mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-19 20:32:15 +02:00
UI: Disallow closing settings without selected codec or format
This commit is contained in:
parent
60139cbdfe
commit
2f2fc33f91
@ -1335,6 +1335,10 @@ OutputWarnings.CodecIncompatible="The audio or video encoder selection was reset
|
||||
CodecCompat.Incompatible="(Incompatible with %1)"
|
||||
CodecCompat.CodecPlaceholder="Select Encoder..."
|
||||
CodecCompat.ContainerPlaceholder="Select Format..."
|
||||
CodecCompat.CodecMissingOnExit.Title="No Encoder Selected"
|
||||
CodecCompat.CodecMissingOnExit.Text="At least one video or audio encoder is not set. Please make sure to select encoders for both recording and streaming."
|
||||
CodecCompat.ContainerMissingOnExit.Title="No Format Selected"
|
||||
CodecCompat.ContainerMissingOnExit.Text="No recording format has been selected. Please select a recording format that is compatible with the selected stream encoder."
|
||||
|
||||
# deleting final scene
|
||||
FinalScene.Title="Delete Scene"
|
||||
|
@ -4197,6 +4197,9 @@ bool OBSBasicSettings::QueryChanges()
|
||||
if (button == QMessageBox::Cancel) {
|
||||
return false;
|
||||
} else if (button == QMessageBox::Yes) {
|
||||
if (!QueryAllowedToClose())
|
||||
return false;
|
||||
|
||||
SaveSettings();
|
||||
} else {
|
||||
if (savedTheme != App()->GetTheme())
|
||||
@ -4210,6 +4213,44 @@ bool OBSBasicSettings::QueryChanges()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OBSBasicSettings::QueryAllowedToClose()
|
||||
{
|
||||
bool simple = (ui->outputMode->currentIndex() == 0);
|
||||
|
||||
bool invalidEncoder = false;
|
||||
bool invalidFormat = false;
|
||||
if (simple) {
|
||||
if (ui->simpleOutRecEncoder->currentIndex() == -1 ||
|
||||
ui->simpleOutStrEncoder->currentIndex() == -1 ||
|
||||
ui->simpleOutRecAEncoder->currentIndex() == -1 ||
|
||||
ui->simpleOutStrAEncoder->currentIndex() == -1)
|
||||
invalidEncoder = true;
|
||||
|
||||
if (ui->simpleOutRecFormat->currentIndex() == -1)
|
||||
invalidFormat = true;
|
||||
} else {
|
||||
if (ui->advOutRecEncoder->currentIndex() == -1 ||
|
||||
ui->advOutEncoder->currentIndex() == -1 ||
|
||||
ui->advOutRecAEncoder->currentIndex() == -1 ||
|
||||
ui->advOutAEncoder->currentIndex() == -1)
|
||||
invalidEncoder = true;
|
||||
}
|
||||
|
||||
if (invalidEncoder) {
|
||||
OBSMessageBox::warning(
|
||||
this, QTStr("CodecCompat.CodecMissingOnExit.Title"),
|
||||
QTStr("CodecCompat.CodecMissingOnExit.Text"));
|
||||
return false;
|
||||
} else if (invalidFormat) {
|
||||
OBSMessageBox::warning(
|
||||
this, QTStr("CodecCompat.ContainerMissingOnExit.Title"),
|
||||
QTStr("CodecCompat.ContainerMissingOnExit.Text"));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void OBSBasicSettings::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if (!AskIfCanCloseSettings())
|
||||
@ -4259,6 +4300,9 @@ void OBSBasicSettings::on_buttonBox_clicked(QAbstractButton *button)
|
||||
|
||||
if (val == QDialogButtonBox::ApplyRole ||
|
||||
val == QDialogButtonBox::AcceptRole) {
|
||||
if (!QueryAllowedToClose())
|
||||
return;
|
||||
|
||||
SaveSettings();
|
||||
ClearChanged();
|
||||
}
|
||||
|
@ -224,6 +224,7 @@ private:
|
||||
void HookWidget(QWidget *widget, const char *signal, const char *slot);
|
||||
|
||||
bool QueryChanges();
|
||||
bool QueryAllowedToClose();
|
||||
|
||||
void ResetEncoders(bool streamOnly = false);
|
||||
void LoadColorRanges();
|
||||
|
Loading…
Reference in New Issue
Block a user