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.
master
jp9000 2015-06-17 12:07:55 -07:00
parent 556fde66ae
commit 94edb7f5d6
5 changed files with 83 additions and 0 deletions

View File

@ -426,3 +426,7 @@ Push-to-talk="Push-to-talk"
# scene item hotkeys # scene item hotkeys
SceneItemShow="Show '%1'" SceneItemShow="Show '%1'"
SceneItemHide="Hide '%1'" SceneItemHide="Hide '%1'"
# Output warnings
OutputWarnings.NoTracksSelected="You must select at least one track"
OutputWarnings.MultiTrackRecording="Warning: Certain formats (such as FLV) do not support multiple tracks per recording"

View File

@ -495,3 +495,16 @@ MuteCheckBox::indicator:unchecked {
OBSHotkeyLabel[hotkeyPairHover=true] { OBSHotkeyLabel[hotkeyPairHover=true] {
color: red; color: red;
} }
/* Label warning/error */
QLabel#warningLabel {
color: rgb(192, 128, 0);
font-weight: bold;
}
QLabel#errorLabel {
color: rgb(192, 0, 0);
font-weight: bold;
}

View File

@ -60,3 +60,16 @@ VolumeMeter {
qproperty-peakColor: rgb(62, 241, 43); qproperty-peakColor: rgb(62, 241, 43);
qproperty-peakHoldColor: rgb(0, 0, 0); qproperty-peakHoldColor: rgb(0, 0, 0);
} }
/* Label warning/error */
QLabel#warningLabel {
color: rgb(192, 128, 0);
font-weight: bold;
}
QLabel#errorLabel {
color: rgb(192, 0, 0);
font-weight: bold;
}

View File

@ -379,6 +379,17 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
"hotkey_unregister", ReloadHotkeysIgnore, this); "hotkey_unregister", ReloadHotkeysIgnore, this);
LoadSettings(false); 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, void OBSBasicSettings::SaveCombo(QComboBox *widget, const char *section,
@ -2533,3 +2544,40 @@ void OBSBasicSettings::AdvancedChanged()
EnableApplyButton(true); 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);
}
}

View File

@ -31,6 +31,7 @@ class OBSBasic;
class QAbstractButton; class QAbstractButton;
class QComboBox; class QComboBox;
class QCheckBox; class QCheckBox;
class QLabel;
class OBSPropertiesView; class OBSPropertiesView;
class OBSHotkeyWidget; class OBSHotkeyWidget;
@ -102,6 +103,8 @@ private:
OBSPropertiesView *streamEncoderProps = nullptr; OBSPropertiesView *streamEncoderProps = nullptr;
OBSPropertiesView *recordEncoderProps = nullptr; OBSPropertiesView *recordEncoderProps = nullptr;
QPointer<QLabel> advOutRecWarning;
using AudioSource_t = using AudioSource_t =
std::tuple<OBSWeakSource, std::tuple<OBSWeakSource,
QPointer<QCheckBox>, QPointer<QSpinBox>, QPointer<QCheckBox>, QPointer<QSpinBox>,
@ -257,6 +260,8 @@ private slots:
void AdvancedChanged(); void AdvancedChanged();
void AdvancedChangedRestart(); void AdvancedChangedRestart();
void AdvOutRecCheckWarnings();
protected: protected:
virtual void closeEvent(QCloseEvent *event); virtual void closeEvent(QCloseEvent *event);