Skip to content

Commit

Permalink
improve clarity of Resample warning (#1581)
Browse files Browse the repository at this point in the history
Also adds check boxes to suppress dialogs.
  • Loading branch information
ddennedy committed Sep 22, 2024
1 parent 0d85b96 commit 012c5d9
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 10 deletions.
28 changes: 21 additions & 7 deletions src/docks/encodedock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2766,22 +2766,36 @@ void EncodeDock::on_reframeButton_clicked()

void EncodeDock::on_resampleButton_clicked(bool checked)
{
if (checked) {
QMessageBox dialog(QMessageBox::Warning,
if (!Settings.askResample() || ("clip" == ui->fromCombo->currentData().toString() && !MLT.profile().is_explicit())) {
setResampleEnabled(checked);
} else if (checked) {
QMessageBox dialog(QMessageBox::Question,
tr("Resample Export"),
tr("<p>Resample is for experts and may not do what you expect.</p>"
"<p>Do you want to change <b>Video Mode</b> in the <b>Settings</b> menu?</p>"),
tr("<p>Are you sure you want to resample instead of change the <b>Video Mode</b>?</p>"
"<p>Changing the aspect ratio adds black bars.</p>"
"<p>Increasing resolution or frame rate is limited by <b>Video Mode</b>.</p>"),
QMessageBox::No | QMessageBox::Yes,
this);
dialog.addButton(tr("Open Settings > Video Mode"), QMessageBox::ResetRole);
dialog.setDefaultButton(QMessageBox::Yes);
dialog.setEscapeButton(QMessageBox::Yes);
dialog.setEscapeButton(QMessageBox::Cancel);
dialog.setWindowModality(QmlApplication::dialogModality());
if (QMessageBox::No == dialog.exec()) {
dialog.setCheckBox(new QCheckBox(tr("Do not show this anymore.",
"Resample export warning dialog")));
switch (dialog.exec()) {
case QMessageBox::Accepted:
setResampleEnabled(checked);
} else {
break;
case QMessageBox::No:
ui->resampleButton->setChecked(false);
break;
default:
ui->resampleButton->setChecked(false);
MAIN.showSettingsMenu();
break;
}
if (dialog.checkBox()->isChecked())
Settings.setAskResample(false);
} else {
setResampleEnabled(false);
}
Expand Down
10 changes: 7 additions & 3 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3989,7 +3989,7 @@ void MainWindow::backupPeriodically()

bool MainWindow::confirmProfileChange()
{
if (MLT.isClip())
if (MLT.isClip() || !Settings.askChangeVideoMode())
return true;

QMessageBox dialog(QMessageBox::Warning,
Expand All @@ -4003,7 +4003,12 @@ bool MainWindow::confirmProfileChange()
dialog.setWindowModality(QmlApplication::dialogModality());
dialog.setDefaultButton(QMessageBox::Yes);
dialog.setEscapeButton(QMessageBox::No);
return QMessageBox::Yes == dialog.exec();
dialog.setCheckBox(new QCheckBox(tr("Do not show this anymore.",
"Change video mode warning dialog")));
auto result = QMessageBox::Yes == dialog.exec();
if (dialog.checkBox()->isChecked())
Settings.setAskChangeVideoMode(false);
return result;
}

void MainWindow::on_actionSystemTheme_triggered()
Expand Down Expand Up @@ -5434,5 +5439,4 @@ void MainWindow::showSettingsMenu() const
point = ui->menuBar->mapToGlobal(point);
#endif
ui->menuSettings->popup(point, ui->menuSettings->defaultAction());

}
20 changes: 20 additions & 0 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,16 @@ void ShotcutSettings::setEncodeParallelProcessing(bool b)
settings.setValue("encode/parallelProcessing", b);
}

bool ShotcutSettings::askResample() const
{
return settings.value("encode/askResample", true).toBool();
}

void ShotcutSettings::setAskResample(bool b)
{
settings.setValue("encode/askResample", b);
}

int ShotcutSettings::playerAudioChannels() const
{
return settings.value("player/audioChannels", 2).toInt();
Expand Down Expand Up @@ -955,6 +965,16 @@ void ShotcutSettings::setAskUpgradeAutomatic(bool b)
settings.setValue("askUpgradeAutmatic", b);
}

bool ShotcutSettings::askChangeVideoMode()
{
return settings.value("askChangeVideoMode", true).toBool();
}

void ShotcutSettings::setAskChangeVideoMode(bool b)
{
settings.setValue("askChangeVideoMode", b);
}

void ShotcutSettings::sync()
{
settings.sync();
Expand Down
4 changes: 4 additions & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ class ShotcutSettings : public QObject
void setShowConvertClipDialog(bool);
bool encodeParallelProcessing() const;
void setEncodeParallelProcessing(bool);
bool askResample() const;
void setAskResample(bool);

// player
int playerAudioChannels() const;
Expand Down Expand Up @@ -257,6 +259,8 @@ class ShotcutSettings : public QObject
void setCheckUpgradeAutomatic(bool b);
bool askUpgradeAutomatic();
void setAskUpgradeAutomatic(bool b);
bool askChangeVideoMode();
void setAskChangeVideoMode(bool b);

void sync();
QString appDataLocation() const;
Expand Down

0 comments on commit 012c5d9

Please sign in to comment.