added header for search

This commit is contained in:
fourtf 2019-09-02 18:59:37 +02:00
parent 234cdb041b
commit 125426dbf1
6 changed files with 29 additions and 3 deletions

View file

@ -30,6 +30,13 @@ chatterino--SettingsPage {
border: 1px solid #555; border: 1px solid #555;
} }
chatterino--PageHeader {
min-height: 54px;
min-width: 64px;
border: 1px solid #555;
border-bottom: none;
}
chatterino--TitleLabel { chatterino--TitleLabel {
font-family: "Segoe UI light"; font-family: "Segoe UI light";
font-size: 24px; font-size: 24px;

View file

@ -20,6 +20,7 @@ Resources2::Resources2()
this->buttons.modModeDisabled2 = QPixmap(":/buttons/modModeDisabled2.png"); this->buttons.modModeDisabled2 = QPixmap(":/buttons/modModeDisabled2.png");
this->buttons.modModeEnabled = QPixmap(":/buttons/modModeEnabled.png"); this->buttons.modModeEnabled = QPixmap(":/buttons/modModeEnabled.png");
this->buttons.modModeEnabled2 = QPixmap(":/buttons/modModeEnabled2.png"); this->buttons.modModeEnabled2 = QPixmap(":/buttons/modModeEnabled2.png");
this->buttons.search = QPixmap(":/buttons/search.png");
this->buttons.timeout = QPixmap(":/buttons/timeout.png"); this->buttons.timeout = QPixmap(":/buttons/timeout.png");
this->buttons.trashCan = QPixmap(":/buttons/trashCan.png"); this->buttons.trashCan = QPixmap(":/buttons/trashCan.png");
this->buttons.unban = QPixmap(":/buttons/unban.png"); this->buttons.unban = QPixmap(":/buttons/unban.png");

View file

@ -26,6 +26,7 @@ public:
QPixmap modModeDisabled2; QPixmap modModeDisabled2;
QPixmap modModeEnabled; QPixmap modModeEnabled;
QPixmap modModeEnabled2; QPixmap modModeEnabled2;
QPixmap search;
QPixmap timeout; QPixmap timeout;
QPixmap trashCan; QPixmap trashCan;
QPixmap unban; QPixmap unban;

View file

@ -1,7 +1,9 @@
#include "widgets/dialogs/SettingsDialog.hpp" #include "widgets/dialogs/SettingsDialog.hpp"
#include "Application.hpp" #include "Application.hpp"
#include "singletons/Resources.hpp"
#include "util/LayoutCreator.hpp" #include "util/LayoutCreator.hpp"
#include "widgets/helper/Button.hpp"
#include "widgets/helper/SettingsDialogTab.hpp" #include "widgets/helper/SettingsDialogTab.hpp"
#include "widgets/settingspages/AboutPage.hpp" #include "widgets/settingspages/AboutPage.hpp"
#include "widgets/settingspages/AccountsPage.hpp" #include "widgets/settingspages/AccountsPage.hpp"
@ -60,11 +62,15 @@ void SettingsDialog::initUi()
this->layout()->setSpacing(0); this->layout()->setSpacing(0);
// right side layout // right side layout
auto right = layoutCreator.emplace<QVBoxLayout>().withoutMargin(); auto right =
layoutCreator.emplace<QVBoxLayout>().withoutMargin().withoutSpacing();
{ {
auto title = right.emplace<QHBoxLayout>().withoutMargin(); auto title = right.emplace<PageHeader>();
auto header = LayoutCreator<PageHeader>(title.getElement())
.setLayoutType<QHBoxLayout>();
auto edit = title.emplace<QLineEdit>().assign(&this->ui_.search); auto edit = header.emplace<QLineEdit>().assign(&this->ui_.search);
edit->setPlaceholderText("Find in settings...");
QTimer::singleShot(100, edit.getElement(), QTimer::singleShot(100, edit.getElement(),
[edit = edit.getElement()]() { edit->setFocus(); }); [edit = edit.getElement()]() { edit->setFocus(); });
QObject::connect( QObject::connect(
@ -116,6 +122,10 @@ void SettingsDialog::initUi()
} }
}); });
auto searchButton = header.emplace<Button>();
searchButton->setPixmap(getApp()->resources->buttons.search);
searchButton->setScaleIndependantSize(30, 30);
right.emplace<QStackedLayout>() right.emplace<QStackedLayout>()
.assign(&this->ui_.pageStack) .assign(&this->ui_.pageStack)
.withoutMargin(); .withoutMargin();

View file

@ -16,6 +16,11 @@ class SettingsPage;
class SettingsDialogTab; class SettingsDialogTab;
class ModerationPage; class ModerationPage;
class PageHeader : public QFrame
{
Q_OBJECT
};
enum class SettingsDialogPreference { enum class SettingsDialogPreference {
NoPreference, NoPreference,
Accounts, Accounts,

View file

@ -68,6 +68,8 @@ void SettingsDialogTab::mousePressEvent(QMouseEvent *event)
} }
this->dialog_->selectTab(this); this->dialog_->selectTab(this);
this->setFocus();
} }
} // namespace chatterino } // namespace chatterino