summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-07-15 17:11:46 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-07-15 17:11:46 +0300
commit30fb46e25b5a2eaeb66f68c9488c5784ed64190d (patch)
tree0091ac126af6168907798fc41b150f1bd5942d9f /include
parentLinting (diff)
downloadnheko-30fb46e25b5a2eaeb66f68c9488c5784ed64190d.tar.xz
Use pixels to specify the font sizes
Basically reverts the last font related commits since pointSize isn't
as reliable as pixelSize.

Also some layout values (margins, spacings) have been moved out to Config.h.
Diffstat (limited to 'include')
-rw-r--r--include/Config.h63
-rw-r--r--include/RoomInfoListItem.h6
-rw-r--r--include/TextInputWidget.h3
-rw-r--r--include/TimelineItem.h10
-rw-r--r--include/TopRoomBar.h3
-rw-r--r--include/UserInfoWidget.h3
-rw-r--r--include/ui/Menu.h7
7 files changed, 71 insertions, 24 deletions
diff --git a/include/Config.h b/include/Config.h
new file mode 100644

index 00000000..147f4446 --- /dev/null +++ b/include/Config.h
@@ -0,0 +1,63 @@ +#pragma once + +// Non-theme app configuration. Layouts, fonts spacing etc. +// +// Font sizes are in pixels. + +namespace conf +{ +// Global settings. +static const int fontSize = 12; +static const int emojiSize = 14; +static const int headerFontSize = 21; + +// Button settings. +namespace btn +{ +static const int fontSize = 20; +static const int cornerRadius = 3; +} + +// RoomList specific. +namespace roomlist +{ +namespace fonts +{ +static const int heading = 13; +static const int badge = 10; +static const int bubble = 20; +} // namespace fonts +} // namespace roomlist + +namespace userInfoWidget +{ +namespace fonts +{ +static const int displayName = 16; +static const int userid = 14; +} // namespace fonts +} // namespace userInfoWidget + +namespace topRoomBar +{ +namespace fonts +{ +static const int roomName = 15; +static const int roomDescription = 13; +} // namespace fonts +} // namespace topRoomBar + +namespace timeline +{ +static const int msgMargin = 11; +static const int avatarSize = 36; +static const int headerSpacing = 5; +static const int headerLeftMargin = 12; + +namespace fonts +{ +static const int timestamp = 9; +} +} + +} // namespace conf diff --git a/include/RoomInfoListItem.h b/include/RoomInfoListItem.h
index f725dc06..12d5abb1 100644 --- a/include/RoomInfoListItem.h +++ b/include/RoomInfoListItem.h
@@ -75,12 +75,6 @@ private: QPixmap roomAvatar_; - // Sizes are relative to the default font size of the Widget. - static const float UnreadCountFontRatio; - static const float RoomNameFontRatio; - static const float RoomDescriptionFontRatio; - static const float RoomAvatarLetterFontRatio; - Menu *menu_; QAction *toggleNotifications_; diff --git a/include/TextInputWidget.h b/include/TextInputWidget.h
index e176d48c..225750f2 100644 --- a/include/TextInputWidget.h +++ b/include/TextInputWidget.h
@@ -63,7 +63,4 @@ private: FlatButton *send_file_button_; FlatButton *send_message_button_; EmojiPickButton *emoji_button_; - - const float TextFontRatio = 1.1; - const float EmojiFontRatio = 1.3; }; diff --git a/include/TimelineItem.h b/include/TimelineItem.h
index 6fd26f52..50a21df3 100644 --- a/include/TimelineItem.h +++ b/include/TimelineItem.h
@@ -69,16 +69,10 @@ private: QHBoxLayout *headerLayout_; // Username (&) Timestamp - int MessageMargin; - - const int AvatarSize = 36; - const float TimestampFontRatio = 0.8; - const float EmojiFontRatio = 1.4; - - float EmojiSize = 13; - Avatar *userAvatar_; + QFont font_; + QLabel *timestamp_; QLabel *userName_; QLabel *body_; diff --git a/include/TopRoomBar.h b/include/TopRoomBar.h
index ad246090..d5cb8e8e 100644 --- a/include/TopRoomBar.h +++ b/include/TopRoomBar.h
@@ -68,9 +68,6 @@ private: Avatar *avatar_; int buttonSize_; - - const float RoomNameFontRatio = 1.2; - const float RoomDescriptionFontRatio = 1; }; inline void TopRoomBar::updateRoomAvatar(const QImage &avatar_image) diff --git a/include/UserInfoWidget.h b/include/UserInfoWidget.h
index 35f7a6f5..10c770d8 100644 --- a/include/UserInfoWidget.h +++ b/include/UserInfoWidget.h
@@ -72,7 +72,4 @@ private: LogoutDialog *logoutDialog_; int logoutButtonSize_; - - const float DisplayNameFontRatio = 1.3; - const float UserIdFontRatio = 1.1; }; diff --git a/include/ui/Menu.h b/include/ui/Menu.h
index 44c13b79..7794b2d2 100644 --- a/include/ui/Menu.h +++ b/include/ui/Menu.h
@@ -2,13 +2,18 @@ #include <QMenu> +#include "Config.h" + class Menu : public QMenu { public: Menu(QWidget *parent = nullptr) : QMenu(parent) { - setFont(QFont("Open Sans", 10)); + QFont font; + font.setPixelSize(conf::fontSize); + + setFont(font); setStyleSheet( "QMenu { color: black; background-color: white; margin: 0px;}" "QMenu::item { color: black; padding: 7px 20px; border: 1px solid transparent; margin: 2px 0px; }"