Merge pull request #2256 from JohannMG/fix-wizard-key-link

UI: Upgrade stream key link to button in Wizard
master
Jim 2020-01-15 02:39:59 -08:00 committed by GitHub
commit 1bfe461473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 91 additions and 78 deletions

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>566</width>
<height>335</height>
<width>692</width>
<height>407</height>
</rect>
</property>
<property name="windowTitle">
@ -44,6 +44,9 @@
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="bottomMargin">
<number>12</number>
</property>
<item row="0" column="0">
<spacer name="horizontalSpacer_6">
<property name="orientation">
@ -73,6 +76,19 @@
<item row="1" column="1">
<widget class="QComboBox" name="service"/>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>12</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
@ -279,6 +295,13 @@
</property>
</widget>
</item>
<item>
<widget class="UrlPushButton" name="streamKeyButton">
<property name="text">
<string>Basic.AutoConfig.StreamPage.GetStreamKey</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -321,22 +344,6 @@
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>87</width>
<height>17</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="doBandwidthTest">
<property name="text">
@ -347,7 +354,7 @@
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QGroupBox" name="region">
<property name="title">
<string>BandwidthTest.Region</string>
@ -384,26 +391,46 @@
</layout>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QPushButton" name="connectAccount2">
<property name="text">
<string>Basic.AutoConfig.StreamPage.ConnectAccount</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QPushButton" name="disconnectAccount">
<property name="text">
<string>Basic.AutoConfig.StreamPage.DisconnectAccount</string>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>6</width>
<height>6</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>UrlPushButton</class>
<extends>QPushButton</extends>
<header>url-push-button.hpp</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>

View File

@ -1,13 +1,14 @@
#include "window-basic-auto-config.hpp"
#include "window-basic-main.hpp"
#include "qt-wrappers.hpp"
#include "obs-app.hpp"
#include <QMessageBox>
#include <QScreen>
#include <obs.hpp>
#include "window-basic-auto-config.hpp"
#include "window-basic-main.hpp"
#include "qt-wrappers.hpp"
#include "obs-app.hpp"
#include "url-push-button.hpp"
#include "ui_AutoConfigStartPage.h"
#include "ui_AutoConfigVideoPage.h"
#include "ui_AutoConfigStreamPage.h"
@ -289,7 +290,7 @@ int AutoConfigStreamPage::nextId() const
return AutoConfig::TestPage;
}
inline bool AutoConfigStreamPage::IsCustom() const
inline bool AutoConfigStreamPage::IsCustomService() const
{
return ui->service->currentData().toInt() == (int)ListOpt::Custom;
}
@ -299,7 +300,7 @@ bool AutoConfigStreamPage::validatePage()
OBSData service_settings = obs_data_create();
obs_data_release(service_settings);
wiz->customServer = IsCustom();
wiz->customServer = IsCustomService();
const char *serverType = wiz->customServer ? "rtmp_custom"
: "rtmp_common";
@ -480,7 +481,7 @@ void AutoConfigStreamPage::ServiceChanged()
std::string service = QT_TO_UTF8(ui->service->currentText());
bool regionBased = service == "Twitch" || service == "Smashcast";
bool testBandwidth = ui->doBandwidthTest->isChecked();
bool custom = IsCustom();
bool custom = IsCustomService();
ui->disconnectAccount->setVisible(false);
@ -553,51 +554,37 @@ void AutoConfigStreamPage::ServiceChanged()
void AutoConfigStreamPage::UpdateKeyLink()
{
bool custom = IsCustom();
if (IsCustomService()) {
ui->doBandwidthTest->setEnabled(true);
return;
}
QString serviceName = ui->service->currentText();
bool isYoutube = false;
QString streamKeyLink;
if (custom)
serviceName = "";
QString text = QTStr("Basic.AutoConfig.StreamPage.StreamKey");
if (serviceName == "Twitch") {
text += " <a href=\"https://";
text += "www.twitch.tv/broadcast/dashboard/streamkey";
text += "\">";
text += QTStr(
"Basic.AutoConfig.StreamPage.StreamKey.LinkToSite");
text += "</a>";
streamKeyLink =
"https://www.twitch.tv/broadcast/dashboard/streamkey";
} else if (serviceName == "YouTube / YouTube Gaming") {
text += " <a href=\"https://";
text += "www.youtube.com/live_dashboard";
text += "\">";
text += QTStr(
"Basic.AutoConfig.StreamPage.StreamKey.LinkToSite");
text += "</a>";
streamKeyLink = "https://www.youtube.com/live_dashboard";
isYoutube = true;
} else if (serviceName.startsWith("Restream.io")) {
text += " <a href=\"https://";
text += "restream.io/settings/streaming-setup?from=OBS";
text += "\">";
text += QTStr(
"Basic.AutoConfig.StreamPage.StreamKey.LinkToSite");
text += "</a>";
} else if (serviceName == "YouStreamer") {
text += " <a href=\"https://";
text += "app.youstreamer.com/stream";
text += "\">";
text += QTStr(
"Basic.AutoConfig.StreamPage.StreamKey.LinkToSite");
text += "</a>";
streamKeyLink =
"https://restream.io/settings/streaming-setup?from=OBS";
} else if (serviceName == "Facebook Live") {
text += " <a href=\"https://";
text += "www.facebook.com/live/create";
text += "\">";
text += QTStr(
"Basic.AutoConfig.StreamPage.StreamKey.LinkToSite");
text += "</a>";
streamKeyLink = "https://www.facebook.com/live/create?ref=OBS";
} else if (serviceName.startsWith("Twitter")) {
streamKeyLink = "https://www.pscp.tv/account/producer";
} else if (serviceName.startsWith("YouStreamer")) {
streamKeyLink = "https://www.app.youstreamer.com/stream/";
}
if (QString(streamKeyLink).isNull()) {
ui->streamKeyButton->hide();
} else {
ui->streamKeyButton->setTargetUrl(QUrl(streamKeyLink));
ui->streamKeyButton->show();
}
if (isYoutube) {
@ -606,8 +593,6 @@ void AutoConfigStreamPage::UpdateKeyLink()
} else {
ui->doBandwidthTest->setEnabled(true);
}
ui->streamKeyLabel->setText(text);
}
void AutoConfigStreamPage::LoadServices(bool showAll)
@ -704,7 +689,7 @@ void AutoConfigStreamPage::UpdateCompleted()
(ui->key->text().isEmpty() && !auth)) {
ready = false;
} else {
bool custom = IsCustom();
bool custom = IsCustomService();
if (custom) {
ready = !ui->customServer->text().isEmpty();
} else {

View File

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

View File

@ -216,18 +216,19 @@ void OBSBasicSettings::UpdateKeyLink()
QString serviceName = ui->service->currentText();
QString streamKeyLink;
if (serviceName == "Twitch") {
streamKeyLink = QTStr(
"https://www.twitch.tv/broadcast/dashboard/streamkey");
streamKeyLink =
"https://www.twitch.tv/broadcast/dashboard/streamkey";
} else if (serviceName == "YouTube / YouTube Gaming") {
streamKeyLink = QTStr("https://www.youtube.com/live_dashboard");
streamKeyLink = "https://www.youtube.com/live_dashboard";
} else if (serviceName.startsWith("Restream.io")) {
streamKeyLink = QTStr(
"https://restream.io/settings/streaming-setup?from=OBS");
streamKeyLink =
"https://restream.io/settings/streaming-setup?from=OBS";
} else if (serviceName == "Facebook Live") {
streamKeyLink +=
QTStr("https://www.facebook.com/live/create?ref=OBS");
streamKeyLink = "https://www.facebook.com/live/create?ref=OBS";
} else if (serviceName.startsWith("Twitter")) {
streamKeyLink = QTStr("https://www.pscp.tv/account/producer");
streamKeyLink = "https://www.pscp.tv/account/producer";
} else if (serviceName.startsWith("YouStreamer")) {
streamKeyLink = "https://www.app.youstreamer.com/stream/";
}
if (QString(streamKeyLink).isNull()) {