summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/android/android.pro8
-rw-r--r--src/plugins/android/android.qbs5
-rw-r--r--src/plugins/android/androidanalyzesupport.h3
-rw-r--r--src/plugins/android/androiddebugsupport.h3
-rw-r--r--src/plugins/android/androidplugin.cpp3
-rw-r--r--src/plugins/android/androidrunconfiguration.cpp72
-rw-r--r--src/plugins/android/androidrunconfiguration.h28
-rw-r--r--src/plugins/android/androidruncontrol.h3
-rw-r--r--src/plugins/android/androidrunfactories.cpp98
-rw-r--r--src/plugins/android/androidrunfactories.h31
-rw-r--r--src/plugins/android/androidrunner.h3
-rw-r--r--src/plugins/android/qmakeandroidrunconfiguration.cpp139
-rw-r--r--src/plugins/android/qmakeandroidrunconfiguration.h73
-rw-r--r--src/plugins/android/qmakeandroidrunfactories.cpp148
-rw-r--r--src/plugins/android/qmakeandroidrunfactories.h78
15 files changed, 465 insertions, 230 deletions
diff --git a/src/plugins/android/android.pro b/src/plugins/android/android.pro
index 83644462bb..230c410104 100644
--- a/src/plugins/android/android.pro
+++ b/src/plugins/android/android.pro
@@ -53,7 +53,9 @@ HEADERS += \
javafilewizard.h \
avddialog.h \
android_global.h \
- qmakeandroidsupport.h
+ qmakeandroidsupport.h \
+ qmakeandroidrunfactories.h \
+ qmakeandroidrunconfiguration.h
SOURCES += \
androidconfigurations.cpp \
@@ -99,7 +101,9 @@ SOURCES += \
javacompletionassistprovider.cpp \
javafilewizard.cpp \
avddialog.cpp \
- qmakeandroidsupport.cpp
+ qmakeandroidsupport.cpp \
+ qmakeandroidrunfactories.cpp \
+ qmakeandroidrunconfiguration.cpp
FORMS += \
androidsettingswidget.ui \
diff --git a/src/plugins/android/android.qbs b/src/plugins/android/android.qbs
index ae0371c960..e247a04e3f 100644
--- a/src/plugins/android/android.qbs
+++ b/src/plugins/android/android.qbs
@@ -116,7 +116,12 @@ QtcPlugin {
"javaindenter.h",
"javaparser.cpp",
"javaparser.h",
+ "qmakeandroidrunconfiguration.cpp",
+ "qmakeandroidrunconfiguration.h",
+ "qmakeandroidrunfactories.cpp",
+ "qmakeandroidrunfactories.h",
"qmakeandroidsupport.cpp",
"qmakeandroidsupport.h",
+
]
}
diff --git a/src/plugins/android/androidanalyzesupport.h b/src/plugins/android/androidanalyzesupport.h
index 7ea63dd28f..15db38589a 100644
--- a/src/plugins/android/androidanalyzesupport.h
+++ b/src/plugins/android/androidanalyzesupport.h
@@ -37,9 +37,10 @@ namespace Analyzer { class AnalyzerRunControl; }
namespace ProjectExplorer { class RunControl; }
namespace Android {
+class AndroidRunConfiguration;
+
namespace Internal {
-class AndroidRunConfiguration;
class AndroidRunner;
class AndroidAnalyzeSupport : public AndroidRunSupport
diff --git a/src/plugins/android/androiddebugsupport.h b/src/plugins/android/androiddebugsupport.h
index c5f11384c8..5cea83a0db 100644
--- a/src/plugins/android/androiddebugsupport.h
+++ b/src/plugins/android/androiddebugsupport.h
@@ -39,9 +39,10 @@ class DebuggerRunControl;
namespace ProjectExplorer { class RunControl; }
namespace Android {
+class AndroidRunConfiguration;
+
namespace Internal {
-class AndroidRunConfiguration;
class AndroidRunner;
class AndroidDebugSupport : public AndroidRunSupport
diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp
index 37b6180f7e..cf90b06134 100644
--- a/src/plugins/android/androidplugin.cpp
+++ b/src/plugins/android/androidplugin.cpp
@@ -48,6 +48,7 @@
#include "javacompletionassistprovider.h"
#include "javafilewizard.h"
#include "qmakeandroidsupport.h"
+#include "qmakeandroidrunfactories.h"
#ifdef HAVE_QBS
# include "androidqbspropertyprovider.h"
#endif
@@ -74,7 +75,7 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
new Internal::AndroidConfigurations(this);
addAutoReleasedObject(new Internal::AndroidRunControlFactory);
- addAutoReleasedObject(new Internal::AndroidRunConfigurationFactory);
+ addAutoReleasedObject(new Internal::QmakeAndroidRunConfigurationFactory);
addAutoReleasedObject(new Internal::AndroidPackageInstallationFactory);
addAutoReleasedObject(new Internal::AndroidDeployQtStepFactory);
addAutoReleasedObject(new Internal::AndroidSettingsPage);
diff --git a/src/plugins/android/androidrunconfiguration.cpp b/src/plugins/android/androidrunconfiguration.cpp
index 1c6b9043fc..de6beed225 100644
--- a/src/plugins/android/androidrunconfiguration.cpp
+++ b/src/plugins/android/androidrunconfiguration.cpp
@@ -36,36 +36,21 @@
#include <projectexplorer/target.h>
#include <qtsupport/qtoutputformatter.h>
#include <qtsupport/qtkitinformation.h>
-#include <qmakeprojectmanager/qmakeproject.h>
-#include <qmakeprojectmanager/qmakenodes.h>
#include <utils/qtcassert.h>
-namespace {
-const char PRO_FILE_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.ProFile";
-}
-
using namespace ProjectExplorer;
-using QmakeProjectManager::QmakeProject;
namespace Android {
-namespace Internal {
-AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, Core::Id id, const QString &path)
+AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, Core::Id id)
: RunConfiguration(parent, id)
- , m_proFilePath(path)
{
- QmakeProject *project = static_cast<QmakeProject *>(parent->project());
- m_parseSuccess = project->validParse(m_proFilePath);
- m_parseInProgress = project->parseInProgress(m_proFilePath);
init();
}
AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, AndroidRunConfiguration *source)
: RunConfiguration(parent, source)
- , m_proFilePath(source->m_proFilePath)
- , m_parseSuccess(source->m_parseSuccess)
- , m_parseInProgress(source->m_parseInProgress)
{
init();
}
@@ -73,55 +58,6 @@ AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, AndroidRunConfi
void AndroidRunConfiguration::init()
{
setDefaultDisplayName(defaultDisplayName());
- connect(target()->project(), SIGNAL(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)),
- this, SLOT(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)));
-}
-
-bool AndroidRunConfiguration::fromMap(const QVariantMap &map)
-{
- const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
- m_proFilePath = QDir::cleanPath(projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString()));
- m_parseSuccess = static_cast<QmakeProject *>(target()->project())->validParse(m_proFilePath);
- m_parseInProgress = static_cast<QmakeProject *>(target()->project())->parseInProgress(m_proFilePath);
-
- return RunConfiguration::fromMap(map);
-}
-
-QVariantMap AndroidRunConfiguration::toMap() const
-{
- const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
- QVariantMap map(RunConfiguration::toMap());
- map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath));
- return map;
-}
-
-bool AndroidRunConfiguration::isEnabled() const
-{
- return m_parseSuccess && !m_parseInProgress;
-}
-
-QString AndroidRunConfiguration::disabledReason() const
-{
- if (m_parseInProgress)
- return tr("The .pro file \"%1\" is currently being parsed.")
- .arg(QFileInfo(m_proFilePath).fileName());
-
- if (!m_parseSuccess)
- return static_cast<QmakeProject *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath);
- return QString();
-}
-
-void AndroidRunConfiguration::proFileUpdated(QmakeProjectManager::QmakeProFileNode *pro, bool success, bool parseInProgress)
-{
- if (m_proFilePath != pro->path())
- return;
-
- bool enabled = isEnabled();
- QString reason = disabledReason();
- m_parseSuccess = success;
- m_parseInProgress = parseInProgress;
- if (enabled != isEnabled() || reason != disabledReason())
- emit enabledChanged();
}
QWidget *AndroidRunConfiguration::createConfigurationWidget()
@@ -144,10 +80,4 @@ const QString AndroidRunConfiguration::remoteChannel() const
return QLatin1String(":5039");
}
-QString AndroidRunConfiguration::proFilePath() const
-{
- return m_proFilePath;
-}
-
-} // namespace Internal
} // namespace Android
diff --git a/src/plugins/android/androidrunconfiguration.h b/src/plugins/android/androidrunconfiguration.h
index 2a4be87f20..2374f04e30 100644
--- a/src/plugins/android/androidrunconfiguration.h
+++ b/src/plugins/android/androidrunconfiguration.h
@@ -30,54 +30,32 @@
#ifndef ANDROIDRUNCONFIGURATION_H
#define ANDROIDRUNCONFIGURATION_H
+#include "android_global.h"
#include "androidconstants.h"
#include "androidconfigurations.h"
#include <projectexplorer/runconfiguration.h>
-namespace QmakeProjectManager { class QmakeProFileNode; }
-
namespace Android {
-namespace Internal {
-
-class AndroidDeployStep;
-class AndroidRunConfigurationFactory;
-class AndroidRunConfiguration : public ProjectExplorer::RunConfiguration
+class ANDROID_EXPORT AndroidRunConfiguration : public ProjectExplorer::RunConfiguration
{
Q_OBJECT
- friend class AndroidRunConfigurationFactory;
-
public:
- AndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &path);
+ AndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
QWidget *createConfigurationWidget();
Utils::OutputFormatter *createOutputFormatter() const;
-
- void setArguments(const QString &args);
- QString proFilePath() const;
-
const QString remoteChannel() const;
- bool isEnabled() const;
- QString disabledReason() const;
protected:
AndroidRunConfiguration(ProjectExplorer::Target *parent, AndroidRunConfiguration *source);
QString defaultDisplayName();
- bool fromMap(const QVariantMap &map);
- QVariantMap toMap() const;
-private slots:
- void proFileUpdated(QmakeProjectManager::QmakeProFileNode *pro, bool success, bool parseInProgress);
private:
void init();
-
- QString m_proFilePath;
- bool m_parseSuccess;
- bool m_parseInProgress;
};
-} // namespace Internal
} // namespace Android
#endif // ANDROIDRUNCONFIGURATION_H
diff --git a/src/plugins/android/androidruncontrol.h b/src/plugins/android/androidruncontrol.h
index 48f9ca6a32..2f6d87acdc 100644
--- a/src/plugins/android/androidruncontrol.h
+++ b/src/plugins/android/androidruncontrol.h
@@ -33,9 +33,10 @@
#include <projectexplorer/runconfiguration.h>
namespace Android {
+class AndroidRunConfiguration;
+
namespace Internal {
-class AndroidRunConfiguration;
class AndroidRunner;
class AndroidRunControl : public ProjectExplorer::RunControl
diff --git a/src/plugins/android/androidrunfactories.cpp b/src/plugins/android/androidrunfactories.cpp
index 13e46e0a7e..7c5640edc0 100644
--- a/src/plugins/android/androidrunfactories.cpp
+++ b/src/plugins/android/androidrunfactories.cpp
@@ -40,114 +40,16 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <debugger/debuggerconstants.h>
-#include <qmakeprojectmanager/qmakeproject.h>
-#include <qmakeprojectmanager/qmakenodes.h>
#include <qtsupport/customexecutablerunconfiguration.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
using namespace ProjectExplorer;
-using namespace QmakeProjectManager;
namespace Android {
namespace Internal {
-static const char ANDROID_RC_ID_PREFIX[] = "Qt4ProjectManager.AndroidRunConfiguration:";
-
-static QString pathFromId(Core::Id id)
-{
- return id.suffixAfter(ANDROID_RC_ID_PREFIX);
-}
-
-AndroidRunConfigurationFactory::AndroidRunConfigurationFactory(QObject *parent)
- : QmakeRunConfigurationFactory(parent)
-{
- setObjectName(QLatin1String("AndroidRunConfigurationFactory"));
-}
-
-bool AndroidRunConfigurationFactory::canCreate(Target *parent, Core::Id id) const
-{
- if (!canHandle(parent))
- return false;
- return availableCreationIds(parent).contains(id);
-}
-
-bool AndroidRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
-{
- if (!canHandle(parent))
- return false;
- return ProjectExplorer::idFromMap(map).name().startsWith(ANDROID_RC_ID_PREFIX);
-}
-
-bool AndroidRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
-{
- return canCreate(parent, source->id());
-}
-
-QList<Core::Id> AndroidRunConfigurationFactory::availableCreationIds(Target *parent, CreationMode mode) const
-{
- if (!AndroidManager::supportsAndroid(parent))
- return QList<Core::Id>();
-
- QmakeProject *project = static_cast<QmakeProject *>(parent->project());
-
- QList<QmakeProFileNode *> nodes = project->allProFiles(QList<QmakeProjectType>()
- << ApplicationTemplate
- << LibraryTemplate);
-
- if (mode == AutoCreate)
- nodes = QmakeProject::nodesWithQtcRunnable(nodes);
-
- const Core::Id base = Core::Id(ANDROID_RC_ID_PREFIX);
- return QmakeProject::idsForNodes(base, nodes);
-}
-
-QString AndroidRunConfigurationFactory::displayNameForId(Core::Id id) const
-{
- return QFileInfo(pathFromId(id)).completeBaseName();
-}
-
-RunConfiguration *AndroidRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
-{
- return new AndroidRunConfiguration(parent, id, pathFromId(id));
-}
-
-RunConfiguration *AndroidRunConfigurationFactory::doRestore(Target *parent,
- const QVariantMap &map)
-{
- Core::Id id = ProjectExplorer::idFromMap(map);
- return new AndroidRunConfiguration(parent, id, pathFromId(id));
-}
-
-RunConfiguration *AndroidRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
-{
- if (!canClone(parent, source))
- return 0;
-
- AndroidRunConfiguration *old = static_cast<AndroidRunConfiguration *>(source);
- return new AndroidRunConfiguration(parent, old);
-}
-
-bool AndroidRunConfigurationFactory::canHandle(Target *t) const
-{
- if (!t->project()->supportsKit(t->kit()))
- return false;
- return AndroidManager::supportsAndroid(t);
-}
-
-QList<RunConfiguration *> AndroidRunConfigurationFactory::runConfigurationsForNode(Target *t, const Node *n)
-{
- QList<ProjectExplorer::RunConfiguration *> result;
- foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())
- if (AndroidRunConfiguration *qt4c = qobject_cast<AndroidRunConfiguration *>(rc))
- if (qt4c->proFilePath() == n->path())
- result << rc;
- return result;
-}
-
-// #pragma mark -- AndroidRunControlFactory
-
AndroidRunControlFactory::AndroidRunControlFactory(QObject *parent)
: IRunControlFactory(parent)
{
diff --git a/src/plugins/android/androidrunfactories.h b/src/plugins/android/androidrunfactories.h
index 06e87d37b5..9b220fed6e 100644
--- a/src/plugins/android/androidrunfactories.h
+++ b/src/plugins/android/androidrunfactories.h
@@ -30,8 +30,9 @@
#ifndef ANDROIDRUNFACTORIES_H
#define ANDROIDRUNFACTORIES_H
+#include "android_global.h"
#include <projectexplorer/runconfiguration.h>
-#include <qmakeprojectmanager/qmakerunconfigurationfactory.h>
+
namespace ProjectExplorer {
class RunControl;
@@ -43,34 +44,6 @@ class Node;
namespace Android {
namespace Internal {
-class AndroidRunConfigurationFactory : public QmakeProjectManager::QmakeRunConfigurationFactory
-{
- Q_OBJECT
-
-public:
- explicit AndroidRunConfigurationFactory(QObject *parent = 0);
-
- QString displayNameForId(Core::Id id) const;
- QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const;
-
- bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const;
-
- bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
-
- bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
- ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
-
- QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
- const ProjectExplorer::Node *n);
-
-private:
- bool canHandle(ProjectExplorer::Target *t) const;
-
- ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id);
- ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
- const QVariantMap &map);
-};
-
class AndroidRunControlFactory : public ProjectExplorer::IRunControlFactory
{
Q_OBJECT
diff --git a/src/plugins/android/androidrunner.h b/src/plugins/android/androidrunner.h
index a42034b557..be0c48216a 100644
--- a/src/plugins/android/androidrunner.h
+++ b/src/plugins/android/androidrunner.h
@@ -41,9 +41,10 @@
#include <QMutex>
namespace Android {
+class AndroidRunConfiguration;
+
namespace Internal {
-class AndroidRunConfiguration;
class AndroidRunner : public QThread
{
diff --git a/src/plugins/android/qmakeandroidrunconfiguration.cpp b/src/plugins/android/qmakeandroidrunconfiguration.cpp
new file mode 100644
index 0000000000..1f5baf6c1c
--- /dev/null
+++ b/src/plugins/android/qmakeandroidrunconfiguration.cpp
@@ -0,0 +1,139 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "qmakeandroidrunconfiguration.h"
+
+#include <projectexplorer/kitinformation.h>
+#include <projectexplorer/target.h>
+#include <qtsupport/qtoutputformatter.h>
+#include <qtsupport/qtkitinformation.h>
+#include <qmakeprojectmanager/qmakeproject.h>
+#include <qmakeprojectmanager/qmakenodes.h>
+
+#include <utils/qtcassert.h>
+
+namespace {
+ QLatin1String PRO_FILE_KEY("QMakeProjectManager.QmakeAndroidRunConfiguration.ProFile");
+}
+
+using namespace ProjectExplorer;
+using QmakeProjectManager::QmakeProject;
+
+namespace Android {
+namespace Internal {
+
+QmakeAndroidRunConfiguration::QmakeAndroidRunConfiguration(Target *parent, Core::Id id, const QString &path)
+ : AndroidRunConfiguration(parent, id)
+ , m_proFilePath(path)
+{
+ QmakeProject *project = static_cast<QmakeProject *>(parent->project());
+ m_parseSuccess = project->validParse(m_proFilePath);
+ m_parseInProgress = project->parseInProgress(m_proFilePath);
+ init();
+}
+
+QmakeAndroidRunConfiguration::QmakeAndroidRunConfiguration(Target *parent, QmakeAndroidRunConfiguration *source)
+ : AndroidRunConfiguration(parent, source)
+ , m_proFilePath(source->m_proFilePath)
+ , m_parseSuccess(source->m_parseSuccess)
+ , m_parseInProgress(source->m_parseInProgress)
+{
+ init();
+}
+
+void QmakeAndroidRunConfiguration::init()
+{
+ connect(target()->project(), SIGNAL(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)),
+ this, SLOT(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)));
+}
+
+bool QmakeAndroidRunConfiguration::fromMap(const QVariantMap &map)
+{
+ const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
+ m_proFilePath = QDir::cleanPath(projectDir.filePath(map.value(PRO_FILE_KEY).toString()));
+ m_parseSuccess = static_cast<QmakeProject *>(target()->project())->validParse(m_proFilePath);
+ m_parseInProgress = static_cast<QmakeProject *>(target()->project())->parseInProgress(m_proFilePath);
+
+ return RunConfiguration::fromMap(map);
+}
+
+QVariantMap QmakeAndroidRunConfiguration::toMap() const
+{
+ if (m_proFilePath.isEmpty()) {
+ if (!target()->project()->rootProjectNode())
+ return QVariantMap();
+ m_proFilePath = target()->project()->rootProjectNode()->path();
+ }
+
+ const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
+ QVariantMap map(RunConfiguration::toMap());
+ map.insert(PRO_FILE_KEY, projectDir.relativeFilePath(m_proFilePath));
+ return map;
+}
+
+bool QmakeAndroidRunConfiguration::isEnabled() const
+{
+ return m_parseSuccess && !m_parseInProgress;
+}
+
+QString QmakeAndroidRunConfiguration::disabledReason() const
+{
+ if (m_parseInProgress)
+ return tr("The .pro file \"%1\" is currently being parsed.")
+ .arg(QFileInfo(m_proFilePath).fileName());
+
+ if (!m_parseSuccess)
+ return static_cast<QmakeProject *>(target()->project())->disabledReasonForRunConfiguration(m_proFilePath);
+ return QString();
+}
+
+void QmakeAndroidRunConfiguration::proFileUpdated(QmakeProjectManager::QmakeProFileNode *pro, bool success, bool parseInProgress)
+{
+ if (m_proFilePath.isEmpty() && target()->project()->rootProjectNode()) {
+ m_proFilePath = target()->project()->rootProjectNode()->path();
+ }
+
+ if (m_proFilePath != pro->path())
+ return;
+
+ bool enabled = isEnabled();
+ QString reason = disabledReason();
+ m_parseSuccess = success;
+ m_parseInProgress = parseInProgress;
+ if (enabled != isEnabled() || reason != disabledReason())
+ emit enabledChanged();
+}
+
+QString QmakeAndroidRunConfiguration::proFilePath() const
+{
+ return m_proFilePath;
+}
+
+} // namespace Internal
+} // namespace Android
diff --git a/src/plugins/android/qmakeandroidrunconfiguration.h b/src/plugins/android/qmakeandroidrunconfiguration.h
new file mode 100644
index 0000000000..95fd4fbe9a
--- /dev/null
+++ b/src/plugins/android/qmakeandroidrunconfiguration.h
@@ -0,0 +1,73 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QMAKE_ANDROIDRUNCONFIGURATION_H
+#define QMAKE_ANDROIDRUNCONFIGURATION_H
+
+#include "androidrunconfiguration.h"
+
+namespace QmakeProjectManager { class QmakeProFileNode; }
+
+namespace Android {
+namespace Internal {
+
+class QmakeAndroidRunConfiguration : public Android::AndroidRunConfiguration
+{
+ Q_OBJECT
+ friend class QmakeAndroidRunConfigurationFactory;
+
+public:
+ QmakeAndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &path = QString());
+
+ QString proFilePath() const;
+
+ bool isEnabled() const;
+ QString disabledReason() const;
+
+protected:
+ QmakeAndroidRunConfiguration(ProjectExplorer::Target *parent, QmakeAndroidRunConfiguration *source);
+
+ bool fromMap(const QVariantMap &map);
+ QVariantMap toMap() const;
+
+private slots:
+ void proFileUpdated(QmakeProjectManager::QmakeProFileNode *pro, bool success, bool parseInProgress);
+
+private:
+ void init();
+
+ mutable QString m_proFilePath;
+ bool m_parseSuccess;
+ bool m_parseInProgress;
+};
+
+} // namespace Internal
+} // namespace Android
+
+#endif // QMAKE_ANDROIDRUNCONFIGURATION_H
diff --git a/src/plugins/android/qmakeandroidrunfactories.cpp b/src/plugins/android/qmakeandroidrunfactories.cpp
new file mode 100644
index 0000000000..d559579508
--- /dev/null
+++ b/src/plugins/android/qmakeandroidrunfactories.cpp
@@ -0,0 +1,148 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "qmakeandroidrunfactories.h"
+#include "qmakeandroidrunconfiguration.h"
+
+#include <android/androidmanager.h>
+
+#include <projectexplorer/project.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/target.h>
+#include <debugger/debuggerconstants.h>
+#include <qmakeprojectmanager/qmakeproject.h>
+#include <qmakeprojectmanager/qmakenodes.h>
+#include <qtsupport/customexecutablerunconfiguration.h>
+#include <qtsupport/qtkitinformation.h>
+#include <qtsupport/qtsupportconstants.h>
+
+
+using namespace Android;
+using namespace ProjectExplorer;
+using namespace QmakeProjectManager;
+
+namespace Android {
+namespace Internal {
+
+static const char ANDROID_RC_ID_PREFIX[] = "Qt4ProjectManager.AndroidRunConfiguration:";
+
+static QString pathFromId(const Core::Id id)
+{
+ return id.suffixAfter(ANDROID_RC_ID_PREFIX);
+}
+
+QmakeAndroidRunConfigurationFactory::QmakeAndroidRunConfigurationFactory(QObject *parent)
+ : ProjectExplorer::IRunConfigurationFactory(parent)
+{
+}
+
+QString QmakeAndroidRunConfigurationFactory::displayNameForId(const Core::Id id) const
+{
+ return QFileInfo(pathFromId(id)).completeBaseName();
+}
+
+bool QmakeAndroidRunConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
+{
+ if (!canHandle(parent))
+ return false;
+ return availableCreationIds(parent).contains(id);
+}
+
+bool QmakeAndroidRunConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
+{
+ return canCreate(parent, ProjectExplorer::idFromMap(map));
+}
+
+bool QmakeAndroidRunConfigurationFactory::canClone(Target *parent, RunConfiguration *source) const
+{
+ return canCreate(parent, source->id());
+}
+
+QList<Core::Id> QmakeAndroidRunConfigurationFactory::availableCreationIds(Target *parent, CreationMode mode) const
+{
+ if (!canHandle(parent))
+ return QList<Core::Id>();
+
+ QmakeProject *project = static_cast<QmakeProject *>(parent->project());
+ QList<QmakeProFileNode *> nodes = project->allProFiles(QList<QmakeProjectType>()
+ << ApplicationTemplate
+ << LibraryTemplate);
+
+ if (mode == AutoCreate)
+ nodes = QmakeProject::nodesWithQtcRunnable(nodes);
+
+ const Core::Id base = Core::Id(ANDROID_RC_ID_PREFIX);
+ return QmakeProject::idsForNodes(base, nodes);
+}
+
+RunConfiguration *QmakeAndroidRunConfigurationFactory::doCreate(Target *parent, const Core::Id id)
+{
+ if (parent->project()->rootProjectNode())
+ return new QmakeAndroidRunConfiguration(parent, id, parent->project()->rootProjectNode()->path());
+ return new QmakeAndroidRunConfiguration(parent, id);
+}
+
+RunConfiguration *QmakeAndroidRunConfigurationFactory::doRestore(Target *parent,
+ const QVariantMap &map)
+{
+ Core::Id id = ProjectExplorer::idFromMap(map);
+ if (parent->project()->rootProjectNode())
+ return new QmakeAndroidRunConfiguration(parent, id, parent->project()->rootProjectNode()->path());
+ return new QmakeAndroidRunConfiguration(parent, id);
+}
+
+RunConfiguration *QmakeAndroidRunConfigurationFactory::clone(Target *parent, RunConfiguration *source)
+{
+ if (!canClone(parent, source))
+ return 0;
+
+ QmakeAndroidRunConfiguration *old = static_cast<QmakeAndroidRunConfiguration *>(source);
+ return new QmakeAndroidRunConfiguration(parent, old);
+}
+
+bool QmakeAndroidRunConfigurationFactory::canHandle(Target *t) const
+{
+ return t->project()->supportsKit(t->kit())
+ && AndroidManager::supportsAndroid(t)
+ && qobject_cast<QmakeProject *>(t->project());
+}
+
+#warning FIX ME !!!
+QList<RunConfiguration *> QmakeAndroidRunConfigurationFactory::runConfigurationsForNode(Target *t, ProjectExplorer::Node *n)
+{
+ QList<ProjectExplorer::RunConfiguration *> result;
+ foreach (ProjectExplorer::RunConfiguration *rc, t->runConfigurations())
+ if (QmakeAndroidRunConfiguration *qt4c = qobject_cast<QmakeAndroidRunConfiguration *>(rc))
+ if (qt4c->proFilePath() == n->path())
+ result << rc;
+ return result;
+}
+
+} // namespace Internal
+} // namespace Android
diff --git a/src/plugins/android/qmakeandroidrunfactories.h b/src/plugins/android/qmakeandroidrunfactories.h
new file mode 100644
index 0000000000..9286612c92
--- /dev/null
+++ b/src/plugins/android/qmakeandroidrunfactories.h
@@ -0,0 +1,78 @@
+/**************************************************************************
+**
+** Copyright (c) 2014 BogDan Vatra <bog_dan_ro@yahoo.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef QMAKE_ANDROIDRUNFACTORIES_H
+#define QMAKE_ANDROIDRUNFACTORIES_H
+
+#include <android/androidrunfactories.h>
+#include <projectexplorer/runconfiguration.h>
+#include <qmakeprojectmanager/qmakerunconfigurationfactory.h>
+
+namespace ProjectExplorer {
+class RunControl;
+class RunConfigWidget;
+class Target;
+class Node;
+} // namespace ProjectExplorer
+
+namespace Android {
+namespace Internal {
+
+class QmakeAndroidRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
+{
+ Q_OBJECT
+
+public:
+ explicit QmakeAndroidRunConfigurationFactory(QObject *parent = 0);
+
+ QString displayNameForId(const Core::Id id) const;
+ QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode = UserCreate) const;
+
+ bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const;
+
+ bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const;
+
+ bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const;
+ ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source);
+
+ QList<ProjectExplorer::RunConfiguration *> runConfigurationsForNode(ProjectExplorer::Target *t,
+ ProjectExplorer::Node *n);
+
+private:
+ bool canHandle(ProjectExplorer::Target *t) const;
+
+ ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, const Core::Id id);
+ ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent,
+ const QVariantMap &map);
+};
+
+} // namespace Internal
+} // namespace Android
+
+#endif // ANDROIDRUNFACTORIES_H