mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-04-13 08:01:29 +03:00
Add default values to checkboxes and save the changes to disk
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
|
, settings("KDiskInfo", "KDiskInfo")
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
@@ -44,6 +45,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
badColor = QColor(Qt::red);
|
badColor = QColor(Qt::red);
|
||||||
naColor = QColor(Qt::gray);
|
naColor = QColor(Qt::gray);
|
||||||
|
|
||||||
|
ui->actionIgnore_C4_Reallocation_Event_Count->setChecked(settings.value("actionIgnore_C4_Reallocation_Event_Count", true).toBool());
|
||||||
|
ui->actionHEX->setChecked(settings.value("actionHEX", true).toBool());
|
||||||
|
ui->actionUse_Fahrenheit->setChecked(settings.value("actionUse_Fahrenheit", false).toBool());
|
||||||
|
|
||||||
QAction *toggleEchoModeAction = serialNumberLineEdit->addAction(QIcon::fromTheme(QStringLiteral("visibility")), QLineEdit::TrailingPosition);
|
QAction *toggleEchoModeAction = serialNumberLineEdit->addAction(QIcon::fromTheme(QStringLiteral("visibility")), QLineEdit::TrailingPosition);
|
||||||
connect(toggleEchoModeAction, &QAction::triggered, this, [=]() {
|
connect(toggleEchoModeAction, &QAction::triggered, this, [=]() {
|
||||||
if (serialNumberLineEdit->echoMode() == QLineEdit::Password) {
|
if (serialNumberLineEdit->echoMode() == QLineEdit::Password) {
|
||||||
@@ -778,3 +783,20 @@ void MainWindow::on_actionAbout_triggered()
|
|||||||
QMessageBox::about(this, "About KDiskInfo", message);
|
QMessageBox::about(this, "About KDiskInfo", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionIgnore_C4_Reallocation_Event_Count_toggled(bool enabled)
|
||||||
|
{
|
||||||
|
settings.setValue("actionIgnore_C4_Reallocation_Event_Count", ui->actionIgnore_C4_Reallocation_Event_Count->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::on_actionHEX_toggled(bool enabled)
|
||||||
|
{
|
||||||
|
settings.setValue("actionHEX", ui->actionHEX->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::on_actionUse_Fahrenheit_toggled(bool enabled)
|
||||||
|
{
|
||||||
|
settings.setValue("actionUse_Fahrenheit", ui->actionUse_Fahrenheit->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QSettings>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "statusdot.h"
|
#include "statusdot.h"
|
||||||
@@ -46,6 +47,12 @@ private slots:
|
|||||||
|
|
||||||
void on_actionAbout_triggered();
|
void on_actionAbout_triggered();
|
||||||
|
|
||||||
|
void on_actionIgnore_C4_Reallocation_Event_Count_toggled(bool enabled);
|
||||||
|
|
||||||
|
void on_actionHEX_toggled(bool enabled);
|
||||||
|
|
||||||
|
void on_actionUse_Fahrenheit_toggled(bool enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QButtonGroup *buttonGroup;
|
QButtonGroup *buttonGroup;
|
||||||
@@ -56,9 +63,9 @@ private:
|
|||||||
QTableWidget *tableWidget;
|
QTableWidget *tableWidget;
|
||||||
QPushButton *prevButton, *nextButton;
|
QPushButton *prevButton, *nextButton;
|
||||||
QColor goodColor, cautionColor, badColor, naColor;
|
QColor goodColor, cautionColor, badColor, naColor;
|
||||||
|
|
||||||
QJsonObject deviceJson;
|
QJsonObject deviceJson;
|
||||||
QSpacerItem *buttonStretch;
|
QSpacerItem *buttonStretch;
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
void onNextButtonClicked();
|
void onNextButtonClicked();
|
||||||
void onPrevButtonClicked();
|
void onPrevButtonClicked();
|
||||||
|
|||||||
@@ -343,7 +343,7 @@
|
|||||||
<addaction name="actionRescan_Refresh"/>
|
<addaction name="actionRescan_Refresh"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionIgnore_C4_Reallocation_Event_Count"/>
|
<addaction name="actionIgnore_C4_Reallocation_Event_Count"/>
|
||||||
<addaction name="actionDon"/>
|
<addaction name="actionHEX"/>
|
||||||
<addaction name="actionUse_Fahrenheit"/>
|
<addaction name="actionUse_Fahrenheit"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuFunction">
|
<widget class="QMenu" name="menuFunction">
|
||||||
@@ -418,12 +418,12 @@
|
|||||||
<string>&Ignore C4 (Reallocated Event Count)</string>
|
<string>&Ignore C4 (Reallocated Event Count)</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionDon">
|
<action name="actionHEX">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Decimal Raw Values</string>
|
<string>&Convert Raw values to HEX</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionUse_Fahrenheit">
|
<action name="actionUse_Fahrenheit">
|
||||||
|
|||||||
Reference in New Issue
Block a user