Commit 28cf277c authored by dt's avatar dt
Browse files

RunControl: Show correct icon in application output

Add a virtual icon() method to runcontrol.
Actually currently the icon only varies between modes of running.

Task-Nr: QTCREATORBUG-1232
parent e945acef
...@@ -169,6 +169,11 @@ QString AnalyzerRunControl::displayName() const ...@@ -169,6 +169,11 @@ QString AnalyzerRunControl::displayName() const
return AnalyzerManager::instance()->currentTool()->displayName(); return AnalyzerManager::instance()->currentTool()->displayName();
} }
QIcon AnalyzerRunControl::icon() const
{
return QIcon(QLatin1String(":/images/analyzer_start_small.png"));
}
void AnalyzerRunControl::receiveStandardOutput(const QString &text) void AnalyzerRunControl::receiveStandardOutput(const QString &text)
{ {
appendMessage(text, ProjectExplorer::StdOutFormat); appendMessage(text, ProjectExplorer::StdOutFormat);
......
...@@ -91,6 +91,7 @@ public: ...@@ -91,6 +91,7 @@ public:
StopResult stop(); StopResult stop();
bool isRunning() const; bool isRunning() const;
QString displayName() const; QString displayName() const;
QIcon icon() const;
private slots: private slots:
void receiveStandardOutput(const QString &); void receiveStandardOutput(const QString &);
......
...@@ -227,6 +227,11 @@ QString DebuggerRunControl::displayName() const ...@@ -227,6 +227,11 @@ QString DebuggerRunControl::displayName() const
return d->m_engine->startParameters().displayName; return d->m_engine->startParameters().displayName;
} }
QIcon DebuggerRunControl::icon() const
{
return QIcon(ProjectExplorer::Constants::ICON_DEBUG_SMALL);
}
void DebuggerRunControl::setCustomEnvironment(Utils::Environment env) void DebuggerRunControl::setCustomEnvironment(Utils::Environment env)
{ {
QTC_ASSERT(d->m_engine, return); QTC_ASSERT(d->m_engine, return);
......
...@@ -96,6 +96,7 @@ public: ...@@ -96,6 +96,7 @@ public:
StopResult stop(); // Called from SnapshotWindow. StopResult stop(); // Called from SnapshotWindow.
bool isRunning() const; bool isRunning() const;
QString displayName() const; QString displayName() const;
QIcon icon() const;
void setCustomEnvironment(Utils::Environment env); void setCustomEnvironment(Utils::Environment env);
void startFailed(); void startFailed();
......
...@@ -122,6 +122,11 @@ bool LocalApplicationRunControl::isRunning() const ...@@ -122,6 +122,11 @@ bool LocalApplicationRunControl::isRunning() const
return m_applicationLauncher.isRunning(); return m_applicationLauncher.isRunning();
} }
QIcon LocalApplicationRunControl::icon() const
{
return QIcon(ProjectExplorer::Constants::ICON_RUN_SMALL);
}
void LocalApplicationRunControl::slotAppendMessage(const QString &err, void LocalApplicationRunControl::slotAppendMessage(const QString &err,
OutputFormat format) OutputFormat format)
{ {
......
...@@ -63,6 +63,7 @@ public: ...@@ -63,6 +63,7 @@ public:
virtual void start(); virtual void start();
virtual StopResult stop(); virtual StopResult stop();
virtual bool isRunning() const; virtual bool isRunning() const;
virtual QIcon icon() const;
private slots: private slots:
void processExited(int exitCode); void processExited(int exitCode);
void slotAppendMessage(const QString &err, ProjectExplorer::OutputFormat isError); void slotAppendMessage(const QString &err, ProjectExplorer::OutputFormat isError);
......
...@@ -88,11 +88,8 @@ OutputPane::OutputPane() : ...@@ -88,11 +88,8 @@ OutputPane::OutputPane() :
m_reRunButton(new QToolButton), m_reRunButton(new QToolButton),
m_stopButton(new QToolButton) m_stopButton(new QToolButton)
{ {
m_runIcon.addFile(Constants::ICON_RUN);
m_runIcon.addFile(Constants::ICON_RUN_SMALL);
// Rerun // Rerun
m_reRunButton->setIcon(m_runIcon); m_reRunButton->setIcon(QIcon(ProjectExplorer::Constants::ICON_RUN_SMALL));
m_reRunButton->setToolTip(tr("Re-run this run-configuration")); m_reRunButton->setToolTip(tr("Re-run this run-configuration"));
m_reRunButton->setAutoRaise(true); m_reRunButton->setAutoRaise(true);
m_reRunButton->setEnabled(false); m_reRunButton->setEnabled(false);
...@@ -396,7 +393,7 @@ void OutputPane::tabChanged(int i) ...@@ -396,7 +393,7 @@ void OutputPane::tabChanged(int i)
RunControl *rc = m_runControlTabs.at(index).runControl; RunControl *rc = m_runControlTabs.at(index).runControl;
m_stopAction->setEnabled(rc->isRunning()); m_stopAction->setEnabled(rc->isRunning());
m_reRunButton->setEnabled(!rc->isRunning()); m_reRunButton->setEnabled(!rc->isRunning());
m_reRunButton->setIcon(m_runIcon); m_reRunButton->setIcon(rc->icon());
} }
} }
...@@ -406,7 +403,7 @@ void OutputPane::runControlStarted() ...@@ -406,7 +403,7 @@ void OutputPane::runControlStarted()
if (current && current == sender()) { if (current && current == sender()) {
m_reRunButton->setEnabled(false); m_reRunButton->setEnabled(false);
m_stopAction->setEnabled(true); m_stopAction->setEnabled(true);
m_reRunButton->setIcon(m_runIcon); m_reRunButton->setIcon(current->icon());
} }
} }
...@@ -427,7 +424,7 @@ void OutputPane::runControlFinished() ...@@ -427,7 +424,7 @@ void OutputPane::runControlFinished()
if (current && current == sender()) { if (current && current == sender()) {
m_reRunButton->setEnabled(true); m_reRunButton->setEnabled(true);
m_stopAction->setEnabled(false); m_stopAction->setEnabled(false);
m_reRunButton->setIcon(m_runIcon); m_reRunButton->setIcon(current->icon());
} }
// Check for asynchronous close. Close the tab. // Check for asynchronous close. Close the tab.
if (m_runControlTabs.at(senderIndex).asyncClosing) if (m_runControlTabs.at(senderIndex).asyncClosing)
......
...@@ -146,7 +146,6 @@ private: ...@@ -146,7 +146,6 @@ private:
QAction *m_stopAction; QAction *m_stopAction;
QToolButton *m_reRunButton; QToolButton *m_reRunButton;
QToolButton *m_stopButton; QToolButton *m_stopButton;
QIcon m_runIcon;
}; };
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <QtCore/QMetaType> #include <QtCore/QMetaType>
#include <QtCore/QWeakPointer> #include <QtCore/QWeakPointer>
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QtGui/QIcon>
namespace ProjectExplorer { namespace ProjectExplorer {
...@@ -252,6 +253,10 @@ public: ...@@ -252,6 +253,10 @@ public:
virtual StopResult stop() = 0; virtual StopResult stop() = 0;
virtual bool isRunning() const = 0; virtual bool isRunning() const = 0;
virtual QString displayName() const; virtual QString displayName() const;
/// \returns the icon to be shown in the outputwindow
// TODO the icon differs currently only per "mode"
// so this is more flexibel then it needs to be
virtual QIcon icon() const = 0;
bool sameRunConfiguration(const RunControl *other) const; bool sameRunConfiguration(const RunControl *other) const;
......
...@@ -113,6 +113,11 @@ bool QmlRunControl::isRunning() const ...@@ -113,6 +113,11 @@ bool QmlRunControl::isRunning() const
return m_applicationLauncher.isRunning(); return m_applicationLauncher.isRunning();
} }
QIcon QmlRunControl::icon() const
{
return QIcon(ProjectExplorer::Constants::ICON_RUN_SMALL);
}
void QmlRunControl::slotBringApplicationToForeground(qint64 pid) void QmlRunControl::slotBringApplicationToForeground(qint64 pid)
{ {
bringApplicationToForeground(pid); bringApplicationToForeground(pid);
......
...@@ -54,6 +54,7 @@ public: ...@@ -54,6 +54,7 @@ public:
virtual void start(); virtual void start();
virtual StopResult stop(); virtual StopResult stop();
virtual bool isRunning() const; virtual bool isRunning() const;
virtual QIcon icon() const;
private slots: private slots:
void processExited(int exitCode); void processExited(int exitCode);
......
...@@ -140,6 +140,11 @@ bool MaemoRunControl::isRunning() const ...@@ -140,6 +140,11 @@ bool MaemoRunControl::isRunning() const
return m_running; return m_running;
} }
QIcon MaemoRunControl::icon() const
{
return QIcon(ProjectExplorer::Constants::ICON_RUN_SMALL);
}
void MaemoRunControl::handleError(const QString &errString) void MaemoRunControl::handleError(const QString &errString)
{ {
stop(); stop();
......
...@@ -55,6 +55,7 @@ public: ...@@ -55,6 +55,7 @@ public:
virtual void start(); virtual void start();
virtual StopResult stop(); virtual StopResult stop();
virtual bool isRunning() const; virtual bool isRunning() const;
virtual QIcon icon() const;
private slots: private slots:
void startExecution(); void startExecution();
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <symbianutils/symbiandevicemanager.h> #include <symbianutils/symbiandevicemanager.h>
...@@ -110,6 +111,11 @@ bool CodaRunControl::isRunning() const ...@@ -110,6 +111,11 @@ bool CodaRunControl::isRunning() const
return m_state >= StateConnecting; return m_state >= StateConnecting;
} }
QIcon CodaRunControl::icon() const
{
return QIcon(ProjectExplorer::Constants::ICON_DEBUG_SMALL);
}
bool CodaRunControl::setupLauncher() bool CodaRunControl::setupLauncher()
{ {
QTC_ASSERT(!m_codaDevice, return false); QTC_ASSERT(!m_codaDevice, return false);
......
...@@ -63,6 +63,7 @@ public: ...@@ -63,6 +63,7 @@ public:
virtual ~CodaRunControl(); virtual ~CodaRunControl();
virtual bool isRunning() const; virtual bool isRunning() const;
virtual QIcon icon() const;
static QMessageBox *createCodaWaitingMessageBox(QWidget *parent = 0); static QMessageBox *createCodaWaitingMessageBox(QWidget *parent = 0);
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
#include "qt4projectmanagerconstants.h" #include "qt4projectmanagerconstants.h"
#include "qtoutputformatter.h" #include "qtoutputformatter.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
...@@ -369,6 +371,11 @@ bool S60EmulatorRunControl::isRunning() const ...@@ -369,6 +371,11 @@ bool S60EmulatorRunControl::isRunning() const
return m_applicationLauncher.isRunning(); return m_applicationLauncher.isRunning();
} }
QIcon S60EmulatorRunControl::icon() const
{
return QIcon(ProjectExplorer::Constants::ICON_RUN_SMALL);
}
void S60EmulatorRunControl::slotError(const QString & err) void S60EmulatorRunControl::slotError(const QString & err)
{ {
appendMessage(err, ErrorMessageFormat); appendMessage(err, ErrorMessageFormat);
......
...@@ -146,6 +146,7 @@ public: ...@@ -146,6 +146,7 @@ public:
void start(); void start();
virtual StopResult stop(); virtual StopResult stop();
bool isRunning() const; bool isRunning() const;
QIcon icon() const;
private slots: private slots:
void processExited(int exitCode); void processExited(int exitCode);
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <symbianutils/bluetoothlistener_gui.h> #include <symbianutils/bluetoothlistener_gui.h>
#include <symbianutils/launcher.h> #include <symbianutils/launcher.h>
#include <symbianutils/symbiandevicemanager.h> #include <symbianutils/symbiandevicemanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
...@@ -97,7 +98,11 @@ bool TrkRunControl::isRunning() const ...@@ -97,7 +98,11 @@ bool TrkRunControl::isRunning() const
return m_launcher && (m_launcher->state() == trk::Launcher::Connecting return m_launcher && (m_launcher->state() == trk::Launcher::Connecting
|| m_launcher->state() == trk::Launcher::Connected || m_launcher->state() == trk::Launcher::Connected
|| m_launcher->state() == trk::Launcher::WaitingForTrk); || m_launcher->state() == trk::Launcher::WaitingForTrk);
}
QIcon TrkRunControl::icon() const
{
return QIcon(ProjectExplorer::Constants::ICON_DEBUG_SMALL);
} }
bool TrkRunControl::setupLauncher() bool TrkRunControl::setupLauncher()
......
...@@ -60,6 +60,7 @@ public: ...@@ -60,6 +60,7 @@ public:
TrkRunControl(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode); TrkRunControl(ProjectExplorer::RunConfiguration *runConfiguration, const QString &mode);
~TrkRunControl(); ~TrkRunControl();
virtual bool isRunning() const; virtual bool isRunning() const;
virtual QIcon icon() const;
static QMessageBox *createTrkWaitingMessageBox(const QString &port, QWidget *parent = 0); static QMessageBox *createTrkWaitingMessageBox(const QString &port, QWidget *parent = 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment