chore: remove Singleton & replace getIApp with getApp (#5514)

This commit is contained in:
pajlada
2024-07-21 15:09:59 +02:00
committed by GitHub
parent 21186df058
commit 5deec1f02f
145 changed files with 802 additions and 856 deletions
+8 -9
View File
@@ -26,8 +26,7 @@ EditHotkeyDialog::EditHotkeyDialog(const std::shared_ptr<Hotkey> hotkey,
this->ui_->easyArgsPicker->setVisible(false);
this->ui_->easyArgsLabel->setVisible(false);
// dynamically add category names to the category picker
for (const auto &[_, hotkeyCategory] :
getIApp()->getHotkeys()->categories())
for (const auto &[_, hotkeyCategory] : getApp()->getHotkeys()->categories())
{
this->ui_->categoryPicker->addItem(hotkeyCategory.displayName,
hotkeyCategory.name);
@@ -154,7 +153,7 @@ void EditHotkeyDialog::afterEdit()
auto arguments =
parseHotkeyArguments(this->ui_->argumentsEdit->toPlainText());
auto category = getIApp()->getHotkeys()->hotkeyCategoryFromName(
auto category = getApp()->getHotkeys()->hotkeyCategoryFromName(
this->ui_->categoryPicker->currentData().toString());
if (!category)
{
@@ -166,7 +165,7 @@ void EditHotkeyDialog::afterEdit()
// check if another hotkey with this name exists, accounts for editing a hotkey
bool isEditing = bool(this->data_);
if (getIApp()->getHotkeys()->getHotkeyByName(nameText))
if (getApp()->getHotkeys()->getHotkeyByName(nameText))
{
// A hotkey with this name already exists
if (isEditing && this->data()->name() == nameText)
@@ -243,8 +242,8 @@ void EditHotkeyDialog::afterEdit()
{
if (keyComboWasEdited || nameWasEdited)
{
if (getIApp()->getHotkeys()->isDuplicate(hotkey,
this->data()->name()))
if (getApp()->getHotkeys()->isDuplicate(hotkey,
this->data()->name()))
{
this->showEditError(
"Keybinding needs to be unique in the category.");
@@ -254,7 +253,7 @@ void EditHotkeyDialog::afterEdit()
}
else
{
if (getIApp()->getHotkeys()->isDuplicate(hotkey, QString()))
if (getApp()->getHotkeys()->isDuplicate(hotkey, QString()))
{
this->showEditError(
"Keybinding needs to be unique in the category.");
@@ -268,7 +267,7 @@ void EditHotkeyDialog::afterEdit()
void EditHotkeyDialog::updatePossibleActions()
{
const auto &hotkeys = getIApp()->getHotkeys();
const auto &hotkeys = getApp()->getHotkeys();
auto category = hotkeys->hotkeyCategoryFromName(
this->ui_->categoryPicker->currentData().toString());
if (!category)
@@ -320,7 +319,7 @@ void EditHotkeyDialog::updateArgumentsInput()
this->ui_->argumentsEdit->setEnabled(true);
return;
}
const auto &hotkeys = getIApp()->getHotkeys();
const auto &hotkeys = getApp()->getHotkeys();
auto category = hotkeys->hotkeyCategoryFromName(
this->ui_->categoryPicker->currentData().toString());
if (!category)