Fixes #232 opening streams in browser

This commit is contained in:
fourtf 2018-01-17 03:18:47 +01:00
parent db41044daf
commit 776a975624
2 changed files with 15 additions and 5 deletions

View file

@ -92,7 +92,7 @@ void SplitHeader::addDropdownItems(RippleEffectLabel *label)
this->dropdownMenu.addAction("Change channel", this->split, &Split::doChangeChannel, QKeySequence(tr("Ctrl+R"))); this->dropdownMenu.addAction("Change channel", this->split, &Split::doChangeChannel, QKeySequence(tr("Ctrl+R")));
this->dropdownMenu.addAction("Clear chat", this->split, &Split::doClearChat); this->dropdownMenu.addAction("Clear chat", this->split, &Split::doClearChat);
this->dropdownMenu.addAction("Open in web browser", this->split, &Split::doOpenChannel); this->dropdownMenu.addAction("Open in web browser", this->split, &Split::doOpenChannel);
this->dropdownMenu.addAction("Open web popup player", this->split, &Split::doOpenPopupPlayer); this->dropdownMenu.addAction("Open web player", this->split, &Split::doOpenPopupPlayer);
this->dropdownMenu.addAction("Open in Streamlink", this->split, &Split::doOpenStreamlink); this->dropdownMenu.addAction("Open in Streamlink", this->split, &Split::doOpenStreamlink);
this->dropdownMenu.addSeparator(); this->dropdownMenu.addSeparator();
this->dropdownMenu.addAction("Reload channel emotes", this, SLOT(menuReloadChannelEmotes())); this->dropdownMenu.addAction("Reload channel emotes", this, SLOT(menuReloadChannelEmotes()));

View file

@ -3,6 +3,7 @@
#include "singletons/settingsmanager.hpp" #include "singletons/settingsmanager.hpp"
#include "singletons/thememanager.hpp" #include "singletons/thememanager.hpp"
#include "singletons/windowmanager.hpp" #include "singletons/windowmanager.hpp"
#include "twitch/twitchchannel.hpp"
#include "twitch/twitchmessagebuilder.hpp" #include "twitch/twitchmessagebuilder.hpp"
#include "util/urlfetch.hpp" #include "util/urlfetch.hpp"
#include "widgets/helper/searchpopup.hpp" #include "widgets/helper/searchpopup.hpp"
@ -15,6 +16,7 @@
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QDebug> #include <QDebug>
#include <QDesktopServices>
#include <QDockWidget> #include <QDockWidget>
#include <QDrag> #include <QDrag>
#include <QFileInfo> #include <QFileInfo>
@ -317,14 +319,22 @@ void Split::doClearChat()
void Split::doOpenChannel() void Split::doOpenChannel()
{ {
qDebug() << "[UNIMPLEMENTED] Open twitch.tv/" SharedChannel _channel = this->channel;
<< QString::fromStdString(this->channelName.getValue()); twitch::TwitchChannel *tc = dynamic_cast<twitch::TwitchChannel *>(_channel.get());
if (tc != nullptr) {
QDesktopServices::openUrl("https://twitch.tv/" + tc->name);
}
} }
void Split::doOpenPopupPlayer() void Split::doOpenPopupPlayer()
{ {
qDebug() << "[UNIMPLEMENTED] Open twitch.tv/" SharedChannel _channel = this->channel;
<< QString::fromStdString(this->channelName.getValue()) << "/popout"; twitch::TwitchChannel *tc = dynamic_cast<twitch::TwitchChannel *>(_channel.get());
if (tc != nullptr) {
QDesktopServices::openUrl("https://player.twitch.tv/?channel=" + tc->name);
}
} }
void Split::doOpenStreamlink() void Split::doOpenStreamlink()