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) {
auto menu = this->createMainMenu(); /// XXX: this never gets disconnected
this->mainMenu_ = menu.get(); this->split_->channelChanged.connect([this] {
w->setMenu(std::move(menu)); auto menu = this->createMainMenu();
this->mainMenu_ = menu.get();
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
menu->addAction(OPEN_IN_BROWSER, this->split_, &Split::openInBrowser); if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
{
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_,
menu->addSeparator(); &Split::openInStreamlink);
menu->addSeparator();
}
{ {
// "How to..." sub menu // "How to..." sub menu
@ -294,26 +301,30 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
// sub menu // sub menu
auto moreMenu = new QMenu("More", this); auto moreMenu = new QMenu("More", this);
moreMenu->addAction("Show viewer list", this->split_, if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
&Split::showViewerList); {
moreMenu->addAction("Show viewer list", this->split_,
&Split::showViewerList);
moreMenu->addAction("Subscribe", this->split_, &Split::openSubPage); moreMenu->addAction("Subscribe", this->split_, &Split::openSubPage);
auto action = new QAction(this); auto action = new QAction(this);
action->setText("Notify when live"); action->setText("Notify when live");
action->setCheckable(true); action->setCheckable(true);
QObject::connect(moreMenu, &QMenu::aboutToShow, this, [action, this]() { QObject::connect(moreMenu, &QMenu::aboutToShow, this, [action, this]() {
action->setChecked(getApp()->notifications->isChannelNotified( action->setChecked(getApp()->notifications->isChannelNotified(
this->split_->getChannel()->getName(), Platform::Twitch)); this->split_->getChannel()->getName(), Platform::Twitch));
}); });
action->connect(action, &QAction::triggered, this, [this]() { action->connect(action, &QAction::triggered, this, [this]() {
getApp()->notifications->updateChannelNotification( getApp()->notifications->updateChannelNotification(
this->split_->getChannel()->getName(), Platform::Twitch); this->split_->getChannel()->getName(), Platform::Twitch);
}); });
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()));
moreMenu->addAction("Reload channel emotes", this,
SLOT(reloadChannelEmotes())); if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
moreMenu->addAction("Reload subscriber emotes", this, {
SLOT(reloadSubscriberEmotes())); moreMenu->addAction("Reload channel emotes", this,
SLOT(reloadChannelEmotes()));
moreMenu->addAction("Reload subscriber emotes", this,
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();