From e99e435818eaa13cbe95b6429a4615ae5416ac60 Mon Sep 17 00:00:00 2001 From: hjk <qthjk@ovi.com> Date: Thu, 26 Jan 2012 00:25:37 +0100 Subject: [PATCH] qtsupport: remove unneeded thing from headers, style. Change-Id: I059af357fa772290a78f62c31cb7c532ae7d77ff Reviewed-by: Kai Koehne <kai.koehne@nokia.com> --- .../qtsupport/debugginghelperbuildtask.cpp | 25 +++-- .../qtsupport/debugginghelperbuildtask.h | 8 +- src/plugins/qtsupport/qmlobservertool.cpp | 96 +++++++++---------- src/plugins/qtsupport/qmlobservertool.h | 20 +--- src/plugins/qtsupport/qtversionmanager.h | 11 --- 5 files changed, 62 insertions(+), 98 deletions(-) diff --git a/src/plugins/qtsupport/debugginghelperbuildtask.cpp b/src/plugins/qtsupport/debugginghelperbuildtask.cpp index 34ff8d7f22a..73a29b229b8 100644 --- a/src/plugins/qtsupport/debugginghelperbuildtask.cpp +++ b/src/plugins/qtsupport/debugginghelperbuildtask.cpp @@ -48,10 +48,11 @@ using namespace QtSupport; using namespace QtSupport::Internal; -using ProjectExplorer::DebuggingHelperLibrary; +using namespace QtSupport::Internal; +using namespace ProjectExplorer; DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version, - ProjectExplorer::ToolChain *toolChain, + ToolChain *toolChain, Tools tools) : m_tools(tools & availableTools(version)), m_invalidQt(false), @@ -65,9 +66,8 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version, qRegisterMetaType<DebuggingHelperBuildTask::Tools>("DebuggingHelperBuildTask::Tools"); // Print result in application ouptut - Core::MessageManager *messageManager = Core::MessageManager::instance(); connect(this, SIGNAL(logOutput(QString,bool)), - messageManager, SLOT(printToOutputPane(QString,bool)), + Core::MessageManager::instance(), SLOT(printToOutputPane(QString,bool)), Qt::QueuedConnection); // @@ -95,10 +95,10 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version, log(QCoreApplication::translate("QtVersion", "Building helper(s) with toolchain '%1' ...\n" ).arg(toolChain->displayName()), QString()); - if (toolChain->targetAbi().os() == ProjectExplorer::Abi::LinuxOS - && ProjectExplorer::Abi::hostAbi().os() == ProjectExplorer::Abi::WindowsOS) + if (toolChain->targetAbi().os() == Abi::LinuxOS + && Abi::hostAbi().os() == Abi::WindowsOS) m_target = QLatin1String("-unix"); - if (toolChain->targetAbi().os() == ProjectExplorer::Abi::SymbianOS) { + if (toolChain->targetAbi().os() == Abi::SymbianOS) { m_makeArguments << QLatin1String("debug-") + toolChain->defaultMakeTarget(); m_makeArguments << QLatin1String("release-") + toolChain->defaultMakeTarget(); m_makeArguments << QLatin1String("-k"); @@ -108,8 +108,8 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version, } m_qmakeCommand = version->qmakeCommand(); m_qmakeArguments = QStringList() << QLatin1String("-nocache"); - if (toolChain->targetAbi().os() == ProjectExplorer::Abi::MacOS - && toolChain->targetAbi().architecture() == ProjectExplorer::Abi::X86Architecture) { + if (toolChain->targetAbi().os() == Abi::MacOS + && toolChain->targetAbi().architecture() == Abi::X86Architecture) { // explicitly set 32 or 64 bit in case Qt is compiled with both if (toolChain->targetAbi().wordWidth() == 32) m_qmakeArguments << QLatin1String("CONFIG+=x86"); @@ -126,9 +126,6 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version, Qt::QueuedConnection); } -DebuggingHelperBuildTask::~DebuggingHelperBuildTask() -{ -} DebuggingHelperBuildTask::Tools DebuggingHelperBuildTask::availableTools(const BaseQtVersion *version) { @@ -136,8 +133,8 @@ DebuggingHelperBuildTask::Tools DebuggingHelperBuildTask::availableTools(const B // Check the build requirements of the tools DebuggingHelperBuildTask::Tools tools = 0; // Gdb helpers are needed on Mac/gdb only. - foreach (const ProjectExplorer::Abi &abi, version->qtAbis()) { - if (abi.os() == ProjectExplorer::Abi::MacOS) { + foreach (const Abi &abi, version->qtAbis()) { + if (abi.os() == Abi::MacOS) { tools |= DebuggingHelperBuildTask::GdbDebugging; break; } diff --git a/src/plugins/qtsupport/debugginghelperbuildtask.h b/src/plugins/qtsupport/debugginghelperbuildtask.h index 8f99e918a1d..f6ea9855094 100644 --- a/src/plugins/qtsupport/debugginghelperbuildtask.h +++ b/src/plugins/qtsupport/debugginghelperbuildtask.h @@ -42,11 +42,8 @@ #include <QtCore/QFutureInterface> #include <QtCore/QMetaType> -namespace ProjectExplorer { -class ToolChain; -} // namespace ProjectExplorer - namespace QtSupport { + class BaseQtVersion; class QTSUPPORT_EXPORT DebuggingHelperBuildTask : public QObject @@ -66,7 +63,6 @@ public: explicit DebuggingHelperBuildTask(const BaseQtVersion *version, ProjectExplorer::ToolChain *toolChain, Tools tools = AllTools); - virtual ~DebuggingHelperBuildTask(); void showOutputOnError(bool show); void run(QFutureInterface<void> &future); @@ -100,7 +96,7 @@ private: bool m_showErrors; }; -} // namespace Qt4ProjectManager +} // namespace QtSupport Q_DECLARE_METATYPE(QtSupport::DebuggingHelperBuildTask::Tools) diff --git a/src/plugins/qtsupport/qmlobservertool.cpp b/src/plugins/qtsupport/qmlobservertool.cpp index 9bd94f256d5..6dacb5b7efc 100644 --- a/src/plugins/qtsupport/qmlobservertool.cpp +++ b/src/plugins/qtsupport/qmlobservertool.cpp @@ -45,7 +45,46 @@ namespace QtSupport { -static inline QStringList validBinaryFilenames() +static QStringList recursiveFileList(const QDir &dir, const QString &prefix) +{ + QStringList files; + + QString _prefix = prefix; + if (!_prefix.isEmpty() && !_prefix.endsWith(QLatin1Char('/'))) + _prefix.append(QLatin1Char('/')); + + foreach (const QString &fileName, dir.entryList(QDir::Files)) + files << _prefix + fileName; + + foreach (const QString &subDir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) + files += recursiveFileList(QDir(dir.absoluteFilePath(subDir)), _prefix + subDir); + + return files; +} + +static QStringList installDirectories(const QString &qtInstallData) +{ + const QChar slash = QLatin1Char('/'); + const uint hash = qHash(qtInstallData); + QStringList directories; + directories + << (qtInstallData + QLatin1String("/qtc-qmlobserver/")) + << QDir::cleanPath((QCoreApplication::applicationDirPath() + QLatin1String("/../qtc-qmlobserver/") + QString::number(hash))) + slash + << (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/qtc-qmlobserver/") + QString::number(hash)) + slash; + return directories; +} + +static QString sourcePath() +{ + return Core::ICore::resourcePath() + QLatin1String("/qml/qmlobserver/"); +} + +static QStringList sourceFileNames() +{ + return recursiveFileList(QDir(sourcePath()), QString()); +} + +static QStringList validBinaryFilenames() { return QStringList() << QLatin1String("debug/qmlobserver.exe") @@ -92,7 +131,7 @@ QStringList QmlObserverTool::locationsByInstallData(const QString &qtInstallData QStringList result; QFileInfo fileInfo; const QStringList binFilenames = validBinaryFilenames(); - foreach(const QString &directory, installDirectories(qtInstallData)) { + foreach (const QString &directory, installDirectories(qtInstallData)) { if (getHelperFileInfoFor(binFilenames, directory, &fileInfo)) result << fileInfo.filePath(); } @@ -118,15 +157,14 @@ static inline bool mkpath(const QString &targetDirectory, QString *errorMessage) QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessage) { - const QStringList directories = QmlObserverTool::installDirectories(qtInstallData); + const QStringList directories = installDirectories(qtInstallData); - // Try to find a writeable directory. - foreach(const QString &directory, directories) { - if (!mkpath(directory, errorMessage)) { + // Try to find a writable directory. + foreach (const QString &directory, directories) { + if (!mkpath(directory, errorMessage)) continue; - } else { - errorMessage->clear(); - } + + errorMessage->clear(); if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) { errorMessage->clear(); @@ -139,44 +177,4 @@ QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessag return QString(); } -QStringList QmlObserverTool::recursiveFileList(const QDir &dir, const QString &prefix) -{ - QStringList files; - - QString _prefix = prefix; - if (!_prefix.isEmpty() && !_prefix.endsWith(QLatin1Char('/'))) { - _prefix.append(QLatin1Char('/')); - } - foreach (const QString &fileName, dir.entryList(QDir::Files)) { - files << _prefix + fileName; - } - - foreach (const QString &subDir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { - files += recursiveFileList(QDir(dir.absoluteFilePath(subDir)), _prefix + subDir); - } - return files; -} - -QStringList QmlObserverTool::installDirectories(const QString &qtInstallData) -{ - const QChar slash = QLatin1Char('/'); - const uint hash = qHash(qtInstallData); - QStringList directories; - directories - << (qtInstallData + QLatin1String("/qtc-qmlobserver/")) - << QDir::cleanPath((QCoreApplication::applicationDirPath() + QLatin1String("/../qtc-qmlobserver/") + QString::number(hash))) + slash - << (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/qtc-qmlobserver/") + QString::number(hash)) + slash; - return directories; -} - -QString QmlObserverTool::sourcePath() -{ - return Core::ICore::resourcePath() + QLatin1String("/qml/qmlobserver/"); -} - -QStringList QmlObserverTool::sourceFileNames() -{ - return recursiveFileList(QDir(sourcePath())); -} - } // namespace diff --git a/src/plugins/qtsupport/qmlobservertool.h b/src/plugins/qtsupport/qmlobservertool.h index 22a23cb5d84..dc4e04e421f 100644 --- a/src/plugins/qtsupport/qmlobservertool.h +++ b/src/plugins/qtsupport/qmlobservertool.h @@ -36,16 +36,6 @@ #include "qtsupport_global.h" #include <utils/buildablehelperlibrary.h> -QT_FORWARD_DECLARE_CLASS(QDir) - -namespace Utils { - class Environment; -} - -namespace ProjectExplorer { - class Project; -} - namespace QtSupport { class BaseQtVersion; @@ -58,18 +48,12 @@ public: static QStringList locationsByInstallData(const QString &qtInstallData); // Build the helpers and return the output log/errormessage. - static bool build(BuildHelperArguments arguments, QString *out, QString *err); + static bool build(BuildHelperArguments arguments, QString *out, QString *err); // Copy the source files to a target location and return the chosen target location. static QString copy(const QString &qtInstallData, QString *errorMessage); - -private: - static QStringList recursiveFileList(const QDir &dir, const QString &prefix = QString()); - static QStringList installDirectories(const QString &qtInstallData); - static QString sourcePath(); - static QStringList sourceFileNames(); }; -} // namespace +} // namespace QtSupport #endif // QMLOBSERVERTOOL_H diff --git a/src/plugins/qtsupport/qtversionmanager.h b/src/plugins/qtsupport/qtversionmanager.h index b44fb41a1e5..339e080d310 100644 --- a/src/plugins/qtsupport/qtversionmanager.h +++ b/src/plugins/qtsupport/qtversionmanager.h @@ -39,19 +39,8 @@ #include <QtCore/QSet> #include <QtCore/QStringList> -namespace Utils { -class Environment; -} - -namespace ProjectExplorer { -class HeaderPath; -class IOutputParser; -class Task; -} - namespace QtSupport { namespace Internal { -class QtOptionsPageWidget; class QtOptionsPage; } -- GitLab