mirror of
https://github.com/edisionnano/QDiskInfo.git
synced 2026-04-21 23:33:18 +03:00
Add cyclic navigation option
This commit is contained in:
@@ -62,9 +62,12 @@ 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());
|
actionCyclic_Navigation = ui->actionCyclic_Navigation;
|
||||||
ui->actionHEX->setChecked(settings.value("actionHEX", true).toBool());
|
|
||||||
ui->actionUse_Fahrenheit->setChecked(settings.value("actionUse_Fahrenheit", false).toBool());
|
ui->actionIgnore_C4_Reallocation_Event_Count->setChecked(settings.value("IgnoreC4", true).toBool());
|
||||||
|
ui->actionHEX->setChecked(settings.value("HEX", true).toBool());
|
||||||
|
ui->actionUse_Fahrenheit->setChecked(settings.value("Fahrenheit", false).toBool());
|
||||||
|
actionCyclic_Navigation->setChecked(settings.value("CyclicNavigation", 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, [=]() {
|
||||||
@@ -103,10 +106,10 @@ void MainWindow::onPrevButtonClicked()
|
|||||||
updateNavigationButtons(prevIndex);
|
updateNavigationButtons(prevIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateNavigationButtons(int currentIndex) // WIP: Add option to roll back instead of disabling them
|
void MainWindow::updateNavigationButtons(int currentIndex)
|
||||||
{
|
{
|
||||||
prevButton->setEnabled(currentIndex > 0); // We can use setVisible if we want to mimic CrystalDiskInfo
|
prevButton->setEnabled(currentIndex > 0||actionCyclic_Navigation->isChecked()); // We can use setVisible if we want to mimic CrystalDiskInfo
|
||||||
nextButton->setEnabled(currentIndex < buttonGroup->buttons().size() - 1);
|
nextButton->setEnabled(currentIndex < buttonGroup->buttons().size() - 1||actionCyclic_Navigation->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getSmartctlPath() {
|
QString getSmartctlPath() {
|
||||||
@@ -966,7 +969,7 @@ void MainWindow::on_actionAbout_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionIgnore_C4_Reallocation_Event_Count_toggled(bool enabled)
|
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());
|
settings.setValue("IgnoreC4", ui->actionIgnore_C4_Reallocation_Event_Count->isChecked());
|
||||||
if (!initializing) {
|
if (!initializing) {
|
||||||
clearButtonGroup();
|
clearButtonGroup();
|
||||||
updateUI();
|
updateUI();
|
||||||
@@ -976,7 +979,7 @@ void MainWindow::on_actionIgnore_C4_Reallocation_Event_Count_toggled(bool enable
|
|||||||
|
|
||||||
void MainWindow::on_actionHEX_toggled(bool enabled)
|
void MainWindow::on_actionHEX_toggled(bool enabled)
|
||||||
{
|
{
|
||||||
settings.setValue("actionHEX", ui->actionHEX->isChecked());
|
settings.setValue("HEX", ui->actionHEX->isChecked());
|
||||||
if (!initializing) {
|
if (!initializing) {
|
||||||
clearButtonGroup();
|
clearButtonGroup();
|
||||||
updateUI();
|
updateUI();
|
||||||
@@ -986,13 +989,20 @@ void MainWindow::on_actionHEX_toggled(bool enabled)
|
|||||||
|
|
||||||
void MainWindow::on_actionUse_Fahrenheit_toggled(bool enabled)
|
void MainWindow::on_actionUse_Fahrenheit_toggled(bool enabled)
|
||||||
{
|
{
|
||||||
settings.setValue("actionUse_Fahrenheit", ui->actionUse_Fahrenheit->isChecked());
|
settings.setValue("Fahrenheit", ui->actionUse_Fahrenheit->isChecked());
|
||||||
if (!initializing) {
|
if (!initializing) {
|
||||||
clearButtonGroup();
|
clearButtonGroup();
|
||||||
updateUI();
|
updateUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionCyclic_Navigation_toggled(bool cyclicNavigation)
|
||||||
|
{
|
||||||
|
settings.setValue("CyclicNavigation", ui->actionCyclic_Navigation->isChecked());
|
||||||
|
int currentIndex = buttonGroup->buttons().indexOf(buttonGroup->checkedButton());
|
||||||
|
updateNavigationButtons(currentIndex);
|
||||||
|
}
|
||||||
|
|
||||||
QString MainWindow::initiateSelfTest(const QString &testType, const QString &deviceNode)
|
QString MainWindow::initiateSelfTest(const QString &testType, const QString &deviceNode)
|
||||||
{
|
{
|
||||||
QProcess process;
|
QProcess process;
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ private slots:
|
|||||||
|
|
||||||
void on_actionUse_Fahrenheit_toggled(bool enabled);
|
void on_actionUse_Fahrenheit_toggled(bool enabled);
|
||||||
|
|
||||||
|
void on_actionCyclic_Navigation_toggled(bool arg1);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QButtonGroup *buttonGroup;
|
QButtonGroup *buttonGroup;
|
||||||
@@ -69,6 +71,7 @@ private:
|
|||||||
QJsonObject deviceJson;
|
QJsonObject deviceJson;
|
||||||
QSpacerItem *buttonStretch;
|
QSpacerItem *buttonStretch;
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
QAction *actionCyclic_Navigation;
|
||||||
|
|
||||||
QMenu *menuDevice;
|
QMenu *menuDevice;
|
||||||
QMenu *menuDisk;
|
QMenu *menuDisk;
|
||||||
|
|||||||
@@ -344,6 +344,7 @@
|
|||||||
<addaction name="actionIgnore_C4_Reallocation_Event_Count"/>
|
<addaction name="actionIgnore_C4_Reallocation_Event_Count"/>
|
||||||
<addaction name="actionHEX"/>
|
<addaction name="actionHEX"/>
|
||||||
<addaction name="actionUse_Fahrenheit"/>
|
<addaction name="actionUse_Fahrenheit"/>
|
||||||
|
<addaction name="actionCyclic_Navigation"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuHelp">
|
<widget class="QMenu" name="menuHelp">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@@ -446,6 +447,14 @@
|
|||||||
<string>Self Test</string>
|
<string>Self Test</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionCyclic_Navigation">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Cyclic Navigation</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="resources.qrc"/>
|
<include location="resources.qrc"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user