mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 08:34:42 +08:00
Save window and splitter sizes and positions.
Remove 'quit' toobar button. Verify 'start' and 'run' if executable is already running.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <QtPrintSupport/QPrintDialog>
|
||||
#include <QtGui/QFont>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QDebug>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
@@ -49,6 +50,9 @@ SeerConsoleWidget::SeerConsoleWidget (QWidget* parent) : QWidget(parent) {
|
||||
QObject::connect(saveButton, &QPushButton::clicked, this, &SeerConsoleWidget::handleSaveButton);
|
||||
QObject::connect(wrapTextCheckBox, &QCheckBox::clicked, this, &SeerConsoleWidget::handleWrapTextCheckBox);
|
||||
QObject::connect(stdinLineEdit, &QLineEdit::returnPressed, this, &SeerConsoleWidget::handleStdinLineEdit);
|
||||
|
||||
// Restore window settings.
|
||||
readSettings();
|
||||
}
|
||||
|
||||
SeerConsoleWidget::~SeerConsoleWidget () {
|
||||
@@ -305,3 +309,33 @@ void SeerConsoleWidget::deleteConsole () {
|
||||
::close(_ptsFD); _ptsFD = -1;
|
||||
}
|
||||
|
||||
void SeerConsoleWidget::writeSettings() {
|
||||
|
||||
QSettings settings;
|
||||
|
||||
settings.beginGroup("consolewindow");
|
||||
settings.setValue("size", size());
|
||||
settings.endGroup();
|
||||
|
||||
//qDebug() << __PRETTY_FUNCTION__ << ":" << size();
|
||||
}
|
||||
|
||||
void SeerConsoleWidget::readSettings() {
|
||||
|
||||
QSettings settings;
|
||||
|
||||
settings.beginGroup("consolewindow");
|
||||
resize(settings.value("size", QSize(800, 600)).toSize());
|
||||
settings.endGroup();
|
||||
|
||||
//qDebug() << __PRETTY_FUNCTION__ << ":" << size();
|
||||
}
|
||||
|
||||
void SeerConsoleWidget::resizeEvent (QResizeEvent* event) {
|
||||
|
||||
// Write window settings.
|
||||
writeSettings();
|
||||
|
||||
QWidget::resizeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <QtWidgets/QWidget>
|
||||
#include <QtGui/QTextCursor>
|
||||
#include <QtGui/QResizeEvent>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QSocketNotifier>
|
||||
#include "ui_SeerConsoleWidget.h"
|
||||
@@ -30,6 +31,9 @@ class SeerConsoleWidget : public QWidget, protected Ui::SeerConsoleWidgetForm {
|
||||
void connectConsole ();
|
||||
void disconnectConsole ();
|
||||
void deleteConsole ();
|
||||
void writeSettings ();
|
||||
void readSettings ();
|
||||
void resizeEvent (QResizeEvent* event);
|
||||
|
||||
private:
|
||||
QTextCursor _cursor;
|
||||
|
||||
+67
-10
@@ -35,10 +35,10 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) {
|
||||
font.setFixedPitch(true);
|
||||
font.setStyleHint(QFont::TypeWriter);
|
||||
|
||||
_breakpointsBrowserWidget = new SeerBreakpointsBrowserWidget(this);
|
||||
_watchpointsBrowserWidget = new SeerWatchpointsBrowserWidget(this);
|
||||
_gdbOutputLog = new SeerTildeEqualAmpersandLogWidget(this);
|
||||
_seerOutputLog = new SeerCaretAsteriskLogWidget(this);
|
||||
_breakpointsBrowserWidget = new SeerBreakpointsBrowserWidget(this);
|
||||
_watchpointsBrowserWidget = new SeerWatchpointsBrowserWidget(this);
|
||||
_gdbOutputLog = new SeerTildeEqualAmpersandLogWidget(this);
|
||||
_seerOutputLog = new SeerCaretAsteriskLogWidget(this);
|
||||
|
||||
logsTabWidget->addTab(_breakpointsBrowserWidget, "Breakpoints");
|
||||
logsTabWidget->addTab(_watchpointsBrowserWidget, "Watchpoints");
|
||||
@@ -148,6 +148,14 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) {
|
||||
QObject::connect(this, &SeerGdbWidget::stoppingPointReached, variableManagerWidget->variableTrackerBrowserWidget(), &SeerVariableTrackerBrowserWidget::handleStoppingPointReached);
|
||||
QObject::connect(this, &SeerGdbWidget::stoppingPointReached, _breakpointsBrowserWidget, &SeerBreakpointsBrowserWidget::handleStoppingPointReached);
|
||||
QObject::connect(this, &SeerGdbWidget::stoppingPointReached, _watchpointsBrowserWidget, &SeerWatchpointsBrowserWidget::handleStoppingPointReached);
|
||||
|
||||
QObject::connect(leftCenterRightSplitter, &QSplitter::splitterMoved, this, &SeerGdbWidget::handleSplitterMoved);
|
||||
QObject::connect(sourceLibraryVariableManagerSplitter, &QSplitter::splitterMoved, this, &SeerGdbWidget::handleSplitterMoved);
|
||||
QObject::connect(codeManagerLogTabsSplitter, &QSplitter::splitterMoved, this, &SeerGdbWidget::handleSplitterMoved);
|
||||
QObject::connect(stackThreadManagersplitter, &QSplitter::splitterMoved, this, &SeerGdbWidget::handleSplitterMoved);
|
||||
|
||||
// Restore window settings.
|
||||
readSettings();
|
||||
}
|
||||
|
||||
SeerGdbWidget::~SeerGdbWidget () {
|
||||
@@ -331,14 +339,23 @@ void SeerGdbWidget::handleGdbRunExecutable () {
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete old console.
|
||||
deleteConsole();
|
||||
|
||||
// Kill previous gdb, if any.
|
||||
if (isGdbRuning() == true) {
|
||||
|
||||
int result = QMessageBox::warning(this, "Seer",
|
||||
QString("The executable is already running.\n\nAre you sure to restart it?"),
|
||||
QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Cancel);
|
||||
|
||||
if (result == QMessageBox::Cancel) {
|
||||
return;
|
||||
}
|
||||
|
||||
killGdb();
|
||||
}
|
||||
|
||||
// Delete old console.
|
||||
deleteConsole();
|
||||
|
||||
// If gdb isn't running, start it.
|
||||
if (isGdbRuning() == false) {
|
||||
startGdb();
|
||||
@@ -385,14 +402,23 @@ void SeerGdbWidget::handleGdbStartExecutable () {
|
||||
|
||||
//qDebug() << __PRETTY_FUNCTION__ << ": newExecutableFlag = " << newExecutableFlag();
|
||||
|
||||
// Delete old console.
|
||||
deleteConsole();
|
||||
|
||||
// Kill previous gdb, if any.
|
||||
if (isGdbRuning() == true) {
|
||||
|
||||
int result = QMessageBox::warning(this, "Seer",
|
||||
QString("The executable is already running.\n\nAre you sure to restart it?"),
|
||||
QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Cancel);
|
||||
|
||||
if (result == QMessageBox::Cancel) {
|
||||
return;
|
||||
}
|
||||
|
||||
killGdb();
|
||||
}
|
||||
|
||||
// Delete old console.
|
||||
deleteConsole();
|
||||
|
||||
// If gdb isn't running, start it.
|
||||
if (isGdbRuning() == false) {
|
||||
startGdb();
|
||||
@@ -1007,6 +1033,13 @@ void SeerGdbWidget::handleGdbMemoryEvaluateExpression (int expressionid, QString
|
||||
handleGdbCommand(QString::number(expressionid) + "-data-read-memory-bytes " + address + " " + QString::number(count));
|
||||
}
|
||||
|
||||
void SeerGdbWidget::handleSplitterMoved (int pos, int index) {
|
||||
|
||||
//qDebug() << __PRETTY_FUNCTION__ << ":" << "Splitter moved to " << pos << index;
|
||||
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void SeerGdbWidget::handleFinished (int exitCode, QProcess::ExitStatus exitStatus) {
|
||||
|
||||
Q_UNUSED(exitCode);
|
||||
@@ -1016,6 +1049,30 @@ void SeerGdbWidget::handleFinished (int exitCode, QProcess::ExitStatus exitStatu
|
||||
qApp->exit();
|
||||
}
|
||||
|
||||
void SeerGdbWidget::writeSettings () {
|
||||
|
||||
QSettings settings;
|
||||
|
||||
settings.beginGroup("mainwindowsplitters");
|
||||
settings.setValue("leftCenterRightSplitter", leftCenterRightSplitter->saveState());
|
||||
settings.setValue("codeManagerLogTabsSplitter", codeManagerLogTabsSplitter->saveState());
|
||||
settings.setValue("sourceLibraryVariableManagerSplitter", sourceLibraryVariableManagerSplitter->saveState());
|
||||
settings.setValue("stackThreadManagersplitter", stackThreadManagersplitter->saveState());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
void SeerGdbWidget::readSettings () {
|
||||
|
||||
QSettings settings;
|
||||
|
||||
settings.beginGroup("mainwindowsplitters");
|
||||
leftCenterRightSplitter->restoreState(settings.value("leftCenterRightSplitter").toByteArray());
|
||||
codeManagerLogTabsSplitter->restoreState(settings.value("codeManagerLogTabsSplitter").toByteArray());
|
||||
sourceLibraryVariableManagerSplitter->restoreState(settings.value("sourceLibraryVariableManagerSplitter").toByteArray());
|
||||
stackThreadManagersplitter->restoreState(settings.value("stackThreadManagersplitter").toByteArray());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
bool SeerGdbWidget::isGdbRuning () const {
|
||||
|
||||
if (_gdbProcess->state() == QProcess::NotRunning) {
|
||||
|
||||
@@ -95,12 +95,17 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm {
|
||||
void handleGdbDataDeleteExpressions (QString expressionids);
|
||||
void handleGdbMemoryAddExpression (QString expression);
|
||||
void handleGdbMemoryEvaluateExpression (int expressionid, QString address, int count);
|
||||
void handleSplitterMoved (int pos, int index);
|
||||
|
||||
void handleFinished (int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
signals:
|
||||
void stoppingPointReached ();
|
||||
|
||||
protected:
|
||||
void writeSettings ();
|
||||
void readSettings ();
|
||||
|
||||
private:
|
||||
bool isGdbRuning () const;
|
||||
void startGdb ();
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1085</width>
|
||||
<height>1128</height>
|
||||
<width>997</width>
|
||||
<height>566</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -15,11 +15,11 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<widget class="QSplitter" name="leftCenterRightSplitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QSplitter" name="splitter_3">
|
||||
<widget class="QSplitter" name="sourceLibraryVariableManagerSplitter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>20</horstretch>
|
||||
@@ -52,7 +52,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QSplitter" name="splitter_1">
|
||||
<widget class="QSplitter" name="codeManagerLogTabsSplitter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>60</horstretch>
|
||||
@@ -92,7 +92,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QSplitter" name="splitter_2">
|
||||
<widget class="QSplitter" name="stackThreadManagersplitter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>20</horstretch>
|
||||
|
||||
+35
-1
@@ -9,6 +9,7 @@
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) {
|
||||
@@ -42,10 +43,10 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) {
|
||||
|
||||
QObject::connect(actionGdbRun, &QAction::triggered, centralwidget, &SeerGdbWidget::handleGdbRunExecutable);
|
||||
QObject::connect(actionGdbStart, &QAction::triggered, centralwidget, &SeerGdbWidget::handleGdbStartExecutable);
|
||||
QObject::connect(actionGdbContinue, &QAction::triggered, centralwidget, &SeerGdbWidget::handleGdbContinue);
|
||||
QObject::connect(actionGdbNext, &QAction::triggered, centralwidget, &SeerGdbWidget::handleGdbNext);
|
||||
QObject::connect(actionGdbStep, &QAction::triggered, centralwidget, &SeerGdbWidget::handleGdbStep);
|
||||
QObject::connect(actionGdbFinish, &QAction::triggered, centralwidget, &SeerGdbWidget::handleGdbFinish);
|
||||
QObject::connect(actionGdbContinue, &QAction::triggered, centralwidget, &SeerGdbWidget::handleGdbContinue);
|
||||
QObject::connect(actionInterruptProcess, &QAction::triggered, centralwidget, &SeerGdbWidget::handleGdbInterrupt);
|
||||
|
||||
QObject::connect(nextKeyF5, &QShortcut::activated, centralwidget, &SeerGdbWidget::handleGdbNext);
|
||||
@@ -57,6 +58,9 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) {
|
||||
QObject::connect(centralwidget->gdbMonitor(), &GdbMonitor::astrixTextOutput, this, &SeerMainWindow::handleText);
|
||||
QObject::connect(centralwidget->gdbMonitor(), &GdbMonitor::caretTextOutput, this, &SeerMainWindow::handleText);
|
||||
|
||||
// Restore window settings.
|
||||
readSettings();
|
||||
|
||||
//
|
||||
// Initialize contents.
|
||||
//
|
||||
@@ -414,3 +418,33 @@ void SeerMainWindow::closeEvent (QCloseEvent* event) {
|
||||
QCoreApplication::exit(0);
|
||||
}
|
||||
|
||||
void SeerMainWindow::writeSettings() {
|
||||
|
||||
QSettings settings;
|
||||
|
||||
settings.beginGroup("mainwindow");
|
||||
settings.setValue("size", size());
|
||||
settings.endGroup();
|
||||
|
||||
//qDebug() << __PRETTY_FUNCTION__ << ":" << size();
|
||||
}
|
||||
|
||||
void SeerMainWindow::readSettings() {
|
||||
|
||||
QSettings settings;
|
||||
|
||||
settings.beginGroup("mainwindow");
|
||||
resize(settings.value("size", QSize(1250, 1000)).toSize());
|
||||
settings.endGroup();
|
||||
|
||||
//qDebug() << __PRETTY_FUNCTION__ << ":" << size();
|
||||
}
|
||||
|
||||
void SeerMainWindow::resizeEvent (QResizeEvent* event) {
|
||||
|
||||
// Write window settings.
|
||||
writeSettings();
|
||||
|
||||
QMainWindow::resizeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "ui_SeerMainWindow.h"
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include <QtGui/QCloseEvent>
|
||||
#include <QtGui/QResizeEvent>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
@@ -38,6 +39,9 @@ class SeerMainWindow : public QMainWindow, protected Ui::SeerMainWindowForm {
|
||||
void handleText (const QString& text);
|
||||
|
||||
protected:
|
||||
void writeSettings ();
|
||||
void readSettings ();
|
||||
void resizeEvent (QResizeEvent* event);
|
||||
void closeEvent (QCloseEvent* event);
|
||||
|
||||
private:
|
||||
|
||||
@@ -76,11 +76,10 @@
|
||||
</attribute>
|
||||
<addaction name="actionGdbRun"/>
|
||||
<addaction name="actionGdbStart"/>
|
||||
<addaction name="actionGdbContinue"/>
|
||||
<addaction name="actionGdbNext"/>
|
||||
<addaction name="actionGdbStep"/>
|
||||
<addaction name="actionGdbFinish"/>
|
||||
<addaction name="actionGdbContinue"/>
|
||||
<addaction name="actionGdbQuit"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionInterruptProcess"/>
|
||||
</widget>
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
#include <QtGui/QIntValidator>
|
||||
#include <QtPrintSupport/QPrinter>
|
||||
#include <QtPrintSupport/QPrintDialog>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
SeerMemoryVisualizerWidget::SeerMemoryVisualizerWidget (QWidget* parent) : QWidget(parent) {
|
||||
|
||||
@@ -52,6 +53,9 @@ SeerMemoryVisualizerWidget::SeerMemoryVisualizerWidget (QWidget* parent) : QWidg
|
||||
QObject::connect(columnCountSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &SeerMemoryVisualizerWidget::handleColumnCountSpinBox);
|
||||
QObject::connect(printToolButton, &QToolButton::clicked, this, &SeerMemoryVisualizerWidget::handlePrintButton);
|
||||
QObject::connect(saveToolButton, &QToolButton::clicked, this, &SeerMemoryVisualizerWidget::handleSaveButton);
|
||||
|
||||
// Restore window settings.
|
||||
readSettings();
|
||||
}
|
||||
|
||||
SeerMemoryVisualizerWidget::~SeerMemoryVisualizerWidget () {
|
||||
@@ -124,7 +128,7 @@ void SeerMemoryVisualizerWidget::handleText (const QString& text) {
|
||||
|
||||
if (id_text.toInt() == _variableId) {
|
||||
|
||||
QStringList words = Seer::filterEscapes(Seer::parseFirst(text, "value=", '"', '"', false)).split(' ',QString::SkipEmptyParts);
|
||||
QStringList words = Seer::filterEscapes(Seer::parseFirst(text, "value=", '"', '"', false)).split(' ', QString::SkipEmptyParts);
|
||||
|
||||
setVariableAddress(words.first());
|
||||
}
|
||||
@@ -323,3 +327,32 @@ void SeerMemoryVisualizerWidget::handleSaveButton () {
|
||||
}
|
||||
}
|
||||
|
||||
void SeerMemoryVisualizerWidget::writeSettings() {
|
||||
|
||||
QSettings settings;
|
||||
|
||||
settings.beginGroup("memoryvisualizerwindow");
|
||||
settings.setValue("size", size());
|
||||
settings.endGroup();
|
||||
|
||||
//qDebug() << __PRETTY_FUNCTION__ << ":" << size();
|
||||
}
|
||||
|
||||
void SeerMemoryVisualizerWidget::readSettings() {
|
||||
|
||||
QSettings settings;
|
||||
|
||||
settings.beginGroup("memoryvisualizerwindow");
|
||||
resize(settings.value("size", QSize(800, 400)).toSize());
|
||||
settings.endGroup();
|
||||
|
||||
//qDebug() << __PRETTY_FUNCTION__ << ":" << size();
|
||||
}
|
||||
|
||||
void SeerMemoryVisualizerWidget::resizeEvent (QResizeEvent* event) {
|
||||
|
||||
writeSettings();
|
||||
|
||||
QWidget::resizeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,10 @@ class SeerMemoryVisualizerWidget : public QWidget, protected Ui::SeerMemoryVisua
|
||||
void handleSaveButton ();
|
||||
|
||||
protected:
|
||||
void writeSettings ();
|
||||
void readSettings ();
|
||||
void resizeEvent (QResizeEvent* event);
|
||||
|
||||
private:
|
||||
int _variableId;
|
||||
int _memoryId;
|
||||
|
||||
@@ -10,6 +10,8 @@ int main (int argc, char* argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QCoreApplication::setApplicationName("Seer");
|
||||
QCoreApplication::setOrganizationName("Pasvix");
|
||||
QCoreApplication::setOrganizationName("pasvix.com");
|
||||
QCoreApplication::setApplicationVersion("1.0.3 - Ernie Pasveer (c)2021");
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user