summaryrefslogtreecommitdiff
path: root/src/plugins/qtsupport/baseqtversion.cpp
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@digia.com>2013-06-13 17:10:32 +0200
committerTobias Hunger <tobias.hunger@digia.com>2013-06-14 13:02:43 +0200
commitb57fd371095c4c5b81864fba90b397e160b2fa88 (patch)
tree80073fc01ad0d74c4be4b49a626387c6ab1002e6 /src/plugins/qtsupport/baseqtversion.cpp
parent4929d65e82563ba7aa1e52a462f899f7cdd7e1ef (diff)
downloadqt-creator-b57fd371095c4c5b81864fba90b397e160b2fa88.tar.gz
Move qmldebugginghelper related code from Qt4PM to QtSupport
... so that it can be reused by the QbsPM Change-Id: I79ee1aeaf66b07878e159ac9d4aecb657bdcb7ee Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src/plugins/qtsupport/baseqtversion.cpp')
-rw-r--r--src/plugins/qtsupport/baseqtversion.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp
index 37923dd406..81e95f79c9 100644
--- a/src/plugins/qtsupport/baseqtversion.cpp
+++ b/src/plugins/qtsupport/baseqtversion.cpp
@@ -36,21 +36,27 @@
#include "qtversionmanager.h"
#include "profilereader.h"
+#include <coreplugin/icore.h>
+#include <coreplugin/progressmanager/progressmanager.h>
#include <proparser/qmakevfs.h>
#include <projectexplorer/toolchainmanager.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/headerpath.h>
#include <qtsupport/debugginghelper.h>
+#include <qtsupport/debugginghelperbuildtask.h>
#include <qtsupport/qtsupportconstants.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
+#include <utils/runextensions.h>
#include <utils/synchronousprocess.h>
+#include <QtConcurrent>
#include <QDir>
#include <QUrl>
#include <QFileInfo>
+#include <QFuture>
#include <QCoreApplication>
#include <QProcess>
@@ -1412,6 +1418,76 @@ FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QString> &ver
return mkspecFullPath;
}
+bool BaseQtVersion::isQmlDebuggingSupported(ProjectExplorer::Kit *k, QString *reason)
+{
+ QTC_ASSERT(k, return false);
+ BaseQtVersion *version = QtKitInformation::qtVersion(k);
+ if (!version) {
+ if (reason)
+ *reason = QCoreApplication::translate("BaseQtVersion", "No Qt version.");
+ return false;
+ }
+ return version->isQmlDebuggingSupported(reason);
+}
+
+bool BaseQtVersion::isQmlDebuggingSupported(QString *reason) const
+{
+ if (!needsQmlDebuggingLibrary() || hasQmlDebuggingLibrary())
+ return true;
+
+ if (!qtAbis().isEmpty()) {
+ ProjectExplorer::Abi abi = qtAbis().first();
+ if (abi.osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor) {
+ if (reason)
+ reason->clear();
+ // *reason = QCoreApplication::translate("BaseQtVersion", "Qml debugging on device not yet supported.");
+ return false;
+ }
+ }
+
+ if (!isValid()) {
+ if (reason)
+ *reason = QCoreApplication::translate("BaseQtVersion", "Invalid Qt version.");
+ return false;
+ }
+
+ if (qtVersion() < QtVersionNumber(4, 7, 1)) {
+ if (reason)
+ *reason = QCoreApplication::translate("BaseQtVersion", "Requires Qt 4.7.1 or newer.");
+ return false;
+ }
+
+ if (reason)
+ *reason = QCoreApplication::translate("BaseQtVersion", "Library not available. <a href='compile'>Compile...</a>");
+
+ return false;
+}
+
+void BaseQtVersion::buildDebuggingHelper(ProjectExplorer::Kit *k, int tools)
+{
+ BaseQtVersion *version = QtKitInformation::qtVersion(k);
+ ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
+ if (!k || !version || !tc)
+ return;
+
+ version->buildDebuggingHelper(tc, tools);
+}
+
+void BaseQtVersion::buildDebuggingHelper(ProjectExplorer::ToolChain *tc, int tools)
+{
+ QTC_ASSERT(tc, return);
+ DebuggingHelperBuildTask *buildTask =
+ new DebuggingHelperBuildTask(this, tc, static_cast<DebuggingHelperBuildTask::Tools>(tools));
+
+ // pop up Application Output on error
+ buildTask->showOutputOnError(true);
+
+ QFuture<void> task = QtConcurrent::run(&QtSupport::DebuggingHelperBuildTask::run, buildTask);
+ const QString taskName = QCoreApplication::translate("BaseQtVersion", "Building helpers");
+ Core::ICore::progressManager()->addTask(task, taskName,
+ QLatin1String("Qt::BuildHelpers"));
+}
+
FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString)
{
QStringList dirs;