mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
refactored the ignores page a bit
This commit is contained in:
parent
1da23e5e91
commit
80c8e11cec
|
@ -404,7 +404,7 @@ HEADERS += \
|
||||||
src/widgets/settingspages/FeelPage.hpp \
|
src/widgets/settingspages/FeelPage.hpp \
|
||||||
src/util/InitUpdateButton.hpp \
|
src/util/InitUpdateButton.hpp \
|
||||||
src/widgets/dialogs/UpdateDialog.hpp \
|
src/widgets/dialogs/UpdateDialog.hpp \
|
||||||
src/widgets/settingspages/IgnorePage.hpp
|
src/widgets/settingspages/IgnoresPage.hpp
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources/resources.qrc \
|
resources/resources.qrc \
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "widgets/settingspages/ExternalToolsPage.hpp"
|
#include "widgets/settingspages/ExternalToolsPage.hpp"
|
||||||
#include "widgets/settingspages/FeelPage.hpp"
|
#include "widgets/settingspages/FeelPage.hpp"
|
||||||
#include "widgets/settingspages/HighlightingPage.hpp"
|
#include "widgets/settingspages/HighlightingPage.hpp"
|
||||||
#include "widgets/settingspages/IgnorePage.hpp"
|
#include "widgets/settingspages/IgnoresPage.hpp"
|
||||||
#include "widgets/settingspages/KeyboardSettingsPage.hpp"
|
#include "widgets/settingspages/KeyboardSettingsPage.hpp"
|
||||||
#include "widgets/settingspages/LogsPage.hpp"
|
#include "widgets/settingspages/LogsPage.hpp"
|
||||||
#include "widgets/settingspages/LookPage.hpp"
|
#include "widgets/settingspages/LookPage.hpp"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
BrowserExtensionPage::BrowserExtensionPage()
|
BrowserExtensionPage::BrowserExtensionPage()
|
||||||
: SettingsPage("Browser Extension", "")
|
: SettingsPage("Browser integration", "")
|
||||||
{
|
{
|
||||||
auto layout = LayoutCreator<BrowserExtensionPage>(this).setLayoutType<QVBoxLayout>();
|
auto layout = LayoutCreator<BrowserExtensionPage>(this).setLayoutType<QVBoxLayout>();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "IgnorePage.hpp"
|
#include "IgnoresPage.hpp"
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "controllers/accounts/AccountController.hpp"
|
#include "controllers/accounts/AccountController.hpp"
|
||||||
|
@ -23,53 +23,32 @@
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
|
static void addPhrasesTab(LayoutCreator<QVBoxLayout> box);
|
||||||
|
static void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> box, QStringListModel &model);
|
||||||
|
|
||||||
IgnoresPage::IgnoresPage()
|
IgnoresPage::IgnoresPage()
|
||||||
: SettingsPage("Ignores", "")
|
: SettingsPage("Ignores", "")
|
||||||
{
|
{
|
||||||
auto app = getApp();
|
|
||||||
|
|
||||||
LayoutCreator<IgnoresPage> layoutCreator(this);
|
LayoutCreator<IgnoresPage> layoutCreator(this);
|
||||||
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
||||||
|
|
||||||
// auto group = layout.emplace<QGroupBox>("Ignored users").setLayoutType<QVBoxLayout>();
|
|
||||||
auto tabs = layout.emplace<QTabWidget>();
|
auto tabs = layout.emplace<QTabWidget>();
|
||||||
// tabs->setStyleSheet("color: #000");
|
|
||||||
|
|
||||||
// users
|
addPhrasesTab(tabs.appendTab(new QVBoxLayout, "Phrases"));
|
||||||
auto users = tabs.appendTab(new QVBoxLayout, "Users");
|
addUsersTab(*this, tabs.appendTab(new QVBoxLayout, "Users"), this->userListModel);
|
||||||
{
|
|
||||||
users.append(this->createCheckBox("Enable twitch ignored users",
|
|
||||||
app->settings->enableTwitchIgnoredUsers));
|
|
||||||
|
|
||||||
auto anyways = users.emplace<QHBoxLayout>().withoutMargin();
|
auto label = layout.emplace<QLabel>(INFO);
|
||||||
{
|
label->setWordWrap(true);
|
||||||
anyways.emplace<QLabel>("Show anyways if:");
|
label->setStyleSheet("color: #BBB");
|
||||||
anyways.emplace<QComboBox>();
|
}
|
||||||
anyways->addStretch(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto addremove = users.emplace<QHBoxLayout>().withoutMargin();
|
void addPhrasesTab(LayoutCreator<QVBoxLayout> layout)
|
||||||
{
|
{
|
||||||
auto add = addremove.emplace<QPushButton>("Ignore user");
|
|
||||||
auto remove = addremove.emplace<QPushButton>("Unignore User");
|
|
||||||
UNUSED(add); // TODO: Add on-clicked event
|
|
||||||
UNUSED(remove); // TODO: Add on-clicked event
|
|
||||||
addremove->addStretch(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
users.emplace<QListView>()->setModel(&this->userListModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
// messages
|
|
||||||
auto messages = tabs.appendTab(new QVBoxLayout, "Messages");
|
|
||||||
{
|
|
||||||
EditableModelView *view =
|
EditableModelView *view =
|
||||||
messages.emplace<EditableModelView>(app->ignores->createModel(nullptr)).getElement();
|
layout.emplace<EditableModelView>(getApp()->ignores->createModel(nullptr)).getElement();
|
||||||
view->setTitles({"Pattern", "Regex"});
|
view->setTitles({"Pattern", "Regex"});
|
||||||
view->getTableView()->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
|
view->getTableView()->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
|
||||||
view->getTableView()->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
view->getTableView()->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||||
|
|
||||||
// fourtf: make class extrend BaseWidget and add this to dpiChanged
|
|
||||||
QTimer::singleShot(1, [view] {
|
QTimer::singleShot(1, [view] {
|
||||||
view->getTableView()->resizeColumnsToContents();
|
view->getTableView()->resizeColumnsToContents();
|
||||||
view->getTableView()->setColumnWidth(0, 200);
|
view->getTableView()->setColumnWidth(0, 200);
|
||||||
|
@ -78,11 +57,28 @@ IgnoresPage::IgnoresPage()
|
||||||
view->addButtonPressed.connect([] {
|
view->addButtonPressed.connect([] {
|
||||||
getApp()->ignores->phrases.appendItem(IgnorePhrase{"my phrase", false});
|
getApp()->ignores->phrases.appendItem(IgnorePhrase{"my phrase", false});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> users, QStringListModel &userModel)
|
||||||
|
{
|
||||||
|
users.append(page.createCheckBox("Enable twitch ignored users",
|
||||||
|
getApp()->settings->enableTwitchIgnoredUsers));
|
||||||
|
|
||||||
|
auto anyways = users.emplace<QHBoxLayout>().withoutMargin();
|
||||||
|
{
|
||||||
|
anyways.emplace<QLabel>("Show anyways if:");
|
||||||
|
anyways.emplace<QComboBox>();
|
||||||
|
anyways->addStretch(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto label = layout.emplace<QLabel>(INFO);
|
/*auto addremove = users.emplace<QHBoxLayout>().withoutMargin();
|
||||||
label->setWordWrap(true);
|
{
|
||||||
label->setStyleSheet("color: #BBB");
|
auto add = addremove.emplace<QPushButton>("Ignore user");
|
||||||
|
auto remove = addremove.emplace<QPushButton>("Unignore User");
|
||||||
|
addremove->addStretch(1);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
users.emplace<QListView>()->setModel(&userModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IgnoresPage::onShow()
|
void IgnoresPage::onShow()
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include <QStringListModel>
|
#include <QStringListModel>
|
||||||
|
|
||||||
|
class QVBoxLayout;
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
class IgnoresPage : public SettingsPage
|
class IgnoresPage : public SettingsPage
|
|
@ -15,10 +15,6 @@ class LookPage : public SettingsPage
|
||||||
public:
|
public:
|
||||||
LookPage();
|
LookPage();
|
||||||
|
|
||||||
void addApplicationGroup(QVBoxLayout &layout);
|
|
||||||
void addMessagesGroup(QVBoxLayout &layout);
|
|
||||||
void addEmotesGroup(QVBoxLayout &layout);
|
|
||||||
|
|
||||||
QLayout *createThemeColorChanger();
|
QLayout *createThemeColorChanger();
|
||||||
QLayout *createFontChanger();
|
QLayout *createFontChanger();
|
||||||
QLayout *createUiScaleSlider();
|
QLayout *createUiScaleSlider();
|
||||||
|
|
Loading…
Reference in a new issue