improvements on settings dialog

This commit is contained in:
fourtf 2018-10-31 20:57:29 +01:00
parent 33ecc2759d
commit 246f999a40
4 changed files with 47 additions and 14 deletions

View file

@ -7,10 +7,29 @@ QCheckBox::indicator {
height: <checkbox-size>px;
}
QComboBox {
chatterino--ComboBox {
width: 100px;
}
QScrollArea {
border: none;
}
QScrollArea QFrame {
background: #222;
border: none;
}
QComboBox QFrame {
background: #000;
border: 1px solid #66BCFF;
}
chatterino--SettingsPage {
background: #222;
border: 1px solid #555;
}
chatterino--TitleLabel {
font-family: "Segoe UI light";
font-size: 24px;

View file

@ -35,7 +35,7 @@ SettingsDialog::SettingsDialog()
this->scaleChangedEvent(this->getScale());
this->overrideBackgroundColor_ = QColor("#282828");
this->overrideBackgroundColor_ = QColor("#111111");
this->themeChangedEvent();
this->resize(766, 600);
@ -96,6 +96,8 @@ void SettingsDialog::addTabs()
this->ui_.tabContainer->setMargin(0);
this->ui_.tabContainer->setSpacing(0);
this->ui_.tabContainer->addSpacing(16);
this->addTab(new GeneralPage);
this->ui_.tabContainer->addSpacing(16);
@ -155,8 +157,10 @@ void SettingsDialog::selectTab(SettingsDialogTab *tab)
}
tab->setSelected(true);
tab->setStyleSheet(
"background: #161616; color: #4FC3F7; border: 1px solid #111");
tab->setStyleSheet("background: #222; color: #4FC3F7;"
"border-left: 1px solid #444;"
"border-top: 1px solid #444;"
"border-bottom: 1px solid #444;");
this->selectedTab_ = tab;
}
@ -226,7 +230,7 @@ void SettingsDialog::themeChangedEvent()
BaseWindow::themeChangedEvent();
QPalette palette;
palette.setColor(QPalette::Background, QColor("#222"));
palette.setColor(QPalette::Background, QColor("#111"));
this->setPalette(palette);
}

View file

@ -59,11 +59,12 @@ QCheckBox *SettingsLayout::addCheckbox(const QString &text,
return check;
}
QComboBox *SettingsLayout::addDropdown(const QString &text,
ComboBox *SettingsLayout::addDropdown(const QString &text,
const QStringList &list)
{
auto layout = new QHBoxLayout;
auto combo = new QComboBox;
auto combo = new ComboBox;
combo->setFocusPolicy(Qt::StrongFocus);
combo->addItems(list);
layout->addWidget(new QLabel(text + ":"));
@ -74,7 +75,7 @@ QComboBox *SettingsLayout::addDropdown(const QString &text,
return combo;
}
QComboBox *SettingsLayout::addDropdown(
ComboBox *SettingsLayout::addDropdown(
const QString &text, const QStringList &items,
pajlada::Settings::Setting<QString> &setting)
{
@ -203,7 +204,7 @@ void GeneralPage::initLayout(SettingsLayout &layout)
layout.addTitle("Emotes");
layout.addDropdown<float>(
"Emote size", {"0.5x", "0.75x", "Default", "1.25", "1.5x", "2x"},
"Emote size", {"0.5x", "0.75x", "Default", "1.25x", "1.5x", "2x"},
s.emoteScale,
[](auto val) {
if (val == 1)

View file

@ -56,6 +56,15 @@ struct DropdownArgs {
QComboBox *combobox;
};
class ComboBox : public QComboBox
{
Q_OBJECT
void wheelEvent(QWheelEvent *event) override
{
}
};
class SettingsLayout : public QVBoxLayout
{
Q_OBJECT
@ -64,12 +73,12 @@ public:
TitleLabel *addTitle(const QString &text);
TitleLabel2 *addTitle2(const QString &text);
QCheckBox *addCheckbox(const QString &text, BoolSetting &setting);
QComboBox *addDropdown(const QString &text, const QStringList &items);
QComboBox *addDropdown(const QString &text, const QStringList &items,
ComboBox *addDropdown(const QString &text, const QStringList &items);
ComboBox *addDropdown(const QString &text, const QStringList &items,
pajlada::Settings::Setting<QString> &setting);
template <typename T>
QComboBox *addDropdown(
ComboBox *addDropdown(
const QString &text, const QStringList &items,
pajlada::Settings::Setting<T> &setting,
std::function<boost::variant<int, QString>(T)> getValue,