Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
mashiros | 6cf739c5eb | 2 years ago |
mashiros | 75d948494c | 2 years ago |
16 changed files with 3457 additions and 1932 deletions
Binary file not shown.
@ -0,0 +1,756 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!DOCTYPE TS> |
||||
<TS version="2.1" language="zh_CN"> |
||||
<context> |
||||
<name>Common</name> |
||||
<message> |
||||
<location filename="qml/Common.qml" line="8"/> |
||||
<source>Light</source> |
||||
<translation>细体</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/Common.qml" line="8"/> |
||||
<source>Normal</source> |
||||
<translation>普通</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/Common.qml" line="8"/> |
||||
<source>Bold</source> |
||||
<translation>加粗</translation> |
||||
</message> |
||||
</context> |
||||
<context> |
||||
<name>ReflectionClock</name> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="16"/> |
||||
<source>Reflection Clock</source> |
||||
<translation>倒影时钟</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="292"/> |
||||
<location filename="qml/ReflectionClock.qml" line="318"/> |
||||
<source>Settings</source> |
||||
<translation>设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="302"/> |
||||
<source>Clock Settings</source> |
||||
<translation>时钟设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="357"/> |
||||
<source>Configuration</source> |
||||
<translation>配置项</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="365"/> |
||||
<source>Hour Settings</source> |
||||
<translation>时设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="371"/> |
||||
<source>24 Hour Clock</source> |
||||
<translation>24时制</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="379"/> |
||||
<location filename="qml/ReflectionClock.qml" line="414"/> |
||||
<location filename="qml/ReflectionClock.qml" line="458"/> |
||||
<source>Clock Background Color</source> |
||||
<translation>时钟背景颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="385"/> |
||||
<location filename="qml/ReflectionClock.qml" line="420"/> |
||||
<location filename="qml/ReflectionClock.qml" line="465"/> |
||||
<source>Clock Font Color</source> |
||||
<translation>时钟字体颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="393"/> |
||||
<location filename="qml/ReflectionClock.qml" line="428"/> |
||||
<location filename="qml/ReflectionClock.qml" line="474"/> |
||||
<source>Panel Background Color</source> |
||||
<translation>面板背景颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="399"/> |
||||
<location filename="qml/ReflectionClock.qml" line="434"/> |
||||
<location filename="qml/ReflectionClock.qml" line="481"/> |
||||
<source>Panel Font Color</source> |
||||
<translation>面板字体颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="408"/> |
||||
<source>Minute Settings</source> |
||||
<translation>分设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="443"/> |
||||
<source>Second Settings</source> |
||||
<translation>秒设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/ReflectionClock.qml" line="450"/> |
||||
<source>Show</source> |
||||
<translation>显示</translation> |
||||
</message> |
||||
</context> |
||||
<context> |
||||
<name>RoundClock</name> |
||||
<message> |
||||
<location filename="qml/RoundClock.qml" line="15"/> |
||||
<location filename="qml/RoundClock.qml" line="346"/> |
||||
<source>Round Clock</source> |
||||
<translation>圆盘时钟</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/RoundClock.qml" line="320"/> |
||||
<source>Settings</source> |
||||
<translation>设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/RoundClock.qml" line="330"/> |
||||
<source>Clock Settings</source> |
||||
<translation>时钟设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/RoundClock.qml" line="385"/> |
||||
<source>Configuration</source> |
||||
<translation>配置项</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/RoundClock.qml" line="393"/> |
||||
<source>Continuous Second Hand</source> |
||||
<translation>秒针连续</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/RoundClock.qml" line="401"/> |
||||
<source>Background Color</source> |
||||
<translation>背景颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/RoundClock.qml" line="407"/> |
||||
<source>Background transparency</source> |
||||
<translation>背景透明度</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/RoundClock.qml" line="419"/> |
||||
<source>Hour Scale Color</source> |
||||
<translation>时刻度颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/RoundClock.qml" line="425"/> |
||||
<source>Minute Scale Color</source> |
||||
<translation>分刻度颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/RoundClock.qml" line="433"/> |
||||
<source>Hour Hand Color</source> |
||||
<translation>时针颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/RoundClock.qml" line="439"/> |
||||
<source>Minute Hand Color</source> |
||||
<translation>分针颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/RoundClock.qml" line="445"/> |
||||
<source>Second Hand Color</source> |
||||
<translation>秒针颜色</translation> |
||||
</message> |
||||
</context> |
||||
<context> |
||||
<name>SolarsClock</name> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="15"/> |
||||
<location filename="qml/SolarsClock.qml" line="430"/> |
||||
<source>Solar Clock</source> |
||||
<translation>太阳系时钟</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="404"/> |
||||
<source>Settings</source> |
||||
<translation>设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="414"/> |
||||
<source>Clock Settings</source> |
||||
<translation>时钟设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="469"/> |
||||
<source>Configuration</source> |
||||
<translation>配置项</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="477"/> |
||||
<source>Background Settings</source> |
||||
<translation>背景设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="483"/> |
||||
<source>Color</source> |
||||
<translation>颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="489"/> |
||||
<source>Transparency</source> |
||||
<translation>透明度</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="502"/> |
||||
<source>Show Scale</source> |
||||
<translation>显示刻度</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="508"/> |
||||
<source>Scale Color</source> |
||||
<translation>刻度颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="518"/> |
||||
<source>Show Center</source> |
||||
<translation>中心显示</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="524"/> |
||||
<source>Center Color</source> |
||||
<translation>中心颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="531"/> |
||||
<source>Center Radius</source> |
||||
<translation>中心半径</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="545"/> |
||||
<source>Display Time</source> |
||||
<translation>显示时间</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="551"/> |
||||
<source>Font Color</source> |
||||
<translation>字体颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="558"/> |
||||
<source>Font Style</source> |
||||
<translation>字体样式</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="566"/> |
||||
<source>Font Weight</source> |
||||
<translation>字体粗细</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="574"/> |
||||
<source>Font Size</source> |
||||
<translation>字体大小</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="588"/> |
||||
<source>Hour Settings</source> |
||||
<translation>时设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="594"/> |
||||
<location filename="qml/SolarsClock.qml" line="623"/> |
||||
<location filename="qml/SolarsClock.qml" line="652"/> |
||||
<location filename="qml/SolarsClock.qml" line="681"/> |
||||
<source>Star Color</source> |
||||
<translation>星球颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="603"/> |
||||
<location filename="qml/SolarsClock.qml" line="632"/> |
||||
<location filename="qml/SolarsClock.qml" line="661"/> |
||||
<location filename="qml/SolarsClock.qml" line="690"/> |
||||
<source>Show Orbit</source> |
||||
<translation>显示轨道</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="609"/> |
||||
<location filename="qml/SolarsClock.qml" line="638"/> |
||||
<location filename="qml/SolarsClock.qml" line="667"/> |
||||
<location filename="qml/SolarsClock.qml" line="696"/> |
||||
<source>Orbit Color</source> |
||||
<translation>轨道颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="617"/> |
||||
<source>Minute Settings</source> |
||||
<translation>分设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="646"/> |
||||
<source>Second Settings</source> |
||||
<translation>秒设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/SolarsClock.qml" line="675"/> |
||||
<source>Millisecond Settings</source> |
||||
<translation>毫秒设置</translation> |
||||
</message> |
||||
</context> |
||||
<context> |
||||
<name>TextClock</name> |
||||
<message> |
||||
<location filename="qml/TextClock.qml" line="15"/> |
||||
<location filename="qml/TextClock.qml" line="186"/> |
||||
<source>Text Clock</source> |
||||
<translation>文字时钟挂件</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/TextClock.qml" line="160"/> |
||||
<source>Settings</source> |
||||
<translation>设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/TextClock.qml" line="170"/> |
||||
<source>Clock Settings</source> |
||||
<translation>时钟设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/TextClock.qml" line="225"/> |
||||
<source>Configuration</source> |
||||
<translation>配置项</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/TextClock.qml" line="233"/> |
||||
<source>Font Style</source> |
||||
<translation>字体样式</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/TextClock.qml" line="241"/> |
||||
<source>Font Weight</source> |
||||
<translation>字体粗细</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/TextClock.qml" line="249"/> |
||||
<source>HighLight Color</source> |
||||
<translation>高亮颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/TextClock.qml" line="255"/> |
||||
<source>Normal Color</source> |
||||
<translation>普通颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/TextClock.qml" line="261"/> |
||||
<source>Font Size</source> |
||||
<translation>字体大小</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/TextClock.qml" line="271"/> |
||||
<source>Letter Space</source> |
||||
<translation>文字间隔</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/TextClock.qml" line="281"/> |
||||
<source>Line Spacing</source> |
||||
<translation>行距</translation> |
||||
</message> |
||||
</context> |
||||
<context> |
||||
<name>VectoClock</name> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="17"/> |
||||
<location filename="qml/VectoClock.qml" line="303"/> |
||||
<source>Vecto Clock</source> |
||||
<translation>Vecto时钟</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="63"/> |
||||
<location filename="qml/VectoClock.qml" line="287"/> |
||||
<source>Settings</source> |
||||
<translation>设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="342"/> |
||||
<source>Configuration</source> |
||||
<translation>配置项</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="350"/> |
||||
<source>Weekday Settings</source> |
||||
<translation>星期设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="356"/> |
||||
<location filename="qml/VectoClock.qml" line="423"/> |
||||
<location filename="qml/VectoClock.qml" line="553"/> |
||||
<source>Color</source> |
||||
<translation>颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="362"/> |
||||
<location filename="qml/VectoClock.qml" line="482"/> |
||||
<location filename="qml/VectoClock.qml" line="559"/> |
||||
<source>Font Size</source> |
||||
<translation>字体大小</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="372"/> |
||||
<location filename="qml/VectoClock.qml" line="492"/> |
||||
<location filename="qml/VectoClock.qml" line="569"/> |
||||
<source>Font Style</source> |
||||
<translation>字体样式</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="379"/> |
||||
<location filename="qml/VectoClock.qml" line="499"/> |
||||
<location filename="qml/VectoClock.qml" line="576"/> |
||||
<source>Font Weight</source> |
||||
<translation>字体粗细</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="386"/> |
||||
<location filename="qml/VectoClock.qml" line="506"/> |
||||
<location filename="qml/VectoClock.qml" line="583"/> |
||||
<source>Letter Spacing</source> |
||||
<translation>文字间隔</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="396"/> |
||||
<location filename="qml/VectoClock.qml" line="526"/> |
||||
<location filename="qml/VectoClock.qml" line="603"/> |
||||
<source>Y Offset</source> |
||||
<translation>Y偏移量</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="406"/> |
||||
<location filename="qml/VectoClock.qml" line="536"/> |
||||
<source>Gap</source> |
||||
<translation>间距</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="417"/> |
||||
<source>Line Settings</source> |
||||
<translation>线设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="429"/> |
||||
<source>Width</source> |
||||
<translation>宽度</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="439"/> |
||||
<source>Position</source> |
||||
<translation>位置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="450"/> |
||||
<source>Clock Settings</source> |
||||
<translatorcomment>时钟设置</translatorcomment> |
||||
<translation>时钟设置</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="456"/> |
||||
<source>24 Hour Clock</source> |
||||
<translation>24时制</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="462"/> |
||||
<source>Text Color</source> |
||||
<translation>文字颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="469"/> |
||||
<source>Background Visible</source> |
||||
<translation>背景可见</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="475"/> |
||||
<source>Background Color</source> |
||||
<translation>背景颜色</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="516"/> |
||||
<location filename="qml/VectoClock.qml" line="593"/> |
||||
<source>X Offset</source> |
||||
<translation>X偏移量</translation> |
||||
</message> |
||||
<message> |
||||
<location filename="qml/VectoClock.qml" line="547"/> |
||||
<source>Date Settings</source> |
||||
<translation>日期设置</translation> |
||||
</message> |
||||
</context> |
||||
<context> |
||||
<name>reflection_clock</name> |
||||
<message> |
||||
<source>Save</source> |
||||
<translation type="vanished">保存</translation> |
||||
</message> |
||||
<message> |
||||
<source>Show</source> |
||||
<translation type="vanished">显示</translation> |
||||
</message> |
||||
<message> |
||||
<source>Reset</source> |
||||
<translation type="vanished">重置</translation> |
||||
</message> |
||||
<message> |
||||
<source>24 Hour Clock</source> |
||||
<translation type="vanished">24时制</translation> |
||||
</message> |
||||
<message> |
||||
<source>Reflection Clock</source> |
||||
<translation type="vanished">倒影时钟</translation> |
||||
</message> |
||||
<message> |
||||
<source>Hour Settings</source> |
||||
<translation type="vanished">时设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Second Settings</source> |
||||
<translation type="vanished">秒设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Configuration</source> |
||||
<translation type="vanished">配置项</translation> |
||||
</message> |
||||
<message> |
||||
<source>Minute Settings</source> |
||||
<translation type="vanished">分设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Panel Background Color</source> |
||||
<translation type="vanished">面板背景颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Settings</source> |
||||
<translation type="vanished">设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Panel Font Color</source> |
||||
<translation type="vanished">面板字体颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Clock Background Color</source> |
||||
<translation type="vanished">时钟背景颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Clock Font Color</source> |
||||
<translation type="vanished">时钟字体颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Clock Settings</source> |
||||
<translation type="vanished">时钟设置</translation> |
||||
</message> |
||||
</context> |
||||
<context> |
||||
<name>round_clock</name> |
||||
<message> |
||||
<source>Save</source> |
||||
<translation type="vanished">保存</translation> |
||||
</message> |
||||
<message> |
||||
<source>Reset</source> |
||||
<translation type="vanished">重置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Second Hand Color</source> |
||||
<translation type="vanished">秒针颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Hour Scale Color</source> |
||||
<translation type="vanished">时刻度颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Minute Scale Color</source> |
||||
<translation type="vanished">分刻度颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Round Clock</source> |
||||
<translation type="vanished">圆盘时钟</translation> |
||||
</message> |
||||
<message> |
||||
<source>Configuration</source> |
||||
<translation type="vanished">配置项</translation> |
||||
</message> |
||||
<message> |
||||
<source>Background Color</source> |
||||
<translation type="vanished">背景颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Hour Hand Color</source> |
||||
<translation type="vanished">时针颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Continuous Second Hand</source> |
||||
<translation type="vanished">秒针连续</translation> |
||||
</message> |
||||
<message> |
||||
<source>Minute Hand Color</source> |
||||
<translation type="vanished">分针颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Settings</source> |
||||
<translation type="vanished">设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Clock Settings</source> |
||||
<translation type="vanished">时钟设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Background transparency</source> |
||||
<translation type="vanished">背景透明度</translation> |
||||
</message> |
||||
</context> |
||||
<context> |
||||
<name>solars_clock</name> |
||||
<message> |
||||
<source>Save</source> |
||||
<translation type="vanished">保存</translation> |
||||
</message> |
||||
<message> |
||||
<source>Color</source> |
||||
<translation type="vanished">颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Reset</source> |
||||
<translation type="vanished">重置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Center Color</source> |
||||
<translation type="vanished">中心颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Background Settings</source> |
||||
<translation type="vanished">背景设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Transparency</source> |
||||
<translation type="vanished">透明度</translation> |
||||
</message> |
||||
<message> |
||||
<source>Hour Settings</source> |
||||
<translation type="vanished">时设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Solar Clock</source> |
||||
<translation type="vanished">太阳系时钟</translation> |
||||
</message> |
||||
<message> |
||||
<source>Star Color</source> |
||||
<translation type="vanished">星球颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Show Center</source> |
||||
<translation type="vanished">中心显示</translation> |
||||
</message> |
||||
<message> |
||||
<source>Font Size</source> |
||||
<translation type="vanished">字体大小</translation> |
||||
</message> |
||||
<message> |
||||
<source>Orbit Color</source> |
||||
<translation type="vanished">轨道颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Font Color</source> |
||||
<translation type="vanished">字体颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Millisecond Settings</source> |
||||
<translation type="vanished">毫秒设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Second Settings</source> |
||||
<translation type="vanished">秒设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Configuration</source> |
||||
<translation type="vanished">配置项</translation> |
||||
</message> |
||||
<message> |
||||
<source>Scale Color</source> |
||||
<translation type="vanished">刻度颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Show Orbit</source> |
||||
<translation type="vanished">显示轨道</translation> |
||||
</message> |
||||
<message> |
||||
<source>Show Scale</source> |
||||
<translation type="vanished">显示刻度</translation> |
||||
</message> |
||||
<message> |
||||
<source>Minute Settings</source> |
||||
<translation type="vanished">分设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Display Time</source> |
||||
<translation type="vanished">显示时间</translation> |
||||
</message> |
||||
<message> |
||||
<source>Center Radius</source> |
||||
<translation type="vanished">中心半径</translation> |
||||
</message> |
||||
<message> |
||||
<source>Settings</source> |
||||
<translation type="vanished">设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Clock Settings</source> |
||||
<translation type="vanished">时钟设置</translation> |
||||
</message> |
||||
</context> |
||||
<context> |
||||
<name>text_clock</name> |
||||
<message> |
||||
<source>Save</source> |
||||
<translation type="vanished">保存</translation> |
||||
</message> |
||||
<message> |
||||
<source>Reset</source> |
||||
<translation type="vanished">重置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Letter Space</source> |
||||
<translation type="vanished">文字间隔</translation> |
||||
</message> |
||||
<message> |
||||
<source>Font Size</source> |
||||
<translation type="vanished">字体大小</translation> |
||||
</message> |
||||
<message> |
||||
<source>Font Weight</source> |
||||
<translation type="vanished">字体粗细</translation> |
||||
</message> |
||||
<message> |
||||
<source>Text Clock</source> |
||||
<translation type="vanished">文字时钟挂件</translation> |
||||
</message> |
||||
<message> |
||||
<source>Font Style</source> |
||||
<translation type="vanished">字体样式</translation> |
||||
</message> |
||||
<message> |
||||
<source>Configuration</source> |
||||
<translation type="vanished">配置项</translation> |
||||
</message> |
||||
<message> |
||||
<source>Normal Color</source> |
||||
<translation type="vanished">普通颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>HighLight Color</source> |
||||
<translation type="vanished">高亮颜色</translation> |
||||
</message> |
||||
<message> |
||||
<source>Settings</source> |
||||
<translation type="vanished">设置</translation> |
||||
</message> |
||||
<message> |
||||
<source>Line Spacing</source> |
||||
<translation type="vanished">行距</translation> |
||||
</message> |
||||
<message> |
||||
<source>Clock Settings</source> |
||||
<translation type="vanished">时钟设置</translation> |
||||
</message> |
||||
</context> |
||||
</TS> |
After Width: | Height: | Size: 17 KiB |
@ -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")] |
||||
} |
@ -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; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -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" |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
import QtQuick 2.12 |
||||
import QtQuick.Controls 2.12 |
||||
|
||||
import NERvGear 1.0 as NVG |
||||
import NERvGear.Templates 1.0 as T |
||||
|
||||
|
||||
T.Widget { |
||||
solid: true |
||||
visible: true |
||||
|
||||
property string version: "" |
||||
property var defaultValues: {} |
||||
signal completed() |
||||
signal updated() |
||||
|
||||
function updateObject(targetObj, sourceObj) { |
||||
for (let prop in sourceObj) { |
||||
if (sourceObj.hasOwnProperty(prop) && sourceObj[prop] !== undefined) { |
||||
if (typeof sourceObj[prop] === 'object') { |
||||
Object.assign(targetObj[prop], sourceObj[prop]); |
||||
} else { |
||||
targetObj[prop] = sourceObj[prop]; |
||||
} |
||||
} |
||||
} |
||||
return targetObj; |
||||
} |
||||
|
||||
onUpdated: { |
||||
widget.settings.styles = updateObject(JSON.parse(JSON.stringify(defaultValues)), widget.settings.styles); |
||||
} |
||||
|
||||
Component.onCompleted: { |
||||
if (!widget.settings.styles) { |
||||
widget.settings.styles = defaultValues; |
||||
widget.settings.version = version; |
||||
} else if (widget.settings.version !== version) { |
||||
updated(); |
||||
widget.settings.version = version; |
||||
} |
||||
completed(); |
||||
} |
||||
} |
@ -1,465 +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.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 |
||||
maximumWidth: minimumWidth |
||||
maximumHeight: minimumHeight |
||||
width: minimumWidth |
||||
height: minimumHeight |
||||
|
||||
transientParent: widget.NVG.View.window |
||||
|
||||
property var configuration |
||||
|
||||
ColumnLayout { |
||||
id: root |
||||
anchors.fill: parent |
||||
anchors.margins: 16 |
||||
anchors.topMargin: 0 |
||||
|
||||
Row { |
||||
spacing: 234 |
||||
|
||||
ToolButton { |
||||
text: qsTr("Save") |
||||
onClicked: { |
||||
configuration = rootPreference.save(); |
||||
widget.settings.styles = configuration; |
||||
styleDialog.active = false; |
||||
} |
||||
} |
||||
|
||||
ToolButton { |
||||
text: qsTr("Reset") |
||||
onClicked: { |
||||
rootPreference.load(); |
||||
let cfg = rootPreference.save(); |
||||
widget.settings.styles = cfg; |
||||
} |
||||
} |
||||
} |
||||
|
||||
Label { |
||||
Layout.alignment: Qt.AlignCenter |
||||
text: qsTr("Settings") |
||||
font.pixelSize: 24 |
||||
} |
||||
|
||||
Flickable { |
||||
Layout.fillWidth: true |
||||
Layout.fillHeight: true |
||||
|
||||
clip: true |
||||
contentWidth: preferenceLayout.implicitWidth |
||||
contentHeight: preferenceLayout.implicitHeight |
||||
|
||||
ColumnLayout { |
||||
id: preferenceLayout |
||||
width: root.width |
||||
|
||||
P.PreferenceGroup { |
||||
id: rootPreference |
||||
Layout.fillWidth: true |
||||
|
||||
label: qsTr("Configuration") |
||||
|
||||
onPreferenceEdited: { |
||||
widget.settings.styles = rootPreference.save(); |
||||
} |
||||
|
||||
P.DialogPreference { |
||||
name: "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; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,687 +0,0 @@
|
||||
import QtQuick 2.12 |
||||
|
||||
import QtQuick.Controls 2.12 |
||||
import QtQuick.Layouts 1.12 |
||||
|
||||
import NERvGear 1.0 as NVG |
||||
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 |
||||
maximumWidth: minimumWidth |
||||
maximumHeight: minimumHeight |
||||
width: minimumWidth |
||||
height: minimumHeight |
||||
|
||||
transientParent: widget.NVG.View.window |
||||
|
||||
property var configuration |
||||
|
||||
ColumnLayout { |
||||
id: root |
||||
anchors.fill: parent |
||||
anchors.margins: 16 |
||||
anchors.topMargin: 0 |
||||
|
||||
Row { |
||||
spacing: 270 |
||||
|
||||
ToolButton { |
||||
text: qsTr("Save") |
||||
onClicked: { |
||||
configuration = rootPreference.save(); |
||||
widget.settings.styles = configuration; |
||||
styleDialog.active = false; |
||||
} |
||||
} |
||||
|
||||
ToolButton { |
||||
text: qsTr("Reset") |
||||
onClicked: { |
||||
rootPreference.load(); |
||||
let cfg = rootPreference.save(); |
||||
widget.settings.styles = cfg; |
||||
} |
||||
} |
||||
} |
||||
|
||||
Label { |
||||
Layout.alignment: Qt.AlignCenter |
||||
text: qsTr("Settings") |
||||
font.pixelSize: 24 |
||||
} |
||||
|
||||
Flickable { |
||||
Layout.fillWidth: true |
||||
Layout.fillHeight: true |
||||
|
||||
clip: true |
||||
contentWidth: preferenceLayout.implicitWidth |
||||
contentHeight: preferenceLayout.implicitHeight |
||||
|
||||
ColumnLayout { |
||||
id: preferenceLayout |
||||
width: root.width |
||||
|
||||
P.PreferenceGroup { |
||||
id: rootPreference |
||||
Layout.fillWidth: true |
||||
|
||||
label: qsTr("Configuration") |
||||
|
||||
onPreferenceEdited: { |
||||
widget.settings.styles = rootPreference.save(); |
||||
} |
||||
|
||||
P.DialogPreference { |
||||
name: "BG Settings" |
||||
label: qsTr("Background Settings") |
||||
live: true |
||||
icon.name: "regular:\uf1de" |
||||
|
||||
P.ColorPreference { |
||||
name: "BG Color" |
||||
label: qsTr("Color") |
||||
defaultValue: "#212121" |
||||
} |
||||
|
||||
P.SliderPreference { |
||||
name: "BG Alpha" |
||||
label: qsTr("Transparency") |
||||
from: 0 |
||||
to: 100 |
||||
stepSize: 1 |
||||
defaultValue: 100 |
||||
displayValue: value + "%" |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SwitchPreference { |
||||
id: show_hgrid |
||||
name: "Show HGrid" |
||||
label: qsTr("Show Scale") |
||||
defaultValue: true |
||||
} |
||||
|
||||
P.ColorPreference { |
||||
name: "HGRID Color" |
||||
label: qsTr("Scale Color") |
||||
enabled: show_hgrid.value |
||||
defaultValue: "#616161" |
||||
} |
||||
|
||||
P.Separator {} |
||||
|
||||
P.SwitchPreference { |
||||
id: showCenter |
||||
name: "Show Center" |
||||
label: qsTr("Show Center") |
||||
defaultValue: true |
||||
} |
||||
|
||||
P.ColorPreference { |
||||
name: "Center Color" |
||||
label: qsTr("Center Color") |
||||
enabled: showCenter.value |
||||
defaultValue: "#ffeb3b" |
||||
} |
||||
|
||||
P.SliderPreference { |
||||
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" |
||||
} |
||||
} |
Loading…
Reference in new issue