Browse Source

- 统一接口

- 新增时钟样式vecto
master
mashiros 2 years ago
parent
commit
6cf739c5eb
  1. BIN
      Locales/zh.qm
  2. 756
      Locales/zh.ts
  3. 20
      package.json
  4. BIN
      preview/vecto_clock.png
  5. 9
      qml/Common.qml
  6. 112
      qml/ReflectionClock.qml
  7. 40
      qml/RoundClock.qml
  8. 116
      qml/SolarsClock.qml
  9. 59
      qml/TextClock.qml
  10. 628
      qml/VectoClock.qml
  11. 44
      qml/WidgetTemplate.qml
  12. 1
      qml/qmldir

BIN
Locales/zh.qm

Binary file not shown.

756
Locales/zh.ts

@ -0,0 +1,756 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN">
<context>
<name>Common</name>
<message>
<location filename="qml/Common.qml" line="8"/>
<source>Light</source>
<translation></translation>
</message>
<message>
<location filename="qml/Common.qml" line="8"/>
<source>Normal</source>
<translation></translation>
</message>
<message>
<location filename="qml/Common.qml" line="8"/>
<source>Bold</source>
<translation></translation>
</message>
</context>
<context>
<name>ReflectionClock</name>
<message>
<location filename="qml/ReflectionClock.qml" line="16"/>
<source>Reflection Clock</source>
<translation></translation>
</message>
<message>
<location filename="qml/ReflectionClock.qml" line="292"/>
<location filename="qml/ReflectionClock.qml" line="318"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/ReflectionClock.qml" line="302"/>
<source>Clock Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/ReflectionClock.qml" line="357"/>
<source>Configuration</source>
<translation></translation>
</message>
<message>
<location filename="qml/ReflectionClock.qml" line="365"/>
<source>Hour Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/ReflectionClock.qml" line="371"/>
<source>24 Hour Clock</source>
<translation>24</translation>
</message>
<message>
<location filename="qml/ReflectionClock.qml" line="379"/>
<location filename="qml/ReflectionClock.qml" line="414"/>
<location filename="qml/ReflectionClock.qml" line="458"/>
<source>Clock Background Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/ReflectionClock.qml" line="385"/>
<location filename="qml/ReflectionClock.qml" line="420"/>
<location filename="qml/ReflectionClock.qml" line="465"/>
<source>Clock Font Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/ReflectionClock.qml" line="393"/>
<location filename="qml/ReflectionClock.qml" line="428"/>
<location filename="qml/ReflectionClock.qml" line="474"/>
<source>Panel Background Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/ReflectionClock.qml" line="399"/>
<location filename="qml/ReflectionClock.qml" line="434"/>
<location filename="qml/ReflectionClock.qml" line="481"/>
<source>Panel Font Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/ReflectionClock.qml" line="408"/>
<source>Minute Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/ReflectionClock.qml" line="443"/>
<source>Second Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/ReflectionClock.qml" line="450"/>
<source>Show</source>
<translation></translation>
</message>
</context>
<context>
<name>RoundClock</name>
<message>
<location filename="qml/RoundClock.qml" line="15"/>
<location filename="qml/RoundClock.qml" line="346"/>
<source>Round Clock</source>
<translation></translation>
</message>
<message>
<location filename="qml/RoundClock.qml" line="320"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/RoundClock.qml" line="330"/>
<source>Clock Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/RoundClock.qml" line="385"/>
<source>Configuration</source>
<translation></translation>
</message>
<message>
<location filename="qml/RoundClock.qml" line="393"/>
<source>Continuous Second Hand</source>
<translation></translation>
</message>
<message>
<location filename="qml/RoundClock.qml" line="401"/>
<source>Background Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/RoundClock.qml" line="407"/>
<source>Background transparency</source>
<translation></translation>
</message>
<message>
<location filename="qml/RoundClock.qml" line="419"/>
<source>Hour Scale Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/RoundClock.qml" line="425"/>
<source>Minute Scale Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/RoundClock.qml" line="433"/>
<source>Hour Hand Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/RoundClock.qml" line="439"/>
<source>Minute Hand Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/RoundClock.qml" line="445"/>
<source>Second Hand Color</source>
<translation></translation>
</message>
</context>
<context>
<name>SolarsClock</name>
<message>
<location filename="qml/SolarsClock.qml" line="15"/>
<location filename="qml/SolarsClock.qml" line="430"/>
<source>Solar Clock</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="404"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="414"/>
<source>Clock Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="469"/>
<source>Configuration</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="477"/>
<source>Background Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="483"/>
<source>Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="489"/>
<source>Transparency</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="502"/>
<source>Show Scale</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="508"/>
<source>Scale Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="518"/>
<source>Show Center</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="524"/>
<source>Center Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="531"/>
<source>Center Radius</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="545"/>
<source>Display Time</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="551"/>
<source>Font Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="558"/>
<source>Font Style</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="566"/>
<source>Font Weight</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="574"/>
<source>Font Size</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="588"/>
<source>Hour Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="594"/>
<location filename="qml/SolarsClock.qml" line="623"/>
<location filename="qml/SolarsClock.qml" line="652"/>
<location filename="qml/SolarsClock.qml" line="681"/>
<source>Star Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="603"/>
<location filename="qml/SolarsClock.qml" line="632"/>
<location filename="qml/SolarsClock.qml" line="661"/>
<location filename="qml/SolarsClock.qml" line="690"/>
<source>Show Orbit</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="609"/>
<location filename="qml/SolarsClock.qml" line="638"/>
<location filename="qml/SolarsClock.qml" line="667"/>
<location filename="qml/SolarsClock.qml" line="696"/>
<source>Orbit Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="617"/>
<source>Minute Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="646"/>
<source>Second Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/SolarsClock.qml" line="675"/>
<source>Millisecond Settings</source>
<translation></translation>
</message>
</context>
<context>
<name>TextClock</name>
<message>
<location filename="qml/TextClock.qml" line="15"/>
<location filename="qml/TextClock.qml" line="186"/>
<source>Text Clock</source>
<translation></translation>
</message>
<message>
<location filename="qml/TextClock.qml" line="160"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/TextClock.qml" line="170"/>
<source>Clock Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/TextClock.qml" line="225"/>
<source>Configuration</source>
<translation></translation>
</message>
<message>
<location filename="qml/TextClock.qml" line="233"/>
<source>Font Style</source>
<translation></translation>
</message>
<message>
<location filename="qml/TextClock.qml" line="241"/>
<source>Font Weight</source>
<translation></translation>
</message>
<message>
<location filename="qml/TextClock.qml" line="249"/>
<source>HighLight Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/TextClock.qml" line="255"/>
<source>Normal Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/TextClock.qml" line="261"/>
<source>Font Size</source>
<translation></translation>
</message>
<message>
<location filename="qml/TextClock.qml" line="271"/>
<source>Letter Space</source>
<translation></translation>
</message>
<message>
<location filename="qml/TextClock.qml" line="281"/>
<source>Line Spacing</source>
<translation></translation>
</message>
</context>
<context>
<name>VectoClock</name>
<message>
<location filename="qml/VectoClock.qml" line="17"/>
<location filename="qml/VectoClock.qml" line="303"/>
<source>Vecto Clock</source>
<translation>Vecto时钟</translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="63"/>
<location filename="qml/VectoClock.qml" line="287"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="342"/>
<source>Configuration</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="350"/>
<source>Weekday Settings</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="356"/>
<location filename="qml/VectoClock.qml" line="423"/>
<location filename="qml/VectoClock.qml" line="553"/>
<source>Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="362"/>
<location filename="qml/VectoClock.qml" line="482"/>
<location filename="qml/VectoClock.qml" line="559"/>
<source>Font Size</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="372"/>
<location filename="qml/VectoClock.qml" line="492"/>
<location filename="qml/VectoClock.qml" line="569"/>
<source>Font Style</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="379"/>
<location filename="qml/VectoClock.qml" line="499"/>
<location filename="qml/VectoClock.qml" line="576"/>
<source>Font Weight</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="386"/>
<location filename="qml/VectoClock.qml" line="506"/>
<location filename="qml/VectoClock.qml" line="583"/>
<source>Letter Spacing</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="396"/>
<location filename="qml/VectoClock.qml" line="526"/>
<location filename="qml/VectoClock.qml" line="603"/>
<source>Y Offset</source>
<translation>Y偏移量</translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="406"/>
<location filename="qml/VectoClock.qml" line="536"/>
<source>Gap</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="417"/>
<source>Line Settings</source>
<translation>线</translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="429"/>
<source>Width</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="439"/>
<source>Position</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="450"/>
<source>Clock Settings</source>
<translatorcomment></translatorcomment>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="456"/>
<source>24 Hour Clock</source>
<translation>24</translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="462"/>
<source>Text Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="469"/>
<source>Background Visible</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="475"/>
<source>Background Color</source>
<translation></translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="516"/>
<location filename="qml/VectoClock.qml" line="593"/>
<source>X Offset</source>
<translation>X偏移量</translation>
</message>
<message>
<location filename="qml/VectoClock.qml" line="547"/>
<source>Date Settings</source>
<translation></translation>
</message>
</context>
<context>
<name>reflection_clock</name>
<message>
<source>Save</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Show</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Reset</source>
<translation type="vanished"></translation>
</message>
<message>
<source>24 Hour Clock</source>
<translation type="vanished">24</translation>
</message>
<message>
<source>Reflection Clock</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Hour Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Second Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Configuration</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Minute Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Panel Background Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Panel Font Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Clock Background Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Clock Font Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Clock Settings</source>
<translation type="vanished"></translation>
</message>
</context>
<context>
<name>round_clock</name>
<message>
<source>Save</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Reset</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Second Hand Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Hour Scale Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Minute Scale Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Round Clock</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Configuration</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Background Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Hour Hand Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Continuous Second Hand</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Minute Hand Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Clock Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Background transparency</source>
<translation type="vanished"></translation>
</message>
</context>
<context>
<name>solars_clock</name>
<message>
<source>Save</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Reset</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Center Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Background Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Transparency</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Hour Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Solar Clock</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Star Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Show Center</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Font Size</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Orbit Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Font Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Millisecond Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Second Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Configuration</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Scale Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Show Orbit</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Show Scale</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Minute Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Display Time</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Center Radius</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Clock Settings</source>
<translation type="vanished"></translation>
</message>
</context>
<context>
<name>text_clock</name>
<message>
<source>Save</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Reset</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Letter Space</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Font Size</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Font Weight</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Text Clock</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Font Style</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Configuration</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Normal Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>HighLight Color</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Settings</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Line Spacing</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Clock Settings</source>
<translation type="vanished"></translation>
</message>
</context>
</TS>

20
package.json

@ -1,6 +1,6 @@
{
"name": "top.mashiros.widget.nclocks",
"version": "1.0.0",
"version": "1.0.1",
"title": {
"en": "Clock Collections Plugin",
@ -40,7 +40,7 @@
"zh": "太阳系时钟挂件"
},
"preview": "preview/solars_clock.png",
"entry": "solars_clock.qml"
"entry": "qml/SolarsClock.qml"
},
{
"location": "/nclocks/reflection",
@ -50,7 +50,7 @@
"zh": "倒影时钟挂件"
},
"preview": "preview/reflection_clock.png",
"entry": "reflection_clock.qml"
"entry": "qml/ReflectionClock.qml"
},
{
"location": "/nclocks/round",
@ -60,7 +60,7 @@
"zh": "圆盘时钟挂件"
},
"preview": "preview/round_clock.png",
"entry": "round_clock.qml"
"entry": "qml/RoundClock.qml"
},
{
"location": "/nclocks/text",
@ -70,7 +70,17 @@
"zh": "文字时钟挂件"
},
"preview": "preview/text_clock.png",
"entry": "text_clock.qml"
"entry": "qml/TextClock.qml"
},
{
"location": "/nclocks/vecto",
"catalog": "widget",
"title": {
"en": "Vecto Clock Widget",
"zh": "Vecto时钟挂件"
},
"preview": "preview/vecto_clock.png",
"entry": "qml/VectoClock.qml"
}
]
}

BIN
preview/vecto_clock.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

9
qml/Common.qml

@ -0,0 +1,9 @@
pragma Singleton
import QtQuick 2.12
QtObject {
readonly property var fonts: Qt.fontFamilies()
readonly property var fontweight: [Font.Light, Font.Normal, Font.Bold]
readonly property var sfontweight: [qsTr("Light"), qsTr("Normal"), qsTr("Bold")]
}

112
reflection_clock.qml → qml/ReflectionClock.qml

@ -11,16 +11,40 @@ import NERvGear.Preferences 1.0 as P
T.Widget {
WidgetTemplate {
id: widget
solid: true
title: qsTr("Reflection Clock")
editing: styleDialog.active
resizable: true
version: "1.0.0"
defaultValues: {
"Hour Settings": {
"Full Clock": true,
"Clock BG Color": "#2196f3",
"Clock Font Color": "#ffffff",
"Panel BG Color": "#2196f3",
"Panel Font Color": "#ffffff"
},
"Min Settings": {
"Clock BG Color": "#2196f3",
"Clock Font Color": "#ffffff",
"Panel BG Color": "#2196f3",
"Panel Font Color": "#ffffff"
},
"Sec Settings": {
"Visible": true,
"Clock BG Color": "#ff006a",
"Clock Font Color": "#ffffff",
"Panel BG Color": "#ff006a",
"Panel Font Color": "#ffffff"
}
}
readonly property real minWH: Math.min(width/1.64, height)
readonly property real multi: minWH/220
readonly property bool full_clock: widget.settings.styles ? widget.settings.styles["Hour Settings"]["Full Clock"] : true
readonly property bool full_clock: widget.settings.styles["Hour Settings"]["Full Clock"]
property string am_pm: ""
Rectangle {
@ -45,7 +69,7 @@ T.Widget {
Rectangle {
id: hour_top
color: widget.settings.styles ? widget.settings.styles["Hour Settings"]["Clock BG Color"] : "#2196f3"
color: widget.settings.styles["Hour Settings"]["Clock BG Color"]
width: 100*multi
height: 80*multi
anchors.top: parent.top
@ -56,7 +80,11 @@ T.Widget {
Text {
id: hour_text
text: ""
color: widget.settings.styles ? widget.settings.styles["Hour Settings"]["Clock Font Color"] : "#ffffff"
style: Text.Outline
styleColor: "transparent"
color: widget.settings.styles["Hour Settings"]["Clock Font Color"]
anchors.centerIn: parent
font.pointSize: 35*multi
font.weight: Font.Light
@ -66,7 +94,7 @@ T.Widget {
Rectangle {
id: hour_bottom
color: widget.settings.styles ? widget.settings.styles["Hour Settings"]["Panel BG Color"] : "#2196f3"
color: widget.settings.styles["Hour Settings"]["Panel BG Color"]
width: 100*multi
height: 30*multi
anchors.top: hour_top.bottom
@ -76,7 +104,11 @@ T.Widget {
Text {
text: "HOURS"+am_pm
color: widget.settings.styles ? widget.settings.styles["Hour Settings"]["Panel Font Color"] : "#ffffff"
style: Text.Outline
styleColor: "transparent"
color: widget.settings.styles["Hour Settings"]["Panel Font Color"]
anchors.centerIn: parent
font.pointSize: 9*multi
font.weight: Font.Normal
@ -99,7 +131,7 @@ T.Widget {
Rectangle {
id: min_top
color: widget.settings.styles ? widget.settings.styles["Min Settings"]["Clock BG Color"] : "#2196f3"
color: widget.settings.styles["Min Settings"]["Clock BG Color"]
anchors.top: parent.top
anchors.topMargin: 0
anchors.left: parent.left
@ -110,7 +142,11 @@ T.Widget {
Text {
id: min_text
text: ""
color: widget.settings.styles ? widget.settings.styles["Min Settings"]["Clock Font Color"] : "#ffffff"
style: Text.Outline
styleColor: "transparent"
color: widget.settings.styles["Min Settings"]["Clock Font Color"]
anchors.centerIn: parent
font.pointSize: 35*multi
font.weight: Font.Light
@ -120,7 +156,7 @@ T.Widget {
Rectangle {
id: min_bottom
color: widget.settings.styles ? widget.settings.styles["Min Settings"]["Panel BG Color"] : "#2196f3"
color: widget.settings.styles["Min Settings"]["Panel BG Color"]
width: 100*multi
height: 30*multi
anchors.top: min_top.bottom
@ -130,7 +166,11 @@ T.Widget {
Text {
text: "MINUTES"
color: widget.settings.styles ? widget.settings.styles["Min Settings"]["Panel Font Color"] : "#ffffff"
style: Text.Outline
styleColor: "transparent"
color: widget.settings.styles["Min Settings"]["Panel Font Color"]
anchors.centerIn: parent
font.pointSize: 9*multi
font.weight: Font.Normal
@ -148,13 +188,13 @@ T.Widget {
anchors.topMargin: 0
anchors.left: min.right
anchors.leftMargin: 15*multi
visible: widget.settings.styles ? widget.settings.styles["Sec Settings"]["Visible"] : true
visible: widget.settings.styles["Sec Settings"]["Visible"]
width: 100*multi
height: 111*multi
Rectangle {
id: sec_top
color: widget.settings.styles ? widget.settings.styles["Sec Settings"]["Clock BG Color"] : "#ff006a"
color: widget.settings.styles["Sec Settings"]["Clock BG Color"]
width: 100*multi
height: 80*multi
anchors.top: parent.top
@ -165,7 +205,11 @@ T.Widget {
Text {
id: sec_text
text: ""
color: widget.settings.styles ? widget.settings.styles["Sec Settings"]["Clock Font Color"] : "#ffffff"
style: Text.Outline
styleColor: "transparent"
color: widget.settings.styles["Sec Settings"]["Clock Font Color"]
anchors.centerIn: parent
font.pointSize: 35*multi
font.weight: Font.Light
@ -175,7 +219,7 @@ T.Widget {
Rectangle {
id: sec_bottom
color: widget.settings.styles ? widget.settings.styles["Sec Settings"]["Panel BG Color"] : "#ff006a"
color: widget.settings.styles["Sec Settings"]["Panel BG Color"]
width: 100*multi
height: 30*multi
anchors.top: sec_top.bottom
@ -185,7 +229,11 @@ T.Widget {
Text {
text: "SECONDS"
color: widget.settings.styles ? widget.settings.styles["Sec Settings"]["Panel Font Color"] : "#ffffff"
style: Text.Outline
styleColor: "transparent"
color: widget.settings.styles["Sec Settings"]["Panel Font Color"]
anchors.centerIn: parent
font.pointSize: 9*multi
font.weight: Font.Normal
@ -321,7 +369,7 @@ T.Widget {
P.SwitchPreference {
name: "Full Clock"
label: qsTr("24 Hour Clock")
defaultValue: true
defaultValue: defaultValues["Hour Settings"]["Full Clock"]
}
P.Separator {}
@ -329,13 +377,13 @@ T.Widget {
P.ColorPreference {
name: "Clock BG Color"
label: qsTr("Clock Background Color")
defaultValue: "#2196f3"
defaultValue: defaultValues["Hour Settings"]["Clock BG Color"]
}
P.ColorPreference {
name: "Clock Font Color"
label: qsTr("Clock Font Color")
defaultValue: "#ffffff"
defaultValue: defaultValues["Hour Settings"]["Clock Font Color"]
}
P.Separator {}
@ -343,13 +391,13 @@ T.Widget {
P.ColorPreference {
name: "Panel BG Color"
label: qsTr("Panel Background Color")
defaultValue: "#2196f3"
defaultValue: defaultValues["Hour Settings"]["Panel BG Color"]
}
P.ColorPreference {
name: "Panel Font Color"
label: qsTr("Panel Font Color")
defaultValue: "#ffffff"
defaultValue: defaultValues["Hour Settings"]["Panel Font Color"]
}
}
@ -364,13 +412,13 @@ T.Widget {
P.ColorPreference {
name: "Clock BG Color"
label: qsTr("Clock Background Color")
defaultValue: "#2196f3"
defaultValue: defaultValues["Min Settings"]["Clock BG Color"]
}
P.ColorPreference {
name: "Clock Font Color"
label: qsTr("Clock Font Color")
defaultValue: "#ffffff"
defaultValue: defaultValues["Min Settings"]["Clock Font Color"]
}
P.Separator {}
@ -378,13 +426,13 @@ T.Widget {
P.ColorPreference {
name: "Panel BG Color"
label: qsTr("Panel Background Color")
defaultValue: "#2196f3"
defaultValue: defaultValues["Min Settings"]["Panel BG Color"]
}
P.ColorPreference {
name: "Panel Font Color"
label: qsTr("Panel Font Color")
defaultValue: "#ffffff"
defaultValue: defaultValues["Min Settings"]["Panel Font Color"]
}
}
@ -400,7 +448,7 @@ T.Widget {
id: cfg_sec_en
name: "Visible"
label: qsTr("Show")
defaultValue: true
defaultValue: defaultValues["Sec Settings"]["Visible"]
}
P.Separator {}
@ -409,14 +457,14 @@ T.Widget {
name: "Clock BG Color"
label: qsTr("Clock Background Color")
enabled: cfg_sec_en.value
defaultValue: "#ff006a"
defaultValue: defaultValues["Sec Settings"]["Clock BG Color"]
}
P.ColorPreference {
name: "Clock Font Color"
label: qsTr("Clock Font Color")
enabled: cfg_sec_en.value
defaultValue: "#ffffff"
defaultValue: defaultValues["Sec Settings"]["Clock Font Color"]
}
P.Separator {}
@ -425,22 +473,18 @@ T.Widget {
name: "Panel BG Color"
label: qsTr("Panel Background Color")
enabled: cfg_sec_en.value
defaultValue: "#ff006a"
defaultValue: defaultValues["Sec Settings"]["Panel BG Color"]
}
P.ColorPreference {
name: "Panel Font Color"
label: qsTr("Panel Font Color")
enabled: cfg_sec_en.value
defaultValue: "#ffffff"
defaultValue: defaultValues["Sec Settings"]["Panel Font Color"]
}
}
Component.onCompleted: {
if(!widget.settings.styles) {
configuration = rootPreference.save();
widget.settings.styles = configuration;
}
rootPreference.load(widget.settings.styles);
configuration = widget.settings.styles;
}

40
round_clock.qml → qml/RoundClock.qml

@ -10,18 +10,30 @@ import NERvGear.Preferences 1.0 as P
T.Widget {
WidgetTemplate {
id: widget
solid: true
title: qsTr("Round Clock")
editing: styleDialog.active
resizable: true
version: "1.0.0"
defaultValues: {
"Sec Continue": true,
"BG Color": "#2196f3",
"BG Alpha": 50,
"HGRID Color": "#ffffff",
"MGRID Color": "#ffffff",
"Hhand Color": "#ffffff",
"Mhand Color": "#ffffff",
"Shand Color": "#f3a829"
}
property real maxr: Math.min(width/2, height/2) -10
property real thour: 0
property real tmin: 0
property real tsec: 0
property var configs: widget.settings.styles ? widget.settings.styles : {"Sec Continue":true,"BG Color":"#2196f3","BG Alpha":50,"HGRID Color":"#ffffff","MGRID Color":"#ffffff","Hhand Color":"#ffffff","Mhand Color":"#ffffff","Shand Color":"#f3a829"}
property var configs: widget.settings.styles
onConfigsChanged: {
background.requestPaint();
@ -331,7 +343,7 @@ T.Widget {
anchors.fill: parent
header: TitleBar {
text: qsTr("Settings")
text: qsTr("Round Clock")
standardButtons: Dialog.Save | Dialog.Reset
@ -379,7 +391,7 @@ T.Widget {
P.SwitchPreference {
name: "Sec Continue"
label: qsTr("Continuous Second Hand")
defaultValue: true
defaultValue: defaultValues["Sec Continue"]
}
P.Separator {}
@ -387,7 +399,7 @@ T.Widget {
P.ColorPreference {
name: "BG Color"
label: qsTr("Background Color")
defaultValue: "#2196f3"
defaultValue: defaultValues["BG Color"]
}
P.SliderPreference {
@ -396,7 +408,7 @@ T.Widget {
from: 0
to: 100
stepSize: 1
defaultValue: 50
defaultValue: defaultValues["BG Alpha"]
displayValue: value + "%"
}
@ -405,13 +417,13 @@ T.Widget {
P.ColorPreference {
name: "HGRID Color"
label: qsTr("Hour Scale Color")
defaultValue: "#fff"
defaultValue: defaultValues["HGRID Color"]
}
P.ColorPreference {
name: "MGRID Color"
label: qsTr("Minute Scale Color")
defaultValue: "#fff"
defaultValue: defaultValues["MGRID Color"]
}
P.Separator {}
@ -419,26 +431,22 @@ T.Widget {
P.ColorPreference {
name: "Hhand Color"
label: qsTr("Hour Hand Color")
defaultValue: "#fff"
defaultValue: defaultValues["Hhand Color"]
}
P.ColorPreference {
name: "Mhand Color"
label: qsTr("Minute Hand Color")
defaultValue: "#fff"
defaultValue: defaultValues["Mhand Color"]
}
P.ColorPreference {
name: "Shand Color"
label: qsTr("Second Hand Color")
defaultValue: "#F3A829"
defaultValue: defaultValues["Shand Color"]
}
Component.onCompleted: {
if(!widget.settings.styles) {
configuration = rootPreference.save();
widget.settings.styles = configuration;
}
rootPreference.load(widget.settings.styles);
configuration = widget.settings.styles;
}

116
solars_clock.qml → qml/SolarsClock.qml

@ -10,14 +10,50 @@ import NERvGear.Preferences 1.0 as P
T.Widget {
WidgetTemplate {
id: widget
solid: true
title: qsTr("Solar Clock")
resizable: true
editing: styleDialog.active
version: "1.0.0"
defaultValues: {
"BG Settings": {
"BG Color": "#212121",
"BG Alpha": 100,
"Show HGrid": true,
"HGRID Color": "#616161",
"Show Center": true,
"Center Color": "#ffeb3b",
"Center Radius": 85,
"Show Clock": true,
"Clock Color": "#616161",
"Font Name": Common.fonts.length-1,
"Font Weight": 1,
"Font Size": 100
},
"Hour Settings": {
"Hstar Color": "#ffa000",
"Show Orbit": true,
"Horbit Color": "#616161"
},
"Min Settings": {
"Mstar Color": "#ff5722",
"Show Orbit": true,
"Morbit Color": "#616161"
},
"Sec Settings": {
"Sstar Color": "#2196f3",
"Show Orbit": true,
"Sorbit Color": "#616161"
},
"MSec Settings": {
"MSstar Color": "#9e9e9e",
"Show Orbit": true,
"MSorbit Color": "#9e9e9e"
}
}
property real maxr: Math.min(width/2, height/2) -10
readonly property real rhour: maxr*0.9
readonly property real rmin: maxr*0.72
@ -27,7 +63,7 @@ T.Widget {
property real tsec: 0
property real tmsec: 0
property var configs: widget.settings.styles ? widget.settings.styles : {"BG Settings":{"BG Color":"#212121","BG Alpha":100,"Show HGrid":true,"HGRID Color":"#616161","Show Center":true,"Center Color":"#ffeb3b","Center Radius":85,"Show Clock":true,"Clock Color":"#616161","Font Size":100},"Hour Settings":{"Hstar Color":"#ffa000","Show Orbit":true,"Horbit Color":"#616161"},"Min Settings":{"Mstar Color":"#ff5722","Show Orbit":true,"Morbit Color":"#616161"},"Sec Settings":{"Sstar Color":"#2196f3","Show Orbit":true,"Sorbit Color":"#616161"},"MSec Settings":{"MSstar Color":"#9e9e9e","Show Orbit":true,"MSorbit Color":"#9e9e9e"}}
property var configs: widget.settings.styles
onConfigsChanged: {
background.requestPaint();
@ -391,7 +427,7 @@ T.Widget {
anchors.fill: parent
header: TitleBar {
text: qsTr("Settings")
text: qsTr("Solar Clock")
standardButtons: Dialog.Save | Dialog.Reset
@ -445,7 +481,7 @@ T.Widget {
P.ColorPreference {
name: "BG Color"
label: qsTr("Color")
defaultValue: "#212121"
defaultValue: defaultValues["BG Settings"]["BG Color"]
}
P.SliderPreference {
@ -454,7 +490,7 @@ T.Widget {
from: 0
to: 100
stepSize: 1
defaultValue: 100
defaultValue: defaultValues["BG Settings"]["BG Alpha"]
displayValue: value + "%"
}
@ -464,14 +500,14 @@ T.Widget {
id: show_hgrid
name: "Show HGrid"
label: qsTr("Show Scale")
defaultValue: true
defaultValue: defaultValues["BG Settings"]["Show HGrid"]
}
P.ColorPreference {
name: "HGRID Color"
label: qsTr("Scale Color")
enabled: show_hgrid.value
defaultValue: "#616161"
defaultValue: defaultValues["BG Settings"]["HGRID Color"]
}
P.Separator {}
@ -480,14 +516,14 @@ T.Widget {
id: showCenter
name: "Show Center"
label: qsTr("Show Center")
defaultValue: true
defaultValue: defaultValues["BG Settings"]["Show Center"]
}
P.ColorPreference {
name: "Center Color"
label: qsTr("Center Color")
enabled: showCenter.value
defaultValue: "#ffeb3b"
defaultValue: defaultValues["BG Settings"]["Center Color"]
}
P.SliderPreference {
@ -497,7 +533,7 @@ T.Widget {
from: 30
to: 100
stepSize: 1
defaultValue: 85
defaultValue: defaultValues["BG Settings"]["Center Radius"]
displayValue: value + "%"
}
@ -507,14 +543,28 @@ T.Widget {
id: showClock
name: "Show Clock"
label: qsTr("Display Time")
defaultValue: true
defaultValue: defaultValues["BG Settings"]["Show Clock"]
}
P.ColorPreference {
name: "Clock Color"
label: qsTr("Font Color")
enabled: showClock.value
defaultValue: "#616161"
defaultValue: defaultValues["BG Settings"]["Clock Color"]
}
P.SelectPreference {
name: "Font Name"
label: qsTr("Font Style")
defaultValue: defaultValues["BG Settings"]["Font Name"]
model: Common.fonts
}
P.SelectPreference {
name: "Font Weight"
label: qsTr("Font Weight")
defaultValue: defaultValues["BG Settings"]["Font Weight"]
model: Common.sfontweight
}
P.SliderPreference {
@ -524,7 +574,7 @@ T.Widget {
from: 50
to: 100
stepSize: 1
defaultValue: 100
defaultValue: defaultValues["BG Settings"]["Font Size"]
displayValue: value + "%"
}
}
@ -540,7 +590,7 @@ T.Widget {
P.ColorPreference {
name: "Hstar Color"
label: qsTr("Star Color")
defaultValue: "#ffa000"
defaultValue: defaultValues["Hour Settings"]["Hstar Color"]
}
P.Separator {}
@ -549,14 +599,14 @@ T.Widget {
id: hour_settings_show_orbit
name: "Show Orbit"
label: qsTr("Show Orbit")
defaultValue: true
defaultValue: defaultValues["Hour Settings"]["Show Orbit"]
}
P.ColorPreference {
name: "Horbit Color"
label: qsTr("Orbit Color")
enabled: hour_settings_show_orbit.value
defaultValue: "#616161"
defaultValue: defaultValues["Hour Settings"]["Horbit Color"]
}
}
@ -569,7 +619,7 @@ T.Widget {
P.ColorPreference {
name: "Mstar Color"
label: qsTr("Star Color")
defaultValue: "#ff5722"
defaultValue: defaultValues["Min Settings"]["Mstar Color"]
}
P.Separator {}
@ -578,14 +628,14 @@ T.Widget {
id: min_settings_show_orbit
name: "Show Orbit"
label: qsTr("Show Orbit")
defaultValue: true
defaultValue: defaultValues["Min Settings"]["Show Orbit"]
}
P.ColorPreference {
name: "Morbit Color"
label: qsTr("Orbit Color")
enabled: min_settings_show_orbit.value
defaultValue: "#616161"
defaultValue: defaultValues["Min Settings"]["Morbit Color"]
}
}
@ -598,7 +648,7 @@ T.Widget {
P.ColorPreference {
name: "Sstar Color"
label: qsTr("Star Color")
defaultValue: "#2196f3"
defaultValue: defaultValues["Sec Settings"]["Sstar Color"]
}
P.Separator {}
@ -607,14 +657,14 @@ T.Widget {
id: sec_settings_show_orbit
name: "Show Orbit"
label: qsTr("Show Orbit")
defaultValue: true
defaultValue: defaultValues["Sec Settings"]["Show Orbit"]
}
P.ColorPreference {
name: "Sorbit Color"
label: qsTr("Orbit Color")
enabled: sec_settings_show_orbit.value
defaultValue: "#616161"
defaultValue: defaultValues["Sec Settings"]["Sorbit Color"]
}
}
@ -627,7 +677,7 @@ T.Widget {
P.ColorPreference {
name: "MSstar Color"
label: qsTr("Star Color")
defaultValue: "#9e9e9e"
defaultValue: defaultValues["MSec Settings"]["MSstar Color"]
}
P.Separator {}
@ -636,22 +686,18 @@ T.Widget {
id: msec_settings_show_orbit
name: "Show Orbit"
label: qsTr("Show Orbit")
defaultValue: true
defaultValue: defaultValues["MSec Settings"]["Show Orbit"]
}
P.ColorPreference {
name: "MSorbit Color"
label: qsTr("Orbit Color")
enabled: msec_settings_show_orbit.value
defaultValue: "#9e9e9e"
defaultValue: defaultValues["MSec Settings"]["MSorbit Color"]
}
}
Component.onCompleted: {
if(!widget.settings.styles) {
configuration = rootPreference.save();
widget.settings.styles = configuration;
}
rootPreference.load(widget.settings.styles);
configuration = widget.settings.styles;
}
@ -671,11 +717,15 @@ T.Widget {
Text {
id: main_time
text: ""
style: Text.Outline
styleColor: "transparent"
visible: configs["BG Settings"]["Show Clock"]
color: configs["BG Settings"]["Clock Color"]
anchors.centerIn: parent
font.pointSize: 0.0009*configs["BG Settings"]["Center Radius"]*maxr*configs["BG Settings"]["Font Size"]/100
font.weight: Font.Normal
font.family: "Microsoft YaHei"
font.weight: Common.fontweight[configs["BG Settings"]["Font Weight"]]
font.family: Common.fonts[configs["BG Settings"]["Font Name"]]//"Microsoft YaHei"
}
}

59
text_clock.qml → qml/TextClock.qml

@ -2,20 +2,30 @@ import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0
import NERvGear 1.0 as NVG
import NERvGear.Controls 1.0
import NERvGear.Templates 1.0 as T
import NERvGear.Preferences 1.0 as P
import "."
T.Widget {
WidgetTemplate {
id: widget
solid: true
title: qsTr("Text Clock")
resizable: true
editing: styleDialog.active
version: "1.0.0"
defaultValues: {
"Font Name": Common.fonts.length-1,
"Font Weight": 0,
"Normal Color": "#333333",
"HighLight Color": "#FFF",
"Font Size": 20,
"Letter Space": 20,
"Line Height": 1.5
}
property real day: 1
property real hours: 0
@ -43,10 +53,6 @@ T.Widget {
"9": 10, "1": 11, "13": 11, "6": 12, "3": 13, "4": 14, "5": 15, "2": 16,
"8": 17, "11": 18, "23": 18, "7": 19, "12": 20, "10": 21, "OCLOCK": 22, "0": 23, "24": 23}
readonly property var fonts: Qt.fontFamilies()
readonly property var fontweight: [Font.Light, Font.Normal, Font.DemiBold, Font.Bold, Font.Black]
readonly property var sfontweight: ["Light", "Normal", "DemiBold", "Bold", "Black"]
function stringFormat(rtext, format) {
if (!rtext)
return null;
@ -77,10 +83,13 @@ T.Widget {
color: widget.settings.styles["Normal Color"]
text: ""
style: Text.Outline
styleColor: "transparent"
anchors.centerIn: parent
font.pointSize: widget.settings.styles["Font Size"]
font.weight: fontweight[widget.settings.styles["Font Weight"]]
font.family: fonts[widget.settings.styles["Font Name"]]
font.weight: Common.fontweight[widget.settings.styles["Font Weight"]]
font.family: Common.fonts[widget.settings.styles["Font Name"]]
lineHeight: widget.settings.styles["Line Height"]
font.letterSpacing: widget.settings.styles["Letter Space"]
}
@ -174,7 +183,7 @@ T.Widget {
anchors.fill: parent
header: TitleBar {
text: qsTr("Settings")
text: qsTr("Text Clock")
standardButtons: Dialog.Save | Dialog.Reset
@ -223,28 +232,28 @@ T.Widget {
name: "Font Name"
label: qsTr("Font Style")
icon.name: "solid:\uf1fc"
defaultValue: 408
model: fonts
defaultValue: defaultValues["Font Name"]
model: Common.fonts
}
P.SelectPreference {
name: "Font Weight"
label: qsTr("Font Weight")
icon.name: "solid:\uf1fc"
defaultValue: 0
model: sfontweight
defaultValue: defaultValues["Font Weight"]
model: Common.sfontweight
}
P.ColorPreference {
name: "HighLight Color"
label: qsTr("HighLight Color")
defaultValue: "#FFF"
defaultValue: defaultValues["HighLight Color"]
}
P.ColorPreference {
name: "Normal Color"
label: qsTr("Normal Color")
defaultValue: "#333333"
defaultValue: defaultValues["Normal Color"]
}
P.SliderPreference {
@ -253,7 +262,7 @@ T.Widget {
from: 1
to: 40
stepSize: 1
defaultValue: 20
defaultValue: defaultValues["Font Size"]
displayValue: value
}
@ -263,7 +272,7 @@ T.Widget {
from: 1
to: 40
stepSize: 1
defaultValue: 20
defaultValue: defaultValues["Letter Space"]
displayValue: value
}
@ -273,15 +282,11 @@ T.Widget {
from: 0.8
to: 2
stepSize: 0.1
defaultValue: 1.5
defaultValue: defaultValues["Line Height"]
displayValue: value.toFixed(1)
}
Component.onCompleted: {
if(!widget.settings.styles) {
configuration = rootPreference.save();
widget.settings.styles = configuration;
}
rootPreference.load(widget.settings.styles);
configuration = widget.settings.styles;
}
@ -297,10 +302,4 @@ T.Widget {
}
}
}
Component.onCompleted: {
if (!widget.settings.styles) {
widget.settings.styles = {"Font Name": fonts.length-1, "Font Weight": 0, "Normal Color": "#333333", "HighLight Color": "#FFF", "Font Size": 20, "Letter Space": 20, "Line Height": 1.5};
}
}
}

628
qml/VectoClock.qml

@ -0,0 +1,628 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0
import QtQuick.Shapes 1.1
import NERvGear 1.0 as NVG
import NERvGear.Controls 1.0
import NERvGear.Templates 1.0 as T
import NERvGear.Preferences 1.0 as P
import "."
WidgetTemplate {
id: widget
title: qsTr("Vecto Clock")
editing: styleDialog.active
resizable: true
version: "1.0.0"
defaultValues: {
"Weekday Settings": {
"Color": "#ffffff",
"Font Size": 43,
"Font Name": Common.fonts.length - 1,
"Font Weight": 2,
"Letter Spacing": 4,
"Y Offset": 50,
"Gap": 12
},
"Line Settings": {
"Color": "#ffffff",
"Width": 30,
"Position": -8
},
"Clock Settings": {
"Full Clock": false,
"Text Color": "#554e49",
"Background Visible": true,
"Background Color": "#ffffff",
"Font Size": 33,
"Font Name": Common.fonts.length - 1,
"Font Weight": 1,
"Letter Spacing": 0,
"X Offset": 0,
"Y Offset": 24,
"Gap": 9
},
"Date Settings": {
"Color": "#ffffff",
"Font Size": 10,
"Font Name": Common.fonts.length - 1,
"Font Weight": 1,
"Letter Spacing": 25,
"X Offset": 29,
"Y Offset": 12
}
}
menu: Menu {
Action {
text: qsTr("Settings") + "..."
onTriggered: styleDialog.active = true
}
}
readonly property var configs: widget.settings.styles
onConfigsChanged: {
weekday_mask_source.requestPaint();
divline.requestPaint();
clockbg.requestPaint();
configsFlag = true;
}
property bool configsFlag: false
property real thour: 0
property real t12hour: 0
property real tmin: -1
readonly property var weekdays: ["SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"]
property int weekday: -1
readonly property var months: ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"]
property string dateString: ""
readonly property real whRatio: width/height
readonly property real fixWHRatio: 2.1
property real clock_width: main.height*fixWHRatio * (0.5-0.005*configs["Line Settings"]["Position"])
property real left_gap_ratio: configs["Weekday Settings"]["Gap"]/100
property real right_gap_ratio: configs["Clock Settings"]["Gap"]/100
property real clock_text_size: weekday_mask.height*configs["Clock Settings"]["Font Size"]/100
property real right_topMargin: (timeinfo.height-clock_text_size)*configs["Clock Settings"]["Y Offset"]/100
Item {
id: main
anchors.centerIn: parent
width: widget.width
height: whRatio > fixWHRatio ? widget.height : widget.width/fixWHRatio
Item {
id: weekday_mask
width: main.width - clock_width
height: main.height
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
layer.enabled: true
layer.effect: OpacityMask{
maskSource: weekday_mask_source
}
Canvas {
id: weekday_mask_source
visible: false
anchors.fill: parent
renderStrategy: Canvas.Cooperative
contextType: "2d"
onPaint: {
context.reset();
context.clearRect(0,0,width,height);
context.beginPath();
context.lineTo(weekday_mask.width-weekday_mask.height*left_gap_ratio, 0);
context.lineTo(weekday_mask.width-0.45*weekday_mask.height-weekday_mask.height*left_gap_ratio, weekday_mask.height);
context.lineTo(0, weekday_mask.height);
context.lineTo(0, 0);
context.closePath();
context.fill();
}
onHeightChanged: {
requestPaint();
}
onWidthChanged: {
requestPaint();
}
}
Text {
id: weekday_text
text: weekday>-1 ? weekdays[weekday] : ""
color: configs["Weekday Settings"]["Color"]
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: (weekday_mask.height-height*0.75)*configs["Weekday Settings"]["Y Offset"]/100
style: Text.Outline
styleColor: "transparent"
font.pixelSize: weekday_mask.height*configs["Weekday Settings"]["Font Size"]/100
font.letterSpacing: weekday_mask.width/text.length*configs["Weekday Settings"]["Letter Spacing"]/100
font.family: Common.fonts[configs["Weekday Settings"]["Font Name"]]
font.weight: Common.fontweight[configs["Weekday Settings"]["Font Weight"]]
}
}
Item {
id: timeinfo
width: clock_width+0.45*timeinfo.height
height: main.height
anchors.right: parent.right
anchors.top: parent.top
Canvas {
id: divline
anchors.fill: parent
renderTarget: Canvas.FramebufferObject
renderStrategy: Canvas.Cooperative
contextType: "2d"
onPaint: {
context.reset();
context.clearRect(0,0,width,height);
context.lineWidth = 6*configs["Line Settings"]["Width"]/100;
context.strokeStyle = configs["Line Settings"]["Color"];
context.beginPath();
context.moveTo(0, timeinfo.height);
context.lineTo(0.45*timeinfo.height, 0);
context.closePath();
context.stroke();
}
onHeightChanged: {
requestPaint();
}
}
Canvas {
id: clockbg
width: timeinfo.width
height: clock_text_size
visible: configs["Clock Settings"]["Background Visible"]
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: right_topMargin
renderStrategy: Canvas.Cooperative
contextType: "2d"
onPaint: {
context.reset();
context.clearRect(0,0,width,height);
context.fillStyle = configs["Clock Settings"]["Background Color"];
context.beginPath();
context.moveTo(timeinfo.width, 0);
context.lineTo(0.45*(timeinfo.height-right_topMargin)+timeinfo.height*right_gap_ratio, 0);
context.lineTo(timeinfo.height*right_gap_ratio, timeinfo.height-right_topMargin);
context.lineTo(timeinfo.width, timeinfo.height);
context.closePath();
context.fill();
}
onHeightChanged: {
requestPaint();
}
}
Text {
id: clock_text
anchors.horizontalCenter: clockbg.horizontalCenter
anchors.horizontalCenterOffset: -right_topMargin*0.225 + timeinfo.width*(0.225*configs["Clock Settings"]["X Offset"]+12.5)/100 + timeinfo.height*right_gap_ratio/2
anchors.verticalCenterOffset: height/100
anchors.verticalCenter: clockbg.verticalCenter
text: ""
color: configs["Clock Settings"]["Text Color"]
style: Text.Outline
styleColor: "transparent"
font.pixelSize: clock_text_size/1.7
font.letterSpacing: clock_width/text.length*configs["Clock Settings"]["Letter Spacing"]/100
font.family: Common.fonts[configs["Clock Settings"]["Font Name"]]
font.weight: Common.fontweight[configs["Clock Settings"]["Font Weight"]]
}
Text {
id: date_text
anchors.top: clockbg.bottom
anchors.topMargin: (configs["Date Settings"]["Y Offset"]>0 ? (main.height-right_topMargin-clock_text_size-height) : right_topMargin+clock_text_size)*configs["Date Settings"]["Y Offset"]/100
anchors.left: clockbg.left
anchors.leftMargin: (configs["Date Settings"]["X Offset"]>0 ? clock_width : main.width-timeinfo.width)*configs["Date Settings"]["X Offset"]/100
text: dateString
color: configs["Date Settings"]["Color"]
style: Text.Outline
styleColor: "transparent"
font.pixelSize: timeinfo.height*configs["Date Settings"]["Font Size"]/100
font.letterSpacing: clock_width/text.length*configs["Date Settings"]["Letter Spacing"]/100
font.family: Common.fonts[configs["Date Settings"]["Font Name"]]
font.weight: Common.fontweight[configs["Date Settings"]["Font Weight"]]
}
}
}
Timer {
interval: 250
running: true
repeat: true
onTriggered: {
var now = new Date();
if (tmin !== now.getMinutes() || configsFlag) {
configsFlag = false;
tmin = now.getMinutes();
thour = now.getHours();
if (configs["Clock Settings"]["Full Clock"]) {
clock_text.text = [("0"+thour).slice(-2), ("0"+tmin).slice(-2)].join(":");
} else {
t12hour = thour > 12 ? thour - 12 : thour;
clock_text.text = [t12hour,("0"+tmin).slice(-2)].join(":") + (thour > 11 ? "PM" : "AM");
}
if (weekday !== now.getDay()) {
weekday = now.getDay();
dateString = [months[now.getMonth()], now.getDate(), now.getFullYear()].join(" ");
}
}
}
}
Loader {
id: styleDialog
active: false
sourceComponent: NVG.Window {
id: window
title: qsTr("Settings")
visible: true
minimumWidth: 500
minimumHeight: 600
width: minimumWidth
height: minimumHeight
transientParent: widget.NVG.View.window
property var configuration
Page {
id: cfg_page
anchors.fill: parent
header: TitleBar {
text: qsTr("Vecto Clock")
standardButtons: Dialog.Save | Dialog.Reset
onAccepted: {
configuration = rootPreference.save();
widget.settings.styles = configuration;
styleDialog.active = false;
}
onReset: {
rootPreference.load();
let cfg = rootPreference.save();
widget.settings.styles = cfg;
}
}
ColumnLayout {
id: root
anchors.fill: parent
anchors.margins: 16
anchors.topMargin: 16
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: "Weekday Settings"
label: qsTr("Weekday Settings")
live: true
icon.name: "regular:\uf1de"
P.ColorPreference {
name: "Color"
label: qsTr("Color")
defaultValue: defaultValues["Weekday Settings"]["Color"]
}
P.SliderPreference {
name: "Font Size"
label: qsTr("Font Size")
from: 1
to: 100
stepSize: 1
defaultValue: defaultValues["Weekday Settings"]["Font Size"]
displayValue: value + "%"
}
P.SelectPreference {
name: "Font Name"
label: qsTr("Font Style")
defaultValue: defaultValues["Weekday Settings"]["Font Name"]
model: Common.fonts
}
P.SelectPreference {
name: "Font Weight"
label: qsTr("Font Weight")
defaultValue: defaultValues["Weekday Settings"]["Font Weight"]
model: Common.sfontweight
}
P.SliderPreference {
name: "Letter Spacing"
label: qsTr("Letter Spacing")
from: 0
to: 100
stepSize: 1
defaultValue: defaultValues["Weekday Settings"]["Letter Spacing"]
displayValue: value + "%"
}
P.SliderPreference {
name: "Y Offset"
label: qsTr("Y Offset")
from: 0
to: 100
stepSize: 1
defaultValue: defaultValues["Weekday Settings"]["Y Offset"]
displayValue: value + "%"
}
P.SliderPreference {
name: "Gap"
label: qsTr("Gap")
from: 0
to: 100
stepSize: 1
defaultValue: defaultValues["Weekday Settings"]["Gap"]
displayValue: value + "%"
}
}
P.DialogPreference {
name: "Line Settings"
label: qsTr("Line Settings")
live: true
icon.name: "regular:\uf1de"
P.ColorPreference {
name: "Color"
label: qsTr("Color")
defaultValue: defaultValues["Line Settings"]["Color"]
}
P.SliderPreference {
name: "Width"
label: qsTr("Width")
from: 1
to: 100
stepSize: 1
defaultValue: defaultValues["Line Settings"]["Width"]
displayValue: value + "%"
}
P.SliderPreference {
name: "Position"
label: qsTr("Position")
from: -100
to: 100
stepSize: 1
defaultValue: defaultValues["Line Settings"]["Position"]
displayValue: value + "%"
}
}
P.DialogPreference {
name: "Clock Settings"
label: qsTr("Clock Settings")
live: true
icon.name: "regular:\uf1de"
P.SwitchPreference {
name: "Full Clock"
label: qsTr("24 Hour Clock")
defaultValue: defaultValues["Clock Settings"]["Full Clock"]
}
P.ColorPreference {
name: "Text Color"
label: qsTr("Text Color")
defaultValue: defaultValues["Clock Settings"]["Text Color"]
}
P.SwitchPreference {
id: _cfg_clock_background_visible
name:"Background Visible"
label: qsTr("Background Visible")
defaultValue: defaultValues["Clock Settings"]["Background Visible"]
}
P.ColorPreference {
name: "Background Color"
label: qsTr("Background Color")
enabled: _cfg_clock_background_visible.value
defaultValue: defaultValues["Clock Settings"]["Background Color"]
}
P.SliderPreference {
name: "Font Size"
label: qsTr("Font Size")
from: 1
to: 100
stepSize: 1
defaultValue: defaultValues["Clock Settings"]["Font Size"]
displayValue: value + "%"
}
P.SelectPreference {
name: "Font Name"
label: qsTr("Font Style")
defaultValue: defaultValues["Clock Settings"]["Font Name"]
model: Common.fonts
}
P.SelectPreference {
name: "Font Weight"
label: qsTr("Font Weight")
defaultValue: defaultValues["Clock Settings"]["Font Weight"]
model: Common.sfontweight
}
P.SliderPreference {
name: "Letter Spacing"
label: qsTr("Letter Spacing")
from: 0
to: 100
stepSize: 1
defaultValue: defaultValues["Clock Settings"]["Letter Spacing"]
displayValue: value + "%"
}
P.SliderPreference {
name: "X Offset"
label: qsTr("X Offset")
from: -100
to: 100
stepSize: 1
defaultValue: defaultValues["Clock Settings"]["X Offset"]
displayValue: value + "%"
}
P.SliderPreference {
name: "Y Offset"
label: qsTr("Y Offset")
from: 0
to: 100
stepSize: 1
defaultValue: defaultValues["Clock Settings"]["Y Offset"]
displayValue: value + "%"
}
P.SliderPreference {
name: "Gap"
label: qsTr("Gap")
from: 0
to: 100
stepSize: 1
defaultValue: defaultValues["Clock Settings"]["Gap"]
displayValue: value + "%"
}
}
P.DialogPreference {
name: "Date Settings"
label: qsTr("Date Settings")
live: true
icon.name: "regular:\uf1de"
P.ColorPreference {
name: "Color"
label: qsTr("Color")
defaultValue: defaultValues["Date Settings"]["Color"]
}
P.SliderPreference {
name: "Font Size"
label: qsTr("Font Size")
from: 1
to: 100
stepSize: 1
defaultValue: defaultValues["Date Settings"]["Font Size"]
displayValue: value + "%"
}
P.SelectPreference {
name: "Font Name"
label: qsTr("Font Style")
defaultValue: defaultValues["Date Settings"]["Font Name"]
model: Common.fonts
}
P.SelectPreference {
name: "Font Weight"
label: qsTr("Font Weight")
defaultValue: defaultValues["Date Settings"]["Font Weight"]
model: Common.sfontweight
}
P.SliderPreference {
name: "Letter Spacing"
label: qsTr("Letter Spacing")
from: 0
to: 100
stepSize: 1
defaultValue: defaultValues["Date Settings"]["Letter Spacing"]
displayValue: value + "%"
}
P.SliderPreference {
name: "X Offset"
label: qsTr("X Offset")
from: -100
to: 100
stepSize: 1
defaultValue: defaultValues["Date Settings"]["X Offset"]
displayValue: value + "%"
}
P.SliderPreference {
name: "Y Offset"
label: qsTr("Y Offset")
from: -100
to: 100
stepSize: 1
defaultValue: defaultValues["Date Settings"]["Y Offset"]
displayValue: value + "%"
}
}
Component.onCompleted: {
rootPreference.load(widget.settings.styles);
configuration = widget.settings.styles;
}
}
}
}
}
}
onClosing: {
widget.settings.styles = configuration;
styleDialog.active = false;
}
}
}
}

44
qml/WidgetTemplate.qml

@ -0,0 +1,44 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import NERvGear 1.0 as NVG
import NERvGear.Templates 1.0 as T
T.Widget {
solid: true
visible: true
property string version: ""
property var defaultValues: {}
signal completed()
signal updated()
function updateObject(targetObj, sourceObj) {
for (let prop in sourceObj) {
if (sourceObj.hasOwnProperty(prop) && sourceObj[prop] !== undefined) {
if (typeof sourceObj[prop] === 'object') {
Object.assign(targetObj[prop], sourceObj[prop]);
} else {
targetObj[prop] = sourceObj[prop];
}
}
}
return targetObj;
}
onUpdated: {
widget.settings.styles = updateObject(JSON.parse(JSON.stringify(defaultValues)), widget.settings.styles);
}
Component.onCompleted: {
if (!widget.settings.styles) {
widget.settings.styles = defaultValues;
widget.settings.version = version;
} else if (widget.settings.version !== version) {
updated();
widget.settings.version = version;
}
completed();
}
}

1
qml/qmldir

@ -0,0 +1 @@
singleton Common 1.0 Common.qml
Loading…
Cancel
Save