mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Merge branch 'master' of https://github.com/fourtf/chatterino2
This commit is contained in:
commit
3ff6eece5c
|
@ -36,6 +36,7 @@ SettingsManager::SettingsManager()
|
||||||
, highlightProperties(this->settingsItems, "highlightProperties",
|
, highlightProperties(this->settingsItems, "highlightProperties",
|
||||||
QMap<QString, QPair<bool, bool>>())
|
QMap<QString, QPair<bool, bool>>())
|
||||||
, highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "")
|
, highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "")
|
||||||
|
, highlightAlwaysPlaySound("/highlighting/alwaysPlaySound", false)
|
||||||
, enableTwitchEmotes(this->settingsItems, "enableTwitchEmotes", true)
|
, enableTwitchEmotes(this->settingsItems, "enableTwitchEmotes", true)
|
||||||
, enableBttvEmotes(this->settingsItems, "enableBttvEmotes", true)
|
, enableBttvEmotes(this->settingsItems, "enableBttvEmotes", true)
|
||||||
, enableFfzEmotes(this->settingsItems, "enableFfzEmotes", true)
|
, enableFfzEmotes(this->settingsItems, "enableFfzEmotes", true)
|
||||||
|
|
|
@ -50,6 +50,7 @@ public:
|
||||||
Setting<QString> pathHighlightSound;
|
Setting<QString> pathHighlightSound;
|
||||||
Setting<QMap<QString, QPair<bool, bool>>> highlightProperties;
|
Setting<QMap<QString, QPair<bool, bool>>> highlightProperties;
|
||||||
Setting<QString> highlightUserBlacklist;
|
Setting<QString> highlightUserBlacklist;
|
||||||
|
pajlada::Settings::Setting<bool> highlightAlwaysPlaySound;
|
||||||
Setting<bool> enableTwitchEmotes;
|
Setting<bool> enableTwitchEmotes;
|
||||||
Setting<bool> enableBttvEmotes;
|
Setting<bool> enableBttvEmotes;
|
||||||
Setting<bool> enableFfzEmotes;
|
Setting<bool> enableFfzEmotes;
|
||||||
|
|
|
@ -412,6 +412,9 @@ void TwitchMessageBuilder::parseHighlights()
|
||||||
bool doHighlight = false;
|
bool doHighlight = false;
|
||||||
bool playSound = false;
|
bool playSound = false;
|
||||||
bool doAlert = false;
|
bool doAlert = false;
|
||||||
|
|
||||||
|
bool hasFocus = (QApplication::focusWidget() != nullptr);
|
||||||
|
|
||||||
if (!blackList.contains(this->ircMessage->nick(), Qt::CaseInsensitive)) {
|
if (!blackList.contains(this->ircMessage->nick(), Qt::CaseInsensitive)) {
|
||||||
for (const Highlight &highlight : activeHighlights) {
|
for (const Highlight &highlight : activeHighlights) {
|
||||||
if (this->originalMessage.contains(highlight.target, Qt::CaseInsensitive)) {
|
if (this->originalMessage.contains(highlight.target, Qt::CaseInsensitive)) {
|
||||||
|
@ -437,7 +440,7 @@ void TwitchMessageBuilder::parseHighlights()
|
||||||
|
|
||||||
this->setHighlight(doHighlight);
|
this->setHighlight(doHighlight);
|
||||||
|
|
||||||
if (playSound) {
|
if (playSound && (!hasFocus || settings.highlightAlwaysPlaySound)) {
|
||||||
player->play();
|
player->play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,69 +72,94 @@ SettingsDialog::SettingsDialog()
|
||||||
|
|
||||||
void SettingsDialog::addTabs()
|
void SettingsDialog::addTabs()
|
||||||
{
|
{
|
||||||
|
this->addTab(this->createAccountsTab(), "Accounts", ":/images/Message_16xLG.png");
|
||||||
|
|
||||||
|
this->addTab(this->createAppearanceTab(), "Appearance",
|
||||||
|
":/images/AppearanceEditorPart_16x.png");
|
||||||
|
|
||||||
|
this->addTab(this->createBehaviourTab(), "Behaviour", ":/images/AppearanceEditorPart_16x.png");
|
||||||
|
|
||||||
|
this->addTab(this->createCommandsTab(), "Commands", ":/images/CustomActionEditor_16x.png");
|
||||||
|
|
||||||
|
this->addTab(this->createEmotesTab(), "Emotes", ":/images/Emoji_Color_1F60A_19.png");
|
||||||
|
|
||||||
|
this->addTab(this->createIgnoredUsersTab(), "Ignored Users",
|
||||||
|
":/images/StatusAnnotations_Blocked_16xLG_color.png");
|
||||||
|
|
||||||
|
this->addTab(this->createIgnoredMessagesTab(), "Ignored Messages", ":/images/Filter_16x.png");
|
||||||
|
|
||||||
|
this->addTab(this->createLinksTab(), "Links", ":/images/VSO_Link_blue_16x.png");
|
||||||
|
|
||||||
|
this->addTab(this->createLogsTab(), "Logs", ":/images/VSO_Link_blue_16x.png");
|
||||||
|
|
||||||
|
this->addTab(this->createHighlightingTab(), "Highlighting", ":/images/format_Bold_16xLG.png");
|
||||||
|
|
||||||
|
this->addTab(this->createWhispersTab(), "Whispers", ":/images/Message_16xLG.png");
|
||||||
|
|
||||||
|
// Add stretch
|
||||||
|
this->ui.tabs.addStretch(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
QVBoxLayout *SettingsDialog::createAccountsTab()
|
||||||
|
{
|
||||||
|
auto layout = new QVBoxLayout();
|
||||||
SettingsManager &settings = SettingsManager::getInstance();
|
SettingsManager &settings = SettingsManager::getInstance();
|
||||||
|
|
||||||
QVBoxLayout *vbox;
|
// add remove buttons
|
||||||
|
auto buttonBox = new QDialogButtonBox(this);
|
||||||
|
|
||||||
// Accounts
|
auto addButton = new QPushButton("Add", this);
|
||||||
vbox = new QVBoxLayout();
|
auto removeButton = new QPushButton("Remove", this);
|
||||||
|
|
||||||
{
|
connect(addButton, &QPushButton::clicked, []() {
|
||||||
// add remove buttons
|
// TODO: fix memory leak :bbaper:
|
||||||
auto buttonBox = new QDialogButtonBox(this);
|
auto loginWidget = new LoginWidget();
|
||||||
|
loginWidget->show();
|
||||||
|
});
|
||||||
|
|
||||||
auto addButton = new QPushButton("Add", this);
|
connect(removeButton, &QPushButton::clicked, []() {
|
||||||
auto removeButton = new QPushButton("Remove", this);
|
qDebug() << "TODO: Implement"; //
|
||||||
|
});
|
||||||
|
|
||||||
connect(addButton, &QPushButton::clicked, []() {
|
buttonBox->addButton(addButton, QDialogButtonBox::YesRole);
|
||||||
// TODO: fix memory leak :bbaper:
|
buttonBox->addButton(removeButton, QDialogButtonBox::NoRole);
|
||||||
auto loginWidget = new LoginWidget();
|
|
||||||
loginWidget->show();
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(removeButton, &QPushButton::clicked, []() {
|
layout->addWidget(buttonBox);
|
||||||
qDebug() << "TODO: Implement"; //
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonBox->addButton(addButton, QDialogButtonBox::YesRole);
|
// listview
|
||||||
buttonBox->addButton(removeButton, QDialogButtonBox::NoRole);
|
auto listWidget = new QListWidget(this);
|
||||||
|
|
||||||
vbox->addWidget(buttonBox);
|
for (auto &user : AccountManager::getInstance().getTwitchUsers()) {
|
||||||
|
listWidget->addItem(user.getUserName());
|
||||||
// listview
|
|
||||||
auto listWidget = new QListWidget(this);
|
|
||||||
|
|
||||||
for (auto &user : AccountManager::getInstance().getTwitchUsers()) {
|
|
||||||
listWidget->addItem(user.getUserName());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listWidget->count() > 0) {
|
|
||||||
const auto ¤tUser = AccountManager::getInstance().getTwitchUser();
|
|
||||||
QString currentUsername = currentUser.getUserName();
|
|
||||||
for (int i = 0; i < listWidget->count(); ++i) {
|
|
||||||
QString itemText = listWidget->item(i)->text();
|
|
||||||
if (itemText.compare(currentUsername, Qt::CaseInsensitive) == 0) {
|
|
||||||
listWidget->setCurrentRow(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject::connect(listWidget, &QListWidget::clicked, this, [&, listWidget] {
|
|
||||||
if (!listWidget->selectedItems().isEmpty()) {
|
|
||||||
AccountManager::getInstance().setCurrentTwitchUser(
|
|
||||||
listWidget->currentItem()->text());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
vbox->addWidget(listWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// vbox->addStretch(1);
|
if (listWidget->count() > 0) {
|
||||||
addTab(vbox, "Accounts", ":/images/Message_16xLG.png");
|
const auto ¤tUser = AccountManager::getInstance().getTwitchUser();
|
||||||
|
QString currentUsername = currentUser.getUserName();
|
||||||
|
for (int i = 0; i < listWidget->count(); ++i) {
|
||||||
|
QString itemText = listWidget->item(i)->text();
|
||||||
|
if (itemText.compare(currentUsername, Qt::CaseInsensitive) == 0) {
|
||||||
|
listWidget->setCurrentRow(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Appearance
|
QObject::connect(listWidget, &QListWidget::clicked, this, [&, listWidget] {
|
||||||
vbox = new QVBoxLayout();
|
if (!listWidget->selectedItems().isEmpty()) {
|
||||||
|
AccountManager::getInstance().setCurrentTwitchUser(listWidget->currentItem()->text());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
layout->addWidget(listWidget);
|
||||||
|
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVBoxLayout *SettingsDialog::createAppearanceTab()
|
||||||
|
{
|
||||||
|
SettingsManager &settings = SettingsManager::getInstance();
|
||||||
|
auto layout = this->createTabLayout();
|
||||||
|
|
||||||
{
|
{
|
||||||
auto group = new QGroupBox("Application");
|
auto group = new QGroupBox("Application");
|
||||||
|
@ -257,7 +282,7 @@ void SettingsDialog::addTabs()
|
||||||
|
|
||||||
group->setLayout(form);
|
group->setLayout(form);
|
||||||
|
|
||||||
vbox->addWidget(group);
|
layout->addWidget(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -287,97 +312,104 @@ void SettingsDialog::addTabs()
|
||||||
|
|
||||||
group->setLayout(v);
|
group->setLayout(v);
|
||||||
|
|
||||||
vbox->addWidget(group);
|
layout->addWidget(group);
|
||||||
}
|
}
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
vbox->addStretch(1);
|
QVBoxLayout *SettingsDialog::createBehaviourTab()
|
||||||
|
{
|
||||||
|
SettingsManager &settings = SettingsManager::getInstance();
|
||||||
|
auto layout = this->createTabLayout();
|
||||||
|
|
||||||
addTab(vbox, "Appearance", ":/images/AppearanceEditorPart_16x.png");
|
auto form = new QFormLayout();
|
||||||
|
|
||||||
// Behaviour
|
form->addRow("Window:", createCheckbox("Window always on top", settings.windowTopMost));
|
||||||
vbox = new QVBoxLayout();
|
// form->addRow("Messages:", createCheckbox("Mention users with a @ (except in
|
||||||
|
// commands)",
|
||||||
|
// settings.mentionUsersWithAt));
|
||||||
|
form->addRow("Messages:", createCheckbox("Hide input box if empty", settings.hideEmptyInput));
|
||||||
|
form->addRow(
|
||||||
|
"", createCheckbox("Show last read message indicator", settings.showLastMessageIndicator));
|
||||||
|
|
||||||
{
|
// auto v = new QVBoxLayout();
|
||||||
auto form = new QFormLayout();
|
// v->addWidget(new QLabel("Mouse scroll speed"));
|
||||||
|
|
||||||
form->addRow("Window:", createCheckbox("Window always on top", settings.windowTopMost));
|
auto scroll = new QSlider(Qt::Horizontal);
|
||||||
// form->addRow("Messages:", createCheckbox("Mention users with a @ (except in
|
form->addRow("Mouse scroll speed:", scroll);
|
||||||
// commands)",
|
|
||||||
// settings.mentionUsersWithAt));
|
|
||||||
form->addRow("Messages:",
|
|
||||||
createCheckbox("Hide input box if empty", settings.hideEmptyInput));
|
|
||||||
form->addRow("", createCheckbox("Show last read message indicator",
|
|
||||||
settings.showLastMessageIndicator));
|
|
||||||
|
|
||||||
// auto v = new QVBoxLayout();
|
form->addRow("Streamlink path:", createLineEdit(settings.streamlinkPath));
|
||||||
// v->addWidget(new QLabel("Mouse scroll speed"));
|
form->addRow(this->createCombobox(
|
||||||
|
"Preferred quality:", settings.preferredQuality,
|
||||||
|
{"Choose", "Source", "High", "Medium", "Low", "Audio only"},
|
||||||
|
[](const QString &newValue, pajlada::Settings::Setting<std::string> &setting) {
|
||||||
|
setting = newValue.toStdString();
|
||||||
|
}));
|
||||||
|
|
||||||
auto scroll = new QSlider(Qt::Horizontal);
|
// v->addWidget(scroll);
|
||||||
form->addRow("Mouse scroll speed:", scroll);
|
// v->addStretch(1);
|
||||||
|
// vbox->addLayout(v);
|
||||||
|
layout->addLayout(form);
|
||||||
|
|
||||||
form->addRow("Streamlink path:", createLineEdit(settings.streamlinkPath));
|
return layout;
|
||||||
form->addRow(this->createCombobox(
|
}
|
||||||
"Preferred quality:", settings.preferredQuality,
|
|
||||||
{"Choose", "Source", "High", "Medium", "Low", "Audio only"},
|
|
||||||
[](const QString &newValue, pajlada::Settings::Setting<std::string> &setting) {
|
|
||||||
setting = newValue.toStdString();
|
|
||||||
}));
|
|
||||||
|
|
||||||
// v->addWidget(scroll);
|
QVBoxLayout *SettingsDialog::createCommandsTab()
|
||||||
// v->addStretch(1);
|
{
|
||||||
// vbox->addLayout(v);
|
auto layout = this->createTabLayout();
|
||||||
vbox->addLayout(form);
|
|
||||||
}
|
|
||||||
|
|
||||||
vbox->addStretch(1);
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
addTab(vbox, "Behaviour", ":/images/AppearanceEditorPart_16x.png");
|
QVBoxLayout *SettingsDialog::createEmotesTab()
|
||||||
|
{
|
||||||
|
SettingsManager &settings = SettingsManager::getInstance();
|
||||||
|
auto layout = this->createTabLayout();
|
||||||
|
|
||||||
// Commands
|
layout->addWidget(createCheckbox("Enable Twitch Emotes", settings.enableTwitchEmotes));
|
||||||
vbox = new QVBoxLayout();
|
layout->addWidget(createCheckbox("Enable BetterTTV Emotes", settings.enableBttvEmotes));
|
||||||
|
layout->addWidget(createCheckbox("Enable FrankerFaceZ Emotes", settings.enableFfzEmotes));
|
||||||
|
layout->addWidget(createCheckbox("Enable Gif Emotes", settings.enableGifs));
|
||||||
|
layout->addWidget(createCheckbox("Enable Emojis", settings.enableEmojis));
|
||||||
|
|
||||||
vbox->addWidget(new QLabel());
|
layout->addWidget(createCheckbox("Enable Twitch Emotes", settings.enableTwitchEmotes));
|
||||||
|
|
||||||
vbox->addStretch(1);
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
addTab(vbox, "Commands", ":/images/CustomActionEditor_16x.png");
|
QVBoxLayout *SettingsDialog::createIgnoredUsersTab()
|
||||||
|
{
|
||||||
|
auto layout = this->createTabLayout();
|
||||||
|
|
||||||
// Emotes
|
return layout;
|
||||||
vbox = new QVBoxLayout();
|
}
|
||||||
|
|
||||||
vbox->addWidget(createCheckbox("Enable Twitch Emotes", settings.enableTwitchEmotes));
|
QVBoxLayout *SettingsDialog::createIgnoredMessagesTab()
|
||||||
vbox->addWidget(createCheckbox("Enable BetterTTV Emotes", settings.enableBttvEmotes));
|
{
|
||||||
vbox->addWidget(createCheckbox("Enable FrankerFaceZ Emotes", settings.enableFfzEmotes));
|
auto layout = this->createTabLayout();
|
||||||
vbox->addWidget(createCheckbox("Enable Gif Emotes", settings.enableGifs));
|
|
||||||
vbox->addWidget(createCheckbox("Enable Emojis", settings.enableEmojis));
|
|
||||||
|
|
||||||
vbox->addWidget(createCheckbox("Enable Twitch Emotes", settings.enableTwitchEmotes));
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
vbox->addStretch(1);
|
QVBoxLayout *SettingsDialog::createLinksTab()
|
||||||
addTab(vbox, "Emotes", ":/images/Emoji_Color_1F60A_19.png");
|
{
|
||||||
|
auto layout = this->createTabLayout();
|
||||||
|
|
||||||
// Ignored Users
|
return layout;
|
||||||
vbox = new QVBoxLayout();
|
}
|
||||||
vbox->addStretch(1);
|
|
||||||
addTab(vbox, "Ignored Users", ":/images/StatusAnnotations_Blocked_16xLG_color.png");
|
|
||||||
|
|
||||||
// Ignored Messages
|
QVBoxLayout *SettingsDialog::createLogsTab()
|
||||||
vbox = new QVBoxLayout();
|
{
|
||||||
vbox->addStretch(1);
|
auto layout = this->createTabLayout();
|
||||||
addTab(vbox, "Ignored Messages", ":/images/Filter_16x.png");
|
|
||||||
|
|
||||||
// Links
|
return layout;
|
||||||
vbox = new QVBoxLayout();
|
}
|
||||||
vbox->addStretch(1);
|
|
||||||
addTab(vbox, "Links", ":/images/VSO_Link_blue_16x.png");
|
|
||||||
|
|
||||||
// Logging
|
QVBoxLayout *SettingsDialog::createHighlightingTab()
|
||||||
vbox = new QVBoxLayout();
|
{
|
||||||
vbox->addStretch(1);
|
SettingsManager &settings = SettingsManager::getInstance();
|
||||||
addTab(vbox, "Logs", ":/images/VSO_Link_blue_16x.png");
|
auto layout = this->createTabLayout();
|
||||||
|
|
||||||
// Highlighting
|
|
||||||
vbox = new QVBoxLayout();
|
|
||||||
auto highlights = new QListWidget();
|
auto highlights = new QListWidget();
|
||||||
auto highlightUserBlacklist = new QTextEdit();
|
auto highlightUserBlacklist = new QTextEdit();
|
||||||
globalHighlights = highlights;
|
globalHighlights = highlights;
|
||||||
|
@ -388,13 +420,13 @@ void SettingsDialog::addTabs()
|
||||||
auto customSound = new QHBoxLayout();
|
auto customSound = new QHBoxLayout();
|
||||||
auto soundForm = new QFormLayout();
|
auto soundForm = new QFormLayout();
|
||||||
{
|
{
|
||||||
vbox->addWidget(createCheckbox("Enable Highlighting", settings.enableHighlights));
|
layout->addWidget(createCheckbox("Enable Highlighting", settings.enableHighlights));
|
||||||
vbox->addWidget(createCheckbox("Highlight messages containing your name",
|
layout->addWidget(createCheckbox("Highlight messages containing your name",
|
||||||
settings.enableHighlightsSelf));
|
settings.enableHighlightsSelf));
|
||||||
vbox->addWidget(createCheckbox("Play sound when your name is mentioned",
|
layout->addWidget(createCheckbox("Play sound when your name is mentioned",
|
||||||
settings.enableHighlightSound));
|
settings.enableHighlightSound));
|
||||||
vbox->addWidget(createCheckbox("Flash taskbar when your name is mentioned",
|
layout->addWidget(createCheckbox("Flash taskbar when your name is mentioned",
|
||||||
settings.enableHighlightTaskbar));
|
settings.enableHighlightTaskbar));
|
||||||
customSound->addWidget(createCheckbox("Custom sound", settings.customHighlightSound));
|
customSound->addWidget(createCheckbox("Custom sound", settings.customHighlightSound));
|
||||||
auto selectBtn = new QPushButton("Select");
|
auto selectBtn = new QPushButton("Select");
|
||||||
QObject::connect(selectBtn, &QPushButton::clicked, this, [&settings, this] {
|
QObject::connect(selectBtn, &QPushButton::clicked, this, [&settings, this] {
|
||||||
|
@ -407,7 +439,6 @@ void SettingsDialog::addTabs()
|
||||||
|
|
||||||
soundForm->addRow(customSound);
|
soundForm->addRow(customSound);
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto hbox = new QHBoxLayout();
|
auto hbox = new QHBoxLayout();
|
||||||
auto addBtn = new QPushButton("Add");
|
auto addBtn = new QPushButton("Add");
|
||||||
|
@ -483,7 +514,10 @@ void SettingsDialog::addTabs()
|
||||||
delete highlights->selectedItems().first();
|
delete highlights->selectedItems().first();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
vbox->addLayout(soundForm);
|
layout->addLayout(soundForm);
|
||||||
|
layout->addWidget(
|
||||||
|
createCheckbox("Always play highlight sound (Even if Chatterino is focused)",
|
||||||
|
settings.highlightAlwaysPlaySound));
|
||||||
auto layoutVbox = new QVBoxLayout();
|
auto layoutVbox = new QVBoxLayout();
|
||||||
auto btnHbox = new QHBoxLayout();
|
auto btnHbox = new QHBoxLayout();
|
||||||
|
|
||||||
|
@ -499,37 +533,37 @@ void SettingsDialog::addTabs()
|
||||||
layoutVbox->addWidget(btnWidget);
|
layoutVbox->addWidget(btnWidget);
|
||||||
highlightWidget->setLayout(layoutVbox);
|
highlightWidget->setLayout(layoutVbox);
|
||||||
|
|
||||||
highlightTab->addTab(highlightWidget,"Highlights");
|
highlightTab->addTab(highlightWidget, "Highlights");
|
||||||
highlightTab->addTab(highlightUserBlacklist,"Disabled Users");
|
highlightTab->addTab(highlightUserBlacklist, "Disabled Users");
|
||||||
vbox->addWidget(highlightTab);
|
layout->addWidget(highlightTab);
|
||||||
|
|
||||||
vbox->addLayout(hbox);
|
layout->addLayout(hbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject::connect(&this->ui.okButton, &QPushButton::clicked, this, [=, &settings](){
|
QObject::connect(&this->ui.okButton, &QPushButton::clicked, this, [=, &settings]() {
|
||||||
QStringList list = highlightUserBlacklist->toPlainText().split("\n",QString::SkipEmptyParts);
|
QStringList list =
|
||||||
|
highlightUserBlacklist->toPlainText().split("\n", QString::SkipEmptyParts);
|
||||||
list.removeDuplicates();
|
list.removeDuplicates();
|
||||||
settings.highlightUserBlacklist.set(list.join("\n") + "\n");
|
settings.highlightUserBlacklist.set(list.join("\n") + "\n");
|
||||||
});
|
});
|
||||||
|
|
||||||
settings.highlightUserBlacklist.valueChanged.connect([=](const QString &str){
|
settings.highlightUserBlacklist.valueChanged.connect(
|
||||||
highlightUserBlacklist->setPlainText(str);
|
[=](const QString &str) { highlightUserBlacklist->setPlainText(str); });
|
||||||
});
|
|
||||||
|
|
||||||
vbox->addStretch(1);
|
return layout;
|
||||||
addTab(vbox, "Highlighting", ":/images/format_Bold_16xLG.png");
|
|
||||||
|
|
||||||
// Whispers
|
|
||||||
vbox = new QVBoxLayout();
|
|
||||||
vbox->addStretch(1);
|
|
||||||
addTab(vbox, "Whispers", ":/images/Message_16xLG.png");
|
|
||||||
|
|
||||||
// Add stretch
|
|
||||||
this->ui.tabs.addStretch(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::addTab(QLayout *layout, QString title, QString imageRes)
|
QVBoxLayout *SettingsDialog::createWhispersTab()
|
||||||
{
|
{
|
||||||
|
auto layout = this->createTabLayout();
|
||||||
|
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::addTab(QBoxLayout *layout, QString title, QString imageRes)
|
||||||
|
{
|
||||||
|
layout->addStretch(1);
|
||||||
|
|
||||||
auto widget = new QWidget();
|
auto widget = new QWidget();
|
||||||
|
|
||||||
widget->setLayout(layout);
|
widget->setLayout(layout);
|
||||||
|
@ -572,6 +606,13 @@ void SettingsDialog::showDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Widget creation helpers
|
/// Widget creation helpers
|
||||||
|
QVBoxLayout *SettingsDialog::createTabLayout()
|
||||||
|
{
|
||||||
|
auto layout = new QVBoxLayout();
|
||||||
|
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
QCheckBox *SettingsDialog::createCheckbox(const QString &title, Setting<bool> &setting)
|
QCheckBox *SettingsDialog::createCheckbox(const QString &title, Setting<bool> &setting)
|
||||||
{
|
{
|
||||||
auto checkbox = new QCheckBox(title);
|
auto checkbox = new QCheckBox(title);
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
void select(SettingsDialogTab *tab);
|
void select(SettingsDialogTab *tab);
|
||||||
|
|
||||||
static void showDialog();
|
static void showDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SettingsSnapshot snapshot;
|
SettingsSnapshot snapshot;
|
||||||
|
|
||||||
|
@ -45,23 +46,36 @@ private:
|
||||||
QPushButton cancelButton;
|
QPushButton cancelButton;
|
||||||
} ui;
|
} ui;
|
||||||
|
|
||||||
void addTab(QLayout *layout, QString title, QString imageRes);
|
void addTab(QBoxLayout *layout, QString title, QString imageRes);
|
||||||
|
|
||||||
void addTabs();
|
void addTabs();
|
||||||
|
QVBoxLayout *createAccountsTab();
|
||||||
|
QVBoxLayout *createAppearanceTab();
|
||||||
|
QVBoxLayout *createMessagesTab();
|
||||||
|
QVBoxLayout *createBehaviourTab();
|
||||||
|
QVBoxLayout *createCommandsTab();
|
||||||
|
QVBoxLayout *createEmotesTab();
|
||||||
|
QVBoxLayout *createIgnoredUsersTab();
|
||||||
|
QVBoxLayout *createIgnoredMessagesTab();
|
||||||
|
QVBoxLayout *createLinksTab();
|
||||||
|
QVBoxLayout *createLogsTab();
|
||||||
|
QVBoxLayout *createHighlightingTab();
|
||||||
|
QVBoxLayout *createWhispersTab();
|
||||||
|
|
||||||
SettingsDialogTab *selectedTab = nullptr;
|
SettingsDialogTab *selectedTab = nullptr;
|
||||||
|
|
||||||
QListWidget *globalHighlights;
|
QListWidget *globalHighlights;
|
||||||
|
|
||||||
/// Widget creation helpers
|
/// Widget creation helpers
|
||||||
|
QVBoxLayout *createTabLayout();
|
||||||
QCheckBox *createCheckbox(const QString &title, Setting<bool> &setting);
|
QCheckBox *createCheckbox(const QString &title, Setting<bool> &setting);
|
||||||
QCheckBox *createCheckbox(const QString &title, pajlada::Settings::Setting<bool> &setting);
|
QCheckBox *createCheckbox(const QString &title, pajlada::Settings::Setting<bool> &setting);
|
||||||
QHBoxLayout *createCombobox(const QString &title, pajlada::Settings::Setting<int> &setting,
|
QHBoxLayout *createCombobox(const QString &title, pajlada::Settings::Setting<int> &setting,
|
||||||
QStringList items,
|
QStringList items,
|
||||||
std::function<void(QString, pajlada::Settings::Setting<int> &)> cb);
|
std::function<void(QString, pajlada::Settings::Setting<int> &)> cb);
|
||||||
QHBoxLayout *createCombobox(const QString &title, pajlada::Settings::Setting<std::string> &setting,
|
QHBoxLayout *createCombobox(
|
||||||
QStringList items,
|
const QString &title, pajlada::Settings::Setting<std::string> &setting, QStringList items,
|
||||||
std::function<void(QString, pajlada::Settings::Setting<std::string> &)> cb);
|
std::function<void(QString, pajlada::Settings::Setting<std::string> &)> cb);
|
||||||
QLineEdit *createLineEdit(pajlada::Settings::Setting<std::string> &setting);
|
QLineEdit *createLineEdit(pajlada::Settings::Setting<std::string> &setting);
|
||||||
|
|
||||||
void okButtonClicked();
|
void okButtonClicked();
|
||||||
|
|
Loading…
Reference in a new issue