mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-19 20:32:15 +02:00
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:
parent
c56de17bdb
commit
3f6cf0e871
@ -243,6 +243,7 @@ set(obs_SOURCES
|
||||
combobox-ignorewheel.cpp
|
||||
spinbox-ignorewheel.cpp
|
||||
record-button.cpp
|
||||
url-push-button.cpp
|
||||
volume-control.cpp
|
||||
adv-audio-control.cpp
|
||||
item-widget-helpers.cpp
|
||||
@ -298,6 +299,7 @@ set(obs_HEADERS
|
||||
menu-button.hpp
|
||||
mute-checkbox.hpp
|
||||
record-button.hpp
|
||||
url-push-button.hpp
|
||||
volume-control.hpp
|
||||
adv-audio-control.hpp
|
||||
item-widget-helpers.hpp
|
||||
|
@ -162,6 +162,7 @@ Basic.AutoConfig.StreamPage.ConnectAccount="Connect Account (recommended)"
|
||||
Basic.AutoConfig.StreamPage.DisconnectAccount="Disconnect Account"
|
||||
Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Disconnect Account?"
|
||||
Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="This change will apply immediately. Are you sure you want to disconnect your account?"
|
||||
Basic.AutoConfig.StreamPage.GetStreamKey="Get Stream Key"
|
||||
Basic.AutoConfig.StreamPage.UseStreamKey="Use Stream Key"
|
||||
Basic.AutoConfig.StreamPage.Service="Service"
|
||||
Basic.AutoConfig.StreamPage.Service.ShowAll="Show All..."
|
||||
|
@ -151,8 +151,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>803</width>
|
||||
<height>977</height>
|
||||
<width>630</width>
|
||||
<height>1035</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||
@ -775,7 +775,7 @@
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="serviceLabel">
|
||||
<property name="text">
|
||||
<string>Basic.AutoConfig.StreamPage.Service</string>
|
||||
@ -785,7 +785,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="service">
|
||||
<property name="maxVisibleItems">
|
||||
<number>20</number>
|
||||
@ -921,7 +921,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QStackedWidget" name="serverStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="servicePage">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_21">
|
||||
@ -1011,10 +1011,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="UrlPushButton" name="getStreamKeyButton">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="toolTipDuration">
|
||||
<number>-4</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Basic.AutoConfig.StreamPage.GetStreamKey</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer_18">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -1027,7 +1040,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
<widget class="QPushButton" name="connectAccount2">
|
||||
@ -1051,7 +1064,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
||||
<item>
|
||||
<widget class="QPushButton" name="disconnectAccount">
|
||||
@ -1076,16 +1089,20 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="bandwidthTestEnable">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.BandwidthTestMode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="useAuth">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.Custom.UseAuthentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="authUsername"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="authUsernameLabel">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.Custom.Username</string>
|
||||
@ -1095,7 +1112,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="7" column="1">
|
||||
<widget class="QLineEdit" name="authUsername"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="authPwLabel">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.Custom.Password</string>
|
||||
@ -1105,7 +1125,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QWidget" name="authPwWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_25">
|
||||
<property name="leftMargin">
|
||||
@ -1137,13 +1157,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="bandwidthTestEnable">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Stream.BandwidthTestMode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -1180,8 +1193,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>601</width>
|
||||
<height>631</height>
|
||||
<width>739</width>
|
||||
<height>793</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||
@ -3628,8 +3641,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>555</width>
|
||||
<height>469</height>
|
||||
<width>696</width>
|
||||
<height>601</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_50">
|
||||
@ -4199,7 +4212,7 @@
|
||||
<item row="3" column="1">
|
||||
<widget class="QStackedWidget" name="fpsTypes">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@ -4444,8 +4457,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>803</width>
|
||||
<height>781</height>
|
||||
<width>759</width>
|
||||
<height>930</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
@ -5249,6 +5262,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>UrlPushButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>url-push-button.hpp</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>listWidget</tabstop>
|
||||
<tabstop>scrollArea_2</tabstop>
|
||||
|
26
UI/url-push-button.cpp
Normal file
26
UI/url-push-button.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "url-push-button.hpp"
|
||||
|
||||
#include <QUrl>
|
||||
#include <QMouseEvent>
|
||||
#include <QDesktopServices>
|
||||
|
||||
void UrlPushButton::setTargetUrl(QUrl url)
|
||||
{
|
||||
setToolTip(url.toString());
|
||||
m_targetUrl = url;
|
||||
}
|
||||
|
||||
QUrl UrlPushButton::targetUrl()
|
||||
{
|
||||
return m_targetUrl;
|
||||
}
|
||||
|
||||
void UrlPushButton::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
QUrl openUrl = m_targetUrl;
|
||||
if (openUrl.isEmpty())
|
||||
return;
|
||||
|
||||
QDesktopServices::openUrl(openUrl);
|
||||
}
|
20
UI/url-push-button.hpp
Normal file
20
UI/url-push-button.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QUrl>
|
||||
|
||||
class UrlPushButton : public QPushButton {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QUrl targetUrl READ targetUrl WRITE setTargetUrl)
|
||||
|
||||
public:
|
||||
inline UrlPushButton(QWidget *parent = nullptr) : QPushButton(parent) {}
|
||||
void setTargetUrl(QUrl url);
|
||||
QUrl targetUrl();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
QUrl m_targetUrl;
|
||||
};
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user