GUI: Refactorings
This commit is contained in:
parent
5189dec343
commit
81a38bd7ea
|
@ -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;
|
||||||
|
}
|
||||||
|
|
|
@ -41,15 +41,15 @@ public:
|
||||||
ProjectFile(const QString &filename, QObject *parent = 0);
|
ProjectFile(const QString &filename, QObject *parent = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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;
|
||||||
}
|
}
|
||||||
|
@ -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.
|
||||||
|
@ -115,45 +127,45 @@ 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());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -166,9 +178,9 @@ public:
|
||||||
static void WriteStringList(QXmlStreamWriter &xmlWriter, const QStringList &stringlist, const char startelementname[], const char stringelementname[]);
|
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;
|
||||||
}
|
}
|
||||||
|
@ -176,89 +188,94 @@ public:
|
||||||
protected:
|
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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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
|
||||||
* @param stringlist destination string list
|
* @param stringlist destination string list
|
||||||
* @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[]);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Filename (+path) of the project file.
|
* @brief Convert paths
|
||||||
*/
|
*/
|
||||||
|
static QStringList fromNativeSeparators(const QStringList &paths);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Filename (+path) of the project file.
|
||||||
|
*/
|
||||||
QString mFilename;
|
QString mFilename;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Root path (optional) for the project.
|
* @brief Root path (optional) for the project.
|
||||||
* This is the project root path. If it is present then all relative paths in
|
* This is the project root path. If it is present then all relative paths in
|
||||||
* the project file are relative to this path. Otherwise paths are relative
|
* the project file are relative to this path. Otherwise paths are relative
|
||||||
* to project file's path.
|
* to project file's path.
|
||||||
*/
|
*/
|
||||||
QString mRootPath;
|
QString mRootPath;
|
||||||
|
|
||||||
QString mImportProject;
|
QString mImportProject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief List of include directories used to search include files.
|
* @brief List of include directories used to search include files.
|
||||||
*/
|
*/
|
||||||
QStringList mIncludeDirs;
|
QStringList mIncludeDirs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief List of defines.
|
* @brief List of defines.
|
||||||
*/
|
*/
|
||||||
QStringList mDefines;
|
QStringList mDefines;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief List of paths to check.
|
* @brief List of paths to check.
|
||||||
*/
|
*/
|
||||||
QStringList mPaths;
|
QStringList mPaths;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Paths excluded from the check.
|
* @brief Paths excluded from the check.
|
||||||
*/
|
*/
|
||||||
QStringList mExcludedPaths;
|
QStringList mExcludedPaths;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief List of libraries.
|
* @brief List of libraries.
|
||||||
*/
|
*/
|
||||||
QStringList mLibraries;
|
QStringList mLibraries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue