-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
6 changed files
with
138 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters