diff --git a/config-dialog.cpp b/config-dialog.cpp index 4a1f242..a0c758a 100644 --- a/config-dialog.cpp +++ b/config-dialog.cpp @@ -196,7 +196,19 @@ OBSBasicSettings::OBSBasicSettings(QMainWindow *parent) : QDialog(parent) addButton->setProperty("themeID", QVariant(QString::fromUtf8("addIconSmall"))); connect(addButton, &QPushButton::clicked, [this] { - auto outputDialog = new OutputDialog(this); + QStringList otherNames; + auto outputs = obs_data_get_array(settings, "outputs"); + obs_data_array_enum( + outputs, + [](obs_data_t *data, void *param) { + auto otherNames = (QStringList *)param; + otherNames->append(QString::fromUtf8(obs_data_get_string(data, "name"))); + }, + &otherNames); + obs_data_array_release(outputs); + otherNames.removeDuplicates(); + otherNames.removeOne(QString::fromUtf8(obs_data_get_string(settings, "name"))); + auto outputDialog = new OutputDialog(this, otherNames); outputDialog->setWindowModality(Qt::WindowModal); outputDialog->setModal(true); @@ -282,7 +294,17 @@ OBSBasicSettings::OBSBasicSettings(QMainWindow *parent) : QDialog(parent) verticalAddButton->setProperty("themeID", QVariant(QString::fromUtf8("addIconSmall"))); connect(verticalAddButton, &QPushButton::clicked, [this] { - auto outputDialog = new OutputDialog(this); + QStringList otherNames; + obs_data_array_enum( + vertical_outputs, + [](obs_data_t *data, void *param) { + auto otherNames = (QStringList *)param; + otherNames->append(QString::fromUtf8(obs_data_get_string(data, "name"))); + }, + &otherNames); + otherNames.removeDuplicates(); + otherNames.removeOne(QString::fromUtf8(obs_data_get_string(settings, "name"))); + auto outputDialog = new OutputDialog(this, otherNames); outputDialog->setWindowModality(Qt::WindowModal); outputDialog->setModal(true); @@ -875,10 +897,20 @@ void OBSBasicSettings::AddServer(QFormLayout *outputsLayout, obs_data_t *setting auto editButton = new QPushButton(QString::fromUtf8(obs_module_text("EditServerSettings"))); editButton->setProperty("themeID", "configIconSmall"); - connect(editButton, &QPushButton::clicked, [this, settings] { + connect(editButton, &QPushButton::clicked, [this, settings, outputs] { + QStringList otherNames; + obs_data_array_enum( + outputs, + [](obs_data_t *data, void *param) { + auto otherNames = (QStringList *)param; + otherNames->append(QString::fromUtf8(obs_data_get_string(data, "name"))); + }, + &otherNames); + otherNames.removeDuplicates(); + otherNames.removeOne(QString::fromUtf8(obs_data_get_string(settings, "name"))); auto outputDialog = new OutputDialog(this, obs_data_get_string(settings, "name"), obs_data_get_string(settings, "stream_server"), - obs_data_get_string(settings, "stream_key")); + obs_data_get_string(settings, "stream_key"), otherNames); outputDialog->setWindowModality(Qt::WindowModal); outputDialog->setModal(true); diff --git a/multistream.cpp b/multistream.cpp index d888e6b..1430c83 100644 --- a/multistream.cpp +++ b/multistream.cpp @@ -55,7 +55,6 @@ bool version_info_downloaded(void *param, struct file_download_data *file) bool obs_module_load(void) { - //return true; blog(LOG_INFO, "[Aitum-Multistream] loaded version %s", PROJECT_VERSION); const auto main_window = static_cast(obs_frontend_get_main_window()); diff --git a/output-dialog.cpp b/output-dialog.cpp index ac572e2..bdcf96b 100644 --- a/output-dialog.cpp +++ b/output-dialog.cpp @@ -33,7 +33,7 @@ void OutputDialog::acceptOutputs() void OutputDialog::validateOutputs(QPushButton *confirmButton) { - if (outputName.isEmpty()) { + if (outputName.isEmpty() || otherNames.contains(outputName)) { confirmButton->setEnabled(false); } else if (outputServer.isEmpty()) { confirmButton->setEnabled(false); @@ -241,7 +241,7 @@ obs_data_t *OutputDialog::getService(std::string serviceName) return nullptr; } -OutputDialog::OutputDialog(QDialog *parent) : QDialog(parent) +OutputDialog::OutputDialog(QDialog *parent, QStringList _otherNames) : QDialog(parent), otherNames(_otherNames) { // Load the services from rtmp-services plugin auto servicesPath = obs_module_get_config_path(obs_get_module("rtmp-services"), "services.json"); @@ -293,7 +293,9 @@ OutputDialog::OutputDialog(QDialog *parent) : QDialog(parent) } // Edit mode -OutputDialog::OutputDialog(QDialog *parent, QString name, QString server, QString key) : QDialog(parent) +OutputDialog::OutputDialog(QDialog *parent, QString name, QString server, QString key, QStringList _otherNames) + : QDialog(parent), + otherNames(_otherNames) { // Load the services from rtmp-services plugin diff --git a/output-dialog.hpp b/output-dialog.hpp index e74ae7d..acb2f45 100644 --- a/output-dialog.hpp +++ b/output-dialog.hpp @@ -54,10 +54,11 @@ private: obs_data_t *getService(std::string serviceName); QStackedWidget *stackedWidget; + QStringList otherNames; public: - OutputDialog(QDialog *parent); - OutputDialog(QDialog *parent, QString name, QString server, QString key); + OutputDialog(QDialog *parent, QStringList otherNames); + OutputDialog(QDialog *parent, QString name, QString server, QString key, QStringList otherNames); QString outputName; QString outputServer;