UI: Upgrade stream link hotlink to a button

Most of the top streaming services now have a link in the stream key
label. Upgrading this button to a button clarifies the assistance
for the important step of setting up a stream.

Creates a new type of button for URL opening simply which also
automatically updates the tootip to the current URL.

Includes addition of Twitter/Periscope URL to make this feature more
complete.
This commit is contained in:
JohannMG
2019-10-24 21:05:43 -07:00
parent c56de17bdb
commit 3f6cf0e871
6 changed files with 125 additions and 64 deletions

View File

@@ -1,10 +1,12 @@
#include <QMessageBox>
#include <QUrl>
#include "window-basic-settings.hpp"
#include "obs-frontend-api.h"
#include "obs-app.hpp"
#include "window-basic-main.hpp"
#include "qt-wrappers.hpp"
#include "url-push-button.hpp"
#ifdef BROWSER_AVAILABLE
#include <browser-panel.hpp>
@@ -177,44 +179,34 @@ void OBSBasicSettings::SaveStream1Settings()
void OBSBasicSettings::UpdateKeyLink()
{
bool custom = IsCustomService();
QString serviceName = ui->service->currentText();
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>";
} 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>";
} 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 == "Facebook Live") {
text += " <a href=\"https://";
text += "www.facebook.com/live/create";
text += "\">";
text += QTStr(
"Basic.AutoConfig.StreamPage.StreamKey.LinkToSite");
text += "</a>";
if (IsCustomService()) {
ui->getStreamKeyButton->hide();
return;
}
ui->streamKeyLabel->setText(text);
QString serviceName = ui->service->currentText();
QString streamKeyLink;
if (serviceName == "Twitch") {
streamKeyLink = QTStr(
"https://www.twitch.tv/broadcast/dashboard/streamkey");
} else if (serviceName == "YouTube / YouTube Gaming") {
streamKeyLink = QTStr("https://www.youtube.com/live_dashboard");
} else if (serviceName.startsWith("Restream.io")) {
streamKeyLink = QTStr(
"https://restream.io/settings/streaming-setup?from=OBS");
} else if (serviceName == "Facebook Live") {
streamKeyLink +=
QTStr("https://www.facebook.com/live/create?ref=OBS");
} else if (serviceName.startsWith("Twitter")) {
streamKeyLink = QTStr("https://www.pscp.tv/account/producer");
}
if (QString(streamKeyLink).isNull()) {
ui->getStreamKeyButton->hide();
} else {
ui->getStreamKeyButton->setTargetUrl(QUrl(streamKeyLink));
ui->getStreamKeyButton->show();
}
}
void OBSBasicSettings::LoadServices(bool showAll)