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
this->dropdownButton_ = makeWidget<Button>([&](auto w) {
auto menu = this->createMainMenu();
this->mainMenu_ = menu.get();
w->setMenu(std::move(menu));
/// XXX: this never gets disconnected
this->split_->channelChanged.connect([this] {
auto menu = this->createMainMenu();
this->mainMenu_ = menu.get();
this->dropdownButton_->setMenu(std::move(menu));
});
}),
// add split
this->addButton_ = makeWidget<Button>([&](auto w) {
@ -275,13 +278,17 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
});
#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
menu->addAction(OPEN_PLAYER_IN_BROWSER, this->split_,
&Split::openBrowserPlayer);
menu->addAction(OPEN_PLAYER_IN_BROWSER, this->split_,
&Split::openBrowserPlayer);
#endif
menu->addAction(OPEN_IN_STREAMLINK, this->split_, &Split::openInStreamlink);
menu->addSeparator();
menu->addAction(OPEN_IN_STREAMLINK, this->split_,
&Split::openInStreamlink);
menu->addSeparator();
}
{
// "How to..." sub menu
@ -294,26 +301,30 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
// sub menu
auto moreMenu = new QMenu("More", this);
moreMenu->addAction("Show viewer list", this->split_,
&Split::showViewerList);
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
{
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);
action->setText("Notify when live");
action->setCheckable(true);
auto action = new QAction(this);
action->setText("Notify when live");
action->setCheckable(true);
QObject::connect(moreMenu, &QMenu::aboutToShow, this, [action, this]() {
action->setChecked(getApp()->notifications->isChannelNotified(
this->split_->getChannel()->getName(), Platform::Twitch));
});
action->connect(action, &QAction::triggered, this, [this]() {
getApp()->notifications->updateChannelNotification(
this->split_->getChannel()->getName(), Platform::Twitch);
});
QObject::connect(moreMenu, &QMenu::aboutToShow, this, [action, this]() {
action->setChecked(getApp()->notifications->isChannelNotified(
this->split_->getChannel()->getName(), Platform::Twitch));
});
action->connect(action, &QAction::triggered, this, [this]() {
getApp()->notifications->updateChannelNotification(
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);
action->setText("Mute highlight sound");
@ -333,10 +344,14 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
moreMenu->addSeparator();
moreMenu->addAction("Reconnect", this, SLOT(reconnect()));
moreMenu->addAction("Reload channel emotes", this,
SLOT(reloadChannelEmotes()));
moreMenu->addAction("Reload subscriber emotes", this,
SLOT(reloadSubscriberEmotes()));
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
{
moreMenu->addAction("Reload channel emotes", this,
SLOT(reloadChannelEmotes()));
moreMenu->addAction("Reload subscriber emotes", this,
SLOT(reloadSubscriberEmotes()));
}
moreMenu->addSeparator();
moreMenu->addAction("Clear messages", this->split_, &Split::clear);
// moreMenu->addSeparator();