Implemented window size and position tracking for the forms that are currently implemented and working
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
DBCMainEditor::DBCMainEditor(DBCHandler *handler, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@@ -10,6 +11,8 @@ DBCMainEditor::DBCMainEditor(DBCHandler *handler, QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
readSettings();
|
||||
|
||||
dbcHandler = handler;
|
||||
|
||||
QStringList headers;
|
||||
@@ -63,6 +66,32 @@ DBCMainEditor::~DBCMainEditor()
|
||||
delete sigEditor;
|
||||
}
|
||||
|
||||
void DBCMainEditor::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void DBCMainEditor::readSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
resize(settings.value("DBCMainEditor/WindowSize", QSize(1103, 571)).toSize());
|
||||
move(settings.value("DBCMainEditor/WindowPos", QPoint(50, 50)).toPoint());
|
||||
}
|
||||
}
|
||||
|
||||
void DBCMainEditor::writeSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
settings.setValue("DBCMainEditor/WindowSize", size());
|
||||
settings.setValue("DBCMainEditor/WindowPos", pos());
|
||||
}
|
||||
}
|
||||
|
||||
void DBCMainEditor::onCustomMenuNode(QPoint point)
|
||||
{
|
||||
QMenu *menu = new QMenu(this);
|
||||
|
||||
@@ -38,6 +38,10 @@ private:
|
||||
void refreshNodesTable();
|
||||
void refreshMessagesTable(const DBC_NODE *node);
|
||||
void showEvent(QShowEvent* event);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
};
|
||||
|
||||
#endif // DBCMAINEDITOR_H
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
#include "dbcsignaleditor.h"
|
||||
#include "ui_dbcsignaleditor.h"
|
||||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
|
||||
DBCSignalEditor::DBCSignalEditor(DBCHandler *handler, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DBCSignalEditor)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
readSettings();
|
||||
|
||||
dbcHandler = handler;
|
||||
dbcMessage = NULL;
|
||||
|
||||
@@ -37,6 +41,33 @@ DBCSignalEditor::~DBCSignalEditor()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DBCSignalEditor::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void DBCSignalEditor::readSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
resize(settings.value("DBCSignalEditor/WindowSize", QSize(800, 572)).toSize());
|
||||
move(settings.value("DBCSignalEditor/WindowPos", QPoint(100, 100)).toPoint());
|
||||
}
|
||||
}
|
||||
|
||||
void DBCSignalEditor::writeSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
settings.setValue("DBCSignalEditor/WindowSize", size());
|
||||
settings.setValue("DBCSignalEditor/WindowPos", pos());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DBCSignalEditor::setMessageRef(DBC_MESSAGE *msg)
|
||||
{
|
||||
dbcMessage = msg;
|
||||
|
||||
@@ -30,6 +30,10 @@ private:
|
||||
void refreshSignalsList();
|
||||
void fillSignalForm(DBC_SIGNAL *sig);
|
||||
void fillValueTable(DBC_SIGNAL *sig);
|
||||
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
};
|
||||
|
||||
#endif // DBCSIGNALEDITOR_H
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
#include "filecomparatorwindow.h"
|
||||
#include "ui_filecomparatorwindow.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
FileComparatorWindow::FileComparatorWindow(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::FileComparatorWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
readSettings();
|
||||
|
||||
connect(ui->btnFirstFile, SIGNAL(clicked(bool)), this, SLOT(loadFirstFile()));
|
||||
connect(ui->btnSecondFile, SIGNAL(clicked(bool)), this, SLOT(loadSecondFile()));
|
||||
connect(ui->btnSaveDetails, SIGNAL(clicked(bool)), this, SLOT(saveDetails()));
|
||||
@@ -20,6 +24,32 @@ FileComparatorWindow::~FileComparatorWindow()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FileComparatorWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void FileComparatorWindow::readSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
resize(settings.value("FileComparator/WindowSize", QSize(720, 631)).toSize());
|
||||
move(settings.value("FileComparator/WindowPos", QPoint(50, 50)).toPoint());
|
||||
}
|
||||
}
|
||||
|
||||
void FileComparatorWindow::writeSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
settings.setValue("FileComparator/WindowSize", size());
|
||||
settings.setValue("FileComparator/WindowPos", pos());
|
||||
}
|
||||
}
|
||||
|
||||
void FileComparatorWindow::loadFirstFile()
|
||||
{
|
||||
firstFileFrames.clear();
|
||||
|
||||
@@ -41,6 +41,9 @@ private:
|
||||
QString secondFilename;
|
||||
|
||||
void calculateDetails();
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
};
|
||||
|
||||
#endif // FILECOMPARATORWINDOW_H
|
||||
|
||||
@@ -12,6 +12,8 @@ FlowViewWindow::FlowViewWindow(const QVector<CANFrame> *frames, QWidget *parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
readSettings();
|
||||
|
||||
modelFrames = frames;
|
||||
|
||||
playbackTimer = new QTimer();
|
||||
@@ -99,6 +101,32 @@ FlowViewWindow::~FlowViewWindow()
|
||||
delete playbackTimer;
|
||||
}
|
||||
|
||||
void FlowViewWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void FlowViewWindow::readSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
resize(settings.value("FlowView/WindowSize", QSize(1078, 621)).toSize());
|
||||
move(settings.value("FlowView/WindowPos", QPoint(50, 50)).toPoint());
|
||||
}
|
||||
}
|
||||
|
||||
void FlowViewWindow::writeSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
settings.setValue("FlowView/WindowSize", size());
|
||||
settings.setValue("FlowView/WindowPos", pos());
|
||||
}
|
||||
}
|
||||
|
||||
void FlowViewWindow::contextMenuRequestFlow(QPoint pos)
|
||||
{
|
||||
QMenu *menu = new QMenu(this);
|
||||
|
||||
@@ -54,6 +54,9 @@ private:
|
||||
void removeAllGraphs();
|
||||
void createGraph(int);
|
||||
void updateGraphLocation();
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
};
|
||||
|
||||
#endif // FLOWVIEWWINDOW_H
|
||||
|
||||
@@ -8,6 +8,9 @@ FrameInfoWindow::FrameInfoWindow(const QVector<CANFrame> *frames, QWidget *paren
|
||||
ui(new Ui::FrameInfoWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
readSettings();
|
||||
|
||||
modelFrames = frames;
|
||||
|
||||
connect(ui->listFrameID, SIGNAL(currentTextChanged(QString)), this, SLOT(updateDetailsWindow(QString)));
|
||||
@@ -30,6 +33,32 @@ FrameInfoWindow::~FrameInfoWindow()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FrameInfoWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void FrameInfoWindow::readSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
resize(settings.value("FrameInfo/WindowSize", QSize(794, 494)).toSize());
|
||||
move(settings.value("FrameInfo/WindowPos", QPoint(50, 50)).toPoint());
|
||||
}
|
||||
}
|
||||
|
||||
void FrameInfoWindow::writeSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
settings.setValue("FrameInfo/WindowSize", size());
|
||||
settings.setValue("FrameInfo/WindowPos", pos());
|
||||
}
|
||||
}
|
||||
|
||||
//remember, negative numbers are special -1 = all frames deleted, -2 = totally new set of frames.
|
||||
void FrameInfoWindow::updatedFrames(int numFrames)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,9 @@ private:
|
||||
const QVector<CANFrame> *modelFrames;
|
||||
|
||||
void refreshIDList();
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
};
|
||||
|
||||
#endif // FRAMEINFOWINDOW_H
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "ui_frameplaybackwindow.h"
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QSettings>
|
||||
|
||||
/*
|
||||
* Notes about new functionality:
|
||||
@@ -22,6 +23,8 @@ FramePlaybackWindow::FramePlaybackWindow(const QVector<CANFrame> *frames, Serial
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
readSettings();
|
||||
|
||||
modelFrames = frames;
|
||||
serialWorker = worker;
|
||||
|
||||
@@ -81,6 +84,32 @@ FramePlaybackWindow::~FramePlaybackWindow()
|
||||
delete playbackTimer;
|
||||
}
|
||||
|
||||
void FramePlaybackWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void FramePlaybackWindow::readSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
resize(settings.value("Playback/WindowSize", QSize(742, 606)).toSize());
|
||||
move(settings.value("Playback/WindowPos", QPoint(50, 50)).toPoint());
|
||||
}
|
||||
}
|
||||
|
||||
void FramePlaybackWindow::writeSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
settings.setValue("Playback/WindowSize", size());
|
||||
settings.setValue("Playback/WindowPos", pos());
|
||||
}
|
||||
}
|
||||
|
||||
void FramePlaybackWindow::refreshIDList()
|
||||
{
|
||||
int id;
|
||||
|
||||
@@ -72,6 +72,9 @@ private:
|
||||
void updateFrameLabel();
|
||||
void updatePosition(bool forward);
|
||||
void fillIDHash(SequenceItem &item);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
};
|
||||
|
||||
#endif // FRAMEPLAYBACKWINDOW_H
|
||||
|
||||
@@ -10,6 +10,8 @@ GraphingWindow::GraphingWindow(const QVector<CANFrame> *frames, QWidget *parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
readSettings();
|
||||
|
||||
modelFrames = frames;
|
||||
|
||||
ui->graphingView->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes |
|
||||
@@ -73,6 +75,32 @@ void GraphingWindow::showEvent(QShowEvent* event)
|
||||
ui->graphingView->replot();
|
||||
}
|
||||
|
||||
void GraphingWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
void GraphingWindow::readSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
resize(settings.value("Graphing/WindowSize", QSize(800, 600)).toSize());
|
||||
move(settings.value("Graphing/WindowPos", QPoint(50, 50)).toPoint());
|
||||
}
|
||||
}
|
||||
|
||||
void GraphingWindow::writeSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
settings.setValue("Graphing/WindowSize", size());
|
||||
settings.setValue("Graphing/WindowPos", pos());
|
||||
}
|
||||
}
|
||||
|
||||
void GraphingWindow::updatedFrames(int numFrames)
|
||||
{
|
||||
if (numFrames == -1) //all frames deleted. Kill the display
|
||||
|
||||
@@ -59,6 +59,9 @@ private:
|
||||
bool needScaleSetup; //do we need to set x,y graphing extents?s
|
||||
|
||||
void showParamsDialog(int idx);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
};
|
||||
|
||||
#endif // GRAPHINGWINDOW_H
|
||||
|
||||
@@ -43,6 +43,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
QCoreApplication::setOrganizationDomain("evtv.me");
|
||||
QCoreApplication::setApplicationName("SavvyCAN");
|
||||
|
||||
readSettings();
|
||||
|
||||
selfRef = this;
|
||||
|
||||
this->setWindowTitle("Savvy CAN V" + QString::number(VERSION));
|
||||
@@ -224,9 +226,31 @@ MainWindow::~MainWindow()
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
writeSettings();
|
||||
exitApp();
|
||||
}
|
||||
|
||||
void MainWindow::readSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
resize(settings.value("Main/WindowSize", QSize(800, 572)).toSize());
|
||||
move(settings.value("Main/WindowPos", QPoint(100, 100)).toPoint());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::writeSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
if (settings.value("Main/SaveRestorePositions", false).toBool())
|
||||
{
|
||||
settings.setValue("Main/WindowSize", size());
|
||||
settings.setValue("Main/WindowPos", pos());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::gridClicked(QModelIndex idx)
|
||||
{
|
||||
if (ui->canFramesView->rowHeight(idx.row()) > normalRowHeight)
|
||||
|
||||
@@ -113,6 +113,8 @@ private:
|
||||
void addFrameToDisplay(CANFrame &, bool);
|
||||
void updateFileStatus();
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
Reference in New Issue
Block a user