@@ -30,13 +30,17 @@ MainWindow::MainWindow() :
3030 mSettings(tr(" CppCheck" ), tr(" CppCheck-GUI" )),
3131 mActionExit(tr(" E&xit" ), this),
3232 mActionCheckFiles(tr(" &Check files(s)" ), this),
33- mActionCheckDirectory(tr(" &Check directory" ), this),
33+ mActionClearResults(tr(" Clear &results" ), this),
34+ mActionReCheck(tr(" Recheck files" ), this),
35+ mActionCheckDirectory(tr(" Check &directory" ), this),
3436 mActionSettings(tr(" &Settings" ), this),
3537 mResults(mSettings )
3638{
3739 QMenu *menu = menuBar ()->addMenu (tr (" &File" ));
3840 menu->addAction (&mActionCheckFiles );
3941 menu->addAction (&mActionCheckDirectory );
42+ menu->addAction (&mActionReCheck );
43+ menu->addAction (&mActionClearResults );
4044 menu->addSeparator ();
4145 menu->addAction (&mActionExit );
4246
@@ -50,6 +54,8 @@ MainWindow::MainWindow() :
5054 connect (&mActionCheckFiles , SIGNAL (triggered ()), this , SLOT (CheckFiles ()));
5155 connect (&mActionCheckDirectory , SIGNAL (triggered ()), this , SLOT (CheckDirectory ()));
5256 connect (&mActionSettings , SIGNAL (triggered ()), this , SLOT (ProgramSettings ()));
57+ connect (&mActionClearResults , SIGNAL (triggered ()), this , SLOT (ClearResults ()));
58+ connect (&mActionReCheck , SIGNAL (triggered ()), this , SLOT (ReCheck ()));
5359 connect (&mThread , SIGNAL (Done ()), this , SLOT (CheckDone ()));
5460 LoadSettings ();
5561 mThread .Initialize (&mResults );
@@ -102,8 +108,8 @@ void MainWindow::DoCheckFiles(QFileDialog::FileMode mode)
102108 mThread .ClearFiles ();
103109 mThread .SetFiles (RemoveUnacceptedFiles (fileNames));
104110 mSettings .setValue (tr (" Check path" ), dialog.directory ().absolutePath ());
105- mActionCheckFiles . setDisabled ( true );
106- mThread .Check (GetCppCheckSettings ());
111+ EnableCheckButtons ( false );
112+ mThread .Check (GetCppCheckSettings (), false );
107113 }
108114}
109115
@@ -125,7 +131,7 @@ Settings MainWindow::GetCppCheckSettings()
125131 result._checkCodingStyle = true ;
126132 result._errorsOnly = false ;
127133 result._verbose = true ;
128- result._force = true ;
134+ result._force = mSettings . value ( tr ( " Check force " ), 1 ). toBool () ;
129135 result._xml = false ;
130136 result._unusedFunctions = true ;
131137 result._security = true ;
@@ -186,7 +192,7 @@ QStringList MainWindow::RemoveUnacceptedFiles(const QStringList &list)
186192
187193void MainWindow::CheckDone ()
188194{
189- mActionCheckFiles . setDisabled ( false );
195+ EnableCheckButtons ( true );
190196}
191197
192198void MainWindow::ProgramSettings ()
@@ -198,3 +204,23 @@ void MainWindow::ProgramSettings()
198204 }
199205}
200206
207+
208+ void MainWindow::ReCheck ()
209+ {
210+ ClearResults ();
211+ EnableCheckButtons (false );
212+ mThread .Check (GetCppCheckSettings (), true );
213+ }
214+
215+ void MainWindow::ClearResults ()
216+ {
217+ mResults .Clear ();
218+ }
219+
220+ void MainWindow::EnableCheckButtons (bool enable)
221+ {
222+ mActionCheckFiles .setEnabled (enable);
223+ mActionReCheck .setEnabled (enable);
224+ mActionCheckDirectory .setEnabled (enable);
225+ }
226+
0 commit comments