diff --git a/build/data/obs-studio/locale/en.txt b/build/data/obs-studio/locale/en.txt index b3ba53cd1..a0722311b 100644 --- a/build/data/obs-studio/locale/en.txt +++ b/build/data/obs-studio/locale/en.txt @@ -42,6 +42,9 @@ 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" diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index b14edce87..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()) { 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("")); };