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:
jp9000
2015-06-21 22:34:58 -07:00
parent 556fde66ae
commit 94edb7f5d6
5 changed files with 83 additions and 0 deletions
+48
View File
@@ -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);
}
}