summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2020-06-01 12:14:45 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2020-06-02 11:37:56 (GMT)
commited2fe558b03e006d708c0fb210f218d9a80ffc01 (patch)
treefa065408e1c2d5f55ccd05eb96b27cebcdbaf2f0
parent44f1744bed50e6ef47b179810a7533538b31722b (diff)
downloadCMake-ed2fe558b03e006d708c0fb210f218d9a80ffc01.zip
CMake-ed2fe558b03e006d708c0fb210f218d9a80ffc01.tar.gz
CMake-ed2fe558b03e006d708c0fb210f218d9a80ffc01.tar.bz2
CursesDialog: resolve clang-tidy warnings
Fixes: - unnecessary bool expression (cmCursesMainForm) - removes a duplicate if/else branch (RegexExplorer) - collapses redundant if/else branch logic (CMakeSetupDialog and cmCursesStringWidget)
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx6
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx10
-rw-r--r--Source/QtDialog/CMakeSetupDialog.cxx9
-rw-r--r--Source/QtDialog/RegexExplorer.cxx3
4 files changed, 6 insertions, 22 deletions
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index df34283..ce1a715 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -853,11 +853,7 @@ void cmCursesMainForm::HandleInput()
}
// switch advanced on/off
else if (key == 't') {
- if (this->AdvancedMode) {
- this->AdvancedMode = false;
- } else {
- this->AdvancedMode = true;
- }
+ this->AdvancedMode = !this->AdvancedMode;
getmaxyx(stdscr, y, x);
this->RePost();
this->Render(1, 1, x, y);
diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx
index c629478..4830d63 100644
--- a/Source/CursesDialog/cmCursesStringWidget.cxx
+++ b/Source/CursesDialog/cmCursesStringWidget.cxx
@@ -105,12 +105,10 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
if (!this->InEdit && (key != 10 && key != KEY_ENTER && key != 'i')) {
return false;
}
- // enter edit with return and i (vim binding)
- if (!this->InEdit && (key == 10 || key == KEY_ENTER || key == 'i')) {
- this->OnReturn(fm, w);
- }
- // leave edit with return (but not i -- not a toggle)
- else if (this->InEdit && (key == 10 || key == KEY_ENTER)) {
+ // toggle edit with return
+ if ((key == 10 || key == KEY_ENTER)
+ // enter edit with i (and not-edit mode)
+ || (!this->InEdit && key == 'i')) {
this->OnReturn(fm, w);
} else if (key == KEY_DOWN || key == ctrl('n') || key == KEY_UP ||
key == ctrl('p') || key == KEY_NPAGE || key == ctrl('d') ||
diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 5916a96..6dbfe11 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -1060,14 +1060,7 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
this->GenerateAction->setEnabled(false);
this->OpenProjectButton->setEnabled(false);
this->GenerateButton->setText(tr("&Stop"));
- } else if (s == ReadyConfigure) {
- this->setEnabledState(true);
- this->GenerateButton->setEnabled(true);
- this->GenerateAction->setEnabled(true);
- this->ConfigureButton->setEnabled(true);
- this->ConfigureButton->setText(tr("&Configure"));
- this->GenerateButton->setText(tr("&Generate"));
- } else if (s == ReadyGenerate) {
+ } else if (s == ReadyConfigure || s == ReadyGenerate) {
this->setEnabledState(true);
this->GenerateButton->setEnabled(true);
this->GenerateAction->setEnabled(true);
diff --git a/Source/QtDialog/RegexExplorer.cxx b/Source/QtDialog/RegexExplorer.cxx
index 746fd8a..6194940 100644
--- a/Source/QtDialog/RegexExplorer.cxx
+++ b/Source/QtDialog/RegexExplorer.cxx
@@ -147,9 +147,6 @@ bool RegexExplorer::stripEscapes(std::string& source)
} else if (nextc == 'n') {
result.append(1, '\n');
in++;
- } else if (nextc == 't') {
- result.append(1, '\t');
- in++;
} else if (isalnum(nextc) || nextc == '\0') {
return false;
} else {