summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-22 18:03:12 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-22 18:03:12 +0300
commit3d2e29bfa0ec0ad387064e31e8fcd69097b9a560 (patch)
tree2dc960d1a9f6f2065e60fab4c599c2c09e6478b1
parentAdd option to ignore key requests altogether (diff)
downloadnheko-3d2e29bfa0ec0ad387064e31e8fcd69097b9a560.tar.xz
Remove pixel values from modals, use pointSize instead
-rw-r--r--src/Config.h18
-rw-r--r--src/UserSettingsPage.cpp36
-rw-r--r--src/dialogs/CreateRoom.cpp23
-rw-r--r--src/dialogs/InviteUsers.cpp19
-rw-r--r--src/dialogs/JoinRoom.cpp36
-rw-r--r--src/dialogs/JoinRoom.h3
-rw-r--r--src/dialogs/LeaveRoom.cpp16
-rw-r--r--src/dialogs/Logout.cpp17
-rw-r--r--src/dialogs/MemberList.cpp25
-rw-r--r--src/dialogs/PreviewUploadOverlay.cpp22
-rw-r--r--src/dialogs/ReCaptcha.cpp15
-rw-r--r--src/dialogs/ReadReceipts.cpp23
12 files changed, 154 insertions, 99 deletions
diff --git a/src/Config.h b/src/Config.h
index dea8851a..08db958f 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -33,6 +33,24 @@ namespace dialogs {
 constexpr int labelSize = 15;
 }
 
+namespace modals {
+constexpr int MIN_WIDGET_WIDTH  = 400;
+constexpr int MIN_WIDGET_HEIGHT = 400;
+
+constexpr int WIDGET_MARGIN     = 20;
+constexpr int WIDGET_SPACING    = 15;
+constexpr int WIDGET_TOP_MARGiN = 2 * WIDGET_MARGIN;
+
+constexpr int TEXT_SPACING = 4;
+
+constexpr int BUTTON_SIZE   = 36;
+constexpr int BUTTON_RADIUS = BUTTON_SIZE / 2;
+
+constexpr float BUTTON_TEXT_SIZE_RATIO  = 1.3;
+constexpr float LABEL_MEDIUM_SIZE_RATIO = 1.3;
+constexpr float LABEL_BIG_SIZE_RATIO    = 2;
+}
+
 namespace strings {
 const QString url_html = "<a href=\"\\1\">\\1</a>";
 const QRegExp url_regex(
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp
index 4c249369..04ce5b5d 100644
--- a/src/UserSettingsPage.cpp
+++ b/src/UserSettingsPage.cpp
@@ -118,8 +118,8 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
         backBtn_->setIcon(icon);
         backBtn_->setIconSize(QSize(24, 24));
 
-        auto heading_ = new QLabel(tr("User Settings"));
-        heading_->setStyleSheet("font-weight: bold; font-size: 22px;");
+        QFont font;
+        font.setPointSizeF(font.pointSizeF() * 1.1);
 
         auto versionInfo = new QLabel(QString("%1 | %2").arg(nheko::version).arg(nheko::build_os));
         versionInfo->setTextInteractionFlags(Qt::TextBrowserInteraction);
@@ -128,14 +128,13 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
         topBarLayout_->setSpacing(0);
         topBarLayout_->setMargin(0);
         topBarLayout_->addWidget(backBtn_, 1, Qt::AlignLeft | Qt::AlignVCenter);
-        topBarLayout_->addWidget(heading_, 0, Qt::AlignBottom);
         topBarLayout_->addStretch(1);
 
         auto trayOptionLayout_ = new QHBoxLayout;
         trayOptionLayout_->setContentsMargins(0, OptionMargin, 0, OptionMargin);
         auto trayLabel = new QLabel(tr("Minimize to tray"), this);
-        trayToggle_    = new Toggle(this);
-        trayLabel->setStyleSheet("font-size: 15px;");
+        trayLabel->setFont(font);
+        trayToggle_ = new Toggle(this);
 
         trayOptionLayout_->addWidget(trayLabel);
         trayOptionLayout_->addWidget(trayToggle_, 0, Qt::AlignBottom | Qt::AlignRight);
@@ -143,10 +142,10 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
         auto startInTrayOptionLayout_ = new QHBoxLayout;
         startInTrayOptionLayout_->setContentsMargins(0, OptionMargin, 0, OptionMargin);
         auto startInTrayLabel = new QLabel(tr("Start in tray"), this);
-        startInTrayToggle_    = new Toggle(this);
+        startInTrayLabel->setFont(font);
+        startInTrayToggle_ = new Toggle(this);
         if (!settings_->isTrayEnabled())
                 startInTrayToggle_->setDisabled(true);
-        startInTrayLabel->setStyleSheet("font-size: 15px;");
 
         startInTrayOptionLayout_->addWidget(startInTrayLabel);
         startInTrayOptionLayout_->addWidget(
@@ -154,9 +153,9 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
 
         auto orderRoomLayout = new QHBoxLayout;
         orderRoomLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
-        auto orderLabel  = new QLabel(tr("Re-order rooms based on activity"), this);
+        auto orderLabel = new QLabel(tr("Re-order rooms based on activity"), this);
+        orderLabel->setFont(font);
         roomOrderToggle_ = new Toggle(this);
-        orderLabel->setStyleSheet("font-size: 15px;");
 
         orderRoomLayout->addWidget(orderLabel);
         orderRoomLayout->addWidget(roomOrderToggle_, 0, Qt::AlignBottom | Qt::AlignRight);
@@ -164,17 +163,17 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
         auto groupViewLayout = new QHBoxLayout;
         groupViewLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
         auto groupViewLabel = new QLabel(tr("Group's sidebar"), this);
-        groupViewToggle_    = new Toggle(this);
-        groupViewLabel->setStyleSheet("font-size: 15px;");
+        groupViewLabel->setFont(font);
+        groupViewToggle_ = new Toggle(this);
 
         groupViewLayout->addWidget(groupViewLabel);
         groupViewLayout->addWidget(groupViewToggle_, 0, Qt::AlignBottom | Qt::AlignRight);
 
         auto typingLayout = new QHBoxLayout;
         typingLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
-        auto typingLabel     = new QLabel(tr("Typing notifications"), this);
+        auto typingLabel = new QLabel(tr("Typing notifications"), this);
+        typingLabel->setFont(font);
         typingNotifications_ = new Toggle(this);
-        typingLabel->setStyleSheet("font-size: 15px;");
 
         typingLayout->addWidget(typingLabel);
         typingLayout->addWidget(typingNotifications_, 0, Qt::AlignBottom | Qt::AlignRight);
@@ -182,8 +181,8 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
         auto receiptsLayout = new QHBoxLayout;
         receiptsLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
         auto receiptsLabel = new QLabel(tr("Read receipts"), this);
-        readReceipts_      = new Toggle(this);
-        receiptsLabel->setStyleSheet("font-size: 15px;");
+        receiptsLabel->setFont(font);
+        readReceipts_ = new Toggle(this);
 
         receiptsLayout->addWidget(receiptsLabel);
         receiptsLayout->addWidget(readReceipts_, 0, Qt::AlignBottom | Qt::AlignRight);
@@ -191,17 +190,18 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
         auto themeOptionLayout_ = new QHBoxLayout;
         themeOptionLayout_->setContentsMargins(0, OptionMargin, 0, OptionMargin);
         auto themeLabel_ = new QLabel(tr("Theme"), this);
-        themeCombo_      = new QComboBox(this);
+        themeLabel_->setFont(font);
+        themeCombo_ = new QComboBox(this);
         themeCombo_->addItem("Light");
         themeCombo_->addItem("Dark");
         themeCombo_->addItem("System");
-        themeLabel_->setStyleSheet("font-size: 15px;");
 
         themeOptionLayout_->addWidget(themeLabel_);
         themeOptionLayout_->addWidget(themeCombo_, 0, Qt::AlignBottom | Qt::AlignRight);
 
+        font.setWeight(65);
         auto general_ = new QLabel(tr("GENERAL"), this);
-        general_->setStyleSheet("font-size: 17px");
+        general_->setFont(font);
 
         mainLayout_ = new QVBoxLayout;
         mainLayout_->setSpacing(7);
diff --git a/src/dialogs/CreateRoom.cpp b/src/dialogs/CreateRoom.cpp
index 3c538b49..27407d45 100644
--- a/src/dialogs/CreateRoom.cpp
+++ b/src/dialogs/CreateRoom.cpp
@@ -16,21 +16,25 @@ using namespace dialogs;
 CreateRoom::CreateRoom(QWidget *parent)
   : QFrame(parent)
 {
-        setMaximumSize(520, 600);
+        setMinimumSize(conf::modals::MIN_WIDGET_WIDTH, conf::modals::MIN_WIDGET_HEIGHT);
+        setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
 
         auto layout = new QVBoxLayout(this);
-        layout->setSpacing(30);
-        layout->setMargin(20);
+        layout->setSpacing(conf::modals::WIDGET_SPACING);
+        layout->setMargin(conf::modals::WIDGET_MARGIN);
 
         auto buttonLayout = new QHBoxLayout();
         buttonLayout->setSpacing(0);
         buttonLayout->setMargin(0);
 
+        QFont buttonFont;
+        buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
+
         confirmBtn_ = new FlatButton("CREATE", this);
-        confirmBtn_->setFontSize(conf::btn::fontSize);
+        confirmBtn_->setFont(buttonFont);
 
         cancelBtn_ = new FlatButton(tr("CANCEL"), this);
-        cancelBtn_->setFontSize(conf::btn::fontSize);
+        cancelBtn_->setFont(buttonFont);
 
         buttonLayout->addStretch(1);
         buttonLayout->addWidget(confirmBtn_);
@@ -55,8 +59,7 @@ CreateRoom::CreateRoom(QWidget *parent)
         presetLayout->setContentsMargins(0, 10, 0, 10);
 
         auto visibilityLabel = new QLabel(tr("Room Visibility"), this);
-        visibilityLabel->setStyleSheet(QString("font-size: %1px;").arg(conf::dialogs::labelSize));
-        visibilityCombo_ = new QComboBox(this);
+        visibilityCombo_     = new QComboBox(this);
         visibilityCombo_->addItem("Private");
         visibilityCombo_->addItem("Public");
 
@@ -64,8 +67,7 @@ CreateRoom::CreateRoom(QWidget *parent)
         visibilityLayout->addWidget(visibilityCombo_, 0, Qt::AlignBottom | Qt::AlignRight);
 
         auto presetLabel = new QLabel(tr("Room Preset"), this);
-        presetLabel->setStyleSheet(QString("font-size: %1px;").arg(conf::dialogs::labelSize));
-        presetCombo_ = new QComboBox(this);
+        presetCombo_     = new QComboBox(this);
         presetCombo_->addItem("Private Chat");
         presetCombo_->addItem("Public Chat");
         presetCombo_->addItem("Trusted Private Chat");
@@ -74,8 +76,7 @@ CreateRoom::CreateRoom(QWidget *parent)
         presetLayout->addWidget(presetCombo_, 0, Qt::AlignBottom | Qt::AlignRight);
 
         auto directLabel_ = new QLabel(tr("Direct Chat"), this);
-        directLabel_->setStyleSheet(QString("font-size: %1px;").arg(conf::dialogs::labelSize));
-        directToggle_ = new Toggle(this);
+        directToggle_     = new Toggle(this);
         directToggle_->setActiveColor(QColor("#38A3D8"));
         directToggle_->setInactiveColor(QColor("gray"));
         directToggle_->setState(true);
diff --git a/src/dialogs/InviteUsers.cpp b/src/dialogs/InviteUsers.cpp
index bcd163b0..8361468a 100644
--- a/src/dialogs/InviteUsers.cpp
+++ b/src/dialogs/InviteUsers.cpp
@@ -20,29 +20,30 @@ using namespace dialogs;
 InviteUsers::InviteUsers(QWidget *parent)
   : QFrame(parent)
 {
-        setMaximumSize(400, 350);
+        setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
+        setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
 
         auto layout = new QVBoxLayout(this);
-        layout->setSpacing(30);
-        layout->setMargin(20);
+        layout->setSpacing(conf::modals::WIDGET_SPACING);
+        layout->setMargin(conf::modals::WIDGET_MARGIN);
 
         auto buttonLayout = new QHBoxLayout();
         buttonLayout->setSpacing(0);
         buttonLayout->setMargin(0);
 
+        QFont buttonFont;
+        buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
+
         confirmBtn_ = new FlatButton("INVITE", this);
-        confirmBtn_->setFontSize(conf::btn::fontSize);
+        confirmBtn_->setFont(buttonFont);
 
         cancelBtn_ = new FlatButton(tr("CANCEL"), this);
-        cancelBtn_->setFontSize(conf::btn::fontSize);
+        cancelBtn_->setFont(buttonFont);
 
         buttonLayout->addStretch(1);
         buttonLayout->addWidget(confirmBtn_);
         buttonLayout->addWidget(cancelBtn_);
 
-        QFont font;
-        font.setPixelSize(conf::headerFontSize);
-
         inviteeInput_ = new TextField(this);
         inviteeInput_->setLabel(tr("User ID to invite"));
 
@@ -54,8 +55,6 @@ InviteUsers::InviteUsers(QWidget *parent)
 
         errorLabel_ = new QLabel(this);
         errorLabel_->setAlignment(Qt::AlignCenter);
-        font.setPixelSize(12);
-        errorLabel_->setFont(font);
 
         layout->addWidget(inviteeInput_);
         layout->addWidget(errorLabel_);
diff --git a/src/dialogs/JoinRoom.cpp b/src/dialogs/JoinRoom.cpp
index 05c0f455..1ff6bba1 100644
--- a/src/dialogs/JoinRoom.cpp
+++ b/src/dialogs/JoinRoom.cpp
@@ -14,44 +14,54 @@ using namespace dialogs;
 JoinRoom::JoinRoom(QWidget *parent)
   : QFrame(parent)
 {
-        setMaximumSize(400, 400);
+        setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
+        setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
 
         auto layout = new QVBoxLayout(this);
-        layout->setSpacing(30);
-        layout->setMargin(20);
+        layout->setSpacing(conf::modals::WIDGET_SPACING);
+        layout->setMargin(conf::modals::WIDGET_MARGIN);
 
         auto buttonLayout = new QHBoxLayout();
         buttonLayout->setSpacing(0);
         buttonLayout->setMargin(0);
 
+        QFont buttonFont;
+        buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
+
         confirmBtn_ = new FlatButton("JOIN", this);
-        confirmBtn_->setFontSize(conf::btn::fontSize);
+        confirmBtn_->setFont(buttonFont);
 
         cancelBtn_ = new FlatButton(tr("CANCEL"), this);
-        cancelBtn_->setFontSize(conf::btn::fontSize);
+        cancelBtn_->setFont(buttonFont);
 
         buttonLayout->addStretch(1);
         buttonLayout->addWidget(confirmBtn_);
         buttonLayout->addWidget(cancelBtn_);
 
-        QFont font;
-        font.setPixelSize(conf::headerFontSize);
-
         roomInput_ = new TextField(this);
         roomInput_->setLabel(tr("Room ID or alias"));
 
         layout->addWidget(roomInput_);
         layout->addLayout(buttonLayout);
+        layout->addStretch(1);
 
-        // TODO: input validation with error messages.
-        connect(confirmBtn_, &QPushButton::clicked, [this]() {
-                emit closing(true, roomInput_->text());
-                roomInput_->clear();
-        });
+        connect(roomInput_, &QLineEdit::returnPressed, this, &JoinRoom::handleInput);
+        connect(confirmBtn_, &QPushButton::clicked, this, &JoinRoom::handleInput);
         connect(cancelBtn_, &QPushButton::clicked, [this]() { emit closing(false, ""); });
 }
 
 void
+JoinRoom::handleInput()
+{
+        if (roomInput_->text().isEmpty())
+                return;
+
+        // TODO: input validation with error messages.
+        emit closing(true, roomInput_->text());
+        roomInput_->clear();
+}
+
+void
 JoinRoom::paintEvent(QPaintEvent *)
 {
         QStyleOption opt;
diff --git a/src/dialogs/JoinRoom.h b/src/dialogs/JoinRoom.h
index 5919f08f..0c2f47d7 100644
--- a/src/dialogs/JoinRoom.h
+++ b/src/dialogs/JoinRoom.h
@@ -20,6 +20,9 @@ protected:
         void paintEvent(QPaintEvent *event) override;
         void showEvent(QShowEvent *event) override;
 
+private slots:
+        void handleInput();
+
 private:
         FlatButton *confirmBtn_;
         FlatButton *cancelBtn_;
diff --git a/src/dialogs/LeaveRoom.cpp b/src/dialogs/LeaveRoom.cpp
index 9647d19f..30f8dace 100644
--- a/src/dialogs/LeaveRoom.cpp
+++ b/src/dialogs/LeaveRoom.cpp
@@ -13,28 +13,32 @@ using namespace dialogs;
 LeaveRoom::LeaveRoom(QWidget *parent)
   : QFrame(parent)
 {
-        setMaximumSize(400, 400);
+        setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
+        setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
 
         auto layout = new QVBoxLayout(this);
-        layout->setSpacing(30);
-        layout->setMargin(20);
+        layout->setSpacing(conf::modals::WIDGET_SPACING);
+        layout->setMargin(conf::modals::WIDGET_MARGIN);
 
         auto buttonLayout = new QHBoxLayout();
         buttonLayout->setSpacing(0);
         buttonLayout->setMargin(0);
 
+        QFont buttonFont;
+        buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
+
         confirmBtn_ = new FlatButton("LEAVE", this);
-        confirmBtn_->setFontSize(conf::btn::fontSize);
+        confirmBtn_->setFont(buttonFont);
 
         cancelBtn_ = new FlatButton(tr("CANCEL"), this);
-        cancelBtn_->setFontSize(conf::btn::fontSize);
+        cancelBtn_->setFont(buttonFont);
 
         buttonLayout->addStretch(1);
         buttonLayout->addWidget(confirmBtn_);
         buttonLayout->addWidget(cancelBtn_);
 
         QFont font;
-        font.setPixelSize(conf::headerFontSize);
+        font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_MEDIUM_SIZE_RATIO);
 
         auto label = new QLabel(tr("Are you sure you want to leave?"), this);
         label->setFont(font);
diff --git a/src/dialogs/Logout.cpp b/src/dialogs/Logout.cpp
index e2449817..f790eb92 100644
--- a/src/dialogs/Logout.cpp
+++ b/src/dialogs/Logout.cpp
@@ -31,34 +31,39 @@ using namespace dialogs;
 Logout::Logout(QWidget *parent)
   : QFrame(parent)
 {
-        setMaximumSize(400, 400);
+        setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
+        setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
 
         auto layout = new QVBoxLayout(this);
-        layout->setSpacing(30);
-        layout->setMargin(20);
+        layout->setSpacing(conf::modals::WIDGET_SPACING);
+        layout->setMargin(conf::modals::WIDGET_MARGIN);
 
         auto buttonLayout = new QHBoxLayout();
         buttonLayout->setSpacing(0);
         buttonLayout->setMargin(0);
 
+        QFont buttonFont;
+        buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
+
         confirmBtn_ = new FlatButton("OK", this);
-        confirmBtn_->setFontSize(conf::btn::fontSize);
+        confirmBtn_->setFont(buttonFont);
 
         cancelBtn_ = new FlatButton(tr("CANCEL"), this);
-        cancelBtn_->setFontSize(conf::btn::fontSize);
+        cancelBtn_->setFont(buttonFont);
 
         buttonLayout->addStretch(1);
         buttonLayout->addWidget(confirmBtn_);
         buttonLayout->addWidget(cancelBtn_);
 
         QFont font;
-        font.setPixelSize(conf::headerFontSize);
+        font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_MEDIUM_SIZE_RATIO);
 
         auto label = new QLabel(tr("Logout. Are you sure?"), this);
         label->setFont(font);
 
         layout->addWidget(label);
         layout->addLayout(buttonLayout);
+        layout->addStretch(1);
 
         connect(confirmBtn_, &QPushButton::clicked, [this]() { emit closing(true); });
         connect(cancelBtn_, &QPushButton::clicked, [this]() { emit closing(false); });
diff --git a/src/dialogs/MemberList.cpp b/src/dialogs/MemberList.cpp
index 60c2eb0a..9757b8af 100644
--- a/src/dialogs/MemberList.cpp
+++ b/src/dialogs/MemberList.cpp
@@ -26,7 +26,7 @@ MemberItem::MemberItem(const RoomMember &member, QWidget *parent)
         textLayout_->setSpacing(0);
 
         avatar_ = new Avatar(this);
-        avatar_->setSize(44);
+        avatar_->setSize(46);
         avatar_->setLetter(utils::firstChar(member.display_name));
 
         if (!member.avatar.isNull())
@@ -37,18 +37,14 @@ MemberItem::MemberItem(const RoomMember &member, QWidget *parent)
                                         this,
                                         [this](const QImage &img) { avatar_->setImage(img); });
 
-        QFont nameFont, idFont;
+        QFont nameFont;
         nameFont.setWeight(65);
-        nameFont.setPixelSize(conf::receipts::font + 1);
-        idFont.setWeight(50);
-        idFont.setPixelSize(conf::receipts::font);
+        nameFont.setPointSizeF(nameFont.pointSizeF() * 1.1);
 
+        userId_   = new QLabel(member.user_id, this);
         userName_ = new QLabel(member.display_name, this);
         userName_->setFont(nameFont);
 
-        userId_ = new QLabel(member.user_id, this);
-        userId_->setFont(idFont);
-
         textLayout_->addWidget(userName_);
         textLayout_->addWidget(userId_);
 
@@ -60,12 +56,17 @@ MemberList::MemberList(const QString &room_id, QWidget *parent)
   : QFrame(parent)
   , room_id_{room_id}
 {
-        setMaximumSize(420, 380);
+        QFont doubleFont;
+        doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
+        setMinimumWidth(QFontMetrics(doubleFont).averageCharWidth() * 30);
+        setMinimumHeight(conf::modals::MIN_WIDGET_HEIGHT);
+
+        setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
         setAttribute(Qt::WA_DeleteOnClose, true);
 
         auto layout = new QVBoxLayout(this);
-        layout->setSpacing(30);
-        layout->setMargin(20);
+        layout->setSpacing(conf::modals::WIDGET_SPACING);
+        layout->setMargin(conf::modals::WIDGET_MARGIN);
 
         list_ = new QListWidget;
         list_->setFrameStyle(QFrame::NoFrame);
@@ -74,7 +75,7 @@ MemberList::MemberList(const QString &room_id, QWidget *parent)
         list_->setSpacing(5);
 
         QFont font;
-        font.setPixelSize(conf::headerFontSize);
+        font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_BIG_SIZE_RATIO);
 
         topLabel_ = new QLabel(tr("Room members"), this);
         topLabel_->setAlignment(Qt::AlignCenter);
diff --git a/src/dialogs/PreviewUploadOverlay.cpp b/src/dialogs/PreviewUploadOverlay.cpp
index 7e54ba4e..31167727 100644
--- a/src/dialogs/PreviewUploadOverlay.cpp
+++ b/src/dialogs/PreviewUploadOverlay.cpp
@@ -39,18 +39,23 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent)
   : QWidget{parent}
   , titleLabel_{this}
   , fileName_{this}
-  , upload_{tr("Upload"), this}
-  , cancel_{tr("Cancel"), this}
+  , upload_{tr("Upload").toUpper(), this}
+  , cancel_{tr("Cancel").toUpper(), this}
 {
         auto hlayout = new QHBoxLayout;
+        hlayout->addStretch(1);
         hlayout->addWidget(&upload_);
         hlayout->addWidget(&cancel_);
+        hlayout->setSpacing(0);
+        hlayout->setMargin(0);
 
         auto vlayout = new QVBoxLayout{this};
         vlayout->addWidget(&titleLabel_);
         vlayout->addWidget(&infoLabel_);
         vlayout->addWidget(&fileName_);
         vlayout->addLayout(hlayout);
+        vlayout->setSpacing(conf::modals::WIDGET_SPACING);
+        vlayout->setMargin(conf::modals::WIDGET_MARGIN);
 
         connect(&upload_, &QPushButton::clicked, [this]() {
                 emit confirmUpload(data_, mediaType_, fileName_.text());
@@ -79,8 +84,10 @@ PreviewUploadOverlay::init()
         setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
         setWindowModality(Qt::WindowModal);
 
-        titleLabel_.setStyleSheet(
-          QString{"font-weight: bold; font-size: %1px;"}.arg(conf::headerFontSize));
+        QFont font;
+        font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_MEDIUM_SIZE_RATIO);
+
+        titleLabel_.setFont(font);
         titleLabel_.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
         titleLabel_.setAlignment(Qt::AlignCenter);
         infoLabel_.setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
@@ -88,8 +95,11 @@ PreviewUploadOverlay::init()
         fileName_.setAlignment(Qt::AlignCenter);
         upload_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
         cancel_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
-        upload_.setFontSize(conf::btn::fontSize);
-        cancel_.setFontSize(conf::btn::fontSize);
+
+        QFont buttonFont;
+        buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
+        upload_.setFont(buttonFont);
+        cancel_.setFont(buttonFont);
 
         if (isImage_) {
                 infoLabel_.setAlignment(Qt::AlignCenter);
diff --git a/src/dialogs/ReCaptcha.cpp b/src/dialogs/ReCaptcha.cpp
index 9181d588..0995e955 100644
--- a/src/dialogs/ReCaptcha.cpp
+++ b/src/dialogs/ReCaptcha.cpp
@@ -22,21 +22,24 @@ ReCaptcha::ReCaptcha(const QString &session, QWidget *parent)
         setWindowModality(Qt::WindowModal);
 
         auto layout = new QVBoxLayout(this);
-        layout->setSpacing(30);
-        layout->setMargin(20);
+        layout->setSpacing(conf::modals::WIDGET_SPACING);
+        layout->setMargin(conf::modals::WIDGET_MARGIN);
 
         auto buttonLayout = new QHBoxLayout();
         buttonLayout->setSpacing(8);
         buttonLayout->setMargin(0);
 
+        QFont buttonFont;
+        buttonFont.setPointSizeF(buttonFont.pointSizeF() * conf::modals::BUTTON_TEXT_SIZE_RATIO);
+
         openCaptchaBtn_ = new FlatButton("OPEN reCAPTCHA", this);
-        openCaptchaBtn_->setFontSize(conf::btn::fontSize);
+        openCaptchaBtn_->setFont(buttonFont);
 
         confirmBtn_ = new RaisedButton(tr("CONFIRM"), this);
-        confirmBtn_->setFontSize(conf::btn::fontSize);
+        confirmBtn_->setFont(buttonFont);
 
         cancelBtn_ = new RaisedButton(tr("CANCEL"), this);
-        cancelBtn_->setFontSize(conf::btn::fontSize);
+        cancelBtn_->setFont(buttonFont);
 
         buttonLayout->addStretch(1);
         buttonLayout->addWidget(openCaptchaBtn_);
@@ -44,7 +47,7 @@ ReCaptcha::ReCaptcha(const QString &session, QWidget *parent)
         buttonLayout->addWidget(cancelBtn_);
 
         QFont font;
-        font.setPixelSize(conf::headerFontSize);
+        font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_MEDIUM_SIZE_RATIO);
 
         auto label = new QLabel(tr("Solve the reCAPTCHA and press the confirm button"), this);
         label->setFont(font);
diff --git a/src/dialogs/ReadReceipts.cpp b/src/dialogs/ReadReceipts.cpp
index c27146ac..f3201de5 100644
--- a/src/dialogs/ReadReceipts.cpp
+++ b/src/dialogs/ReadReceipts.cpp
@@ -28,15 +28,16 @@ ReceiptItem::ReceiptItem(QWidget *parent,
 
         textLayout_ = new QVBoxLayout;
         textLayout_->setMargin(0);
-        textLayout_->setSpacing(5);
+        textLayout_->setSpacing(conf::modals::TEXT_SPACING);
 
-        QFont font;
-        font.setPixelSize(conf::receipts::font);
+        QFont nameFont;
+        nameFont.setWeight(65);
+        nameFont.setPointSizeF(nameFont.pointSizeF() * 1.1);
 
         auto displayName = Cache::displayName(room_id, user_id);
 
         avatar_ = new Avatar(this);
-        avatar_->setSize(40);
+        avatar_->setSize(44);
         avatar_->setLetter(utils::firstChar(displayName));
 
         // If it's a matrix id we use the second letter.
@@ -44,10 +45,9 @@ ReceiptItem::ReceiptItem(QWidget *parent,
                 avatar_->setLetter(QChar(displayName.at(1)));
 
         userName_ = new QLabel(displayName, this);
-        userName_->setFont(font);
+        userName_->setFont(nameFont);
 
         timestamp_ = new QLabel(dateFormat(QDateTime::fromMSecsSinceEpoch(timestamp)), this);
-        timestamp_->setFont(font);
 
         textLayout_->addWidget(userName_);
         textLayout_->addWidget(timestamp_);
@@ -80,20 +80,21 @@ ReceiptItem::dateFormat(const QDateTime &then) const
 ReadReceipts::ReadReceipts(QWidget *parent)
   : QFrame(parent)
 {
-        setMaximumSize(400, 350);
+        setMinimumSize(conf::modals::MIN_WIDGET_WIDTH, conf::modals::MIN_WIDGET_HEIGHT);
+        setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
 
         auto layout = new QVBoxLayout(this);
-        layout->setSpacing(30);
-        layout->setMargin(20);
+        layout->setSpacing(conf::modals::WIDGET_SPACING);
+        layout->setMargin(conf::modals::WIDGET_MARGIN);
 
         userList_ = new QListWidget;
         userList_->setFrameStyle(QFrame::NoFrame);
         userList_->setSelectionMode(QAbstractItemView::NoSelection);
         userList_->setAttribute(Qt::WA_MacShowFocusRect, 0);
-        userList_->setSpacing(5);
+        userList_->setSpacing(conf::modals::TEXT_SPACING);
 
         QFont font;
-        font.setPixelSize(conf::headerFontSize);
+        font.setPointSizeF(font.pointSizeF() * conf::modals::LABEL_MEDIUM_SIZE_RATIO);
 
         topLabel_ = new QLabel(tr("Read receipts"), this);
         topLabel_->setAlignment(Qt::AlignCenter);