diff --git a/src/lib/gui/dialogs/ScreenSettingsDialog.cpp b/src/lib/gui/dialogs/ScreenSettingsDialog.cpp index 2ba9b20b5..8112a3864 100644 --- a/src/lib/gui/dialogs/ScreenSettingsDialog.cpp +++ b/src/lib/gui/dialogs/ScreenSettingsDialog.cpp @@ -23,52 +23,52 @@ using enum ScreenConfig::Fix; ScreenSettingsDialog::~ScreenSettingsDialog() = default; -ScreenSettingsDialog::ScreenSettingsDialog(QWidget *parent, Screen *pScreen, const ScreenList *pScreens) +ScreenSettingsDialog::ScreenSettingsDialog(QWidget *parent, Screen *screen, const ScreenList *screens) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), ui{std::make_unique()}, - m_pScreen(pScreen) + m_screen(screen) { ui->setupUi(this); - ui->m_pButtonBox->button(QDialogButtonBox::Cancel)->setFocus(); + ui->buttonBox->button(QDialogButtonBox::Cancel)->setFocus(); - ui->m_pLabelAliasError->setStyleSheet(kStyleErrorActiveLabel); - ui->m_pLabelNameError->setStyleSheet(kStyleErrorActiveLabel); + ui->lblAliasError->setStyleSheet(kStyleErrorActiveLabel); + ui->lblNameError->setStyleSheet(kStyleErrorActiveLabel); - ui->m_pLineEditName->setText(m_pScreen->name()); + ui->lineNameEdit->setText(m_screen->name()); - const auto valNameError = new validators::ValidationError(this, ui->m_pLabelNameError); - const auto valName = new validators::ScreenNameValidator(ui->m_pLineEditName, valNameError, pScreens); - ui->m_pLineEditName->setValidator(valName); + const auto valNameError = new validators::ValidationError(this, ui->lblNameError); + const auto valName = new validators::ScreenNameValidator(ui->lineNameEdit, valNameError, screens); + ui->lineNameEdit->setValidator(valName); - const auto valAliasError = new validators::ValidationError(this, ui->m_pLabelAliasError); - const auto valAlias = new validators::AliasValidator(ui->m_pLineEditAlias, valAliasError); - ui->m_pLineEditAlias->setValidator(valAlias); + const auto valAliasError = new validators::ValidationError(this, ui->lblAliasError); + const auto valAlias = new validators::AliasValidator(ui->lineAddAlias, valAliasError); + ui->lineAddAlias->setValidator(valAlias); - for (int i = 0; i < m_pScreen->aliases().count(); i++) - new QListWidgetItem(m_pScreen->aliases()[i], ui->m_pListAliases); + for (int i = 0; i < m_screen->aliases().count(); i++) + new QListWidgetItem(m_screen->aliases()[i], ui->listAliases); - ui->m_pComboBoxShift->setCurrentIndex(m_pScreen->modifier(static_cast(Shift))); - ui->m_pComboBoxCtrl->setCurrentIndex(m_pScreen->modifier(static_cast(Ctrl))); - ui->m_pComboBoxAlt->setCurrentIndex(m_pScreen->modifier(static_cast(Alt))); - ui->m_pComboBoxMeta->setCurrentIndex(m_pScreen->modifier(static_cast(Meta))); - ui->m_pComboBoxSuper->setCurrentIndex(m_pScreen->modifier(static_cast(Super))); + ui->comboShift->setCurrentIndex(m_screen->modifier(static_cast(Shift))); + ui->comboCtrl->setCurrentIndex(m_screen->modifier(static_cast(Ctrl))); + ui->comboAlt->setCurrentIndex(m_screen->modifier(static_cast(Alt))); + ui->comboMeta->setCurrentIndex(m_screen->modifier(static_cast(Meta))); + ui->comboSuper->setCurrentIndex(m_screen->modifier(static_cast(Super))); - ui->m_pCheckBoxCornerTopLeft->setChecked(m_pScreen->switchCorner(static_cast(TopLeft))); - ui->m_pCheckBoxCornerTopRight->setChecked(m_pScreen->switchCorner(static_cast(TopRight))); - ui->m_pCheckBoxCornerBottomLeft->setChecked(m_pScreen->switchCorner(static_cast(BottomLeft))); - ui->m_pCheckBoxCornerBottomRight->setChecked(m_pScreen->switchCorner(static_cast(BottomRight))); - ui->m_pSpinBoxSwitchCornerSize->setValue(m_pScreen->switchCornerSize()); + ui->chkDeadTopLeft->setChecked(m_screen->switchCorner(static_cast(TopLeft))); + ui->chkDeadTopRight->setChecked(m_screen->switchCorner(static_cast(TopRight))); + ui->chkDeadBottomLeft->setChecked(m_screen->switchCorner(static_cast(BottomLeft))); + ui->chkDeadBottomRight->setChecked(m_screen->switchCorner(static_cast(BottomRight))); + ui->sbSwitchCornerSize->setValue(m_screen->switchCornerSize()); - ui->m_pCheckBoxCapsLock->setChecked(m_pScreen->fix(CapsLock)); - ui->m_pCheckBoxNumLock->setChecked(m_pScreen->fix(NumLock)); - ui->m_pCheckBoxScrollLock->setChecked(m_pScreen->fix(ScrollLock)); - ui->m_pCheckBoxXTest->setChecked(m_pScreen->fix(XTest)); + ui->chkFixCapsLock->setChecked(m_screen->fix(CapsLock)); + ui->chkFixNumLock->setChecked(m_screen->fix(NumLock)); + ui->chkFixScrollLock->setChecked(m_screen->fix(ScrollLock)); + ui->chkFixXTest->setChecked(m_screen->fix(XTest)); } void ScreenSettingsDialog::accept() { - if (ui->m_pLineEditName->text().isEmpty()) { + if (ui->lineNameEdit->text().isEmpty()) { QMessageBox::warning( this, tr("Screen name is empty"), tr("The screen name cannot be empty. " @@ -76,15 +76,15 @@ void ScreenSettingsDialog::accept() ); return; } - if (!ui->m_pLabelNameError->text().isEmpty()) { + if (!ui->lblNameError->text().isEmpty()) { return; } - m_pScreen->setName(ui->m_pLineEditName->text()); + m_screen->setName(ui->lineNameEdit->text()); - for (int i = 0; i < ui->m_pListAliases->count(); i++) { - QString alias(ui->m_pListAliases->item(i)->text()); - if (alias == ui->m_pLineEditName->text()) { + for (int i = 0; i < ui->listAliases->count(); i++) { + QString alias(ui->listAliases->item(i)->text()); + if (alias == ui->lineNameEdit->text()) { QMessageBox::warning( this, tr("Screen name matches alias"), tr("The screen name cannot be the same as an alias. " @@ -92,50 +92,50 @@ void ScreenSettingsDialog::accept() ); return; } - m_pScreen->addAlias(alias); + m_screen->addAlias(alias); } - m_pScreen->setModifier(Shift, ui->m_pComboBoxShift->currentIndex()); - m_pScreen->setModifier(Ctrl, ui->m_pComboBoxCtrl->currentIndex()); - m_pScreen->setModifier(Alt, ui->m_pComboBoxAlt->currentIndex()); - m_pScreen->setModifier(Meta, ui->m_pComboBoxMeta->currentIndex()); - m_pScreen->setModifier(Super, ui->m_pComboBoxSuper->currentIndex()); + m_screen->setModifier(Shift, ui->comboShift->currentIndex()); + m_screen->setModifier(Ctrl, ui->comboCtrl->currentIndex()); + m_screen->setModifier(Alt, ui->comboAlt->currentIndex()); + m_screen->setModifier(Meta, ui->comboMeta->currentIndex()); + m_screen->setModifier(Super, ui->comboSuper->currentIndex()); - m_pScreen->setSwitchCorner(TopLeft, ui->m_pCheckBoxCornerTopLeft->isChecked()); - m_pScreen->setSwitchCorner(TopRight, ui->m_pCheckBoxCornerTopRight->isChecked()); - m_pScreen->setSwitchCorner(BottomLeft, ui->m_pCheckBoxCornerBottomLeft->isChecked()); - m_pScreen->setSwitchCorner(BottomRight, ui->m_pCheckBoxCornerBottomRight->isChecked()); - m_pScreen->setSwitchCornerSize(ui->m_pSpinBoxSwitchCornerSize->value()); + m_screen->setSwitchCorner(TopLeft, ui->chkDeadTopLeft->isChecked()); + m_screen->setSwitchCorner(TopRight, ui->chkDeadTopRight->isChecked()); + m_screen->setSwitchCorner(BottomLeft, ui->chkDeadBottomLeft->isChecked()); + m_screen->setSwitchCorner(BottomRight, ui->chkDeadBottomRight->isChecked()); + m_screen->setSwitchCornerSize(ui->sbSwitchCornerSize->value()); - m_pScreen->setFix(CapsLock, ui->m_pCheckBoxCapsLock->isChecked()); - m_pScreen->setFix(NumLock, ui->m_pCheckBoxNumLock->isChecked()); - m_pScreen->setFix(ScrollLock, ui->m_pCheckBoxScrollLock->isChecked()); - m_pScreen->setFix(XTest, ui->m_pCheckBoxXTest->isChecked()); + m_screen->setFix(CapsLock, ui->chkFixCapsLock->isChecked()); + m_screen->setFix(NumLock, ui->chkFixNumLock->isChecked()); + m_screen->setFix(ScrollLock, ui->chkFixScrollLock->isChecked()); + m_screen->setFix(XTest, ui->chkFixXTest->isChecked()); QDialog::accept(); } -void ScreenSettingsDialog::on_m_pButtonAddAlias_clicked() +void ScreenSettingsDialog::on_btnAddAlias_clicked() { - if (!ui->m_pLineEditAlias->text().isEmpty() && - ui->m_pListAliases->findItems(ui->m_pLineEditAlias->text(), Qt::MatchFixedString).isEmpty()) { - new QListWidgetItem(ui->m_pLineEditAlias->text(), ui->m_pListAliases); - ui->m_pLineEditAlias->clear(); + if (!ui->lineAddAlias->text().isEmpty() && + ui->listAliases->findItems(ui->lineAddAlias->text(), Qt::MatchFixedString).isEmpty()) { + new QListWidgetItem(ui->lineAddAlias->text(), ui->listAliases); + ui->lineAddAlias->clear(); } } -void ScreenSettingsDialog::on_m_pLineEditAlias_textChanged(const QString &text) +void ScreenSettingsDialog::on_lineAddAlias_textChanged(const QString &text) { - ui->m_pButtonAddAlias->setEnabled(!text.isEmpty() && ui->m_pLabelAliasError->text().isEmpty()); + ui->btnAddAlias->setEnabled(!text.isEmpty() && ui->lblAliasError->text().isEmpty()); } -void ScreenSettingsDialog::on_m_pButtonRemoveAlias_clicked() +void ScreenSettingsDialog::on_btnRemoveAlias_clicked() { - QList items = ui->m_pListAliases->selectedItems(); + QList items = ui->listAliases->selectedItems(); qDeleteAll(items); } -void ScreenSettingsDialog::on_m_pListAliases_itemSelectionChanged() +void ScreenSettingsDialog::on_listAliases_itemSelectionChanged() { - ui->m_pButtonRemoveAlias->setEnabled(!ui->m_pListAliases->selectedItems().isEmpty()); + ui->btnRemoveAlias->setEnabled(!ui->listAliases->selectedItems().isEmpty()); } diff --git a/src/lib/gui/dialogs/ScreenSettingsDialog.h b/src/lib/gui/dialogs/ScreenSettingsDialog.h index a9407a2d4..028ce3853 100644 --- a/src/lib/gui/dialogs/ScreenSettingsDialog.h +++ b/src/lib/gui/dialogs/ScreenSettingsDialog.h @@ -24,19 +24,19 @@ class ScreenSettingsDialog : public QDialog Q_OBJECT public: - explicit ScreenSettingsDialog(QWidget *parent, Screen *pScreen = nullptr, const ScreenList *pScreens = nullptr); + explicit ScreenSettingsDialog(QWidget *parent, Screen *screen = nullptr, const ScreenList *screens = nullptr); ~ScreenSettingsDialog() override; public Q_SLOTS: void accept() override; private Q_SLOTS: - void on_m_pButtonAddAlias_clicked(); - void on_m_pButtonRemoveAlias_clicked(); - void on_m_pLineEditAlias_textChanged(const QString &text); - void on_m_pListAliases_itemSelectionChanged(); + void on_btnAddAlias_clicked(); + void on_btnRemoveAlias_clicked(); + void on_lineAddAlias_textChanged(const QString &text); + void on_listAliases_itemSelectionChanged(); private: std::unique_ptr ui; - Screen *m_pScreen; + Screen *m_screen; }; diff --git a/src/lib/gui/dialogs/ScreenSettingsDialog.ui b/src/lib/gui/dialogs/ScreenSettingsDialog.ui index ba5d62913..65dd43091 100644 --- a/src/lib/gui/dialogs/ScreenSettingsDialog.ui +++ b/src/lib/gui/dialogs/ScreenSettingsDialog.ui @@ -15,7 +15,7 @@ - + 0 @@ -40,12 +40,12 @@ Name - m_pLineEditName + lineNameEdit - + 0 @@ -60,7 +60,7 @@ - + 0 @@ -74,7 +74,7 @@ - m_pLabelNameError + lblNameError Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -85,11 +85,11 @@ - + - + - + Modifier Keys @@ -106,7 +106,7 @@ M&eta - m_pComboBoxMeta + comboMeta @@ -116,7 +116,7 @@ &Ctrl - m_pComboBoxCtrl + comboCtrl @@ -126,7 +126,7 @@ S&uper - m_pComboBoxSuper + comboSuper @@ -136,12 +136,12 @@ Al&t - m_pComboBoxAlt + comboAlt - + 3 @@ -178,7 +178,7 @@ - + Shift @@ -223,12 +223,12 @@ &Shift - m_pComboBoxShift + comboShift - + 2 @@ -265,7 +265,7 @@ - + 4 @@ -302,7 +302,7 @@ - + 1 @@ -342,15 +342,15 @@ - + Dead Corners - + - + 0 @@ -366,7 +366,7 @@ - + 0 @@ -397,7 +397,7 @@ - + @@ -410,12 +410,12 @@ Corner si&ze - m_pSpinBoxSwitchCornerSize + sbSwitchCornerSize - + 0 @@ -446,9 +446,9 @@ - + - + 0 @@ -461,7 +461,7 @@ - + 0 @@ -484,15 +484,15 @@ - + - + Fixes - + 0 @@ -505,7 +505,7 @@ - + 0 @@ -518,7 +518,7 @@ - + 0 @@ -531,7 +531,7 @@ - + 0 @@ -550,7 +550,7 @@ - + 0 @@ -564,7 +564,7 @@ - + 0 @@ -583,7 +583,7 @@ - + true @@ -595,7 +595,7 @@ - + 0 @@ -615,7 +615,7 @@ - m_pLabelNameError + lblAliasError true @@ -623,7 +623,7 @@ - + 0 @@ -648,7 +648,7 @@ - + false @@ -665,7 +665,7 @@ - + 0 @@ -683,30 +683,30 @@ - m_pLineEditName - m_pComboBoxMeta - m_pComboBoxShift - m_pComboBoxCtrl - m_pComboBoxSuper - m_pComboBoxAlt - m_pCheckBoxCornerTopRight - m_pCheckBoxCornerTopLeft - m_pSpinBoxSwitchCornerSize - m_pCheckBoxCornerBottomLeft - m_pCheckBoxCornerBottomRight - m_pCheckBoxScrollLock - m_pCheckBoxCapsLock - m_pCheckBoxNumLock - m_pCheckBoxXTest - m_pLineEditAlias - m_pButtonAddAlias - m_pListAliases - m_pButtonRemoveAlias + lineNameEdit + comboMeta + comboShift + comboCtrl + comboSuper + comboAlt + chkDeadTopLeft + chkDeadTopRight + sbSwitchCornerSize + chkDeadBottomLeft + chkDeadBottomRight + chkFixScrollLock + chkFixCapsLock + chkFixNumLock + chkFixXTest + lineAddAlias + btnAddAlias + listAliases + btnRemoveAlias - m_pButtonBox + buttonBox accepted() ScreenSettingsDialog accept() @@ -722,7 +722,7 @@ - m_pButtonBox + buttonBox rejected() ScreenSettingsDialog reject()