GUI: Rename methods in ProjectFile
This commit is contained in:
parent
6c424709b6
commit
8d704f7709
|
@ -362,7 +362,7 @@ void MainWindow::DoCheckProject(ImportProject p)
|
||||||
mIsLogfileLoaded = false;
|
mIsLogfileLoaded = false;
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
foreach (const QString &s, mProject->getProjectFile()->GetExcludedPaths()) {
|
foreach (const QString &s, mProject->getProjectFile()->getExcludedPaths()) {
|
||||||
v.push_back(s.toStdString());
|
v.push_back(s.toStdString());
|
||||||
}
|
}
|
||||||
p.ignorePaths(v);
|
p.ignorePaths(v);
|
||||||
|
@ -386,7 +386,7 @@ void MainWindow::DoCheckProject(ImportProject p)
|
||||||
checkSettings.force = false;
|
checkSettings.force = false;
|
||||||
|
|
||||||
if (mProject)
|
if (mProject)
|
||||||
qDebug() << "Checking project file" << mProject->getProjectFile()->GetFilename();
|
qDebug() << "Checking project file" << mProject->getProjectFile()->getFilename();
|
||||||
|
|
||||||
if (!checkSettings.buildDir.empty()) {
|
if (!checkSettings.buildDir.empty()) {
|
||||||
std::list<std::string> sourcefiles;
|
std::list<std::string> sourcefiles;
|
||||||
|
@ -409,7 +409,7 @@ void MainWindow::DoCheckFiles(const QStringList &files)
|
||||||
FileList pathList;
|
FileList pathList;
|
||||||
pathList.AddPathList(files);
|
pathList.AddPathList(files);
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
pathList.AddExcludeList(mProject->getProjectFile()->GetExcludedPaths());
|
pathList.AddExcludeList(mProject->getProjectFile()->getExcludedPaths());
|
||||||
} else {
|
} else {
|
||||||
EnableProjectActions(false);
|
EnableProjectActions(false);
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ void MainWindow::DoCheckFiles(const QStringList &files)
|
||||||
Settings checkSettings = GetCppcheckSettings();
|
Settings checkSettings = GetCppcheckSettings();
|
||||||
|
|
||||||
if (mProject)
|
if (mProject)
|
||||||
qDebug() << "Checking project file" << mProject->getProjectFile()->GetFilename();
|
qDebug() << "Checking project file" << mProject->getProjectFile()->getFilename();
|
||||||
|
|
||||||
if (!checkSettings.buildDir.empty()) {
|
if (!checkSettings.buildDir.empty()) {
|
||||||
std::list<std::string> sourcefiles;
|
std::list<std::string> sourcefiles;
|
||||||
|
@ -642,7 +642,7 @@ Library::Error MainWindow::LoadLibrary(Library *library, QString filename)
|
||||||
|
|
||||||
// Try to load the library from the project folder..
|
// Try to load the library from the project folder..
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
QString path = QFileInfo(mProject->getProjectFile()->GetFilename()).canonicalPath();
|
QString path = QFileInfo(mProject->getProjectFile()->getFilename()).canonicalPath();
|
||||||
ret = library->load(NULL, (path+"/"+filename).toLatin1());
|
ret = library->load(NULL, (path+"/"+filename).toLatin1());
|
||||||
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
|
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -742,24 +742,23 @@ Settings MainWindow::GetCppcheckSettings()
|
||||||
// If project file loaded, read settings from it
|
// If project file loaded, read settings from it
|
||||||
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();
|
||||||
QString define;
|
foreach (QString define, defines) {
|
||||||
foreach (define, defines) {
|
|
||||||
if (!result.userDefines.empty())
|
if (!result.userDefines.empty())
|
||||||
result.userDefines += ";";
|
result.userDefines += ";";
|
||||||
result.userDefines += define.toStdString();
|
result.userDefines += define.toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
foreach (QString suppression, suppressions) {
|
foreach (QString suppression, suppressions) {
|
||||||
result.nomsg.addSuppressionLine(suppression.toStdString());
|
result.nomsg.addSuppressionLine(suppression.toStdString());
|
||||||
}
|
}
|
||||||
|
@ -768,9 +767,9 @@ Settings MainWindow::GetCppcheckSettings()
|
||||||
if (!defines.isEmpty())
|
if (!defines.isEmpty())
|
||||||
result.maxConfigs = 1;
|
result.maxConfigs = 1;
|
||||||
|
|
||||||
QString buildDir = pfile->GetBuildDir();
|
QString buildDir = pfile->getBuildDir();
|
||||||
if (!buildDir.isEmpty()) {
|
if (!buildDir.isEmpty()) {
|
||||||
QString prjpath = QFileInfo(pfile->GetFilename()).absolutePath();
|
QString prjpath = QFileInfo(pfile->getFilename()).absolutePath();
|
||||||
result.buildDir = (prjpath + '/' + buildDir).toStdString();
|
result.buildDir = (prjpath + '/' + buildDir).toStdString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -934,7 +933,7 @@ void MainWindow::ReCheckSelected(QStringList files, bool all)
|
||||||
FileList pathList;
|
FileList pathList;
|
||||||
pathList.AddPathList(files);
|
pathList.AddPathList(files);
|
||||||
if (mProject)
|
if (mProject)
|
||||||
pathList.AddExcludeList(mProject->getProjectFile()->GetExcludedPaths());
|
pathList.AddExcludeList(mProject->getProjectFile()->getExcludedPaths());
|
||||||
QStringList fileNames = pathList.GetFileList();
|
QStringList fileNames = pathList.GetFileList();
|
||||||
CheckLockDownUI(); // lock UI while checking
|
CheckLockDownUI(); // lock UI while checking
|
||||||
mUI.mResults->CheckingStarted(fileNames.size());
|
mUI.mResults->CheckingStarted(fileNames.size());
|
||||||
|
@ -965,7 +964,7 @@ void MainWindow::ReCheck(bool all)
|
||||||
mUI.mResults->CheckingStarted(files.size());
|
mUI.mResults->CheckingStarted(files.size());
|
||||||
|
|
||||||
if (mProject)
|
if (mProject)
|
||||||
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);
|
||||||
|
@ -1323,7 +1322,7 @@ void MainWindow::CheckProject(Project *project)
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo inf(project->getFilename());
|
QFileInfo inf(project->getFilename());
|
||||||
const QString rootpath = project->getProjectFile()->GetRootPath();
|
const QString rootpath = project->getProjectFile()->getRootPath();
|
||||||
|
|
||||||
// If the root path is not given or is not "current dir", use project
|
// If the root path is not given or is not "current dir", use project
|
||||||
// file's location directory as root path
|
// file's location directory as root path
|
||||||
|
@ -1334,15 +1333,15 @@ void MainWindow::CheckProject(Project *project)
|
||||||
else
|
else
|
||||||
mCurrentDirectory = rootpath;
|
mCurrentDirectory = rootpath;
|
||||||
|
|
||||||
if (!project->getProjectFile()->GetImportProject().isEmpty()) {
|
if (!project->getProjectFile()->getImportProject().isEmpty()) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList paths = project->getProjectFile()->GetCheckPaths();
|
QStringList paths = project->getProjectFile()->getCheckPaths();
|
||||||
|
|
||||||
// If paths not given then check the root path (which may be the project
|
// If paths not given then check the root path (which may be the project
|
||||||
// file's location, see above). This is to keep the compatibility with
|
// file's location, see above). This is to keep the compatibility with
|
||||||
|
|
|
@ -68,7 +68,7 @@ bool Project::open()
|
||||||
if (!QFile::exists(mFilename))
|
if (!QFile::exists(mFilename))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!mProjectFile->Read()) {
|
if (!mProjectFile->read()) {
|
||||||
QMessageBox msg(QMessageBox::Critical,
|
QMessageBox msg(QMessageBox::Critical,
|
||||||
tr("Cppcheck"),
|
tr("Cppcheck"),
|
||||||
tr("Could not read the project file."),
|
tr("Could not read the project file."),
|
||||||
|
@ -76,7 +76,7 @@ bool Project::open()
|
||||||
mParentWidget);
|
mParentWidget);
|
||||||
msg.exec();
|
msg.exec();
|
||||||
mFilename = QString();
|
mFilename = QString();
|
||||||
mProjectFile->SetFilename(mFilename);
|
mProjectFile->setFilename(mFilename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ bool Project::edit()
|
||||||
|
|
||||||
dlg.SaveToProjectFile(mProjectFile);
|
dlg.SaveToProjectFile(mProjectFile);
|
||||||
|
|
||||||
if (!mProjectFile->Write()) {
|
if (!mProjectFile->write()) {
|
||||||
QMessageBox msg(QMessageBox::Critical,
|
QMessageBox msg(QMessageBox::Critical,
|
||||||
tr("Cppcheck"),
|
tr("Cppcheck"),
|
||||||
tr("Could not write the project file."),
|
tr("Could not write the project file."),
|
||||||
|
|
|
@ -62,7 +62,7 @@ ProjectFile::ProjectFile(const QString &filename, QObject *parent) :
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProjectFile::Read(const QString &filename)
|
bool ProjectFile::read(const QString &filename)
|
||||||
{
|
{
|
||||||
if (!filename.isEmpty())
|
if (!filename.isEmpty())
|
||||||
mFilename = filename;
|
mFilename = filename;
|
||||||
|
@ -83,43 +83,43 @@ bool ProjectFile::Read(const QString &filename)
|
||||||
}
|
}
|
||||||
// Read root path from inside project element
|
// Read root path from inside project element
|
||||||
if (insideProject && xmlReader.name() == RootPathName)
|
if (insideProject && xmlReader.name() == RootPathName)
|
||||||
ReadRootPath(xmlReader);
|
readRootPath(xmlReader);
|
||||||
|
|
||||||
// Read root path from inside project element
|
// Read root path from inside project element
|
||||||
if (insideProject && xmlReader.name() == BuildDirElementName)
|
if (insideProject && xmlReader.name() == BuildDirElementName)
|
||||||
ReadBuildDir(xmlReader);
|
readBuildDir(xmlReader);
|
||||||
|
|
||||||
// Find paths to check from inside project element
|
// Find paths to check from inside project element
|
||||||
if (insideProject && xmlReader.name() == PathsElementName)
|
if (insideProject && xmlReader.name() == PathsElementName)
|
||||||
ReadCheckPaths(xmlReader);
|
readCheckPaths(xmlReader);
|
||||||
|
|
||||||
if (insideProject && xmlReader.name() == ImportProjectElementName)
|
if (insideProject && xmlReader.name() == ImportProjectElementName)
|
||||||
ReadImportProject(xmlReader);
|
readImportProject(xmlReader);
|
||||||
|
|
||||||
// Find include directory from inside project element
|
// Find include directory from inside project element
|
||||||
if (insideProject && xmlReader.name() == IncludeDirElementName)
|
if (insideProject && xmlReader.name() == IncludeDirElementName)
|
||||||
ReadIncludeDirs(xmlReader);
|
readIncludeDirs(xmlReader);
|
||||||
|
|
||||||
// Find preprocessor define from inside project element
|
// Find preprocessor define from inside project element
|
||||||
if (insideProject && xmlReader.name() == DefinesElementName)
|
if (insideProject && xmlReader.name() == DefinesElementName)
|
||||||
ReadDefines(xmlReader);
|
readDefines(xmlReader);
|
||||||
|
|
||||||
// Find exclude list from inside project element
|
// Find exclude list from inside project element
|
||||||
if (insideProject && xmlReader.name() == ExcludeElementName)
|
if (insideProject && xmlReader.name() == ExcludeElementName)
|
||||||
ReadExcludes(xmlReader);
|
readExcludes(xmlReader);
|
||||||
|
|
||||||
// Find ignore list from inside project element
|
// Find ignore list from inside project element
|
||||||
// These are read for compatibility
|
// These are read for compatibility
|
||||||
if (insideProject && xmlReader.name() == IgnoreElementName)
|
if (insideProject && xmlReader.name() == IgnoreElementName)
|
||||||
ReadExcludes(xmlReader);
|
readExcludes(xmlReader);
|
||||||
|
|
||||||
// Find libraries list from inside project element
|
// Find libraries list from inside project element
|
||||||
if (insideProject && xmlReader.name() == LibrariesElementName)
|
if (insideProject && xmlReader.name() == LibrariesElementName)
|
||||||
ReadStringList(mLibraries, xmlReader,LibraryElementName);
|
readStringList(mLibraries, xmlReader,LibraryElementName);
|
||||||
|
|
||||||
// Find suppressions list from inside project element
|
// Find suppressions list from inside project element
|
||||||
if (insideProject && xmlReader.name() == SuppressionsElementName)
|
if (insideProject && xmlReader.name() == SuppressionsElementName)
|
||||||
ReadStringList(mSuppressions, xmlReader,SuppressionElementName);
|
readStringList(mSuppressions, xmlReader,SuppressionElementName);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -143,13 +143,10 @@ bool ProjectFile::Read(const QString &filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
if (projectTagFound)
|
return projectTagFound;
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::ReadRootPath(QXmlStreamReader &reader)
|
void ProjectFile::readRootPath(QXmlStreamReader &reader)
|
||||||
{
|
{
|
||||||
QXmlStreamAttributes attribs = reader.attributes();
|
QXmlStreamAttributes attribs = reader.attributes();
|
||||||
QString name = attribs.value("", RootPathNameAttrib).toString();
|
QString name = attribs.value("", RootPathNameAttrib).toString();
|
||||||
|
@ -157,7 +154,7 @@ void ProjectFile::ReadRootPath(QXmlStreamReader &reader)
|
||||||
mRootPath = name;
|
mRootPath = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::ReadBuildDir(QXmlStreamReader &reader)
|
void ProjectFile::readBuildDir(QXmlStreamReader &reader)
|
||||||
{
|
{
|
||||||
mBuildDir.clear();
|
mBuildDir.clear();
|
||||||
do {
|
do {
|
||||||
|
@ -182,7 +179,7 @@ void ProjectFile::ReadBuildDir(QXmlStreamReader &reader)
|
||||||
} while (1);
|
} while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::ReadImportProject(QXmlStreamReader &reader)
|
void ProjectFile::readImportProject(QXmlStreamReader &reader)
|
||||||
{
|
{
|
||||||
mImportProject.clear();
|
mImportProject.clear();
|
||||||
do {
|
do {
|
||||||
|
@ -207,7 +204,7 @@ void ProjectFile::ReadImportProject(QXmlStreamReader &reader)
|
||||||
} while (1);
|
} while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::ReadIncludeDirs(QXmlStreamReader &reader)
|
void ProjectFile::readIncludeDirs(QXmlStreamReader &reader)
|
||||||
{
|
{
|
||||||
QXmlStreamReader::TokenType type;
|
QXmlStreamReader::TokenType type;
|
||||||
bool allRead = false;
|
bool allRead = false;
|
||||||
|
@ -245,7 +242,7 @@ void ProjectFile::ReadIncludeDirs(QXmlStreamReader &reader)
|
||||||
} while (!allRead);
|
} while (!allRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::ReadDefines(QXmlStreamReader &reader)
|
void ProjectFile::readDefines(QXmlStreamReader &reader)
|
||||||
{
|
{
|
||||||
QXmlStreamReader::TokenType type;
|
QXmlStreamReader::TokenType type;
|
||||||
bool allRead = false;
|
bool allRead = false;
|
||||||
|
@ -282,7 +279,7 @@ void ProjectFile::ReadDefines(QXmlStreamReader &reader)
|
||||||
} while (!allRead);
|
} while (!allRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::ReadCheckPaths(QXmlStreamReader &reader)
|
void ProjectFile::readCheckPaths(QXmlStreamReader &reader)
|
||||||
{
|
{
|
||||||
QXmlStreamReader::TokenType type;
|
QXmlStreamReader::TokenType type;
|
||||||
bool allRead = false;
|
bool allRead = false;
|
||||||
|
@ -320,7 +317,7 @@ void ProjectFile::ReadCheckPaths(QXmlStreamReader &reader)
|
||||||
} while (!allRead);
|
} while (!allRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::ReadExcludes(QXmlStreamReader &reader)
|
void ProjectFile::readExcludes(QXmlStreamReader &reader)
|
||||||
{
|
{
|
||||||
QXmlStreamReader::TokenType type;
|
QXmlStreamReader::TokenType type;
|
||||||
bool allRead = false;
|
bool allRead = false;
|
||||||
|
@ -367,7 +364,7 @@ void ProjectFile::ReadExcludes(QXmlStreamReader &reader)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ProjectFile::ReadStringList(QStringList &stringlist, QXmlStreamReader &reader, const char elementname[])
|
void ProjectFile::readStringList(QStringList &stringlist, QXmlStreamReader &reader, const char elementname[])
|
||||||
{
|
{
|
||||||
QXmlStreamReader::TokenType type;
|
QXmlStreamReader::TokenType type;
|
||||||
bool allRead = false;
|
bool allRead = false;
|
||||||
|
@ -405,37 +402,37 @@ void ProjectFile::ReadStringList(QStringList &stringlist, QXmlStreamReader &read
|
||||||
} while (!allRead);
|
} while (!allRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::SetIncludes(const QStringList &includes)
|
void ProjectFile::setIncludes(const QStringList &includes)
|
||||||
{
|
{
|
||||||
mIncludeDirs = includes;
|
mIncludeDirs = includes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::SetDefines(const QStringList &defines)
|
void ProjectFile::setDefines(const QStringList &defines)
|
||||||
{
|
{
|
||||||
mDefines = defines;
|
mDefines = defines;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::SetCheckPaths(const QStringList &paths)
|
void ProjectFile::setCheckPaths(const QStringList &paths)
|
||||||
{
|
{
|
||||||
mPaths = paths;
|
mPaths = paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::SetExcludedPaths(const QStringList &paths)
|
void ProjectFile::setExcludedPaths(const QStringList &paths)
|
||||||
{
|
{
|
||||||
mExcludedPaths = paths;
|
mExcludedPaths = paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::SetLibraries(const QStringList &libraries)
|
void ProjectFile::setLibraries(const QStringList &libraries)
|
||||||
{
|
{
|
||||||
mLibraries = libraries;
|
mLibraries = libraries;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::SetSuppressions(const QStringList &suppressions)
|
void ProjectFile::setSuppressions(const QStringList &suppressions)
|
||||||
{
|
{
|
||||||
mSuppressions = suppressions;
|
mSuppressions = suppressions;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProjectFile::Write(const QString &filename)
|
bool ProjectFile::write(const QString &filename)
|
||||||
{
|
{
|
||||||
if (!filename.isEmpty())
|
if (!filename.isEmpty())
|
||||||
mFilename = filename;
|
mFilename = filename;
|
||||||
|
@ -508,12 +505,12 @@ bool ProjectFile::Write(const QString &filename)
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteStringList(xmlWriter,
|
writeStringList(xmlWriter,
|
||||||
mLibraries,
|
mLibraries,
|
||||||
LibrariesElementName,
|
LibrariesElementName,
|
||||||
LibraryElementName);
|
LibraryElementName);
|
||||||
|
|
||||||
WriteStringList(xmlWriter,
|
writeStringList(xmlWriter,
|
||||||
mSuppressions,
|
mSuppressions,
|
||||||
SuppressionsElementName,
|
SuppressionsElementName,
|
||||||
SuppressionElementName);
|
SuppressionElementName);
|
||||||
|
@ -523,7 +520,7 @@ bool ProjectFile::Write(const QString &filename)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFile::WriteStringList(QXmlStreamWriter &xmlWriter, const QStringList &stringlist, const char startelementname[], const char stringelementname[])
|
void ProjectFile::writeStringList(QXmlStreamWriter &xmlWriter, const QStringList &stringlist, const char startelementname[], const char stringelementname[])
|
||||||
{
|
{
|
||||||
if (stringlist.isEmpty())
|
if (stringlist.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -44,21 +44,21 @@ public:
|
||||||
* @brief Read the project file.
|
* @brief Read the project file.
|
||||||
* @param filename Filename (can be also given to constructor).
|
* @param filename Filename (can be also given to constructor).
|
||||||
*/
|
*/
|
||||||
bool Read(const QString &filename = QString());
|
bool read(const QString &filename = QString());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get project root path.
|
* @brief Get project root path.
|
||||||
* @return project root path.
|
* @return project root path.
|
||||||
*/
|
*/
|
||||||
QString GetRootPath() const {
|
QString getRootPath() const {
|
||||||
return mRootPath;
|
return mRootPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GetBuildDir() const {
|
QString getBuildDir() const {
|
||||||
return mBuildDir;
|
return mBuildDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GetImportProject() const {
|
QString getImportProject() const {
|
||||||
return mImportProject;
|
return mImportProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public:
|
||||||
* @brief Get list of include directories.
|
* @brief Get list of include directories.
|
||||||
* @return list of directories.
|
* @return list of directories.
|
||||||
*/
|
*/
|
||||||
QStringList GetIncludeDirs() const {
|
QStringList getIncludeDirs() const {
|
||||||
return ProjectFile::fromNativeSeparators(mIncludeDirs);
|
return ProjectFile::fromNativeSeparators(mIncludeDirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ public:
|
||||||
* @brief Get list of defines.
|
* @brief Get list of defines.
|
||||||
* @return list of defines.
|
* @return list of defines.
|
||||||
*/
|
*/
|
||||||
QStringList GetDefines() const {
|
QStringList getDefines() const {
|
||||||
return mDefines;
|
return mDefines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public:
|
||||||
* @brief Get list of paths to check.
|
* @brief Get list of paths to check.
|
||||||
* @return list of paths.
|
* @return list of paths.
|
||||||
*/
|
*/
|
||||||
QStringList GetCheckPaths() const {
|
QStringList getCheckPaths() const {
|
||||||
return ProjectFile::fromNativeSeparators(mPaths);
|
return ProjectFile::fromNativeSeparators(mPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public:
|
||||||
* @brief Get list of paths to exclude from the check.
|
* @brief Get list of paths to exclude from the check.
|
||||||
* @return list of paths.
|
* @return list of paths.
|
||||||
*/
|
*/
|
||||||
QStringList GetExcludedPaths() const {
|
QStringList getExcludedPaths() const {
|
||||||
return ProjectFile::fromNativeSeparators(mExcludedPaths);
|
return ProjectFile::fromNativeSeparators(mExcludedPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ public:
|
||||||
* @brief Get list libraries.
|
* @brief Get list libraries.
|
||||||
* @return list of libraries.
|
* @return list of libraries.
|
||||||
*/
|
*/
|
||||||
QStringList GetLibraries() const {
|
QStringList getLibraries() const {
|
||||||
return mLibraries;
|
return mLibraries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public:
|
||||||
* @brief Get list suppressions.
|
* @brief Get list suppressions.
|
||||||
* @return list of suppressions.
|
* @return list of suppressions.
|
||||||
*/
|
*/
|
||||||
QStringList GetSuppressions() const {
|
QStringList getSuppressions() const {
|
||||||
return mSuppressions;
|
return mSuppressions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ public:
|
||||||
* @brief Get filename for the project file.
|
* @brief Get filename for the project file.
|
||||||
* @return file name.
|
* @return file name.
|
||||||
*/
|
*/
|
||||||
QString GetFilename() const {
|
QString getFilename() const {
|
||||||
return mFilename;
|
return mFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,16 +122,16 @@ public:
|
||||||
* @brief Set project root path.
|
* @brief Set project root path.
|
||||||
* @param rootpath new project root path.
|
* @param rootpath new project root path.
|
||||||
*/
|
*/
|
||||||
void SetRootPath(const QString &rootpath) {
|
void setRootPath(const QString &rootpath) {
|
||||||
mRootPath = rootpath;
|
mRootPath = rootpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SetBuildDir(const QString &buildDir) {
|
void setBuildDir(const QString &buildDir) {
|
||||||
mBuildDir = buildDir;
|
mBuildDir = buildDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetImportProject(const QString &importProject) {
|
void setImportProject(const QString &importProject) {
|
||||||
mImportProject = importProject;
|
mImportProject = importProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,58 +139,49 @@ public:
|
||||||
* @brief Set list of includes.
|
* @brief Set list of includes.
|
||||||
* @param includes List of defines.
|
* @param includes List of defines.
|
||||||
*/
|
*/
|
||||||
void SetIncludes(const QStringList &includes);
|
void setIncludes(const QStringList &includes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set list of defines.
|
* @brief Set list of defines.
|
||||||
* @param defines List of defines.
|
* @param defines List of defines.
|
||||||
*/
|
*/
|
||||||
void SetDefines(const QStringList &defines);
|
void setDefines(const QStringList &defines);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set list of paths to check.
|
* @brief Set list of paths to check.
|
||||||
* @param paths List of paths.
|
* @param paths List of paths.
|
||||||
*/
|
*/
|
||||||
void SetCheckPaths(const QStringList &paths);
|
void setCheckPaths(const QStringList &paths);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set list of paths to exclude from the check.
|
* @brief Set list of paths to exclude from the check.
|
||||||
* @param paths List of paths.
|
* @param paths List of paths.
|
||||||
*/
|
*/
|
||||||
void SetExcludedPaths(const QStringList &paths);
|
void setExcludedPaths(const QStringList &paths);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set list of libraries.
|
* @brief Set list of libraries.
|
||||||
* @param libraries List of libraries.
|
* @param libraries List of libraries.
|
||||||
*/
|
*/
|
||||||
void SetLibraries(const QStringList &libraries);
|
void setLibraries(const QStringList &libraries);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set list of suppressions.
|
* @brief Set list of suppressions.
|
||||||
* @param suppressions List of suppressions.
|
* @param suppressions List of suppressions.
|
||||||
*/
|
*/
|
||||||
void SetSuppressions(const QStringList &suppressions);
|
void setSuppressions(const QStringList &suppressions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Write project file (to disk).
|
* @brief Write project file (to disk).
|
||||||
* @param filename Filename to use.
|
* @param filename Filename to use.
|
||||||
*/
|
*/
|
||||||
bool Write(const QString &filename = QString());
|
bool write(const QString &filename = QString());
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Write string list
|
|
||||||
* @param xmlWriter xml writer
|
|
||||||
* @param stringlist string list to write
|
|
||||||
* @param startelementname name of start element
|
|
||||||
* @param stringelementname name of each string element
|
|
||||||
*/
|
|
||||||
static void WriteStringList(QXmlStreamWriter &xmlWriter, const QStringList &stringlist, const char startelementname[], const char stringelementname[]);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set filename for the project file.
|
* @brief Set filename for the project file.
|
||||||
* @param filename Filename to use.
|
* @param filename Filename to use.
|
||||||
*/
|
*/
|
||||||
void SetFilename(const QString &filename) {
|
void setFilename(const QString &filename) {
|
||||||
mFilename = filename;
|
mFilename = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,39 +191,39 @@ protected:
|
||||||
* @brief Read optional root path from XML.
|
* @brief Read optional root path from XML.
|
||||||
* @param reader XML stream reader.
|
* @param reader XML stream reader.
|
||||||
*/
|
*/
|
||||||
void ReadRootPath(QXmlStreamReader &reader);
|
void readRootPath(QXmlStreamReader &reader);
|
||||||
|
|
||||||
void ReadBuildDir(QXmlStreamReader &reader);
|
void readBuildDir(QXmlStreamReader &reader);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read importproject from XML.
|
* @brief Read importproject from XML.
|
||||||
* @param reader XML stream reader.
|
* @param reader XML stream reader.
|
||||||
*/
|
*/
|
||||||
void ReadImportProject(QXmlStreamReader &reader);
|
void readImportProject(QXmlStreamReader &reader);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read list of include directories from XML.
|
* @brief Read list of include directories from XML.
|
||||||
* @param reader XML stream reader.
|
* @param reader XML stream reader.
|
||||||
*/
|
*/
|
||||||
void ReadIncludeDirs(QXmlStreamReader &reader);
|
void readIncludeDirs(QXmlStreamReader &reader);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read list of defines from XML.
|
* @brief Read list of defines from XML.
|
||||||
* @param reader XML stream reader.
|
* @param reader XML stream reader.
|
||||||
*/
|
*/
|
||||||
void ReadDefines(QXmlStreamReader &reader);
|
void readDefines(QXmlStreamReader &reader);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read list paths to check.
|
* @brief Read list paths to check.
|
||||||
* @param reader XML stream reader.
|
* @param reader XML stream reader.
|
||||||
*/
|
*/
|
||||||
void ReadCheckPaths(QXmlStreamReader &reader);
|
void readCheckPaths(QXmlStreamReader &reader);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read lists of excluded paths.
|
* @brief Read lists of excluded paths.
|
||||||
* @param reader XML stream reader.
|
* @param reader XML stream reader.
|
||||||
*/
|
*/
|
||||||
void ReadExcludes(QXmlStreamReader &reader);
|
void readExcludes(QXmlStreamReader &reader);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read string list
|
* @brief Read string list
|
||||||
|
@ -240,7 +231,16 @@ protected:
|
||||||
* @param reader XML stream reader
|
* @param reader XML stream reader
|
||||||
* @param elementname elementname for each string
|
* @param elementname elementname for each string
|
||||||
*/
|
*/
|
||||||
void ReadStringList(QStringList &stringlist, QXmlStreamReader &reader, const char elementname[]);
|
void readStringList(QStringList &stringlist, QXmlStreamReader &reader, const char elementname[]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write string list
|
||||||
|
* @param xmlWriter xml writer
|
||||||
|
* @param stringlist string list to write
|
||||||
|
* @param startelementname name of start element
|
||||||
|
* @param stringelementname name of each string element
|
||||||
|
*/
|
||||||
|
static void writeStringList(QXmlStreamWriter &xmlWriter, const QStringList &stringlist, const char startelementname[], const char stringelementname[]);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -129,28 +129,28 @@ void ProjectFileDialog::SaveSettings() const
|
||||||
|
|
||||||
void ProjectFileDialog::LoadFromProjectFile(const ProjectFile *projectFile)
|
void ProjectFileDialog::LoadFromProjectFile(const ProjectFile *projectFile)
|
||||||
{
|
{
|
||||||
SetRootPath(projectFile->GetRootPath());
|
SetRootPath(projectFile->getRootPath());
|
||||||
SetBuildDir(projectFile->GetBuildDir());
|
SetBuildDir(projectFile->getBuildDir());
|
||||||
SetIncludepaths(projectFile->GetIncludeDirs());
|
SetIncludepaths(projectFile->getIncludeDirs());
|
||||||
SetDefines(projectFile->GetDefines());
|
SetDefines(projectFile->getDefines());
|
||||||
SetCheckPaths(projectFile->GetCheckPaths());
|
SetCheckPaths(projectFile->getCheckPaths());
|
||||||
SetImportProject(projectFile->GetImportProject());
|
SetImportProject(projectFile->getImportProject());
|
||||||
SetExcludedPaths(projectFile->GetExcludedPaths());
|
SetExcludedPaths(projectFile->getExcludedPaths());
|
||||||
SetLibraries(projectFile->GetLibraries());
|
SetLibraries(projectFile->getLibraries());
|
||||||
SetSuppressions(projectFile->GetSuppressions());
|
SetSuppressions(projectFile->getSuppressions());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectFileDialog::SaveToProjectFile(ProjectFile *projectFile) const
|
void ProjectFileDialog::SaveToProjectFile(ProjectFile *projectFile) const
|
||||||
{
|
{
|
||||||
projectFile->SetRootPath(GetRootPath());
|
projectFile->setRootPath(GetRootPath());
|
||||||
projectFile->SetBuildDir(GetBuildDir());
|
projectFile->setBuildDir(GetBuildDir());
|
||||||
projectFile->SetImportProject(GetImportProject());
|
projectFile->setImportProject(GetImportProject());
|
||||||
projectFile->SetIncludes(GetIncludePaths());
|
projectFile->setIncludes(GetIncludePaths());
|
||||||
projectFile->SetDefines(GetDefines());
|
projectFile->setDefines(GetDefines());
|
||||||
projectFile->SetCheckPaths(GetCheckPaths());
|
projectFile->setCheckPaths(GetCheckPaths());
|
||||||
projectFile->SetExcludedPaths(GetExcludedPaths());
|
projectFile->setExcludedPaths(GetExcludedPaths());
|
||||||
projectFile->SetLibraries(GetLibraries());
|
projectFile->setLibraries(GetLibraries());
|
||||||
projectFile->SetSuppressions(GetSuppressions());
|
projectFile->setSuppressions(GetSuppressions());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProjectFileDialog::getExistingDirectory(const QString &caption, bool trailingSlash)
|
QString ProjectFileDialog::getExistingDirectory(const QString &caption, bool trailingSlash)
|
||||||
|
|
|
@ -44,10 +44,10 @@ void StatsDialog::setProject(const Project& project)
|
||||||
{
|
{
|
||||||
ProjectFile *projectFile = project.getProjectFile();
|
ProjectFile *projectFile = project.getProjectFile();
|
||||||
if (projectFile) {
|
if (projectFile) {
|
||||||
mUI.mProject->setText(projectFile->GetRootPath());
|
mUI.mProject->setText(projectFile->getRootPath());
|
||||||
mUI.mPaths->setText(projectFile->GetCheckPaths().join(";"));
|
mUI.mPaths->setText(projectFile->getCheckPaths().join(";"));
|
||||||
mUI.mIncludePaths->setText(projectFile->GetIncludeDirs().join(";"));
|
mUI.mIncludePaths->setText(projectFile->getIncludeDirs().join(";"));
|
||||||
mUI.mDefines->setText(projectFile->GetDefines().join(";"));
|
mUI.mDefines->setText(projectFile->getDefines().join(";"));
|
||||||
} else {
|
} else {
|
||||||
mUI.mProject->setText("");
|
mUI.mProject->setText("");
|
||||||
mUI.mPaths->setText("");
|
mUI.mPaths->setText("");
|
||||||
|
|
Loading…
Reference in New Issue