#include "NotificationPage.hpp" #include "Application.hpp" #include "controllers/notifications/NotificationController.hpp" #include "controllers/notifications/NotificationModel.hpp" #include "singletons/Settings.hpp" #include "util/LayoutCreator.hpp" #include "widgets/helper/EditableModelView.hpp" #include #include #include #include #include #include #include namespace chatterino { NotificationPage::NotificationPage() : SettingsPage("Notifications", "") { LayoutCreator layoutCreator(this); auto layout = layoutCreator.emplace().withoutMargin(); { auto tabs = layout.emplace(); { auto settings = tabs.appendTab(new QVBoxLayout, "Options"); { settings.emplace( "Enable for channel next to channel name"); settings.append(this->createCheckBox( "Flash taskbar", getApp()->settings->notificationFlashTaskbar)); settings.append(this->createCheckBox( "Playsound", getApp()->settings->notificationPlaySound)); settings.append(this->createCheckBox( "Enable toasts (currently only for windows)", getApp()->settings->notificationToast)); settings->addStretch(1); } auto twitchChannels = tabs.appendTab(new QVBoxLayout, "Twitch"); { EditableModelView *view = twitchChannels .emplace( getApp()->notifications->createModel( nullptr, Platform::Twitch)) .getElement(); view->setTitles({"Twitch channels"}); view->getTableView()->horizontalHeader()->setSectionResizeMode( QHeaderView::Fixed); view->getTableView()->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch); QTimer::singleShot(1, [view] { view->getTableView()->resizeColumnsToContents(); view->getTableView()->setColumnWidth(0, 200); }); view->addButtonPressed.connect([] { getApp()->notifications->twitchVector.appendItem("channel"); }); } auto mixerChannels = tabs.appendTab(new QVBoxLayout, "Mixer"); { EditableModelView *view = mixerChannels .emplace( getApp()->notifications->createModel( nullptr, Platform::Mixer)) .getElement(); view->setTitles({"Mixer channels"}); view->getTableView()->horizontalHeader()->setSectionResizeMode( QHeaderView::Fixed); view->getTableView()->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch); QTimer::singleShot(1, [view] { view->getTableView()->resizeColumnsToContents(); view->getTableView()->setColumnWidth(0, 200); }); view->addButtonPressed.connect([] { getApp()->notifications->mixerVector.appendItem("channel"); }); } } } } } // namespace chatterino