forked from qt-creator/qt-creator
ClangTools: Show hint when disabling "Build the project before analysis."
Show also the same hint as a tooltip. Fixes: QTCREATORBUG-22382 Change-Id: If1b594994cea387d6727775ce4c28c21d51f2d86 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -295,6 +295,7 @@ SelectableFilesDialog::SelectableFilesDialog(const ProjectInfo &projectInfo,
|
|||||||
CppTools::ClangDiagnosticConfigsSelectionWidget *diagnosticConfigsSelectionWidget
|
CppTools::ClangDiagnosticConfigsSelectionWidget *diagnosticConfigsSelectionWidget
|
||||||
= m_ui->clangToolsBasicSettings->ui()->clangDiagnosticConfigsSelectionWidget;
|
= m_ui->clangToolsBasicSettings->ui()->clangDiagnosticConfigsSelectionWidget;
|
||||||
QCheckBox *buildBeforeAnalysis = m_ui->clangToolsBasicSettings->ui()->buildBeforeAnalysis;
|
QCheckBox *buildBeforeAnalysis = m_ui->clangToolsBasicSettings->ui()->buildBeforeAnalysis;
|
||||||
|
buildBeforeAnalysis->setToolTip(hintAboutBuildBeforeAnalysis());
|
||||||
|
|
||||||
ClangToolsProjectSettings *settings = ClangToolsProjectSettingsManager::getSettings(m_project);
|
ClangToolsProjectSettings *settings = ClangToolsProjectSettingsManager::getSettings(m_project);
|
||||||
m_customDiagnosticConfig = diagnosticConfiguration(settings);
|
m_customDiagnosticConfig = diagnosticConfiguration(settings);
|
||||||
@@ -337,6 +338,8 @@ SelectableFilesDialog::SelectableFilesDialog(const ProjectInfo &projectInfo,
|
|||||||
m_customDiagnosticConfig = currentConfigId;
|
m_customDiagnosticConfig = currentConfigId;
|
||||||
});
|
});
|
||||||
connect(buildBeforeAnalysis, &QCheckBox::toggled, [this](bool checked) {
|
connect(buildBeforeAnalysis, &QCheckBox::toggled, [this](bool checked) {
|
||||||
|
if (!checked)
|
||||||
|
showHintAboutBuildBeforeAnalysis();
|
||||||
if (m_ui->globalOrCustom->currentIndex() == CustomSettings)
|
if (m_ui->globalOrCustom->currentIndex() == CustomSettings)
|
||||||
m_buildBeforeAnalysis = checked;
|
m_buildBeforeAnalysis = checked;
|
||||||
});
|
});
|
||||||
|
@@ -56,9 +56,12 @@ ClangToolsConfigWidget::ClangToolsConfigWidget(
|
|||||||
[settings](int count) { settings->setSimultaneousProcesses(count); });
|
[settings](int count) { settings->setSimultaneousProcesses(count); });
|
||||||
|
|
||||||
QCheckBox *buildBeforeAnalysis = m_ui->clangToolsBasicSettings->ui()->buildBeforeAnalysis;
|
QCheckBox *buildBeforeAnalysis = m_ui->clangToolsBasicSettings->ui()->buildBeforeAnalysis;
|
||||||
|
buildBeforeAnalysis->setToolTip(hintAboutBuildBeforeAnalysis());
|
||||||
buildBeforeAnalysis->setCheckState(settings->savedBuildBeforeAnalysis()
|
buildBeforeAnalysis->setCheckState(settings->savedBuildBeforeAnalysis()
|
||||||
? Qt::Checked : Qt::Unchecked);
|
? Qt::Checked : Qt::Unchecked);
|
||||||
connect(buildBeforeAnalysis, &QCheckBox::toggled, [settings](bool checked) {
|
connect(buildBeforeAnalysis, &QCheckBox::toggled, [settings](bool checked) {
|
||||||
|
if (!checked)
|
||||||
|
showHintAboutBuildBeforeAnalysis();
|
||||||
settings->setBuildBeforeAnalysis(checked);
|
settings->setBuildBeforeAnalysis(checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "clangtoolsutils.h"
|
#include "clangtoolsutils.h"
|
||||||
|
|
||||||
|
#include "clangtool.h"
|
||||||
#include "clangtoolsdiagnostic.h"
|
#include "clangtoolsdiagnostic.h"
|
||||||
#include "clangtoolssettings.h"
|
#include "clangtoolssettings.h"
|
||||||
|
|
||||||
@@ -32,8 +33,9 @@
|
|||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/checkablemessagebox.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/synchronousprocess.h>
|
#include <utils/synchronousprocess.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -49,5 +51,24 @@ QString createFullLocationString(const Debugger::DiagnosticLocation &location)
|
|||||||
+ QLatin1Char(':') + QString::number(location.column);
|
+ QLatin1Char(':') + QString::number(location.column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString hintAboutBuildBeforeAnalysis()
|
||||||
|
{
|
||||||
|
return ClangTool::tr(
|
||||||
|
"In general, the project should be built before starting the analysis to ensure that the "
|
||||||
|
"code to analyze is valid.<br/><br/>"
|
||||||
|
"Building the project might also run code generators that update the source files as "
|
||||||
|
"necessary.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void showHintAboutBuildBeforeAnalysis()
|
||||||
|
{
|
||||||
|
Utils::CheckableMessageBox::doNotShowAgainInformation(
|
||||||
|
Core::ICore::dialogParent(),
|
||||||
|
ClangTool::tr("Info About Build the Project Before Analysis"),
|
||||||
|
hintAboutBuildBeforeAnalysis(),
|
||||||
|
Core::ICore::settings(),
|
||||||
|
"ClangToolsDisablingBuildBeforeAnalysisHint");
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace ClangTools
|
} // namespace ClangTools
|
||||||
|
@@ -41,5 +41,8 @@ namespace Internal {
|
|||||||
|
|
||||||
QString createFullLocationString(const Debugger::DiagnosticLocation &location);
|
QString createFullLocationString(const Debugger::DiagnosticLocation &location);
|
||||||
|
|
||||||
|
QString hintAboutBuildBeforeAnalysis();
|
||||||
|
void showHintAboutBuildBeforeAnalysis();
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace ClangTools
|
} // namespace ClangTools
|
||||||
|
Reference in New Issue
Block a user