summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-01-11 04:12:42 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2022-01-11 04:12:42 +0100
commit59bc8307c8e9cd50c4d70d11e418a427c5c86fa2 (patch)
tree3af1a8d61aa8ea51f24925e04d826ca8c672b22e
parentPort usersettings to qml (diff)
downloadnheko-59bc8307c8e9cd50c4d70d11e418a427c5c86fa2.tar.xz
Address review comments
-rw-r--r--resources/qml/UserSettingsPage.qml19
-rw-r--r--resources/qml/components/FlatButton.qml1
-rw-r--r--src/UserSettingsPage.cpp1
3 files changed, 8 insertions, 13 deletions
diff --git a/resources/qml/UserSettingsPage.qml b/resources/qml/UserSettingsPage.qml
index 025f44fa..588f0c2c 100644
--- a/resources/qml/UserSettingsPage.qml
+++ b/resources/qml/UserSettingsPage.qml
@@ -6,22 +6,18 @@
 import "ui"
 import Qt.labs.platform 1.1 as Platform
 import QtQuick 2.15
-import QtQuick.Controls 2.3
+import QtQuick.Controls 2.15
 import QtQuick.Layouts 1.2
-import QtQuick.Window 2.13
+import QtQuick.Window 2.15
 import im.nheko 1.0
 
 Rectangle {
     id: userSettingsDialog
 
-    property bool collapsed: width < 800
+    property int collapsePoint: 800
+    property bool collapsed: width < collapsePoint
     color: Nheko.colors.window
 
-    Shortcut {
-        sequence: StandardKey.Cancel
-        onActivated: userSettingsDialog.close()
-    }
-
     ScrollView {
         id: scroll
 
@@ -51,8 +47,8 @@ Rectangle {
             columnSpacing: Nheko.paddingMedium
 
             anchors.fill: parent
-            anchors.leftMargin: userSettingsDialog.collapsed ? Nheko.paddingLarge : (userSettingsDialog.width-600) * 0.4
-            anchors.rightMargin: userSettingsDialog.collapsed ? Nheko.paddingLarge : (userSettingsDialog.width-600) * 0.4
+            anchors.leftMargin: userSettingsDialog.collapsed ? Nheko.paddingLarge : (userSettingsDialog.width-userSettingsDialog.collapsePoint) * 0.4
+            anchors.rightMargin: anchors.leftMargin
 
             Repeater {
                 model: UserSettingsModel
@@ -63,7 +59,6 @@ Rectangle {
 
                     Component.onCompleted: {
                         while (children.length) { 
-                            console.log("Reparenting: " + children[0]);
                             children[0].parent = grid;
                         }
                     }
@@ -79,7 +74,7 @@ Rectangle {
                         Layout.minimumWidth: implicitWidth
                         Layout.leftMargin: model.type == UserSettingsModel.SectionTitle ? 0 : Nheko.paddingMedium
                         Layout.topMargin: model.type == UserSettingsModel.SectionTitle ? Nheko.paddingLarge : 0
-                        font.pointSize: 1.1 * fontInfo.pointSize
+                        font.pointSize: 1.1 * fontMetrics.font.pointSize
 
                         HoverHandler {
                             id: hovered
diff --git a/resources/qml/components/FlatButton.qml b/resources/qml/components/FlatButton.qml
index 1978b373..8ca3f104 100644
--- a/resources/qml/components/FlatButton.qml
+++ b/resources/qml/components/FlatButton.qml
@@ -8,6 +8,7 @@ import QtQuick 2.9
 import QtQuick.Controls 2.5
 import im.nheko 1.0
 
+// FIXME(Nico): Don't use hardcoded colors.
 Button {
     id: control
 
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp
index b6d05fb5..c43727a2 100644
--- a/src/UserSettingsPage.cpp
+++ b/src/UserSettingsPage.cpp
@@ -964,7 +964,6 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
             return data(index, Values).toStringList().indexOf(i->emojiFont());
         case Ringtone: {
             auto v = i->ringtone();
-            nhlog::ui()->critical("ringtone: {}", v.toStdString());
             if (v == QStringView(u"Mute"))
                 return 0;
             else if (v == QStringView(u"Default"))