Browse Source

统一设置页面样式

master
mashiros 2 years ago
parent
commit
75d948494c
  1. 318
      reflection_clock.qml
  2. 192
      round_clock.qml
  3. 490
      solars_clock.qml
  4. 198
      text_clock.qml

318
reflection_clock.qml

@ -5,6 +5,7 @@ import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import NERvGear 1.0 as NVG import NERvGear 1.0 as NVG
import NERvGear.Controls 1.0
import NERvGear.Templates 1.0 as T import NERvGear.Templates 1.0 as T
import NERvGear.Preferences 1.0 as P import NERvGear.Preferences 1.0 as P
@ -254,8 +255,6 @@ T.Widget {
visible: true visible: true
minimumWidth: 380 minimumWidth: 380
minimumHeight: 480 minimumHeight: 480
maximumWidth: minimumWidth
maximumHeight: minimumHeight
width: minimumWidth width: minimumWidth
height: minimumHeight height: minimumHeight
@ -263,193 +262,188 @@ T.Widget {
property var configuration property var configuration
ColumnLayout { Page {
id: root id: cfg_page
anchors.fill: parent anchors.fill: parent
anchors.margins: 16
anchors.topMargin: 0
Row { header: TitleBar {
spacing: 234 text: qsTr("Settings")
ToolButton { standardButtons: Dialog.Save | Dialog.Reset
text: qsTr("Save")
onClicked: {
configuration = rootPreference.save();
widget.settings.styles = configuration;
styleDialog.active = false;
}
}
ToolButton { onAccepted: {
text: qsTr("Reset") configuration = rootPreference.save();
onClicked: { widget.settings.styles = configuration;
rootPreference.load(); styleDialog.active = false;
let cfg = rootPreference.save();
widget.settings.styles = cfg;
}
} }
}
Label { onReset: {
Layout.alignment: Qt.AlignCenter rootPreference.load();
text: qsTr("Settings") let cfg = rootPreference.save();
font.pixelSize: 24 widget.settings.styles = cfg;
}
} }
Flickable { ColumnLayout {
Layout.fillWidth: true id: root
Layout.fillHeight: true anchors.fill: parent
anchors.margins: 16
clip: true anchors.topMargin: 0
contentWidth: preferenceLayout.implicitWidth
contentHeight: preferenceLayout.implicitHeight
ColumnLayout {
id: preferenceLayout
width: root.width
P.PreferenceGroup {
id: rootPreference
Layout.fillWidth: true
label: qsTr("Configuration") Flickable {
Layout.fillWidth: true
Layout.fillHeight: true
onPreferenceEdited: { clip: true
widget.settings.styles = rootPreference.save(); contentWidth: preferenceLayout.implicitWidth
} contentHeight: preferenceLayout.implicitHeight
P.DialogPreference { ColumnLayout {
name: "Hour Settings" id: preferenceLayout
label: qsTr("Hour Settings") width: root.width
live: true
icon.name: "regular:\uf1de"
P.SwitchPreference { P.PreferenceGroup {
name: "Full Clock" id: rootPreference
label: qsTr("24 Hour Clock") Layout.fillWidth: true
defaultValue: true
}
P.Separator {} label: qsTr("Configuration")
P.ColorPreference { onPreferenceEdited: {
name: "Clock BG Color" widget.settings.styles = rootPreference.save();
label: qsTr("Clock Background Color")
defaultValue: "#2196f3"
} }
P.ColorPreference { P.DialogPreference {
name: "Clock Font Color" name: "Hour Settings"
label: qsTr("Clock Font Color") label: qsTr("Hour Settings")
defaultValue: "#ffffff" live: true
icon.name: "regular:\uf1de"
P.SwitchPreference {
name: "Full Clock"
label: qsTr("24 Hour Clock")
defaultValue: true
}
P.Separator {}
P.ColorPreference {
name: "Clock BG Color"
label: qsTr("Clock Background Color")
defaultValue: "#2196f3"
}
P.ColorPreference {
name: "Clock Font Color"
label: qsTr("Clock Font Color")
defaultValue: "#ffffff"
}
P.Separator {}
P.ColorPreference {
name: "Panel BG Color"
label: qsTr("Panel Background Color")
defaultValue: "#2196f3"
}
P.ColorPreference {
name: "Panel Font Color"
label: qsTr("Panel Font Color")
defaultValue: "#ffffff"
}
} }
P.Separator {} P.Separator {}
P.ColorPreference { P.DialogPreference {
name: "Panel BG Color" name: "Min Settings"
label: qsTr("Panel Background Color") label: qsTr("Minute Settings")
defaultValue: "#2196f3" live: true
} icon.name: "regular:\uf1de"
P.ColorPreference { P.ColorPreference {
name: "Panel Font Color" name: "Clock BG Color"
label: qsTr("Panel Font Color") label: qsTr("Clock Background Color")
defaultValue: "#ffffff" defaultValue: "#2196f3"
} }
}
P.ColorPreference {
P.Separator {} name: "Clock Font Color"
label: qsTr("Clock Font Color")
P.DialogPreference { defaultValue: "#ffffff"
name: "Min Settings" }
label: qsTr("Minute Settings")
live: true P.Separator {}
icon.name: "regular:\uf1de"
P.ColorPreference {
P.ColorPreference { name: "Panel BG Color"
name: "Clock BG Color" label: qsTr("Panel Background Color")
label: qsTr("Clock Background Color") defaultValue: "#2196f3"
defaultValue: "#2196f3" }
}
P.ColorPreference {
P.ColorPreference { name: "Panel Font Color"
name: "Clock Font Color" label: qsTr("Panel Font Color")
label: qsTr("Clock Font Color") defaultValue: "#ffffff"
defaultValue: "#ffffff" }
} }
P.Separator {} P.Separator {}
P.ColorPreference { P.DialogPreference {
name: "Panel BG Color" name: "Sec Settings"
label: qsTr("Panel Background Color") label: qsTr("Second Settings")
defaultValue: "#2196f3" live: true
} icon.name: "regular:\uf1de"
P.ColorPreference { P.SwitchPreference {
name: "Panel Font Color" id: cfg_sec_en
label: qsTr("Panel Font Color") name: "Visible"
defaultValue: "#ffffff" label: qsTr("Show")
defaultValue: true
}
P.Separator {}
P.ColorPreference {
name: "Clock BG Color"
label: qsTr("Clock Background Color")
enabled: cfg_sec_en.value
defaultValue: "#ff006a"
}
P.ColorPreference {
name: "Clock Font Color"
label: qsTr("Clock Font Color")
enabled: cfg_sec_en.value
defaultValue: "#ffffff"
}
P.Separator {}
P.ColorPreference {
name: "Panel BG Color"
label: qsTr("Panel Background Color")
enabled: cfg_sec_en.value
defaultValue: "#ff006a"
}
P.ColorPreference {
name: "Panel Font Color"
label: qsTr("Panel Font Color")
enabled: cfg_sec_en.value
defaultValue: "#ffffff"
}
} }
}
P.Separator {}
P.DialogPreference {
name: "Sec Settings"
label: qsTr("Second Settings")
live: true
icon.name: "regular:\uf1de"
P.SwitchPreference {
id: cfg_sec_en
name: "Visible"
label: qsTr("Show")
defaultValue: true
}
P.Separator {}
P.ColorPreference {
name: "Clock BG Color"
label: qsTr("Clock Background Color")
enabled: cfg_sec_en.value
defaultValue: "#ff006a"
}
P.ColorPreference {
name: "Clock Font Color"
label: qsTr("Clock Font Color")
enabled: cfg_sec_en.value
defaultValue: "#ffffff"
}
P.Separator {}
P.ColorPreference {
name: "Panel BG Color"
label: qsTr("Panel Background Color")
enabled: cfg_sec_en.value
defaultValue: "#ff006a"
}
P.ColorPreference {
name: "Panel Font Color"
label: qsTr("Panel Font Color")
enabled: cfg_sec_en.value
defaultValue: "#ffffff"
}
}
Component.onCompleted: { Component.onCompleted: {
if(!widget.settings.styles) { if(!widget.settings.styles) {
configuration = rootPreference.save(); configuration = rootPreference.save();
widget.settings.styles = configuration; widget.settings.styles = configuration;
}
rootPreference.load(widget.settings.styles);
configuration = widget.settings.styles;
} }
rootPreference.load(widget.settings.styles);
configuration = widget.settings.styles;
} }
} }
} }

192
round_clock.qml

@ -4,6 +4,7 @@ import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import NERvGear 1.0 as NVG import NERvGear 1.0 as NVG
import NERvGear.Controls 1.0
import NERvGear.Templates 1.0 as T import NERvGear.Templates 1.0 as T
import NERvGear.Preferences 1.0 as P import NERvGear.Preferences 1.0 as P
@ -139,7 +140,7 @@ T.Widget {
renderTarget: Canvas.FramebufferObject renderTarget: Canvas.FramebufferObject
renderStrategy: Canvas.Cooperative renderStrategy: Canvas.Cooperative
rotation: thour*30+tmin*0.5+tsec*0.6/60 rotation: thour*30+tmin*0.5+tsec*0.01
onWidthChanged: { onWidthChanged: {
requestPaint(); requestPaint();
@ -318,8 +319,6 @@ T.Widget {
visible: true visible: true
minimumWidth: 380 minimumWidth: 380
minimumHeight: 540 minimumHeight: 540
maximumWidth: minimumWidth
maximumHeight: minimumHeight
width: minimumWidth width: minimumWidth
height: minimumHeight height: minimumHeight
@ -327,127 +326,122 @@ T.Widget {
property var configuration property var configuration
ColumnLayout { Page {
id: root id: cfg_page
anchors.fill: parent anchors.fill: parent
anchors.margins: 16
anchors.topMargin: 0 header: TitleBar {
text: qsTr("Settings")
Row {
spacing: 234 standardButtons: Dialog.Save | Dialog.Reset
ToolButton { onAccepted: {
text: qsTr("Save") configuration = rootPreference.save();
onClicked: { widget.settings.styles = configuration;
configuration = rootPreference.save(); styleDialog.active = false;
widget.settings.styles = configuration;
styleDialog.active = false;
}
} }
ToolButton { onReset: {
text: qsTr("Reset") rootPreference.load();
onClicked: { let cfg = rootPreference.save();
rootPreference.load(); widget.settings.styles = cfg;
let cfg = rootPreference.save();
widget.settings.styles = cfg;
}
} }
} }
Label { ColumnLayout {
Layout.alignment: Qt.AlignCenter id: root
text: qsTr("Settings") anchors.fill: parent
font.pixelSize: 24 anchors.margins: 16
} anchors.topMargin: 0
Flickable { Flickable {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
clip: true clip: true
contentWidth: preferenceLayout.implicitWidth contentWidth: preferenceLayout.implicitWidth
contentHeight: preferenceLayout.implicitHeight contentHeight: preferenceLayout.implicitHeight
ColumnLayout { ColumnLayout {
id: preferenceLayout id: preferenceLayout
width: root.width width: root.width
P.PreferenceGroup { P.PreferenceGroup {
id: rootPreference id: rootPreference
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Configuration") label: qsTr("Configuration")
onPreferenceEdited: { onPreferenceEdited: {
widget.settings.styles = rootPreference.save(); widget.settings.styles = rootPreference.save();
} }
P.SwitchPreference { P.SwitchPreference {
name: "Sec Continue" name: "Sec Continue"
label: qsTr("Continuous Second Hand") label: qsTr("Continuous Second Hand")
defaultValue: true defaultValue: true
} }
P.Separator {} P.Separator {}
P.ColorPreference { P.ColorPreference {
name: "BG Color" name: "BG Color"
label: qsTr("Background Color") label: qsTr("Background Color")
defaultValue: "#2196f3" defaultValue: "#2196f3"
} }
P.SliderPreference { P.SliderPreference {
name: "BG Alpha" name: "BG Alpha"
label: qsTr("Background transparency") label: qsTr("Background transparency")
from: 0 from: 0
to: 100 to: 100
stepSize: 1 stepSize: 1
defaultValue: 50 defaultValue: 50
displayValue: value + "%" displayValue: value + "%"
} }
P.Separator {} P.Separator {}
P.ColorPreference { P.ColorPreference {
name: "HGRID Color" name: "HGRID Color"
label: qsTr("Hour Scale Color") label: qsTr("Hour Scale Color")
defaultValue: "#fff" defaultValue: "#fff"
} }
P.ColorPreference { P.ColorPreference {
name: "MGRID Color" name: "MGRID Color"
label: qsTr("Minute Scale Color") label: qsTr("Minute Scale Color")
defaultValue: "#fff" defaultValue: "#fff"
} }
P.Separator {} P.Separator {}
P.ColorPreference { P.ColorPreference {
name: "Hhand Color" name: "Hhand Color"
label: qsTr("Hour Hand Color") label: qsTr("Hour Hand Color")
defaultValue: "#fff" defaultValue: "#fff"
} }
P.ColorPreference { P.ColorPreference {
name: "Mhand Color" name: "Mhand Color"
label: qsTr("Minute Hand Color") label: qsTr("Minute Hand Color")
defaultValue: "#fff" defaultValue: "#fff"
} }
P.ColorPreference { P.ColorPreference {
name: "Shand Color" name: "Shand Color"
label: qsTr("Second Hand Color") label: qsTr("Second Hand Color")
defaultValue: "#F3A829" defaultValue: "#F3A829"
} }
Component.onCompleted: { Component.onCompleted: {
if(!widget.settings.styles) { if(!widget.settings.styles) {
configuration = rootPreference.save(); configuration = rootPreference.save();
widget.settings.styles = configuration; widget.settings.styles = configuration;
}
rootPreference.load(widget.settings.styles);
configuration = widget.settings.styles;
} }
rootPreference.load(widget.settings.styles);
configuration = widget.settings.styles;
} }
} }
} }

490
solars_clock.qml

@ -4,6 +4,7 @@ import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import NERvGear 1.0 as NVG import NERvGear 1.0 as NVG
import NERvGear.Controls 1.0
import NERvGear.Templates 1.0 as T import NERvGear.Templates 1.0 as T
import NERvGear.Preferences 1.0 as P import NERvGear.Preferences 1.0 as P
@ -378,8 +379,6 @@ T.Widget {
visible: true visible: true
minimumWidth: 400 minimumWidth: 400
minimumHeight: 660 minimumHeight: 660
maximumWidth: minimumWidth
maximumHeight: minimumHeight
width: minimumWidth width: minimumWidth
height: minimumHeight height: minimumHeight
@ -387,280 +386,275 @@ T.Widget {
property var configuration property var configuration
ColumnLayout { Page {
id: root id: cfg_page
anchors.fill: parent anchors.fill: parent
anchors.margins: 16
anchors.topMargin: 0
Row {
spacing: 270
ToolButton {
text: qsTr("Save")
onClicked: {
configuration = rootPreference.save();
widget.settings.styles = configuration;
styleDialog.active = false;
}
}
ToolButton {
text: qsTr("Reset")
onClicked: {
rootPreference.load();
let cfg = rootPreference.save();
widget.settings.styles = cfg;
}
}
}
Label { header: TitleBar {
Layout.alignment: Qt.AlignCenter
text: qsTr("Settings") text: qsTr("Settings")
font.pixelSize: 24
}
Flickable {
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
contentWidth: preferenceLayout.implicitWidth
contentHeight: preferenceLayout.implicitHeight
ColumnLayout {
id: preferenceLayout
width: root.width
P.PreferenceGroup {
id: rootPreference
Layout.fillWidth: true
label: qsTr("Configuration")
onPreferenceEdited: {
widget.settings.styles = rootPreference.save();
}
P.DialogPreference {
name: "BG Settings"
label: qsTr("Background Settings")
live: true
icon.name: "regular:\uf1de"
P.ColorPreference {
name: "BG Color"
label: qsTr("Color")
defaultValue: "#212121"
}
P.SliderPreference {
name: "BG Alpha"
label: qsTr("Transparency")
from: 0
to: 100
stepSize: 1
defaultValue: 100
displayValue: value + "%"
}
P.Separator {}
P.SwitchPreference {
id: show_hgrid
name: "Show HGrid"
label: qsTr("Show Scale")
defaultValue: true
}
P.ColorPreference {
name: "HGRID Color"
label: qsTr("Scale Color")
enabled: show_hgrid.value
defaultValue: "#616161"
}
P.Separator {}
P.SwitchPreference {
id: showCenter
name: "Show Center"
label: qsTr("Show Center")
defaultValue: true
}
P.ColorPreference {
name: "Center Color"
label: qsTr("Center Color")
enabled: showCenter.value
defaultValue: "#ffeb3b"
}
P.SliderPreference { standardButtons: Dialog.Save | Dialog.Reset
name: "Center Radius"
label: qsTr("Center Radius")
enabled: showCenter.value
from: 30
to: 100
stepSize: 1
defaultValue: 85
displayValue: value + "%"
}
P.Separator {} onAccepted: {
configuration = rootPreference.save();
P.SwitchPreference { widget.settings.styles = configuration;
id: showClock styleDialog.active = false;
name: "Show Clock" }
label: qsTr("Display Time")
defaultValue: true
}
P.ColorPreference { onReset: {
name: "Clock Color" rootPreference.load();
label: qsTr("Font Color") let cfg = rootPreference.save();
enabled: showClock.value widget.settings.styles = cfg;
defaultValue: "#616161" }
} }
P.SliderPreference { ColumnLayout {
name: "Font Size" id: root
label: qsTr("Font Size") anchors.fill: parent
enabled: showClock.value anchors.margins: 16
from: 50 anchors.topMargin: 0
to: 100
stepSize: 1
defaultValue: 100
displayValue: value + "%"
}
}
P.Separator {} Flickable {
Layout.fillWidth: true
Layout.fillHeight: true
P.DialogPreference { clip: true
name: "Hour Settings" contentWidth: preferenceLayout.implicitWidth
label: qsTr("Hour Settings") contentHeight: preferenceLayout.implicitHeight
live: true
icon.name: "regular:\uf1de"
P.ColorPreference { ColumnLayout {
name: "Hstar Color" id: preferenceLayout
label: qsTr("Star Color") width: root.width
defaultValue: "#ffa000"
}
P.Separator {} P.PreferenceGroup {
id: rootPreference
Layout.fillWidth: true
P.SwitchPreference { label: qsTr("Configuration")
id: hour_settings_show_orbit
name: "Show Orbit"
label: qsTr("Show Orbit")
defaultValue: true
}
P.ColorPreference { onPreferenceEdited: {
name: "Horbit Color" widget.settings.styles = rootPreference.save();
label: qsTr("Orbit Color")
enabled: hour_settings_show_orbit.value
defaultValue: "#616161"
} }
}
P.DialogPreference {
name: "Min Settings"
label: qsTr("Minute Settings")
live: true
icon.name: "regular:\uf1de"
P.ColorPreference { P.DialogPreference {
name: "Mstar Color" name: "BG Settings"
label: qsTr("Star Color") label: qsTr("Background Settings")
defaultValue: "#ff5722" live: true
icon.name: "regular:\uf1de"
P.ColorPreference {
name: "BG Color"
label: qsTr("Color")
defaultValue: "#212121"
}
P.SliderPreference {
name: "BG Alpha"
label: qsTr("Transparency")
from: 0
to: 100
stepSize: 1
defaultValue: 100
displayValue: value + "%"
}
P.Separator {}
P.SwitchPreference {
id: show_hgrid
name: "Show HGrid"
label: qsTr("Show Scale")
defaultValue: true
}
P.ColorPreference {
name: "HGRID Color"
label: qsTr("Scale Color")
enabled: show_hgrid.value
defaultValue: "#616161"
}
P.Separator {}
P.SwitchPreference {
id: showCenter
name: "Show Center"
label: qsTr("Show Center")
defaultValue: true
}
P.ColorPreference {
name: "Center Color"
label: qsTr("Center Color")
enabled: showCenter.value
defaultValue: "#ffeb3b"
}
P.SliderPreference {
name: "Center Radius"
label: qsTr("Center Radius")
enabled: showCenter.value
from: 30
to: 100
stepSize: 1
defaultValue: 85
displayValue: value + "%"
}
P.Separator {}
P.SwitchPreference {
id: showClock
name: "Show Clock"
label: qsTr("Display Time")
defaultValue: true
}
P.ColorPreference {
name: "Clock Color"
label: qsTr("Font Color")
enabled: showClock.value
defaultValue: "#616161"
}
P.SliderPreference {
name: "Font Size"
label: qsTr("Font Size")
enabled: showClock.value
from: 50
to: 100
stepSize: 1
defaultValue: 100
displayValue: value + "%"
}
} }
P.Separator {} P.Separator {}
P.SwitchPreference { P.DialogPreference {
id: min_settings_show_orbit name: "Hour Settings"
name: "Show Orbit" label: qsTr("Hour Settings")
label: qsTr("Show Orbit") live: true
defaultValue: true icon.name: "regular:\uf1de"
P.ColorPreference {
name: "Hstar Color"
label: qsTr("Star Color")
defaultValue: "#ffa000"
}
P.Separator {}
P.SwitchPreference {
id: hour_settings_show_orbit
name: "Show Orbit"
label: qsTr("Show Orbit")
defaultValue: true
}
P.ColorPreference {
name: "Horbit Color"
label: qsTr("Orbit Color")
enabled: hour_settings_show_orbit.value
defaultValue: "#616161"
}
} }
P.ColorPreference { P.DialogPreference {
name: "Morbit Color" name: "Min Settings"
label: qsTr("Orbit Color") label: qsTr("Minute Settings")
enabled: min_settings_show_orbit.value live: true
defaultValue: "#616161" icon.name: "regular:\uf1de"
P.ColorPreference {
name: "Mstar Color"
label: qsTr("Star Color")
defaultValue: "#ff5722"
}
P.Separator {}
P.SwitchPreference {
id: min_settings_show_orbit
name: "Show Orbit"
label: qsTr("Show Orbit")
defaultValue: true
}
P.ColorPreference {
name: "Morbit Color"
label: qsTr("Orbit Color")
enabled: min_settings_show_orbit.value
defaultValue: "#616161"
}
} }
}
P.DialogPreference {
name: "Sec Settings"
label: qsTr("Second Settings")
live: true
icon.name: "regular:\uf1de"
P.ColorPreference { P.DialogPreference {
name: "Sstar Color" name: "Sec Settings"
label: qsTr("Star Color") label: qsTr("Second Settings")
defaultValue: "#2196f3" live: true
icon.name: "regular:\uf1de"
P.ColorPreference {
name: "Sstar Color"
label: qsTr("Star Color")
defaultValue: "#2196f3"
}
P.Separator {}
P.SwitchPreference {
id: sec_settings_show_orbit
name: "Show Orbit"
label: qsTr("Show Orbit")
defaultValue: true
}
P.ColorPreference {
name: "Sorbit Color"
label: qsTr("Orbit Color")
enabled: sec_settings_show_orbit.value
defaultValue: "#616161"
}
} }
P.Separator {} P.DialogPreference {
name: "MSec Settings"
P.SwitchPreference { label: qsTr("Millisecond Settings")
id: sec_settings_show_orbit live: true
name: "Show Orbit" icon.name: "regular:\uf1de"
label: qsTr("Show Orbit")
defaultValue: true P.ColorPreference {
} name: "MSstar Color"
label: qsTr("Star Color")
P.ColorPreference { defaultValue: "#9e9e9e"
name: "Sorbit Color" }
label: qsTr("Orbit Color")
enabled: sec_settings_show_orbit.value P.Separator {}
defaultValue: "#616161"
} P.SwitchPreference {
} id: msec_settings_show_orbit
name: "Show Orbit"
P.DialogPreference { label: qsTr("Show Orbit")
name: "MSec Settings" defaultValue: true
label: qsTr("Millisecond Settings") }
live: true
icon.name: "regular:\uf1de" P.ColorPreference {
name: "MSorbit Color"
P.ColorPreference { label: qsTr("Orbit Color")
name: "MSstar Color" enabled: msec_settings_show_orbit.value
label: qsTr("Star Color") defaultValue: "#9e9e9e"
defaultValue: "#9e9e9e" }
} }
P.Separator {} Component.onCompleted: {
if(!widget.settings.styles) {
P.SwitchPreference { configuration = rootPreference.save();
id: msec_settings_show_orbit widget.settings.styles = configuration;
name: "Show Orbit" }
label: qsTr("Show Orbit") rootPreference.load(widget.settings.styles);
defaultValue: true configuration = widget.settings.styles;
}
P.ColorPreference {
name: "MSorbit Color"
label: qsTr("Orbit Color")
enabled: msec_settings_show_orbit.value
defaultValue: "#9e9e9e"
}
}
Component.onCompleted: {
if(!widget.settings.styles) {
configuration = rootPreference.save();
widget.settings.styles = configuration;
} }
rootPreference.load(widget.settings.styles);
configuration = widget.settings.styles;
} }
} }
} }

198
text_clock.qml

@ -5,6 +5,7 @@ import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import NERvGear 1.0 as NVG import NERvGear 1.0 as NVG
import NERvGear.Controls 1.0
import NERvGear.Templates 1.0 as T import NERvGear.Templates 1.0 as T
import NERvGear.Preferences 1.0 as P import NERvGear.Preferences 1.0 as P
@ -161,8 +162,6 @@ T.Widget {
visible: true visible: true
minimumWidth: 380 minimumWidth: 380
minimumHeight: 580 minimumHeight: 580
maximumWidth: minimumWidth
maximumHeight: minimumHeight
width: minimumWidth width: minimumWidth
height: minimumHeight height: minimumHeight
@ -170,127 +169,122 @@ T.Widget {
property var configuration property var configuration
ColumnLayout { Page {
id: root id: cfg_page
anchors.fill: parent anchors.fill: parent
anchors.margins: 16
anchors.topMargin: 0 header: TitleBar {
text: qsTr("Settings")
Row {
spacing: 234 standardButtons: Dialog.Save | Dialog.Reset
ToolButton { onAccepted: {
text: qsTr("Save") configuration = rootPreference.save();
onClicked: { widget.settings.styles = configuration;
configuration = rootPreference.save(); styleDialog.active = false;
widget.settings.styles = configuration;
styleDialog.active = false;
}
} }
ToolButton { onReset: {
text: qsTr("Reset") rootPreference.load();
onClicked: { let cfg = rootPreference.save();
rootPreference.load(); widget.settings.styles = cfg;
let cfg = rootPreference.save();
widget.settings.styles = cfg;
}
} }
} }
Label { ColumnLayout {
Layout.alignment: Qt.AlignCenter id: root
text: qsTr("Settings") anchors.fill: parent
font.pixelSize: 24 anchors.margins: 16
} anchors.topMargin: 0
Flickable { Flickable {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
clip: true clip: true
contentWidth: preferenceLayout.implicitWidth contentWidth: preferenceLayout.implicitWidth
contentHeight: preferenceLayout.implicitHeight contentHeight: preferenceLayout.implicitHeight
ColumnLayout { ColumnLayout {
id: preferenceLayout id: preferenceLayout
width: root.width width: root.width
P.PreferenceGroup { P.PreferenceGroup {
id: rootPreference id: rootPreference
Layout.fillWidth: true Layout.fillWidth: true
label: qsTr("Configuration") label: qsTr("Configuration")
onPreferenceEdited: { onPreferenceEdited: {
widget.settings.styles = rootPreference.save(); widget.settings.styles = rootPreference.save();
} }
P.SelectPreference { P.SelectPreference {
name: "Font Name" name: "Font Name"
label: qsTr("Font Style") label: qsTr("Font Style")
icon.name: "solid:\uf1fc" icon.name: "solid:\uf1fc"
defaultValue: 408 defaultValue: 408
model: fonts model: fonts
} }
P.SelectPreference { P.SelectPreference {
name: "Font Weight" name: "Font Weight"
label: qsTr("Font Weight") label: qsTr("Font Weight")
icon.name: "solid:\uf1fc" icon.name: "solid:\uf1fc"
defaultValue: 0 defaultValue: 0
model: sfontweight model: sfontweight
} }
P.ColorPreference { P.ColorPreference {
name: "HighLight Color" name: "HighLight Color"
label: qsTr("HighLight Color") label: qsTr("HighLight Color")
defaultValue: "#FFF" defaultValue: "#FFF"
} }
P.ColorPreference { P.ColorPreference {
name: "Normal Color" name: "Normal Color"
label: qsTr("Normal Color") label: qsTr("Normal Color")
defaultValue: "#333333" defaultValue: "#333333"
} }
P.SliderPreference { P.SliderPreference {
name: "Font Size" name: "Font Size"
label: qsTr("Font Size") label: qsTr("Font Size")
from: 1 from: 1
to: 40 to: 40
stepSize: 1 stepSize: 1
defaultValue: 20 defaultValue: 20
displayValue: value displayValue: value
} }
P.SliderPreference { P.SliderPreference {
name: "Letter Space" name: "Letter Space"
label: qsTr("Letter Space") label: qsTr("Letter Space")
from: 1 from: 1
to: 40 to: 40
stepSize: 1 stepSize: 1
defaultValue: 20 defaultValue: 20
displayValue: value displayValue: value
} }
P.SliderPreference { P.SliderPreference {
name: "Line Height" name: "Line Height"
label: qsTr("Line Spacing") label: qsTr("Line Spacing")
from: 0.8 from: 0.8
to: 2 to: 2
stepSize: 0.1 stepSize: 0.1
defaultValue: 1.5 defaultValue: 1.5
displayValue: value.toFixed(1) displayValue: value.toFixed(1)
} }
Component.onCompleted: { Component.onCompleted: {
if(!widget.settings.styles) { if(!widget.settings.styles) {
configuration = rootPreference.save(); configuration = rootPreference.save();
widget.settings.styles = configuration; widget.settings.styles = configuration;
}
rootPreference.load(widget.settings.styles);
configuration = widget.settings.styles;
} }
rootPreference.load(widget.settings.styles);
configuration = widget.settings.styles;
} }
} }
} }

Loading…
Cancel
Save