GUI: Rename methods in MainWindow
This commit is contained in:
parent
8bd2531603
commit
213f17e79f
|
@ -136,12 +136,12 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
|
||||||
|
|
||||||
connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents()));
|
connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents()));
|
||||||
|
|
||||||
LoadSettings();
|
loadSettings();
|
||||||
|
|
||||||
mThread->Initialize(mUI.mResults);
|
mThread->Initialize(mUI.mResults);
|
||||||
FormatAndSetTitle();
|
formatAndSetTitle();
|
||||||
|
|
||||||
EnableCheckButtons(true);
|
enableCheckButtons(true);
|
||||||
|
|
||||||
mUI.mActionPrint->setShortcut(QKeySequence::Print);
|
mUI.mActionPrint->setShortcut(QKeySequence::Print);
|
||||||
mUI.mActionPrint->setEnabled(false);
|
mUI.mActionPrint->setEnabled(false);
|
||||||
|
@ -150,8 +150,8 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
|
||||||
mUI.mActionSave->setEnabled(false);
|
mUI.mActionSave->setEnabled(false);
|
||||||
mUI.mActionRecheckModified->setEnabled(false);
|
mUI.mActionRecheckModified->setEnabled(false);
|
||||||
mUI.mActionRecheckAll->setEnabled(false);
|
mUI.mActionRecheckAll->setEnabled(false);
|
||||||
EnableProjectOpenActions(true);
|
enableProjectOpenActions(true);
|
||||||
EnableProjectActions(false);
|
enableProjectActions(false);
|
||||||
|
|
||||||
// Must setup MRU menu before CLI param handling as it can load a
|
// Must setup MRU menu before CLI param handling as it can load a
|
||||||
// project file and update MRU menu.
|
// project file and update MRU menu.
|
||||||
|
@ -163,13 +163,13 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
|
||||||
}
|
}
|
||||||
mRecentProjectActs[MaxRecentProjects] = NULL; // The separator
|
mRecentProjectActs[MaxRecentProjects] = NULL; // The separator
|
||||||
mUI.mActionProjectMRU->setVisible(false);
|
mUI.mActionProjectMRU->setVisible(false);
|
||||||
UpdateMRUMenuItems();
|
updateMRUMenuItems();
|
||||||
|
|
||||||
QStringList args = QCoreApplication::arguments();
|
QStringList args = QCoreApplication::arguments();
|
||||||
//Remove the application itself
|
//Remove the application itself
|
||||||
args.removeFirst();
|
args.removeFirst();
|
||||||
if (!args.isEmpty()) {
|
if (!args.isEmpty()) {
|
||||||
HandleCLIParams(args);
|
handleCLIParams(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < mPlatforms.getCount(); i++) {
|
for (int i = 0; i < mPlatforms.getCount(); i++) {
|
||||||
|
@ -215,13 +215,13 @@ MainWindow::~MainWindow()
|
||||||
delete mScratchPad;
|
delete mScratchPad;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::HandleCLIParams(const QStringList ¶ms)
|
void MainWindow::handleCLIParams(const QStringList ¶ms)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
if (params.contains("-p")) {
|
if (params.contains("-p")) {
|
||||||
index = params.indexOf("-p");
|
index = params.indexOf("-p");
|
||||||
if ((index + 1) < params.length())
|
if ((index + 1) < params.length())
|
||||||
LoadProjectFile(params[index + 1]);
|
loadProjectFile(params[index + 1]);
|
||||||
} else if (params.contains("-l")) {
|
} else if (params.contains("-l")) {
|
||||||
QString logFile;
|
QString logFile;
|
||||||
index = params.indexOf("-l");
|
index = params.indexOf("-l");
|
||||||
|
@ -234,19 +234,19 @@ void MainWindow::HandleCLIParams(const QStringList ¶ms)
|
||||||
if ((index + 1) < params.length())
|
if ((index + 1) < params.length())
|
||||||
checkedDir = params[index + 1];
|
checkedDir = params[index + 1];
|
||||||
|
|
||||||
LoadResults(logFile, checkedDir);
|
loadResults(logFile, checkedDir);
|
||||||
} else {
|
} else {
|
||||||
LoadResults(logFile);
|
loadResults(logFile);
|
||||||
}
|
}
|
||||||
} else if ((index = params.indexOf(QRegExp(".*\\.cppcheck$", Qt::CaseInsensitive), 0)) >= 0 && index < params.length() && QFile(params[index]).exists()) {
|
} else if ((index = params.indexOf(QRegExp(".*\\.cppcheck$", Qt::CaseInsensitive), 0)) >= 0 && index < params.length() && QFile(params[index]).exists()) {
|
||||||
LoadProjectFile(params[index]);
|
loadProjectFile(params[index]);
|
||||||
} else if ((index = params.indexOf(QRegExp(".*\\.xml$", Qt::CaseInsensitive), 0)) >= 0 && index < params.length() && QFile(params[index]).exists()) {
|
} else if ((index = params.indexOf(QRegExp(".*\\.xml$", Qt::CaseInsensitive), 0)) >= 0 && index < params.length() && QFile(params[index]).exists()) {
|
||||||
LoadResults(params[index],QDir::currentPath());
|
loadResults(params[index],QDir::currentPath());
|
||||||
} else
|
} else
|
||||||
DoCheckFiles(params);
|
doCheckFiles(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::LoadSettings()
|
void MainWindow::loadSettings()
|
||||||
{
|
{
|
||||||
// Window/dialog sizes
|
// Window/dialog sizes
|
||||||
if (mSettings->value(SETTINGS_WINDOW_MAXIMIZED, false).toBool()) {
|
if (mSettings->value(SETTINGS_WINDOW_MAXIMIZED, false).toBool()) {
|
||||||
|
@ -315,7 +315,7 @@ void MainWindow::LoadSettings()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SaveSettings() const
|
void MainWindow::saveSettings() const
|
||||||
{
|
{
|
||||||
// Window/dialog sizes
|
// Window/dialog sizes
|
||||||
mSettings->setValue(SETTINGS_WINDOW_WIDTH, size().width());
|
mSettings->setValue(SETTINGS_WINDOW_WIDTH, size().width());
|
||||||
|
@ -355,7 +355,7 @@ void MainWindow::SaveSettings() const
|
||||||
mUI.mResults->SaveSettings(mSettings);
|
mUI.mResults->SaveSettings(mSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::DoCheckProject(ImportProject p)
|
void MainWindow::doCheckProject(ImportProject p)
|
||||||
{
|
{
|
||||||
ClearResults();
|
ClearResults();
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ void MainWindow::DoCheckProject(ImportProject p)
|
||||||
}
|
}
|
||||||
p.ignorePaths(v);
|
p.ignorePaths(v);
|
||||||
} else {
|
} else {
|
||||||
EnableProjectActions(false);
|
enableProjectActions(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mUI.mResults->Clear(true);
|
mUI.mResults->Clear(true);
|
||||||
|
@ -382,7 +382,7 @@ void MainWindow::DoCheckProject(ImportProject p)
|
||||||
CheckLockDownUI(); // lock UI while checking
|
CheckLockDownUI(); // lock UI while checking
|
||||||
|
|
||||||
mUI.mResults->SetCheckDirectory(checkPath);
|
mUI.mResults->SetCheckDirectory(checkPath);
|
||||||
Settings checkSettings = GetCppcheckSettings();
|
Settings checkSettings = getCppcheckSettings();
|
||||||
checkSettings.force = false;
|
checkSettings.force = false;
|
||||||
|
|
||||||
if (mProject)
|
if (mProject)
|
||||||
|
@ -398,7 +398,7 @@ void MainWindow::DoCheckProject(ImportProject p)
|
||||||
mThread->Check(checkSettings, true);
|
mThread->Check(checkSettings, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::DoCheckFiles(const QStringList &files)
|
void MainWindow::doCheckFiles(const QStringList &files)
|
||||||
{
|
{
|
||||||
if (files.isEmpty()) {
|
if (files.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -411,7 +411,7 @@ void MainWindow::DoCheckFiles(const QStringList &files)
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
pathList.AddExcludeList(mProject->getProjectFile()->getExcludedPaths());
|
pathList.AddExcludeList(mProject->getProjectFile()->getExcludedPaths());
|
||||||
} else {
|
} else {
|
||||||
EnableProjectActions(false);
|
enableProjectActions(false);
|
||||||
}
|
}
|
||||||
QStringList fileNames = pathList.GetFileList();
|
QStringList fileNames = pathList.GetFileList();
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ void MainWindow::DoCheckFiles(const QStringList &files)
|
||||||
CheckLockDownUI(); // lock UI while checking
|
CheckLockDownUI(); // lock UI while checking
|
||||||
|
|
||||||
mUI.mResults->SetCheckDirectory(checkPath);
|
mUI.mResults->SetCheckDirectory(checkPath);
|
||||||
Settings checkSettings = GetCppcheckSettings();
|
Settings checkSettings = getCppcheckSettings();
|
||||||
|
|
||||||
if (mProject)
|
if (mProject)
|
||||||
qDebug() << "Checking project file" << mProject->getProjectFile()->getFilename();
|
qDebug() << "Checking project file" << mProject->getProjectFile()->getFilename();
|
||||||
|
@ -454,7 +454,7 @@ void MainWindow::DoCheckFiles(const QStringList &files)
|
||||||
mThread->Check(checkSettings, true);
|
mThread->Check(checkSettings, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::CheckCode(const QString& code, const QString& filename)
|
void MainWindow::checkCode(const QString& code, const QString& filename)
|
||||||
{
|
{
|
||||||
// Initialize dummy ThreadResult as ErrorLogger
|
// Initialize dummy ThreadResult as ErrorLogger
|
||||||
ThreadResult result;
|
ThreadResult result;
|
||||||
|
@ -470,7 +470,7 @@ void MainWindow::CheckCode(const QString& code, const QString& filename)
|
||||||
|
|
||||||
// Create CppCheck instance
|
// Create CppCheck instance
|
||||||
CppCheck cppcheck(result, true);
|
CppCheck cppcheck(result, true);
|
||||||
cppcheck.settings() = GetCppcheckSettings();
|
cppcheck.settings() = getCppcheckSettings();
|
||||||
|
|
||||||
// Check
|
// Check
|
||||||
CheckLockDownUI();
|
CheckLockDownUI();
|
||||||
|
@ -480,7 +480,7 @@ void MainWindow::CheckCode(const QString& code, const QString& filename)
|
||||||
CheckDone();
|
CheckDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList MainWindow::SelectFilesToCheck(QFileDialog::FileMode mode)
|
QStringList MainWindow::selectFilesToCheck(QFileDialog::FileMode mode)
|
||||||
{
|
{
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
QMessageBox msgBox(this);
|
QMessageBox msgBox(this);
|
||||||
|
@ -511,7 +511,7 @@ QStringList MainWindow::SelectFilesToCheck(QFileDialog::FileMode mode)
|
||||||
QFileInfo inf(selected[0]);
|
QFileInfo inf(selected[0]);
|
||||||
mCurrentDirectory = inf.absolutePath();
|
mCurrentDirectory = inf.absolutePath();
|
||||||
}
|
}
|
||||||
FormatAndSetTitle();
|
formatAndSetTitle();
|
||||||
} else if (mode == QFileDialog::DirectoryOnly) {
|
} else if (mode == QFileDialog::DirectoryOnly) {
|
||||||
QString dir = QFileDialog::getExistingDirectory(this,
|
QString dir = QFileDialog::getExistingDirectory(this,
|
||||||
tr("Select directory to check"),
|
tr("Select directory to check"),
|
||||||
|
@ -521,7 +521,7 @@ QStringList MainWindow::SelectFilesToCheck(QFileDialog::FileMode mode)
|
||||||
mCurrentDirectory = dir;
|
mCurrentDirectory = dir;
|
||||||
selected.append(dir);
|
selected.append(dir);
|
||||||
dir = QDir::toNativeSeparators(dir);
|
dir = QDir::toNativeSeparators(dir);
|
||||||
FormatAndSetTitle(dir);
|
formatAndSetTitle(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ QStringList MainWindow::SelectFilesToCheck(QFileDialog::FileMode mode)
|
||||||
|
|
||||||
void MainWindow::CheckFiles()
|
void MainWindow::CheckFiles()
|
||||||
{
|
{
|
||||||
QStringList selected = SelectFilesToCheck(QFileDialog::ExistingFiles);
|
QStringList selected = selectFilesToCheck(QFileDialog::ExistingFiles);
|
||||||
|
|
||||||
const QString file0 = (selected.size() ? selected[0].toLower() : "");
|
const QString file0 = (selected.size() ? selected[0].toLower() : "");
|
||||||
if (file0.endsWith(".sln") || file0.endsWith(".vcxproj") || file0.endsWith(compile_commands_json)) {
|
if (file0.endsWith(".sln") || file0.endsWith(".vcxproj") || file0.endsWith(compile_commands_json)) {
|
||||||
|
@ -555,16 +555,16 @@ void MainWindow::CheckFiles()
|
||||||
p.ignoreOtherConfigs(cfg.toStdString());
|
p.ignoreOtherConfigs(cfg.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
DoCheckProject(p);
|
doCheckProject(p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DoCheckFiles(selected);
|
doCheckFiles(selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::CheckDirectory()
|
void MainWindow::CheckDirectory()
|
||||||
{
|
{
|
||||||
QStringList dir = SelectFilesToCheck(QFileDialog::DirectoryOnly);
|
QStringList dir = selectFilesToCheck(QFileDialog::DirectoryOnly);
|
||||||
if (dir.isEmpty())
|
if (dir.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -592,9 +592,9 @@ void MainWindow::CheckDirectory()
|
||||||
if (!path.endsWith("/"))
|
if (!path.endsWith("/"))
|
||||||
path += "/";
|
path += "/";
|
||||||
path += projFiles[0];
|
path += projFiles[0];
|
||||||
LoadProjectFile(path);
|
loadProjectFile(path);
|
||||||
} else {
|
} else {
|
||||||
DoCheckFiles(dir);
|
doCheckFiles(dir);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If multiple project files found inform that there are project
|
// If multiple project files found inform that there are project
|
||||||
|
@ -611,15 +611,15 @@ void MainWindow::CheckDirectory()
|
||||||
msgBox.setDefaultButton(QMessageBox::Yes);
|
msgBox.setDefaultButton(QMessageBox::Yes);
|
||||||
int dlgResult = msgBox.exec();
|
int dlgResult = msgBox.exec();
|
||||||
if (dlgResult == QMessageBox::Yes) {
|
if (dlgResult == QMessageBox::Yes) {
|
||||||
DoCheckFiles(dir);
|
doCheckFiles(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DoCheckFiles(dir);
|
doCheckFiles(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::AddIncludeDirs(const QStringList &includeDirs, Settings &result)
|
void MainWindow::addIncludeDirs(const QStringList &includeDirs, Settings &result)
|
||||||
{
|
{
|
||||||
QString dir;
|
QString dir;
|
||||||
foreach (dir, includeDirs) {
|
foreach (dir, includeDirs) {
|
||||||
|
@ -636,7 +636,7 @@ void MainWindow::AddIncludeDirs(const QStringList &includeDirs, Settings &result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Library::Error MainWindow::LoadLibrary(Library *library, QString filename)
|
Library::Error MainWindow::loadLibrary(Library *library, QString filename)
|
||||||
{
|
{
|
||||||
Library::Error ret;
|
Library::Error ret;
|
||||||
|
|
||||||
|
@ -684,9 +684,9 @@ Library::Error MainWindow::LoadLibrary(Library *library, QString filename)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::TryLoadLibrary(Library *library, QString filename)
|
bool MainWindow::tryLoadLibrary(Library *library, QString filename)
|
||||||
{
|
{
|
||||||
const Library::Error error = LoadLibrary(library, filename);
|
const Library::Error error = loadLibrary(library, filename);
|
||||||
if (error.errorcode != Library::ErrorCode::OK) {
|
if (error.errorcode != Library::ErrorCode::OK) {
|
||||||
if (error.errorcode == Library::UNKNOWN_ELEMENT) {
|
if (error.errorcode == Library::UNKNOWN_ELEMENT) {
|
||||||
QMessageBox::information(this, tr("Information"), tr("The library '%1' contains unknown elements:\n%2").arg(filename).arg(error.reason.c_str()));
|
QMessageBox::information(this, tr("Information"), tr("The library '%1' contains unknown elements:\n%2").arg(filename).arg(error.reason.c_str()));
|
||||||
|
@ -733,9 +733,9 @@ bool MainWindow::TryLoadLibrary(Library *library, QString filename)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings MainWindow::GetCppcheckSettings()
|
Settings MainWindow::getCppcheckSettings()
|
||||||
{
|
{
|
||||||
SaveSettings(); // Save settings
|
saveSettings(); // Save settings
|
||||||
|
|
||||||
Settings result;
|
Settings result;
|
||||||
|
|
||||||
|
@ -743,7 +743,7 @@ Settings MainWindow::GetCppcheckSettings()
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
ProjectFile *pfile = mProject->getProjectFile();
|
ProjectFile *pfile = mProject->getProjectFile();
|
||||||
QStringList dirs = pfile->getIncludeDirs();
|
QStringList dirs = pfile->getIncludeDirs();
|
||||||
AddIncludeDirs(dirs, result);
|
addIncludeDirs(dirs, result);
|
||||||
|
|
||||||
const QStringList defines = pfile->getDefines();
|
const QStringList defines = pfile->getDefines();
|
||||||
foreach (QString define, defines) {
|
foreach (QString define, defines) {
|
||||||
|
@ -755,7 +755,7 @@ Settings MainWindow::GetCppcheckSettings()
|
||||||
const QStringList libraries = pfile->getLibraries();
|
const QStringList libraries = pfile->getLibraries();
|
||||||
foreach (QString library, libraries) {
|
foreach (QString library, libraries) {
|
||||||
const QString filename = library + ".cfg";
|
const QString filename = library + ".cfg";
|
||||||
TryLoadLibrary(&result.library, filename);
|
tryLoadLibrary(&result.library, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList suppressions = pfile->getSuppressions();
|
const QStringList suppressions = pfile->getSuppressions();
|
||||||
|
@ -780,7 +780,7 @@ Settings MainWindow::GetCppcheckSettings()
|
||||||
const QString globalIncludes = mSettings->value(SETTINGS_GLOBAL_INCLUDE_PATHS).toString();
|
const QString globalIncludes = mSettings->value(SETTINGS_GLOBAL_INCLUDE_PATHS).toString();
|
||||||
if (!globalIncludes.isEmpty()) {
|
if (!globalIncludes.isEmpty()) {
|
||||||
QStringList includes = globalIncludes.split(";");
|
QStringList includes = globalIncludes.split(";");
|
||||||
AddIncludeDirs(includes, result);
|
addIncludeDirs(includes, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.addEnabled("warning");
|
result.addEnabled("warning");
|
||||||
|
@ -806,13 +806,13 @@ Settings MainWindow::GetCppcheckSettings()
|
||||||
result.standards.posix = mSettings->value(SETTINGS_STD_POSIX, false).toBool();
|
result.standards.posix = mSettings->value(SETTINGS_STD_POSIX, false).toBool();
|
||||||
result.enforcedLang = (Settings::Language)mSettings->value(SETTINGS_ENFORCED_LANGUAGE, 0).toInt();
|
result.enforcedLang = (Settings::Language)mSettings->value(SETTINGS_ENFORCED_LANGUAGE, 0).toInt();
|
||||||
|
|
||||||
const bool std = TryLoadLibrary(&result.library, "std.cfg");
|
const bool std = tryLoadLibrary(&result.library, "std.cfg");
|
||||||
bool posix = true;
|
bool posix = true;
|
||||||
if (result.standards.posix)
|
if (result.standards.posix)
|
||||||
posix = TryLoadLibrary(&result.library, "posix.cfg");
|
posix = tryLoadLibrary(&result.library, "posix.cfg");
|
||||||
bool windows = true;
|
bool windows = true;
|
||||||
if (result.platformType == Settings::Win32A || result.platformType == Settings::Win32W || result.platformType == Settings::Win64)
|
if (result.platformType == Settings::Win32A || result.platformType == Settings::Win32W || result.platformType == Settings::Win64)
|
||||||
windows = TryLoadLibrary(&result.library, "windows.cfg");
|
windows = tryLoadLibrary(&result.library, "windows.cfg");
|
||||||
|
|
||||||
if (!std || !posix || !windows)
|
if (!std || !posix || !windows)
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Failed to load %1. Your Cppcheck installation is broken. You can use --data-dir=<directory> at the command line to specify where this file is located. Please note that --data-dir is supposed to be used by installation scripts and therefore the GUI does not start when it is used, all that happens is that the setting is configured.").arg(!std ? "std.cfg" : !posix ? "posix.cfg" : "windows.cfg"));
|
QMessageBox::critical(this, tr("Error"), tr("Failed to load %1. Your Cppcheck installation is broken. You can use --data-dir=<directory> at the command line to specify where this file is located. Please note that --data-dir is supposed to be used by installation scripts and therefore the GUI does not start when it is used, all that happens is that the setting is configured.").arg(!std ? "std.cfg" : !posix ? "posix.cfg" : "windows.cfg"));
|
||||||
|
@ -834,16 +834,16 @@ void MainWindow::CheckDone()
|
||||||
}
|
}
|
||||||
|
|
||||||
mUI.mResults->CheckingFinished();
|
mUI.mResults->CheckingFinished();
|
||||||
EnableCheckButtons(true);
|
enableCheckButtons(true);
|
||||||
mUI.mActionSettings->setEnabled(true);
|
mUI.mActionSettings->setEnabled(true);
|
||||||
mUI.mActionOpenXML->setEnabled(true);
|
mUI.mActionOpenXML->setEnabled(true);
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
EnableProjectActions(true);
|
enableProjectActions(true);
|
||||||
} else if (mIsLogfileLoaded) {
|
} else if (mIsLogfileLoaded) {
|
||||||
mUI.mActionRecheckModified->setEnabled(false);
|
mUI.mActionRecheckModified->setEnabled(false);
|
||||||
mUI.mActionRecheckAll->setEnabled(false);
|
mUI.mActionRecheckAll->setEnabled(false);
|
||||||
}
|
}
|
||||||
EnableProjectOpenActions(true);
|
enableProjectOpenActions(true);
|
||||||
mPlatformActions->setEnabled(true);
|
mPlatformActions->setEnabled(true);
|
||||||
mCStandardActions->setEnabled(true);
|
mCStandardActions->setEnabled(true);
|
||||||
mCppStandardActions->setEnabled(true);
|
mCppStandardActions->setEnabled(true);
|
||||||
|
@ -872,11 +872,11 @@ void MainWindow::CheckDone()
|
||||||
|
|
||||||
void MainWindow::CheckLockDownUI()
|
void MainWindow::CheckLockDownUI()
|
||||||
{
|
{
|
||||||
EnableCheckButtons(false);
|
enableCheckButtons(false);
|
||||||
mUI.mActionSettings->setEnabled(false);
|
mUI.mActionSettings->setEnabled(false);
|
||||||
mUI.mActionOpenXML->setEnabled(false);
|
mUI.mActionOpenXML->setEnabled(false);
|
||||||
EnableProjectActions(false);
|
enableProjectActions(false);
|
||||||
EnableProjectOpenActions(false);
|
enableProjectOpenActions(false);
|
||||||
mPlatformActions->setEnabled(false);
|
mPlatformActions->setEnabled(false);
|
||||||
mCStandardActions->setEnabled(false);
|
mCStandardActions->setEnabled(false);
|
||||||
mCppStandardActions->setEnabled(false);
|
mCppStandardActions->setEnabled(false);
|
||||||
|
@ -903,21 +903,21 @@ void MainWindow::ProgramSettings()
|
||||||
dialog.ShowErrorId(),
|
dialog.ShowErrorId(),
|
||||||
dialog.ShowInconclusive());
|
dialog.ShowInconclusive());
|
||||||
const QString newLang = mSettings->value(SETTINGS_LANGUAGE, "en").toString();
|
const QString newLang = mSettings->value(SETTINGS_LANGUAGE, "en").toString();
|
||||||
SetLanguage(newLang);
|
setLanguage(newLang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ReCheckModified()
|
void MainWindow::ReCheckModified()
|
||||||
{
|
{
|
||||||
ReCheck(false);
|
reCheck(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ReCheckAll()
|
void MainWindow::ReCheckAll()
|
||||||
{
|
{
|
||||||
ReCheck(true);
|
reCheck(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ReCheckSelected(QStringList files, bool all)
|
void MainWindow::reCheckSelected(QStringList files, bool all)
|
||||||
{
|
{
|
||||||
if (files.empty())
|
if (files.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -943,11 +943,11 @@ void MainWindow::ReCheckSelected(QStringList files, bool all)
|
||||||
// considered in "Modified Files Check" performed after "Selected Files Check"
|
// considered in "Modified Files Check" performed after "Selected Files Check"
|
||||||
// TODO: Should we store per file CheckStartTime?
|
// TODO: Should we store per file CheckStartTime?
|
||||||
QDateTime saveCheckStartTime = mThread->GetCheckStartTime();
|
QDateTime saveCheckStartTime = mThread->GetCheckStartTime();
|
||||||
mThread->Check(GetCppcheckSettings(), all);
|
mThread->Check(getCppcheckSettings(), all);
|
||||||
mThread->SetCheckStartTime(saveCheckStartTime);
|
mThread->SetCheckStartTime(saveCheckStartTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ReCheck(bool all)
|
void MainWindow::reCheck(bool all)
|
||||||
{
|
{
|
||||||
const QStringList files = mThread->GetReCheckFiles(all);
|
const QStringList files = mThread->GetReCheckFiles(all);
|
||||||
if (files.empty())
|
if (files.empty())
|
||||||
|
@ -967,7 +967,7 @@ void MainWindow::ReCheck(bool all)
|
||||||
qDebug() << "Rechecking project file" << mProject->getProjectFile()->getFilename();
|
qDebug() << "Rechecking project file" << mProject->getProjectFile()->getFilename();
|
||||||
|
|
||||||
mThread->SetCheckFiles(all);
|
mThread->SetCheckFiles(all);
|
||||||
mThread->Check(GetCppcheckSettings(), all);
|
mThread->Check(getCppcheckSettings(), all);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ClearResults()
|
void MainWindow::ClearResults()
|
||||||
|
@ -1007,11 +1007,11 @@ void MainWindow::OpenResults()
|
||||||
&selectedFilter);
|
&selectedFilter);
|
||||||
|
|
||||||
if (!selectedFile.isEmpty()) {
|
if (!selectedFile.isEmpty()) {
|
||||||
LoadResults(selectedFile);
|
loadResults(selectedFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::LoadResults(const QString selectedFile)
|
void MainWindow::loadResults(const QString selectedFile)
|
||||||
{
|
{
|
||||||
if (!selectedFile.isEmpty()) {
|
if (!selectedFile.isEmpty()) {
|
||||||
if (mProject)
|
if (mProject)
|
||||||
|
@ -1025,13 +1025,13 @@ void MainWindow::LoadResults(const QString selectedFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::LoadResults(const QString selectedFile, const QString sourceDirectory)
|
void MainWindow::loadResults(const QString selectedFile, const QString sourceDirectory)
|
||||||
{
|
{
|
||||||
LoadResults(selectedFile);
|
loadResults(selectedFile);
|
||||||
mUI.mResults->SetCheckDirectory(sourceDirectory);
|
mUI.mResults->SetCheckDirectory(sourceDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::EnableCheckButtons(bool enable)
|
void MainWindow::enableCheckButtons(bool enable)
|
||||||
{
|
{
|
||||||
mUI.mActionStop->setEnabled(!enable);
|
mUI.mActionStop->setEnabled(!enable);
|
||||||
mUI.mActionCheckFiles->setEnabled(enable);
|
mUI.mActionCheckFiles->setEnabled(enable);
|
||||||
|
@ -1076,19 +1076,19 @@ void MainWindow::ShowInformation(bool checked)
|
||||||
|
|
||||||
void MainWindow::CheckAll()
|
void MainWindow::CheckAll()
|
||||||
{
|
{
|
||||||
ToggleAllChecked(true);
|
toggleAllChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::UncheckAll()
|
void MainWindow::UncheckAll()
|
||||||
{
|
{
|
||||||
ToggleAllChecked(false);
|
toggleAllChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *event)
|
void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
// Check that we aren't checking files
|
// Check that we aren't checking files
|
||||||
if (!mThread->IsChecking()) {
|
if (!mThread->IsChecking()) {
|
||||||
SaveSettings();
|
saveSettings();
|
||||||
event->accept();
|
event->accept();
|
||||||
} else {
|
} else {
|
||||||
const QString text(tr("Checking is running.\n\n" \
|
const QString text(tr("Checking is running.\n\n" \
|
||||||
|
@ -1106,14 +1106,14 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
// This isn't really very clean way to close threads but since the app is
|
// This isn't really very clean way to close threads but since the app is
|
||||||
// exiting it doesn't matter.
|
// exiting it doesn't matter.
|
||||||
mThread->Stop();
|
mThread->Stop();
|
||||||
SaveSettings();
|
saveSettings();
|
||||||
mExiting = true;
|
mExiting = true;
|
||||||
}
|
}
|
||||||
event->ignore();
|
event->ignore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ToggleAllChecked(bool checked)
|
void MainWindow::toggleAllChecked(bool checked)
|
||||||
{
|
{
|
||||||
mUI.mActionShowStyle->setChecked(checked);
|
mUI.mActionShowStyle->setChecked(checked);
|
||||||
ShowStyle(checked);
|
ShowStyle(checked);
|
||||||
|
@ -1151,7 +1151,7 @@ void MainWindow::ShowAuthors()
|
||||||
|
|
||||||
void MainWindow::PerformSelectedFilesCheck(QStringList selectedFilesList)
|
void MainWindow::PerformSelectedFilesCheck(QStringList selectedFilesList)
|
||||||
{
|
{
|
||||||
ReCheckSelected(selectedFilesList, true);
|
reCheckSelected(selectedFilesList, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::Save()
|
void MainWindow::Save()
|
||||||
|
@ -1219,7 +1219,7 @@ void MainWindow::ToggleFilterToolBar()
|
||||||
mLineEditFilter->clear(); // Clearing the filter also disables filtering
|
mLineEditFilter->clear(); // Clearing the filter also disables filtering
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::FormatAndSetTitle(const QString &text)
|
void MainWindow::formatAndSetTitle(const QString &text)
|
||||||
{
|
{
|
||||||
QString title;
|
QString title;
|
||||||
if (text.isEmpty())
|
if (text.isEmpty())
|
||||||
|
@ -1229,7 +1229,7 @@ void MainWindow::FormatAndSetTitle(const QString &text)
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SetLanguage(const QString &code)
|
void MainWindow::setLanguage(const QString &code)
|
||||||
{
|
{
|
||||||
const QString currentLang = mTranslation->GetCurrentLanguage();
|
const QString currentLang = mTranslation->GetCurrentLanguage();
|
||||||
if (currentLang == code)
|
if (currentLang == code)
|
||||||
|
@ -1259,10 +1259,10 @@ void MainWindow::StopChecking()
|
||||||
|
|
||||||
void MainWindow::OpenHelpContents()
|
void MainWindow::OpenHelpContents()
|
||||||
{
|
{
|
||||||
OpenOnlineHelp();
|
openOnlineHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::OpenOnlineHelp()
|
void MainWindow::openOnlineHelp()
|
||||||
{
|
{
|
||||||
QDesktopServices::openUrl(QUrl(OnlineHelpURL));
|
QDesktopServices::openUrl(QUrl(OnlineHelpURL));
|
||||||
}
|
}
|
||||||
|
@ -1280,7 +1280,7 @@ void MainWindow::OpenProjectFile()
|
||||||
const QFileInfo fi(filepath);
|
const QFileInfo fi(filepath);
|
||||||
if (fi.exists() && fi.isFile() && fi.isReadable()) {
|
if (fi.exists() && fi.isFile() && fi.isReadable()) {
|
||||||
SetPath(SETTINGS_LAST_PROJECT_PATH, filepath);
|
SetPath(SETTINGS_LAST_PROJECT_PATH, filepath);
|
||||||
LoadProjectFile(filepath);
|
loadProjectFile(filepath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1296,22 +1296,22 @@ void MainWindow::ShowScratchpad()
|
||||||
mScratchPad->activateWindow();
|
mScratchPad->activateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::LoadProjectFile(const QString &filePath)
|
void MainWindow::loadProjectFile(const QString &filePath)
|
||||||
{
|
{
|
||||||
QFileInfo inf(filePath);
|
QFileInfo inf(filePath);
|
||||||
const QString filename = inf.fileName();
|
const QString filename = inf.fileName();
|
||||||
FormatAndSetTitle(tr("Project:") + QString(" ") + filename);
|
formatAndSetTitle(tr("Project:") + QString(" ") + filename);
|
||||||
AddProjectMRU(filePath);
|
addProjectMRU(filePath);
|
||||||
|
|
||||||
mIsLogfileLoaded = false;
|
mIsLogfileLoaded = false;
|
||||||
mUI.mActionCloseProjectFile->setEnabled(true);
|
mUI.mActionCloseProjectFile->setEnabled(true);
|
||||||
mUI.mActionEditProjectFile->setEnabled(true);
|
mUI.mActionEditProjectFile->setEnabled(true);
|
||||||
delete mProject;
|
delete mProject;
|
||||||
mProject = new Project(filePath, this);
|
mProject = new Project(filePath, this);
|
||||||
CheckProject(mProject);
|
checkProject(mProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::CheckProject(Project *project)
|
void MainWindow::checkProject(Project *project)
|
||||||
{
|
{
|
||||||
if (!project->isOpen()) {
|
if (!project->isOpen()) {
|
||||||
if (!project->open()) {
|
if (!project->open()) {
|
||||||
|
@ -1337,7 +1337,7 @@ void MainWindow::CheckProject(Project *project)
|
||||||
ImportProject p;
|
ImportProject p;
|
||||||
QString prjfile = inf.canonicalPath() + '/' + project->getProjectFile()->getImportProject();
|
QString prjfile = inf.canonicalPath() + '/' + project->getProjectFile()->getImportProject();
|
||||||
p.import(prjfile.toStdString());
|
p.import(prjfile.toStdString());
|
||||||
DoCheckProject(p);
|
doCheckProject(p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1359,7 +1359,7 @@ void MainWindow::CheckProject(Project *project)
|
||||||
paths[i] = QDir::cleanPath(path);
|
paths[i] = QDir::cleanPath(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DoCheckFiles(paths);
|
doCheckFiles(paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::NewProjectFile()
|
void MainWindow::NewProjectFile()
|
||||||
|
@ -1375,17 +1375,17 @@ void MainWindow::NewProjectFile()
|
||||||
|
|
||||||
SetPath(SETTINGS_LAST_PROJECT_PATH, filepath);
|
SetPath(SETTINGS_LAST_PROJECT_PATH, filepath);
|
||||||
|
|
||||||
EnableProjectActions(true);
|
enableProjectActions(true);
|
||||||
QFileInfo inf(filepath);
|
QFileInfo inf(filepath);
|
||||||
const QString filename = inf.fileName();
|
const QString filename = inf.fileName();
|
||||||
FormatAndSetTitle(tr("Project:") + QString(" ") + filename);
|
formatAndSetTitle(tr("Project:") + QString(" ") + filename);
|
||||||
|
|
||||||
delete mProject;
|
delete mProject;
|
||||||
mProject = new Project(filepath, this);
|
mProject = new Project(filepath, this);
|
||||||
mProject->create();
|
mProject->create();
|
||||||
if (mProject->edit()) {
|
if (mProject->edit()) {
|
||||||
AddProjectMRU(filepath);
|
addProjectMRU(filepath);
|
||||||
CheckProject(mProject);
|
checkProject(mProject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1393,9 +1393,9 @@ void MainWindow::CloseProjectFile()
|
||||||
{
|
{
|
||||||
delete mProject;
|
delete mProject;
|
||||||
mProject = NULL;
|
mProject = NULL;
|
||||||
EnableProjectActions(false);
|
enableProjectActions(false);
|
||||||
EnableProjectOpenActions(true);
|
enableProjectOpenActions(true);
|
||||||
FormatAndSetTitle();
|
formatAndSetTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::EditProjectFile()
|
void MainWindow::EditProjectFile()
|
||||||
|
@ -1410,7 +1410,7 @@ void MainWindow::EditProjectFile()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mProject->edit())
|
if (mProject->edit())
|
||||||
CheckProject(mProject);
|
checkProject(mProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ShowLogView()
|
void MainWindow::ShowLogView()
|
||||||
|
@ -1464,13 +1464,13 @@ void MainWindow::FilterResults()
|
||||||
mUI.mResults->FilterResults(mLineEditFilter->text());
|
mUI.mResults->FilterResults(mLineEditFilter->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::EnableProjectActions(bool enable)
|
void MainWindow::enableProjectActions(bool enable)
|
||||||
{
|
{
|
||||||
mUI.mActionCloseProjectFile->setEnabled(enable);
|
mUI.mActionCloseProjectFile->setEnabled(enable);
|
||||||
mUI.mActionEditProjectFile->setEnabled(enable);
|
mUI.mActionEditProjectFile->setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::EnableProjectOpenActions(bool enable)
|
void MainWindow::enableProjectOpenActions(bool enable)
|
||||||
{
|
{
|
||||||
mUI.mActionNewProjectFile->setEnabled(enable);
|
mUI.mActionNewProjectFile->setEnabled(enable);
|
||||||
mUI.mActionOpenProjectFile->setEnabled(enable);
|
mUI.mActionOpenProjectFile->setEnabled(enable);
|
||||||
|
@ -1483,7 +1483,7 @@ void MainWindow::OpenRecentProject()
|
||||||
const QString project = action->data().toString();
|
const QString project = action->data().toString();
|
||||||
QFileInfo inf(project);
|
QFileInfo inf(project);
|
||||||
if (inf.exists()) {
|
if (inf.exists()) {
|
||||||
LoadProjectFile(project);
|
loadProjectFile(project);
|
||||||
} else {
|
} else {
|
||||||
const QString text(tr("The project file\n\n%1\n\n could not be found!\n\n"
|
const QString text(tr("The project file\n\n%1\n\n could not be found!\n\n"
|
||||||
"Do you want to remove the file from the recently "
|
"Do you want to remove the file from the recently "
|
||||||
|
@ -1498,14 +1498,14 @@ void MainWindow::OpenRecentProject()
|
||||||
msg.setDefaultButton(QMessageBox::No);
|
msg.setDefaultButton(QMessageBox::No);
|
||||||
int rv = msg.exec();
|
int rv = msg.exec();
|
||||||
if (rv == QMessageBox::Yes) {
|
if (rv == QMessageBox::Yes) {
|
||||||
RemoveProjectMRU(project);
|
removeProjectMRU(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::UpdateMRUMenuItems()
|
void MainWindow::updateMRUMenuItems()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MaxRecentProjects + 1; i++) {
|
for (int i = 0; i < MaxRecentProjects + 1; i++) {
|
||||||
if (mRecentProjectActs[i] != NULL)
|
if (mRecentProjectActs[i] != NULL)
|
||||||
|
@ -1541,7 +1541,7 @@ void MainWindow::UpdateMRUMenuItems()
|
||||||
mRecentProjectActs[numRecentProjects] = mUI.mMenuFile->insertSeparator(mUI.mActionProjectMRU);
|
mRecentProjectActs[numRecentProjects] = mUI.mMenuFile->insertSeparator(mUI.mActionProjectMRU);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::AddProjectMRU(const QString &project)
|
void MainWindow::addProjectMRU(const QString &project)
|
||||||
{
|
{
|
||||||
QStringList files = mSettings->value(SETTINGS_MRU_PROJECTS).toStringList();
|
QStringList files = mSettings->value(SETTINGS_MRU_PROJECTS).toStringList();
|
||||||
files.removeAll(project);
|
files.removeAll(project);
|
||||||
|
@ -1550,16 +1550,16 @@ void MainWindow::AddProjectMRU(const QString &project)
|
||||||
files.removeLast();
|
files.removeLast();
|
||||||
|
|
||||||
mSettings->setValue(SETTINGS_MRU_PROJECTS, files);
|
mSettings->setValue(SETTINGS_MRU_PROJECTS, files);
|
||||||
UpdateMRUMenuItems();
|
updateMRUMenuItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::RemoveProjectMRU(const QString &project)
|
void MainWindow::removeProjectMRU(const QString &project)
|
||||||
{
|
{
|
||||||
QStringList files = mSettings->value(SETTINGS_MRU_PROJECTS).toStringList();
|
QStringList files = mSettings->value(SETTINGS_MRU_PROJECTS).toStringList();
|
||||||
files.removeAll(project);
|
files.removeAll(project);
|
||||||
|
|
||||||
mSettings->setValue(SETTINGS_MRU_PROJECTS, files);
|
mSettings->setValue(SETTINGS_MRU_PROJECTS, files);
|
||||||
UpdateMRUMenuItems();
|
updateMRUMenuItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SelectPlatform()
|
void MainWindow::SelectPlatform()
|
||||||
|
|
|
@ -68,7 +68,7 @@ public:
|
||||||
* @param code Content of the (virtual) file to be checked
|
* @param code Content of the (virtual) file to be checked
|
||||||
* @param filename Name of the (virtual) file to be checked - determines language.
|
* @param filename Name of the (virtual) file to be checked - determines language.
|
||||||
*/
|
*/
|
||||||
void CheckCode(const QString& code, const QString& filename);
|
void checkCode(const QString& code, const QString& filename);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
@ -224,26 +224,26 @@ protected slots:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/** @brief Rechecks files */
|
/** @brief Rechecks files */
|
||||||
void ReCheck(bool all);
|
void reCheck(bool all);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Recheck selected files
|
* @brief Recheck selected files
|
||||||
* @param files list of selected files
|
* @param files list of selected files
|
||||||
* @param all true if all files of list, false if modified files of list
|
* @param all true if all files of list, false if modified files of list
|
||||||
*/
|
*/
|
||||||
void ReCheckSelected(QStringList files, bool all);
|
void reCheckSelected(QStringList files, 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.
|
||||||
*/
|
*/
|
||||||
void CheckProject(Project *project);
|
void checkProject(Project *project);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set current language
|
* @brief Set current language
|
||||||
* @param code Language code of the language to set (e.g. "en").
|
* @param code Language code of the language to set (e.g. "en").
|
||||||
*/
|
*/
|
||||||
void SetLanguage(const QString &code);
|
void setLanguage(const QString &code);
|
||||||
|
|
||||||
/** @brief Event coming when application is about to close. */
|
/** @brief Event coming when application is about to close. */
|
||||||
virtual void closeEvent(QCloseEvent *event);
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
|
@ -252,10 +252,10 @@ private:
|
||||||
* @brief Helper function to toggle all show error menu items
|
* @brief Helper function to toggle all show error menu items
|
||||||
* @param checked Should all errors be shown (true) or hidden (false)
|
* @param checked Should all errors be shown (true) or hidden (false)
|
||||||
*/
|
*/
|
||||||
void ToggleAllChecked(bool checked);
|
void toggleAllChecked(bool checked);
|
||||||
|
|
||||||
/** @brief Helper function to enable/disable all check,recheck buttons */
|
/** @brief Helper function to enable/disable all check,recheck buttons */
|
||||||
void EnableCheckButtons(bool enable);
|
void enableCheckButtons(bool enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Select files/or directory to check.
|
* @brief Select files/or directory to check.
|
||||||
|
@ -265,42 +265,42 @@ private:
|
||||||
* @param mode Dialog open mode (files or directories)
|
* @param mode Dialog open mode (files or directories)
|
||||||
* @return QStringList of files or directories that were selected to check
|
* @return QStringList of files or directories that were selected to check
|
||||||
*/
|
*/
|
||||||
QStringList SelectFilesToCheck(QFileDialog::FileMode mode);
|
QStringList selectFilesToCheck(QFileDialog::FileMode mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check project
|
* @brief Check project
|
||||||
* @param p imported project
|
* @param p imported project
|
||||||
*/
|
*/
|
||||||
void DoCheckProject(ImportProject p);
|
void doCheckProject(ImportProject p);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check all files specified in parameter files
|
* @brief Check all files specified in parameter files
|
||||||
*
|
*
|
||||||
* @param files List of files and/or directories to check
|
* @param files List of files and/or directories to check
|
||||||
*/
|
*/
|
||||||
void DoCheckFiles(const QStringList &files);
|
void doCheckFiles(const QStringList &files);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get our default cppcheck settings and read project file.
|
* @brief Get our default cppcheck settings and read project file.
|
||||||
*
|
*
|
||||||
* @return Default cppcheck settings
|
* @return Default cppcheck settings
|
||||||
*/
|
*/
|
||||||
Settings GetCppcheckSettings();
|
Settings getCppcheckSettings();
|
||||||
|
|
||||||
/** @brief Load program settings */
|
/** @brief Load program settings */
|
||||||
void LoadSettings();
|
void loadSettings();
|
||||||
|
|
||||||
/** @brief Save program settings */
|
/** @brief Save program settings */
|
||||||
void SaveSettings() const;
|
void saveSettings() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Format main window title.
|
* @brief Format main window title.
|
||||||
* @param text Text added to end of the title.
|
* @param text Text added to end of the title.
|
||||||
*/
|
*/
|
||||||
void FormatAndSetTitle(const QString &text = QString());
|
void formatAndSetTitle(const QString &text = QString());
|
||||||
|
|
||||||
/** @brief Show help contents */
|
/** @brief Show help contents */
|
||||||
void OpenOnlineHelp();
|
void openOnlineHelp();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable or disable project file actions.
|
* @brief Enable or disable project file actions.
|
||||||
|
@ -308,46 +308,46 @@ private:
|
||||||
* open and we are not checking files.
|
* open and we are not checking files.
|
||||||
* @param enable If true then actions are enabled.
|
* @param enable If true then actions are enabled.
|
||||||
*/
|
*/
|
||||||
void EnableProjectActions(bool enable);
|
void enableProjectActions(bool enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable or disable project file actions.
|
* @brief Enable or disable project file actions.
|
||||||
* Project opening and creating actions should be disabled when checking.
|
* Project opening and creating actions should be disabled when checking.
|
||||||
* @param enable If true then actions are enabled.
|
* @param enable If true then actions are enabled.
|
||||||
*/
|
*/
|
||||||
void EnableProjectOpenActions(bool enable);
|
void enableProjectOpenActions(bool enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add include directories.
|
* @brief Add include directories.
|
||||||
* @param includeDirs List of include directories to add.
|
* @param includeDirs List of include directories to add.
|
||||||
* @param result Settings class where include directories are added.
|
* @param result Settings class where include directories are added.
|
||||||
*/
|
*/
|
||||||
void AddIncludeDirs(const QStringList &includeDirs, Settings &result);
|
void addIncludeDirs(const QStringList &includeDirs, Settings &result);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Handle command line parameters given to GUI.
|
* @brief Handle command line parameters given to GUI.
|
||||||
* @param params List of string given to command line.
|
* @param params List of string given to command line.
|
||||||
*/
|
*/
|
||||||
void HandleCLIParams(const QStringList ¶ms);
|
void handleCLIParams(const QStringList ¶ms);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Load XML file to the GUI.
|
* @brief Load XML file to the GUI.
|
||||||
* @param selectedFile Filename (inc. path) of XML file to load.
|
* @param selectedFile Filename (inc. path) of XML file to load.
|
||||||
*/
|
*/
|
||||||
void LoadResults(const QString selectedFile);
|
void loadResults(const QString selectedFile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Load XML file to the GUI.
|
* @brief Load XML file to the GUI.
|
||||||
* @param selectedFile Filename (inc. path) of XML file to load.
|
* @param selectedFile Filename (inc. path) of XML file to load.
|
||||||
* @param sourceDirectory Path to the directory that the results were generated for.
|
* @param sourceDirectory Path to the directory that the results were generated for.
|
||||||
*/
|
*/
|
||||||
void LoadResults(const QString selectedFile, const QString sourceDirectory);
|
void loadResults(const QString selectedFile, const QString sourceDirectory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Load project file to the GUI.
|
* @brief Load project file to the GUI.
|
||||||
* @param filePath Filename (inc. path) of project file to load.
|
* @param filePath Filename (inc. path) of project file to load.
|
||||||
*/
|
*/
|
||||||
void LoadProjectFile(const QString &filePath);
|
void loadProjectFile(const QString &filePath);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Load library file
|
* @brief Load library file
|
||||||
|
@ -355,7 +355,7 @@ private:
|
||||||
* @param filename filename (no path)
|
* @param filename filename (no path)
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
Library::Error LoadLibrary(Library *library, QString filename);
|
Library::Error loadLibrary(Library *library, QString filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Tries to load library file, prints message on error
|
* @brief Tries to load library file, prints message on error
|
||||||
|
@ -363,24 +363,24 @@ private:
|
||||||
* @param filename filename (no path)
|
* @param filename filename (no path)
|
||||||
* @return True if no error
|
* @return True if no error
|
||||||
*/
|
*/
|
||||||
bool TryLoadLibrary(Library *library, QString filename);
|
bool tryLoadLibrary(Library *library, QString filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Update project MRU items in File-menu.
|
* @brief Update project MRU items in File-menu.
|
||||||
*/
|
*/
|
||||||
void UpdateMRUMenuItems();
|
void updateMRUMenuItems();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add project file (path) to the MRU list.
|
* @brief Add project file (path) to the MRU list.
|
||||||
* @param project Full path to the project file to add.
|
* @param project Full path to the project file to add.
|
||||||
*/
|
*/
|
||||||
void AddProjectMRU(const QString &project);
|
void addProjectMRU(const QString &project);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove project file (path) from the MRU list.
|
* @brief Remove project file (path) from the MRU list.
|
||||||
* @param project Full path of the project file to remove.
|
* @param project Full path of the project file to remove.
|
||||||
*/
|
*/
|
||||||
void RemoveProjectMRU(const QString &project);
|
void removeProjectMRU(const QString &project);
|
||||||
|
|
||||||
/** @brief Program settings */
|
/** @brief Program settings */
|
||||||
QSettings *mSettings;
|
QSettings *mSettings;
|
||||||
|
|
|
@ -34,5 +34,5 @@ void ScratchPad::CheckButtonClicked()
|
||||||
QString filename = mUI.lineEdit->text();
|
QString filename = mUI.lineEdit->text();
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
filename = "test.cpp";
|
filename = "test.cpp";
|
||||||
mMainWindow.CheckCode(mUI.plainTextEdit->toPlainText(), filename);
|
mMainWindow.checkCode(mUI.plainTextEdit->toPlainText(), filename);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue