diff --git a/gui/QT/option/settings.cpp b/gui/QT/option/settings.cpp index bf550aaf4..474d14554 100644 --- a/gui/QT/option/settings.cpp +++ b/gui/QT/option/settings.cpp @@ -189,6 +189,15 @@ static void fec_auto_callback(Option &opt, bool /*subopt*/, void *){ } } +static void network_mode_callback(Option &opt, bool /*subopt*/, void *){ + Settings *settings = opt.getSettings(); + + const std::string &mode = opt.getValue(); + Option& destinationOpt = settings->getOption("network.destination"); + + destinationOpt.setEnabled(mode != " -S"); +} + const static struct{ const char *name; Option::OptType type; @@ -223,6 +232,7 @@ const static struct{ {"audio.playback", Option::StringOpt, " -r ", "", false, "", ""}, {"audio.compress", Option::StringOpt, " --audio-codec ", "", false, "", ""}, {"bitrate", Option::StringOpt, ":bitrate=", "", false, "audio.compress", ""}, + {"network.mode", Option::StringOpt, " ", "", false, "", ""}, {"network.destination", Option::StringOpt, " ", "", false, "", ""}, {"network.port", Option::StringOpt, " -P ", "5004", false, "", ""}, {"network.control_port", Option::StringOpt, " --control-port ", "8888", true, "", ""}, @@ -253,6 +263,7 @@ const struct { {"network.fec", fec_builder_callback}, {"video.compress", fec_auto_callback}, {"network.fec.auto", fec_auto_callback}, + {"network.mode", network_mode_callback}, }; Settings::Settings() : dummy(this){ @@ -340,6 +351,7 @@ std::string Settings::getLaunchParams() const{ out += getOption("network.port").getLaunchOption(); out += getOption("network.control_port").getParam(); out += getControlPort(); + out += getOption("network.mode").getLaunchOption(); out += getOption("network.destination").getLaunchOption(); out += getOption("decode.hwaccel").getLaunchOption(); out += getOption("errors_fatal").getLaunchOption(); diff --git a/gui/QT/option/settings_ui.cpp b/gui/QT/option/settings_ui.cpp index af1512c93..ed416c838 100644 --- a/gui/QT/option/settings_ui.cpp +++ b/gui/QT/option/settings_ui.cpp @@ -27,11 +27,17 @@ void SettingsUi::initMainWin(Ui::UltragridWindow *ui){ connect(mainWin->actionTest, SIGNAL(triggered()), this, SLOT(test())); #endif + connect(ui->networkModeTabWidget, &QTabWidget::currentChanged, + this, &SettingsUi::networkModeTabChanged); + addControl(new CheckboxUi(ui->fECCheckBox, settings, "network.fec.enabled")); addControl(new CheckboxUi(ui->previewCheckBox, settings, "preview")); addControl( new LineEditUi(ui->networkDestinationEdit, settings, "network.destination") ); + addControl( + new LineEditUi(ui->networkDestinationEdit_clientTab, settings, "network.destination") + ); addControl(new ActionCheckableUi(ui->actionVuMeter, settings, "vuMeter")); addControl(new ActionCheckableUi(ui->actionUse_hw_acceleration, settings, @@ -112,6 +118,8 @@ void SettingsUi::initMainWin(Ui::UltragridWindow *ui){ "audio.source.channels")); addControl(new LineEditUi(ui->portLineEdit, settings, "network.port")); + addControl(new LineEditUi(ui->portLineEdit_serverTab, settings, "network.port")); + addControl(new LineEditUi(ui->portLineEdit_clientTab, settings, "network.port")); } void SettingsUi::refreshAll(){ @@ -263,6 +271,23 @@ void SettingsUi::buildSettingsDeviceList(QListWidget *list, SettingType type){ } } +void SettingsUi::networkModeTabChanged(int index){ + Option &modeOpt = settings->getOption("network.mode"); + switch(index){ + case 0: + modeOpt.setValue(" "); + break; + case 1: + modeOpt.setValue(" -S"); + break; + case 2: + modeOpt.setValue(" -C"); + break; + } + + emit changed(); +} + void SettingsUi::settingsCodecSelected(QListWidgetItem *curr, QListWidgetItem *){ if(!curr){ codecControls.clear(); diff --git a/gui/QT/option/settings_ui.hpp b/gui/QT/option/settings_ui.hpp index 947b67c92..cacf227f5 100644 --- a/gui/QT/option/settings_ui.hpp +++ b/gui/QT/option/settings_ui.hpp @@ -84,6 +84,7 @@ private slots: void buildSettingsCodecList(); void settingsCodecSelected(QListWidgetItem *curr, QListWidgetItem *prev); void buildCodecOptControls(const Codec& codec); + void networkModeTabChanged(int index); void settingsDeviceSelected(QListWidgetItem *curr, QListWidgetItem *prev);