Browse Source

UI: Remove "service type" from auto-config stream page

The "Custom" service has been moved, and is now an item called "Custom"
in the "Services" combo box.  This simplifies the stream page of
auto-configuration and removes an unnecessary widget.  Overall a minor
but nice slimline/improvement on user experience.
jp9000 7 years ago
parent
commit
c482f463e0

+ 1 - 0
UI/data/locale/en-US.ini

@@ -127,6 +127,7 @@ Basic.AutoConfig.StreamPage="Stream Information"
 Basic.AutoConfig.StreamPage.SubTitle="Please enter your stream information"
 Basic.AutoConfig.StreamPage.SubTitle="Please enter your stream information"
 Basic.AutoConfig.StreamPage.Service="Service"
 Basic.AutoConfig.StreamPage.Service="Service"
 Basic.AutoConfig.StreamPage.Service.ShowAll="Show All..."
 Basic.AutoConfig.StreamPage.Service.ShowAll="Show All..."
+Basic.AutoConfig.StreamPage.Service.Custom="Custom"
 Basic.AutoConfig.StreamPage.Server="Server"
 Basic.AutoConfig.StreamPage.Server="Server"
 Basic.AutoConfig.StreamPage.StreamKey="Stream Key"
 Basic.AutoConfig.StreamPage.StreamKey="Stream Key"
 Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(Link)"
 Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(Link)"

+ 85 - 96
UI/forms/AutoConfigStreamPage.ui

@@ -20,7 +20,7 @@
    <property name="labelAlignment">
    <property name="labelAlignment">
     <set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
     <set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
    </property>
    </property>
-   <item row="1" column="0">
+   <item row="0" column="0">
     <widget class="QLabel" name="serviceLabel">
     <widget class="QLabel" name="serviceLabel">
      <property name="text">
      <property name="text">
       <string>Basic.AutoConfig.StreamPage.Service</string>
       <string>Basic.AutoConfig.StreamPage.Service</string>
@@ -30,10 +30,62 @@
      </property>
      </property>
     </widget>
     </widget>
    </item>
    </item>
-   <item row="1" column="1">
+   <item row="0" column="1">
     <widget class="QComboBox" name="service"/>
     <widget class="QComboBox" name="service"/>
    </item>
    </item>
-   <item row="3" column="0">
+   <item row="1" column="0">
+    <widget class="QLabel" name="serverLabel">
+     <property name="text">
+      <string>Basic.AutoConfig.StreamPage.Server</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QStackedWidget" name="serverStackedWidget">
+     <property name="currentIndex">
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="servicePage">
+      <layout class="QHBoxLayout" name="horizontalLayout_2">
+       <property name="leftMargin">
+        <number>0</number>
+       </property>
+       <property name="topMargin">
+        <number>0</number>
+       </property>
+       <property name="rightMargin">
+        <number>0</number>
+       </property>
+       <property name="bottomMargin">
+        <number>0</number>
+       </property>
+       <item>
+        <widget class="QComboBox" name="server"/>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="customPage">
+      <layout class="QHBoxLayout" name="horizontalLayout_3">
+       <property name="leftMargin">
+        <number>0</number>
+       </property>
+       <property name="topMargin">
+        <number>0</number>
+       </property>
+       <property name="rightMargin">
+        <number>0</number>
+       </property>
+       <property name="bottomMargin">
+        <number>0</number>
+       </property>
+       <item>
+        <widget class="QLineEdit" name="customServer"/>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+   <item row="2" column="0">
     <widget class="QLabel" name="streamKeyLabel">
     <widget class="QLabel" name="streamKeyLabel">
      <property name="text">
      <property name="text">
       <string>Basic.AutoConfig.StreamPage.StreamKey</string>
       <string>Basic.AutoConfig.StreamPage.StreamKey</string>
@@ -46,7 +98,7 @@
      </property>
      </property>
     </widget>
     </widget>
    </item>
    </item>
-   <item row="3" column="1">
+   <item row="2" column="1">
     <layout class="QHBoxLayout" name="horizontalLayout">
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
      <item>
       <widget class="QLineEdit" name="key">
       <widget class="QLineEdit" name="key">
@@ -70,17 +122,33 @@
      </item>
      </item>
     </layout>
     </layout>
    </item>
    </item>
-   <item row="6" column="1">
-    <widget class="QCheckBox" name="doBandwidthTest">
+   <item row="3" column="0">
+    <widget class="QLabel" name="bitrateLabel">
      <property name="text">
      <property name="text">
-      <string>Basic.AutoConfig.StreamPage.PerformBandwidthTest</string>
+      <string>Basic.Settings.Output.VideoBitrate</string>
      </property>
      </property>
-     <property name="checked">
-      <bool>true</bool>
+     <property name="buddy">
+      <cstring>bitrate</cstring>
      </property>
      </property>
     </widget>
     </widget>
    </item>
    </item>
-   <item row="5" column="1">
+   <item row="3" column="1">
+    <widget class="QSpinBox" name="bitrate">
+     <property name="suffix">
+      <string notr="true"/>
+     </property>
+     <property name="minimum">
+      <number>500</number>
+     </property>
+     <property name="maximum">
+      <number>10000</number>
+     </property>
+     <property name="value">
+      <number>2500</number>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="1">
     <widget class="QCheckBox" name="preferHardware">
     <widget class="QCheckBox" name="preferHardware">
      <property name="toolTip">
      <property name="toolTip">
       <string>Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip</string>
       <string>Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip</string>
@@ -93,7 +161,7 @@
      </property>
      </property>
     </widget>
     </widget>
    </item>
    </item>
-   <item row="6" column="0">
+   <item row="5" column="0">
     <spacer name="horizontalSpacer">
     <spacer name="horizontalSpacer">
      <property name="orientation">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
       <enum>Qt::Horizontal</enum>
@@ -109,69 +177,17 @@
      </property>
      </property>
     </spacer>
     </spacer>
    </item>
    </item>
-   <item row="2" column="0">
-    <widget class="QLabel" name="serverLabel">
-     <property name="text">
-      <string>Basic.AutoConfig.StreamPage.Server</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="0">
-    <widget class="QLabel" name="label_3">
+   <item row="5" column="1">
+    <widget class="QCheckBox" name="doBandwidthTest">
      <property name="text">
      <property name="text">
-      <string>Basic.Settings.Stream.StreamType</string>
+      <string>Basic.AutoConfig.StreamPage.PerformBandwidthTest</string>
      </property>
      </property>
-    </widget>
-   </item>
-   <item row="0" column="1">
-    <widget class="QComboBox" name="streamType"/>
-   </item>
-   <item row="2" column="1">
-    <widget class="QStackedWidget" name="serverStackedWidget">
-     <property name="currentIndex">
-      <number>0</number>
+     <property name="checked">
+      <bool>true</bool>
      </property>
      </property>
-     <widget class="QWidget" name="servicePage">
-      <layout class="QHBoxLayout" name="horizontalLayout_2">
-       <property name="leftMargin">
-        <number>0</number>
-       </property>
-       <property name="topMargin">
-        <number>0</number>
-       </property>
-       <property name="rightMargin">
-        <number>0</number>
-       </property>
-       <property name="bottomMargin">
-        <number>0</number>
-       </property>
-       <item>
-        <widget class="QComboBox" name="server"/>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="customPage">
-      <layout class="QHBoxLayout" name="horizontalLayout_3">
-       <property name="leftMargin">
-        <number>0</number>
-       </property>
-       <property name="topMargin">
-        <number>0</number>
-       </property>
-       <property name="rightMargin">
-        <number>0</number>
-       </property>
-       <property name="bottomMargin">
-        <number>0</number>
-       </property>
-       <item>
-        <widget class="QLineEdit" name="customServer"/>
-       </item>
-      </layout>
-     </widget>
     </widget>
     </widget>
    </item>
    </item>
-   <item row="7" column="1">
+   <item row="6" column="1">
     <widget class="QGroupBox" name="region">
     <widget class="QGroupBox" name="region">
      <property name="title">
      <property name="title">
       <string>BandwidthTest.Region</string>
       <string>BandwidthTest.Region</string>
@@ -208,36 +224,9 @@
      </layout>
      </layout>
     </widget>
     </widget>
    </item>
    </item>
-   <item row="4" column="1">
-    <widget class="QSpinBox" name="bitrate">
-     <property name="suffix">
-      <string notr="true"/>
-     </property>
-     <property name="minimum">
-      <number>500</number>
-     </property>
-     <property name="maximum">
-      <number>10000</number>
-     </property>
-     <property name="value">
-      <number>2500</number>
-     </property>
-    </widget>
-   </item>
-   <item row="4" column="0">
-    <widget class="QLabel" name="bitrateLabel">
-     <property name="text">
-      <string>Basic.Settings.Output.VideoBitrate</string>
-     </property>
-     <property name="buddy">
-      <cstring>bitrate</cstring>
-     </property>
-    </widget>
-   </item>
   </layout>
   </layout>
  </widget>
  </widget>
  <tabstops>
  <tabstops>
-  <tabstop>streamType</tabstop>
   <tabstop>service</tabstop>
   <tabstop>service</tabstop>
   <tabstop>server</tabstop>
   <tabstop>server</tabstop>
   <tabstop>customServer</tabstop>
   <tabstop>customServer</tabstop>

+ 26 - 23
UI/window-basic-auto-config.cpp

@@ -210,6 +210,11 @@ bool AutoConfigVideoPage::validatePage()
 
 
 /* ------------------------------------------------------------------------- */
 /* ------------------------------------------------------------------------- */
 
 
+enum class ListOpt : int {
+	ShowAll = 1,
+	Custom
+};
+
 AutoConfigStreamPage::AutoConfigStreamPage(QWidget *parent)
 AutoConfigStreamPage::AutoConfigStreamPage(QWidget *parent)
 	: QWizardPage (parent),
 	: QWizardPage (parent),
 	  ui          (new Ui_AutoConfigStreamPage)
 	  ui          (new Ui_AutoConfigStreamPage)
@@ -218,16 +223,11 @@ AutoConfigStreamPage::AutoConfigStreamPage(QWidget *parent)
 	ui->bitrateLabel->setVisible(false);
 	ui->bitrateLabel->setVisible(false);
 	ui->bitrate->setVisible(false);
 	ui->bitrate->setVisible(false);
 
 
-	ui->streamType->addItem(obs_service_get_display_name("rtmp_common"));
-	ui->streamType->addItem(obs_service_get_display_name("rtmp_custom"));
-
 	setTitle(QTStr("Basic.AutoConfig.StreamPage"));
 	setTitle(QTStr("Basic.AutoConfig.StreamPage"));
 	setSubTitle(QTStr("Basic.AutoConfig.StreamPage.SubTitle"));
 	setSubTitle(QTStr("Basic.AutoConfig.StreamPage.SubTitle"));
 
 
 	LoadServices(false);
 	LoadServices(false);
 
 
-	connect(ui->streamType, SIGNAL(currentIndexChanged(int)),
-			this, SLOT(ServiceChanged()));
 	connect(ui->service, SIGNAL(currentIndexChanged(int)),
 	connect(ui->service, SIGNAL(currentIndexChanged(int)),
 			this, SLOT(ServiceChanged()));
 			this, SLOT(ServiceChanged()));
 	connect(ui->customServer, SIGNAL(textChanged(const QString &)),
 	connect(ui->customServer, SIGNAL(textChanged(const QString &)),
@@ -238,8 +238,6 @@ AutoConfigStreamPage::AutoConfigStreamPage(QWidget *parent)
 	connect(ui->service, SIGNAL(currentIndexChanged(int)),
 	connect(ui->service, SIGNAL(currentIndexChanged(int)),
 			this, SLOT(UpdateServerList()));
 			this, SLOT(UpdateServerList()));
 
 
-	connect(ui->streamType, SIGNAL(currentIndexChanged(int)),
-			this, SLOT(UpdateKeyLink()));
 	connect(ui->service, SIGNAL(currentIndexChanged(int)),
 	connect(ui->service, SIGNAL(currentIndexChanged(int)),
 			this, SLOT(UpdateKeyLink()));
 			this, SLOT(UpdateKeyLink()));
 
 
@@ -270,12 +268,17 @@ int AutoConfigStreamPage::nextId() const
 	return AutoConfig::TestPage;
 	return AutoConfig::TestPage;
 }
 }
 
 
+inline bool AutoConfigStreamPage::IsCustom() const
+{
+	return ui->service->currentData().toInt() == (int)ListOpt::Custom;
+}
+
 bool AutoConfigStreamPage::validatePage()
 bool AutoConfigStreamPage::validatePage()
 {
 {
 	OBSData service_settings = obs_data_create();
 	OBSData service_settings = obs_data_create();
 	obs_data_release(service_settings);
 	obs_data_release(service_settings);
 
 
-	wiz->customServer = ui->streamType->currentIndex() == 1;
+	wiz->customServer = IsCustom();
 
 
 	const char *serverType = wiz->customServer
 	const char *serverType = wiz->customServer
 		? "rtmp_custom"
 		? "rtmp_custom"
@@ -360,7 +363,8 @@ void AutoConfigStreamPage::on_show_clicked()
 
 
 void AutoConfigStreamPage::ServiceChanged()
 void AutoConfigStreamPage::ServiceChanged()
 {
 {
-	bool showMore = ui->service->currentData().toBool();
+	bool showMore =
+		ui->service->currentData().toInt() == (int)ListOpt::ShowAll;
 	if (showMore)
 	if (showMore)
 		return;
 		return;
 
 
@@ -368,18 +372,12 @@ void AutoConfigStreamPage::ServiceChanged()
 	bool regionBased = service == "Twitch" ||
 	bool regionBased = service == "Twitch" ||
 	                   service == "Smashcast";
 	                   service == "Smashcast";
 	bool testBandwidth = ui->doBandwidthTest->isChecked();
 	bool testBandwidth = ui->doBandwidthTest->isChecked();
-	bool custom = ui->streamType->currentIndex() == 1;
+	bool custom = IsCustom();
 
 
 	/* Test three closest servers if "Auto" is available for Twitch */
 	/* Test three closest servers if "Auto" is available for Twitch */
 	if (service == "Twitch" && wiz->twitchAuto)
 	if (service == "Twitch" && wiz->twitchAuto)
 		regionBased = false;
 		regionBased = false;
 
 
-	ui->service->setVisible(!custom);
-	ui->serviceLabel->setVisible(!custom);
-
-	ui->formLayout->removeWidget(ui->serviceLabel);
-	ui->formLayout->removeWidget(ui->service);
-
 	ui->formLayout->removeWidget(ui->serverLabel);
 	ui->formLayout->removeWidget(ui->serverLabel);
 	ui->formLayout->removeWidget(ui->serverStackedWidget);
 	ui->formLayout->removeWidget(ui->serverStackedWidget);
 
 
@@ -392,8 +390,6 @@ void AutoConfigStreamPage::ServiceChanged()
 		ui->serverStackedWidget->setVisible(true);
 		ui->serverStackedWidget->setVisible(true);
 		ui->serverLabel->setVisible(true);
 		ui->serverLabel->setVisible(true);
 	} else {
 	} else {
-		ui->formLayout->insertRow(1, ui->serviceLabel, ui->service);
-
 		if (!testBandwidth)
 		if (!testBandwidth)
 			ui->formLayout->insertRow(2, ui->serverLabel,
 			ui->formLayout->insertRow(2, ui->serverLabel,
 					ui->serverStackedWidget);
 					ui->serverStackedWidget);
@@ -414,7 +410,7 @@ void AutoConfigStreamPage::ServiceChanged()
 
 
 void AutoConfigStreamPage::UpdateKeyLink()
 void AutoConfigStreamPage::UpdateKeyLink()
 {
 {
-	bool custom = ui->streamType->currentIndex() == 1;
+	bool custom = IsCustom();
 	QString serviceName = ui->service->currentText();
 	QString serviceName = ui->service->currentText();
 	bool isYoutube = false;
 	bool isYoutube = false;
 
 
@@ -487,9 +483,13 @@ void AutoConfigStreamPage::LoadServices(bool showAll)
 	if (!showAll) {
 	if (!showAll) {
 		ui->service->addItem(
 		ui->service->addItem(
 			QTStr("Basic.AutoConfig.StreamPage.Service.ShowAll"),
 			QTStr("Basic.AutoConfig.StreamPage.Service.ShowAll"),
-			QVariant(true));
+			QVariant((int)ListOpt::ShowAll));
 	}
 	}
 
 
+	ui->service->insertItem(0,
+			QTStr("Basic.AutoConfig.StreamPage.Service.Custom"),
+			QVariant((int)ListOpt::Custom));
+
 	obs_properties_destroy(props);
 	obs_properties_destroy(props);
 
 
 	ui->service->blockSignals(false);
 	ui->service->blockSignals(false);
@@ -498,7 +498,8 @@ void AutoConfigStreamPage::LoadServices(bool showAll)
 void AutoConfigStreamPage::UpdateServerList()
 void AutoConfigStreamPage::UpdateServerList()
 {
 {
 	QString serviceName = ui->service->currentText();
 	QString serviceName = ui->service->currentText();
-	bool showMore = ui->service->currentData().toBool();
+	bool showMore =
+		ui->service->currentData().toInt() == (int)ListOpt::ShowAll;
 
 
 	if (showMore) {
 	if (showMore) {
 		LoadServices(true);
 		LoadServices(true);
@@ -536,7 +537,7 @@ void AutoConfigStreamPage::UpdateCompleted()
 	if (ui->key->text().isEmpty()) {
 	if (ui->key->text().isEmpty()) {
 		ready = false;
 		ready = false;
 	} else {
 	} else {
-		bool custom = ui->streamType->currentIndex() == 1;
+		bool custom = IsCustom();
 		if (custom) {
 		if (custom) {
 			ready = !ui->customServer->text().isEmpty();
 			ready = !ui->customServer->text().isEmpty();
 		} else {
 		} else {
@@ -646,7 +647,9 @@ AutoConfig::AutoConfig(QWidget *parent)
 		serverList->setCurrentIndex(idx);
 		serverList->setCurrentIndex(idx);
 	} else {
 	} else {
 		streamPage->ui->customServer->setText(server.c_str());
 		streamPage->ui->customServer->setText(server.c_str());
-		streamPage->ui->streamType->setCurrentIndex(1);
+		int idx = streamPage->ui->service->findData(
+				QVariant((int)ListOpt::Custom));
+		streamPage->ui->service->setCurrentIndex(idx);
 	}
 	}
 
 
 	if (!key.empty())
 	if (!key.empty())

+ 1 - 0
UI/window-basic-auto-config.hpp

@@ -160,6 +160,7 @@ class AutoConfigStreamPage : public QWizardPage {
 	bool ready = false;
 	bool ready = false;
 
 
 	void LoadServices(bool showAll);
 	void LoadServices(bool showAll);
+	inline bool IsCustom() const;
 
 
 public:
 public:
 	AutoConfigStreamPage(QWidget *parent = nullptr);
 	AutoConfigStreamPage(QWidget *parent = nullptr);