summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-11-25 18:19:58 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-11-25 18:19:58 +0200
commitf0ecf6eee6d6c9270f2e21f4f57af3f91044bd6c (patch)
tree362b97bd8b3e1a44b373a28efaa6ef67207e5ed9 /src
parentf36e498503860a5c3051ef202c60b61876150c61 (diff)
Add dark theme
Diffstat (limited to 'src')
-rw-r--r--src/EmojiPanel.cc12
-rw-r--r--src/LeaveRoomDialog.cc1
-rw-r--r--src/LoginPage.cc1
-rw-r--r--src/TimelineView.cc1
-rw-r--r--src/UserSettingsPage.cc18
-rw-r--r--src/main.cc18
6 files changed, 33 insertions, 18 deletions
diff --git a/src/EmojiPanel.cc b/src/EmojiPanel.cc
index ce342007..0daaad68 100644
--- a/src/EmojiPanel.cc
+++ b/src/EmojiPanel.cc
@@ -52,7 +52,9 @@ EmojiPanel::EmojiPanel(QWidget *parent)
contentLayout->setSpacing(0);
auto emojiCategories = new QFrame(mainWidget);
- emojiCategories->setStyleSheet("background-color: #f2f2f2");
+ emojiCategories->setStyleSheet(
+ QString("background-color: %1")
+ .arg(palette().color(QPalette::Window).darker(110).name()));
auto categoriesLayout = new QHBoxLayout(emojiCategories);
categoriesLayout->setSpacing(0);
@@ -64,49 +66,41 @@ EmojiPanel::EmojiPanel(QWidget *parent)
icon.addFile(":/icons/icons/emoji-categories/people.png");
peopleCategory->setIcon(icon);
peopleCategory->setIconSize(QSize(categoryIconSize_, categoryIconSize_));
- peopleCategory->setForegroundColor("gray");
auto natureCategory_ = new FlatButton(emojiCategories);
icon.addFile(":/icons/icons/emoji-categories/nature.png");
natureCategory_->setIcon(icon);
natureCategory_->setIconSize(QSize(categoryIconSize_, categoryIconSize_));
- natureCategory_->setForegroundColor("gray");
auto foodCategory_ = new FlatButton(emojiCategories);
icon.addFile(":/icons/icons/emoji-categories/foods.png");
foodCategory_->setIcon(icon);
foodCategory_->setIconSize(QSize(categoryIconSize_, categoryIconSize_));
- foodCategory_->setForegroundColor("gray");
auto activityCategory = new FlatButton(emojiCategories);
icon.addFile(":/icons/icons/emoji-categories/activity.png");
activityCategory->setIcon(icon);
activityCategory->setIconSize(QSize(categoryIconSize_, categoryIconSize_));
- activityCategory->setForegroundColor("gray");
auto travelCategory = new FlatButton(emojiCategories);
icon.addFile(":/icons/icons/emoji-categories/travel.png");
travelCategory->setIcon(icon);
travelCategory->setIconSize(QSize(categoryIconSize_, categoryIconSize_));
- travelCategory->setForegroundColor("gray");
auto objectsCategory = new FlatButton(emojiCategories);
icon.addFile(":/icons/icons/emoji-categories/objects.png");
objectsCategory->setIcon(icon);
objectsCategory->setIconSize(QSize(categoryIconSize_, categoryIconSize_));
- objectsCategory->setForegroundColor("gray");
auto symbolsCategory = new FlatButton(emojiCategories);
icon.addFile(":/icons/icons/emoji-categories/symbols.png");
symbolsCategory->setIcon(icon);
symbolsCategory->setIconSize(QSize(categoryIconSize_, categoryIconSize_));
- symbolsCategory->setForegroundColor("gray");
auto flagsCategory = new FlatButton(emojiCategories);
icon.addFile(":/icons/icons/emoji-categories/flags.png");
flagsCategory->setIcon(icon);
flagsCategory->setIconSize(QSize(categoryIconSize_, categoryIconSize_));
- flagsCategory->setForegroundColor("gray");
categoriesLayout->addWidget(peopleCategory);
categoriesLayout->addWidget(natureCategory_);
diff --git a/src/LeaveRoomDialog.cc b/src/LeaveRoomDialog.cc
index b99818b9..e9877a24 100644
--- a/src/LeaveRoomDialog.cc
+++ b/src/LeaveRoomDialog.cc
@@ -35,7 +35,6 @@ LeaveRoomDialog::LeaveRoomDialog(QWidget *parent)
auto label = new QLabel(tr("Are you sure you want to leave?"), this);
label->setFont(font);
- label->setStyleSheet("color: #333333");
layout->addWidget(label);
layout->addLayout(buttonLayout);
diff --git a/src/LoginPage.cc b/src/LoginPage.cc
index f24e2fde..ef665b39 100644
--- a/src/LoginPage.cc
+++ b/src/LoginPage.cc
@@ -78,7 +78,6 @@ LoginPage::LoginPage(QSharedPointer<MatrixClient> client, QWidget *parent)
matrixid_input_->setPlaceholderText(tr("e.g @joe:matrix.org"));
spinner_ = new LoadingIndicator(this);
- spinner_->setColor("#333333");
spinner_->setFixedHeight(40);
spinner_->setFixedWidth(40);
spinner_->hide();
diff --git a/src/TimelineView.cc b/src/TimelineView.cc
index 44f3b9d8..64b68a1e 100644
--- a/src/TimelineView.cc
+++ b/src/TimelineView.cc
@@ -416,6 +416,7 @@ TimelineView::init()
scroll_widget_ = new QWidget(this);
scroll_layout_ = new QVBoxLayout(scroll_widget_);
+ scroll_layout_->setContentsMargins(15, 0, 15, 15);
scroll_layout_->addStretch(1);
scroll_layout_->setSpacing(0);
scroll_layout_->setObjectName("timelinescrollarea");
diff --git a/src/UserSettingsPage.cc b/src/UserSettingsPage.cc
index 997f3eef..79f8f7bd 100644
--- a/src/UserSettingsPage.cc
+++ b/src/UserSettingsPage.cc
@@ -96,7 +96,8 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
themeOptionLayout_->setContentsMargins(0, OptionMargin, 0, OptionMargin);
auto themeLabel_ = new QLabel(tr("App theme"), this);
themeCombo_ = new QComboBox(this);
- themeCombo_->addItem("Default");
+ themeCombo_->addItem("Light");
+ themeCombo_->addItem("Dark");
themeCombo_->addItem("System");
themeLabel_->setStyleSheet("font-size: 15px;");
@@ -104,7 +105,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
themeOptionLayout_->addWidget(themeCombo_, 0, Qt::AlignBottom | Qt::AlignRight);
auto general_ = new QLabel(tr("GENERAL"), this);
- general_->setStyleSheet("font-size: 17px; color: #5d6565");
+ general_->setStyleSheet("font-size: 17px");
mainLayout_ = new QVBoxLayout;
mainLayout_->setSpacing(7);
@@ -139,7 +140,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
void
UserSettingsPage::showEvent(QShowEvent *)
{
- themeCombo_->setCurrentIndex((settings_->theme() == "default" ? 0 : 1));
+ restoreThemeCombo();
trayToggle_->setState(!settings_->isTrayEnabled()); // Treats true as "off"
}
@@ -161,3 +162,14 @@ UserSettingsPage::paintEvent(QPaintEvent *)
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
+
+void
+UserSettingsPage::restoreThemeCombo() const
+{
+ if (settings_->theme() == "light")
+ themeCombo_->setCurrentIndex(0);
+ else if (settings_->theme() == "dark")
+ themeCombo_->setCurrentIndex(1);
+ else
+ themeCombo_->setCurrentIndex(2);
+}
diff --git a/src/main.cc b/src/main.cc
index 9ca1d5de..7338e578 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -75,15 +75,25 @@ main(int argc, char *argv[])
QFile stylefile;
- if (!settings.contains("user/theme")) {
- settings.setValue("user/theme", "default");
- }
+ if (!settings.contains("user/theme"))
+ settings.setValue("user/theme", "light");
+
+ const auto theme = settings.value("user/theme", "light").toString();
+
+ QPalette pal;
- if (settings.value("user/theme").toString() == "default") {
+ if (theme == "light") {
stylefile.setFileName(":/styles/styles/nheko.qss");
+ pal.setColor(QPalette::Link, QColor("#333"));
+ } else if (theme == "dark") {
+ stylefile.setFileName(":/styles/styles/nheko-dark.qss");
+ pal.setColor(QPalette::Link, QColor("#d7d9dc"));
} else {
stylefile.setFileName(":/styles/styles/system.qss");
}
+
+ app.setPalette(pal);
+
stylefile.open(QFile::ReadOnly);
QString stylesheet = QString(stylefile.readAll());