moved navigation to the right

This commit is contained in:
fourtf 2020-10-23 09:32:45 +02:00
parent 74e2242da2
commit 5f54b1b495
7 changed files with 36 additions and 18 deletions

View file

@ -24,7 +24,12 @@ QComboBox QFrame {
border: 1px solid #66BCFF; border: 1px solid #66BCFF;
} }
chatterino--SettingsPage { chatterino--SettingsDialog chatterino--SettingsDialogTab {
font-family: "Segoe UI";
font-size: 14;
}
chatterino--SettingsPage #generalSettingsScrollContent {
background: #222; background: #222;
} }
@ -39,5 +44,12 @@ chatterino--TitleLabel {
} }
chatterino--DescriptionLabel { chatterino--DescriptionLabel {
font-size: 14px;
color: #999; color: #999;
} }
chatterino--NavigationLabel {
font-family: "Segoe UI light";
font-size: 16px;
color: #A6DDF4;
}

View file

@ -12,7 +12,7 @@ QWidget *wrapLayout(QLayout *layout)
return widget; return widget;
} }
QScrollArea *makeScrollArea(LayoutItem item) QScrollArea *makeScrollArea(WidgetOrLayout item)
{ {
auto area = new QScrollArea(); auto area = new QScrollArea();

View file

@ -8,10 +8,11 @@ class QScrollArea;
namespace chatterino { namespace chatterino {
using LayoutItem = boost::variant<QWidget *, QLayout *>; using LayoutItem = boost::variant<QWidget *, QLayoutItem *>;
using WidgetOrLayout = boost::variant<QWidget *, QLayout *>;
QWidget *wrapLayout(QLayout *layout); QWidget *wrapLayout(QLayout *layout);
QScrollArea *makeScrollArea(LayoutItem item); QScrollArea *makeScrollArea(WidgetOrLayout item);
template <typename T> template <typename T>
T *makeLayout(std::initializer_list<LayoutItem> items) T *makeLayout(std::initializer_list<LayoutItem> items)
@ -26,7 +27,7 @@ T *makeLayout(std::initializer_list<LayoutItem> items)
t->addItem(new QWidgetItem(boost::get<QWidget *>(item))); t->addItem(new QWidgetItem(boost::get<QWidget *>(item)));
break; break;
case 1: case 1:
t->addItem(boost::get<QLayout *>(item)); t->addItem(boost::get<QLayoutItem *>(item));
break; break;
} }
} }
@ -36,14 +37,6 @@ T *makeLayout(std::initializer_list<LayoutItem> items)
return t; return t;
} }
template <typename T>
T *makeStretchingLayout(std::initializer_list<LayoutItem> items)
{
auto layout = makeLayout<T>(items);
layout->addStretch(1);
return layout;
}
template <typename T, typename With> template <typename T, typename With>
T *makeWidget(With with) T *makeWidget(With with)
{ {

View file

@ -65,8 +65,9 @@ void SettingsDialogTab::paintEvent(QPaintEvent *)
a = a + a + 20 + a; a = a + a + 20 + a;
painter.drawText(QRect(a, 0, width() - a, height()), this->ui_.labelText, this->style()->drawItemText(&painter, QRect(a, 0, width() - a, height()),
QTextOption(Qt::AlignLeft | Qt::AlignVCenter)); Qt::AlignLeft | Qt::AlignVCenter,
this->palette(), false, this->ui_.labelText);
} }
void SettingsDialogTab::mousePressEvent(QMouseEvent *event) void SettingsDialogTab::mousePressEvent(QMouseEvent *event)

View file

@ -420,6 +420,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
layout.addCheckbox("Category", s.headerGame); layout.addCheckbox("Category", s.headerGame);
layout.addCheckbox("Title", s.headerStreamTitle); layout.addCheckbox("Title", s.headerStreamTitle);
layout.addNavigationSpacing();
layout.addTitle("Beta"); layout.addTitle("Beta");
if (Version::instance().isSupportedOS()) if (Version::instance().isSupportedOS())
{ {
@ -563,7 +564,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
// invisible element for width // invisible element for width
auto inv = new BaseWidget(this); auto inv = new BaseWidget(this);
inv->setScaleIndependantWidth(500); // inv->setScaleIndependantWidth(600);
layout.addWidget(inv); layout.addWidget(inv);
} }

View file

@ -15,11 +15,16 @@ GeneralPageView::GeneralPageView(QWidget *parent)
{ {
auto scrollArea = this->contentScrollArea_ = auto scrollArea = this->contentScrollArea_ =
makeScrollArea(this->contentLayout_ = new QVBoxLayout); makeScrollArea(this->contentLayout_ = new QVBoxLayout);
scrollArea->setObjectName("generalSettingsScrollContent");
auto navigation = auto navigation =
wrapLayout(this->navigationLayout_ = makeLayout<QVBoxLayout>({})); wrapLayout(this->navigationLayout_ = makeLayout<QVBoxLayout>({}));
navigation->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
this->navigationLayout_->setAlignment(Qt::AlignTop);
this->navigationLayout_->addSpacing(6);
this->setLayout(makeLayout<QHBoxLayout>({scrollArea, navigation})); this->setLayout(makeLayout<QHBoxLayout>(
{scrollArea, new QSpacerItem(16, 1), navigation}));
QObject::connect(scrollArea->verticalScrollBar(), &QScrollBar::valueChanged, QObject::connect(scrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
this, [=] { this->updateNavigationHighlighting(); }); this, [=] { this->updateNavigationHighlighting(); });
@ -166,6 +171,11 @@ ColorButton *GeneralPageView::addColorButton(
return colorButton; return colorButton;
} }
void GeneralPageView::addNavigationSpacing()
{
this->navigationLayout_->addSpacing(24);
}
DescriptionLabel *GeneralPageView::addDescription(const QString &text) DescriptionLabel *GeneralPageView::addDescription(const QString &text)
{ {
auto label = new DescriptionLabel(text); auto label = new DescriptionLabel(text);
@ -259,7 +269,7 @@ void GeneralPageView::updateNavigationHighlighting()
&group == &this->groups_.back())) &group == &this->groups_.back()))
{ {
first = false; first = false;
group.navigationLink->setStyleSheet("color: #4FC3F7"); group.navigationLink->setStyleSheet("color: #00ABF4");
} }
else else
{ {

View file

@ -87,6 +87,7 @@ public:
bool editable = false); bool editable = false);
ColorButton *addColorButton(const QString &text, const QColor &color, ColorButton *addColorButton(const QString &text, const QColor &color,
pajlada::Settings::Setting<QString> &setting); pajlada::Settings::Setting<QString> &setting);
void addNavigationSpacing();
template <typename OnClick> template <typename OnClick>
QPushButton *makeButton(const QString &text, OnClick onClick) QPushButton *makeButton(const QString &text, OnClick onClick)