Update to latest settings library version
This commit is contained in:
@@ -50,8 +50,7 @@ AccountSwitchWidget::AccountSwitchWidget(QWidget *parent)
|
||||
}
|
||||
else
|
||||
{
|
||||
app->accounts->twitch.currentUsername =
|
||||
newUsername.toStdString();
|
||||
app->accounts->twitch.currentUsername = newUsername;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -56,9 +56,9 @@ BaseWindow::BaseWindow(QWidget *parent, Flags _flags)
|
||||
|
||||
this->init();
|
||||
|
||||
this->connections_.managedConnect(
|
||||
getSettings()->uiScale.getValueChangedSignal(),
|
||||
[this](auto, auto) { postToThread([this] { this->updateScale(); }); });
|
||||
getSettings()->uiScale.connect(
|
||||
[this]() { postToThread([this] { this->updateScale(); }); },
|
||||
this->connections_);
|
||||
|
||||
this->updateScale();
|
||||
|
||||
@@ -133,8 +133,8 @@ void BaseWindow::init()
|
||||
? Qt::WindowActive
|
||||
: Qt::WindowMaximized);
|
||||
});
|
||||
QObject::connect(_exitButton, &TitleBarButton::leftClicked, this,
|
||||
[this] { this->close(); });
|
||||
QObject::connect(_exitButton, &TitleBarButton::leftClicked,
|
||||
this, [this] { this->close(); });
|
||||
|
||||
this->ui_.minButton = _minButton;
|
||||
this->ui_.maxButton = _maxButton;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "common/NetworkRequest.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "providers/twitch/PartialTwitchUser.hpp"
|
||||
#include "util/Helpers.hpp"
|
||||
|
||||
#ifdef USEWINSDK
|
||||
# include <Windows.h>
|
||||
@@ -21,26 +22,25 @@ namespace chatterino {
|
||||
|
||||
namespace {
|
||||
|
||||
void LogInWithCredentials(const std::string &userID,
|
||||
const std::string &username,
|
||||
const std::string &clientID,
|
||||
const std::string &oauthToken)
|
||||
void LogInWithCredentials(const QString &userID, const QString &username,
|
||||
const QString &clientID,
|
||||
const QString &oauthToken)
|
||||
{
|
||||
QStringList errors;
|
||||
|
||||
if (userID.empty())
|
||||
if (userID.isEmpty())
|
||||
{
|
||||
errors.append("Missing user ID");
|
||||
}
|
||||
if (username.empty())
|
||||
if (username.isEmpty())
|
||||
{
|
||||
errors.append("Missing username");
|
||||
}
|
||||
if (clientID.empty())
|
||||
if (clientID.isEmpty())
|
||||
{
|
||||
errors.append("Missing Client ID");
|
||||
}
|
||||
if (oauthToken.empty())
|
||||
if (oauthToken.isEmpty())
|
||||
{
|
||||
errors.append("Missing OAuth Token");
|
||||
}
|
||||
@@ -65,14 +65,14 @@ namespace {
|
||||
// messageBox.setIcon(QMessageBox::Information);
|
||||
// messageBox.setText("Successfully logged in with user <b>" +
|
||||
// qS(username) + "</b>!");
|
||||
pajlada::Settings::Setting<std::string>::set(
|
||||
"/accounts/uid" + userID + "/username", username);
|
||||
pajlada::Settings::Setting<std::string>::set(
|
||||
"/accounts/uid" + userID + "/userID", userID);
|
||||
pajlada::Settings::Setting<std::string>::set(
|
||||
"/accounts/uid" + userID + "/clientID", clientID);
|
||||
pajlada::Settings::Setting<std::string>::set(
|
||||
"/accounts/uid" + userID + "/oauthToken", oauthToken);
|
||||
auto basePath = fS("/accounts/uid{}", userID);
|
||||
pajlada::Settings::Setting<QString>::set(basePath + "/username",
|
||||
username);
|
||||
pajlada::Settings::Setting<QString>::set(basePath + "/userID", userID);
|
||||
pajlada::Settings::Setting<QString>::set(basePath + "/clientID",
|
||||
clientID);
|
||||
pajlada::Settings::Setting<QString>::set(basePath + "/oauthToken",
|
||||
oauthToken);
|
||||
|
||||
getApp()->accounts->twitch.reloadUsers();
|
||||
|
||||
@@ -105,7 +105,7 @@ BasicLoginWidget::BasicLoginWidget()
|
||||
QString clipboardString = clipboard->text();
|
||||
QStringList parameters = clipboardString.split(';');
|
||||
|
||||
std::string oauthToken, clientID, username, userID;
|
||||
QString oauthToken, clientID, username, userID;
|
||||
|
||||
for (const auto ¶m : parameters)
|
||||
{
|
||||
@@ -119,19 +119,19 @@ BasicLoginWidget::BasicLoginWidget()
|
||||
|
||||
if (key == "oauth_token")
|
||||
{
|
||||
oauthToken = value.toStdString();
|
||||
oauthToken = value;
|
||||
}
|
||||
else if (key == "client_id")
|
||||
{
|
||||
clientID = value.toStdString();
|
||||
clientID = value;
|
||||
}
|
||||
else if (key == "username")
|
||||
{
|
||||
username = value.toStdString();
|
||||
username = value;
|
||||
}
|
||||
else if (key == "user_id")
|
||||
{
|
||||
userID = value.toStdString();
|
||||
userID = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -198,16 +198,15 @@ AdvancedLoginWidget::AdvancedLoginWidget()
|
||||
this->ui_.oauthTokenInput.clear();
|
||||
});
|
||||
|
||||
connect(
|
||||
&this->ui_.buttonUpperRow.addUserButton, &QPushButton::clicked, [=]() {
|
||||
std::string userID = this->ui_.userIDInput.text().toStdString();
|
||||
std::string username = this->ui_.usernameInput.text().toStdString();
|
||||
std::string clientID = this->ui_.clientIDInput.text().toStdString();
|
||||
std::string oauthToken =
|
||||
this->ui_.oauthTokenInput.text().toStdString();
|
||||
connect(&this->ui_.buttonUpperRow.addUserButton, &QPushButton::clicked,
|
||||
[=]() {
|
||||
QString userID = this->ui_.userIDInput.text();
|
||||
QString username = this->ui_.usernameInput.text();
|
||||
QString clientID = this->ui_.clientIDInput.text();
|
||||
QString oauthToken = this->ui_.oauthTokenInput.text();
|
||||
|
||||
LogInWithCredentials(userID, username, clientID, oauthToken);
|
||||
});
|
||||
LogInWithCredentials(userID, username, clientID, oauthToken);
|
||||
});
|
||||
|
||||
/// Lower button row
|
||||
this->ui_.buttonLowerRow.fillInUserIDButton.setText(
|
||||
|
||||
@@ -36,8 +36,8 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
||||
this->positionChangedAnimation_.setEasingCurve(
|
||||
QEasingCurve(QEasingCurve::InCubic));
|
||||
|
||||
getSettings()->showTabCloseButton.connect(
|
||||
boost::bind(&NotebookTab::hideTabXChanged, this, _1),
|
||||
getSettings()->showTabCloseButton.connectSimple(
|
||||
boost::bind(&NotebookTab::hideTabXChanged, this),
|
||||
this->managedConnections_);
|
||||
getSettings()->showTabLive.connect([this](auto, auto) { this->update(); },
|
||||
this->managedConnections_);
|
||||
@@ -230,7 +230,7 @@ QRect NotebookTab::getDesiredRect() const
|
||||
return QRect(this->positionAnimationDesiredPoint_, size());
|
||||
}
|
||||
|
||||
void NotebookTab::hideTabXChanged(bool)
|
||||
void NotebookTab::hideTabXChanged()
|
||||
{
|
||||
this->updateSize();
|
||||
this->update();
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
void moveAnimated(QPoint pos, bool animated = true);
|
||||
|
||||
QRect getDesiredRect() const;
|
||||
void hideTabXChanged(bool);
|
||||
void hideTabXChanged();
|
||||
|
||||
protected:
|
||||
virtual void themeChangedEvent() override;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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{};
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user