mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-19 01:36:12 +08: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:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user