diff --git a/src/plugins/projectexplorer/outputwindow.cpp b/src/plugins/projectexplorer/outputwindow.cpp index 7c30e935e947e1158244a89da3b59afc005c08de..597a6daba6ee7c2266d38c96b29b75668dda7fdc 100644 --- a/src/plugins/projectexplorer/outputwindow.cpp +++ b/src/plugins/projectexplorer/outputwindow.cpp @@ -35,6 +35,9 @@ #include "projectexplorerconstants.h" #include "runconfiguration.h" +#include <coreplugin/actionmanager/actionmanagerinterface.h> +#include <coreplugin/coreconstants.h> +#include <coreplugin/icore.h> #include <find/basetextfind.h> #include <aggregation/aggregate.h> @@ -52,8 +55,8 @@ using namespace ProjectExplorer::Internal; using namespace ProjectExplorer; -OutputPane::OutputPane() - : m_mainWidget(new QWidget) +OutputPane::OutputPane(Core::ICore *core) + : m_mainWidget(new QWidget) { // m_insertLineButton = new QToolButton; // m_insertLineButton->setIcon(QIcon(ProjectExplorer::Constants::ICON_INSERT_LINE)); @@ -65,7 +68,7 @@ OutputPane::OutputPane() QIcon runIcon(Constants::ICON_RUN); runIcon.addFile(Constants::ICON_RUN_SMALL); - //Rerun + // Rerun m_reRunButton = new QToolButton; m_reRunButton->setIcon(runIcon); m_reRunButton->setToolTip(tr("Rerun this runconfiguration")); @@ -74,13 +77,23 @@ OutputPane::OutputPane() connect(m_reRunButton, SIGNAL(clicked()), this, SLOT(reRunRunControl())); - //Stop + // Stop + Core::ActionManagerInterface *am = core->actionManager(); + QList<int> globalcontext; + globalcontext.append(Core::Constants::C_GLOBAL_ID); + + m_stopAction = new QAction(QIcon(Constants::ICON_STOP), tr("Stop"), this); + m_stopAction->setToolTip(tr("Stop")); + m_stopAction->setEnabled(false); + + Core::ICommand *cmd = am->registerAction(m_stopAction, Constants::STOP, globalcontext); + cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+R"))); + m_stopButton = new QToolButton; - m_stopButton->setIcon(QIcon(Constants::ICON_STOP)); - m_stopButton->setToolTip(tr("Stop")); + m_stopButton->setDefaultAction(cmd->action()); m_stopButton->setAutoRaise(true); - m_stopButton->setEnabled(false); - connect(m_stopButton, SIGNAL(clicked()), + + connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stopRunControl())); // Spacer (?) @@ -252,11 +265,11 @@ void OutputPane::projectRemoved() void OutputPane::tabChanged(int i) { if (i == -1) { - m_stopButton->setEnabled(false); + m_stopAction->setEnabled(false); m_reRunButton->setEnabled(false); } else { RunControl *rc = runControlForTab(i); - m_stopButton->setEnabled(rc->isRunning()); + m_stopAction->setEnabled(rc->isRunning()); m_reRunButton->setEnabled(!rc->isRunning() && rc->runConfiguration()->project()); } } @@ -266,7 +279,7 @@ void OutputPane::runControlStarted() RunControl *rc = runControlForTab(m_tabWidget->currentIndex()); if (rc == qobject_cast<RunControl *>(sender())) { m_reRunButton->setEnabled(false); - m_stopButton->setEnabled(true); + m_stopAction->setEnabled(true); } } @@ -275,7 +288,7 @@ void OutputPane::runControlFinished() RunControl *rc = runControlForTab(m_tabWidget->currentIndex()); if (rc == qobject_cast<RunControl *>(sender())) { m_reRunButton->setEnabled(rc->runConfiguration()->project()); - m_stopButton->setEnabled(false); + m_stopAction->setEnabled(false); } } diff --git a/src/plugins/projectexplorer/outputwindow.h b/src/plugins/projectexplorer/outputwindow.h index cf298f6643a27db5896ace05c607047464e433b7..3367909d804c1a2a7c8d9d2ab2f90edbde291f83 100644 --- a/src/plugins/projectexplorer/outputwindow.h +++ b/src/plugins/projectexplorer/outputwindow.h @@ -48,6 +48,10 @@ QT_BEGIN_NAMESPACE class QTabWidget; QT_END_NAMESPACE +namespace Core { +class ICore; +} + namespace ProjectExplorer { class RunControl; @@ -61,7 +65,7 @@ class OutputPane : public Core::IOutputPane Q_OBJECT public: - OutputPane(); + OutputPane(Core::ICore *core); ~OutputPane(); QWidget *outputWidget(QWidget *); @@ -99,6 +103,7 @@ private: QWidget *m_mainWidget; QTabWidget *m_tabWidget; QHash<RunControl *, OutputWindow *> m_outputWindows; + QAction *m_stopAction; // QToolButton *m_insertLineButton; QToolButton *m_reRunButton; QToolButton *m_stopButton; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 385f7452b74a730d4472ab7639280098a043cddf..e4721457af47fb2845ee3b75fa049c2e372f0539 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -200,7 +200,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QStrin addAutoReleasedObject(new CoreListenerCheckingForRunningBuild(m_buildManager)); - m_outputPane = new OutputPane(); + m_outputPane = new OutputPane(m_core); addAutoReleasedObject(m_outputPane); connect(m_session, SIGNAL(projectRemoved(ProjectExplorer::Project *)), m_outputPane, SLOT(projectRemoved())); diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index 3f937823ef2502230277cd6c3b8f388202d248bf..5cc5f5c67e28638dc80db5b71e063c4cd16b35cb 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -56,6 +56,8 @@ const char * const CLEANSESSION = "ProjectExplorer.CleanSession"; const char * const BUILDCONFIGURATIONMENU = "ProjectExplorer.BuildConfigurationMenu"; const char * const CANCELBUILD = "ProjectExplorer.CancelBuild"; const char * const RUNCONFIGURATIONMENU = "ProjectExplorer.RunConfigurationMenu"; +const char * const RUN = "ProjectExplorer.Run"; +const char * const STOP = "ProjectExplorer.Stop"; const char * const DEBUG = "ProjectExplorer.Debug"; const char * const DEPENDENCIES = "ProjectExplorer.Dependencies"; const char * const FINDINALLPROJECTS = "ProjectExplorer.FindInAllProjects"; @@ -67,7 +69,7 @@ const char * const OPENFILE = "ProjectExplorer.OpenFile"; const char * const REMOVEFILE = "ProjectExplorer.RemoveFile"; const char * const RENAMEFILE = "ProjectExplorer.RenameFile"; -//Run modes +// Run modes const char * const RUNMODE = "ProjectExplorer.RunMode"; const char * const DEBUGMODE = "ProjectExplorer.DebugMode"; @@ -76,8 +78,6 @@ const int P_ACTION_RUN = 100; const int P_ACTION_DEBUG = 90; const int P_ACTION_BUILDSESSION = 80; -const char * const RUN = "ProjectExplorer.Run"; - // context const char * const C_PROJECTEXPLORER = "Project Explorer"; diff --git a/src/plugins/quickopen/quickopentoolwindow.cpp b/src/plugins/quickopen/quickopentoolwindow.cpp index b3232147f37b724f9f332e3f5fea5fbc99dbacca..c3f390f54b7d73c8311c7c6e8c5769c42f5a41ae 100644 --- a/src/plugins/quickopen/quickopentoolwindow.cpp +++ b/src/plugins/quickopen/quickopentoolwindow.cpp @@ -261,7 +261,7 @@ QuickOpenToolWindow::QuickOpenToolWindow(QuickOpenPlugin *qop) : m_configureAction(new QAction(tr("Configure..."), this)), m_fileLineEdit(new Core::Utils::FancyLineEdit) { - // Explcitly hide the completion list popup. + // Explicitly hide the completion list popup. m_completionList->hide(); setWindowTitle("Locate...");