From 552941118bb7f94bfb3ff8c7f854380408c85ffe Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Wed, 22 Nov 2017 19:52:38 +0200 Subject: [PATCH] Fix minor stylistic issues on the nheko theme --- include/LeaveRoomDialog.h | 3 +++ include/LoginPage.h | 3 +++ include/LogoutDialog.h | 3 +++ include/RegisterPage.h | 3 +++ include/UserSettingsPage.h | 1 + include/WelcomePage.h | 3 +++ resources/styles/nheko.qss | 35 +++++++++++++++++++++++++++++------ src/LeaveRoomDialog.cc | 10 ++++++++++ src/LoginPage.cc | 11 +++++++++++ src/LogoutDialog.cc | 13 +++++++++++-- src/RegisterPage.cc | 11 +++++++++++ src/UserSettingsPage.cc | 9 +++++++++ src/WelcomePage.cc | 10 ++++++++++ 13 files changed, 107 insertions(+), 8 deletions(-) diff --git a/include/LeaveRoomDialog.h b/include/LeaveRoomDialog.h index 231556dc..1a2f003c 100644 --- a/include/LeaveRoomDialog.h +++ b/include/LeaveRoomDialog.h @@ -10,6 +10,9 @@ class LeaveRoomDialog : public QFrame public: explicit LeaveRoomDialog(QWidget *parent = nullptr); +protected: + void paintEvent(QPaintEvent *event) override; + signals: void closing(bool isLeaving); diff --git a/include/LoginPage.h b/include/LoginPage.h index d5f46f76..b83a146b 100644 --- a/include/LoginPage.h +++ b/include/LoginPage.h @@ -42,6 +42,9 @@ public: signals: void backButtonClicked(); +protected: + void paintEvent(QPaintEvent *event) override; + public slots: // Displays errors produced during the login. void loginError(QString error_message); diff --git a/include/LogoutDialog.h b/include/LogoutDialog.h index e081986e..6b698221 100644 --- a/include/LogoutDialog.h +++ b/include/LogoutDialog.h @@ -27,6 +27,9 @@ class LogoutDialog : public QFrame public: explicit LogoutDialog(QWidget *parent = nullptr); +protected: + void paintEvent(QPaintEvent *event) override; + signals: void closing(bool isLoggingOut); diff --git a/include/RegisterPage.h b/include/RegisterPage.h index e0a3b6d8..34fdf268 100644 --- a/include/RegisterPage.h +++ b/include/RegisterPage.h @@ -35,6 +35,9 @@ public: RegisterPage(QSharedPointer client, QWidget *parent = 0); ~RegisterPage(); +protected: + void paintEvent(QPaintEvent *event) override; + signals: void backButtonClicked(); diff --git a/include/UserSettingsPage.h b/include/UserSettingsPage.h index d8160cbe..3d4d9be4 100644 --- a/include/UserSettingsPage.h +++ b/include/UserSettingsPage.h @@ -65,6 +65,7 @@ public: protected: void showEvent(QShowEvent *event) override; void resizeEvent(QResizeEvent *event) override; + void paintEvent(QPaintEvent *event) override; signals: void moveBack(); diff --git a/include/WelcomePage.h b/include/WelcomePage.h index 73b612a8..4f6b63a6 100644 --- a/include/WelcomePage.h +++ b/include/WelcomePage.h @@ -28,6 +28,9 @@ class WelcomePage : public QWidget public: explicit WelcomePage(QWidget *parent = 0); +protected: + void paintEvent(QPaintEvent *event) override; + signals: // Notify that the user wants to login in. void userLogin(); diff --git a/resources/styles/nheko.qss b/resources/styles/nheko.qss index caaac6b9..76ff7b5e 100644 --- a/resources/styles/nheko.qss +++ b/resources/styles/nheko.qss @@ -1,7 +1,3 @@ -* { - color: #333; -} - QLabel { color: #333; } @@ -10,8 +6,6 @@ QLabel { TimelineView, TimelineView > * { background-color: white; } -QMenu, QMenu > * { background-color: white; } - FlatButton { qproperty-foregroundColor: #333; } RaisedButton { qproperty-foregroundColor: white; } @@ -42,6 +36,10 @@ UserInfoWidget, UserInfoWidget > * { color: #ebebeb; } +UserSettingsPage { + background-color: white; +} + Avatar { qproperty-textColor: black; qproperty-backgroundColor: #eee; @@ -54,3 +52,28 @@ Avatar { #userIdLabel { color: #555459; } + +LogoutDialog { + background-color: white; + color: #333; +} + +LeaveRoomDialog { + background-color: white; + color: #333; +} + +WelcomePage { + background-color: white; + color: #333; +} + +LoginPage { + background-color: white; + color: #333; +} + +RegisterPage { + background-color: white; + color: #333; +} diff --git a/src/LeaveRoomDialog.cc b/src/LeaveRoomDialog.cc index cd4a3260..a6aedbfe 100644 --- a/src/LeaveRoomDialog.cc +++ b/src/LeaveRoomDialog.cc @@ -1,5 +1,6 @@ #include #include +#include #include "Config.h" #include "FlatButton.h" @@ -43,3 +44,12 @@ LeaveRoomDialog::LeaveRoomDialog(QWidget *parent) connect(confirmBtn_, &QPushButton::clicked, [=]() { emit closing(true); }); connect(cancelBtn_, &QPushButton::clicked, [=]() { emit closing(false); }); } + +void +LeaveRoomDialog::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} diff --git a/src/LoginPage.cc b/src/LoginPage.cc index 5c766b78..c4923c7d 100644 --- a/src/LoginPage.cc +++ b/src/LoginPage.cc @@ -15,6 +15,8 @@ * along with this program. If not, see . */ +#include + #include "LoginPage.h" #include "Config.h" #include "FlatButton.h" @@ -301,4 +303,13 @@ LoginPage::onBackButtonClicked() emit backButtonClicked(); } +void +LoginPage::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} + LoginPage::~LoginPage() {} diff --git a/src/LogoutDialog.cc b/src/LogoutDialog.cc index c0db1270..8be6e166 100644 --- a/src/LogoutDialog.cc +++ b/src/LogoutDialog.cc @@ -17,6 +17,8 @@ #include #include +#include +#include #include "Config.h" #include "FlatButton.h" @@ -27,7 +29,6 @@ LogoutDialog::LogoutDialog(QWidget *parent) : QFrame(parent) { setMaximumSize(400, 400); - // setStyleSheet("background-color: #fff"); auto layout = new QVBoxLayout(this); layout->setSpacing(30); @@ -52,7 +53,6 @@ LogoutDialog::LogoutDialog(QWidget *parent) auto label = new QLabel(tr("Logout. Are you sure?"), this); label->setFont(font); - // label->setStyleSheet("color: #333333"); layout->addWidget(label); layout->addLayout(buttonLayout); @@ -60,3 +60,12 @@ LogoutDialog::LogoutDialog(QWidget *parent) connect(confirmBtn_, &QPushButton::clicked, [=]() { emit closing(true); }); connect(cancelBtn_, &QPushButton::clicked, [=]() { emit closing(false); }); } + +void +LogoutDialog::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} diff --git a/src/RegisterPage.cc b/src/RegisterPage.cc index 01f3b28f..52a0ac02 100644 --- a/src/RegisterPage.cc +++ b/src/RegisterPage.cc @@ -15,6 +15,8 @@ * along with this program. If not, see . */ +#include + #include "RegisterPage.h" #include "Avatar.h" #include "Config.h" @@ -186,4 +188,13 @@ RegisterPage::onRegisterButtonClicked() } } +void +RegisterPage::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} + RegisterPage::~RegisterPage() {} diff --git a/src/UserSettingsPage.cc b/src/UserSettingsPage.cc index e53ad668..997f3eef 100644 --- a/src/UserSettingsPage.cc +++ b/src/UserSettingsPage.cc @@ -152,3 +152,12 @@ UserSettingsPage::resizeEvent(QResizeEvent *event) QWidget::resizeEvent(event); } + +void +UserSettingsPage::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} diff --git a/src/WelcomePage.cc b/src/WelcomePage.cc index f361ca05..e1c74d3e 100644 --- a/src/WelcomePage.cc +++ b/src/WelcomePage.cc @@ -15,6 +15,7 @@ * along with this program. If not, see . */ +#include #include #include @@ -83,3 +84,12 @@ WelcomePage::WelcomePage(QWidget *parent) connect(registerBtn_, &QPushButton::clicked, this, &WelcomePage::userRegister); connect(loginBtn_, &QPushButton::clicked, this, &WelcomePage::userLogin); } + +void +WelcomePage::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +}