From 6cf739c5eb59ff50f8442e6f5ab9d09ffde8f4fb Mon Sep 17 00:00:00 2001 From: mashiros <490328928@qq.com> Date: Mon, 23 May 2022 19:19:19 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E7=BB=9F=E4=B8=80=E6=8E=A5=E5=8F=A3=20-=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=97=B6=E9=92=9F=E6=A0=B7=E5=BC=8Fvecto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Locales/zh.qm | Bin 4039 -> 5027 bytes Locales/zh.ts | 756 ++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 20 +- preview/vecto_clock.png | Bin 0 -> 17568 bytes qml/Common.qml | 9 + qml/ReflectionClock.qml | 503 ++++++++++++++++++++++++++++++++ qml/RoundClock.qml | 465 +++++++++++++++++++++++++++++ qml/SolarsClock.qml | 731 ++++++++++++++++++++++++++++++++++++++++++++++ qml/TextClock.qml | 305 +++++++++++++++++++ qml/VectoClock.qml | 628 ++++++++++++++++++++++++++++++++++++++++ qml/WidgetTemplate.qml | 44 +++ qml/qmldir | 1 + reflection_clock.qml | 459 ----------------------------- round_clock.qml | 457 ----------------------------- solars_clock.qml | 681 ------------------------------------------- text_clock.qml | 306 -------------------- 16 files changed, 3457 insertions(+), 1908 deletions(-) create mode 100644 Locales/zh.ts create mode 100644 preview/vecto_clock.png create mode 100644 qml/Common.qml create mode 100644 qml/ReflectionClock.qml create mode 100644 qml/RoundClock.qml create mode 100644 qml/SolarsClock.qml create mode 100644 qml/TextClock.qml create mode 100644 qml/VectoClock.qml create mode 100644 qml/WidgetTemplate.qml create mode 100644 qml/qmldir delete mode 100644 reflection_clock.qml delete mode 100644 round_clock.qml delete mode 100644 solars_clock.qml delete mode 100644 text_clock.qml diff --git a/Locales/zh.qm b/Locales/zh.qm index 1d112c178a8b10fe12cbbc363d5b6f1165a63684..f72df4a994d9400229cdae388379d50190dbfe45 100644 GIT binary patch liter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Oxfqc({Nu@w(vlfP2fOM>$4a-?2ynv)1dxE!rEoD7^xc;fD0!W8L^ zoce{DBPXC>caR9Ge@^gG4+Ehs~^TVPJ-z4VPk#jw5G_q0+I--0d9Xf zFPKI-A&y`BOsWRchHD6^ss(Rowy|ayKZcP27ivNR3Lyo_#v!gzInzWWj)_zglyCa|an&Lf2A<6V*3U=2dWend}v4t5e-`XaXO z-Pn40L{G;Ma#f;3(RPGN?nTXCeFpwC)BY)hWRmTM|0 zyIcc2LM3m0Hwg8KxP|Qfwxewx_=X}@peh+pQTh}7C%%9kD6~2{`IlXpgiO+Q-5l#K6y6xhGJkrV@eLxEk#)fhYci)ESqenyf03sQ$1>NAl9z$n>+{ zcB&Iog9#J8)j$Pm#AtUcp{A6MK&={A6M4e4h8qM+7(Wj4n5t;`06Bxsgs6XO4xF@RN$54|RY1NFW5N0AWhJFaf&55* zygfER7Q0bYr1<|SwjPEoHV#uzu^Y=H$Mk}mHS>qe=E&DE)Ydi&wC3L5J{u4*%stjI?f_}I`-soX<2E3I zeB2=klXuw%oMOENfdjgYuI{=;2IL`a>fOM#5gI_#?yWs zk&Y}eCOE-5A4p6g>x)F?P$ubY$jh?2I005y0Lw)m&Ndj`U$3g!Djox4lr;xLuRs>W zD1kl1({j&P)rr5YV^7e>!^VZej$4K1vIx>6Xgb7sSTI=&m2b-0qBdCynG_yPdPd8b zWck&fjbL>d=g_3Bf7e5i4Gm-23tBpEh}afzV!Zzg^H?}T^kGSkbs3j10x`K5eAiN6 zUmf@!*8Mk%OrWF}TEn9^#zxFM{9(9;!w?sG#i%VcYUuDwOBwF60vBR%hO4{YFGPk; zW%xD=FFvRydc?RhDJPL + + + + Common + + + Light + 细体 + + + + Normal + 普通 + + + + Bold + 加粗 + + + + ReflectionClock + + + Reflection Clock + 倒影时钟 + + + + + Settings + 设置 + + + + Clock Settings + 时钟设置 + + + + Configuration + 配置项 + + + + Hour Settings + 时设置 + + + + 24 Hour Clock + 24时制 + + + + + + Clock Background Color + 时钟背景颜色 + + + + + + Clock Font Color + 时钟字体颜色 + + + + + + Panel Background Color + 面板背景颜色 + + + + + + Panel Font Color + 面板字体颜色 + + + + Minute Settings + 分设置 + + + + Second Settings + 秒设置 + + + + Show + 显示 + + + + RoundClock + + + + Round Clock + 圆盘时钟 + + + + Settings + 设置 + + + + Clock Settings + 时钟设置 + + + + Configuration + 配置项 + + + + Continuous Second Hand + 秒针连续 + + + + Background Color + 背景颜色 + + + + Background transparency + 背景透明度 + + + + Hour Scale Color + 时刻度颜色 + + + + Minute Scale Color + 分刻度颜色 + + + + Hour Hand Color + 时针颜色 + + + + Minute Hand Color + 分针颜色 + + + + Second Hand Color + 秒针颜色 + + + + SolarsClock + + + + Solar Clock + 太阳系时钟 + + + + Settings + 设置 + + + + Clock Settings + 时钟设置 + + + + Configuration + 配置项 + + + + Background Settings + 背景设置 + + + + Color + 颜色 + + + + Transparency + 透明度 + + + + Show Scale + 显示刻度 + + + + Scale Color + 刻度颜色 + + + + Show Center + 中心显示 + + + + Center Color + 中心颜色 + + + + Center Radius + 中心半径 + + + + Display Time + 显示时间 + + + + Font Color + 字体颜色 + + + + Font Style + 字体样式 + + + + Font Weight + 字体粗细 + + + + Font Size + 字体大小 + + + + Hour Settings + 时设置 + + + + + + + Star Color + 星球颜色 + + + + + + + Show Orbit + 显示轨道 + + + + + + + Orbit Color + 轨道颜色 + + + + Minute Settings + 分设置 + + + + Second Settings + 秒设置 + + + + Millisecond Settings + 毫秒设置 + + + + TextClock + + + + Text Clock + 文字时钟挂件 + + + + Settings + 设置 + + + + Clock Settings + 时钟设置 + + + + Configuration + 配置项 + + + + Font Style + 字体样式 + + + + Font Weight + 字体粗细 + + + + HighLight Color + 高亮颜色 + + + + Normal Color + 普通颜色 + + + + Font Size + 字体大小 + + + + Letter Space + 文字间隔 + + + + Line Spacing + 行距 + + + + VectoClock + + + + Vecto Clock + Vecto时钟 + + + + + Settings + 设置 + + + + Configuration + 配置项 + + + + Weekday Settings + 星期设置 + + + + + + Color + 颜色 + + + + + + Font Size + 字体大小 + + + + + + Font Style + 字体样式 + + + + + + Font Weight + 字体粗细 + + + + + + Letter Spacing + 文字间隔 + + + + + + Y Offset + Y偏移量 + + + + + Gap + 间距 + + + + Line Settings + 线设置 + + + + Width + 宽度 + + + + Position + 位置 + + + + Clock Settings + 时钟设置 + 时钟设置 + + + + 24 Hour Clock + 24时制 + + + + Text Color + 文字颜色 + + + + Background Visible + 背景可见 + + + + Background Color + 背景颜色 + + + + + X Offset + X偏移量 + + + + Date Settings + 日期设置 + + + + reflection_clock + + Save + 保存 + + + Show + 显示 + + + Reset + 重置 + + + 24 Hour Clock + 24时制 + + + Reflection Clock + 倒影时钟 + + + Hour Settings + 时设置 + + + Second Settings + 秒设置 + + + Configuration + 配置项 + + + Minute Settings + 分设置 + + + Panel Background Color + 面板背景颜色 + + + Settings + 设置 + + + Panel Font Color + 面板字体颜色 + + + Clock Background Color + 时钟背景颜色 + + + Clock Font Color + 时钟字体颜色 + + + Clock Settings + 时钟设置 + + + + round_clock + + Save + 保存 + + + Reset + 重置 + + + Second Hand Color + 秒针颜色 + + + Hour Scale Color + 时刻度颜色 + + + Minute Scale Color + 分刻度颜色 + + + Round Clock + 圆盘时钟 + + + Configuration + 配置项 + + + Background Color + 背景颜色 + + + Hour Hand Color + 时针颜色 + + + Continuous Second Hand + 秒针连续 + + + Minute Hand Color + 分针颜色 + + + Settings + 设置 + + + Clock Settings + 时钟设置 + + + Background transparency + 背景透明度 + + + + solars_clock + + Save + 保存 + + + Color + 颜色 + + + Reset + 重置 + + + Center Color + 中心颜色 + + + Background Settings + 背景设置 + + + Transparency + 透明度 + + + Hour Settings + 时设置 + + + Solar Clock + 太阳系时钟 + + + Star Color + 星球颜色 + + + Show Center + 中心显示 + + + Font Size + 字体大小 + + + Orbit Color + 轨道颜色 + + + Font Color + 字体颜色 + + + Millisecond Settings + 毫秒设置 + + + Second Settings + 秒设置 + + + Configuration + 配置项 + + + Scale Color + 刻度颜色 + + + Show Orbit + 显示轨道 + + + Show Scale + 显示刻度 + + + Minute Settings + 分设置 + + + Display Time + 显示时间 + + + Center Radius + 中心半径 + + + Settings + 设置 + + + Clock Settings + 时钟设置 + + + + text_clock + + Save + 保存 + + + Reset + 重置 + + + Letter Space + 文字间隔 + + + Font Size + 字体大小 + + + Font Weight + 字体粗细 + + + Text Clock + 文字时钟挂件 + + + Font Style + 字体样式 + + + Configuration + 配置项 + + + Normal Color + 普通颜色 + + + HighLight Color + 高亮颜色 + + + Settings + 设置 + + + Line Spacing + 行距 + + + Clock Settings + 时钟设置 + + + diff --git a/package.json b/package.json index e8ed14e..9aca7d9 100644 --- a/package.json +++ b/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" } ] } \ No newline at end of file diff --git a/preview/vecto_clock.png b/preview/vecto_clock.png new file mode 100644 index 0000000000000000000000000000000000000000..e8a5e5ee3e5329743fd7909c0c995c8a4d23f600 GIT binary patch literal 17568 zcmXwhcO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y%8p41*9Xoi5 zuBt-QFf3>!QfPu{GAVkk+rcdQE7dB+so<{&56LmPt2ejpxj12uGXvYwHJ>XC| z;IJsr!%>8yF-txK@j{L$_>4O^3=u>S7SdgZ7v+-%$93!7+14P4{J{p`3G`Hek~d1j zMOfuk0VwmD#Ju0Z%yr`vVe}ot0A4K}O{5)YY6Nq9o89Umd@z?=4>}=U%T zM{7id#s1$Z&8NW!UV!qd7Q&JJWQgwYq;~cKH$ml%f{bY14?WfYfBmPs{ zP1iqwJ7N0Ib3@-0r^$UAtvMzC@7jhApOe3nf06W{`L`PQ$`R<{eGO!(qUnqO2gK3E A1^@s6 literal 0 HcmV?d00001 diff --git a/qml/Common.qml b/qml/Common.qml new file mode 100644 index 0000000..4335adb --- /dev/null +++ b/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")] +} \ No newline at end of file diff --git a/qml/ReflectionClock.qml b/qml/ReflectionClock.qml new file mode 100644 index 0000000..0e45d70 --- /dev/null +++ b/qml/ReflectionClock.qml @@ -0,0 +1,503 @@ +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 + + + +WidgetTemplate { + id: widget + 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["Hour Settings"]["Full Clock"] + property string am_pm: "" + + Rectangle { + id: main + color: "transparent" + anchors.top: parent.top + anchors.topMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + width: 345*multi + height: 222*multi + + Rectangle { + id: hour + color: "transparent" + anchors.top: parent.top + anchors.topMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 15*multi + width: 100*multi + height: 111*multi + + Rectangle { + id: hour_top + color: widget.settings.styles["Hour Settings"]["Clock BG Color"] + width: 100*multi + height: 80*multi + anchors.top: parent.top + anchors.topMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + + Text { + id: hour_text + text: "" + + 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 + font.family: "Microsoft YaHei" + } + } + + Rectangle { + id: hour_bottom + color: widget.settings.styles["Hour Settings"]["Panel BG Color"] + width: 100*multi + height: 30*multi + anchors.top: hour_top.bottom + anchors.topMargin: multi + anchors.left: parent.left + anchors.leftMargin: 0 + + Text { + text: "HOURS"+am_pm + + 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 + font.family: "Microsoft YaHei" + font.letterSpacing: 2*multi + } + } + } + + + Rectangle { + id: min + color: "transparent" + anchors.top: parent.top + anchors.topMargin: 0 + anchors.left: hour.right + anchors.leftMargin: 15*multi + width: 100*multi + height: 111*multi + + Rectangle { + id: min_top + color: widget.settings.styles["Min Settings"]["Clock BG Color"] + anchors.top: parent.top + anchors.topMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + width: 100*multi + height: 80*multi + + Text { + id: min_text + text: "" + + 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 + font.family: "Microsoft YaHei" + } + } + + Rectangle { + id: min_bottom + color: widget.settings.styles["Min Settings"]["Panel BG Color"] + width: 100*multi + height: 30*multi + anchors.top: min_top.bottom + anchors.topMargin: multi + anchors.left: parent.left + anchors.leftMargin: 0 + + Text { + text: "MINUTES" + + 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 + font.family: "Microsoft YaHei" + font.letterSpacing: 2*multi + } + } + } + + + Rectangle { + id: sec + color: "transparent" + anchors.top: parent.top + anchors.topMargin: 0 + anchors.left: min.right + anchors.leftMargin: 15*multi + visible: widget.settings.styles["Sec Settings"]["Visible"] + width: 100*multi + height: 111*multi + + Rectangle { + id: sec_top + color: widget.settings.styles["Sec Settings"]["Clock BG Color"] + width: 100*multi + height: 80*multi + anchors.top: parent.top + anchors.topMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + + Text { + id: sec_text + text: "" + + 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 + font.family: "Microsoft YaHei" + } + } + + Rectangle { + id: sec_bottom + color: widget.settings.styles["Sec Settings"]["Panel BG Color"] + width: 100*multi + height: 30*multi + anchors.top: sec_top.bottom + anchors.topMargin: multi + anchors.left: parent.left + anchors.leftMargin: 0 + + Text { + text: "SECONDS" + + 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 + font.family: "Microsoft YaHei" + font.letterSpacing: 2*multi + } + } + } + } + + OpacityMask { + width: main.width + height: main.height + anchors.top: main.bottom + anchors.topMargin: multi + + source: main + maskSource: Rectangle { + width: main.width + height: main.height + gradient: Gradient{ + GradientStop{position: 0.0;color:"transparent"} + GradientStop{position: 1.0;color:"#FFF"} + } + } + transform: Scale {yScale: -1} + } + + Timer { + interval: 250 + repeat: true + running: widget.NVG.View.exposed + onTriggered: { + var now = new Date(), + sec = now.getSeconds(), + min = now.getMinutes(), + hr = now.getHours(); + if(!full_clock) { + am_pm = "|" + (hr > 11 ? "PM" : "AM"); + if (hr === 0 || hr === 24) + hr = 12; + else if(hr > 12) + hr -= 12; + } else { + am_pm = ""; + } + + hour_text.text = hr < 10 ? "0"+hr : hr; + min_text.text = min < 10 ? "0"+min : min; + sec_text.text = sec < 10 ? "0"+sec : sec; + } + } + + menu: Menu { + Action { + text: qsTr("Settings") + "..." + onTriggered: styleDialog.active = true + } + } + + Loader { + id: styleDialog + active: false + sourceComponent: NVG.Window { + id: window + title: qsTr("Clock Settings") + visible: true + minimumWidth: 380 + minimumHeight: 480 + width: minimumWidth + height: minimumHeight + + transientParent: widget.NVG.View.window + + property var configuration + + Page { + id: cfg_page + anchors.fill: parent + + header: TitleBar { + text: qsTr("Settings") + + 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: 0 + + 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: "Hour Settings" + label: qsTr("Hour Settings") + live: true + icon.name: "regular:\uf1de" + + P.SwitchPreference { + name: "Full Clock" + label: qsTr("24 Hour Clock") + defaultValue: defaultValues["Hour Settings"]["Full Clock"] + } + + P.Separator {} + + P.ColorPreference { + name: "Clock BG Color" + label: qsTr("Clock Background Color") + defaultValue: defaultValues["Hour Settings"]["Clock BG Color"] + } + + P.ColorPreference { + name: "Clock Font Color" + label: qsTr("Clock Font Color") + defaultValue: defaultValues["Hour Settings"]["Clock Font Color"] + } + + P.Separator {} + + P.ColorPreference { + name: "Panel BG Color" + label: qsTr("Panel Background Color") + defaultValue: defaultValues["Hour Settings"]["Panel BG Color"] + } + + P.ColorPreference { + name: "Panel Font Color" + label: qsTr("Panel Font Color") + defaultValue: defaultValues["Hour Settings"]["Panel Font Color"] + } + } + + P.Separator {} + + P.DialogPreference { + name: "Min Settings" + label: qsTr("Minute Settings") + live: true + icon.name: "regular:\uf1de" + + P.ColorPreference { + name: "Clock BG Color" + label: qsTr("Clock Background Color") + defaultValue: defaultValues["Min Settings"]["Clock BG Color"] + } + + P.ColorPreference { + name: "Clock Font Color" + label: qsTr("Clock Font Color") + defaultValue: defaultValues["Min Settings"]["Clock Font Color"] + } + + P.Separator {} + + P.ColorPreference { + name: "Panel BG Color" + label: qsTr("Panel Background Color") + defaultValue: defaultValues["Min Settings"]["Panel BG Color"] + } + + P.ColorPreference { + name: "Panel Font Color" + label: qsTr("Panel Font Color") + defaultValue: defaultValues["Min Settings"]["Panel Font Color"] + } + } + + 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: defaultValues["Sec Settings"]["Visible"] + } + + P.Separator {} + + P.ColorPreference { + name: "Clock BG Color" + label: qsTr("Clock Background Color") + enabled: cfg_sec_en.value + defaultValue: defaultValues["Sec Settings"]["Clock BG Color"] + } + + P.ColorPreference { + name: "Clock Font Color" + label: qsTr("Clock Font Color") + enabled: cfg_sec_en.value + defaultValue: defaultValues["Sec Settings"]["Clock Font Color"] + } + + P.Separator {} + + P.ColorPreference { + name: "Panel BG Color" + label: qsTr("Panel Background Color") + enabled: cfg_sec_en.value + defaultValue: defaultValues["Sec Settings"]["Panel BG Color"] + } + + P.ColorPreference { + name: "Panel Font Color" + label: qsTr("Panel Font Color") + enabled: cfg_sec_en.value + defaultValue: defaultValues["Sec Settings"]["Panel Font Color"] + } + } + + Component.onCompleted: { + rootPreference.load(widget.settings.styles); + configuration = widget.settings.styles; + } + } + } + } + } + } + + onClosing: { + widget.settings.styles = configuration; + styleDialog.active = false; + } + } + } +} diff --git a/qml/RoundClock.qml b/qml/RoundClock.qml new file mode 100644 index 0000000..f0f71f4 --- /dev/null +++ b/qml/RoundClock.qml @@ -0,0 +1,465 @@ +import QtQuick 2.12 + +import QtQuick.Controls 2.12 +import QtQuick.Layouts 1.12 + +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 + + + +WidgetTemplate { + id: widget + 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 + + onConfigsChanged: { + background.requestPaint(); + hour.requestPaint(); + min.requestPaint(); + sec.requestPaint(); + sec_tail.requestPaint(); + sec_center.requestPaint(); + } + + function colorToRGBA(color, alpha) { + var color1, color2, color3; + color = ""+color; + if (typeof color !== "string") return; + if (color.charAt(0) === "#") { + color = color.substring(1); + } + var not16num = color.split("").filter(function (item, index) { + return isNaN(parseInt(item, 16)) + }); + if(not16num.length) return; + switch (color.length) { + case 3: + color1 = color.substr(0,1); + color2 = color.substr(1,1); + color3 = color.substr(2,1); + color1 = color1 + color1; + color2 = color2 + color2; + color3 = color3 + color3; + break; + case 6: + color1 = color.substr(0,2); + color2 = color.substr(2,2); + color3 = color.substr(4,2); + break; + default: + return false; + } + color1 = parseInt(color1, 16); + color2 = parseInt(color2, 16); + color3 = parseInt(color3, 16); + return "rgba("+color1+","+color2+","+color3+","+alpha+")"; + } + + + Timer { + interval: configs["Sec Continue"] ? 50 : 250 + running: widget.NVG.View.exposed + repeat: true + onTriggered: { + var now = new Date(); + tsec = now.getSeconds() + (configs["Sec Continue"] ? now.getMilliseconds()/1000 : 0); + tmin = now.getMinutes(); + thour = now.getHours(); + thour = thour % 12; + } + } + + Canvas { + id: background + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + context.translate(width/2, height/2); //将坐标原点移到画布中心 + context.rotate(-Math.PI/2); //将坐标轴逆时针旋转90度,x轴正方向对准12点方向 + + context.fillStyle = colorToRGBA(configs["BG Color"], configs["BG Alpha"]/100); + context.beginPath(); + context.arc(0, 0, maxr, 0, Math.PI * 2, true); + context.fill(); + + context.strokeStyle = configs["HGRID Color"]; + context.lineWidth = maxr*0.04; + context.lineCap = "round"; + for (var i = 0; i < 12; i++) { + context.beginPath(); + context.rotate(Math.PI / 6); + context.moveTo(maxr*0.92, 0); + context.lineTo(maxr*0.78, 0); + context.stroke(); + } + + context.strokeStyle = configs["MGRID Color"]; + context.lineWidth = maxr*0.015; + for (i = 0; i < 60; i++) { + if (i % 5 !== 0) { //去掉与小时刻度重叠的部分 + context.beginPath(); + context.moveTo(maxr*0.92, 0); + context.lineTo(maxr*0.86, 0); + context.stroke(); + } + context.rotate(Math.PI / 30); + } + } + } + + Canvas { + id: hour + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + + rotation: thour*30+tmin*0.5+tsec*0.01 + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + context.translate(width/2, height/2); + context.shadowColor = 'rgba(0,0,0,.5)'; + context.shadowBlur = maxr*0.03; + context.lineCap = "round"; + context.strokeStyle = configs["Hhand Color"]; + + context.lineWidth = maxr*0.08; + context.beginPath(); + context.moveTo(0,0); + context.lineTo(0, -maxr*0.56); + context.stroke(); + } + } + + Canvas { + id: min + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + + rotation: tmin*6+tsec*0.1 + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + context.translate(width/2, height/2); + context.shadowColor = 'rgba(0,0,0,.5)'; + context.shadowBlur = maxr*0.04; + context.lineCap = "round"; + context.strokeStyle = configs["Mhand Color"]; + + context.lineWidth = maxr*0.045; + context.beginPath(); + context.moveTo(0,0); + context.lineTo(0, -maxr*0.82); + context.stroke(); + } + } + + Canvas { + id: sec + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + rotation: widget.tsec*6 + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + context.translate(width/2, height/2); + context.shadowColor = 'rgba(0,0,0,.5)'; + context.shadowBlur = maxr*0.05; + context.lineCap = "round"; + context.strokeStyle = configs["Shand Color"]; + + context.lineWidth = maxr*0.016; + context.beginPath(); + context.moveTo(0,0); + context.lineTo(0, -maxr*0.9); + context.stroke(); + } + } + + + Canvas { + id: sec_tail + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + rotation: widget.tsec*6 + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + context.translate(width/2, height/2); + context.shadowColor = 'rgba(0,0,0,.5)'; + context.shadowBlur = maxr*0.05; + + context.lineCap = "round"; + context.strokeStyle = configs["Shand Color"]; + context.beginPath(); + context.moveTo(0,0); + context.lineTo(0, maxr*0.07); + context.lineWidth = maxr*0.07; + context.stroke(); + } + } + + Canvas { + id: sec_center + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + context.translate(width/2, height/2); + context.shadowColor = 'rgba(0,0,0,.5)'; + context.shadowBlur = maxr*0.1; + context.shadowOffsetX = maxr*0.05/2.5; + context.shadowOffsetY = maxr*0.05/2.5; + + context.beginPath(); + context.arc(0, 0, maxr*0.07, 0, Math.PI * 2, true); + context.fillStyle = configs["Shand Color"]; + context.fill(); + } + } + + menu: Menu { + Action { + text: qsTr("Settings") + "..." + onTriggered: styleDialog.active = true + } + } + + Loader { + id: styleDialog + active: false + sourceComponent: NVG.Window { + id: window + title: qsTr("Clock Settings") + visible: true + minimumWidth: 380 + minimumHeight: 540 + width: minimumWidth + height: minimumHeight + + transientParent: widget.NVG.View.window + + property var configuration + + Page { + id: cfg_page + anchors.fill: parent + + header: TitleBar { + text: qsTr("Round 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: 0 + + 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.SwitchPreference { + name: "Sec Continue" + label: qsTr("Continuous Second Hand") + defaultValue: defaultValues["Sec Continue"] + } + + P.Separator {} + + P.ColorPreference { + name: "BG Color" + label: qsTr("Background Color") + defaultValue: defaultValues["BG Color"] + } + + P.SliderPreference { + name: "BG Alpha" + label: qsTr("Background transparency") + from: 0 + to: 100 + stepSize: 1 + defaultValue: defaultValues["BG Alpha"] + displayValue: value + "%" + } + + P.Separator {} + + P.ColorPreference { + name: "HGRID Color" + label: qsTr("Hour Scale Color") + defaultValue: defaultValues["HGRID Color"] + } + + P.ColorPreference { + name: "MGRID Color" + label: qsTr("Minute Scale Color") + defaultValue: defaultValues["MGRID Color"] + } + + P.Separator {} + + P.ColorPreference { + name: "Hhand Color" + label: qsTr("Hour Hand Color") + defaultValue: defaultValues["Hhand Color"] + } + + P.ColorPreference { + name: "Mhand Color" + label: qsTr("Minute Hand Color") + defaultValue: defaultValues["Mhand Color"] + } + + P.ColorPreference { + name: "Shand Color" + label: qsTr("Second Hand Color") + defaultValue: defaultValues["Shand Color"] + } + + Component.onCompleted: { + rootPreference.load(widget.settings.styles); + configuration = widget.settings.styles; + } + } + } + } + } + } + + onClosing: { + widget.settings.styles = configuration; + styleDialog.active = false; + } + } + } +} diff --git a/qml/SolarsClock.qml b/qml/SolarsClock.qml new file mode 100644 index 0000000..7478a2c --- /dev/null +++ b/qml/SolarsClock.qml @@ -0,0 +1,731 @@ +import QtQuick 2.12 + +import QtQuick.Controls 2.12 +import QtQuick.Layouts 1.12 + +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 + + + +WidgetTemplate { + id: widget + 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 + readonly property real rsec: maxr*0.5 + property real thour: 0 + property real tmin: 0 + property real tsec: 0 + property real tmsec: 0 + + property var configs: widget.settings.styles + + onConfigsChanged: { + background.requestPaint(); + hour.requestPaint(); + min.requestPaint(); + sec.requestPaint(); + millisec_orbit.requestPaint(); + millisec_star.requestPaint(); + center.requestPaint(); + } + + function colorToRGBA(color, alpha) { + var color1, color2, color3; + color = ""+color; + if (typeof color !== "string") return; + if (color.charAt(0) === "#") { + color = color.substring(1); + } + var not16num = color.split("").filter(function (item, index) { + return isNaN(parseInt(item, 16)) + }); + if(not16num.length) return; + switch (color.length) { + case 3: + color1 = color.substr(0,1); + color2 = color.substr(1,1); + color3 = color.substr(2,1); + color1 = color1 + color1; + color2 = color2 + color2; + color3 = color3 + color3; + break; + case 6: + color1 = color.substr(0,2); + color2 = color.substr(2,2); + color3 = color.substr(4,2); + break; + default: + return false; + } + color1 = parseInt(color1, 16); + color2 = parseInt(color2, 16); + color3 = parseInt(color3, 16); + return "rgba("+color1+","+color2+","+color3+","+alpha+")"; + } + + + Timer { + interval: 50 + running: widget.NVG.View.exposed + repeat: true + onTriggered: { + var now = new Date(); + tmsec = now.getMilliseconds(); + tsec = now.getSeconds(); + tmin = now.getMinutes(); + thour = now.getHours(); + main_time.text = (thour<10 ? "0"+thour : thour) + ":" + (tmin<10 ? "0"+tmin : tmin) + ":" + (tsec<10 ? "0"+tsec : tsec); + thour = thour > 12 ? thour - 12 : thour; + tsec += tmsec/1000; + } + } + + Canvas { + id: background + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + context.translate(width/2, height/2); //将坐标原点移到画布中心 + context.rotate(-Math.PI/2); //将坐标轴逆时针旋转90度,x轴正方向对准12点方向 + + context.fillStyle = colorToRGBA(configs["BG Settings"]["BG Color"], configs["BG Settings"]["BG Alpha"]/100); + context.beginPath(); + context.arc(0, 0, maxr, 0, Math.PI * 2, true); + context.fill(); + + if (configs["Hour Settings"]["Show Orbit"]) { + context.strokeStyle = configs["Hour Settings"]["Horbit Color"]; + context.lineWidth = maxr*0.01; + context.beginPath(); + context.arc(0, 0, rhour, 0, Math.PI * 2, true); + context.stroke(); + } + + if (configs["Min Settings"]["Show Orbit"]) { + context.strokeStyle = configs["Min Settings"]["Morbit Color"]; + context.lineWidth = maxr*0.01; + context.beginPath(); + context.arc(0, 0, rmin, 0, Math.PI * 2, true); + context.stroke(); + } + + if (configs["Sec Settings"]["Show Orbit"]) { + context.strokeStyle = configs["Sec Settings"]["Sorbit Color"]; + context.lineWidth = maxr*0.01; + context.beginPath(); + context.arc(0, 0, rsec, 0, Math.PI * 2, true); + context.stroke(); + } + + if (configs["BG Settings"]["Show HGrid"]) { + context.strokeStyle = configs["BG Settings"]["HGRID Color"]; + context.lineWidth = maxr*0.016; + context.lineCap = "round"; + for (var i = 0; i < 12; i++) { + context.beginPath(); + if (!(i%3)) { + context.moveTo(rmin+maxr*0.07, 0); + } else { + context.moveTo(rmin+maxr*0.035, 0); + } + context.lineTo(rmin, 0); + context.stroke(); + context.rotate(Math.PI / 6); + } + } + } + } + + Canvas { + id: hour + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + + rotation: thour*30+tmin*0.5+tsec*0.6/60 + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + context.translate(width/2, height/2); + context.shadowColor = 'rgba(0,0,0,.5)'; + context.shadowBlur = maxr*0.03; + context.lineCap = "round"; + context.fillStyle = configs["Hour Settings"]["Hstar Color"]; + + context.beginPath(); + context.arc(0, -rhour, maxr*0.075, 0, Math.PI * 2, true); + context.fill(); + } + } + + Canvas { + id: min + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + + rotation: tmin*6+tsec*0.1 + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + context.translate(width/2, height/2); + context.shadowColor = 'rgba(0,0,0,.5)'; + context.shadowBlur = maxr*0.04; + context.lineCap = "round"; + context.fillStyle = configs["Min Settings"]["Mstar Color"]; + context.beginPath(); + context.arc(0, -rmin, maxr*0.06, 0, Math.PI * 2, true); + context.fill(); + } + } + + Canvas { + id: sec + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + rotation: widget.tsec*6 + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + context.translate(width/2, height/2); + context.shadowColor = 'rgba(0,0,0,.5)'; + context.shadowBlur = maxr*0.04; + context.lineCap = "round"; + context.fillStyle = configs["Sec Settings"]["Sstar Color"]; + context.beginPath(); + context.arc(0, -rsec, maxr*0.045, 0, Math.PI * 2, true); + context.fill(); + } + } + + Canvas { + id: millisec_orbit + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + rotation: widget.tsec*6 + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + if (configs["MSec Settings"]["Show Orbit"]) { + context.translate(width/2, height/2); + context.strokeStyle = configs["MSec Settings"]["MSorbit Color"]; + context.lineWidth = maxr*0.005; + context.beginPath(); + context.arc(0, -rsec, maxr*0.1, 0, Math.PI * 2, true); + context.stroke(); + } + } + + Canvas { + id: millisec_star + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + transform: Rotation { + //设置图像原点 + origin.x: width/2 + origin.y: height/2-rsec + axis{ + x: 0 + y: 0 + z: 1 + } + angle: tmsec*0.360 + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + context.translate(width/2, height/2); + context.shadowColor = 'rgba(0,0,0,.5)'; + context.shadowBlur = maxr*0.05; + context.lineCap = "round"; + context.fillStyle = configs["MSec Settings"]["MSstar Color"]; + context.beginPath(); + context.arc(0, -rsec-maxr*0.1, maxr*0.025, 0, Math.PI * 2, true); + context.fill(); + } + } + } + + Canvas { + id: center + width: widget.width; + height: widget.height; + contextType: "2d"; + renderTarget: Canvas.FramebufferObject + renderStrategy: Canvas.Cooperative + + visible: configs["BG Settings"]["Show Center"] + + onWidthChanged: { + requestPaint(); + } + + onHeightChanged: { + requestPaint(); + } + + onPaint: { + context.resetTransform(); + context.clearRect(0,0,widget.width,widget.height); + context.translate(width/2, height/2); + context.shadowColor = colorToRGBA(configs["BG Settings"]["Center Color"], 0.5); + context.shadowBlur = maxr*0.1; + context.shadowOffsetX = maxr*0.05/2.5; + context.shadowOffsetY = maxr*0.05/2.5; + + context.beginPath(); + context.arc(0, 0, maxr*0.003*configs["BG Settings"]["Center Radius"], 0, Math.PI * 2, true); + context.fillStyle = configs["BG Settings"]["Center Color"]; + context.fill(); + } + } + + menu: Menu { + Action { + text: qsTr("Settings") + "..." + onTriggered: styleDialog.active = true + } + } + + Loader { + id: styleDialog + active: false + sourceComponent: NVG.Window { + id: window + title: qsTr("Clock Settings") + visible: true + minimumWidth: 400 + minimumHeight: 660 + width: minimumWidth + height: minimumHeight + + transientParent: widget.NVG.View.window + + property var configuration + + Page { + id: cfg_page + anchors.fill: parent + + header: TitleBar { + text: qsTr("Solar 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: 0 + + 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: defaultValues["BG Settings"]["BG Color"] + } + + P.SliderPreference { + name: "BG Alpha" + label: qsTr("Transparency") + from: 0 + to: 100 + stepSize: 1 + defaultValue: defaultValues["BG Settings"]["BG Alpha"] + displayValue: value + "%" + } + + P.Separator {} + + P.SwitchPreference { + id: show_hgrid + name: "Show HGrid" + label: qsTr("Show Scale") + defaultValue: defaultValues["BG Settings"]["Show HGrid"] + } + + P.ColorPreference { + name: "HGRID Color" + label: qsTr("Scale Color") + enabled: show_hgrid.value + defaultValue: defaultValues["BG Settings"]["HGRID Color"] + } + + P.Separator {} + + P.SwitchPreference { + id: showCenter + name: "Show Center" + label: qsTr("Show Center") + defaultValue: defaultValues["BG Settings"]["Show Center"] + } + + P.ColorPreference { + name: "Center Color" + label: qsTr("Center Color") + enabled: showCenter.value + defaultValue: defaultValues["BG Settings"]["Center Color"] + } + + P.SliderPreference { + name: "Center Radius" + label: qsTr("Center Radius") + enabled: showCenter.value + from: 30 + to: 100 + stepSize: 1 + defaultValue: defaultValues["BG Settings"]["Center Radius"] + displayValue: value + "%" + } + + P.Separator {} + + P.SwitchPreference { + id: showClock + name: "Show Clock" + label: qsTr("Display Time") + defaultValue: defaultValues["BG Settings"]["Show Clock"] + } + + P.ColorPreference { + name: "Clock Color" + label: qsTr("Font Color") + enabled: showClock.value + 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 { + name: "Font Size" + label: qsTr("Font Size") + enabled: showClock.value + from: 50 + to: 100 + stepSize: 1 + defaultValue: defaultValues["BG Settings"]["Font Size"] + displayValue: value + "%" + } + } + + P.Separator {} + + P.DialogPreference { + name: "Hour Settings" + label: qsTr("Hour Settings") + live: true + icon.name: "regular:\uf1de" + + P.ColorPreference { + name: "Hstar Color" + label: qsTr("Star Color") + defaultValue: defaultValues["Hour Settings"]["Hstar Color"] + } + + P.Separator {} + + P.SwitchPreference { + id: hour_settings_show_orbit + name: "Show Orbit" + label: qsTr("Show Orbit") + defaultValue: defaultValues["Hour Settings"]["Show Orbit"] + } + + P.ColorPreference { + name: "Horbit Color" + label: qsTr("Orbit Color") + enabled: hour_settings_show_orbit.value + defaultValue: defaultValues["Hour Settings"]["Horbit Color"] + } + } + + P.DialogPreference { + name: "Min Settings" + label: qsTr("Minute Settings") + live: true + icon.name: "regular:\uf1de" + + P.ColorPreference { + name: "Mstar Color" + label: qsTr("Star Color") + defaultValue: defaultValues["Min Settings"]["Mstar Color"] + } + + P.Separator {} + + P.SwitchPreference { + id: min_settings_show_orbit + name: "Show Orbit" + label: qsTr("Show Orbit") + defaultValue: defaultValues["Min Settings"]["Show Orbit"] + } + + P.ColorPreference { + name: "Morbit Color" + label: qsTr("Orbit Color") + enabled: min_settings_show_orbit.value + defaultValue: defaultValues["Min Settings"]["Morbit Color"] + } + } + + P.DialogPreference { + name: "Sec Settings" + label: qsTr("Second Settings") + live: true + icon.name: "regular:\uf1de" + + P.ColorPreference { + name: "Sstar Color" + label: qsTr("Star Color") + defaultValue: defaultValues["Sec Settings"]["Sstar Color"] + } + + P.Separator {} + + P.SwitchPreference { + id: sec_settings_show_orbit + name: "Show Orbit" + label: qsTr("Show Orbit") + defaultValue: defaultValues["Sec Settings"]["Show Orbit"] + } + + P.ColorPreference { + name: "Sorbit Color" + label: qsTr("Orbit Color") + enabled: sec_settings_show_orbit.value + defaultValue: defaultValues["Sec Settings"]["Sorbit Color"] + } + } + + P.DialogPreference { + name: "MSec Settings" + label: qsTr("Millisecond Settings") + live: true + icon.name: "regular:\uf1de" + + P.ColorPreference { + name: "MSstar Color" + label: qsTr("Star Color") + defaultValue: defaultValues["MSec Settings"]["MSstar Color"] + } + + P.Separator {} + + P.SwitchPreference { + id: msec_settings_show_orbit + name: "Show Orbit" + label: qsTr("Show Orbit") + defaultValue: defaultValues["MSec Settings"]["Show Orbit"] + } + + P.ColorPreference { + name: "MSorbit Color" + label: qsTr("Orbit Color") + enabled: msec_settings_show_orbit.value + defaultValue: defaultValues["MSec Settings"]["MSorbit Color"] + } + } + + Component.onCompleted: { + rootPreference.load(widget.settings.styles); + configuration = widget.settings.styles; + } + } + } + } + } + } + + onClosing: { + widget.settings.styles = configuration; + styleDialog.active = false; + } + } + } + + 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: Common.fontweight[configs["BG Settings"]["Font Weight"]] + font.family: Common.fonts[configs["BG Settings"]["Font Name"]]//"Microsoft YaHei" + } +} diff --git a/qml/TextClock.qml b/qml/TextClock.qml new file mode 100644 index 0000000..785386e --- /dev/null +++ b/qml/TextClock.qml @@ -0,0 +1,305 @@ +import QtQuick 2.12 + +import QtQuick.Controls 2.12 +import QtQuick.Layouts 1.12 + +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("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 + property string minutes: "" + property string seconds: "" + + readonly property string hlight_color: widget.settings.styles["HighLight Color"] + readonly property string normal_color: widget.settings.styles["Normal Color"] + readonly property string rfulltext: "ITAISSL" + ((day===5) ? "TGIF" : "GTFI") + "
" + + "FJLVZGABOUT
" + + "ACQUARTERBS
" + + "TWENTYFIVEX
" + + "HALFBTENFTO
" + + "PASTERUNINE
" + + "ONESIXTHREE
" + + "FOURFIVETWO
" + + "EIGHTELEVEN
" + + "SEVENTNOONE
" + + "TENSEOCLOCK
" + + "AMIDNIGHTVW
" + + + property var rcolors: [hlight_color, hlight_color, hlight_color, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''] + readonly property var rcindex: {"M15": 3, "M20": 4, "M5": 5, "M30": 6, "M10": 7, "TO": 8, "PAST": 9, + "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} + + function stringFormat(rtext, format) { + if (!rtext) + return null; + var str = rtext; + for (var i = 0; i < format.length; i++) + { + var re = new RegExp('\\{' + i + '\\}', 'gm'); + str = str.replace(re, format[i]); + } + return str; + } + + function clearHLColors() { + for(let i=3; i<24; i++) { + rcolors[i] = ""; + } + } + + function updateHLColors(){ + for(let i=0; i 12 && hours !== 23) { + hours = hours - 12; + } + + if (minutes < 10) { + minutes = 0 + minutes; + } + if (seconds < 10) { + seconds = 0 + seconds; + } + + var minsSecs = minutes + seconds; + if (minsSecs > 3230) { + hours++; + } + + clearHLColors(); + updateHLColors(hours); + + if ((minsSecs >= 5730 && minsSecs < 6000) || (minsSecs >= 0 && minsSecs < 230)) { + if (hours !== 24 && hours !== 0) { + updateHLColors("OCLOCK"); + } + } else if (minsSecs >= 230 && minsSecs < 730) { + updateHLColors("M5","PAST"); + } else if (minsSecs >= 730 && minsSecs < 1230) { + updateHLColors("M10", "PAST"); + } else if (minsSecs >= 1230 && minsSecs < 1730) { + updateHLColors("M15","PAST"); + } else if (minsSecs >= 1730 && minsSecs < 2230) { + updateHLColors("M20", "PAST"); + } else if (minsSecs >= 2230 && minsSecs < 2730) { + updateHLColors("M20", "M5", "PAST"); + } else if (minsSecs >= 2730 && minsSecs < 3230) { + updateHLColors("M30", "PAST"); + } else if (minsSecs >= 3230 && minsSecs < 3730) { + updateHLColors("M20", "M5", "TO"); + } else if (minsSecs >= 3730 && minsSecs < 4230) { + updateHLColors("M20", "TO"); + } else if (minsSecs >= 4230 && minsSecs < 4730) { + updateHLColors("M15", "TO"); + } else if (minsSecs >= 4730 && minsSecs < 5230) { + updateHLColors("M10", "TO"); + } else if (minsSecs >= 5230 && minsSecs < 5730) { + updateHLColors("M5", "TO"); + } + main.text = stringFormat(rfulltext, rcolors); + } + } + + menu: Menu { + Action { + text: qsTr("Settings") + "..." + onTriggered: styleDialog.active = true + } + } + + Loader { + id: styleDialog + active: false + sourceComponent: NVG.Window { + id: window + title: qsTr("Clock Settings") + visible: true + minimumWidth: 380 + minimumHeight: 580 + width: minimumWidth + height: minimumHeight + + transientParent: widget.NVG.View.window + + property var configuration + + Page { + id: cfg_page + anchors.fill: parent + + header: TitleBar { + text: qsTr("Text 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: 0 + + 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.SelectPreference { + name: "Font Name" + label: qsTr("Font Style") + icon.name: "solid:\uf1fc" + defaultValue: defaultValues["Font Name"] + model: Common.fonts + } + + P.SelectPreference { + name: "Font Weight" + label: qsTr("Font Weight") + icon.name: "solid:\uf1fc" + defaultValue: defaultValues["Font Weight"] + model: Common.sfontweight + } + + P.ColorPreference { + name: "HighLight Color" + label: qsTr("HighLight Color") + defaultValue: defaultValues["HighLight Color"] + } + + P.ColorPreference { + name: "Normal Color" + label: qsTr("Normal Color") + defaultValue: defaultValues["Normal Color"] + } + + P.SliderPreference { + name: "Font Size" + label: qsTr("Font Size") + from: 1 + to: 40 + stepSize: 1 + defaultValue: defaultValues["Font Size"] + displayValue: value + } + + P.SliderPreference { + name: "Letter Space" + label: qsTr("Letter Space") + from: 1 + to: 40 + stepSize: 1 + defaultValue: defaultValues["Letter Space"] + displayValue: value + } + + P.SliderPreference { + name: "Line Height" + label: qsTr("Line Spacing") + from: 0.8 + to: 2 + stepSize: 0.1 + defaultValue: defaultValues["Line Height"] + displayValue: value.toFixed(1) + } + + Component.onCompleted: { + rootPreference.load(widget.settings.styles); + configuration = widget.settings.styles; + } + } + } + } + } + } + + onClosing: { + widget.settings.styles = configuration; + styleDialog.active = false; + } + } + } +} diff --git a/qml/VectoClock.qml b/qml/VectoClock.qml new file mode 100644 index 0000000..7113d73 --- /dev/null +++ b/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; + } + } + } +} diff --git a/qml/WidgetTemplate.qml b/qml/WidgetTemplate.qml new file mode 100644 index 0000000..8fb82a0 --- /dev/null +++ b/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(); + } +} diff --git a/qml/qmldir b/qml/qmldir new file mode 100644 index 0000000..f7640a6 --- /dev/null +++ b/qml/qmldir @@ -0,0 +1 @@ +singleton Common 1.0 Common.qml \ No newline at end of file diff --git a/reflection_clock.qml b/reflection_clock.qml deleted file mode 100644 index eac7042..0000000 --- a/reflection_clock.qml +++ /dev/null @@ -1,459 +0,0 @@ -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 - - - -T.Widget { - id: widget - solid: true - title: qsTr("Reflection Clock") - resizable: true - - 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 - property string am_pm: "" - - Rectangle { - id: main - color: "transparent" - anchors.top: parent.top - anchors.topMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - width: 345*multi - height: 222*multi - - Rectangle { - id: hour - color: "transparent" - anchors.top: parent.top - anchors.topMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 15*multi - width: 100*multi - height: 111*multi - - Rectangle { - id: hour_top - color: widget.settings.styles ? widget.settings.styles["Hour Settings"]["Clock BG Color"] : "#2196f3" - width: 100*multi - height: 80*multi - anchors.top: parent.top - anchors.topMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - - Text { - id: hour_text - text: "" - color: widget.settings.styles ? widget.settings.styles["Hour Settings"]["Clock Font Color"] : "#ffffff" - anchors.centerIn: parent - font.pointSize: 35*multi - font.weight: Font.Light - font.family: "Microsoft YaHei" - } - } - - Rectangle { - id: hour_bottom - color: widget.settings.styles ? widget.settings.styles["Hour Settings"]["Panel BG Color"] : "#2196f3" - width: 100*multi - height: 30*multi - anchors.top: hour_top.bottom - anchors.topMargin: multi - anchors.left: parent.left - anchors.leftMargin: 0 - - Text { - text: "HOURS"+am_pm - color: widget.settings.styles ? widget.settings.styles["Hour Settings"]["Panel Font Color"] : "#ffffff" - anchors.centerIn: parent - font.pointSize: 9*multi - font.weight: Font.Normal - font.family: "Microsoft YaHei" - font.letterSpacing: 2*multi - } - } - } - - - Rectangle { - id: min - color: "transparent" - anchors.top: parent.top - anchors.topMargin: 0 - anchors.left: hour.right - anchors.leftMargin: 15*multi - width: 100*multi - height: 111*multi - - Rectangle { - id: min_top - color: widget.settings.styles ? widget.settings.styles["Min Settings"]["Clock BG Color"] : "#2196f3" - anchors.top: parent.top - anchors.topMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - width: 100*multi - height: 80*multi - - Text { - id: min_text - text: "" - color: widget.settings.styles ? widget.settings.styles["Min Settings"]["Clock Font Color"] : "#ffffff" - anchors.centerIn: parent - font.pointSize: 35*multi - font.weight: Font.Light - font.family: "Microsoft YaHei" - } - } - - Rectangle { - id: min_bottom - color: widget.settings.styles ? widget.settings.styles["Min Settings"]["Panel BG Color"] : "#2196f3" - width: 100*multi - height: 30*multi - anchors.top: min_top.bottom - anchors.topMargin: multi - anchors.left: parent.left - anchors.leftMargin: 0 - - Text { - text: "MINUTES" - color: widget.settings.styles ? widget.settings.styles["Min Settings"]["Panel Font Color"] : "#ffffff" - anchors.centerIn: parent - font.pointSize: 9*multi - font.weight: Font.Normal - font.family: "Microsoft YaHei" - font.letterSpacing: 2*multi - } - } - } - - - Rectangle { - id: sec - color: "transparent" - anchors.top: parent.top - anchors.topMargin: 0 - anchors.left: min.right - anchors.leftMargin: 15*multi - visible: widget.settings.styles ? widget.settings.styles["Sec Settings"]["Visible"] : true - width: 100*multi - height: 111*multi - - Rectangle { - id: sec_top - color: widget.settings.styles ? widget.settings.styles["Sec Settings"]["Clock BG Color"] : "#ff006a" - width: 100*multi - height: 80*multi - anchors.top: parent.top - anchors.topMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - - Text { - id: sec_text - text: "" - color: widget.settings.styles ? widget.settings.styles["Sec Settings"]["Clock Font Color"] : "#ffffff" - anchors.centerIn: parent - font.pointSize: 35*multi - font.weight: Font.Light - font.family: "Microsoft YaHei" - } - } - - Rectangle { - id: sec_bottom - color: widget.settings.styles ? widget.settings.styles["Sec Settings"]["Panel BG Color"] : "#ff006a" - width: 100*multi - height: 30*multi - anchors.top: sec_top.bottom - anchors.topMargin: multi - anchors.left: parent.left - anchors.leftMargin: 0 - - Text { - text: "SECONDS" - color: widget.settings.styles ? widget.settings.styles["Sec Settings"]["Panel Font Color"] : "#ffffff" - anchors.centerIn: parent - font.pointSize: 9*multi - font.weight: Font.Normal - font.family: "Microsoft YaHei" - font.letterSpacing: 2*multi - } - } - } - } - - OpacityMask { - width: main.width - height: main.height - anchors.top: main.bottom - anchors.topMargin: multi - - source: main - maskSource: Rectangle { - width: main.width - height: main.height - gradient: Gradient{ - GradientStop{position: 0.0;color:"transparent"} - GradientStop{position: 1.0;color:"#FFF"} - } - } - transform: Scale {yScale: -1} - } - - Timer { - interval: 250 - repeat: true - running: widget.NVG.View.exposed - onTriggered: { - var now = new Date(), - sec = now.getSeconds(), - min = now.getMinutes(), - hr = now.getHours(); - if(!full_clock) { - am_pm = "|" + (hr > 11 ? "PM" : "AM"); - if (hr === 0 || hr === 24) - hr = 12; - else if(hr > 12) - hr -= 12; - } else { - am_pm = ""; - } - - hour_text.text = hr < 10 ? "0"+hr : hr; - min_text.text = min < 10 ? "0"+min : min; - sec_text.text = sec < 10 ? "0"+sec : sec; - } - } - - menu: Menu { - Action { - text: qsTr("Settings") + "..." - onTriggered: styleDialog.active = true - } - } - - Loader { - id: styleDialog - active: false - sourceComponent: NVG.Window { - id: window - title: qsTr("Clock Settings") - visible: true - minimumWidth: 380 - minimumHeight: 480 - width: minimumWidth - height: minimumHeight - - transientParent: widget.NVG.View.window - - property var configuration - - Page { - id: cfg_page - anchors.fill: parent - - header: TitleBar { - text: qsTr("Settings") - - 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: 0 - - 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: "Hour Settings" - label: qsTr("Hour Settings") - 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.DialogPreference { - name: "Min Settings" - label: qsTr("Minute Settings") - live: true - icon.name: "regular:\uf1de" - - 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.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: { - if(!widget.settings.styles) { - configuration = rootPreference.save(); - widget.settings.styles = configuration; - } - rootPreference.load(widget.settings.styles); - configuration = widget.settings.styles; - } - } - } - } - } - } - - onClosing: { - widget.settings.styles = configuration; - styleDialog.active = false; - } - } - } -} diff --git a/round_clock.qml b/round_clock.qml deleted file mode 100644 index 2ced197..0000000 --- a/round_clock.qml +++ /dev/null @@ -1,457 +0,0 @@ -import QtQuick 2.12 - -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.12 - -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 - - - -T.Widget { - id: widget - solid: true - title: qsTr("Round Clock") - resizable: true - - 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"} - - onConfigsChanged: { - background.requestPaint(); - hour.requestPaint(); - min.requestPaint(); - sec.requestPaint(); - sec_tail.requestPaint(); - sec_center.requestPaint(); - } - - function colorToRGBA(color, alpha) { - var color1, color2, color3; - color = ""+color; - if (typeof color !== "string") return; - if (color.charAt(0) === "#") { - color = color.substring(1); - } - var not16num = color.split("").filter(function (item, index) { - return isNaN(parseInt(item, 16)) - }); - if(not16num.length) return; - switch (color.length) { - case 3: - color1 = color.substr(0,1); - color2 = color.substr(1,1); - color3 = color.substr(2,1); - color1 = color1 + color1; - color2 = color2 + color2; - color3 = color3 + color3; - break; - case 6: - color1 = color.substr(0,2); - color2 = color.substr(2,2); - color3 = color.substr(4,2); - break; - default: - return false; - } - color1 = parseInt(color1, 16); - color2 = parseInt(color2, 16); - color3 = parseInt(color3, 16); - return "rgba("+color1+","+color2+","+color3+","+alpha+")"; - } - - - Timer { - interval: configs["Sec Continue"] ? 50 : 250 - running: widget.NVG.View.exposed - repeat: true - onTriggered: { - var now = new Date(); - tsec = now.getSeconds() + (configs["Sec Continue"] ? now.getMilliseconds()/1000 : 0); - tmin = now.getMinutes(); - thour = now.getHours(); - thour = thour % 12; - } - } - - Canvas { - id: background - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - context.translate(width/2, height/2); //将坐标原点移到画布中心 - context.rotate(-Math.PI/2); //将坐标轴逆时针旋转90度,x轴正方向对准12点方向 - - context.fillStyle = colorToRGBA(configs["BG Color"], configs["BG Alpha"]/100); - context.beginPath(); - context.arc(0, 0, maxr, 0, Math.PI * 2, true); - context.fill(); - - context.strokeStyle = configs["HGRID Color"]; - context.lineWidth = maxr*0.04; - context.lineCap = "round"; - for (var i = 0; i < 12; i++) { - context.beginPath(); - context.rotate(Math.PI / 6); - context.moveTo(maxr*0.92, 0); - context.lineTo(maxr*0.78, 0); - context.stroke(); - } - - context.strokeStyle = configs["MGRID Color"]; - context.lineWidth = maxr*0.015; - for (i = 0; i < 60; i++) { - if (i % 5 !== 0) { //去掉与小时刻度重叠的部分 - context.beginPath(); - context.moveTo(maxr*0.92, 0); - context.lineTo(maxr*0.86, 0); - context.stroke(); - } - context.rotate(Math.PI / 30); - } - } - } - - Canvas { - id: hour - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - - rotation: thour*30+tmin*0.5+tsec*0.01 - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - context.translate(width/2, height/2); - context.shadowColor = 'rgba(0,0,0,.5)'; - context.shadowBlur = maxr*0.03; - context.lineCap = "round"; - context.strokeStyle = configs["Hhand Color"]; - - context.lineWidth = maxr*0.08; - context.beginPath(); - context.moveTo(0,0); - context.lineTo(0, -maxr*0.56); - context.stroke(); - } - } - - Canvas { - id: min - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - - rotation: tmin*6+tsec*0.1 - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - context.translate(width/2, height/2); - context.shadowColor = 'rgba(0,0,0,.5)'; - context.shadowBlur = maxr*0.04; - context.lineCap = "round"; - context.strokeStyle = configs["Mhand Color"]; - - context.lineWidth = maxr*0.045; - context.beginPath(); - context.moveTo(0,0); - context.lineTo(0, -maxr*0.82); - context.stroke(); - } - } - - Canvas { - id: sec - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - rotation: widget.tsec*6 - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - context.translate(width/2, height/2); - context.shadowColor = 'rgba(0,0,0,.5)'; - context.shadowBlur = maxr*0.05; - context.lineCap = "round"; - context.strokeStyle = configs["Shand Color"]; - - context.lineWidth = maxr*0.016; - context.beginPath(); - context.moveTo(0,0); - context.lineTo(0, -maxr*0.9); - context.stroke(); - } - } - - - Canvas { - id: sec_tail - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - rotation: widget.tsec*6 - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - context.translate(width/2, height/2); - context.shadowColor = 'rgba(0,0,0,.5)'; - context.shadowBlur = maxr*0.05; - - context.lineCap = "round"; - context.strokeStyle = configs["Shand Color"]; - context.beginPath(); - context.moveTo(0,0); - context.lineTo(0, maxr*0.07); - context.lineWidth = maxr*0.07; - context.stroke(); - } - } - - Canvas { - id: sec_center - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - context.translate(width/2, height/2); - context.shadowColor = 'rgba(0,0,0,.5)'; - context.shadowBlur = maxr*0.1; - context.shadowOffsetX = maxr*0.05/2.5; - context.shadowOffsetY = maxr*0.05/2.5; - - context.beginPath(); - context.arc(0, 0, maxr*0.07, 0, Math.PI * 2, true); - context.fillStyle = configs["Shand Color"]; - context.fill(); - } - } - - menu: Menu { - Action { - text: qsTr("Settings") + "..." - onTriggered: styleDialog.active = true - } - } - - Loader { - id: styleDialog - active: false - sourceComponent: NVG.Window { - id: window - title: qsTr("Clock Settings") - visible: true - minimumWidth: 380 - minimumHeight: 540 - width: minimumWidth - height: minimumHeight - - transientParent: widget.NVG.View.window - - property var configuration - - Page { - id: cfg_page - anchors.fill: parent - - header: TitleBar { - text: qsTr("Settings") - - 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: 0 - - 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.SwitchPreference { - name: "Sec Continue" - label: qsTr("Continuous Second Hand") - defaultValue: true - } - - P.Separator {} - - P.ColorPreference { - name: "BG Color" - label: qsTr("Background Color") - defaultValue: "#2196f3" - } - - P.SliderPreference { - name: "BG Alpha" - label: qsTr("Background transparency") - from: 0 - to: 100 - stepSize: 1 - defaultValue: 50 - displayValue: value + "%" - } - - P.Separator {} - - P.ColorPreference { - name: "HGRID Color" - label: qsTr("Hour Scale Color") - defaultValue: "#fff" - } - - P.ColorPreference { - name: "MGRID Color" - label: qsTr("Minute Scale Color") - defaultValue: "#fff" - } - - P.Separator {} - - P.ColorPreference { - name: "Hhand Color" - label: qsTr("Hour Hand Color") - defaultValue: "#fff" - } - - P.ColorPreference { - name: "Mhand Color" - label: qsTr("Minute Hand Color") - defaultValue: "#fff" - } - - P.ColorPreference { - name: "Shand Color" - label: qsTr("Second Hand Color") - defaultValue: "#F3A829" - } - - Component.onCompleted: { - if(!widget.settings.styles) { - configuration = rootPreference.save(); - widget.settings.styles = configuration; - } - rootPreference.load(widget.settings.styles); - configuration = widget.settings.styles; - } - } - } - } - } - } - - onClosing: { - widget.settings.styles = configuration; - styleDialog.active = false; - } - } - } -} diff --git a/solars_clock.qml b/solars_clock.qml deleted file mode 100644 index c3490a6..0000000 --- a/solars_clock.qml +++ /dev/null @@ -1,681 +0,0 @@ -import QtQuick 2.12 - -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.12 - -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 - - - -T.Widget { - id: widget - solid: true - title: qsTr("Solar Clock") - resizable: true - - editing: styleDialog.active - - property real maxr: Math.min(width/2, height/2) -10 - readonly property real rhour: maxr*0.9 - readonly property real rmin: maxr*0.72 - readonly property real rsec: maxr*0.5 - property real thour: 0 - property real tmin: 0 - 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"}} - - onConfigsChanged: { - background.requestPaint(); - hour.requestPaint(); - min.requestPaint(); - sec.requestPaint(); - millisec_orbit.requestPaint(); - millisec_star.requestPaint(); - center.requestPaint(); - } - - function colorToRGBA(color, alpha) { - var color1, color2, color3; - color = ""+color; - if (typeof color !== "string") return; - if (color.charAt(0) === "#") { - color = color.substring(1); - } - var not16num = color.split("").filter(function (item, index) { - return isNaN(parseInt(item, 16)) - }); - if(not16num.length) return; - switch (color.length) { - case 3: - color1 = color.substr(0,1); - color2 = color.substr(1,1); - color3 = color.substr(2,1); - color1 = color1 + color1; - color2 = color2 + color2; - color3 = color3 + color3; - break; - case 6: - color1 = color.substr(0,2); - color2 = color.substr(2,2); - color3 = color.substr(4,2); - break; - default: - return false; - } - color1 = parseInt(color1, 16); - color2 = parseInt(color2, 16); - color3 = parseInt(color3, 16); - return "rgba("+color1+","+color2+","+color3+","+alpha+")"; - } - - - Timer { - interval: 50 - running: widget.NVG.View.exposed - repeat: true - onTriggered: { - var now = new Date(); - tmsec = now.getMilliseconds(); - tsec = now.getSeconds(); - tmin = now.getMinutes(); - thour = now.getHours(); - main_time.text = (thour<10 ? "0"+thour : thour) + ":" + (tmin<10 ? "0"+tmin : tmin) + ":" + (tsec<10 ? "0"+tsec : tsec); - thour = thour > 12 ? thour - 12 : thour; - tsec += tmsec/1000; - } - } - - Canvas { - id: background - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - context.translate(width/2, height/2); //将坐标原点移到画布中心 - context.rotate(-Math.PI/2); //将坐标轴逆时针旋转90度,x轴正方向对准12点方向 - - context.fillStyle = colorToRGBA(configs["BG Settings"]["BG Color"], configs["BG Settings"]["BG Alpha"]/100); - context.beginPath(); - context.arc(0, 0, maxr, 0, Math.PI * 2, true); - context.fill(); - - if (configs["Hour Settings"]["Show Orbit"]) { - context.strokeStyle = configs["Hour Settings"]["Horbit Color"]; - context.lineWidth = maxr*0.01; - context.beginPath(); - context.arc(0, 0, rhour, 0, Math.PI * 2, true); - context.stroke(); - } - - if (configs["Min Settings"]["Show Orbit"]) { - context.strokeStyle = configs["Min Settings"]["Morbit Color"]; - context.lineWidth = maxr*0.01; - context.beginPath(); - context.arc(0, 0, rmin, 0, Math.PI * 2, true); - context.stroke(); - } - - if (configs["Sec Settings"]["Show Orbit"]) { - context.strokeStyle = configs["Sec Settings"]["Sorbit Color"]; - context.lineWidth = maxr*0.01; - context.beginPath(); - context.arc(0, 0, rsec, 0, Math.PI * 2, true); - context.stroke(); - } - - if (configs["BG Settings"]["Show HGrid"]) { - context.strokeStyle = configs["BG Settings"]["HGRID Color"]; - context.lineWidth = maxr*0.016; - context.lineCap = "round"; - for (var i = 0; i < 12; i++) { - context.beginPath(); - if (!(i%3)) { - context.moveTo(rmin+maxr*0.07, 0); - } else { - context.moveTo(rmin+maxr*0.035, 0); - } - context.lineTo(rmin, 0); - context.stroke(); - context.rotate(Math.PI / 6); - } - } - } - } - - Canvas { - id: hour - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - - rotation: thour*30+tmin*0.5+tsec*0.6/60 - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - context.translate(width/2, height/2); - context.shadowColor = 'rgba(0,0,0,.5)'; - context.shadowBlur = maxr*0.03; - context.lineCap = "round"; - context.fillStyle = configs["Hour Settings"]["Hstar Color"]; - - context.beginPath(); - context.arc(0, -rhour, maxr*0.075, 0, Math.PI * 2, true); - context.fill(); - } - } - - Canvas { - id: min - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - - rotation: tmin*6+tsec*0.1 - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - context.translate(width/2, height/2); - context.shadowColor = 'rgba(0,0,0,.5)'; - context.shadowBlur = maxr*0.04; - context.lineCap = "round"; - context.fillStyle = configs["Min Settings"]["Mstar Color"]; - context.beginPath(); - context.arc(0, -rmin, maxr*0.06, 0, Math.PI * 2, true); - context.fill(); - } - } - - Canvas { - id: sec - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - rotation: widget.tsec*6 - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - context.translate(width/2, height/2); - context.shadowColor = 'rgba(0,0,0,.5)'; - context.shadowBlur = maxr*0.04; - context.lineCap = "round"; - context.fillStyle = configs["Sec Settings"]["Sstar Color"]; - context.beginPath(); - context.arc(0, -rsec, maxr*0.045, 0, Math.PI * 2, true); - context.fill(); - } - } - - Canvas { - id: millisec_orbit - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - rotation: widget.tsec*6 - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - if (configs["MSec Settings"]["Show Orbit"]) { - context.translate(width/2, height/2); - context.strokeStyle = configs["MSec Settings"]["MSorbit Color"]; - context.lineWidth = maxr*0.005; - context.beginPath(); - context.arc(0, -rsec, maxr*0.1, 0, Math.PI * 2, true); - context.stroke(); - } - } - - Canvas { - id: millisec_star - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - transform: Rotation { - //设置图像原点 - origin.x: width/2 - origin.y: height/2-rsec - axis{ - x: 0 - y: 0 - z: 1 - } - angle: tmsec*0.360 - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - context.translate(width/2, height/2); - context.shadowColor = 'rgba(0,0,0,.5)'; - context.shadowBlur = maxr*0.05; - context.lineCap = "round"; - context.fillStyle = configs["MSec Settings"]["MSstar Color"]; - context.beginPath(); - context.arc(0, -rsec-maxr*0.1, maxr*0.025, 0, Math.PI * 2, true); - context.fill(); - } - } - } - - Canvas { - id: center - width: widget.width; - height: widget.height; - contextType: "2d"; - renderTarget: Canvas.FramebufferObject - renderStrategy: Canvas.Cooperative - - visible: configs["BG Settings"]["Show Center"] - - onWidthChanged: { - requestPaint(); - } - - onHeightChanged: { - requestPaint(); - } - - onPaint: { - context.resetTransform(); - context.clearRect(0,0,widget.width,widget.height); - context.translate(width/2, height/2); - context.shadowColor = colorToRGBA(configs["BG Settings"]["Center Color"], 0.5); - context.shadowBlur = maxr*0.1; - context.shadowOffsetX = maxr*0.05/2.5; - context.shadowOffsetY = maxr*0.05/2.5; - - context.beginPath(); - context.arc(0, 0, maxr*0.003*configs["BG Settings"]["Center Radius"], 0, Math.PI * 2, true); - context.fillStyle = configs["BG Settings"]["Center Color"]; - context.fill(); - } - } - - menu: Menu { - Action { - text: qsTr("Settings") + "..." - onTriggered: styleDialog.active = true - } - } - - Loader { - id: styleDialog - active: false - sourceComponent: NVG.Window { - id: window - title: qsTr("Clock Settings") - visible: true - minimumWidth: 400 - minimumHeight: 660 - width: minimumWidth - height: minimumHeight - - transientParent: widget.NVG.View.window - - property var configuration - - Page { - id: cfg_page - anchors.fill: parent - - header: TitleBar { - text: qsTr("Settings") - - 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: 0 - - 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 { - 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.DialogPreference { - name: "Hour Settings" - label: qsTr("Hour Settings") - live: 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.DialogPreference { - name: "Min Settings" - label: qsTr("Minute Settings") - live: true - 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 { - 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.DialogPreference { - name: "MSec Settings" - label: qsTr("Millisecond Settings") - live: true - icon.name: "regular:\uf1de" - - P.ColorPreference { - name: "MSstar Color" - label: qsTr("Star Color") - defaultValue: "#9e9e9e" - } - - P.Separator {} - - P.SwitchPreference { - id: msec_settings_show_orbit - name: "Show Orbit" - label: qsTr("Show Orbit") - defaultValue: true - } - - 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; - } - } - } - } - } - } - - onClosing: { - widget.settings.styles = configuration; - styleDialog.active = false; - } - } - } - - Text { - id: main_time - text: "" - 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" - } -} diff --git a/text_clock.qml b/text_clock.qml deleted file mode 100644 index 6fc46fa..0000000 --- a/text_clock.qml +++ /dev/null @@ -1,306 +0,0 @@ -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 - - - -T.Widget { - id: widget - solid: true - title: qsTr("Text Clock") - resizable: true - - property real day: 1 - property real hours: 0 - property string minutes: "" - property string seconds: "" - - readonly property string hlight_color: widget.settings.styles["HighLight Color"] - readonly property string normal_color: widget.settings.styles["Normal Color"] - readonly property string rfulltext: "ITAISSL" + ((day===5) ? "TGIF" : "GTFI") + "
" + - "FJLVZGABOUT
" + - "ACQUARTERBS
" + - "TWENTYFIVEX
" + - "HALFBTENFTO
" + - "PASTERUNINE
" + - "ONESIXTHREE
" + - "FOURFIVETWO
" + - "EIGHTELEVEN
" + - "SEVENTNOONE
" + - "TENSEOCLOCK
" + - "AMIDNIGHTVW
" - - - property var rcolors: [hlight_color, hlight_color, hlight_color, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''] - readonly property var rcindex: {"M15": 3, "M20": 4, "M5": 5, "M30": 6, "M10": 7, "TO": 8, "PAST": 9, - "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; - var str = rtext; - for (var i = 0; i < format.length; i++) - { - var re = new RegExp('\\{' + i + '\\}', 'gm'); - str = str.replace(re, format[i]); - } - return str; - } - - function clearHLColors() { - for(let i=3; i<24; i++) { - rcolors[i] = ""; - } - } - - function updateHLColors(){ - for(let i=0; i 12 && hours !== 23) { - hours = hours - 12; - } - - if (minutes < 10) { - minutes = 0 + minutes; - } - if (seconds < 10) { - seconds = 0 + seconds; - } - - var minsSecs = minutes + seconds; - if (minsSecs > 3230) { - hours++; - } - - clearHLColors(); - updateHLColors(hours); - - if ((minsSecs >= 5730 && minsSecs < 6000) || (minsSecs >= 0 && minsSecs < 230)) { - if (hours !== 24 && hours !== 0) { - updateHLColors("OCLOCK"); - } - } else if (minsSecs >= 230 && minsSecs < 730) { - updateHLColors("M5","PAST"); - } else if (minsSecs >= 730 && minsSecs < 1230) { - updateHLColors("M10", "PAST"); - } else if (minsSecs >= 1230 && minsSecs < 1730) { - updateHLColors("M15","PAST"); - } else if (minsSecs >= 1730 && minsSecs < 2230) { - updateHLColors("M20", "PAST"); - } else if (minsSecs >= 2230 && minsSecs < 2730) { - updateHLColors("M20", "M5", "PAST"); - } else if (minsSecs >= 2730 && minsSecs < 3230) { - updateHLColors("M30", "PAST"); - } else if (minsSecs >= 3230 && minsSecs < 3730) { - updateHLColors("M20", "M5", "TO"); - } else if (minsSecs >= 3730 && minsSecs < 4230) { - updateHLColors("M20", "TO"); - } else if (minsSecs >= 4230 && minsSecs < 4730) { - updateHLColors("M15", "TO"); - } else if (minsSecs >= 4730 && minsSecs < 5230) { - updateHLColors("M10", "TO"); - } else if (minsSecs >= 5230 && minsSecs < 5730) { - updateHLColors("M5", "TO"); - } - main.text = stringFormat(rfulltext, rcolors); - } - } - - menu: Menu { - Action { - text: qsTr("Settings") + "..." - onTriggered: styleDialog.active = true - } - } - - Loader { - id: styleDialog - active: false - sourceComponent: NVG.Window { - id: window - title: qsTr("Clock Settings") - visible: true - minimumWidth: 380 - minimumHeight: 580 - width: minimumWidth - height: minimumHeight - - transientParent: widget.NVG.View.window - - property var configuration - - Page { - id: cfg_page - anchors.fill: parent - - header: TitleBar { - text: qsTr("Settings") - - 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: 0 - - 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.SelectPreference { - name: "Font Name" - label: qsTr("Font Style") - icon.name: "solid:\uf1fc" - defaultValue: 408 - model: fonts - } - - P.SelectPreference { - name: "Font Weight" - label: qsTr("Font Weight") - icon.name: "solid:\uf1fc" - defaultValue: 0 - model: sfontweight - } - - P.ColorPreference { - name: "HighLight Color" - label: qsTr("HighLight Color") - defaultValue: "#FFF" - } - - P.ColorPreference { - name: "Normal Color" - label: qsTr("Normal Color") - defaultValue: "#333333" - } - - P.SliderPreference { - name: "Font Size" - label: qsTr("Font Size") - from: 1 - to: 40 - stepSize: 1 - defaultValue: 20 - displayValue: value - } - - P.SliderPreference { - name: "Letter Space" - label: qsTr("Letter Space") - from: 1 - to: 40 - stepSize: 1 - defaultValue: 20 - displayValue: value - } - - P.SliderPreference { - name: "Line Height" - label: qsTr("Line Spacing") - from: 0.8 - to: 2 - stepSize: 0.1 - defaultValue: 1.5 - 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; - } - } - } - } - } - } - - onClosing: { - widget.settings.styles = configuration; - styleDialog.active = false; - } - } - } - - 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}; - } - } -}