forked from qt-creator/qt-creator
Compile output: Add 'Cancel Build' button
Change-Id: Ib633c172f3e5a79818ac737016948cbeda82ac41 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
committed by
Daniel Teske
parent
12236050b9
commit
9270d858c1
@@ -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();
|
||||
|
@@ -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();
|
||||
|
@@ -52,6 +52,7 @@
|
||||
#include <QTextEdit>
|
||||
#include <QScrollBar>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QToolButton>
|
||||
|
||||
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<QWidget *> CompileOutputWindow::toolBarWidgets() const
|
||||
{
|
||||
return QList<QWidget *>() << m_cancelBuildButton;
|
||||
}
|
||||
|
||||
static QColor mix_colors(QColor a, QColor b)
|
||||
{
|
||||
return QColor((a.red() + 2 * b.red()) / 3, (a.green() + 2 * b.green()) / 3,
|
||||
|
@@ -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<QWidget *> toolBarWidgets() const { return QList<QWidget *>(); }
|
||||
QList<QWidget *> toolBarWidgets() const;
|
||||
QString displayName() const { return tr("Compile Output"); }
|
||||
int priorityInStatusBar() const;
|
||||
void clearContents();
|
||||
@@ -90,6 +91,7 @@ private:
|
||||
CompileOutputTextEdit *m_outputWindow;
|
||||
QHash<unsigned int, int> m_taskPositions;
|
||||
ShowOutputTaskHandler * m_handler;
|
||||
QToolButton *m_cancelBuildButton;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -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()),
|
||||
|
Reference in New Issue
Block a user