From 2a2af59d247b51695318735bf126fc577e5e275a Mon Sep 17 00:00:00 2001 From: spiros Date: Thu, 29 May 2025 02:49:34 +0300 Subject: [PATCH] Fix cyclic navigation enabling the next button even if there's only one drive --- src/mainwindow.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d8142de..1fa23d7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -170,8 +170,16 @@ void MainWindow::onPrevButtonClicked() void MainWindow::updateNavigationButtons(qsizetype currentIndex) { - prevButton->setEnabled(currentIndex > 0 || (ui->actionCyclic_Navigation->isChecked() && buttonGroup->buttons().size() > 1)); // We can use setVisible if we want to mimic CrystalDiskInfo - nextButton->setEnabled(currentIndex < buttonGroup->buttons().size() - 1 || ui->actionCyclic_Navigation->isChecked()); + const qsizetype totalButtons = buttonGroup->buttons().size(); + const bool isCyclic = ui->actionCyclic_Navigation->isChecked(); + + prevButton->setEnabled( // We can use setVisible if we want to mimic CrystalDiskInfo + (currentIndex > 0) || (isCyclic && totalButtons > 1) + ); + + nextButton->setEnabled( + (currentIndex < totalButtons - 1) || (isCyclic && totalButtons > 1) + ); } void MainWindow::updateUI()