Fix SettingsDialog to do validity check when OK is pressed

This commit is contained in:
Gary Talent 2025-03-29 14:45:32 -05:00
parent 2e9b37f3b4
commit af07f8853a
2 changed files with 8 additions and 5 deletions

View File

@ -205,12 +205,12 @@ QWidget *SettingsDialog::setupButtons(QWidget *parent) {
return root;
}
void SettingsDialog::handleApply() {
int SettingsDialog::handleApply() {
QSettings settings;
QVector<View> views;
auto const viewsErr = collectViews(views);
if (viewsErr) {
return;
return -1;
}
setViews(settings, views);
setCameraConnectionData(settings, {
@ -227,11 +227,13 @@ void SettingsDialog::handleApply() {
});
collectVideoConfig();
setVideoConfig(settings, m_videoConfig);
return 0;
}
void SettingsDialog::handleOK() {
handleApply();
accept();
if (handleApply() == 0) {
accept();
}
}
void SettingsDialog::setupViewRow(int row, View const&view) {

View File

@ -38,7 +38,8 @@ class SettingsDialog: public QDialog {
QWidget *setupViewConfig(QWidget *parent);
QWidget *setupImageConfig(QWidget *parent);
QWidget *setupButtons(QWidget *parent);
void handleApply();
[[nodiscard]]
int handleApply();
void handleOK();
void setupViewRow(int row, View const&view = {});
/**