Update to latest settings library version

This commit is contained in:
Rasmus Karlsson
2018-11-03 13:00:07 +01:00
parent 9ced50e94e
commit ac4a496a06
36 changed files with 373 additions and 374 deletions
+8 -8
View File
@@ -148,10 +148,9 @@ void GeneralPage::initLayout(SettingsLayout &layout)
layout.addTitle("Appearance");
layout.addDropdown("Theme", {"White", "Light", "Dark", "Black"},
getApp()->themes->themeName);
layout.addDropdown<std::string>(
layout.addDropdown<QString>(
"Font", {"Segoe UI", "Arial", "Choose..."},
getApp()->fonts->chatFontFamily,
[](auto val) { return QString::fromStdString(val); },
getApp()->fonts->chatFontFamily, [](auto val) { return val; },
[this](auto args) { return this->getFont(args); });
layout.addDropdown<int>(
"Font size", {"9pt", "10pt", "12pt", "14pt", "16pt", "20pt"},
@@ -220,7 +219,8 @@ void GeneralPage::initLayout(SettingsLayout &layout)
layout.addCheckbox("Animate only when focused", s.animationsWhenFocused);
layout.addDropdown("Emoji set",
{"EmojiOne 2", "EmojiOne 3", "Twitter", "Facebook",
"Apple", "Google", "Messenger"});
"Apple", "Google", "Messenger"},
s.emojiSet);
layout.addTitle("Badges");
layout.addCheckbox("Show authority badges (staff, admin, turbo, etc)",
@@ -311,7 +311,7 @@ void GeneralPage::initExtra()
}
}
std::string GeneralPage::getFont(const DropdownArgs &args) const
QString GeneralPage::getFont(const DropdownArgs &args) const
{
if (args.combobox->currentIndex() == args.combobox->count() - 1)
{
@@ -325,11 +325,11 @@ std::string GeneralPage::getFont(const DropdownArgs &args) const
auto font = dialog.getFont(&ok);
if (ok)
return font.family().toStdString();
return font.family();
else
return args.combobox->itemText(0).toStdString();
return args.combobox->itemText(0);
}
return args.value.toStdString();
return args.value;
}
} // namespace chatterino
+1 -1
View File
@@ -156,7 +156,7 @@ private:
void initLayout(SettingsLayout &layout);
void initExtra();
std::string getFont(const DropdownArgs &args) const;
QString getFont(const DropdownArgs &args) const;
DescriptionLabel *cachePath{};
};
+12 -14
View File
@@ -532,17 +532,15 @@ QLayout *LookPage::createFontChanger()
QLabel *label = new QLabel();
layout->addWidget(label);
auto updateFontFamilyLabel = [=](auto) {
label->setText(
"Font (" +
QString::fromStdString(app->fonts->chatFontFamily.getValue()) +
", " + QString::number(app->fonts->chatFontSize) + "pt)");
auto updateFontFamilyLabel = [=]() {
label->setText("Font (" + app->fonts->chatFontFamily.getValue() + ", " +
QString::number(app->fonts->chatFontSize) + "pt)");
};
app->fonts->chatFontFamily.connectSimple(updateFontFamilyLabel,
this->managedConnections_);
app->fonts->chatFontSize.connectSimple(updateFontFamilyLabel,
this->managedConnections_);
app->fonts->chatFontFamily.connect(updateFontFamilyLabel,
this->managedConnections_);
app->fonts->chatFontSize.connect(updateFontFamilyLabel,
this->managedConnections_);
// BUTTON
QPushButton *button = new QPushButton("Select");
@@ -554,11 +552,11 @@ QLayout *LookPage::createFontChanger()
dialog.setWindowFlag(Qt::WindowStaysOnTopHint);
dialog.connect(
&dialog, &QFontDialog::fontSelected, [=](const QFont &font) {
app->fonts->chatFontFamily = font.family().toStdString();
app->fonts->chatFontSize = font.pointSize();
});
dialog.connect(&dialog, &QFontDialog::fontSelected,
[=](const QFont &font) {
app->fonts->chatFontFamily = font.family();
app->fonts->chatFontSize = font.pointSize();
});
dialog.show();
dialog.exec();