Added a settings dialog that allows for persistent settings to be stored. It operates but nothing else uses the settings just yet. Updated version num.
This commit is contained in:
+6
-3
@@ -31,7 +31,8 @@ SOURCES += main.cpp\
|
|||||||
dbcmaineditor.cpp \
|
dbcmaineditor.cpp \
|
||||||
dbcsignaleditor.cpp \
|
dbcsignaleditor.cpp \
|
||||||
framefileio.cpp \
|
framefileio.cpp \
|
||||||
filecomparatorwindow.cpp
|
filecomparatorwindow.cpp \
|
||||||
|
mainsettingsdialog.cpp
|
||||||
|
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
can_structs.h \
|
can_structs.h \
|
||||||
@@ -53,7 +54,8 @@ HEADERS += mainwindow.h \
|
|||||||
dbcsignaleditor.h \
|
dbcsignaleditor.h \
|
||||||
framefileio.h \
|
framefileio.h \
|
||||||
config.h \
|
config.h \
|
||||||
filecomparatorwindow.h
|
filecomparatorwindow.h \
|
||||||
|
mainsettingsdialog.h
|
||||||
|
|
||||||
FORMS += mainwindow.ui \
|
FORMS += mainwindow.ui \
|
||||||
graphingwindow.ui \
|
graphingwindow.ui \
|
||||||
@@ -65,7 +67,8 @@ FORMS += mainwindow.ui \
|
|||||||
framesenderwindow.ui \
|
framesenderwindow.ui \
|
||||||
dbcmaineditor.ui \
|
dbcmaineditor.ui \
|
||||||
dbcsignaleditor.ui \
|
dbcsignaleditor.ui \
|
||||||
filecomparatorwindow.ui
|
filecomparatorwindow.ui \
|
||||||
|
mainsettingsdialog.ui
|
||||||
|
|
||||||
DISTFILES +=
|
DISTFILES +=
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef CONFIG
|
#ifndef CONFIG
|
||||||
#define CONFIG
|
#define CONFIG
|
||||||
|
|
||||||
#define VERSION 115
|
#define VERSION 116
|
||||||
|
|
||||||
#endif // CONFIG
|
#endif // CONFIG
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
#include "mainsettingsdialog.h"
|
||||||
|
#include "ui_mainsettingsdialog.h"
|
||||||
|
|
||||||
|
MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::MainSettingsDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
settings = new QSettings();
|
||||||
|
|
||||||
|
//update the GUI with all the settings we have stored giving things
|
||||||
|
//defaults if nothing was stored (if this is the first time)
|
||||||
|
ui->cbDisplayHex->setChecked(settings->value("Main/UseHex", true).toBool());
|
||||||
|
ui->cbFlowAutoRef->setChecked(settings->value("FlowView/AutoRef", false).toBool());
|
||||||
|
ui->cbFlowUseTimestamp->setChecked(settings->value("FlowView/UseTimestamp", true).toBool());
|
||||||
|
ui->cbInfoAutoExpand->setChecked(settings->value("InfoCompare/AutoExpand", false).toBool());
|
||||||
|
ui->cbMainAutoScroll->setChecked(settings->value("Main/AutoScroll", false).toBool());
|
||||||
|
ui->cbPlaybackLoop->setChecked(settings->value("Playback/AutoLoop", false).toBool());
|
||||||
|
ui->cbRestorePositions->setChecked(settings->value("Main/SaveRestorePositions", true).toBool());
|
||||||
|
ui->cbValidate->setChecked(settings->value("Main/ValidateComm", true).toBool());
|
||||||
|
ui->spinPlaybackSpeed->setValue(settings->value("Playback/DefSpeed", 5).toInt());
|
||||||
|
|
||||||
|
//just for simplicity they all call the same function and that function updates all settings at once
|
||||||
|
connect(ui->cbDisplayHex, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||||
|
connect(ui->cbFlowAutoRef, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||||
|
connect(ui->cbFlowUseTimestamp, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||||
|
connect(ui->cbInfoAutoExpand, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||||
|
connect(ui->cbMainAutoScroll, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||||
|
connect(ui->cbPlaybackLoop, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||||
|
connect(ui->cbRestorePositions, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||||
|
connect(ui->cbValidate, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||||
|
connect(ui->spinPlaybackSpeed, SIGNAL(valueChanged(int)), this, SLOT(updateSettings()));
|
||||||
|
}
|
||||||
|
|
||||||
|
MainSettingsDialog::~MainSettingsDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
delete settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainSettingsDialog::closeEvent(QCloseEvent *event)
|
||||||
|
{
|
||||||
|
settings->sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainSettingsDialog::updateSettings()
|
||||||
|
{
|
||||||
|
settings->setValue("Main/UseHex", ui->cbDisplayHex->isChecked());
|
||||||
|
settings->setValue("FlowView/AutoRef", ui->cbFlowAutoRef->isChecked());
|
||||||
|
settings->setValue("FlowView/UseTimestamp", ui->cbFlowUseTimestamp->isChecked());
|
||||||
|
settings->setValue("InfoCompare/AutoExpand", ui->cbInfoAutoExpand->isChecked());
|
||||||
|
settings->setValue("Main/AutoScroll", ui->cbMainAutoScroll->isChecked());
|
||||||
|
settings->setValue("Playback/AutoLoop", ui->cbPlaybackLoop->isChecked());
|
||||||
|
settings->setValue("Main/SaveRestorePositions", ui->cbRestorePositions->isChecked());
|
||||||
|
settings->setValue("Main/ValidateComm", ui->cbValidate->isChecked());
|
||||||
|
settings->setValue("Playback/DefSpeed", ui->spinPlaybackSpeed->value());
|
||||||
|
|
||||||
|
settings->sync();
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#ifndef MAINSETTINGSDIALOG_H
|
||||||
|
#define MAINSETTINGSDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class MainSettingsDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MainSettingsDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MainSettingsDialog(QWidget *parent = 0);
|
||||||
|
~MainSettingsDialog();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateSettings();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::MainSettingsDialog *ui;
|
||||||
|
QSettings *settings;
|
||||||
|
|
||||||
|
void closeEvent(QCloseEvent *event);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAINSETTINGSDIALOG_H
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainSettingsDialog</class>
|
||||||
|
<widget class="QDialog" name="MainSettingsDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>580</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Main Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>General Settings:</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbRestorePositions">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save/Restore window positions and sizes</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbDisplayHex">
|
||||||
|
<property name="text">
|
||||||
|
<string>Display values as hexadecimal</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbValidate">
|
||||||
|
<property name="text">
|
||||||
|
<string>Validate GVRET connection</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Main Form Settings:</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbMainAutoScroll">
|
||||||
|
<property name="text">
|
||||||
|
<string>Autoscroll main frame window by default</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
|
<property name="title">
|
||||||
|
<string>Flowview Settings:</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbFlowUseTimestamp">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use timestamp mode by default</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbFlowAutoRef">
|
||||||
|
<property name="text">
|
||||||
|
<string>Set Auto Reference by default</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_4">
|
||||||
|
<property name="title">
|
||||||
|
<string>Playback Window Settings:</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbPlaybackLoop">
|
||||||
|
<property name="text">
|
||||||
|
<string>Loop by default</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Default playback speed (ms)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinPlaybackSpeed">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
|
<property name="title">
|
||||||
|
<string>File Info and Comparator Settings:</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbInfoAutoExpand">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto expand all nodes</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -38,6 +38,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
//These things are used by QSettings to set up setting storage
|
||||||
|
QCoreApplication::setOrganizationName("EVTV");
|
||||||
|
QCoreApplication::setOrganizationDomain("evtv.me");
|
||||||
|
QCoreApplication::setApplicationName("SavvyCAN");
|
||||||
|
|
||||||
selfRef = this;
|
selfRef = this;
|
||||||
|
|
||||||
this->setWindowTitle("Savvy CAN V" + QString::number(VERSION));
|
this->setWindowTitle("Savvy CAN V" + QString::number(VERSION));
|
||||||
@@ -102,6 +107,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
frameSenderWindow = NULL;
|
frameSenderWindow = NULL;
|
||||||
dbcMainEditor = NULL;
|
dbcMainEditor = NULL;
|
||||||
comparatorWindow = NULL;
|
comparatorWindow = NULL;
|
||||||
|
settingsDialog = NULL;
|
||||||
dbcHandler = new DBCHandler;
|
dbcHandler = new DBCHandler;
|
||||||
bDirty = false;
|
bDirty = false;
|
||||||
|
|
||||||
@@ -131,6 +137,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
connect(ui->actionSingle_Multi_State, SIGNAL(triggered(bool)), this, SLOT(showSingleMultiWindow()));
|
connect(ui->actionSingle_Multi_State, SIGNAL(triggered(bool)), this, SLOT(showSingleMultiWindow()));
|
||||||
connect(ui->actionFile_Comparison, SIGNAL(triggered(bool)), this, SLOT(showComparisonWindow()));
|
connect(ui->actionFile_Comparison, SIGNAL(triggered(bool)), this, SLOT(showComparisonWindow()));
|
||||||
connect(ui->btnNormalize, SIGNAL(clicked(bool)), this, SLOT(normalizeTiming()));
|
connect(ui->btnNormalize, SIGNAL(clicked(bool)), this, SLOT(normalizeTiming()));
|
||||||
|
connect(ui->actionPreferences, SIGNAL(triggered(bool)), this, SLOT(showSettingsDialog()));
|
||||||
|
|
||||||
lbStatusConnected.setText(tr("Not connected"));
|
lbStatusConnected.setText(tr("Not connected"));
|
||||||
updateFileStatus();
|
updateFileStatus();
|
||||||
@@ -159,6 +166,7 @@ MainWindow::~MainWindow()
|
|||||||
{
|
{
|
||||||
serialWorkerThread.quit();
|
serialWorkerThread.quit();
|
||||||
serialWorkerThread.wait();
|
serialWorkerThread.wait();
|
||||||
|
//delete worker;
|
||||||
|
|
||||||
if (graphingWindow)
|
if (graphingWindow)
|
||||||
{
|
{
|
||||||
@@ -202,6 +210,12 @@ MainWindow::~MainWindow()
|
|||||||
delete dbcMainEditor;
|
delete dbcMainEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settingsDialog)
|
||||||
|
{
|
||||||
|
settingsDialog->close();
|
||||||
|
delete settingsDialog;
|
||||||
|
}
|
||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
delete dbcHandler;
|
delete dbcHandler;
|
||||||
model->clearFrames();
|
model->clearFrames();
|
||||||
@@ -587,6 +601,12 @@ void MainWindow::gotDeviceInfo(int build, int swCAN)
|
|||||||
lbStatusConnected.setText(str);
|
lbStatusConnected.setText(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::showSettingsDialog()
|
||||||
|
{
|
||||||
|
if (!settingsDialog) settingsDialog = new MainSettingsDialog();
|
||||||
|
settingsDialog->show();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::showGraphingWindow()
|
void MainWindow::showGraphingWindow()
|
||||||
{
|
{
|
||||||
if (!graphingWindow) graphingWindow = new GraphingWindow(model->getListReference());
|
if (!graphingWindow) graphingWindow = new GraphingWindow(model->getListReference());
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "filecomparatorwindow.h"
|
#include "filecomparatorwindow.h"
|
||||||
#include "dbchandler.h"
|
#include "dbchandler.h"
|
||||||
#include "dbcmaineditor.h"
|
#include "dbcmaineditor.h"
|
||||||
|
#include "mainsettingsdialog.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
@@ -47,6 +48,7 @@ private slots:
|
|||||||
void showRangeWindow();
|
void showRangeWindow();
|
||||||
void showFuzzyScopeWindow();
|
void showFuzzyScopeWindow();
|
||||||
void showComparisonWindow();
|
void showComparisonWindow();
|
||||||
|
void showSettingsDialog();
|
||||||
void exitApp();
|
void exitApp();
|
||||||
void handleSaveDecoded();
|
void handleSaveDecoded();
|
||||||
void changeBaudRates();
|
void changeBaudRates();
|
||||||
@@ -97,6 +99,7 @@ private:
|
|||||||
FrameSenderWindow *frameSenderWindow;
|
FrameSenderWindow *frameSenderWindow;
|
||||||
DBCMainEditor *dbcMainEditor;
|
DBCMainEditor *dbcMainEditor;
|
||||||
FileComparatorWindow *comparatorWindow;
|
FileComparatorWindow *comparatorWindow;
|
||||||
|
MainSettingsDialog *settingsDialog;
|
||||||
|
|
||||||
//various private storage
|
//various private storage
|
||||||
QLabel lbStatusConnected;
|
QLabel lbStatusConnected;
|
||||||
|
|||||||
+7
-8
@@ -280,20 +280,14 @@
|
|||||||
<addaction name="actionSave_DBC_File"/>
|
<addaction name="actionSave_DBC_File"/>
|
||||||
<addaction name="actionSave_Decoded_Frames"/>
|
<addaction name="actionSave_Decoded_Frames"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionPreferences"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="actionExit_Application"/>
|
<addaction name="actionExit_Application"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menu_RE_Tools"/>
|
<addaction name="menu_RE_Tools"/>
|
||||||
<addaction name="menuSend_Frames"/>
|
<addaction name="menuSend_Frames"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="mainToolBar">
|
|
||||||
<attribute name="toolBarArea">
|
|
||||||
<enum>TopToolBarArea</enum>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="toolBarBreak">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
<action name="action_Playback">
|
<action name="action_Playback">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -375,6 +369,11 @@
|
|||||||
<string>File Comparison</string>
|
<string>File Comparison</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionPreferences">
|
||||||
|
<property name="text">
|
||||||
|
<string>Preferences</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|||||||
Reference in New Issue
Block a user