diff --git a/src/btle/btle_hub.cpp b/src/btle/btle_hub.cpp index 557a2867..e436ca4b 100644 --- a/src/btle/btle_hub.cpp +++ b/src/btle/btle_hub.cpp @@ -88,11 +88,12 @@ void BtleHub::connectToDevice(const QBluetoothDeviceInfo &device) } // Clean up any previously-created service objects - delete m_hrService; m_hrService = nullptr; - delete m_cscService; m_cscService = nullptr; - delete m_powerService; m_powerService = nullptr; - delete m_ftmsService; m_ftmsService = nullptr; - delete m_moxyService; m_moxyService = nullptr; + delete m_hrService; m_hrService = nullptr; + delete m_cscService; m_cscService = nullptr; + delete m_powerService; m_powerService = nullptr; + delete m_ftmsService; m_ftmsService = nullptr; + delete m_moxyService; m_moxyService = nullptr; + delete m_batteryService; m_batteryService = nullptr; m_firstCscMeasurement = true; m_ftmsControlRequested = false; diff --git a/src/model/account.cpp b/src/model/account.cpp index 3dcb43ed..43e2c90d 100644 --- a/src/model/account.cpp +++ b/src/model/account.cpp @@ -53,8 +53,8 @@ Account::Account(QObject *parent) : QObject(parent) { intervals_icu_refresh_token = settings.value("intervals_icu_refresh_token", "").toString(); // Sensor dropout auto-pause sensor_dropout_enabled = settings.value("sensor_dropout_enabled", true).toBool(); - sensor_dropout_timeout_s = settings.value("sensor_dropout_timeout_s", 5 ).toInt(); - battery_warning_threshold = settings.value("battery_warning_threshold", 20).toInt(); + sensor_dropout_timeout_s = qBound(2, settings.value("sensor_dropout_timeout_s", 5).toInt(), 30); + battery_warning_threshold = qBound(5, settings.value("battery_warning_threshold", 20).toInt(), 50); settings.endGroup(); // Load encrypted third-party service credentials from the platform credential store. @@ -165,8 +165,8 @@ Account::Account(QObject *parent) : QObject(parent) { QSettings s; s.beginGroup("account"); interval_summary_enabled = s.value("interval_summary_enabled", true).toBool(); - interval_summary_duration_s = s.value("interval_summary_duration_s", 5).toInt(); - app_theme = s.value("app_theme", 2).toInt(); // default: System + interval_summary_duration_s = qBound(2, s.value("interval_summary_duration_s", 5).toInt(), 15); + app_theme = qBound(0, s.value("app_theme", 2).toInt(), 2); // default: System s.endGroup(); } @@ -258,7 +258,7 @@ void Account::saveSensorDropoutSettings() QSettings settings; settings.beginGroup("account"); settings.setValue("sensor_dropout_enabled", sensor_dropout_enabled); - settings.setValue("sensor_dropout_timeout_s", sensor_dropout_timeout_s); + settings.setValue("sensor_dropout_timeout_s", qBound(2, sensor_dropout_timeout_s, 30)); settings.endGroup(); } @@ -266,7 +266,7 @@ void Account::saveBatteryWarningThreshold() { QSettings settings; settings.beginGroup("account"); - settings.setValue("battery_warning_threshold", battery_warning_threshold); + settings.setValue("battery_warning_threshold", qBound(5, battery_warning_threshold, 50)); settings.endGroup(); } @@ -275,7 +275,7 @@ void Account::saveIntervalSummarySettings() QSettings settings; settings.beginGroup("account"); settings.setValue("interval_summary_enabled", interval_summary_enabled); - settings.setValue("interval_summary_duration_s", interval_summary_duration_s); + settings.setValue("interval_summary_duration_s", qBound(2, interval_summary_duration_s, 15)); settings.endGroup(); } @@ -283,7 +283,7 @@ void Account::saveAppTheme() { QSettings s; s.beginGroup("account"); - s.setValue("app_theme", app_theme); + s.setValue("app_theme", qBound(0, app_theme, 2)); s.endGroup(); } diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 8b44e5f2..c5cb7415 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -719,8 +719,13 @@ void MainWindow::tryAdvanceWorkoutQueue() const QString nextName = m_workoutQueue->name(0); const QString nextPath = m_workoutQueue->filePath(0); WorkoutCountdownDialog countdown(nextName, 60, this); - if (countdown.exec() != QDialog::Accepted) + if (countdown.exec() != QDialog::Accepted) { + // User chose "Cancel Queue" — clear the remaining queue so it doesn't + // auto-advance after subsequent workouts. + if (countdown.dialogResult() == WorkoutCountdownDialog::Result::Cancelled) + m_workoutQueue->clear(); return; + } // Defer via singleShot so this stack frame fully unwinds before // the next workout begins — avoids unbounded recursion with long queues. diff --git a/src/ui/pmcdialog.cpp b/src/ui/pmcdialog.cpp index ee2f3792..83c9034b 100644 --- a/src/ui/pmcdialog.cpp +++ b/src/ui/pmcdialog.cpp @@ -78,7 +78,7 @@ void PmcDialog::setupUi(const QList &points) // ── close button ────────────────────────────────────────────────────────── auto *buttons = new QDialogButtonBox(QDialogButtonBox::Close, this); - connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::accept); + connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); // ── layout ──────────────────────────────────────────────────────────────── auto *mainLayout = new QVBoxLayout(this);