qtsupport: remove unneeded thing from headers, style.

Change-Id: I059af357fa772290a78f62c31cb7c532ae7d77ff
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
hjk
2012-01-26 00:25:37 +01:00
committed by Kai Koehne
parent 52b47364de
commit e99e435818
5 changed files with 62 additions and 98 deletions

View File

@@ -48,10 +48,11 @@
using namespace QtSupport; using namespace QtSupport;
using namespace QtSupport::Internal; using namespace QtSupport::Internal;
using ProjectExplorer::DebuggingHelperLibrary; using namespace QtSupport::Internal;
using namespace ProjectExplorer;
DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version, DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
ProjectExplorer::ToolChain *toolChain, ToolChain *toolChain,
Tools tools) : Tools tools) :
m_tools(tools & availableTools(version)), m_tools(tools & availableTools(version)),
m_invalidQt(false), m_invalidQt(false),
@@ -65,9 +66,8 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
qRegisterMetaType<DebuggingHelperBuildTask::Tools>("DebuggingHelperBuildTask::Tools"); qRegisterMetaType<DebuggingHelperBuildTask::Tools>("DebuggingHelperBuildTask::Tools");
// Print result in application ouptut // Print result in application ouptut
Core::MessageManager *messageManager = Core::MessageManager::instance();
connect(this, SIGNAL(logOutput(QString,bool)), connect(this, SIGNAL(logOutput(QString,bool)),
messageManager, SLOT(printToOutputPane(QString,bool)), Core::MessageManager::instance(), SLOT(printToOutputPane(QString,bool)),
Qt::QueuedConnection); Qt::QueuedConnection);
// //
@@ -95,10 +95,10 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
log(QCoreApplication::translate("QtVersion", "Building helper(s) with toolchain '%1' ...\n" log(QCoreApplication::translate("QtVersion", "Building helper(s) with toolchain '%1' ...\n"
).arg(toolChain->displayName()), QString()); ).arg(toolChain->displayName()), QString());
if (toolChain->targetAbi().os() == ProjectExplorer::Abi::LinuxOS if (toolChain->targetAbi().os() == Abi::LinuxOS
&& ProjectExplorer::Abi::hostAbi().os() == ProjectExplorer::Abi::WindowsOS) && Abi::hostAbi().os() == Abi::WindowsOS)
m_target = QLatin1String("-unix"); 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("debug-") + toolChain->defaultMakeTarget();
m_makeArguments << QLatin1String("release-") + toolChain->defaultMakeTarget(); m_makeArguments << QLatin1String("release-") + toolChain->defaultMakeTarget();
m_makeArguments << QLatin1String("-k"); m_makeArguments << QLatin1String("-k");
@@ -108,8 +108,8 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
} }
m_qmakeCommand = version->qmakeCommand(); m_qmakeCommand = version->qmakeCommand();
m_qmakeArguments = QStringList() << QLatin1String("-nocache"); m_qmakeArguments = QStringList() << QLatin1String("-nocache");
if (toolChain->targetAbi().os() == ProjectExplorer::Abi::MacOS if (toolChain->targetAbi().os() == Abi::MacOS
&& toolChain->targetAbi().architecture() == ProjectExplorer::Abi::X86Architecture) { && toolChain->targetAbi().architecture() == Abi::X86Architecture) {
// explicitly set 32 or 64 bit in case Qt is compiled with both // explicitly set 32 or 64 bit in case Qt is compiled with both
if (toolChain->targetAbi().wordWidth() == 32) if (toolChain->targetAbi().wordWidth() == 32)
m_qmakeArguments << QLatin1String("CONFIG+=x86"); m_qmakeArguments << QLatin1String("CONFIG+=x86");
@@ -126,9 +126,6 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
Qt::QueuedConnection); Qt::QueuedConnection);
} }
DebuggingHelperBuildTask::~DebuggingHelperBuildTask()
{
}
DebuggingHelperBuildTask::Tools DebuggingHelperBuildTask::availableTools(const BaseQtVersion *version) DebuggingHelperBuildTask::Tools DebuggingHelperBuildTask::availableTools(const BaseQtVersion *version)
{ {
@@ -136,8 +133,8 @@ DebuggingHelperBuildTask::Tools DebuggingHelperBuildTask::availableTools(const B
// Check the build requirements of the tools // Check the build requirements of the tools
DebuggingHelperBuildTask::Tools tools = 0; DebuggingHelperBuildTask::Tools tools = 0;
// Gdb helpers are needed on Mac/gdb only. // Gdb helpers are needed on Mac/gdb only.
foreach (const ProjectExplorer::Abi &abi, version->qtAbis()) { foreach (const Abi &abi, version->qtAbis()) {
if (abi.os() == ProjectExplorer::Abi::MacOS) { if (abi.os() == Abi::MacOS) {
tools |= DebuggingHelperBuildTask::GdbDebugging; tools |= DebuggingHelperBuildTask::GdbDebugging;
break; break;
} }

View File

@@ -42,11 +42,8 @@
#include <QtCore/QFutureInterface> #include <QtCore/QFutureInterface>
#include <QtCore/QMetaType> #include <QtCore/QMetaType>
namespace ProjectExplorer {
class ToolChain;
} // namespace ProjectExplorer
namespace QtSupport { namespace QtSupport {
class BaseQtVersion; class BaseQtVersion;
class QTSUPPORT_EXPORT DebuggingHelperBuildTask : public QObject class QTSUPPORT_EXPORT DebuggingHelperBuildTask : public QObject
@@ -66,7 +63,6 @@ public:
explicit DebuggingHelperBuildTask(const BaseQtVersion *version, explicit DebuggingHelperBuildTask(const BaseQtVersion *version,
ProjectExplorer::ToolChain *toolChain, ProjectExplorer::ToolChain *toolChain,
Tools tools = AllTools); Tools tools = AllTools);
virtual ~DebuggingHelperBuildTask();
void showOutputOnError(bool show); void showOutputOnError(bool show);
void run(QFutureInterface<void> &future); void run(QFutureInterface<void> &future);
@@ -100,7 +96,7 @@ private:
bool m_showErrors; bool m_showErrors;
}; };
} // namespace Qt4ProjectManager } // namespace QtSupport
Q_DECLARE_METATYPE(QtSupport::DebuggingHelperBuildTask::Tools) Q_DECLARE_METATYPE(QtSupport::DebuggingHelperBuildTask::Tools)

View File

@@ -45,7 +45,46 @@
namespace QtSupport { 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() return QStringList()
<< QLatin1String("debug/qmlobserver.exe") << QLatin1String("debug/qmlobserver.exe")
@@ -92,7 +131,7 @@ QStringList QmlObserverTool::locationsByInstallData(const QString &qtInstallData
QStringList result; QStringList result;
QFileInfo fileInfo; QFileInfo fileInfo;
const QStringList binFilenames = validBinaryFilenames(); const QStringList binFilenames = validBinaryFilenames();
foreach(const QString &directory, installDirectories(qtInstallData)) { foreach (const QString &directory, installDirectories(qtInstallData)) {
if (getHelperFileInfoFor(binFilenames, directory, &fileInfo)) if (getHelperFileInfoFor(binFilenames, directory, &fileInfo))
result << fileInfo.filePath(); result << fileInfo.filePath();
} }
@@ -118,15 +157,14 @@ static inline bool mkpath(const QString &targetDirectory, QString *errorMessage)
QString QmlObserverTool::copy(const QString &qtInstallData, 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. // Try to find a writable directory.
foreach(const QString &directory, directories) { foreach (const QString &directory, directories) {
if (!mkpath(directory, errorMessage)) { if (!mkpath(directory, errorMessage))
continue; continue;
} else {
errorMessage->clear(); errorMessage->clear();
}
if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) { if (copyFiles(sourcePath(), sourceFileNames(), directory, errorMessage)) {
errorMessage->clear(); errorMessage->clear();
@@ -139,44 +177,4 @@ QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessag
return QString(); 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 } // namespace

View File

@@ -36,16 +36,6 @@
#include "qtsupport_global.h" #include "qtsupport_global.h"
#include <utils/buildablehelperlibrary.h> #include <utils/buildablehelperlibrary.h>
QT_FORWARD_DECLARE_CLASS(QDir)
namespace Utils {
class Environment;
}
namespace ProjectExplorer {
class Project;
}
namespace QtSupport { namespace QtSupport {
class BaseQtVersion; class BaseQtVersion;
@@ -58,18 +48,12 @@ public:
static QStringList locationsByInstallData(const QString &qtInstallData); static QStringList locationsByInstallData(const QString &qtInstallData);
// Build the helpers and return the output log/errormessage. // 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. // Copy the source files to a target location and return the chosen target location.
static QString copy(const QString &qtInstallData, QString *errorMessage); 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 #endif // QMLOBSERVERTOOL_H

View File

@@ -39,19 +39,8 @@
#include <QtCore/QSet> #include <QtCore/QSet>
#include <QtCore/QStringList> #include <QtCore/QStringList>
namespace Utils {
class Environment;
}
namespace ProjectExplorer {
class HeaderPath;
class IOutputParser;
class Task;
}
namespace QtSupport { namespace QtSupport {
namespace Internal { namespace Internal {
class QtOptionsPageWidget;
class QtOptionsPage; class QtOptionsPage;
} }