2018-08-09 15:41:03 +02:00
|
|
|
#include "NotificationPage.hpp"
|
|
|
|
|
|
|
|
#include "Application.hpp"
|
2018-08-10 00:04:50 +02:00
|
|
|
#include "controllers/notifications/NotificationController.hpp"
|
|
|
|
#include "controllers/notifications/NotificationModel.hpp"
|
2018-08-09 15:41:03 +02:00
|
|
|
#include "singletons/Settings.hpp"
|
|
|
|
#include "util/LayoutCreator.hpp"
|
|
|
|
#include "widgets/helper/EditableModelView.hpp"
|
|
|
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QHeaderView>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QListView>
|
|
|
|
#include <QTableView>
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
NotificationPage::NotificationPage()
|
|
|
|
: SettingsPage("Notifications", "")
|
|
|
|
{
|
|
|
|
LayoutCreator<NotificationPage> layoutCreator(this);
|
|
|
|
|
|
|
|
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
|
|
|
{
|
|
|
|
auto tabs = layout.emplace<QTabWidget>();
|
|
|
|
{
|
|
|
|
auto settings = tabs.appendTab(new QVBoxLayout, "Options");
|
|
|
|
{
|
|
|
|
settings.emplace<QLabel>(
|
|
|
|
"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->addStretch(1);
|
|
|
|
}
|
2018-08-12 15:29:40 +02:00
|
|
|
auto twitchChannels = tabs.appendTab(new QVBoxLayout, "Twitch");
|
2018-08-09 15:41:03 +02:00
|
|
|
{
|
2018-08-12 15:29:40 +02:00
|
|
|
int i = 0;
|
2018-08-09 15:41:03 +02:00
|
|
|
EditableModelView *view =
|
2018-08-12 15:29:40 +02:00
|
|
|
twitchChannels
|
2018-08-09 15:41:03 +02:00
|
|
|
.emplace<EditableModelView>(
|
2018-08-12 15:29:40 +02:00
|
|
|
getApp()->notifications->createModel(nullptr, i))
|
2018-08-09 15:41:03 +02:00
|
|
|
.getElement();
|
2018-08-12 15:29:40 +02:00
|
|
|
view->setTitles({"Twitch channels"});
|
2018-08-09 15:41:03 +02:00
|
|
|
|
|
|
|
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([] {
|
2018-08-12 15:29:40 +02:00
|
|
|
getApp()->notifications->twitchVector.appendItem("channel");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
auto mixerChannels = tabs.appendTab(new QVBoxLayout, "Mixer");
|
|
|
|
{
|
|
|
|
int i = 1;
|
|
|
|
EditableModelView *view =
|
|
|
|
mixerChannels
|
|
|
|
.emplace<EditableModelView>(
|
|
|
|
getApp()->notifications->createModel(nullptr, i))
|
|
|
|
.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");
|
2018-08-09 15:41:03 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // namespace chatterino
|