GUI: Implemented "Recheck all files" button (#3614), renamed "Recheck files" button to "Recheck modified files" (#3624)
This commit is contained in:
parent
dcb746a49a
commit
6dcb918b78
|
@ -11,6 +11,7 @@
|
||||||
<file>images/preferences-system.png</file>
|
<file>images/preferences-system.png</file>
|
||||||
<file>images/process-stop.png</file>
|
<file>images/process-stop.png</file>
|
||||||
<file>images/text-x-generic.png</file>
|
<file>images/text-x-generic.png</file>
|
||||||
|
<file>images/view-recheck.png</file>
|
||||||
<file>images/view-refresh.png</file>
|
<file>images/view-refresh.png</file>
|
||||||
<file>images/showerrors.png</file>
|
<file>images/showerrors.png</file>
|
||||||
<file>images/showstylewarnings.png</file>
|
<file>images/showstylewarnings.png</file>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 894 B |
19
gui/main.ui
19
gui/main.ui
|
@ -148,7 +148,8 @@
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="mActionCheckFiles"/>
|
<addaction name="mActionCheckFiles"/>
|
||||||
<addaction name="mActionCheckDirectory"/>
|
<addaction name="mActionCheckDirectory"/>
|
||||||
<addaction name="mActionRecheck"/>
|
<addaction name="mActionRecheckModified"/>
|
||||||
|
<addaction name="mActionRecheckAll"/>
|
||||||
<addaction name="mActionStop"/>
|
<addaction name="mActionStop"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="menuC_standard"/>
|
<addaction name="menuC_standard"/>
|
||||||
|
@ -188,7 +189,8 @@
|
||||||
<addaction name="mActionOpenProjectFile"/>
|
<addaction name="mActionOpenProjectFile"/>
|
||||||
<addaction name="mActionShowScratchpad"/>
|
<addaction name="mActionShowScratchpad"/>
|
||||||
<addaction name="mActionSave"/>
|
<addaction name="mActionSave"/>
|
||||||
<addaction name="mActionRecheck"/>
|
<addaction name="mActionRecheckModified"/>
|
||||||
|
<addaction name="mActionRecheckAll"/>
|
||||||
<addaction name="mActionStop"/>
|
<addaction name="mActionStop"/>
|
||||||
<addaction name="mActionClearResults"/>
|
<addaction name="mActionClearResults"/>
|
||||||
<addaction name="mActionSettings"/>
|
<addaction name="mActionSettings"/>
|
||||||
|
@ -273,18 +275,27 @@
|
||||||
<string>Ctrl+D</string>
|
<string>Ctrl+D</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="mActionRecheck">
|
<action name="mActionRecheckModified">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="gui.qrc">
|
<iconset resource="gui.qrc">
|
||||||
<normaloff>:/images/view-refresh.png</normaloff>:/images/view-refresh.png</iconset>
|
<normaloff>:/images/view-refresh.png</normaloff>:/images/view-refresh.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Recheck files</string>
|
<string>&Recheck modified files</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Ctrl+R</string>
|
<string>Ctrl+R</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="mActionRecheckAll">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="gui.qrc">
|
||||||
|
<normaloff>:/images/view-recheck.png</normaloff>:/images/view-recheck.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Recheck all files</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="mActionStop">
|
<action name="mActionStop">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="gui.qrc">
|
<iconset resource="gui.qrc">
|
||||||
|
|
|
@ -103,7 +103,8 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
|
||||||
connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(ShowStatistics()));
|
connect(mUI.mActionViewStats, SIGNAL(triggered()), this, SLOT(ShowStatistics()));
|
||||||
connect(mUI.mActionLibraryEditor, SIGNAL(triggered()), this, SLOT(ShowLibraryEditor()));
|
connect(mUI.mActionLibraryEditor, SIGNAL(triggered()), this, SLOT(ShowLibraryEditor()));
|
||||||
|
|
||||||
connect(mUI.mActionRecheck, SIGNAL(triggered()), this, SLOT(ReCheck()));
|
connect(mUI.mActionRecheckModified, SIGNAL(triggered()), this, SLOT(ReCheckModified()));
|
||||||
|
connect(mUI.mActionRecheckAll, SIGNAL(triggered()), this, SLOT(ReCheckAll()));
|
||||||
|
|
||||||
connect(mUI.mActionStop, SIGNAL(triggered()), this, SLOT(StopChecking()));
|
connect(mUI.mActionStop, SIGNAL(triggered()), this, SLOT(StopChecking()));
|
||||||
connect(mUI.mActionSave, SIGNAL(triggered()), this, SLOT(Save()));
|
connect(mUI.mActionSave, SIGNAL(triggered()), this, SLOT(Save()));
|
||||||
|
@ -144,7 +145,8 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
|
||||||
mUI.mActionPrintPreview->setEnabled(false);
|
mUI.mActionPrintPreview->setEnabled(false);
|
||||||
mUI.mActionClearResults->setEnabled(false);
|
mUI.mActionClearResults->setEnabled(false);
|
||||||
mUI.mActionSave->setEnabled(false);
|
mUI.mActionSave->setEnabled(false);
|
||||||
mUI.mActionRecheck->setEnabled(false);
|
mUI.mActionRecheckModified->setEnabled(false);
|
||||||
|
mUI.mActionRecheckAll->setEnabled(false);
|
||||||
EnableProjectOpenActions(true);
|
EnableProjectOpenActions(true);
|
||||||
EnableProjectActions(false);
|
EnableProjectActions(false);
|
||||||
|
|
||||||
|
@ -776,14 +778,24 @@ void MainWindow::ProgramSettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ReCheck()
|
void MainWindow::ReCheckModified()
|
||||||
{
|
{
|
||||||
const QStringList files = mThread->GetReCheckFiles();
|
ReCheck(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ReCheckAll()
|
||||||
|
{
|
||||||
|
ReCheck(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ReCheck(bool all)
|
||||||
|
{
|
||||||
|
const QStringList files = mThread->GetReCheckFiles(all);
|
||||||
if (files.empty())
|
if (files.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Clear details, statistics and progress
|
// Clear details, statistics and progress
|
||||||
mUI.mResults->Clear(false);
|
mUI.mResults->Clear(all);
|
||||||
|
|
||||||
// Clear results for changed files
|
// Clear results for changed files
|
||||||
for (int i = 0; i < files.size(); ++i)
|
for (int i = 0; i < files.size(); ++i)
|
||||||
|
@ -795,7 +807,7 @@ void MainWindow::ReCheck()
|
||||||
if (mProject)
|
if (mProject)
|
||||||
qDebug() << "Rechecking project file" << mProject->GetProjectFile()->GetFilename();
|
qDebug() << "Rechecking project file" << mProject->GetProjectFile()->GetFilename();
|
||||||
|
|
||||||
mThread->Check(GetCppcheckSettings(), true);
|
mThread->Check(GetCppcheckSettings(), !all);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ClearResults()
|
void MainWindow::ClearResults()
|
||||||
|
@ -859,8 +871,10 @@ void MainWindow::EnableCheckButtons(bool enable)
|
||||||
mUI.mActionStop->setEnabled(!enable);
|
mUI.mActionStop->setEnabled(!enable);
|
||||||
mUI.mActionCheckFiles->setEnabled(enable);
|
mUI.mActionCheckFiles->setEnabled(enable);
|
||||||
|
|
||||||
if (!enable || mThread->HasPreviousFiles())
|
if (!enable || mThread->HasPreviousFiles()) {
|
||||||
mUI.mActionRecheck->setEnabled(enable);
|
mUI.mActionRecheckModified->setEnabled(enable);
|
||||||
|
mUI.mActionRecheckAll->setEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
mUI.mActionCheckDirectory->setEnabled(enable);
|
mUI.mActionCheckDirectory->setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,10 +79,16 @@ public slots:
|
||||||
void CheckFiles();
|
void CheckFiles();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Slot to recheck files
|
* @brief Slot to recheck all files
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void ReCheck();
|
void ReCheckAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Slot to recheck modified files
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void ReCheckModified();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Slot to clear all search results
|
* @brief Slot to clear all search results
|
||||||
|
@ -307,6 +313,12 @@ protected slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Rechecks files
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void ReCheck(bool all);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check the project.
|
* @brief Check the project.
|
||||||
* @param project Pointer to the project to check.
|
* @param project Pointer to the project to check.
|
||||||
|
|
|
@ -55,7 +55,7 @@ void ThreadHandler::Check(const Settings &settings, bool recheck)
|
||||||
{
|
{
|
||||||
if (recheck && mRunningThreadCount == 0) {
|
if (recheck && mRunningThreadCount == 0) {
|
||||||
// only recheck changed files
|
// only recheck changed files
|
||||||
mResults.SetFiles(GetReCheckFiles());
|
mResults.SetFiles(GetReCheckFiles(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mResults.GetFileCount() == 0 || mRunningThreadCount > 0 || settings._jobs == 0) {
|
if (mResults.GetFileCount() == 0 || mRunningThreadCount > 0 || settings._jobs == 0) {
|
||||||
|
@ -188,7 +188,7 @@ int ThreadHandler::GetPreviousScanDuration() const
|
||||||
return mScanDuration;
|
return mScanDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ThreadHandler::GetReCheckFiles() const
|
QStringList ThreadHandler::GetReCheckFiles(bool all) const
|
||||||
{
|
{
|
||||||
if (mLastCheckTime.isNull())
|
if (mLastCheckTime.isNull())
|
||||||
return mLastFiles;
|
return mLastFiles;
|
||||||
|
|
|
@ -123,7 +123,7 @@ public:
|
||||||
* @brief Get files that should be rechecked because they have been
|
* @brief Get files that should be rechecked because they have been
|
||||||
* changed.
|
* changed.
|
||||||
*/
|
*/
|
||||||
QStringList GetReCheckFiles() const;
|
QStringList GetReCheckFiles(bool all) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue