GUI: Refactorings

This commit is contained in:
Daniel Marjamäki 2016-10-02 18:03:21 +02:00
parent 5189dec343
commit 81a38bd7ea
2 changed files with 101 additions and 126 deletions

View File

@ -144,56 +144,6 @@ bool ProjectFile::Read(const QString &filename)
return false; return false;
} }
QStringList ProjectFile::GetIncludeDirs() const
{
QStringList dirs;
foreach (QString path, mIncludeDirs) {
dirs << QDir::fromNativeSeparators(path);
}
return dirs;
}
QStringList ProjectFile::GetDefines() const
{
return mDefines;
}
QStringList ProjectFile::GetCheckPaths() const
{
QStringList paths;
foreach (QString path, mPaths) {
paths << QDir::fromNativeSeparators(path);
}
return paths;
}
QStringList ProjectFile::GetExcludedPaths() const
{
QStringList paths;
foreach (QString path, mExcludedPaths) {
paths << QDir::fromNativeSeparators(path);
}
return paths;
}
QStringList ProjectFile::GetLibraries() const
{
QStringList libraries;
foreach (QString library, mLibraries) {
libraries << library;
}
return libraries;
}
QStringList ProjectFile::GetSuppressions() const
{
QStringList suppressions;
foreach (QString suppression, mSuppressions) {
suppressions << suppression;
}
return suppressions;
}
void ProjectFile::ReadRootPath(QXmlStreamReader &reader) void ProjectFile::ReadRootPath(QXmlStreamReader &reader)
{ {
QXmlStreamAttributes attribs = reader.attributes(); QXmlStreamAttributes attribs = reader.attributes();
@ -550,3 +500,11 @@ void ProjectFile::WriteStringList(QXmlStreamWriter &xmlWriter, const QStringList
} }
xmlWriter.writeEndElement(); xmlWriter.writeEndElement();
} }
QStringList ProjectFile::fromNativeSeparators(const QStringList &paths)
{
QStringList ret;
foreach (const QString &path, paths)
ret << QDir::fromNativeSeparators(path);
return ret;
}

View File

@ -62,37 +62,49 @@ 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);
}
/** /**
* @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;
}
/** /**
* @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);
}
/** /**
* @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);
}
/** /**
* @brief Get list libraries. * @brief Get list libraries.
* @return list of libraries. * @return list of libraries.
*/ */
QStringList GetLibraries() const; QStringList GetLibraries() const {
return mLibraries;
}
/** /**
* @brief Get list suppressions. * @brief Get list suppressions.
* @return list of suppressions. * @return list of suppressions.
*/ */
QStringList GetSuppressions() const; QStringList GetSuppressions() const {
return mSuppressions;
}
/** /**
* @brief Get filename for the project file. * @brief Get filename for the project file.
@ -221,6 +233,11 @@ protected:
private: private:
/**
* @brief Convert paths
*/
static QStringList fromNativeSeparators(const QStringList &paths);
/** /**
* @brief Filename (+path) of the project file. * @brief Filename (+path) of the project file.
*/ */