From d3aa3694f2d305b6f38f71809efb5dfc87b51061 Mon Sep 17 00:00:00 2001 From: TranRed Date: Wed, 17 Jul 2019 16:49:16 +0200 Subject: [PATCH] Merge pull request #1 from TranRed/subbutton Added Subscribe option to channel menu --- src/widgets/splits/Split.cpp | 10 ++++++++++ src/widgets/splits/Split.hpp | 1 + src/widgets/splits/SplitHeader.cpp | 3 +++ 3 files changed, 14 insertions(+) diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index c53d0285a..58fd15c23 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -636,6 +636,16 @@ void Split::showViewerList() viewerDock->activateWindow(); } +void Split::openSubPage() +{ + ChannelPtr channel = this->getChannel(); + + if (auto twitchChannel = dynamic_cast(channel.get())) + { + QDesktopServices::openUrl(twitchChannel->subscriptionUrl()); + } +} + void Split::copyToClipboard() { QApplication::clipboard()->setText(this->view_->getSelectedText()); diff --git a/src/widgets/splits/Split.hpp b/src/widgets/splits/Split.hpp index 95db30155..edfca352e 100644 --- a/src/widgets/splits/Split.hpp +++ b/src/widgets/splits/Split.hpp @@ -129,6 +129,7 @@ public slots: void copyToClipboard(); void showSearch(); void showViewerList(); + void openSubPage(); void reloadChannelAndSubscriberEmotes(); }; diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index 3754ae967..c63f373df 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -284,9 +284,12 @@ std::unique_ptr SplitHeader::createMainMenu() // sub menu auto moreMenu = new QMenu("More", this); + moreMenu->addAction("Show viewer list", this->split_, &Split::showViewerList); + moreMenu->addAction("Subscribe", this->split_, &Split::openSubPage); + auto action = new QAction(this); action->setText("Notify when live"); action->setCheckable(true);