disabled twitch dropdown items for irc chats

This commit is contained in:
fourtf 2019-09-11 13:34:59 +02:00
parent b20fdc0da6
commit 158564d0c2

View file

@ -211,9 +211,12 @@ void SplitHeader::initializeLayout()
}), }),
// dropdown // dropdown
this->dropdownButton_ = makeWidget<Button>([&](auto w) { this->dropdownButton_ = makeWidget<Button>([&](auto w) {
/// XXX: this never gets disconnected
this->split_->channelChanged.connect([this] {
auto menu = this->createMainMenu(); auto menu = this->createMainMenu();
this->mainMenu_ = menu.get(); this->mainMenu_ = menu.get();
w->setMenu(std::move(menu)); this->dropdownButton_->setMenu(std::move(menu));
});
}), }),
// add split // add split
this->addButton_ = makeWidget<Button>([&](auto w) { this->addButton_ = makeWidget<Button>([&](auto w) {
@ -275,13 +278,17 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
}); });
#endif #endif
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
{
menu->addAction(OPEN_IN_BROWSER, this->split_, &Split::openInBrowser); menu->addAction(OPEN_IN_BROWSER, this->split_, &Split::openInBrowser);
#ifndef USEWEBENGINE #ifndef USEWEBENGINE
menu->addAction(OPEN_PLAYER_IN_BROWSER, this->split_, menu->addAction(OPEN_PLAYER_IN_BROWSER, this->split_,
&Split::openBrowserPlayer); &Split::openBrowserPlayer);
#endif #endif
menu->addAction(OPEN_IN_STREAMLINK, this->split_, &Split::openInStreamlink); menu->addAction(OPEN_IN_STREAMLINK, this->split_,
&Split::openInStreamlink);
menu->addSeparator(); menu->addSeparator();
}
{ {
// "How to..." sub menu // "How to..." sub menu
@ -294,6 +301,8 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
// sub menu // sub menu
auto moreMenu = new QMenu("More", this); auto moreMenu = new QMenu("More", this);
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
{
moreMenu->addAction("Show viewer list", this->split_, moreMenu->addAction("Show viewer list", this->split_,
&Split::showViewerList); &Split::showViewerList);
@ -313,7 +322,9 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
}); });
moreMenu->addAction(action); moreMenu->addAction(action);
}
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
{ {
auto action = new QAction(this); auto action = new QAction(this);
action->setText("Mute highlight sound"); action->setText("Mute highlight sound");
@ -333,10 +344,14 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
moreMenu->addSeparator(); moreMenu->addSeparator();
moreMenu->addAction("Reconnect", this, SLOT(reconnect())); moreMenu->addAction("Reconnect", this, SLOT(reconnect()));
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
{
moreMenu->addAction("Reload channel emotes", this, moreMenu->addAction("Reload channel emotes", this,
SLOT(reloadChannelEmotes())); SLOT(reloadChannelEmotes()));
moreMenu->addAction("Reload subscriber emotes", this, moreMenu->addAction("Reload subscriber emotes", this,
SLOT(reloadSubscriberEmotes())); SLOT(reloadSubscriberEmotes()));
}
moreMenu->addSeparator(); moreMenu->addSeparator();
moreMenu->addAction("Clear messages", this->split_, &Split::clear); moreMenu->addAction("Clear messages", this->split_, &Split::clear);
// moreMenu->addSeparator(); // moreMenu->addSeparator();