feat: add channel for messages caught by AutoMod (#4986)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -140,10 +140,27 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
live_lbl->setVisible(enabled);
|
||||
});
|
||||
|
||||
// automod_btn
|
||||
auto automod_btn = vbox.emplace<QRadioButton>("AutoMod").assign(
|
||||
&this->ui_.twitch.automod);
|
||||
auto automod_lbl =
|
||||
vbox.emplace<QLabel>("Shows when AutoMod catches a message in any "
|
||||
"channel you moderate.")
|
||||
.hidden();
|
||||
|
||||
automod_lbl->setWordWrap(true);
|
||||
automod_btn->installEventFilter(&this->tabFilter_);
|
||||
|
||||
QObject::connect(automod_btn.getElement(), &QRadioButton::toggled,
|
||||
[=](bool enabled) mutable {
|
||||
automod_lbl->setVisible(enabled);
|
||||
});
|
||||
|
||||
vbox->addStretch(1);
|
||||
|
||||
// tabbing order
|
||||
QWidget::setTabOrder(live_btn.getElement(), channel_btn.getElement());
|
||||
QWidget::setTabOrder(automod_btn.getElement(),
|
||||
channel_btn.getElement());
|
||||
QWidget::setTabOrder(channel_btn.getElement(),
|
||||
whispers_btn.getElement());
|
||||
QWidget::setTabOrder(whispers_btn.getElement(),
|
||||
@@ -151,6 +168,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
QWidget::setTabOrder(mentions_btn.getElement(),
|
||||
watching_btn.getElement());
|
||||
QWidget::setTabOrder(watching_btn.getElement(), live_btn.getElement());
|
||||
QWidget::setTabOrder(live_btn.getElement(), automod_btn.getElement());
|
||||
|
||||
// tab
|
||||
auto tab = notebook->addPage(obj.getElement());
|
||||
@@ -311,6 +329,11 @@ void SelectChannelDialog::setSelectedChannel(IndirectChannel _channel)
|
||||
this->ui_.twitch.live->setFocus();
|
||||
}
|
||||
break;
|
||||
case Channel::Type::TwitchAutomod: {
|
||||
this->ui_.notebook->selectIndex(TAB_TWITCH);
|
||||
this->ui_.twitch.automod->setFocus();
|
||||
}
|
||||
break;
|
||||
case Channel::Type::Irc: {
|
||||
this->ui_.notebook->selectIndex(TAB_IRC);
|
||||
this->ui_.irc.channel->setText(_channel.get()->getName());
|
||||
@@ -378,6 +401,10 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
|
||||
{
|
||||
return app->twitch->liveChannel;
|
||||
}
|
||||
else if (this->ui_.twitch.automod->isChecked())
|
||||
{
|
||||
return app->twitch->automodChannel;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TAB_IRC: {
|
||||
@@ -442,9 +469,9 @@ bool SelectChannelDialog::EventFilter::eventFilter(QObject *watched,
|
||||
this->dialog->ui_.twitch.whispers->setFocus();
|
||||
return true;
|
||||
}
|
||||
else if (widget == this->dialog->ui_.twitch.live)
|
||||
else if (widget == this->dialog->ui_.twitch.automod)
|
||||
{
|
||||
// Special case for when current selection is "Live" (the last entry in the list), next wrap is Channel, but we need to select its edit box
|
||||
// Special case for when current selection is "AutoMod" (the last entry in the list), next wrap is Channel, but we need to select its edit box
|
||||
this->dialog->ui_.twitch.channel->setFocus();
|
||||
return true;
|
||||
}
|
||||
@@ -463,7 +490,7 @@ bool SelectChannelDialog::EventFilter::eventFilter(QObject *watched,
|
||||
if (widget == this->dialog->ui_.twitch.channelName)
|
||||
{
|
||||
// Special case for when current selection is the "Channel" entry's edit box since the Edit box actually has the focus
|
||||
this->dialog->ui_.twitch.live->setFocus();
|
||||
this->dialog->ui_.twitch.automod->setFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user