diff --git a/mainwindow.cpp b/mainwindow.cpp index c9643cf..54ca27c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -3,6 +3,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) + , settings("KDiskInfo", "KDiskInfo") { ui->setupUi(this); @@ -44,6 +45,10 @@ MainWindow::MainWindow(QWidget *parent) badColor = QColor(Qt::red); 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); connect(toggleEchoModeAction, &QAction::triggered, this, [=]() { if (serialNumberLineEdit->echoMode() == QLineEdit::Password) { @@ -778,3 +783,20 @@ void MainWindow::on_actionAbout_triggered() 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()); +} + diff --git a/mainwindow.h b/mainwindow.h index 2d17bc7..d33cdad 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include "statusdot.h" @@ -46,6 +47,12 @@ private slots: 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: Ui::MainWindow *ui; QButtonGroup *buttonGroup; @@ -56,9 +63,9 @@ private: QTableWidget *tableWidget; QPushButton *prevButton, *nextButton; QColor goodColor, cautionColor, badColor, naColor; - QJsonObject deviceJson; QSpacerItem *buttonStretch; + QSettings settings; void onNextButtonClicked(); void onPrevButtonClicked(); diff --git a/mainwindow.ui b/mainwindow.ui index 7c67a87..b57dd29 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -343,7 +343,7 @@ - + @@ -418,12 +418,12 @@ &Ignore C4 (Reallocated Event Count) - + true - &Decimal Raw Values + &Convert Raw values to HEX