mirror of
https://github.com/redis/RedisDesktopManager.git
synced 2026-10-21 22:55:57 +08:00
+16
-2
@@ -4,6 +4,7 @@
|
||||
#include <QUrl>
|
||||
#include <QSysInfo>
|
||||
#include <QQmlContext>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <easylogging++.h>
|
||||
#include <googlemp.h>
|
||||
@@ -68,8 +69,21 @@ void Application::initAppInfo()
|
||||
|
||||
void Application::initAppFonts()
|
||||
{
|
||||
QFontDatabase::addApplicationFont("://fonts/OpenSans-Regular.ttc");
|
||||
QFont defaultFont("OpenSans", 11);
|
||||
QSettings settings;
|
||||
QString appFont = settings.value("app/appFont", "Open Sans").toString();
|
||||
int appFontSize = settings.value("app/appFontSize", 11).toInt();
|
||||
|
||||
if (appFont == "Open Sans") {
|
||||
int result = QFontDatabase::addApplicationFont("://fonts/OpenSans.ttc");
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
if (result == -1) {
|
||||
appFont = "Ubuntu";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
qDebug() << "App font:" << appFont << appFontSize;
|
||||
QFont defaultFont(appFont, appFontSize);
|
||||
QApplication::setFont(defaultFont);
|
||||
}
|
||||
|
||||
|
||||
+42
-11
@@ -10,16 +10,6 @@ Dialog {
|
||||
id: root
|
||||
title: "Settings"
|
||||
|
||||
Settings {
|
||||
id: globalSettings
|
||||
category: "app"
|
||||
|
||||
property alias reopenNamespacesOnReload: nsReload.value
|
||||
property alias enableKeySortingInTree: keySorting.value
|
||||
property alias liveUpdateKeysLimit: liveKeyLimit.value
|
||||
property alias liveUpdateInterval: liveUpdateInterval.value
|
||||
}
|
||||
|
||||
contentItem: Item {
|
||||
implicitWidth: 800
|
||||
implicitHeight: 600
|
||||
@@ -29,7 +19,36 @@ Dialog {
|
||||
anchors.margins: 20
|
||||
|
||||
Text {
|
||||
text: "Connections Tree Settings"
|
||||
text: "Appearance"
|
||||
font.pixelSize: 20
|
||||
}
|
||||
|
||||
ComboboxOption {
|
||||
id: appFont
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
|
||||
value: "Open Sans"
|
||||
model: Qt.fontFamilies()
|
||||
label: "Font"
|
||||
description: ""
|
||||
}
|
||||
|
||||
ComboboxOption {
|
||||
id: appFontSize
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
|
||||
model: ["8", "9", "10", "11", "12"]
|
||||
value: "10"
|
||||
label: "Font Size"
|
||||
description: "in pixels"
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Connections Tree"
|
||||
font.pixelSize: 20
|
||||
}
|
||||
|
||||
@@ -96,4 +115,16 @@ Dialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Settings {
|
||||
id: globalSettings
|
||||
category: "app"
|
||||
|
||||
property alias reopenNamespacesOnReload: nsReload.value
|
||||
property alias enableKeySortingInTree: keySorting.value
|
||||
property alias liveUpdateKeysLimit: liveKeyLimit.value
|
||||
property alias liveUpdateInterval: liveUpdateInterval.value
|
||||
property alias appFont: appFont.value
|
||||
property alias appFontSize: appFontSize.value
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -30,7 +30,7 @@
|
||||
<file>value-editor/editors/editor.js</file>
|
||||
<file>3rdparty/php-unserialize-js/phpUnserialize.js</file>
|
||||
<file>console/QConsole.qml</file>
|
||||
<file>console/BaseConsole.qml</file>
|
||||
<file>console/BaseConsole.qml</file>
|
||||
<file>console/Consoles.qml</file>
|
||||
<file>connections-tree/BetterTreeView.qml</file>
|
||||
<file>AppToolBar.qml</file>
|
||||
@@ -41,5 +41,6 @@
|
||||
<file>settings/IntOption.qml</file>
|
||||
<file>bulk-operations/BulkOperationsDialog.qml</file>
|
||||
<file>value-editor/editors/formatters/json-tools.js</file>
|
||||
<file>settings/ComboboxOption.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import QtQuick 2.3
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 1.2
|
||||
|
||||
Item {
|
||||
id: root
|
||||
property string label
|
||||
property string description
|
||||
property string value
|
||||
property alias model: val.model
|
||||
|
||||
onValueChanged: {
|
||||
if (val.currentText != root.value) {
|
||||
val.currentIndex = val.find(root.value)
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 1
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: root.label
|
||||
}
|
||||
|
||||
Text {
|
||||
color: "#cccccc"
|
||||
text: root.description
|
||||
}
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
id: val
|
||||
|
||||
Layout.minimumWidth: 80
|
||||
|
||||
onActivated: {
|
||||
if (index >= 0)
|
||||
root.value = textAt(index)
|
||||
}
|
||||
|
||||
onCountChanged: {
|
||||
if (model) {
|
||||
currentIndex = val.find(root.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user