diff --git a/src/blackgui/components/hotkeydialog.cpp b/src/blackgui/components/hotkeydialog.cpp index 3fa6b7151..2e6d865a4 100644 --- a/src/blackgui/components/hotkeydialog.cpp +++ b/src/blackgui/components/hotkeydialog.cpp @@ -72,21 +72,21 @@ namespace BlackGui m_inputManager = BlackCore::CInputManager::instance(); ui->setupUi(this); - ui->advancedFrame->hide(); + ui->qf_Advanced->hide(); - ui->tv_actions->setModel(&m_actionModel); - ui->pb_advancedMode->setIcon(BlackMisc::CIcons::arrowMediumSouth16()); + ui->tv_Actions->setModel(&m_actionModel); + ui->pb_AdvancedMode->setIcon(BlackMisc::CIcons::arrowMediumSouth16()); selectAction(); - if (!actionHotkey.getCombination().isEmpty()) { ui->pb_selectedHotkey->setText(actionHotkey.getCombination().toQString()); } + if (!actionHotkey.getCombination().isEmpty()) { ui->pb_SelectedHotkey->setText(actionHotkey.getCombination().toQString()); } - connect(ui->pb_advancedMode, &QPushButton::clicked, this, &CHotkeyDialog::ps_advancedModeChanged); - connect(ui->pb_selectedHotkey, &QPushButton::clicked, this, &CHotkeyDialog::ps_selectHotkey); - connect(ui->pb_accept, &QPushButton::clicked, this, &CHotkeyDialog::ps_accept); - connect(ui->pb_cancel, &QPushButton::clicked, this, &CHotkeyDialog::reject); + connect(ui->pb_AdvancedMode, &QPushButton::clicked, this, &CHotkeyDialog::ps_advancedModeChanged); + connect(ui->pb_SelectedHotkey, &QPushButton::clicked, this, &CHotkeyDialog::ps_selectHotkey); + connect(ui->pb_Accept, &QPushButton::clicked, this, &CHotkeyDialog::ps_accept); + connect(ui->pb_Cancel, &QPushButton::clicked, this, &CHotkeyDialog::reject); connect(m_inputManager, &BlackCore::CInputManager::combinationSelectionChanged, this, &CHotkeyDialog::ps_combinationSelectionChanged); connect(m_inputManager, &BlackCore::CInputManager::combinationSelectionFinished, this, &CHotkeyDialog::ps_combinationSelectionFinished); - connect(ui->tv_actions->selectionModel(), &QItemSelectionModel::selectionChanged, this, &CHotkeyDialog::ps_changeSelectedAction); + connect(ui->tv_Actions->selectionModel(), &QItemSelectionModel::selectionChanged, this, &CHotkeyDialog::ps_changeSelectedAction); initStyleSheet(); } @@ -99,7 +99,7 @@ namespace BlackGui { for (const auto &app : applications) { - ui->cb_identifier->addItem(app.getMachineName(), QVariant::fromValue(app)); + ui->cb_Identifier->addItem(app.getMachineName(), QVariant::fromValue(app)); } } @@ -129,29 +129,29 @@ namespace BlackGui { if (m_actionHotkey.getCombination().isEmpty()) return; - if (!ui->advancedFrame->isVisible()) + if (!ui->qf_Advanced->isVisible()) { setupAdvancedFrame(); - ui->advancedFrame->show(); - ui->pb_advancedMode->setIcon(BlackMisc::CIcons::arrowMediumNorth16()); + ui->qf_Advanced->show(); + ui->pb_AdvancedMode->setIcon(BlackMisc::CIcons::arrowMediumNorth16()); } else { - ui->pb_advancedMode->setIcon(BlackMisc::CIcons::arrowMediumSouth16()); - ui->advancedFrame->hide(); - ui->gb_hotkey->resize(0, 0); + ui->pb_AdvancedMode->setIcon(BlackMisc::CIcons::arrowMediumSouth16()); + ui->qf_Advanced->hide(); + ui->gb_Hotkey->resize(0, 0); } } void CHotkeyDialog::ps_selectHotkey() { - ui->pb_selectedHotkey->setText("Press any key/button..."); + ui->pb_SelectedHotkey->setText("Press any key/button..."); m_inputManager->startCapture(); } void CHotkeyDialog::ps_combinationSelectionChanged(const BlackMisc::Input::CHotkeyCombination &combination) { - ui->pb_selectedHotkey->setText(combination.toFormattedQString()); + ui->pb_SelectedHotkey->setText(combination.toFormattedQString()); } void CHotkeyDialog::ps_combinationSelectionFinished(const BlackMisc::Input::CHotkeyCombination &combination) @@ -171,19 +171,19 @@ namespace BlackGui { if (m_actionHotkey.getApplicableMachine().getMachineName().isEmpty()) { - CLogMessage().validationWarning("Missing %1") << ui->gb_machine->title(); + CLogMessage().validationWarning("Missing %1") << ui->gb_Machine->title(); return; } if (m_actionHotkey.getCombination().isEmpty()) { - CLogMessage().validationWarning("Missing %1") << ui->gb_hotkey->title(); + CLogMessage().validationWarning("Missing %1") << ui->gb_Hotkey->title(); return; } if (m_actionHotkey.getAction().isEmpty()) { - CLogMessage().validationWarning("Missing %1") << ui->gb_action->title(); + CLogMessage().validationWarning("Missing %1") << ui->gb_Action->title(); return; } @@ -198,12 +198,12 @@ namespace BlackGui void CHotkeyDialog::synchronizeSimpleSelection() { - ui->pb_selectedHotkey->setText(m_actionHotkey.getCombination().toFormattedQString()); + ui->pb_SelectedHotkey->setText(m_actionHotkey.getCombination().toFormattedQString()); } void CHotkeyDialog::synchronizeAdvancedSelection() { - if (ui->advancedFrame->isVisible()) { setupAdvancedFrame(); } + if (ui->qf_Advanced->isVisible()) { setupAdvancedFrame(); } } void CHotkeyDialog::setupAdvancedFrame() @@ -217,7 +217,7 @@ namespace BlackGui if (splittedKey == "+") continue; int currentIndex = -1; - CKeySelectionBox *ksb = new CKeySelectionBox(ui->advancedFrame); + CKeySelectionBox *ksb = new CKeySelectionBox(ui->qf_Advanced); for (const auto &supportedKey : allSupportedKeys) { QString supportedKeyAsString = supportedKey.toQString(); @@ -228,8 +228,8 @@ namespace BlackGui } } ksb->setSelectedIndex(currentIndex); - ui->advancedFrame->layout()->addWidget(ksb); - int position = ui->advancedFrame->layout()->count() - 1; + ui->qf_Advanced->layout()->addWidget(ksb); + int position = ui->qf_Advanced->layout()->count() - 1; ksb->setProperty("position", position); connect(ksb, &CKeySelectionBox::keySelectionChanged, this, &CHotkeyDialog::advancedKeyChanged); } @@ -237,7 +237,7 @@ namespace BlackGui void CHotkeyDialog::clearAdvancedFrame() { - QLayout *layout = ui->advancedFrame->layout(); + QLayout *layout = ui->qf_Advanced->layout(); QLayoutItem *child; while ((child = layout->takeAt(0)) != 0) @@ -273,10 +273,10 @@ namespace BlackGui auto indexList = m_actionModel.match(startIndex, Qt::DisplayRole, QVariant::fromValue(token)); if (indexList.isEmpty()) return; parentIndex = indexList.first(); - ui->tv_actions->expand(parentIndex); + ui->tv_Actions->expand(parentIndex); } - QItemSelectionModel *selectionModel = ui->tv_actions->selectionModel(); + QItemSelectionModel *selectionModel = ui->tv_Actions->selectionModel(); selectionModel->select(parentIndex, QItemSelectionModel::Select); } } // ns diff --git a/src/blackgui/components/hotkeydialog.h b/src/blackgui/components/hotkeydialog.h index 8649dbf5b..eeb560556 100644 --- a/src/blackgui/components/hotkeydialog.h +++ b/src/blackgui/components/hotkeydialog.h @@ -70,7 +70,7 @@ namespace BlackGui CHotkeyDialog(const BlackMisc::Input::CActionHotkey &actionHotkey, QWidget *parent = nullptr); //! Destructor - ~CHotkeyDialog(); + virtual ~CHotkeyDialog(); //! Get hotkey selected by user BlackMisc::Input::CActionHotkey getSelectedActionHotkey() const { return m_actionHotkey; } @@ -81,7 +81,7 @@ namespace BlackGui //! Init style sheet void initStyleSheet(); - //! getHotkey runs the hotkey dialog and returns the result + //! Runs the hotkey dialog and returns the result static BlackMisc::Input::CActionHotkey getActionHotkey(const BlackMisc::Input::CActionHotkey &initial, const BlackMisc::CIdentifierList &applications, QWidget *parent = nullptr); diff --git a/src/blackgui/components/hotkeydialog.ui b/src/blackgui/components/hotkeydialog.ui index 8e8fad14f..70b786279 100644 --- a/src/blackgui/components/hotkeydialog.ui +++ b/src/blackgui/components/hotkeydialog.ui @@ -15,25 +15,25 @@ - + Machine - + - + Combination - + 0 @@ -58,7 +58,7 @@ - + Press @@ -68,7 +68,7 @@ - + 0 @@ -81,7 +81,7 @@ - + Qt::Horizontal @@ -94,14 +94,14 @@ - + Release - + true @@ -118,13 +118,13 @@ - + Action - + false @@ -134,7 +134,7 @@ - + Qt::Horizontal @@ -147,14 +147,14 @@ - + Ok - + Cancel diff --git a/src/blackgui/components/settingshotkeycomponent.cpp b/src/blackgui/components/settingshotkeycomponent.cpp index 871d6be47..d959d676f 100644 --- a/src/blackgui/components/settingshotkeycomponent.cpp +++ b/src/blackgui/components/settingshotkeycomponent.cpp @@ -42,14 +42,14 @@ namespace BlackGui ui(new Ui::CSettingsHotkeyComponent) { ui->setupUi(this); - ui->tv_hotkeys->setModel(&m_model); + ui->tv_Hotkeys->setModel(&m_model); - connect(ui->pb_addHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_addEntry); - connect(ui->pb_editHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_editEntry); - connect(ui->pb_removeHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_removeEntry); + connect(ui->pb_AddHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_addEntry); + connect(ui->pb_EditHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_editEntry); + connect(ui->pb_RemoveHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_removeEntry); reloadHotkeysFromSettings(); - ui->tv_hotkeys->selectRow(0); + ui->tv_Hotkeys->selectRow(0); } CSettingsHotkeyComponent::~CSettingsHotkeyComponent() @@ -75,10 +75,10 @@ namespace BlackGui void CSettingsHotkeyComponent::ps_editEntry() { - auto index = ui->tv_hotkeys->selectionModel()->currentIndex(); + auto index = ui->tv_Hotkeys->selectionModel()->currentIndex(); if (!index.isValid()) return; - const auto model = ui->tv_hotkeys->model(); + const auto model = ui->tv_Hotkeys->model(); const QModelIndex indexHotkey = model->index(index.row(), 0, QModelIndex()); Q_ASSERT(indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).canConvert()); CActionHotkey actionHotkey = indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).value(); @@ -96,7 +96,7 @@ namespace BlackGui void CSettingsHotkeyComponent::ps_removeEntry() { - QModelIndexList indexes = ui->tv_hotkeys->selectionModel()->selectedRows(); + QModelIndexList indexes = ui->tv_Hotkeys->selectionModel()->selectedRows(); for (const auto &index : indexes) { CActionHotkey actionHotkey = index.data(CActionHotkeyListModel::ActionHotkeyRole).value(); @@ -165,7 +165,7 @@ namespace BlackGui void CSettingsHotkeyComponent::ps_hotkeySlot(bool keyDown) { - if (keyDown) QMessageBox::information(this, "Test", "Push-To-Talk"); + if (keyDown) { QMessageBox::information(this, "Test", "Hotkey test"); } } } // ns } // ns diff --git a/src/blackgui/components/settingshotkeycomponent.h b/src/blackgui/components/settingshotkeycomponent.h index 8d1f809bc..94808ef24 100644 --- a/src/blackgui/components/settingshotkeycomponent.h +++ b/src/blackgui/components/settingshotkeycomponent.h @@ -43,7 +43,7 @@ namespace BlackGui CSettingsHotkeyComponent(QWidget *parent = nullptr); //! Destructor - ~CSettingsHotkeyComponent(); + virtual ~CSettingsHotkeyComponent(); private slots: void ps_addEntry(); diff --git a/src/blackgui/components/settingshotkeycomponent.ui b/src/blackgui/components/settingshotkeycomponent.ui index 306af8e49..5f311b7bd 100644 --- a/src/blackgui/components/settingshotkeycomponent.ui +++ b/src/blackgui/components/settingshotkeycomponent.ui @@ -11,15 +11,9 @@ - sample_hotkeys + Hotkeys - - QFrame::StyledPanel - - - QFrame::Raised - - + 1 @@ -30,21 +24,21 @@ 1 - + Add - + Edit - + Remove @@ -64,7 +58,10 @@ - + + + QAbstractScrollArea::AdjustToContents + QAbstractItemView::SingleSelection @@ -77,9 +74,6 @@ false - - false -