diff --git a/src/SeerConfigDialog.cpp b/src/SeerConfigDialog.cpp index 0fd635e..3c257e3 100644 --- a/src/SeerConfigDialog.cpp +++ b/src/SeerConfigDialog.cpp @@ -125,6 +125,26 @@ bool SeerConfigDialog::editorHighlighterEnabled () const { return _editorConfigPage->highlighterEnabled(); } +void SeerConfigDialog::setSeerRememberWindowSizes (bool flag) { + + _seerConfigPage->setRememberWindowSizes(flag); +} + +bool SeerConfigDialog::seerRememberWindowSizes () const { + + return _seerConfigPage->rememberWindowSizes(); +} + +void SeerConfigDialog::setSeerConsoleMode (const QString& mode) { + + _seerConfigPage->setConsoleMode(mode); +} + +QString SeerConfigDialog::seerConsoleMode () const { + + return _seerConfigPage->consoleMode(); +} + void SeerConfigDialog::handleChangePage(QListWidgetItem* current, QListWidgetItem* previous) { //qDebug() << __PRETTY_FUNCTION__ << ":" << current << previous; @@ -171,6 +191,15 @@ void SeerConfigDialog::handleButtonClicked (QAbstractButton* button) { }else if (itemLabel == "Seer") { + int result = QMessageBox::warning(this, "Seer", + QString("Reset settings for '") + itemLabel + "'?", + QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Cancel); + + if (result == QMessageBox::Ok) { + setSeerRememberWindowSizes(true); + setSeerConsoleMode("normal"); + } + }else{ } } diff --git a/src/SeerConfigDialog.h b/src/SeerConfigDialog.h index 1a4fbe8..5ebd915 100644 --- a/src/SeerConfigDialog.h +++ b/src/SeerConfigDialog.h @@ -41,6 +41,13 @@ class SeerConfigDialog : public QDialog, protected Ui::SeerConfigDialogForm { void setEditorHighlighterEnabled (bool flag); bool editorHighlighterEnabled () const; + // Seer settings. + void setSeerRememberWindowSizes (bool flag); + bool seerRememberWindowSizes () const; + + void setSeerConsoleMode (const QString& mode); + QString seerConsoleMode () const; + public slots: void handleChangePage (QListWidgetItem* current, QListWidgetItem* previous); void handleButtonClicked (QAbstractButton* button); diff --git a/src/SeerEditorConfigPage.ui b/src/SeerEditorConfigPage.ui index d4e5814..2053317 100644 --- a/src/SeerEditorConfigPage.ui +++ b/src/SeerEditorConfigPage.ui @@ -122,7 +122,7 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Specify font and highlighting colors for the code editor.</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Specify font and highlighting colors for the code editor.</span></p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These formats apply only when highlighting is enabled and if the file is C or C++.</p> <ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Class</li> <li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Comment</li> diff --git a/src/SeerGdbConfigPage.ui b/src/SeerGdbConfigPage.ui index fd338cf..1b0e5de 100644 --- a/src/SeerGdbConfigPage.ui +++ b/src/SeerGdbConfigPage.ui @@ -65,7 +65,7 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Specify an alternate gdb program or alternate gdb flags.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Specify an alternate gdb program and alternate gdb flags.</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Note, Seer relies on the &quot;mi&quot; interpreter that is built into gdb. If a different debugger is used, it must provide that. So, usually, the &quot;--interpreter=mi&quot; argument is a must.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> diff --git a/src/SeerGdbWidget.cpp b/src/SeerGdbWidget.cpp index 800393f..d35947c 100644 --- a/src/SeerGdbWidget.cpp +++ b/src/SeerGdbWidget.cpp @@ -4,6 +4,7 @@ #include "SeerArrayVisualizerWidget.h" #include "SeerUtl.h" #include +#include #include #include #include @@ -179,6 +180,7 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) { QObject::connect(stackThreadManagersplitter, &QSplitter::splitterMoved, this, &SeerGdbWidget::handleSplitterMoved); // Restore window settings. + setConsoleMode("normal"); readSettings(); } @@ -1291,6 +1293,10 @@ void SeerGdbWidget::writeSettings () { settings.setValue("sourceLibraryVariableManagerSplitter", sourceLibraryVariableManagerSplitter->saveState()); settings.setValue("stackThreadManagersplitter", stackThreadManagersplitter->saveState()); settings.endGroup(); + + settings.beginGroup("consolewindow"); + settings.setValue("start", consoleMode()); + settings.endGroup(); } void SeerGdbWidget::readSettings () { @@ -1303,6 +1309,10 @@ void SeerGdbWidget::readSettings () { sourceLibraryVariableManagerSplitter->restoreState(settings.value("sourceLibraryVariableManagerSplitter").toByteArray()); stackThreadManagersplitter->restoreState(settings.value("stackThreadManagersplitter").toByteArray()); settings.endGroup(); + + settings.beginGroup("consolewindow"); + setConsoleMode(settings.value("start", "normal").toString()); + settings.endGroup(); } bool SeerGdbWidget::isGdbRuning () const { @@ -1365,7 +1375,8 @@ void SeerGdbWidget::createConsole () { if (_consoleWidget == 0) { _consoleWidget = new SeerConsoleWidget(0); _consoleWidget->setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint); - _consoleWidget->show(); + + setConsoleMode(consoleMode()); } } @@ -1377,6 +1388,45 @@ void SeerGdbWidget::deleteConsole () { } } +void SeerGdbWidget::setConsoleMode (const QString& mode) { + + _consoleMode = mode; + + if (_consoleWidget != 0) { + if (_consoleMode == "normal") { + _consoleWidget->show(); + _consoleWidget->setWindowState(Qt::WindowNoState); + + }else if (_consoleMode == "minimized") { + _consoleWidget->show(); + _consoleWidget->setWindowState(Qt::WindowMinimized); + + }else if (_consoleMode == "hidden") { + _consoleWidget->hide(); + + }else if (_consoleMode == "") { + _consoleMode = "normal"; + _consoleWidget->show(); + _consoleWidget->setWindowState(Qt::WindowNoState); + + }else{ + } + } + + //_consoleWidget->hide(); // Hide the console. Use show() to restore it. + //_consoleWidget->setWindowState(Qt::WindowNoState); // Show it normally. + //_consoleWidget->setWindowState(Qt::WindowMinimized); // Show it minimized. +} + +QString SeerGdbWidget::consoleMode () const { + + if (_consoleMode == "") { + return "normal"; + } + + return _consoleMode; +} + void SeerGdbWidget::sendGdbInterrupt (int signal) { //qDebug() << __PRETTY_FUNCTION__ << "Sending an interrupt to the program. Signal =" << signal; diff --git a/src/SeerGdbWidget.h b/src/SeerGdbWidget.h index 19c4aca..05621cb 100644 --- a/src/SeerGdbWidget.h +++ b/src/SeerGdbWidget.h @@ -58,9 +58,15 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm { void setGdbAsyncMode (bool flag); bool gdbAsyncMode () const; + void setConsoleMode (const QString& mode); + QString consoleMode () const; + // Editor manager. SeerEditorManagerWidget* editorManager (); + void writeSettings (); + void readSettings (); + public slots: void handleText (const QString& text); void handleExecute (); @@ -133,8 +139,6 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm { void stoppingPointReached (); protected: - void writeSettings (); - void readSettings (); private: bool isGdbRuning () const; @@ -158,6 +162,7 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm { bool _newExecutableFlag; SeerConsoleWidget* _consoleWidget; + QString _consoleMode; SeerBreakpointsBrowserWidget* _breakpointsBrowserWidget; SeerWatchpointsBrowserWidget* _watchpointsBrowserWidget; SeerCatchpointsBrowserWidget* _catchpointsBrowserWidget; diff --git a/src/SeerMainWindow.cpp b/src/SeerMainWindow.cpp index 2fce8b7..e234dd3 100644 --- a/src/SeerMainWindow.cpp +++ b/src/SeerMainWindow.cpp @@ -73,6 +73,9 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) { QObject::connect(actionFileQuit, &QAction::triggered, this, &SeerMainWindow::handleFileQuit); QObject::connect(actionViewMemoryVisualizer, &QAction::triggered, this, &SeerMainWindow::handleViewMemoryVisualizer); QObject::connect(actionViewArrayVisualizer, &QAction::triggered, this, &SeerMainWindow::handleViewArrayVisualizer); + QObject::connect(actionConsoleNormal, &QAction::triggered, this, &SeerMainWindow::handleViewConsoleNormal); + QObject::connect(actionConsoleHidden, &QAction::triggered, this, &SeerMainWindow::handleViewConsoleHidden); + QObject::connect(actionConsoleMinimized, &QAction::triggered, this, &SeerMainWindow::handleViewConsoleMinimized); QObject::connect(actionHelpAbout, &QAction::triggered, this, &SeerMainWindow::handleHelpAbout); QObject::connect(actionControlRun, &QAction::triggered, gdbWidget, &SeerGdbWidget::handleGdbRunExecutable); @@ -278,6 +281,21 @@ void SeerMainWindow::handleViewArrayVisualizer () { gdbWidget->handleGdbArrayVisualizer(); } +void SeerMainWindow::handleViewConsoleNormal () { + + gdbWidget->setConsoleMode("normal"); +} + +void SeerMainWindow::handleViewConsoleHidden () { + + gdbWidget->setConsoleMode("hidden"); +} + +void SeerMainWindow::handleViewConsoleMinimized () { + + gdbWidget->setConsoleMode("minimized"); +} + void SeerMainWindow::handleSettingsConfiguration () { SeerConfigDialog dlg(this); @@ -288,6 +306,7 @@ void SeerMainWindow::handleSettingsConfiguration () { dlg.setEditorFont(gdbWidget->editorManager()->editorFont()); dlg.setEditorHighlighterSettings(gdbWidget->editorManager()->editorHighlighterSettings()); dlg.setEditorHighlighterEnabled(gdbWidget->editorManager()->editorHighlighterEnabled()); + dlg.setSeerConsoleMode(gdbWidget->consoleMode()); int ret = dlg.exec(); @@ -301,6 +320,7 @@ void SeerMainWindow::handleSettingsConfiguration () { gdbWidget->editorManager()->setEditorFont(dlg.editorFont()); gdbWidget->editorManager()->setEditorHighlighterSettings(dlg.editorHighlighterSettings()); gdbWidget->editorManager()->setEditorHighlighterEnabled(dlg.editorHighlighterEnabled()); + gdbWidget->setConsoleMode(dlg.seerConsoleMode()); } void SeerMainWindow::handleSettingsSaveConfiguration () { @@ -314,6 +334,7 @@ void SeerMainWindow::handleSettingsSaveConfiguration () { } writeConfigSettings(); + gdbWidget->writeSettings(); QMessageBox::information(this, "Seer", "Saved."); } diff --git a/src/SeerMainWindow.h b/src/SeerMainWindow.h index e6a6267..286948c 100644 --- a/src/SeerMainWindow.h +++ b/src/SeerMainWindow.h @@ -40,6 +40,9 @@ class SeerMainWindow : public QMainWindow, protected Ui::SeerMainWindowForm { void handleFileQuit (); void handleViewMemoryVisualizer (); void handleViewArrayVisualizer (); + void handleViewConsoleNormal (); + void handleViewConsoleHidden (); + void handleViewConsoleMinimized (); void handleSettingsConfiguration (); void handleSettingsSaveConfiguration (); void handleHelpAbout (); diff --git a/src/SeerMainWindow.ui b/src/SeerMainWindow.ui index fbfbe9f..c3e34ee 100644 --- a/src/SeerMainWindow.ui +++ b/src/SeerMainWindow.ui @@ -40,8 +40,27 @@ View + + + + + + + + + Console + + + + :/seer/resources/console.png:/seer/resources/console.png + + + + + + @@ -428,6 +447,42 @@ Save the configurations so future Seer sessions will use them. + + + + :/seer/resources/maximize.png:/seer/resources/maximize.png + + + Normal + + + Show the console window. + + + + + + :/seer/resources/hide.png:/seer/resources/hide.png + + + Hidden + + + Hide the console window. + + + + + + :/seer/resources/minimize.png:/seer/resources/minimize.png + + + Minimized + + + Minimize the console window. + + diff --git a/src/SeerSeerConfigPage.cpp b/src/SeerSeerConfigPage.cpp index d0cdc6c..f22fd97 100644 --- a/src/SeerSeerConfigPage.cpp +++ b/src/SeerSeerConfigPage.cpp @@ -7,6 +7,8 @@ SeerSeerConfigPage::SeerSeerConfigPage(QWidget* parent) : QWidget(parent) { setupUi(this); // Setup the widgets + setConsoleMode("normal"); + setRememberWindowSizes(true); // Connect things. } @@ -14,3 +16,45 @@ SeerSeerConfigPage::SeerSeerConfigPage(QWidget* parent) : QWidget(parent) { SeerSeerConfigPage::~SeerSeerConfigPage() { } +void SeerSeerConfigPage::setConsoleMode (const QString& mode) { + + if (mode == "normal") { + normalRadioButton->setChecked(true); + + }else if (mode == "minimized") { + minimizedRadioButton->setChecked(true); + + }else if (mode == "hidden") { + hiddenRadioButton->setChecked(true); + + }else{ + normalRadioButton->setChecked(true); + } +} + +QString SeerSeerConfigPage::consoleMode () const { + + if (normalRadioButton->isChecked()) { + return "normal"; + + }else if (minimizedRadioButton->isChecked()) { + return "minimized"; + + }else if (hiddenRadioButton->isChecked()) { + return "hidden"; + + }else{ + return "normal"; + } +} + +void SeerSeerConfigPage::setRememberWindowSizes (bool flag) { + + rememberSizescheckBox->setChecked(flag); +} + +bool SeerSeerConfigPage::rememberWindowSizes () const { + + return rememberSizescheckBox->isChecked(); +} + diff --git a/src/SeerSeerConfigPage.h b/src/SeerSeerConfigPage.h index f376be8..f449c68 100644 --- a/src/SeerSeerConfigPage.h +++ b/src/SeerSeerConfigPage.h @@ -12,5 +12,10 @@ class SeerSeerConfigPage : public QWidget, public Ui::SeerSeerConfigPage { explicit SeerSeerConfigPage (QWidget* parent = 0); ~SeerSeerConfigPage (); + void setConsoleMode (const QString& mode); + QString consoleMode () const; + + void setRememberWindowSizes (bool flag); + bool rememberWindowSizes () const; }; diff --git a/src/SeerSeerConfigPage.ui b/src/SeerSeerConfigPage.ui index 8546510..6aac174 100644 --- a/src/SeerSeerConfigPage.ui +++ b/src/SeerSeerConfigPage.ui @@ -20,22 +20,98 @@ 0 - + + + + Number of manual gdb/mi commands to remember + + + + + + + Remember window sizes. + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Specify general settings for the Seer program itself.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Specify general settings for the Seer program itself.</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Coming soon near you.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">On startup, the console can be shown normal, minimized, or hidden.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The window sizes can be remembered if they get changed. On startup, Seer will start with the rembered sizes.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Also, 'N' number of the most recent gdb/mi commands will be remembered.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> + + + + Console mode on startup + + + + + + Normal + + + modeButtonGroup + + + + + + + Minimized + + + modeButtonGroup + + + + + + + Hidden + + + modeButtonGroup + + + + + + + + + diff --git a/src/SeerSourceConfigPage.ui b/src/SeerSourceConfigPage.ui index 30f3a17..8837497 100644 --- a/src/SeerSourceConfigPage.ui +++ b/src/SeerSourceConfigPage.ui @@ -27,7 +27,7 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Specify directory mappings for locating source files.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Specify directory mappings for locating source files.</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Coming soon near you.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> diff --git a/src/resource.qrc b/src/resource.qrc index 13e2003..97f8ac0 100644 --- a/src/resource.qrc +++ b/src/resource.qrc @@ -25,5 +25,9 @@ resources/editor.png resources/source.png resources/font.png + resources/console.png + resources/hide.png + resources/maximize.png + resources/minimize.png diff --git a/src/resources/README.icons b/src/resources/README.icons index 4e94d81..adce094 100644 --- a/src/resources/README.icons +++ b/src/resources/README.icons @@ -9,6 +9,10 @@ Most are 32x32. https://www.flaticon.com/premium-icon/contrast-adjustment_4353977 https://www.flaticon.com/authors/creatype https://www.flaticon.com/free-icon/blogger_3860232 https://www.flaticon.com/authors/xnimrodx https://www.flaticon.com/premium-icon/c_2085176 https://www.flaticon.com/authors/justicon + https://www.flaticon.com/premium-icon/command_6008504 https://www.flaticon.com/authors/flat-icons + https://www.flaticon.com/free-icon/maximize_3580204 https://www.flaticon.com/authors/mavadee + https://www.flaticon.com/free-icon/minimize_3580225 https://www.flaticon.com/authors/mavadee + https://www.flaticon.com/premium-icon/close_3718000 https://www.flaticon.com/authors/flat-icons https://icon-icons.com/icon/GDB/132365 https://creativecommons.org/licenses/by/4.0/ John Gardner The debugging icons used are from the NetBeans project (via the Gede debugger) and licensed under the diff --git a/src/resources/console.png b/src/resources/console.png new file mode 100644 index 0000000..88871fe Binary files /dev/null and b/src/resources/console.png differ diff --git a/src/resources/hide.png b/src/resources/hide.png new file mode 100644 index 0000000..337e279 Binary files /dev/null and b/src/resources/hide.png differ diff --git a/src/resources/maximize.png b/src/resources/maximize.png new file mode 100644 index 0000000..8441c9a Binary files /dev/null and b/src/resources/maximize.png differ diff --git a/src/resources/minimize.png b/src/resources/minimize.png new file mode 100644 index 0000000..566a56f Binary files /dev/null and b/src/resources/minimize.png differ diff --git a/src/seer.cpp b/src/seer.cpp index 54d3805..e8425f3 100644 --- a/src/seer.cpp +++ b/src/seer.cpp @@ -110,6 +110,7 @@ int main (int argc, char* argv[]) { seer.move(800, 400); seer.show(); + seer.activateWindow(); return app.exec(); }