From d51b632f9f8ebf486a1dbb492dfd0737998bf4ee Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 27 Jul 2022 14:03:49 +0200 Subject: [PATCH] Add more layout fixes --- .../bulk-operations/BulkOperationsDialog.qml | 26 ++++++++++--------- src/qml/common/ImageButton.qml | 2 ++ src/qml/common/platformutils.js | 5 ++++ .../connections/ConnectionSettignsDialog.qml | 2 +- src/qml/server-actions/ServerActionTabs.qml | 5 ++-- src/qml/settings/GlobalSettings.qml | 17 ++++++------ src/qml/settings/IntOption.qml | 4 +-- 7 files changed, 35 insertions(+), 26 deletions(-) diff --git a/src/qml/bulk-operations/BulkOperationsDialog.qml b/src/qml/bulk-operations/BulkOperationsDialog.qml index aa4fcf13..90312e6b 100644 --- a/src/qml/bulk-operations/BulkOperationsDialog.qml +++ b/src/qml/bulk-operations/BulkOperationsDialog.qml @@ -2,8 +2,8 @@ import QtQuick 2.3 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.13 import QtQuick.Dialogs 1.3 - import "./../common/" +import "../common/platformutils.js" as PlatformUtils BetterDialog { id: root @@ -13,6 +13,8 @@ BetterDialog { property string operationName: bulkOperations.operationName + property int firstColSize: PlatformUtils.isScalingDisabled()? 300 : 250 + standardButtons: StandardButton.NoButton function loadKeys() { @@ -70,8 +72,8 @@ BetterDialog { contentItem: Rectangle { id: contentWrapper - implicitWidth: 900 - implicitHeight: 600 + implicitWidth: PlatformUtils.isScalingDisabled() ? 1100 : 900 + implicitHeight: PlatformUtils.isScalingDisabled() ? 650 : 600 color: sysPalette.base Control { @@ -147,7 +149,7 @@ BetterDialog { BetterLabel { text: qsTranslate("RESP","Redis Server:") - Layout.preferredWidth: 250 + Layout.preferredWidth: root.firstColSize Layout.preferredHeight: 25 } @@ -159,7 +161,7 @@ BetterDialog { BetterLabel { text: qsTranslate("RESP","Database number:") - Layout.preferredWidth: 250 + Layout.preferredWidth: root.firstColSize Layout.preferredHeight: 25 } @@ -179,7 +181,7 @@ BetterDialog { BetterLabel { id: rdbPathLabel text: qsTranslate("RESP","Path to RDB file:") - Layout.preferredWidth: 250 + Layout.preferredWidth: root.firstColSize } FilePathInput { @@ -201,7 +203,7 @@ BetterDialog { BetterLabel { id: rdbDbLabel text: qsTranslate("RESP","Select DB in RDB file:") - Layout.preferredWidth: 250 + Layout.preferredWidth: root.firstColSize } BetterSpinBox { @@ -221,7 +223,7 @@ BetterDialog { BetterLabel { text: root.operationName == "rdb_import"? qsTranslate("RESP","Import keys that match regex:") : qsTranslate("RESP","Key pattern:") - Layout.preferredWidth: 250 + Layout.preferredWidth: root.firstColSize } BetterTextField { @@ -242,7 +244,7 @@ BetterDialog { BetterLabel { text: "New TTL value (seconds):" - Layout.preferredWidth: 250 + Layout.preferredWidth: root.firstColSize } BetterSpinBox { @@ -266,7 +268,7 @@ BetterDialog { visible: bulkOperations.multiConnectionOperation() BetterLabel { - Layout.preferredWidth: 250 + Layout.preferredWidth: root.firstColSize text: qsTranslate("RESP","Destination Redis Server:") } @@ -277,7 +279,7 @@ BetterDialog { } BetterLabel { - Layout.preferredWidth: 250 + Layout.preferredWidth: root.firstColSize text: qsTranslate("RESP","Destination Redis Server Database Index:") } @@ -300,7 +302,7 @@ BetterDialog { BetterLabel { text: "Replace existing keys in target db:" - Layout.preferredWidth: 250 + Layout.preferredWidth: root.firstColSize } BetterCheckbox { diff --git a/src/qml/common/ImageButton.qml b/src/qml/common/ImageButton.qml index 7869afc9..a1f723c8 100644 --- a/src/qml/common/ImageButton.qml +++ b/src/qml/common/ImageButton.qml @@ -12,6 +12,7 @@ BetterButton { property alias imgSource: img.source property alias iconSource: img.source property bool showBorder: false + property bool imgStickTop: false MouseArea { id: mouseArea @@ -23,6 +24,7 @@ BetterButton { Image { id: img anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: root.text || root.imgStickTop ? null : parent.verticalCenter source: PlatformUtils.getThemeIcon("clear.svg") width: 18 height: 18 diff --git a/src/qml/common/platformutils.js b/src/qml/common/platformutils.js index 8480a172..98be9746 100644 --- a/src/qml/common/platformutils.js +++ b/src/qml/common/platformutils.js @@ -1,6 +1,11 @@ var dateTimeFormat = "yyyy-MM-dd hh:mm:ss.zzz" +function isScalingDisabled() { + return (Qt.platform.os == "windows" || Qt.platform.os == "linux") + && screen.devicePixelRatio < 2 +} + function isWindows() { return Qt.platform.os == "windows" } diff --git a/src/qml/connections/ConnectionSettignsDialog.qml b/src/qml/connections/ConnectionSettignsDialog.qml index 2fb60120..64213a8c 100644 --- a/src/qml/connections/ConnectionSettignsDialog.qml +++ b/src/qml/connections/ConnectionSettignsDialog.qml @@ -111,7 +111,7 @@ BetterDialog { contentItem: Rectangle { color: sysPalette.base - implicitWidth: 650 + implicitWidth: PlatformUtils.isScalingDisabled() ? 900 : 650 implicitHeight: { if (screen.devicePixelRatio === 1) { return connectionSettingsTabBar.implicitHeight diff --git a/src/qml/server-actions/ServerActionTabs.qml b/src/qml/server-actions/ServerActionTabs.qml index 60186ea3..9c0e7cc7 100644 --- a/src/qml/server-actions/ServerActionTabs.qml +++ b/src/qml/server-actions/ServerActionTabs.qml @@ -95,8 +95,8 @@ Repeater { Layout.fillWidth: true - property int tileSize: PlatformUtils.isOSX()? 100 : 120 - property int tileIconSize: 64 + property int tileSize: PlatformUtils.isScalingDisabled()? 150 : 110 + property int tileIconSize: PlatformUtils.isScalingDisabled()? 90 : 75 ImageButton { objectName: "rdm_server_action_info" @@ -108,6 +108,7 @@ Repeater { tooltip: qsTranslate("RESP", "View Server Info") showBorder: true + imgStickTop: true imgWidth: tileGrid.tileIconSize imgHeight: tileGrid.tileIconSize diff --git a/src/qml/settings/GlobalSettings.qml b/src/qml/settings/GlobalSettings.qml index 5bf984bb..892d2e52 100644 --- a/src/qml/settings/GlobalSettings.qml +++ b/src/qml/settings/GlobalSettings.qml @@ -18,8 +18,8 @@ BetterDialog { contentItem: Rectangle { id: dialogRoot - implicitWidth: 950 - implicitHeight: 550 + implicitWidth: PlatformUtils.isScalingDisabled() ? 1100 : 950 + implicitHeight: PlatformUtils.isScalingDisabled() ? 650 : 550 color: sysPalette.base @@ -59,8 +59,8 @@ BetterDialog { rows: 3 flow: GridLayout.TopToBottom Layout.fillWidth: true - rowSpacing: 10 - columnSpacing: 15 + rowSpacing: PlatformUtils.isScalingDisabled() ? 20 : 10 + columnSpacing: PlatformUtils.isScalingDisabled() ? 20 : 15 ComboboxOption { id: appLang @@ -160,9 +160,8 @@ BetterDialog { columns: 2 rows: 2 flow: GridLayout.TopToBottom - rowSpacing: 10 - columnSpacing: 15 - + rowSpacing: PlatformUtils.isScalingDisabled() ? 20 : 10 + columnSpacing: PlatformUtils.isScalingDisabled() ? 20 : 15 ComboboxOption { id: valueEditorFont @@ -224,8 +223,8 @@ BetterDialog { columns: 2 rows: 4 flow: GridLayout.TopToBottom - rowSpacing: 10 - columnSpacing: 20 + rowSpacing: PlatformUtils.isScalingDisabled() ? 20 : 10 + columnSpacing: PlatformUtils.isScalingDisabled() ? 20 : 15 BoolOption { id: nsOnTop diff --git a/src/qml/settings/IntOption.qml b/src/qml/settings/IntOption.qml index 2e61d020..8cacd060 100644 --- a/src/qml/settings/IntOption.qml +++ b/src/qml/settings/IntOption.qml @@ -31,9 +31,9 @@ Item { } Text { - color: "#cccccc" + color: disabledSysPalette.text text: root.description - visible: !!text + visible: root.description } }