mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
UI: Add warning if using no/multiple tracks
Certain output formats don't support multiple tracks, so it's important to warn the user if they select multiple tracks. Also warn the user if they select no tracks.
This commit is contained in:
@@ -379,6 +379,17 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
|
||||
"hotkey_unregister", ReloadHotkeysIgnore, this);
|
||||
|
||||
LoadSettings(false);
|
||||
|
||||
// Add warning checks to advanced output recording section controls
|
||||
connect(ui->advOutRecTrack1, SIGNAL(clicked()),
|
||||
this, SLOT(AdvOutRecCheckWarnings()));
|
||||
connect(ui->advOutRecTrack2, SIGNAL(clicked()),
|
||||
this, SLOT(AdvOutRecCheckWarnings()));
|
||||
connect(ui->advOutRecTrack3, SIGNAL(clicked()),
|
||||
this, SLOT(AdvOutRecCheckWarnings()));
|
||||
connect(ui->advOutRecTrack4, SIGNAL(clicked()),
|
||||
this, SLOT(AdvOutRecCheckWarnings()));
|
||||
AdvOutRecCheckWarnings();
|
||||
}
|
||||
|
||||
void OBSBasicSettings::SaveCombo(QComboBox *widget, const char *section,
|
||||
@@ -2533,3 +2544,40 @@ void OBSBasicSettings::AdvancedChanged()
|
||||
EnableApplyButton(true);
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasicSettings::AdvOutRecCheckWarnings()
|
||||
{
|
||||
auto Checked = [](QCheckBox *box)
|
||||
{
|
||||
return box->isChecked() ? 1 : 0;
|
||||
};
|
||||
|
||||
QString msg;
|
||||
uint32_t tracks =
|
||||
Checked(ui->advOutRecTrack1) +
|
||||
Checked(ui->advOutRecTrack2) +
|
||||
Checked(ui->advOutRecTrack3) +
|
||||
Checked(ui->advOutRecTrack4);
|
||||
const char *objectName = nullptr;
|
||||
|
||||
if (tracks == 0) {
|
||||
msg = QTStr("OutputWarnings.NoTracksSelected");
|
||||
objectName = "errorLabel";
|
||||
|
||||
} else if (tracks > 1) {
|
||||
msg = QTStr("OutputWarnings.MultiTrackRecording");
|
||||
objectName = "warningLabel";
|
||||
}
|
||||
|
||||
delete advOutRecWarning;
|
||||
|
||||
if (!msg.isEmpty()) {
|
||||
advOutRecWarning = new QLabel(msg, this);
|
||||
advOutRecWarning->setObjectName(objectName);
|
||||
|
||||
QFormLayout *formLayout = reinterpret_cast<QFormLayout*>(
|
||||
ui->advOutRecTopContainer->layout());
|
||||
|
||||
formLayout->addRow(nullptr, advOutRecWarning);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user