diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index a68576db17b..361a146300c 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -119,7 +119,7 @@ BuildManagerPrivate::BuildManagerPrivate() : { } -BuildManager::BuildManager(ProjectExplorerPlugin *parent) +BuildManager::BuildManager(ProjectExplorerPlugin *parent, QAction *cancelBuildAction) : QObject(parent), d(new BuildManagerPrivate) { ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); @@ -138,7 +138,7 @@ BuildManager::BuildManager(ProjectExplorerPlugin *parent) connect(parent->session(), SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)), this, SLOT(aboutToRemoveProject(ProjectExplorer::Project*))); - d->m_outputWindow = new Internal::CompileOutputWindow(this); + d->m_outputWindow = new Internal::CompileOutputWindow(this, cancelBuildAction); pm->addObject(d->m_outputWindow); d->m_taskHub = ProjectExplorerPlugin::instance()->taskHub(); diff --git a/src/plugins/projectexplorer/buildmanager.h b/src/plugins/projectexplorer/buildmanager.h index eff114e8b88..0ae6c6f84cf 100644 --- a/src/plugins/projectexplorer/buildmanager.h +++ b/src/plugins/projectexplorer/buildmanager.h @@ -51,7 +51,7 @@ class PROJECTEXPLORER_EXPORT BuildManager : public QObject Q_OBJECT public: - explicit BuildManager(ProjectExplorerPlugin *parent); + explicit BuildManager(ProjectExplorerPlugin *parent, QAction *cancelBuildAction); virtual ~BuildManager(); void extensionsInitialized(); diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp index d9406a603ff..28f8bf07da1 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.cpp +++ b/src/plugins/projectexplorer/compileoutputwindow.cpp @@ -52,6 +52,7 @@ #include #include #include +#include using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; @@ -100,7 +101,8 @@ private: } // namespace Internal } // namespace ProjectExplorer -CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/) +CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/, QAction *cancelBuildAction) : + m_cancelBuildButton(new QToolButton) { Core::Context context(Constants::C_COMPILE_OUTPUT); m_outputWindow = new CompileOutputTextEdit(context); @@ -110,6 +112,8 @@ CompileOutputWindow::CompileOutputWindow(BuildManager * /*bm*/) m_outputWindow->setUndoRedoEnabled(false); m_outputWindow->setMaxLineCount(MAX_LINECOUNT); + m_cancelBuildButton->setDefaultAction(cancelBuildAction); + Aggregation::Aggregate *agg = new Aggregation::Aggregate; agg->add(m_outputWindow); agg->add(new Find::BaseTextFind(m_outputWindow)); @@ -127,6 +131,7 @@ CompileOutputWindow::~CompileOutputWindow() { ExtensionSystem::PluginManager::instance()->removeObject(m_handler); delete m_handler; + delete m_cancelBuildButton; } void CompileOutputWindow::updateWordWrapMode() @@ -154,6 +159,11 @@ QWidget *CompileOutputWindow::outputWidget(QWidget *) return m_outputWindow; } +QList CompileOutputWindow::toolBarWidgets() const +{ + return QList() << m_cancelBuildButton; +} + static QColor mix_colors(QColor a, QColor b) { return QColor((a.red() + 2 * b.red()) / 3, (a.green() + 2 * b.green()) / 3, diff --git a/src/plugins/projectexplorer/compileoutputwindow.h b/src/plugins/projectexplorer/compileoutputwindow.h index 315893c6403..676bbf007f6 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.h +++ b/src/plugins/projectexplorer/compileoutputwindow.h @@ -42,6 +42,7 @@ QT_BEGIN_NAMESPACE class QPlainTextEdit; class QTextCharFormat; +class QToolButton; QT_END_NAMESPACE namespace ProjectExplorer { @@ -59,11 +60,11 @@ class CompileOutputWindow : public Core::IOutputPane Q_OBJECT public: - CompileOutputWindow(BuildManager *bm); + CompileOutputWindow(BuildManager *bm, QAction *cancelBuildAction); ~CompileOutputWindow(); QWidget *outputWidget(QWidget *); - QList toolBarWidgets() const { return QList(); } + QList toolBarWidgets() const; QString displayName() const { return tr("Compile Output"); } int priorityInStatusBar() const; void clearContents(); @@ -90,6 +91,7 @@ private: CompileOutputTextEdit *m_outputWindow; QHash m_taskPositions; ShowOutputTaskHandler * m_handler; + QToolButton *m_cancelBuildButton; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index ca12fed0db9..9f64737e1ee 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -376,13 +376,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er addAutoReleasedObject(new CopyTaskHandler); addAutoReleasedObject(new ShowInEditorTaskHandler); addAutoReleasedObject(new VcsAnnotateTaskHandler); - - d->m_buildManager = new BuildManager(this); - connect(d->m_buildManager, SIGNAL(buildStateChanged(ProjectExplorer::Project*)), - this, SLOT(buildStateChanged(ProjectExplorer::Project*))); - connect(d->m_buildManager, SIGNAL(buildQueueFinished(bool)), - this, SLOT(buildQueueFinished(bool))); - addAutoReleasedObject(new CoreListener); d->m_outputPane = new AppOutputPane; @@ -798,7 +791,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er mbuild->addAction(cmd, Constants::G_BUILD_RUN); // cancel build action - d->m_cancelBuildAction = new QAction(tr("Cancel Build"), this); + QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP)); + stopIcon.addFile(QLatin1String(Constants::ICON_STOP_SMALL)); + d->m_cancelBuildAction = new QAction(stopIcon, tr("Cancel Build"), this); cmd = am->registerAction(d->m_cancelBuildAction, Constants::CANCELBUILD, globalcontext); mbuild->addAction(cmd, Constants::G_BUILD_CANCEL); @@ -1003,6 +998,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er connect(this, SIGNAL(updateRunActions()), this, SLOT(slotUpdateRunActions())); connect(this, SIGNAL(settingsChanged()), this, SLOT(updateRunWithoutDeployMenu())); + d->m_buildManager = new BuildManager(this, d->m_cancelBuildAction); + connect(d->m_buildManager, SIGNAL(buildStateChanged(ProjectExplorer::Project*)), + this, SLOT(buildStateChanged(ProjectExplorer::Project*))); + connect(d->m_buildManager, SIGNAL(buildQueueFinished(bool)), + this, SLOT(buildQueueFinished(bool))); + updateActions(); connect(Core::ICore::instance(), SIGNAL(coreAboutToOpen()),