GUI: Refactoring, split out getAddonPath()

This commit is contained in:
Daniel Marjamäki 2017-08-03 17:26:16 +02:00
parent 14efd2fdf5
commit 1be04346b3
2 changed files with 15 additions and 9 deletions

View File

@ -72,15 +72,7 @@ void CheckThread::run()
return;
}
QString addonPath;
if (QFileInfo(mDataDir + "/threadsafety.py").exists())
addonPath = mDataDir;
else if (QDir(mDataDir + "/addons").exists())
addonPath = mDataDir + "/addons";
else if (mDataDir.endsWith("/cfg")) {
if (QDir(mDataDir.mid(0,mDataDir.size()-3) + "addons").exists())
addonPath = mDataDir.mid(0,mDataDir.size()-3) + "addons";
}
QString addonPath = getAddonPath();
bool needDump = mAddons.contains("y2038") || mAddons.contains("threadsafety") || mAddons.contains("cert") || mAddons.contains("misra");
QString file = mResult.getNextFile();
@ -182,6 +174,18 @@ void CheckThread::stop()
mCppcheck.terminate();
}
QString CheckThread::getAddonPath() const {
if (QFileInfo(mDataDir + "/threadsafety.py").exists())
return mDataDir;
else if (QDir(mDataDir + "/addons").exists())
return mDataDir + "/addons";
else if (mDataDir.endsWith("/cfg")) {
if (QDir(mDataDir.mid(0,mDataDir.size()-3) + "addons").exists())
return mDataDir.mid(0,mDataDir.size()-3) + "addons";
}
return QString();
}
void CheckThread::parseAddonErrors(QString err, QString tool)
{
QTextStream in(&err, QIODevice::ReadOnly);

View File

@ -106,6 +106,8 @@ protected:
CppCheck mCppcheck;
private:
QString getAddonPath() const;
void parseAddonErrors(QString err, QString tool);
void parseClangErrors(QString err);