mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-03-19 11:10:54 +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)
|
||||
: 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());
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QTimer>
|
||||
#include <QSettings>
|
||||
#include <cmath>
|
||||
|
||||
#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();
|
||||
|
||||
@@ -343,7 +343,7 @@
|
||||
<addaction name="actionRescan_Refresh"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionIgnore_C4_Reallocation_Event_Count"/>
|
||||
<addaction name="actionDon"/>
|
||||
<addaction name="actionHEX"/>
|
||||
<addaction name="actionUse_Fahrenheit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuFunction">
|
||||
@@ -418,12 +418,12 @@
|
||||
<string>&Ignore C4 (Reallocated Event Count)</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDon">
|
||||
<action name="actionHEX">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Decimal Raw Values</string>
|
||||
<string>&Convert Raw values to HEX</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUse_Fahrenheit">
|
||||
|
||||
Reference in New Issue
Block a user