Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/btle/btle_hub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions src/model/account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -258,15 +258,15 @@ 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();
}

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();
}

Expand All @@ -275,15 +275,15 @@ 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();
}

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();
}

Expand Down
7 changes: 6 additions & 1 deletion src/ui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pmcdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void PmcDialog::setupUi(const QList<PmcPoint> &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);
Expand Down
Loading