summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/unstartedappwatcherdialog.cpp
diff options
context:
space:
mode:
authorhjk <hjk@theqtcompany.com>2016-01-25 15:00:20 +0100
committerhjk <hjk@theqtcompany.com>2016-01-26 10:09:29 +0000
commit9ae2ce76297ef899e9c4444f736ede4706c7ece4 (patch)
tree660cd2d30ad4e0d4393e68e66cb738d2e2afd38c /src/plugins/debugger/unstartedappwatcherdialog.cpp
parent4ea8caccf24451ab70db3bc4aa5ee36859e41684 (diff)
downloadqt-creator-9ae2ce76297ef899e9c4444f736ede4706c7ece4.tar.gz
ProjectExplorer: Drop LocalApplicationRunConfiguration
The functionality can be provided by producing a suitable Runnable in the derived classes directly. Change-Id: I7b8e8fe33fffd2b00176b6cf6633eca4e152e466 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Diffstat (limited to 'src/plugins/debugger/unstartedappwatcherdialog.cpp')
-rw-r--r--src/plugins/debugger/unstartedappwatcherdialog.cpp48
1 files changed, 28 insertions, 20 deletions
diff --git a/src/plugins/debugger/unstartedappwatcherdialog.cpp b/src/plugins/debugger/unstartedappwatcherdialog.cpp
index 7e5e323517..763fba865f 100644
--- a/src/plugins/debugger/unstartedappwatcherdialog.cpp
+++ b/src/plugins/debugger/unstartedappwatcherdialog.cpp
@@ -38,7 +38,7 @@
#include <projectexplorer/projecttree.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/buildconfiguration.h>
-#include <projectexplorer/localapplicationrunconfiguration.h>
+#include <projectexplorer/runnables.h>
#include <QVBoxLayout>
#include <QHBoxLayout>
@@ -56,6 +56,13 @@ using namespace ProjectExplorer;
namespace Debugger {
namespace Internal {
+static bool isLocal(RunConfiguration *runConfiguration)
+{
+ Target *target = runConfiguration ? runConfiguration->target() : 0;
+ Kit *kit = target ? target->kit() : 0;
+ return DeviceTypeKitInformation::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
+}
+
/*!
\class Debugger::Internal::UnstartedAppWatcherDialog
@@ -88,8 +95,11 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
m_kitChooser->setVisible(true);
Project *project = ProjectTree::currentProject();
- if (project && project->activeTarget() && project->activeTarget()->kit())
- m_kitChooser->setCurrentKitId(project->activeTarget()->kit()->id());
+ Target *activeTarget = project ? project->activeTarget() : 0;
+ Kit *kit = activeTarget ? activeTarget->kit() : 0;
+
+ if (kit)
+ m_kitChooser->setCurrentKitId(kit->id());
else if (KitManager::defaultKit())
m_kitChooser->setCurrentKitId(KitManager::defaultKit()->id());
@@ -97,13 +107,12 @@ UnstartedAppWatcherDialog::UnstartedAppWatcherDialog(QWidget *parent)
m_pathChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_pathChooser->setHistoryCompleter(QLatin1String("LocalExecutable"));
- if (project && project->activeTarget() && project->activeTarget()->activeRunConfiguration()) {
- LocalApplicationRunConfiguration *localAppRC =
- qobject_cast<LocalApplicationRunConfiguration *>
- (project->activeTarget()->activeRunConfiguration());
-
- if (localAppRC)
- m_pathChooser->setPath(localAppRC->executable());
+ if (activeTarget) {
+ if (RunConfiguration *runConfig = activeTarget->activeRunConfiguration()) {
+ const Runnable runnable = runConfig->runnable();
+ if (runnable.is<StandardRunnable>() && isLocal(runConfig))
+ m_pathChooser->setPath(runnable.as<StandardRunnable>().executable);
+ }
}
m_hideOnAttachCheckBox = new QCheckBox(tr("Reopen dialog when application finishes"), this);
@@ -171,20 +180,19 @@ void UnstartedAppWatcherDialog::selectExecutable()
QString path;
Project *project = ProjectTree::currentProject();
+ Target *activeTarget = project ? project->activeTarget() : 0;
- if (project && project->activeTarget() && project->activeTarget()->activeRunConfiguration()) {
-
- LocalApplicationRunConfiguration *localAppRC =
- qobject_cast<LocalApplicationRunConfiguration *>
- (project->activeTarget()->activeRunConfiguration());
- if (localAppRC)
- path = QFileInfo(localAppRC->executable()).path();
+ if (activeTarget) {
+ if (RunConfiguration *runConfig = activeTarget->activeRunConfiguration()) {
+ const Runnable runnable = runConfig->runnable();
+ if (runnable.is<StandardRunnable>() && isLocal(runConfig))
+ path = QFileInfo(runnable.as<StandardRunnable>().executable).path();
+ }
}
if (path.isEmpty()) {
- if (project && project->activeTarget() &&
- project->activeTarget()->activeBuildConfiguration()) {
- path = project->activeTarget()->activeBuildConfiguration()->buildDirectory().toString();
+ if (activeTarget && activeTarget->activeBuildConfiguration()) {
+ path = activeTarget->activeBuildConfiguration()->buildDirectory().toString();
} else if (project) {
path = project->projectDirectory().toString();
}