From 0b49f696ce0fe28d442398d1006d4729c3271002 Mon Sep 17 00:00:00 2001 From: fourtf Date: Sun, 1 Sep 2019 23:23:20 +0200 Subject: [PATCH 01/11] added filtering to general page and greying out some items to the other pages --- resources/qss/settings.qss | 7 +- src/widgets/dialogs/SettingsDialog.cpp | 24 ++++--- src/widgets/dialogs/SettingsDialog.hpp | 4 ++ src/widgets/settingspages/GeneralPage.cpp | 80 ++++++++++++++++++---- src/widgets/settingspages/GeneralPage.hpp | 31 +++++---- src/widgets/settingspages/SettingsPage.cpp | 45 +++++++++++- src/widgets/settingspages/SettingsPage.hpp | 29 ++++++++ 7 files changed, 175 insertions(+), 45 deletions(-) diff --git a/resources/qss/settings.qss b/resources/qss/settings.qss index 54f1b599b..32d571924 100644 --- a/resources/qss/settings.qss +++ b/resources/qss/settings.qss @@ -34,12 +34,7 @@ chatterino--TitleLabel { font-family: "Segoe UI light"; font-size: 24px; color: #4FC3F7; -} - -chatterino--TitleLabel2 { - font-family: "Segoe UI light"; - font-size: 24px; - color: #bbb; + margin-top: 16px; } chatterino--DescriptionLabel { diff --git a/src/widgets/dialogs/SettingsDialog.cpp b/src/widgets/dialogs/SettingsDialog.cpp index 69536bede..2474ac26a 100644 --- a/src/widgets/dialogs/SettingsDialog.cpp +++ b/src/widgets/dialogs/SettingsDialog.cpp @@ -22,6 +22,7 @@ #include "widgets/settingspages/SpecialChannelsPage.hpp" #include +#include namespace chatterino { @@ -61,6 +62,19 @@ void SettingsDialog::initUi() // right side layout auto right = layoutCreator.emplace().withoutMargin(); { + auto title = right.emplace().withoutMargin(); + + auto edit = title.emplace().assign(&this->ui_.search); + QTimer::singleShot(100, edit.getElement(), + [edit = edit.getElement()]() { edit->setFocus(); }); + QObject::connect(edit.getElement(), &QLineEdit::textChanged, this, + [this](const QString &text) { + for (auto &&page : this->pages_) + { + page->filterElements(text); + } + }); + right.emplace() .assign(&this->ui_.pageStack) .withoutMargin(); @@ -104,26 +118,17 @@ void SettingsDialog::addTabs() this->addTab(new AccountsPage); - // this->ui_.tabContainer->addSpacing(16); - - // this->addTab(new LookPage); - // this->addTab(new FeelPage); - this->ui_.tabContainer->addSpacing(16); this->addTab(new CommandPage); - // this->addTab(new EmotesPage); this->addTab(new HighlightingPage); this->addTab(new IgnoresPage); this->ui_.tabContainer->addSpacing(16); this->addTab(new KeyboardSettingsPage); - // this->addTab(new LogsPage); this->addTab(this->ui_.moderationPage = new ModerationPage); this->addTab(new NotificationPage); - // this->addTab(new SpecialChannelsPage); - // this->addTab(new BrowserExtensionPage); this->addTab(new ExternalToolsPage); this->addTab(new AdvancedPage); @@ -140,6 +145,7 @@ void SettingsDialog::addTab(SettingsPage *page, Qt::Alignment alignment) this->ui_.pageStack->addWidget(page); this->ui_.tabContainer->addWidget(tab, 0, alignment); this->tabs_.push_back(tab); + this->pages_.push_back(page); if (this->tabs_.size() == 1) { diff --git a/src/widgets/dialogs/SettingsDialog.hpp b/src/widgets/dialogs/SettingsDialog.hpp index e5bc06595..e637fa280 100644 --- a/src/widgets/dialogs/SettingsDialog.hpp +++ b/src/widgets/dialogs/SettingsDialog.hpp @@ -8,6 +8,8 @@ #include #include +class QLineEdit; + namespace chatterino { class SettingsPage; @@ -54,8 +56,10 @@ private: QPushButton *okButton{}; QPushButton *cancelButton{}; ModerationPage *moderationPage{}; + QLineEdit *search{}; } ui_; std::vector tabs_; + std::vector pages_; SettingsDialogTab *selectedTab_{}; friend class SettingsDialogTab; diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 6ee10777a..8081b2b93 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -36,20 +36,13 @@ TitleLabel *SettingsLayout::addTitle(const QString &title) { auto label = new TitleLabel(title + ":"); - if (this->count() != 0) - this->addSpacing(16); - + if (this->count() == 0) + label->setStyleSheet("margin-top: 0"); this->addWidget(label); - return label; -} -TitleLabel2 *SettingsLayout::addTitle2(const QString &title) -{ - auto label = new TitleLabel2(title + ":"); + // groups + this->groups_.push_back(Group{title, label, {}}); - this->addSpacing(16); - - this->addWidget(label); return label; } @@ -71,6 +64,10 @@ QCheckBox *SettingsLayout::addCheckbox(const QString &text, [&setting, inverse](bool state) { setting = inverse ^ state; }); this->addWidget(check); + + // groups + this->groups_.back().widgets.push_back({check, {text}}); + return check; } @@ -82,11 +79,17 @@ ComboBox *SettingsLayout::addDropdown(const QString &text, combo->setFocusPolicy(Qt::StrongFocus); combo->addItems(list); - layout->addWidget(new QLabel(text + ":")); + auto label = new QLabel(text + ":"); + layout->addWidget(label); layout->addStretch(1); layout->addWidget(combo); this->addLayout(layout); + + // groups + this->groups_.back().widgets.push_back({combo, {text}}); + this->groups_.back().widgets.push_back({label, {text}}); + return combo; } @@ -124,6 +127,9 @@ DescriptionLabel *SettingsLayout::addDescription(const QString &text) this->addWidget(label); + // groups + this->groups_.back().widgets.push_back({label, {text}}); + return label; } @@ -132,6 +138,43 @@ void SettingsLayout::addSeperator() this->addWidget(new Line(false)); } +void SettingsLayout::filterElements(const QString &query) +{ + for (auto &&group : this->groups_) + { + // if group name matches then all should be visible + if (group.name.contains(query, Qt::CaseInsensitive)) + { + for (auto &&widget : group.widgets) + widget.element->show(); + group.title->show(); + } + // check if any match + else + { + auto any = false; + + for (auto &&widget : group.widgets) + { + for (auto &&keyword : widget.keywords) + { + if (keyword.contains(query, Qt::CaseInsensitive)) + { + widget.element->show(); + any = true; + } + else + { + widget.element->hide(); + } + } + } + + group.title->setVisible(any); + } + } +} + GeneralPage::GeneralPage() : SettingsPage("General", ":/settings/about.svg") { @@ -141,6 +184,7 @@ GeneralPage::GeneralPage() y->addWidget(scroll); auto x = new QHBoxLayout; auto layout = new SettingsLayout; + this->settingsLayout_ = layout; x->addLayout(layout, 0); x->addStretch(1); auto z = new QFrame; @@ -155,6 +199,12 @@ GeneralPage::GeneralPage() this->initExtra(); } +void GeneralPage::filterElements(const QString &query) +{ + if (this->settingsLayout_) + this->settingsLayout_->filterElements(query); +} + void GeneralPage::initLayout(SettingsLayout &layout) { auto &s = *getSettings(); @@ -284,7 +334,7 @@ void GeneralPage::initLayout(SettingsLayout &layout) layout.addCheckbox("Chatterino", getSettings()->showBadgesChatterino); layout.addTitle("Chat title"); - layout.addWidget(new QLabel("In live channels show:")); + layout.addDescription("In live channels show:"); layout.addCheckbox("Uptime", s.headerUptime); layout.addCheckbox("Viewer count", s.headerViewerCount); layout.addCheckbox("Category", s.headerGame); @@ -345,10 +395,10 @@ void GeneralPage::initLayout(SettingsLayout &layout) void GeneralPage::initExtra() { /// update cache path - if (this->cachePath) + if (this->cachePath_) { getSettings()->cachePath.connect( - [cachePath = this->cachePath](const auto &, auto) mutable { + [cachePath = this->cachePath_](const auto &, auto) mutable { QString newPath = getPaths()->cacheDirectory(); QString pathShortened = "Current location: widgets; + }; + + std::vector groups_; std::vector managedConnections_; }; @@ -154,13 +156,16 @@ class GeneralPage : public SettingsPage public: GeneralPage(); + void filterElements(const QString &query); + private: void initLayout(SettingsLayout &layout); void initExtra(); QString getFont(const DropdownArgs &args) const; - DescriptionLabel *cachePath{}; + DescriptionLabel *cachePath_{}; + SettingsLayout *settingsLayout_{}; }; } // namespace chatterino diff --git a/src/widgets/settingspages/SettingsPage.cpp b/src/widgets/settingspages/SettingsPage.cpp index 01af44538..4b0d147f1 100644 --- a/src/widgets/settingspages/SettingsPage.cpp +++ b/src/widgets/settingspages/SettingsPage.cpp @@ -5,15 +5,56 @@ #include #include +#include namespace chatterino { +void filterItemsRec(QObject *object, const QString &query) +{ + for (auto &&child : object->children()) + { + auto setOpacity = [=](auto *widget, bool condition) { + widget->greyedOut = !condition; + widget->update(); + }; + + if (auto x = dynamic_cast(child); x) + { + setOpacity(x, x->text().contains(query, Qt::CaseInsensitive)); + } + else if (auto x = dynamic_cast(child); x) + { + setOpacity(x, x->text().contains(query, Qt::CaseInsensitive)); + } + else if (auto x = dynamic_cast(child); x) + { + setOpacity(x, [=]() { + for (int i = 0; i < x->count(); i++) + { + if (x->itemText(i).contains(query, Qt::CaseInsensitive)) + return true; + } + return false; + }()); + } + else + { + filterItemsRec(child, query); + } + } +} + SettingsPage::SettingsPage(const QString &name, const QString &iconResource) : name_(name) , iconResource_(iconResource) { } +void SettingsPage::filterElements(const QString &query) +{ + filterItemsRec(this, query); +} + const QString &SettingsPage::getName() { return this->name_; @@ -42,7 +83,7 @@ void SettingsPage::cancel() QCheckBox *SettingsPage::createCheckBox( const QString &text, pajlada::Settings::Setting &setting) { - QCheckBox *checkbox = new QCheckBox(text); + QCheckBox *checkbox = new SCheckBox(text); // update when setting changes setting.connect( @@ -64,7 +105,7 @@ QCheckBox *SettingsPage::createCheckBox( QComboBox *SettingsPage::createComboBox( const QStringList &items, pajlada::Settings::Setting &setting) { - QComboBox *combo = new QComboBox(); + QComboBox *combo = new SComboBox(); // update setting on toogle combo->addItems(items); diff --git a/src/widgets/settingspages/SettingsPage.hpp b/src/widgets/settingspages/SettingsPage.hpp index 79d3a7240..1678b34f8 100644 --- a/src/widgets/settingspages/SettingsPage.hpp +++ b/src/widgets/settingspages/SettingsPage.hpp @@ -8,8 +8,35 @@ #include "singletons/Settings.hpp" +#define SETTINGS_PAGE_WIDGET_BOILERPLATE(type, parent) \ + class type : public parent \ + { \ + using parent::parent; \ + \ + public: \ + bool greyedOut{}; \ + \ + protected: \ + void paintEvent(QPaintEvent *e) override \ + { \ + parent::paintEvent(e); \ + \ + if (this->greyedOut) \ + { \ + QPainter painter(this); \ + QColor color = QColor("#222222"); \ + color.setAlphaF(0.7); \ + painter.fillRect(this->rect(), color); \ + } \ + } \ + }; + namespace chatterino { +SETTINGS_PAGE_WIDGET_BOILERPLATE(SCheckBox, QCheckBox) +SETTINGS_PAGE_WIDGET_BOILERPLATE(SLabel, QLabel) +SETTINGS_PAGE_WIDGET_BOILERPLATE(SComboBox, QComboBox) + class SettingsDialogTab; class SettingsPage : public QFrame @@ -22,6 +49,8 @@ public: const QString &getName(); const QString &getIconResource(); + virtual void filterElements(const QString &query); + SettingsDialogTab *tab() const; void setTab(SettingsDialogTab *tab); From 54c26d22281fcacde8e018f257cecd4ce3866134 Mon Sep 17 00:00:00 2001 From: fourtf Date: Mon, 2 Sep 2019 09:44:25 +0200 Subject: [PATCH 02/11] fixed width when searching --- resources/qss/settings.qss | 2 +- src/widgets/settingspages/GeneralPage.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/qss/settings.qss b/resources/qss/settings.qss index 32d571924..ec6da9e9b 100644 --- a/resources/qss/settings.qss +++ b/resources/qss/settings.qss @@ -8,7 +8,7 @@ QCheckBox::indicator { } chatterino--ComboBox { - width: 100px; + width: 120px; } QScrollArea { diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 8081b2b93..57f25a9c1 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -390,7 +390,12 @@ void GeneralPage::initLayout(SettingsLayout &layout) layout.addDescription( createNamedLink(FIREFOX_EXTENSION_LINK, "Download for Firefox")); #endif -} // namespace chatterino + + // invisible element for width + auto inv = new BaseWidget(this); + inv->setScaleIndependantWidth(500); + layout.addWidget(inv); +} void GeneralPage::initExtra() { From b0459ba646c789a06890e294827c32f8f70f39dc Mon Sep 17 00:00:00 2001 From: fourtf Date: Mon, 2 Sep 2019 16:39:21 +0200 Subject: [PATCH 03/11] add basic hiding of SettingsTabs --- src/widgets/dialogs/SettingsDialog.cpp | 32 +++++++++++++++++----- src/widgets/settingspages/GeneralPage.cpp | 19 +++++++++---- src/widgets/settingspages/GeneralPage.hpp | 4 +-- src/widgets/settingspages/SettingsPage.cpp | 15 ++++++---- src/widgets/settingspages/SettingsPage.hpp | 2 +- 5 files changed, 51 insertions(+), 21 deletions(-) diff --git a/src/widgets/dialogs/SettingsDialog.cpp b/src/widgets/dialogs/SettingsDialog.cpp index 2474ac26a..3a695eb89 100644 --- a/src/widgets/dialogs/SettingsDialog.cpp +++ b/src/widgets/dialogs/SettingsDialog.cpp @@ -67,13 +67,31 @@ void SettingsDialog::initUi() auto edit = title.emplace().assign(&this->ui_.search); QTimer::singleShot(100, edit.getElement(), [edit = edit.getElement()]() { edit->setFocus(); }); - QObject::connect(edit.getElement(), &QLineEdit::textChanged, this, - [this](const QString &text) { - for (auto &&page : this->pages_) - { - page->filterElements(text); - } - }); + QObject::connect( + edit.getElement(), &QLineEdit::textChanged, this, + [this](const QString &text) { + // filter elements and hide pages + for (auto &&page : this->pages_) + { + // filterElements returns true if anything on the page matches the search query + page->tab()->setVisible(page->filterElements(text)); + } + + // TODO: add originally selected page + + // find next visible page + if (!this->selectedTab_->isVisible()) + { + for (auto &&tab : this->tabs_) + { + if (tab->isVisible()) + { + this->selectTab(tab); + break; + } + } + } + }); right.emplace() .assign(&this->ui_.pageStack) diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 57f25a9c1..5c3b79e72 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -138,8 +138,10 @@ void SettingsLayout::addSeperator() this->addWidget(new Line(false)); } -void SettingsLayout::filterElements(const QString &query) +bool SettingsLayout::filterElements(const QString &query) { + bool any{}; + for (auto &&group : this->groups_) { // if group name matches then all should be visible @@ -152,7 +154,7 @@ void SettingsLayout::filterElements(const QString &query) // check if any match else { - auto any = false; + auto groupAny = false; for (auto &&widget : group.widgets) { @@ -161,7 +163,7 @@ void SettingsLayout::filterElements(const QString &query) if (keyword.contains(query, Qt::CaseInsensitive)) { widget.element->show(); - any = true; + groupAny = true; } else { @@ -170,9 +172,11 @@ void SettingsLayout::filterElements(const QString &query) } } - group.title->setVisible(any); + group.title->setVisible(groupAny); } } + + return any; } GeneralPage::GeneralPage() @@ -199,10 +203,13 @@ GeneralPage::GeneralPage() this->initExtra(); } -void GeneralPage::filterElements(const QString &query) +bool GeneralPage::filterElements(const QString &query) { if (this->settingsLayout_) - this->settingsLayout_->filterElements(query); + return this->settingsLayout_->filterElements(query) || + this->name_.contains(query) || query.isEmpty(); + else + return false; } void GeneralPage::initLayout(SettingsLayout &layout) diff --git a/src/widgets/settingspages/GeneralPage.hpp b/src/widgets/settingspages/GeneralPage.hpp index 83381cf1a..4e0c1e261 100644 --- a/src/widgets/settingspages/GeneralPage.hpp +++ b/src/widgets/settingspages/GeneralPage.hpp @@ -131,7 +131,7 @@ public: DescriptionLabel *addDescription(const QString &text); void addSeperator(); - void filterElements(const QString &query); + bool filterElements(const QString &query); private: struct Widget { @@ -156,7 +156,7 @@ class GeneralPage : public SettingsPage public: GeneralPage(); - void filterElements(const QString &query); + bool filterElements(const QString &query); private: void initLayout(SettingsLayout &layout); diff --git a/src/widgets/settingspages/SettingsPage.cpp b/src/widgets/settingspages/SettingsPage.cpp index 4b0d147f1..0d7d8d129 100644 --- a/src/widgets/settingspages/SettingsPage.cpp +++ b/src/widgets/settingspages/SettingsPage.cpp @@ -9,11 +9,14 @@ namespace chatterino { -void filterItemsRec(QObject *object, const QString &query) +bool filterItemsRec(QObject *object, const QString &query) { + bool any{}; + for (auto &&child : object->children()) { - auto setOpacity = [=](auto *widget, bool condition) { + auto setOpacity = [&](auto *widget, bool condition) { + any |= condition; widget->greyedOut = !condition; widget->update(); }; @@ -39,9 +42,10 @@ void filterItemsRec(QObject *object, const QString &query) } else { - filterItemsRec(child, query); + any |= filterItemsRec(child, query); } } + return any; } SettingsPage::SettingsPage(const QString &name, const QString &iconResource) @@ -50,9 +54,10 @@ SettingsPage::SettingsPage(const QString &name, const QString &iconResource) { } -void SettingsPage::filterElements(const QString &query) +bool SettingsPage::filterElements(const QString &query) { - filterItemsRec(this, query); + return filterItemsRec(this, query) || query.isEmpty() || + this->name_.contains(query); } const QString &SettingsPage::getName() diff --git a/src/widgets/settingspages/SettingsPage.hpp b/src/widgets/settingspages/SettingsPage.hpp index 1678b34f8..d25cad819 100644 --- a/src/widgets/settingspages/SettingsPage.hpp +++ b/src/widgets/settingspages/SettingsPage.hpp @@ -49,7 +49,7 @@ public: const QString &getName(); const QString &getIconResource(); - virtual void filterElements(const QString &query); + virtual bool filterElements(const QString &query); SettingsDialogTab *tab() const; void setTab(SettingsDialogTab *tab); From a6fd6300c9144bc70944ff8495dbebf1b26cd120 Mon Sep 17 00:00:00 2001 From: fourtf Date: Mon, 2 Sep 2019 17:21:17 +0200 Subject: [PATCH 04/11] hide duplicate spaces in settings tab list --- src/widgets/dialogs/SettingsDialog.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/widgets/dialogs/SettingsDialog.cpp b/src/widgets/dialogs/SettingsDialog.cpp index 3a695eb89..108c33beb 100644 --- a/src/widgets/dialogs/SettingsDialog.cpp +++ b/src/widgets/dialogs/SettingsDialog.cpp @@ -91,6 +91,24 @@ void SettingsDialog::initUi() } } } + + // remove duplicate spaces + bool shouldShowSpace = true; + + for (int i = 0; i < this->ui_.tabContainer->count(); i++) + { + auto item = this->ui_.tabContainer->itemAt(i); + if (auto x = dynamic_cast(item); x) + { + x->changeSize( + 10, shouldShowSpace ? int(16 * this->scale()) : 0); + shouldShowSpace = false; + } + else if (item->widget()) + { + shouldShowSpace |= item->widget()->isVisible(); + } + } }); right.emplace() From 661a36c2e4520e16ca9cea41044921cc7fb640fd Mon Sep 17 00:00:00 2001 From: fourtf Date: Mon, 2 Sep 2019 17:22:14 +0200 Subject: [PATCH 05/11] prefere user selected tab in settings search --- src/widgets/dialogs/SettingsDialog.cpp | 15 ++++++++++++--- src/widgets/dialogs/SettingsDialog.hpp | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/widgets/dialogs/SettingsDialog.cpp b/src/widgets/dialogs/SettingsDialog.cpp index 108c33beb..46fc92195 100644 --- a/src/widgets/dialogs/SettingsDialog.cpp +++ b/src/widgets/dialogs/SettingsDialog.cpp @@ -80,13 +80,18 @@ void SettingsDialog::initUi() // TODO: add originally selected page // find next visible page - if (!this->selectedTab_->isVisible()) + if (this->lastSelectedByUser_ && + this->lastSelectedByUser_->isVisible()) + { + this->selectTab(this->lastSelectedByUser_, false); + } + else if (!this->selectedTab_->isVisible()) { for (auto &&tab : this->tabs_) { if (tab->isVisible()) { - this->selectTab(tab); + this->selectTab(tab, false); break; } } @@ -189,7 +194,7 @@ void SettingsDialog::addTab(SettingsPage *page, Qt::Alignment alignment) } } -void SettingsDialog::selectTab(SettingsDialogTab *tab) +void SettingsDialog::selectTab(SettingsDialogTab *tab, bool byUser) { this->ui_.pageStack->setCurrentWidget(tab->getSettingsPage()); @@ -205,6 +210,10 @@ void SettingsDialog::selectTab(SettingsDialogTab *tab) "border-top: 1px solid #444;" "border-bottom: 1px solid #444;"); this->selectedTab_ = tab; + if (byUser) + { + this->lastSelectedByUser_ = tab; + } } void SettingsDialog::selectPage(SettingsPage *page) diff --git a/src/widgets/dialogs/SettingsDialog.hpp b/src/widgets/dialogs/SettingsDialog.hpp index e637fa280..87bdb52af 100644 --- a/src/widgets/dialogs/SettingsDialog.hpp +++ b/src/widgets/dialogs/SettingsDialog.hpp @@ -43,7 +43,7 @@ private: void initUi(); void addTabs(); void addTab(SettingsPage *page, Qt::Alignment alignment = Qt::AlignTop); - void selectTab(SettingsDialogTab *tab); + void selectTab(SettingsDialogTab *tab, bool byUser = true); void selectPage(SettingsPage *page); void onOkClicked(); @@ -61,6 +61,7 @@ private: std::vector tabs_; std::vector pages_; SettingsDialogTab *selectedTab_{}; + SettingsDialogTab *lastSelectedByUser_{}; friend class SettingsDialogTab; }; From 234cdb041bb9e9138cabb2c44ac4ff4bfb85dae0 Mon Sep 17 00:00:00 2001 From: fourtf Date: Mon, 2 Sep 2019 18:53:08 +0200 Subject: [PATCH 06/11] sort paths in Resources to eliminate merge conflicts --- resources/generate_resources.py | 8 +- resources/resources_autogenerated.qrc | 130 +++++++++++++------------ src/autogenerated/ResourcesAutogen.cpp | 1 + src/autogenerated/ResourcesAutogen.hpp | 4 +- 4 files changed, 73 insertions(+), 70 deletions(-) diff --git a/resources/generate_resources.py b/resources/generate_resources.py index e48795f72..dc0cf1844 100755 --- a/resources/generate_resources.py +++ b/resources/generate_resources.py @@ -18,10 +18,10 @@ def isNotIgnored(file): return file.as_posix() not in ignored_files -all_files = list(filter(isNotIgnored, \ - filter(Path.is_file, Path('.').glob('**/*')))) -image_files = list(filter(isNotIgnored, \ - filter(Path.is_file, Path('.').glob('**/*.png')))) +all_files = sorted(list(filter(isNotIgnored, \ + filter(Path.is_file, Path('.').glob('**/*'))))) +image_files = sorted(list(filter(isNotIgnored, \ + filter(Path.is_file, Path('.').glob('**/*.png'))))) with open('./resources_autogenerated.qrc', 'w') as out: out.write(resources_header) diff --git a/resources/resources_autogenerated.qrc b/resources/resources_autogenerated.qrc index e1ffa3311..9f0569e3d 100644 --- a/resources/resources_autogenerated.qrc +++ b/resources/resources_autogenerated.qrc @@ -1,86 +1,88 @@ - icon.png - emojidata.txt - chatterino.desktop - error.png - .gitignore - tlds.txt - contributors.txt - pajaDank.png - chatterino.icns - icon.ico - emoji.json - buttons/mod.png - buttons/copyDark.svg - buttons/modModeDisabled.png - buttons/unmod.png + .gitignore + avatars/fourtf.png + avatars/pajlada.png + buttons/addSplit.png buttons/addSplitDark.png + buttons/ban.png + buttons/banRed.png + buttons/copyDark.png + buttons/copyDark.svg + buttons/copyDarkTheme.png + buttons/copyLight.png + buttons/copyLight.svg + buttons/emote.svg + buttons/emoteDark.svg + buttons/menuDark.png + buttons/menuLight.png + buttons/mod.png + buttons/modModeDisabled.png + buttons/modModeDisabled2.png + buttons/modModeEnabled.png + buttons/modModeEnabled2.png + buttons/search.png buttons/timeout.png buttons/trashCan.png buttons/trashcan.svg - buttons/modModeEnabled.png - buttons/copyLight.svg - buttons/modModeEnabled2.png - buttons/banRed.png - buttons/ban.png - buttons/emoteDark.svg - buttons/menuLight.png - buttons/emote.svg - buttons/update.png - buttons/addSplit.png - buttons/menuDark.png - buttons/updateError.png buttons/unban.png - buttons/copyLight.png - buttons/modModeDisabled2.png - buttons/copyDark.png + buttons/unmod.png + buttons/update.png + buttons/updateError.png + chatterino.desktop + chatterino.icns + contributors.txt + emoji.json + emojidata.txt + error.png examples/moving.gif examples/splitting.gif - twitch/prime.png - twitch/vip.png - twitch/cheer1.png - twitch/admin.png - twitch/broadcaster.png - twitch/verified.png - twitch/moderator.png - twitch/globalmod.png - twitch/automod.png - twitch/subscriber.png - twitch/staff.png - twitch/turbo.png - licenses/qt_lgpl-3.0.txt - licenses/emoji-data-source.txt - licenses/pajlada_settings.txt - licenses/openssl.txt - licenses/pajlada_signals.txt - licenses/rapidjson.txt - licenses/libcommuni_BSD3.txt + icon.ico + icon.png licenses/boost_boost.txt - licenses/websocketpp.txt + licenses/emoji-data-source.txt licenses/fmt_bsd2.txt - settings/aboutlogo.png - settings/ignore.svg - settings/notification2.svg - settings/theme.svg - settings/externaltools.svg - settings/advanced.svg + licenses/libcommuni_BSD3.txt + licenses/openssl.txt + licenses/pajlada_settings.txt + licenses/pajlada_signals.txt + licenses/qt_lgpl-3.0.txt + licenses/rapidjson.txt + licenses/websocketpp.txt + pajaDank.png + qss/settings.qss settings/about.svg - settings/notifications.svg - settings/behave.svg + settings/aboutlogo.png settings/accounts.svg - settings/emote.svg + settings/advanced.svg + settings/behave.svg + settings/browser.svg settings/commands.svg + settings/emote.svg + settings/externaltools.svg + settings/ignore.svg settings/keybinds.svg settings/moderation.svg - settings/browser.svg - avatars/pajlada.png - avatars/fourtf.png - qss/settings.qss + settings/notification2.svg + settings/notifications.svg + settings/theme.svg sounds/ping2.wav + split/down.png split/left.png split/move.png split/right.png - split/down.png split/up.png + tlds.txt + twitch/admin.png + twitch/automod.png + twitch/broadcaster.png + twitch/cheer1.png + twitch/globalmod.png + twitch/moderator.png + twitch/prime.png + twitch/staff.png + twitch/subscriber.png + twitch/turbo.png + twitch/verified.png + twitch/vip.png \ No newline at end of file diff --git a/src/autogenerated/ResourcesAutogen.cpp b/src/autogenerated/ResourcesAutogen.cpp index 8075ca026..54bd1db6e 100644 --- a/src/autogenerated/ResourcesAutogen.cpp +++ b/src/autogenerated/ResourcesAutogen.cpp @@ -11,6 +11,7 @@ Resources2::Resources2() this->buttons.ban = QPixmap(":/buttons/ban.png"); this->buttons.banRed = QPixmap(":/buttons/banRed.png"); this->buttons.copyDark = QPixmap(":/buttons/copyDark.png"); + this->buttons.copyDarkTheme = QPixmap(":/buttons/copyDarkTheme.png"); this->buttons.copyLight = QPixmap(":/buttons/copyLight.png"); this->buttons.menuDark = QPixmap(":/buttons/menuDark.png"); this->buttons.menuLight = QPixmap(":/buttons/menuLight.png"); diff --git a/src/autogenerated/ResourcesAutogen.hpp b/src/autogenerated/ResourcesAutogen.hpp index 467cbed9a..8d137fe36 100644 --- a/src/autogenerated/ResourcesAutogen.hpp +++ b/src/autogenerated/ResourcesAutogen.hpp @@ -3,8 +3,7 @@ namespace chatterino { -class Resources2 : public Singleton -{ +class Resources2 : public Singleton { public: Resources2(); @@ -18,6 +17,7 @@ public: QPixmap ban; QPixmap banRed; QPixmap copyDark; + QPixmap copyDarkTheme; QPixmap copyLight; QPixmap menuDark; QPixmap menuLight; From 125426dbf15935a904c6e673c3bd9d7934145dc6 Mon Sep 17 00:00:00 2001 From: fourtf Date: Mon, 2 Sep 2019 18:59:37 +0200 Subject: [PATCH 07/11] added header for search --- resources/qss/settings.qss | 7 +++++++ src/autogenerated/ResourcesAutogen.cpp | 1 + src/autogenerated/ResourcesAutogen.hpp | 1 + src/widgets/dialogs/SettingsDialog.cpp | 16 +++++++++++++--- src/widgets/dialogs/SettingsDialog.hpp | 5 +++++ src/widgets/helper/SettingsDialogTab.cpp | 2 ++ 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/resources/qss/settings.qss b/resources/qss/settings.qss index ec6da9e9b..3c1c97a44 100644 --- a/resources/qss/settings.qss +++ b/resources/qss/settings.qss @@ -30,6 +30,13 @@ chatterino--SettingsPage { border: 1px solid #555; } +chatterino--PageHeader { + min-height: 54px; + min-width: 64px; + border: 1px solid #555; + border-bottom: none; +} + chatterino--TitleLabel { font-family: "Segoe UI light"; font-size: 24px; diff --git a/src/autogenerated/ResourcesAutogen.cpp b/src/autogenerated/ResourcesAutogen.cpp index 54bd1db6e..9629a8f02 100644 --- a/src/autogenerated/ResourcesAutogen.cpp +++ b/src/autogenerated/ResourcesAutogen.cpp @@ -20,6 +20,7 @@ Resources2::Resources2() this->buttons.modModeDisabled2 = QPixmap(":/buttons/modModeDisabled2.png"); this->buttons.modModeEnabled = QPixmap(":/buttons/modModeEnabled.png"); this->buttons.modModeEnabled2 = QPixmap(":/buttons/modModeEnabled2.png"); + this->buttons.search = QPixmap(":/buttons/search.png"); this->buttons.timeout = QPixmap(":/buttons/timeout.png"); this->buttons.trashCan = QPixmap(":/buttons/trashCan.png"); this->buttons.unban = QPixmap(":/buttons/unban.png"); diff --git a/src/autogenerated/ResourcesAutogen.hpp b/src/autogenerated/ResourcesAutogen.hpp index 8d137fe36..c6b3dc486 100644 --- a/src/autogenerated/ResourcesAutogen.hpp +++ b/src/autogenerated/ResourcesAutogen.hpp @@ -26,6 +26,7 @@ public: QPixmap modModeDisabled2; QPixmap modModeEnabled; QPixmap modModeEnabled2; + QPixmap search; QPixmap timeout; QPixmap trashCan; QPixmap unban; diff --git a/src/widgets/dialogs/SettingsDialog.cpp b/src/widgets/dialogs/SettingsDialog.cpp index 46fc92195..dad738b2e 100644 --- a/src/widgets/dialogs/SettingsDialog.cpp +++ b/src/widgets/dialogs/SettingsDialog.cpp @@ -1,7 +1,9 @@ #include "widgets/dialogs/SettingsDialog.hpp" #include "Application.hpp" +#include "singletons/Resources.hpp" #include "util/LayoutCreator.hpp" +#include "widgets/helper/Button.hpp" #include "widgets/helper/SettingsDialogTab.hpp" #include "widgets/settingspages/AboutPage.hpp" #include "widgets/settingspages/AccountsPage.hpp" @@ -60,11 +62,15 @@ void SettingsDialog::initUi() this->layout()->setSpacing(0); // right side layout - auto right = layoutCreator.emplace().withoutMargin(); + auto right = + layoutCreator.emplace().withoutMargin().withoutSpacing(); { - auto title = right.emplace().withoutMargin(); + auto title = right.emplace(); + auto header = LayoutCreator(title.getElement()) + .setLayoutType(); - auto edit = title.emplace().assign(&this->ui_.search); + auto edit = header.emplace().assign(&this->ui_.search); + edit->setPlaceholderText("Find in settings..."); QTimer::singleShot(100, edit.getElement(), [edit = edit.getElement()]() { edit->setFocus(); }); QObject::connect( @@ -116,6 +122,10 @@ void SettingsDialog::initUi() } }); + auto searchButton = header.emplace