diff --git a/src/SeerConsoleWidget.cpp b/src/SeerConsoleWidget.cpp index c759827..9c2fb75 100644 --- a/src/SeerConsoleWidget.cpp +++ b/src/SeerConsoleWidget.cpp @@ -90,6 +90,11 @@ void SeerConsoleWidget::handleText (const char* buffer, int count) { textEdit->insertAnsiText(str); textEdit->ensureCursorVisible(); + // Send signal of new text if this widget is not visable. + if (isVisible() == false) { + emit newTextAdded(); + } + return; } @@ -523,3 +528,12 @@ void SeerConsoleWidget::resizeEvent (QResizeEvent* event) { QWidget::resizeEvent(event); } +void SeerConsoleWidget::showEvent (QShowEvent* event) { + + // Handle the event as normal. + QWidget::showEvent(event); + + // Announce we are now visable. + emit newTextViewed(); +} + diff --git a/src/SeerConsoleWidget.h b/src/SeerConsoleWidget.h index 2e4e4ae..56f2dd2 100644 --- a/src/SeerConsoleWidget.h +++ b/src/SeerConsoleWidget.h @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include "ui_SeerConsoleWidget.h" @@ -32,6 +33,10 @@ class SeerConsoleWidget : public QWidget, protected Ui::SeerConsoleWidgetForm { void resetSize (); + signals: + void newTextAdded (); + void newTextViewed (); + public slots: void handleChangeWindowTitle (QString title); void handleTabDetached (QWidget* widget); @@ -54,6 +59,7 @@ class SeerConsoleWidget : public QWidget, protected Ui::SeerConsoleWidgetForm { void writeSizeSettings (); void readSettings (); void resizeEvent (QResizeEvent* event); + void showEvent (QShowEvent* event); private: QString _ttyDeviceName; diff --git a/src/SeerGdbWidget.cpp b/src/SeerGdbWidget.cpp index 32e0152..5a447a6 100644 --- a/src/SeerGdbWidget.cpp +++ b/src/SeerGdbWidget.cpp @@ -780,7 +780,6 @@ void SeerGdbWidget::handleLogsTabMoved (int to, int from) { // Keep track of console tab if it moved. if (_consoleIndex == from) { - qDebug() << "Console tab index changed from" << from << "to" << to; _consoleIndex = to; } @@ -821,10 +820,11 @@ void SeerGdbWidget::writeLogsSettings () { QStringList tabs; for (int i=0; itabBar()->count(); i++) { - tabs.append(logsTabWidget->tabBar()->tabText(i)); + tabs.append(logsTabWidget->tabBar()->tabText(i).remove('*')); // Remove '*' from each tab name. } QString current = logsTabWidget->tabBar()->tabText(logsTabWidget->tabBar()->currentIndex()); + current = current.remove('*'); //qDebug() << "Tabs" << tabs; //qDebug() << "Current" << current; @@ -864,7 +864,7 @@ void SeerGdbWidget::readLogsSettings () { int tb = -1; for (int j=0; jtabBar()->count(); j++) { - if (logsTabWidget->tabBar()->tabText(j) == tab) { + if (logsTabWidget->tabBar()->tabText(j).remove('*') == tab) { tb = j; break; } @@ -878,7 +878,7 @@ void SeerGdbWidget::readLogsSettings () { // Find the console tab index. _consoleIndex = -1; for (int i=0; itabBar()->count(); i++) { - if (logsTabWidget->tabBar()->tabText(i) == "Console output") { + if (logsTabWidget->tabBar()->tabText(i).remove('*') == "Console output") { _consoleIndex = i; break; } @@ -891,7 +891,7 @@ void SeerGdbWidget::readLogsSettings () { // Make a tab current. if (current != "") { for (int i=0; itabBar()->count(); i++) { - if (logsTabWidget->tabBar()->tabText(i) == current) { + if (logsTabWidget->tabBar()->tabText(i).remove('*') == current) { logsTabWidget->setCurrentIndex(i); break; } @@ -3504,11 +3504,28 @@ void SeerGdbWidget::createConsole () { _consoleIndex = logsTabWidget->addTab(_consoleWidget, "Console output"); + QObject::connect(_consoleWidget, &SeerConsoleWidget::newTextAdded, this, &SeerGdbWidget::handleConsoleNewTextAdded); + QObject::connect(_consoleWidget, &SeerConsoleWidget::newTextViewed, this, &SeerGdbWidget::handleConsoleNewTextViewed); + setConsoleMode(consoleMode()); setConsoleScrollLines(consoleScrollLines()); } } +void SeerGdbWidget::handleConsoleNewTextAdded () { + + if (_consoleIndex >= 0) { + logsTabWidget->setTabText(_consoleIndex, "Console output*"); + } +} + +void SeerGdbWidget::handleConsoleNewTextViewed () { + + if (_consoleIndex >= 0) { + logsTabWidget->setTabText(_consoleIndex, "Console output"); + } +} + SeerConsoleWidget* SeerGdbWidget::console () { return _consoleWidget; diff --git a/src/SeerGdbWidget.h b/src/SeerGdbWidget.h index a7bed12..6290432 100644 --- a/src/SeerGdbWidget.h +++ b/src/SeerGdbWidget.h @@ -361,6 +361,8 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm { void handleGdbProcessErrored (QProcess::ProcessError errorStatus); void handleConsoleModeChanged (); + void handleConsoleNewTextAdded (); + void handleConsoleNewTextViewed (); void handleAboutToQuit (); signals: