summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChatPage.cc7
-rw-r--r--src/EmojiPanel.cc17
-rw-r--r--src/LoginPage.cc28
-rw-r--r--src/LogoutDialog.cc4
-rw-r--r--src/MainWindow.cc3
-rw-r--r--src/RegisterPage.cc32
-rw-r--r--src/RoomInfoListItem.cc30
-rw-r--r--src/RoomList.cc4
-rw-r--r--src/TextInputWidget.cc13
-rw-r--r--src/TimelineItem.cc25
-rw-r--r--src/TimelineView.cc11
-rw-r--r--src/TopRoomBar.cc2
-rw-r--r--src/UserInfoWidget.cc22
-rw-r--r--src/UserSettingsPage.cc9
-rw-r--r--src/main.cc16
-rw-r--r--src/ui/Badge.cc1
-rw-r--r--src/ui/OverlayWidget.cc11
-rw-r--r--src/ui/TextField.cc2
18 files changed, 153 insertions, 84 deletions
diff --git a/src/ChatPage.cc b/src/ChatPage.cc

index 8dd509be..acc60c03 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc
@@ -49,7 +49,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent) : QWidget(parent) , client_(client) { - setStyleSheet("background-color: #fff;"); + setObjectName("chatPage"); topLayout_ = new QHBoxLayout(this); topLayout_->setSpacing(0); @@ -79,7 +79,8 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent) sideBarLayout_->addWidget(sidebarActions_); // Content - content_ = new QFrame(this); + content_ = new QFrame(this); + content_->setObjectName("mainContent"); contentLayout_ = new QVBoxLayout(content_); contentLayout_->setSpacing(0); contentLayout_->setMargin(0); @@ -544,7 +545,7 @@ ChatPage::showQuickSwitcher() new OverlayModal(MainWindow::instance(), quickSwitcher_.data()), [=](OverlayModal *modal) { modal->deleteLater(); }); quickSwitcherModal_->setDuration(0); - quickSwitcherModal_->setColor(QColor(30, 30, 30, 170)); + // quickSwitcherModal_->setColor(QColor(30, 30, 30, 170)); } QMap<QString, QString> rooms; diff --git a/src/EmojiPanel.cc b/src/EmojiPanel.cc
index 3f5f8369..82eb8afc 100644 --- a/src/EmojiPanel.cc +++ b/src/EmojiPanel.cc
@@ -32,11 +32,9 @@ EmojiPanel::EmojiPanel(QWidget *parent) , animationDuration_{100} , categoryIconSize_{20} { - setStyleSheet("QWidget {background: #fff; color: #e8e8e8; border: none;}" - "QScrollBar:vertical { background-color: #fff; width: 8px; margin: 0px " - "2px 0 2px; }" - "QScrollBar::handle:vertical { background-color: #d6dde3; min-height: " - "20px; }" + setStyleSheet("QWidget {border: none;}" + "QScrollBar:vertical { width: 8px; margin: 0px 2px 0 2px; }" + "QScrollBar::handle:vertical { min-height: 20px; }" "QScrollBar::add-line:vertical { border: none; background: none; }" "QScrollBar::sub-line:vertical { border: none; background: none; }"); @@ -55,7 +53,7 @@ EmojiPanel::EmojiPanel(QWidget *parent) contentLayout->setMargin(0); auto emojiCategories = new QFrame(mainWidget); - emojiCategories->setStyleSheet("background-color: #f2f2f2"); + // emojiCategories->setStyleSheet("background-color: #f2f2f2"); auto categoriesLayout = new QHBoxLayout(emojiCategories); categoriesLayout->setSpacing(6); @@ -250,6 +248,10 @@ EmojiPanel::leaveEvent(QEvent *event) void EmojiPanel::paintEvent(QPaintEvent *event) { + Q_UNUSED(event); + + QStyleOption opt; + opt.init(this); QPainter p(this); DropShadow::draw(p, shadowMargin_, @@ -262,7 +264,8 @@ EmojiPanel::paintEvent(QPaintEvent *event) width(), height()); - QWidget::paintEvent(event); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + // QWidget::paintEvent(event); } void diff --git a/src/LoginPage.cc b/src/LoginPage.cc
index 0b65f8bc..5c766b78 100644 --- a/src/LoginPage.cc +++ b/src/LoginPage.cc
@@ -30,7 +30,7 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent) , inferredServerAddress_() , client_{client} { - setStyleSheet("background-color: #fff"); + // setStyleSheet("background-color: #fff"); top_layout_ = new QVBoxLayout(); @@ -40,7 +40,7 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent) back_button_ = new FlatButton(this); back_button_->setMinimumSize(QSize(30, 30)); - back_button_->setForegroundColor("#333333"); + // back_button_->setForegroundColor("#333333"); top_bar_layout_->addWidget(back_button_, 0, Qt::AlignLeft | Qt::AlignVCenter); top_bar_layout_->addStretch(1); @@ -75,10 +75,10 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent) form_wrapper_->addStretch(1); matrixid_input_ = new TextField(this); - matrixid_input_->setTextColor("#333333"); + // matrixid_input_->setTextColor("#333333"); matrixid_input_->setLabel(tr("Matrix ID")); - matrixid_input_->setInkColor("#555459"); - matrixid_input_->setBackgroundColor("#fff"); + // matrixid_input_->setInkColor("#555459"); + // matrixid_input_->setBackgroundColor("#fff"); matrixid_input_->setPlaceholderText(tr("e.g @joe:matrix.org")); spinner_ = new LoadingIndicator(this); @@ -95,17 +95,17 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent) matrixidLayout_->addWidget(matrixid_input_, 0, Qt::AlignVCenter); password_input_ = new TextField(this); - password_input_->setTextColor("#333333"); + // password_input_->setTextColor("#333333"); password_input_->setLabel(tr("Password")); - password_input_->setInkColor("#555459"); - password_input_->setBackgroundColor("#fff"); + // password_input_->setInkColor("#555459"); + // password_input_->setBackgroundColor("#fff"); password_input_->setEchoMode(QLineEdit::Password); serverInput_ = new TextField(this); - serverInput_->setTextColor("#333333"); + // serverInput_->setTextColor("#333333"); serverInput_->setLabel("Homeserver address"); - serverInput_->setInkColor("#555459"); - serverInput_->setBackgroundColor("#fff"); + // serverInput_->setInkColor("#555459"); + // serverInput_->setBackgroundColor("#fff"); serverInput_->setPlaceholderText("matrix.org"); serverInput_->hide(); @@ -121,8 +121,8 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent) button_layout_->setContentsMargins(0, 0, 0, 30); login_button_ = new RaisedButton(tr("LOGIN"), this); - login_button_->setBackgroundColor(QColor("#333333")); - login_button_->setForegroundColor(QColor("white")); + // login_button_->setBackgroundColor(QColor("#333333")); + // login_button_->setForegroundColor(QColor("white")); login_button_->setMinimumSize(350, 65); login_button_->setFontSize(20); login_button_->setCornerRadius(3); @@ -136,7 +136,7 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent) error_label_ = new QLabel(this); error_label_->setFont(font); - error_label_->setStyleSheet("color: #E22826"); + // error_label_->setStyleSheet("color: #E22826"); top_layout_->addLayout(top_bar_layout_); top_layout_->addStretch(1); diff --git a/src/LogoutDialog.cc b/src/LogoutDialog.cc
index 7f2cdbd3..c0db1270 100644 --- a/src/LogoutDialog.cc +++ b/src/LogoutDialog.cc
@@ -27,7 +27,7 @@ LogoutDialog::LogoutDialog(QWidget *parent) : QFrame(parent) { setMaximumSize(400, 400); - setStyleSheet("background-color: #fff"); + // setStyleSheet("background-color: #fff"); auto layout = new QVBoxLayout(this); layout->setSpacing(30); @@ -52,7 +52,7 @@ LogoutDialog::LogoutDialog(QWidget *parent) auto label = new QLabel(tr("Logout. Are you sure?"), this); label->setFont(font); - label->setStyleSheet("color: #333333"); + // label->setStyleSheet("color: #333333"); layout->addWidget(label); layout->addLayout(buttonLayout); diff --git a/src/MainWindow.cc b/src/MainWindow.cc
index c5735b68..04b0e8e3 100644 --- a/src/MainWindow.cc +++ b/src/MainWindow.cc
@@ -43,7 +43,6 @@ MainWindow::MainWindow(QWidget *parent) { setWindowTitle("nheko"); setObjectName("MainWindow"); - setStyleSheet("QWidget#MainWindow {background-color: #fff}"); restoreWindowSize(); @@ -204,9 +203,9 @@ MainWindow::showChatPage(QString userid, QString homeserver, QString token) spinner_ = QSharedPointer<LoadingIndicator>( new LoadingIndicator(this), [=](LoadingIndicator *indicator) { indicator->deleteLater(); }); - spinner_->setColor("#acc7dc"); spinner_->setFixedHeight(100); spinner_->setFixedWidth(100); + spinner_->setObjectName("ChatPageLoadSpinner"); spinner_->start(); } diff --git a/src/RegisterPage.cc b/src/RegisterPage.cc
index 304a7dc0..01f3b28f 100644 --- a/src/RegisterPage.cc +++ b/src/RegisterPage.cc
@@ -28,7 +28,7 @@ RegisterPage::RegisterPage(QSharedPointer<MatrixClient> client, QWidget *parent) : QWidget(parent) , client_(client) { - setStyleSheet("background-color: #fff"); + // setStyleSheet("background-color: #fff"); top_layout_ = new QVBoxLayout(); @@ -73,30 +73,30 @@ RegisterPage::RegisterPage(QSharedPointer<MatrixClient> client, QWidget *parent) form_wrapper_->addStretch(1); username_input_ = new TextField(); - username_input_->setTextColor("#333333"); + // username_input_->setTextColor("#333333"); username_input_->setLabel(tr("Username")); - username_input_->setInkColor("#555459"); - username_input_->setBackgroundColor("#fff"); + // username_input_->setInkColor("#555459"); + // username_input_->setBackgroundColor("#fff"); password_input_ = new TextField(); - password_input_->setTextColor("#333333"); + // password_input_->setTextColor("#333333"); password_input_->setLabel(tr("Password")); - password_input_->setInkColor("#555459"); - password_input_->setBackgroundColor("#fff"); + // password_input_->setInkColor("#555459"); + // password_input_->setBackgroundColor("#fff"); password_input_->setEchoMode(QLineEdit::Password); password_confirmation_ = new TextField(); - password_confirmation_->setTextColor("#333333"); + // password_confirmation_->setTextColor("#333333"); password_confirmation_->setLabel(tr("Password confirmation")); - password_confirmation_->setInkColor("#555459"); - password_confirmation_->setBackgroundColor("#fff"); + // password_confirmation_->setInkColor("#555459"); + // password_confirmation_->setBackgroundColor("#fff"); password_confirmation_->setEchoMode(QLineEdit::Password); server_input_ = new TextField(); - server_input_->setTextColor("#333333"); + // server_input_->setTextColor("#333333"); server_input_->setLabel(tr("Home Server")); - server_input_->setInkColor("#555459"); - server_input_->setBackgroundColor("#fff"); + // server_input_->setInkColor("#555459"); + // server_input_->setBackgroundColor("#fff"); form_layout_->addWidget(username_input_, Qt::AlignHCenter, 0); form_layout_->addWidget(password_input_, Qt::AlignHCenter, 0); @@ -112,11 +112,11 @@ RegisterPage::RegisterPage(QSharedPointer<MatrixClient> client, QWidget *parent) error_label_ = new QLabel(this); error_label_->setFont(font); - error_label_->setStyleSheet("color: #E22826"); + // error_label_->setStyleSheet("color: #E22826"); register_button_ = new RaisedButton(tr("REGISTER"), this); - register_button_->setBackgroundColor(QColor("#333333")); - register_button_->setForegroundColor(QColor("white")); + // register_button_->setBackgroundColor(QColor("#333333")); + // register_button_->setForegroundColor(QColor("white")); register_button_->setMinimumSize(350, 65); register_button_->setFontSize(conf::btn::fontSize); register_button_->setCornerRadius(conf::btn::cornerRadius); diff --git a/src/RoomInfoListItem.cc b/src/RoomInfoListItem.cc
index 49b24b58..875bb506 100644 --- a/src/RoomInfoListItem.cc +++ b/src/RoomInfoListItem.cc
@@ -95,18 +95,19 @@ RoomInfoListItem::paintEvent(QPaintEvent *event) p.setRenderHint(QPainter::SmoothPixmapTransform); p.setRenderHint(QPainter::Antialiasing); - if (isPressed_) - p.fillRect(rect(), QColor("#38A3D8")); - else if (underMouse()) - p.fillRect(rect(), QColor(200, 200, 200, 128)); - else - p.fillRect(rect(), QColor("#FFF")); - QFont font; font.setPixelSize(conf::fontSize); QFontMetrics metrics(font); - p.setPen(QColor("#333")); + if (isPressed_) { + p.fillRect(rect(), highlightedBackgroundColor_); + } else if (underMouse()) { + p.fillRect(rect(), hoverBackgroundColor_); + } else { + p.fillRect(rect(), backgroundColor_); + } + + // p.setPen(QColor("#333")); QRect avatarRegion(Padding, Padding, IconSize, IconSize); @@ -115,10 +116,12 @@ RoomInfoListItem::paintEvent(QPaintEvent *event) if (width() > ui::sidebar::SmallSize) { if (isPressed_) { - QPen pen(QColor("white")); + QPen pen(highlightedTitleColor_); + p.setPen(pen); + } else { + QPen pen(titleColor_); p.setPen(pen); } - font.setPixelSize(conf::roomlist::fonts::heading); p.setFont(font); @@ -130,8 +133,11 @@ RoomInfoListItem::paintEvent(QPaintEvent *event) state_.getName(), Qt::ElideRight, (width() - IconSize - 2 * Padding) * 0.8); p.drawText(QPoint(2 * Padding + IconSize, top_y), name); - if (!isPressed_) { - QPen pen(QColor("#5d6565")); + if (isPressed_) { + QPen pen(highlightedSubtitleColor_); + p.setPen(pen); + } else { + QPen pen(subtitleColor_); p.setPen(pen); } diff --git a/src/RoomList.cc b/src/RoomList.cc
index 5b10d1c5..b1d3a9ca 100644 --- a/src/RoomList.cc +++ b/src/RoomList.cc
@@ -33,9 +33,7 @@ RoomList::RoomList(QSharedPointer<MatrixClient> client, QWidget *parent) : QWidget(parent) , client_(client) { - setStyleSheet( - "border: 1px solid #ccc; border-right: 0px solid #000; border-left: 0px solid #000;"); - + setStyleSheet("border: none;"); topLayout_ = new QVBoxLayout(this); topLayout_->setSpacing(0); topLayout_->setMargin(0); diff --git a/src/TextInputWidget.cc b/src/TextInputWidget.cc
index c086db85..829784fd 100644 --- a/src/TextInputWidget.cc +++ b/src/TextInputWidget.cc
@@ -176,7 +176,6 @@ TextInputWidget::TextInputWidget(QWidget *parent) setFixedHeight(conf::textInput::height); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setCursor(Qt::ArrowCursor); - setStyleSheet("background-color: #fff;"); topLayout_ = new QHBoxLayout(); topLayout_->setSpacing(0); @@ -192,6 +191,7 @@ TextInputWidget::TextInputWidget(QWidget *parent) spinner_ = new LoadingIndicator(this); spinner_->setFixedHeight(32); spinner_->setFixedWidth(32); + spinner_->setObjectName("FileUploadSpinner"); spinner_->hide(); QFont font; @@ -202,7 +202,7 @@ TextInputWidget::TextInputWidget(QWidget *parent) input_->setFont(font); input_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); input_->setPlaceholderText(tr("Write a message...")); - input_->setStyleSheet("color: #333333; border: none; padding-top: 5px; margin: 0 5px"); + input_->setStyleSheet("border: none; padding-top: 5px;"); sendMessageBtn_ = new FlatButton(this); @@ -335,3 +335,12 @@ TextInputWidget::focusInEvent(QFocusEvent *event) { input_->setFocus(event->reason()); } + +void +TextInputWidget::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} diff --git a/src/TimelineItem.cc b/src/TimelineItem.cc
index efc12d42..8c21e61d 100644 --- a/src/TimelineItem.cc +++ b/src/TimelineItem.cc
@@ -30,7 +30,7 @@ #include "TimelineViewManager.h" static const QRegExp URL_REGEX("((?:https?|ftp)://\\S+)"); -static const QString URL_HTML = "<a href=\"\\1\" style=\"color: #333333\">\\1</a>"; +static const QString URL_HTML = "<a href=\"\\1\">\\1</a>"; namespace events = matrix::events; namespace msgs = matrix::events::messages; @@ -205,7 +205,7 @@ TimelineItem::TimelineItem(const events::MessageEvent<msgs::Notice> &event, body.replace(URL_REGEX, URL_HTML); body.replace("\n", "<br/>"); - body = "<i style=\"color: #565E5E\">" + body + "</i>"; + body = "<i>" + body + "</i>"; if (with_sender) { auto displayName = TimelineViewManager::displayName(event.sender()); @@ -308,7 +308,7 @@ TimelineItem::TimelineItem(const events::MessageEvent<msgs::Text> &event, void TimelineItem::generateBody(const QString &body) { - QString content("<span style=\"color: black;\"> %1 </span>"); + QString content("<span> %1 </span>"); body_ = new QLabel(this); body_->setFont(font_); @@ -332,8 +332,8 @@ TimelineItem::generateBody(const QString &userid, const QString &body) sender = userid.split(":")[0].split("@")[1]; } - QString userContent("<span style=\"color: #171717\"> %1 </span>"); - QString bodyContent("<span style=\"color: #171717;\"> %1 </span>"); + QString userContent("%1"); + QString bodyContent("%1"); QFont usernameFont = font_; usernameFont.setBold(true); @@ -357,7 +357,7 @@ TimelineItem::generateBody(const QString &userid, const QString &body) void TimelineItem::generateTimestamp(const QDateTime &time) { - QString msg("<span style=\"color: #5d6565;\"> %1 </span>"); + QString msg("%1"); QFont timestampFont; timestampFont.setPixelSize(conf::timeline::fonts::timestamp); @@ -369,6 +369,8 @@ TimelineItem::generateTimestamp(const QDateTime &time) timestamp_->setFont(timestampFont); timestamp_->setText(msg.arg(time.toString("HH:mm"))); timestamp_->setContentsMargins(0, topMargin, 0, 0); + timestamp_->setStyleSheet( + QString("font-size: %1px;").arg(conf::timeline::fonts::timestamp)); } QString @@ -399,8 +401,6 @@ TimelineItem::setupAvatarLayout(const QString &userName) userAvatar_ = new Avatar(this); userAvatar_->setLetter(QChar(userName[0]).toUpper()); - userAvatar_->setBackgroundColor(QColor("#eee")); - userAvatar_->setTextColor(QColor("black")); userAvatar_->setSize(conf::timeline::avatarSize); // TODO: The provided user name should be a UserId class @@ -467,3 +467,12 @@ TimelineItem::descriptiveTime(const QDateTime &then) } TimelineItem::~TimelineItem() {} + +void +TimelineItem::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} diff --git a/src/TimelineView.cc b/src/TimelineView.cc
index b1fb2ad0..267fbbff 100644 --- a/src/TimelineView.cc +++ b/src/TimelineView.cc
@@ -399,7 +399,6 @@ TimelineView::init() const int max = scroll_area_->verticalScrollBar()->maximum(); scroll_area_->verticalScrollBar()->setValue(max); }); - top_layout_ = new QVBoxLayout(this); top_layout_->setSpacing(0); top_layout_->setMargin(0); @@ -416,6 +415,7 @@ TimelineView::init() scroll_layout_ = new QVBoxLayout(scroll_widget_); scroll_layout_->addStretch(1); scroll_layout_->setSpacing(0); + scroll_layout_->setObjectName("timelinescrollarea"); scroll_area_->setWidget(scroll_widget_); @@ -639,3 +639,12 @@ TimelineView::handleFailedMessage(int txnid) // Note: We do this even if the message has already been echoed. QTimer::singleShot(500, this, SLOT(sendNextPendingMessage())); } + +void +TimelineView::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} diff --git a/src/TopRoomBar.cc b/src/TopRoomBar.cc
index 7bec888d..d852ae32 100644 --- a/src/TopRoomBar.cc +++ b/src/TopRoomBar.cc
@@ -41,8 +41,6 @@ TopRoomBar::TopRoomBar(QWidget *parent) avatar_ = new Avatar(this); avatar_->setLetter(QChar('?')); - avatar_->setBackgroundColor(QColor("#d6dde3")); - avatar_->setTextColor(QColor("#555459")); avatar_->setSize(35); textLayout_ = new QVBoxLayout(); diff --git a/src/UserInfoWidget.cc b/src/UserInfoWidget.cc
index f5f3db74..27d6cbbe 100644 --- a/src/UserInfoWidget.cc +++ b/src/UserInfoWidget.cc
@@ -43,17 +43,19 @@ UserInfoWidget::UserInfoWidget(QWidget *parent) textLayout_ = new QVBoxLayout(); userAvatar_ = new Avatar(this); + userAvatar_->setObjectName("userAvatar"); userAvatar_->setLetter(QChar('?')); userAvatar_->setSize(55); - userAvatar_->setBackgroundColor("#fff"); - userAvatar_->setTextColor("#333333"); + // userAvatar_->setBackgroundColor("#fff"); + // userAvatar_->setTextColor("#333333"); QFont nameFont("Open Sans SemiBold"); nameFont.setPixelSize(conf::userInfoWidget::fonts::displayName); displayNameLabel_ = new QLabel(this); displayNameLabel_->setFont(nameFont); - displayNameLabel_->setStyleSheet("padding: 0 9px; color: #171919; margin-bottom: -10px;"); + displayNameLabel_->setObjectName("displayNameLabel"); + displayNameLabel_->setStyleSheet("padding: 0 9px; margin-bottom: -10px;"); displayNameLabel_->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop); QFont useridFont("Open Sans"); @@ -61,7 +63,8 @@ UserInfoWidget::UserInfoWidget(QWidget *parent) userIdLabel_ = new QLabel(this); userIdLabel_->setFont(useridFont); - userIdLabel_->setStyleSheet("padding: 0 8px 8px 8px; color: #555459;"); + userIdLabel_->setObjectName("userIdLabel"); + userIdLabel_->setStyleSheet("padding: 0 8px 8px 8px;"); userIdLabel_->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter); avatarLayout_->addWidget(userAvatar_); @@ -177,3 +180,14 @@ UserInfoWidget::setUserId(const QString &userid) user_id_ = userid; userIdLabel_->setText(userid); } + +void +UserInfoWidget::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event); + + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} diff --git a/src/UserSettingsPage.cc b/src/UserSettingsPage.cc
index 10754cfd..e53ad668 100644 --- a/src/UserSettingsPage.cc +++ b/src/UserSettingsPage.cc
@@ -72,7 +72,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge backBtn_->setIconSize(QSize(24, 24)); auto heading_ = new QLabel(tr("User Settings")); - heading_->setFont(QFont("Open Sans Bold", 22)); + heading_->setStyleSheet("font-weight: bold; font-size: 22px;"); topBarLayout_ = new QHBoxLayout; topBarLayout_->setSpacing(0); @@ -87,7 +87,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge trayToggle_ = new Toggle(this); trayToggle_->setActiveColor(QColor("#38A3D8")); trayToggle_->setInactiveColor(QColor("gray")); - trayLabel->setFont(QFont("Open Sans", 15)); + trayLabel->setStyleSheet("font-size: 15px;"); trayOptionLayout_->addWidget(trayLabel); trayOptionLayout_->addWidget(trayToggle_, 0, Qt::AlignBottom | Qt::AlignRight); @@ -98,14 +98,13 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge themeCombo_ = new QComboBox(this); themeCombo_->addItem("Default"); themeCombo_->addItem("System"); - themeLabel_->setFont(QFont("Open Sans", 15)); + themeLabel_->setStyleSheet("font-size: 15px;"); themeOptionLayout_->addWidget(themeLabel_); themeOptionLayout_->addWidget(themeCombo_, 0, Qt::AlignBottom | Qt::AlignRight); auto general_ = new QLabel(tr("GENERAL"), this); - general_->setFont(QFont("Open Sans Bold", 17)); - general_->setStyleSheet("color: #5d6565"); + general_->setStyleSheet("font-size: 17px; color: #5d6565"); mainLayout_ = new QVBoxLayout; mainLayout_->setSpacing(7); diff --git a/src/main.cc b/src/main.cc
index 8bd77254..9ca1d5de 100644 --- a/src/main.cc +++ b/src/main.cc
@@ -17,6 +17,7 @@ #include <QApplication> #include <QDesktopWidget> +#include <QFile> #include <QFontDatabase> #include <QLibraryInfo> #include <QNetworkProxy> @@ -72,6 +73,21 @@ main(int argc, char *argv[]) QSettings settings; + QFile stylefile; + + if (!settings.contains("user/theme")) { + settings.setValue("user/theme", "default"); + } + + if (settings.value("user/theme").toString() == "default") { + stylefile.setFileName(":/styles/styles/nheko.qss"); + } else { + stylefile.setFileName(":/styles/styles/system.qss"); + } + stylefile.open(QFile::ReadOnly); + QString stylesheet = QString(stylefile.readAll()); + + app.setStyleSheet(stylesheet); // Set the default if a value has not been set. if (settings.value("font/size").toInt() == 0) settings.setValue("font/size", 12); diff --git a/src/ui/Badge.cc b/src/ui/Badge.cc
index 6e73eca0..016ed64f 100644 --- a/src/ui/Badge.cc +++ b/src/ui/Badge.cc
@@ -176,7 +176,6 @@ Badge::paintEvent(QPaintEvent *) QBrush brush; brush.setStyle(Qt::SolidPattern); - brush.setColor(isEnabled() ? backgroundColor() : QColor("#cccccc")); painter.setBrush(brush); painter.setPen(Qt::NoPen); diff --git a/src/ui/OverlayWidget.cc b/src/ui/OverlayWidget.cc
index c69f81f7..ccac0116 100644 --- a/src/ui/OverlayWidget.cc +++ b/src/ui/OverlayWidget.cc
@@ -59,3 +59,14 @@ OverlayWidget::overlayGeometry() const return widget->rect(); } + +void +OverlayWidget::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event); + + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} diff --git a/src/ui/TextField.cc b/src/ui/TextField.cc
index e038f2dd..d80d6466 100644 --- a/src/ui/TextField.cc +++ b/src/ui/TextField.cc
@@ -197,8 +197,6 @@ TextField::paintEvent(QPaintEvent *event) if (text().isEmpty()) { painter.setOpacity(1 - state_machine_->progress()); - // painter.fillRect(rect(), - // parentWidget()->palette().color(backgroundRole())); painter.fillRect(rect(), backgroundColor()); }