Skip to content

Commit

Permalink
Merge pull request Chatterino#1147 from TranRed/subbutton
Browse files Browse the repository at this point in the history
Added Subscribe option to split menu
  • Loading branch information
pajlada authored Jul 16, 2019
2 parents fb6a558 + a768515 commit 3ef77f4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/widgets/splits/Split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,16 @@ void Split::showViewerList()
viewerDock->activateWindow();
}

void Split::openSubPage()
{
ChannelPtr channel = this->getChannel();

if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
{
QDesktopServices::openUrl(twitchChannel->subscriptionUrl());
}
}

void Split::copyToClipboard()
{
QApplication::clipboard()->setText(this->view_->getSelectedText());
Expand Down
1 change: 1 addition & 0 deletions src/widgets/splits/Split.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public slots:
void copyToClipboard();
void showSearch();
void showViewerList();
void openSubPage();
void reloadChannelAndSubscriberEmotes();
};

Expand Down
3 changes: 3 additions & 0 deletions src/widgets/splits/SplitHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,12 @@ std::unique_ptr<QMenu> 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);
Expand Down

0 comments on commit 3ef77f4

Please sign in to comment.