diff --git a/resources/qss/settings.qss b/resources/qss/settings.qss index 3c1c97a44..590dff5f5 100644 --- a/resources/qss/settings.qss +++ b/resources/qss/settings.qss @@ -27,14 +27,12 @@ QComboBox QFrame { chatterino--SettingsPage { background: #222; - border: 1px solid #555; + /*border: 1px solid #555; + border-left: none;*/ } chatterino--PageHeader { - min-height: 54px; - min-width: 64px; - border: 1px solid #555; - border-bottom: none; + margin-bottom: 12px; } chatterino--TitleLabel { diff --git a/src/widgets/dialogs/SettingsDialog.cpp b/src/widgets/dialogs/SettingsDialog.cpp index 5ed84b212..ea52df184 100644 --- a/src/widgets/dialogs/SettingsDialog.cpp +++ b/src/widgets/dialogs/SettingsDialog.cpp @@ -46,105 +46,55 @@ SettingsDialog::SettingsDialog() void SettingsDialog::initUi() { - LayoutCreator layoutCreator(this); + auto outerBox = LayoutCreator(this) + .setLayoutType() + .withoutSpacing(); - // tab pages - auto outerBox = layoutCreator.setLayoutType(); - outerBox->setSpacing(12); + // TOP + auto title = outerBox.emplace(); + auto edit = LayoutCreator(title.getElement()) + .setLayoutType() + .withoutMargin() + .emplace() + .assign(&this->ui_.search); + edit->setPlaceholderText("Find in settings..."); - outerBox.emplace() + QObject::connect(edit.getElement(), &QLineEdit::textChanged, this, + &SettingsDialog::filterElements); + + // CENTER + auto centerBox = + outerBox.emplace().withoutMargin().withoutSpacing(); + + // left side (tabs) + centerBox.emplace() .assign(&this->ui_.tabContainerContainer) - .emplace() + .setLayoutType() .withoutMargin() .assign(&this->ui_.tabContainer); - this->ui_.tabContainerContainer->layout()->setContentsMargins(8, 8, 0, 39); - - // right side layout + // right side (pages) auto right = - layoutCreator.emplace().withoutMargin().withoutSpacing(); + centerBox.emplace().withoutMargin().withoutSpacing(); { - auto title = right.emplace(); - auto header = LayoutCreator(title.getElement()) - .setLayoutType(); - - 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( - 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->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, false); - break; - } - } - } - - // 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(); - } - } - }); - - auto searchButton = header.emplace