OSDN Git Service

Add "Run in terminal" option also to cmake runconfigurations
authordt_ <qtc-committer@nokia.com>
Wed, 27 Apr 2011 14:33:21 +0000 (16:33 +0200)
committerdt_ <qtc-committer@nokia.com>
Wed, 27 Apr 2011 14:33:21 +0000 (16:33 +0200)
Task-Nr: QTCREATORBUG-4695

src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
src/plugins/cmakeprojectmanager/cmakerunconfiguration.h

index 59e8a64..fbc44cd 100644 (file)
@@ -53,6 +53,7 @@
 #include <QtGui/QLabel>
 #include <QtGui/QComboBox>
 #include <QtGui/QToolButton>
+#include <QtGui/QCheckBox>
 
 using namespace CMakeProjectManager;
 using namespace CMakeProjectManager::Internal;
@@ -138,6 +139,11 @@ ProjectExplorer::LocalApplicationRunConfiguration::RunMode CMakeRunConfiguration
     return m_runMode;
 }
 
+void CMakeRunConfiguration::setRunMode(RunMode runMode)
+{
+    m_runMode = runMode;
+}
+
 QString CMakeRunConfiguration::workingDirectory() const
 {
     return QDir::cleanPath(environment().expandVariables(
@@ -347,6 +353,10 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
 
     fl->addRow(tr("Working directory:"), boxlayout);
 
+    QCheckBox *runInTerminal = new QCheckBox;
+    fl->addRow(tr("Run in Terminal"), runInTerminal);
+
+
     QWidget *debuggerLabelWidget = new QWidget(this);
     QVBoxLayout *debuggerLabelLayout = new QVBoxLayout(debuggerLabelWidget);
     debuggerLabelLayout->setMargin(0);
@@ -411,6 +421,9 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *
     connect(resetButton, SIGNAL(clicked()),
             this, SLOT(resetWorkingDirectory()));
 
+    connect(runInTerminal, SIGNAL(toggled(bool)),
+            this, SLOT(runInTerminalToggled(bool)));
+
     connect(m_debuggerLanguageChooser, SIGNAL(cppLanguageToggled(bool)),
             this, SLOT(useCppDebuggerToggled(bool)));
     connect(m_debuggerLanguageChooser, SIGNAL(qmlLanguageToggled(bool)),
@@ -455,6 +468,12 @@ void CMakeRunConfigurationWidget::resetWorkingDirectory()
     m_cmakeRunConfiguration->setUserWorkingDirectory(QString());
 }
 
+void CMakeRunConfigurationWidget::runInTerminalToggled(bool toggled)
+{
+    m_cmakeRunConfiguration->setRunMode(toggled ? ProjectExplorer::LocalApplicationRunConfiguration::Console
+                                                : ProjectExplorer::LocalApplicationRunConfiguration::Gui);
+}
+
 void CMakeRunConfigurationWidget::useCppDebuggerToggled(bool toggled)
 {
     m_cmakeRunConfiguration->setUseCppDebugger(toggled);
index 0dfaf34..abacd6c 100644 (file)
@@ -72,6 +72,7 @@ public:
 
     QString executable() const;
     RunMode runMode() const;
+    void setRunMode(RunMode runMode);
     QString workingDirectory() const;
     QString commandLineArguments() const;
     Utils::Environment environment() const;
@@ -145,11 +146,11 @@ private slots:
     void userChangesChanged();
     void setWorkingDirectory();
     void resetWorkingDirectory();
+    void runInTerminalToggled(bool toggled);
     void useCppDebuggerToggled(bool toggled);
     void useQmlDebuggerToggled(bool toggled);
     void qmlDebugServerPortChanged(uint port);
 
-private slots:
     void baseEnvironmentComboBoxChanged(int index);
     void workingDirectoryChanged(const QString &workingDirectory);