diff --git a/build/data/obs-studio/locale/en.txt b/build/data/obs-studio/locale/en.txt index 742917391..a0722311b 100644 --- a/build/data/obs-studio/locale/en.txt +++ b/build/data/obs-studio/locale/en.txt @@ -42,10 +42,17 @@ Basic.DisplayCapture="Display Capture" Basic.Main.AddSceneDlg.Title="Add Scene" Basic.Main.AddSceneDlg.Text="Please enter the name of the scene" +# add scene suggested name +Basic.Main.DefaultSceneName.Text="Scene %1" + # add source dialog Basic.SourceSelect.CreateNew="Create new" Basic.SourceSelect.AddExisting="Add Existing" +# no scene warning +Basic.Main.AddSourceHelp.Title="Cannot Add Source" +Basic.Main.AddSourceHelp.Text="You need to have at least 1 scene to add a source." + # basic mode main window Basic.Main.Scenes="Scenes" Basic.Main.Sources="Sources" diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index 66052eab4..a782bb247 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -958,10 +958,14 @@ void OBSBasic::on_scenes_customContextMenuRequested(const QPoint &pos) void OBSBasic::on_actionAddScene_triggered() { string name; + QString format{QTStr("Basic.Main.DefaultSceneName.Text")}; + QString placeHolderText = format.arg(ui->scenes->count() + 1); + bool accepted = NameDialog::AskForName(this, QTStr("MainWindow.AddSceneDlg.Title"), QTStr("MainWindow.AddSceneDlg.Text"), - name); + name, + placeHolderText); if (accepted) { if (name.empty()) { @@ -1045,8 +1049,14 @@ void OBSBasic::AddSourcePopupMenu(const QPoint &pos) bool foundValues = false; size_t idx = 0; - if (!GetCurrentScene()) + if (!GetCurrentScene()) { + // Tell the user he needs a scene first (help beginners). + QMessageBox::information(this, + QTStr("Basic.Main.AddSourceHelp.Title"), + QTStr("Basic.Main.AddSourceHelp.Text")); return; + } + QMenu popup; while (obs_enum_input_types(idx++, &type)) { diff --git a/obs/window-basic-settings.cpp b/obs/window-basic-settings.cpp index 09f9cec91..4877581ce 100644 --- a/obs/window-basic-settings.cpp +++ b/obs/window-basic-settings.cpp @@ -158,6 +158,9 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent) HookWidget(ui->fpsNumerator, SCROLL_CHANGED, VIDEO_CHANGED); HookWidget(ui->fpsDenominator, SCROLL_CHANGED, VIDEO_CHANGED); + //Apply button disabled until change. + EnableApplyButton(false); + LoadServiceTypes(); LoadServiceInfo(); LoadSettings(false); @@ -664,11 +667,6 @@ void OBSBasicSettings::on_listWidget_itemSelectionChanged() if (loading || row == pageIndex) return; - if (Changed() && !QueryChanges()) { - ui->listWidget->setCurrentRow(pageIndex); - return; - } - pageIndex = row; } @@ -744,20 +742,26 @@ void OBSBasicSettings::on_baseResolution_editTextChanged(const QString &text) void OBSBasicSettings::GeneralChanged() { - if (!loading) + if (!loading) { generalChanged = true; + EnableApplyButton(true); + } } void OBSBasicSettings::OutputsChanged() { - if (!loading) + if (!loading) { outputsChanged = true; + EnableApplyButton(true); + } } void OBSBasicSettings::AudioChanged() { - if (!loading) + if (!loading) { audioChanged = true; + EnableApplyButton(true); + } } void OBSBasicSettings::AudioChangedRestart() @@ -765,6 +769,7 @@ void OBSBasicSettings::AudioChangedRestart() if (!loading) { audioChanged = true; ui->audioMsg->setText(QTStr("Basic.Settings.ProgramRestart")); + EnableApplyButton(true); } } @@ -773,17 +778,22 @@ void OBSBasicSettings::VideoChangedRestart() if (!loading) { videoChanged = true; ui->videoMsg->setText(QTStr("Basic.Settings.ProgramRestart")); + EnableApplyButton(true); } } void OBSBasicSettings::VideoChangedResolution() { - if (!loading && ValidResolutions(ui.get())) + if (!loading && ValidResolutions(ui.get())) { videoChanged = true; + EnableApplyButton(true); + } } void OBSBasicSettings::VideoChanged() { - if (!loading) + if (!loading) { videoChanged = true; + EnableApplyButton(true); + } } diff --git a/obs/window-basic-settings.hpp b/obs/window-basic-settings.hpp index ef54be101..937e1dd72 100644 --- a/obs/window-basic-settings.hpp +++ b/obs/window-basic-settings.hpp @@ -53,12 +53,18 @@ private: audioChanged || videoChanged; } + inline void EnableApplyButton(bool en) + { + ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(en); + } + inline void ClearChanged() { generalChanged = false; outputsChanged = false; audioChanged = false; videoChanged = false; + EnableApplyButton(false); } void HookWidget(QWidget *widget, const char *signal, const char *slot); diff --git a/obs/window-basic-source-select.cpp b/obs/window-basic-source-select.cpp index d74d12a2e..f48831f82 100644 --- a/obs/window-basic-source-select.cpp +++ b/obs/window-basic-source-select.cpp @@ -18,6 +18,7 @@ #include "window-basic-main.hpp" #include "window-basic-source-select.hpp" #include "qt-wrappers.hpp" +#include "obs-app.hpp" bool OBSBasicSourceSelect::EnumSources(void *data, obs_source_t source) { @@ -143,5 +144,13 @@ OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *type_) { ui->setupUi(this); + const char *placeHolderText = obs_source_getdisplayname( + OBS_SOURCE_TYPE_INPUT, + type_, App()->GetLocale()); + + ui->sourceName->setText(QT_UTF8(placeHolderText)); + ui->sourceName->setFocus(); //Fixes deselect of text. + ui->sourceName->selectAll(); + obs_enum_sources(EnumSources, this); } diff --git a/obs/window-namedialog.cpp b/obs/window-namedialog.cpp index ae1134e78..a51e44485 100644 --- a/obs/window-namedialog.cpp +++ b/obs/window-namedialog.cpp @@ -28,11 +28,13 @@ NameDialog::NameDialog(QWidget *parent) } bool NameDialog::AskForName(QWidget *parent, const QString &title, - const QString &text, string &str) + const QString &text, string &str, const QString &placeHolder) { NameDialog dialog(parent); dialog.setWindowTitle(title); dialog.ui->label->setText(text); + dialog.ui->userText->setText(placeHolder); + dialog.ui->userText->selectAll(); bool accepted = (dialog.exec() == DialogCode::Accepted); if (accepted) diff --git a/obs/window-namedialog.hpp b/obs/window-namedialog.hpp index 054e4da45..84314547a 100644 --- a/obs/window-namedialog.hpp +++ b/obs/window-namedialog.hpp @@ -33,5 +33,6 @@ public: NameDialog(QWidget *parent); static bool AskForName(QWidget *parent, const QString &title, - const QString &text, std::string &str); + const QString &text, std::string &str, + const QString &placeHolder = QString("")); };