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.
master
jp9000 2018-11-14 20:02:02 -08:00
parent 1f79fc1295
commit c482f463e0
4 changed files with 135 additions and 141 deletions

View File

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

View File

@ -20,7 +20,7 @@
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
</property>
<item row="1" column="0">
<item row="0" column="0">
<widget class="QLabel" name="serviceLabel">
<property name="text">
<string>Basic.AutoConfig.StreamPage.Service</string>
@ -30,103 +30,17 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="QComboBox" name="service"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="streamKeyLabel">
<property name="text">
<string>Basic.AutoConfig.StreamPage.StreamKey</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>key</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="key">
<property name="inputMask">
<string notr="true"/>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="show">
<property name="text">
<string>Show</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="doBandwidthTest">
<property name="text">
<string>Basic.AutoConfig.StreamPage.PerformBandwidthTest</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="preferHardware">
<property name="toolTip">
<string>Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip</string>
</property>
<property name="text">
<string>Basic.AutoConfig.StreamPage.PreferHardwareEncoding</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>90</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" 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="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Basic.Settings.Stream.StreamType</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="streamType"/>
</item>
<item row="2" column="1">
<item row="1" column="1">
<widget class="QStackedWidget" name="serverStackedWidget">
<property name="currentIndex">
<number>0</number>
@ -171,7 +85,109 @@
</widget>
</widget>
</item>
<item row="7" column="1">
<item row="2" column="0">
<widget class="QLabel" name="streamKeyLabel">
<property name="text">
<string>Basic.AutoConfig.StreamPage.StreamKey</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>key</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="key">
<property name="inputMask">
<string notr="true"/>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="show">
<property name="text">
<string>Show</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" 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>
<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">
<property name="toolTip">
<string>Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip</string>
</property>
<property name="text">
<string>Basic.AutoConfig.StreamPage.PreferHardwareEncoding</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>90</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="doBandwidthTest">
<property name="text">
<string>Basic.AutoConfig.StreamPage.PerformBandwidthTest</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QGroupBox" name="region">
<property name="title">
<string>BandwidthTest.Region</string>
@ -208,36 +224,9 @@
</layout>
</widget>
</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>
</widget>
<tabstops>
<tabstop>streamType</tabstop>
<tabstop>service</tabstop>
<tabstop>server</tabstop>
<tabstop>customServer</tabstop>

View File

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

View File

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