Revert "Debugger: Remove 'Context' label in debugger console"

As we can have a context again now, we should be able to show it.

This reverts commit 8679a7caa6.

Task-number: QTCREATORBUG-17177
Change-Id: I221628dc91af839be867cc1bf8dfe5d5163fd321
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2016-12-09 11:32:48 +01:00
parent 697b612a88
commit 43dbed9919
3 changed files with 15 additions and 1 deletions

View File

@@ -144,6 +144,8 @@ Console::Console()
m_spacer = new QWidget(m_consoleWidget); m_spacer = new QWidget(m_consoleWidget);
m_spacer->setMinimumWidth(30); m_spacer->setMinimumWidth(30);
m_statusLabel = new QLabel(m_consoleWidget);
readSettings(); readSettings();
connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested, connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested,
this, &Console::writeSettings); this, &Console::writeSettings);
@@ -162,7 +164,8 @@ QWidget *Console::outputWidget(QWidget *)
QList<QWidget *> Console::toolBarWidgets() const QList<QWidget *> Console::toolBarWidgets() const
{ {
return { m_showDebugButton, m_showWarningButton, m_showErrorButton, m_spacer }; return { m_showDebugButton, m_showWarningButton, m_showErrorButton,
m_spacer, m_statusLabel };
} }
int Console::priorityInStatusBar() const int Console::priorityInStatusBar() const
@@ -230,6 +233,11 @@ void Console::readSettings()
m_showErrorButtonAction->readSettings(settings); m_showErrorButtonAction->readSettings(settings);
} }
void Console::setContext(const QString &context)
{
m_statusLabel->setText(context);
}
void Console::writeSettings() const void Console::writeSettings() const
{ {
QSettings *settings = Core::ICore::settings(); QSettings *settings = Core::ICore::settings();
@@ -241,6 +249,8 @@ void Console::writeSettings() const
void Console::setScriptEvaluator(const ScriptEvaluator &evaluator) void Console::setScriptEvaluator(const ScriptEvaluator &evaluator)
{ {
m_scriptEvaluator = evaluator; m_scriptEvaluator = evaluator;
if (!m_scriptEvaluator)
setContext(QString());
} }
void Console::printItem(ConsoleItem::ItemType itemType, const QString &text) void Console::printItem(ConsoleItem::ItemType itemType, const QString &text)

View File

@@ -73,6 +73,7 @@ public:
bool canNavigate() const; bool canNavigate() const;
void readSettings(); void readSettings();
void setContext(const QString &context);
void setScriptEvaluator(const ScriptEvaluator &evaluator); void setScriptEvaluator(const ScriptEvaluator &evaluator);
@@ -90,6 +91,7 @@ private:
Utils::SavedAction *m_showWarningButtonAction; Utils::SavedAction *m_showWarningButtonAction;
Utils::SavedAction *m_showErrorButtonAction; Utils::SavedAction *m_showErrorButtonAction;
QWidget *m_spacer; QWidget *m_spacer;
QLabel *m_statusLabel;
ConsoleItemModel *m_consoleItemModel; ConsoleItemModel *m_consoleItemModel;
ConsoleView *m_consoleView; ConsoleView *m_consoleView;
QWidget *m_consoleWidget; QWidget *m_consoleWidget;

View File

@@ -1120,6 +1120,8 @@ void QmlEngine::updateCurrentContext()
else else
context = grandParentData->name; context = grandParentData->name;
} }
debuggerConsole()->setContext(tr("Context:") + QLatin1Char(' ') + context);
} }
void QmlEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages) void QmlEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)