提交 6597206d 编写于 作者: S Socapex

Alert user when using existing source name.

上级 38d2cf59
......@@ -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"
......
......@@ -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);
}
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册