diff --git a/obs/data/locale/en-US.ini b/obs/data/locale/en-US.ini index 8f2b3175e91561abddc44656817f7964c7b195d3..b6d77b8a77edf9b824af267adec2ce5ff435edef 100644 --- a/obs/data/locale/en-US.ini +++ b/obs/data/locale/en-US.ini @@ -30,7 +30,8 @@ DroppedFrames="Dropped Frames %1 (%2%)" NameExists.Title="Name already exists" NameExists.Text="The name is already in use." -NoNameEntered="Please enter a valid name" +NoNameEntered.Title="Please enter a valid name" +NoNameEntered.Text="You cannot use empty names." # confirm delete dialog box ConfirmRemove.Title="Confirm Remove" diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index 865686d7c1e67e59eb49c1aaadbba924d6e8a2fb..1d47dc6eab17fc6428ddd79fd10513ab58b67d76 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -1480,8 +1480,8 @@ void OBSBasic::on_actionAddScene_triggered() if (accepted) { if (name.empty()) { QMessageBox::information(this, - QTStr("NoNameEntered"), - QTStr("NoNameEntered")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); on_actionAddScene_triggered(); return; } @@ -1818,7 +1818,7 @@ void OBSBasic::logUploadFinished() logDialog.exec(); } -static void RenameListItem(QListWidget *listWidget, obs_source_t source, +static void RenameListItem(OBSBasic *parent, QListWidget *listWidget, obs_source_t source, const string &name) { const char *prevName = obs_source_get_name(source); @@ -1827,6 +1827,17 @@ static void RenameListItem(QListWidget *listWidget, obs_source_t source, if (foundSource || name.compare(prevName) == 0 || name.empty()) { listItem->setText(QT_UTF8(prevName)); + + if (foundSource || name.compare(prevName) == 0) { + QMessageBox::information(parent, + QTStr("NameExists.Title"), + QTStr("NameExists.Text")); + } else if (name.empty()) { + QMessageBox::information(parent, + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); + } + obs_source_release(foundSource); } else { listItem->setText(QT_UTF8(name.c_str())); @@ -1845,7 +1856,7 @@ void OBSBasic::SceneNameEdited(QWidget *editor, return; obs_source_t source = obs_scene_get_source(scene); - RenameListItem(ui->scenes, source, text); + RenameListItem(this, ui->scenes, source, text); UNUSED_PARAMETER(endHint); } @@ -1861,7 +1872,7 @@ void OBSBasic::SceneItemNameEdited(QWidget *editor, return; obs_source_t source = obs_sceneitem_get_source(item); - RenameListItem(ui->sources, source, text); + RenameListItem(this, ui->sources, source, text); UNUSED_PARAMETER(endHint); } diff --git a/obs/window-basic-source-select.cpp b/obs/window-basic-source-select.cpp index 4ae207fbf5534ef3278d846ba2ce22487f785bf2..fd32a13c519ae3a312e6508978d1a49ae9ec8bec 100644 --- a/obs/window-basic-source-select.cpp +++ b/obs/window-basic-source-select.cpp @@ -140,8 +140,8 @@ void OBSBasicSourceSelect::on_buttonBox_accepted() } else { if (ui->sourceName->text().isEmpty()) { QMessageBox::information(this, - QTStr("NoNameEntered"), - QTStr("NoNameEntered")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); return; }