This commit is contained in:
朱子楚\zhuzi 2024-03-27 00:36:56 +08:00
parent 485bcc8acc
commit e81a2cc849
42 changed files with 412 additions and 635 deletions

View File

@ -49,13 +49,9 @@ configure_file(
)
#Cpp
message("---------->${filename}")
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
foreach(filepath ${CPP_FILES})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
message(${filename})
list(APPEND sources_files ${filename})
endforeach(filepath)

View File

@ -181,8 +181,6 @@
<file>res/image/image_1.jpg</file>
<file>qml/window/PageWindow.qml</file>
<file>qml/page/T_StaggeredLayout.qml</file>
<file>qml/viewmodel/SettingsViewModel.qml</file>
<file>qml/viewmodel/TextBoxViewModel.qml</file>
<file>qml/page/T_Clip.qml</file>
<file>qml/page/T_3D.qml</file>
<file>qml/page/T_Network.qml</file>
@ -208,5 +206,6 @@
<file>res/template/src/qml.qrc.in</file>
<file>res/template/src/zh_CN.ts.in</file>
<file>res/template/src/README.md.in</file>
<file>qml/global/GlobalModel.qml</file>
</qresource>
</RCC>

View File

@ -535,104 +535,104 @@
<context>
<name>MainWindow</name>
<message>
<location filename="qml/window/MainWindow.qml" line="322"/>
<location filename="qml/window/MainWindow.qml" line="318"/>
<source>Dark Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="98"/>
<location filename="qml/window/MainWindow.qml" line="106"/>
<location filename="qml/window/MainWindow.qml" line="94"/>
<location filename="qml/window/MainWindow.qml" line="102"/>
<source>Quit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="99"/>
<location filename="qml/window/MainWindow.qml" line="95"/>
<source>Are you sure you want to exit the program?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="100"/>
<location filename="qml/window/MainWindow.qml" line="96"/>
<source>Minimize</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="103"/>
<location filename="qml/window/MainWindow.qml" line="99"/>
<source>Friendly Reminder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="103"/>
<location filename="qml/window/MainWindow.qml" line="99"/>
<source>FluentUI is hidden from the tray, click on the tray to activate the window again</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="107"/>
<location filename="qml/window/MainWindow.qml" line="351"/>
<location filename="qml/window/MainWindow.qml" line="103"/>
<location filename="qml/window/MainWindow.qml" line="347"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="118"/>
<location filename="qml/window/MainWindow.qml" line="114"/>
<source>Open in Separate Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="215"/>
<location filename="qml/window/MainWindow.qml" line="211"/>
<source>Click Time</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="225"/>
<location filename="qml/window/MainWindow.qml" line="221"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="316"/>
<location filename="qml/window/MainWindow.qml" line="312"/>
<source>Finish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="317"/>
<location filename="qml/window/MainWindow.qml" line="313"/>
<source>Next</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="318"/>
<location filename="qml/window/MainWindow.qml" line="314"/>
<source>Previous</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="322"/>
<location filename="qml/window/MainWindow.qml" line="318"/>
<source>Here you can switch to night mode.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="324"/>
<location filename="qml/window/MainWindow.qml" line="320"/>
<source>Hide Easter eggs</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="324"/>
<location filename="qml/window/MainWindow.qml" line="320"/>
<source>Try a few more clicks!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="348"/>
<location filename="qml/window/MainWindow.qml" line="344"/>
<source>Upgrade Tips</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="349"/>
<location filename="qml/window/MainWindow.qml" line="345"/>
<source>FluentUI is currently up to date </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="349"/>
<location filename="qml/window/MainWindow.qml" line="345"/>
<source> -- The current app version</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="349"/>
<location filename="qml/window/MainWindow.qml" line="345"/>
<source>
Now go and download the new version
@ -641,17 +641,17 @@ Updated content:
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="352"/>
<location filename="qml/window/MainWindow.qml" line="348"/>
<source>OK</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="379"/>
<location filename="qml/window/MainWindow.qml" line="375"/>
<source>The current version is already the latest</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="386"/>
<location filename="qml/window/MainWindow.qml" line="382"/>
<source>The network is abnormal</source>
<translation type="unfinished"></translation>
</message>
@ -1521,46 +1521,46 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<context>
<name>T_MultiWindow</name>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="13"/>
<location filename="qml/page/T_MultiWindow.qml" line="12"/>
<source>MultiWindow</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="35"/>
<location filename="qml/page/T_MultiWindow.qml" line="36"/>
<source>&lt;font color=&apos;red&apos;&gt;Standard&lt;/font&gt; mode windowa new window is created every time</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="38"/>
<location filename="qml/page/T_MultiWindow.qml" line="62"/>
<location filename="qml/page/T_MultiWindow.qml" line="85"/>
<location filename="qml/page/T_MultiWindow.qml" line="119"/>
<location filename="qml/page/T_MultiWindow.qml" line="154"/>
<location filename="qml/page/T_MultiWindow.qml" line="39"/>
<location filename="qml/page/T_MultiWindow.qml" line="63"/>
<location filename="qml/page/T_MultiWindow.qml" line="86"/>
<location filename="qml/page/T_MultiWindow.qml" line="120"/>
<location filename="qml/page/T_MultiWindow.qml" line="155"/>
<source>Create Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="58"/>
<location filename="qml/page/T_MultiWindow.qml" line="59"/>
<source>&lt;font color=&apos;red&apos;&gt;SingleTask&lt;/font&gt; mode windowIf a window exists, this activates the window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="82"/>
<location filename="qml/page/T_MultiWindow.qml" line="83"/>
<source>&lt;font color=&apos;red&apos;&gt;SingleInstance&lt;/font&gt; mode windowIf the window exists, destroy the window and create a new window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="116"/>
<location filename="qml/page/T_MultiWindow.qml" line="117"/>
<source>Create the window without carrying any parameters</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="151"/>
<location filename="qml/page/T_MultiWindow.qml" line="152"/>
<source>Create a window with the parameter username: zhuzichu</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="160"/>
<location filename="qml/page/T_MultiWindow.qml" line="161"/>
<source>Login Window Returned Password - &gt;</source>
<translation type="unfinished"></translation>
</message>
@ -1735,97 +1735,97 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<context>
<name>T_Settings</name>
<message>
<location filename="qml/page/T_Settings.qml" line="12"/>
<location filename="qml/page/T_Settings.qml" line="11"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="43"/>
<location filename="qml/page/T_Settings.qml" line="38"/>
<source>Current Version</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="49"/>
<location filename="qml/page/T_Settings.qml" line="44"/>
<source>Check for Updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="65"/>
<location filename="qml/page/T_Settings.qml" line="60"/>
<source>Use System AppBar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="81"/>
<location filename="qml/page/T_Settings.qml" line="76"/>
<source>Fits AppBar Windows</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="92"/>
<location filename="qml/page/T_Settings.qml" line="87"/>
<source>Friendly Reminder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="93"/>
<location filename="qml/page/T_Settings.qml" line="88"/>
<source>This action requires a restart of the program to take effect, is it restarted?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="95"/>
<location filename="qml/page/T_Settings.qml" line="90"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="96"/>
<location filename="qml/page/T_Settings.qml" line="91"/>
<source>OK</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="115"/>
<location filename="qml/page/T_Settings.qml" line="110"/>
<source>Dark Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="120"/>
<location filename="qml/page/T_Settings.qml" line="115"/>
<source>System</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="120"/>
<location filename="qml/page/T_Settings.qml" line="115"/>
<source>Light</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="120"/>
<location filename="qml/page/T_Settings.qml" line="115"/>
<source>Dark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="145"/>
<location filename="qml/page/T_Settings.qml" line="140"/>
<source>Navigation View Display Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="150"/>
<location filename="qml/page/T_Settings.qml" line="145"/>
<source>Open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="150"/>
<location filename="qml/page/T_Settings.qml" line="145"/>
<source>Compact</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="150"/>
<location filename="qml/page/T_Settings.qml" line="145"/>
<source>Minimal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="150"/>
<location filename="qml/page/T_Settings.qml" line="145"/>
<source>Auto</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="185"/>
<location filename="qml/page/T_Settings.qml" line="180"/>
<source>Language</source>
<translation type="unfinished"></translation>
</message>
@ -2023,36 +2023,36 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<context>
<name>T_TextBox</name>
<message>
<location filename="qml/page/T_TextBox.qml" line="11"/>
<location filename="qml/page/T_TextBox.qml" line="10"/>
<source>TextBox</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TextBox.qml" line="24"/>
<location filename="qml/page/T_TextBox.qml" line="19"/>
<source>Single-line Input Box</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TextBox.qml" line="43"/>
<location filename="qml/page/T_TextBox.qml" line="74"/>
<location filename="qml/page/T_TextBox.qml" line="112"/>
<location filename="qml/page/T_TextBox.qml" line="143"/>
<location filename="qml/page/T_TextBox.qml" line="172"/>
<location filename="qml/page/T_TextBox.qml" line="34"/>
<location filename="qml/page/T_TextBox.qml" line="65"/>
<location filename="qml/page/T_TextBox.qml" line="98"/>
<location filename="qml/page/T_TextBox.qml" line="129"/>
<location filename="qml/page/T_TextBox.qml" line="158"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TextBox.qml" line="61"/>
<location filename="qml/page/T_TextBox.qml" line="52"/>
<source>Please enter your password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TextBox.qml" line="94"/>
<location filename="qml/page/T_TextBox.qml" line="84"/>
<source>Multi-line Input Box</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TextBox.qml" line="129"/>
<location filename="qml/page/T_TextBox.qml" line="115"/>
<source>AutoSuggestBox</source>
<translation type="unfinished"></translation>
</message>

View File

@ -535,104 +535,104 @@
<context>
<name>MainWindow</name>
<message>
<location filename="qml/window/MainWindow.qml" line="322"/>
<location filename="qml/window/MainWindow.qml" line="318"/>
<source>Dark Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="98"/>
<location filename="qml/window/MainWindow.qml" line="106"/>
<location filename="qml/window/MainWindow.qml" line="94"/>
<location filename="qml/window/MainWindow.qml" line="102"/>
<source>Quit</source>
<translation type="unfinished">退</translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="99"/>
<location filename="qml/window/MainWindow.qml" line="95"/>
<source>Are you sure you want to exit the program?</source>
<translation type="unfinished">退</translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="100"/>
<location filename="qml/window/MainWindow.qml" line="96"/>
<source>Minimize</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="103"/>
<location filename="qml/window/MainWindow.qml" line="99"/>
<source>Friendly Reminder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="103"/>
<location filename="qml/window/MainWindow.qml" line="99"/>
<source>FluentUI is hidden from the tray, click on the tray to activate the window again</source>
<translation type="unfinished">FluentUI </translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="107"/>
<location filename="qml/window/MainWindow.qml" line="351"/>
<location filename="qml/window/MainWindow.qml" line="103"/>
<location filename="qml/window/MainWindow.qml" line="347"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="118"/>
<location filename="qml/window/MainWindow.qml" line="114"/>
<source>Open in Separate Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="215"/>
<location filename="qml/window/MainWindow.qml" line="211"/>
<source>Click Time</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="225"/>
<location filename="qml/window/MainWindow.qml" line="221"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="316"/>
<location filename="qml/window/MainWindow.qml" line="312"/>
<source>Finish</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="317"/>
<location filename="qml/window/MainWindow.qml" line="313"/>
<source>Next</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="318"/>
<location filename="qml/window/MainWindow.qml" line="314"/>
<source>Previous</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="322"/>
<location filename="qml/window/MainWindow.qml" line="318"/>
<source>Here you can switch to night mode.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="324"/>
<location filename="qml/window/MainWindow.qml" line="320"/>
<source>Hide Easter eggs</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="324"/>
<location filename="qml/window/MainWindow.qml" line="320"/>
<source>Try a few more clicks!!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="348"/>
<location filename="qml/window/MainWindow.qml" line="344"/>
<source>Upgrade Tips</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="349"/>
<location filename="qml/window/MainWindow.qml" line="345"/>
<source>FluentUI is currently up to date </source>
<translation type="unfinished">FluentUI </translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="349"/>
<location filename="qml/window/MainWindow.qml" line="345"/>
<source> -- The current app version</source>
<translation type="unfinished"> -- </translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="349"/>
<location filename="qml/window/MainWindow.qml" line="345"/>
<source>
Now go and download the new version
@ -645,17 +645,17 @@ Updated content:
</translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="352"/>
<location filename="qml/window/MainWindow.qml" line="348"/>
<source>OK</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="379"/>
<location filename="qml/window/MainWindow.qml" line="375"/>
<source>The current version is already the latest</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/window/MainWindow.qml" line="386"/>
<location filename="qml/window/MainWindow.qml" line="382"/>
<source>The network is abnormal</source>
<translation type="unfinished"></translation>
</message>
@ -1561,46 +1561,46 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<context>
<name>T_MultiWindow</name>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="13"/>
<location filename="qml/page/T_MultiWindow.qml" line="12"/>
<source>MultiWindow</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="35"/>
<location filename="qml/page/T_MultiWindow.qml" line="36"/>
<source>&lt;font color=&apos;red&apos;&gt;Standard&lt;/font&gt; mode windowa new window is created every time</source>
<translation type="unfinished">&lt;font color=&apos;red&apos;&gt;Standard&lt;/font&gt; </translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="38"/>
<location filename="qml/page/T_MultiWindow.qml" line="62"/>
<location filename="qml/page/T_MultiWindow.qml" line="85"/>
<location filename="qml/page/T_MultiWindow.qml" line="119"/>
<location filename="qml/page/T_MultiWindow.qml" line="154"/>
<location filename="qml/page/T_MultiWindow.qml" line="39"/>
<location filename="qml/page/T_MultiWindow.qml" line="63"/>
<location filename="qml/page/T_MultiWindow.qml" line="86"/>
<location filename="qml/page/T_MultiWindow.qml" line="120"/>
<location filename="qml/page/T_MultiWindow.qml" line="155"/>
<source>Create Window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="58"/>
<location filename="qml/page/T_MultiWindow.qml" line="59"/>
<source>&lt;font color=&apos;red&apos;&gt;SingleTask&lt;/font&gt; mode windowIf a window exists, this activates the window</source>
<translation type="unfinished">&lt;font color=&apos;red&apos;&gt;SingleTask&lt;/font&gt; </translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="82"/>
<location filename="qml/page/T_MultiWindow.qml" line="83"/>
<source>&lt;font color=&apos;red&apos;&gt;SingleInstance&lt;/font&gt; mode windowIf the window exists, destroy the window and create a new window</source>
<translation type="unfinished">&lt;font color=&apos;red&apos;&gt;SingleInstance&lt;/font&gt; </translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="116"/>
<location filename="qml/page/T_MultiWindow.qml" line="117"/>
<source>Create the window without carrying any parameters</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="151"/>
<location filename="qml/page/T_MultiWindow.qml" line="152"/>
<source>Create a window with the parameter username: zhuzichu</source>
<translation type="unfinished">zhuzichu</translation>
</message>
<message>
<location filename="qml/page/T_MultiWindow.qml" line="160"/>
<location filename="qml/page/T_MultiWindow.qml" line="161"/>
<source>Login Window Returned Password - &gt;</source>
<translation type="unfinished"> - &gt;</translation>
</message>
@ -1785,97 +1785,97 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<context>
<name>T_Settings</name>
<message>
<location filename="qml/page/T_Settings.qml" line="12"/>
<location filename="qml/page/T_Settings.qml" line="11"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="43"/>
<location filename="qml/page/T_Settings.qml" line="38"/>
<source>Current Version</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="49"/>
<location filename="qml/page/T_Settings.qml" line="44"/>
<source>Check for Updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="65"/>
<location filename="qml/page/T_Settings.qml" line="60"/>
<source>Use System AppBar</source>
<translation type="unfinished">使</translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="81"/>
<location filename="qml/page/T_Settings.qml" line="76"/>
<source>Fits AppBar Windows</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="92"/>
<location filename="qml/page/T_Settings.qml" line="87"/>
<source>Friendly Reminder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="93"/>
<location filename="qml/page/T_Settings.qml" line="88"/>
<source>This action requires a restart of the program to take effect, is it restarted?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="95"/>
<location filename="qml/page/T_Settings.qml" line="90"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="96"/>
<location filename="qml/page/T_Settings.qml" line="91"/>
<source>OK</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="115"/>
<location filename="qml/page/T_Settings.qml" line="110"/>
<source>Dark Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="120"/>
<location filename="qml/page/T_Settings.qml" line="115"/>
<source>System</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="120"/>
<location filename="qml/page/T_Settings.qml" line="115"/>
<source>Light</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="120"/>
<location filename="qml/page/T_Settings.qml" line="115"/>
<source>Dark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="145"/>
<location filename="qml/page/T_Settings.qml" line="140"/>
<source>Navigation View Display Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="150"/>
<location filename="qml/page/T_Settings.qml" line="145"/>
<source>Open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="150"/>
<location filename="qml/page/T_Settings.qml" line="145"/>
<source>Compact</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="150"/>
<location filename="qml/page/T_Settings.qml" line="145"/>
<source>Minimal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="150"/>
<location filename="qml/page/T_Settings.qml" line="145"/>
<source>Auto</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_Settings.qml" line="185"/>
<location filename="qml/page/T_Settings.qml" line="180"/>
<source>Language</source>
<translation type="unfinished"></translation>
</message>
@ -2093,36 +2093,36 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<context>
<name>T_TextBox</name>
<message>
<location filename="qml/page/T_TextBox.qml" line="11"/>
<location filename="qml/page/T_TextBox.qml" line="10"/>
<source>TextBox</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TextBox.qml" line="24"/>
<location filename="qml/page/T_TextBox.qml" line="19"/>
<source>Single-line Input Box</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TextBox.qml" line="43"/>
<location filename="qml/page/T_TextBox.qml" line="74"/>
<location filename="qml/page/T_TextBox.qml" line="112"/>
<location filename="qml/page/T_TextBox.qml" line="143"/>
<location filename="qml/page/T_TextBox.qml" line="172"/>
<location filename="qml/page/T_TextBox.qml" line="34"/>
<location filename="qml/page/T_TextBox.qml" line="65"/>
<location filename="qml/page/T_TextBox.qml" line="98"/>
<location filename="qml/page/T_TextBox.qml" line="129"/>
<location filename="qml/page/T_TextBox.qml" line="158"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TextBox.qml" line="61"/>
<location filename="qml/page/T_TextBox.qml" line="52"/>
<source>Please enter your password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TextBox.qml" line="94"/>
<location filename="qml/page/T_TextBox.qml" line="84"/>
<source>Multi-line Input Box</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_TextBox.qml" line="129"/>
<location filename="qml/page/T_TextBox.qml" line="115"/>
<source>AutoSuggestBox</source>
<translation type="unfinished"></translation>
</message>

View File

@ -4,30 +4,26 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import FluentUI 1.0
Item {
FluLauncher {
id: app
Connections{
target: FluTheme
function onDarkModeChanged(){
SettingsHelper.saveDarkMode(FluTheme.darkMode)
}
}
Connections{
target: FluApp
function onUseSystemAppBarChanged(){
SettingsHelper.saveUseSystemAppBar(FluApp.useSystemAppBar)
}
}
Connections{
target: TranslateHelper
function onCurrentChanged(){
SettingsHelper.saveLanguage(TranslateHelper.current)
}
}
Component.onCompleted: {
FluNetwork.openLog = false
FluNetwork.setInterceptor(function(param){
@ -38,7 +34,7 @@ Item {
FluApp.useSystemAppBar = SettingsHelper.getUseSystemAppBar()
FluTheme.darkMode = SettingsHelper.getDarkMode()
FluTheme.enableAnimation = true
FluApp.routes = {
FluRouter.routes = {
"/":"qrc:/example/qml/window/MainWindow.qml",
"/about":"qrc:/example/qml/window/AboutWindow.qml",
"/login":"qrc:/example/qml/window/LoginWindow.qml",
@ -51,9 +47,9 @@ Item {
}
var args = Qt.application.arguments
if(args.length>=2 && args[1].startsWith("-crashed=")){
FluApp.navigate("/crash",{crashFilePath:args[1].replace("-crashed=","")})
FluRouter.navigate("/crash",{crashFilePath:args[1].replace("-crashed=","")})
}else{
FluApp.navigate("/")
FluRouter.navigate("/")
}
}
}

View File

@ -0,0 +1,10 @@
pragma Singleton
import QtQuick 2.15
import FluentUI 1.0
QtObject{
property int displayMode: FluNavigationViewType.Auto
}

View File

@ -16,7 +16,7 @@ FluObject{
title:qsTr("About")
icon:FluentIcons.Contact
onTapListener:function(){
FluApp.navigate("/about")
FluRouter.navigate("/about")
}
}

View File

@ -462,7 +462,7 @@ FluObject{
FluPaneItem{
title: qsTr("Hot Loader")
onTapListener: function(){
FluApp.navigate("/hotload")
FluRouter.navigate("/hotload")
}
}
FluPaneItem{

View File

@ -1,2 +1,3 @@
singleton ItemsOriginal 1.0 ItemsOriginal.qml
singleton ItemsOriginal 1.0 ItemsOriginal.qml
singleton ItemsFooter 1.0 ItemsFooter.qml
singleton GlobalModel 1.0 GlobalModel.qml

View File

@ -8,16 +8,17 @@ import "../component"
FluScrollablePage{
property string password: ""
property var loginPageRegister: registerForWindowResult("/login")
title: qsTr("MultiWindow")
Connections{
target: loginPageRegister
function onResult(data)
{
FluWindowResultLauncher{
id:loginResultLauncher
path: "/login"
onResult:
(data)=>{
password = data.password
}
}
FluArea{
@ -37,7 +38,7 @@ FluScrollablePage{
FluButton{
text: qsTr("Create Window")
onClicked: {
FluApp.navigate("/standardWindow")
FluRouter.navigate("/standardWindow")
}
}
}
@ -61,7 +62,7 @@ FluScrollablePage{
FluButton{
text: qsTr("Create Window")
onClicked: {
FluApp.navigate("/singleTaskWindow")
FluRouter.navigate("/singleTaskWindow")
}
}
}
@ -84,7 +85,7 @@ FluScrollablePage{
FluButton{
text: qsTr("Create Window")
onClicked: {
FluApp.navigate("/singleInstanceWindow")
FluRouter.navigate("/singleInstanceWindow")
}
}
}
@ -118,7 +119,7 @@ FluScrollablePage{
FluButton{
text: qsTr("Create Window")
onClicked: {
FluApp.navigate("/about")
FluRouter.navigate("/about")
}
}
}
@ -129,7 +130,7 @@ FluScrollablePage{
code:'FluButton{
text: qsTr("Create Window")
onClicked: {
FluApp.navigate("/about")
FluRouter.navigate("/about")
}
}
'
@ -153,7 +154,7 @@ FluScrollablePage{
FluButton{
text: qsTr("Create Window")
onClicked: {
loginPageRegister.launch({username:"zhuzichu"})
loginResultLauncher.launch({username:"zhuzichu"})
}
}
FluText{

View File

@ -4,17 +4,12 @@ import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import "../component"
import "../viewmodel"
import "../global"
FluScrollablePage{
title: qsTr("Settings")
SettingsViewModel{
id:viewmodel_settings
}
FluEvent{
id:event_checkupdate_finish
name: "checkUpdateFinish"
@ -95,7 +90,7 @@ FluScrollablePage{
negativeText: qsTr("Cancel")
positiveText: qsTr("OK")
onPositiveClicked: {
FluApp.exit(931)
FluRouter.exit(931)
}
}
@ -149,10 +144,10 @@ FluScrollablePage{
Repeater{
model: [{title:qsTr("Open"),mode:FluNavigationViewType.Open},{title:qsTr("Compact"),mode:FluNavigationViewType.Compact},{title:qsTr("Minimal"),mode:FluNavigationViewType.Minimal},{title:qsTr("Auto"),mode:FluNavigationViewType.Auto}]
delegate: FluRadioButton{
checked : viewmodel_settings.displayMode===modelData.mode
text:modelData.title
text: modelData.title
checked: GlobalModel.displayMode === modelData.mode
clickListener:function(){
viewmodel_settings.displayMode = modelData.mode
GlobalModel.displayMode = modelData.mode
}
}
}

View File

@ -4,16 +4,11 @@ import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import FluentUI 1.0
import "../component"
import "../viewmodel"
FluScrollablePage{
title: qsTr("TextBox")
TextBoxViewModel{
id:viewModel
}
FluArea{
Layout.fillWidth: true
height: 68
@ -24,10 +19,6 @@ FluScrollablePage{
placeholderText: qsTr("Single-line Input Box")
disabled: text_box_switch.checked
cleanEnabled: true
text: viewModel.text1
onTextChanged: {
viewModel.text1 = text
}
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
@ -82,7 +73,6 @@ FluScrollablePage{
}'
}
FluArea{
Layout.fillWidth: true
height: 36+multiine_textbox.height
@ -92,10 +82,6 @@ FluScrollablePage{
FluMultilineTextBox{
id: multiine_textbox
placeholderText: qsTr("Multi-line Input Box")
text:viewModel.text2
onTextChanged: {
viewModel.text2 = text
}
disabled: text_box_multi_switch.checked
anchors{
verticalCenter: parent.verticalCenter

View File

@ -1,14 +0,0 @@
import QtQuick 2.15
import FluentUI 1.0
FluViewModel{
objectName: "SettingsViewModel"
scope: FluViewModelType.Application
property int displayMode
onInitData: {
displayMode = FluNavigationViewType.Auto
}
}

View File

@ -1,8 +0,0 @@
import QtQuick 2.15
import FluentUI 1.0
FluViewModel {
objectName: "TextBoxView"
property string text1
property string text2
}

View File

@ -31,7 +31,7 @@ FluWindow {
MouseArea{
anchors.fill: parent
onClicked: {
FluApp.navigate("/")
FluRouter.navigate("/")
}
}
}

View File

@ -71,7 +71,7 @@ FluWindow {
FluFilledButton{
text: qsTr("Restart Program")
onClicked: {
FluApp.exit(931)
FluRouter.exit(931)
}
}
}

View File

@ -51,7 +51,7 @@ FluWindow {
showError(qsTr("Please feel free to enter a password"))
return
}
onResult({password:textbox_password.text})
setResult({password:textbox_password.text})
window.close()
}
}

View File

@ -7,7 +7,6 @@ import Qt.labs.platform 1.1
import FluentUI 1.0
import example 1.0
import "../component"
import "../viewmodel"
import "../global"
FluWindow {
@ -29,10 +28,6 @@ FluWindow {
z:7
}
SettingsViewModel{
id:viewmodel_settings
}
FluEvent{
id:event_checkupdate
name: "checkUpdate"
@ -60,6 +55,7 @@ FluWindow {
Component.onDestruction: {
FluEventBus.unRegisterEvent(event_checkupdate)
FluRouter.exit()
}
SystemTrayIcon {
@ -71,7 +67,7 @@ FluWindow {
MenuItem {
text: "退出"
onTriggered: {
FluApp.exit()
FluRouter.exit()
}
}
}
@ -106,7 +102,7 @@ FluWindow {
positiveText: qsTr("Quit")
neutralText: qsTr("Cancel")
onPositiveClicked:{
FluApp.exit(0)
FluRouter.exit(0)
}
}
@ -118,7 +114,7 @@ FluWindow {
text: qsTr("Open in Separate Window")
font.pixelSize: 12
onClicked: {
FluApp.navigate("/pageWindow",{title:modelData.title,url:modelData.url})
FluRouter.navigate("/pageWindow",{title:modelData.title,url:modelData.url})
}
}
}
@ -197,7 +193,7 @@ FluWindow {
z:999
//StackpopFluPagelaunchMode
// pageMode: FluNavigationViewType.Stack
//NoStackFluViewModel
//NoStack
pageMode: FluNavigationViewType.NoStack
items: ItemsOriginal
footerItems:ItemsFooter
@ -207,7 +203,7 @@ FluWindow {
}
return FluTools.isMacos() ? 20 : 0
}
displayMode:viewmodel_settings.displayMode
displayMode: GlobalModel.displayMode
logo: "qrc:/example/res/image/favicon.ico"
title:"FluentUI"
onLogoClicked:{

View File

@ -12,6 +12,6 @@ Item {
FluApp.routes = {
"/":"qrc:/main.qml",
}
FluApp.navigate("/")
FluRouter.navigate("/")
}
}

View File

@ -73,12 +73,16 @@ if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
endif()
#qml
file(GLOB_RECURSE QML_PATHS *.qml)
file(GLOB_RECURSE QML_PATHS *.qml qmldir)
foreach(filepath ${QML_PATHS})
if(${filepath} MATCHES "Qt${QT_VERSION_MAJOR}/")
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
if(${filename} MATCHES "qmldir")
list(APPEND resource_files ${filename})
else()
list(APPEND qml_files ${filename})
endif()
endif()
endforeach(filepath)
#

View File

@ -4,16 +4,6 @@
#include <QObject>
#include <QtQml/qqml.h>
namespace FluViewModelType {
Q_NAMESPACE
enum Scope {
Window = 0x0000,
Application = 0x0001
};
Q_ENUM_NS(Scope)
QML_NAMED_ELEMENT(FluViewModelType)
}
namespace FluNetworkType {
Q_NAMESPACE
enum CacheMode {

View File

@ -10,20 +10,6 @@
#include <QClipboard>
#include <QTranslator>
FluWindowRegister::FluWindowRegister(QObject *parent):QObject{parent}{
from(nullptr);
to(nullptr);
path("");
}
void FluWindowRegister::launch(const QJsonObject& argument){
FluApp::getInstance()->navigate(path(),argument,this);
}
void FluWindowRegister::onResult(const QJsonObject& data){
Q_EMIT result(data);
}
FluApp::FluApp(QObject *parent):QObject{parent}{
useSystemAppBar(false);
}
@ -45,76 +31,3 @@ void FluApp::init(QObject *target,QLocale locale){
}
}
}
void FluApp::run(){
navigate(initialRoute());
}
void FluApp::navigate(const QString& route,const QJsonObject& argument,FluWindowRegister* windowRegister){
if(!routes().contains(route)){
qCritical()<<"Not Found Route "<<route;
return;
}
QQmlComponent component(_engine, routes().value(route).toString());
if (component.isError()) {
qCritical() << component.errors();
return;
}
QVariantMap properties;
properties.insert("_route",route);
if(windowRegister){
properties.insert("_windowRegister",QVariant::fromValue(windowRegister));
}
properties.insert("argument",argument);
QQuickWindow *win=nullptr;
for (const auto& pair : _windows.toStdMap()) {
QString r = pair.second->property("_route").toString();
if(r == route){
win = pair.second;
break;
}
}
if(win){
int launchMode = win->property("launchMode").toInt();
if(launchMode == 1){
win->setProperty("",argument);
win->show();
win->raise();
win->requestActivate();
return;
}else if(launchMode == 2){
win->close();
}
}
win = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
if(windowRegister){
windowRegister->to(win);
}
}
void FluApp::exit(int retCode){
for (const auto& pair : _windows.toStdMap()) {
pair.second->close();
removeWindow(pair.second);
}
qApp->exit(retCode);
}
void FluApp::addWindow(QQuickWindow* window){
_windows.insert(window->winId(),window);
}
void FluApp::removeWindow(QQuickWindow* window){
if(window){
_windows.remove(window->winId());
window->deleteLater();
window = nullptr;
}
}
QVariant FluApp::createWindowRegister(QQuickWindow* window,const QString& path){
FluWindowRegister *p = new FluWindowRegister(window);
p->from(window);
p->path(path);
return QVariant::fromValue(p);
}

View File

@ -4,7 +4,6 @@
#include <QObject>
#include <QWindow>
#include <QtQml/qqml.h>
#include <QJsonArray>
#include <QQmlContext>
#include <QJsonObject>
#include <QQmlEngine>
@ -13,31 +12,12 @@
#include "stdafx.h"
#include "singleton.h"
/**
* @brief The FluWindowRegister class
*/
class FluWindowRegister : public QObject
{
Q_OBJECT
Q_PROPERTY_AUTO(QQuickWindow*,from)
Q_PROPERTY_AUTO(QQuickWindow*,to)
Q_PROPERTY_AUTO(QString,path);
public:
explicit FluWindowRegister(QObject *parent = nullptr);
Q_INVOKABLE void launch(const QJsonObject& argument = {});
Q_INVOKABLE void onResult(const QJsonObject& data = {});
Q_SIGNAL void result(const QJsonObject& data);
};
/**
* @brief The FluApp class
*/
class FluApp : public QObject
{
Q_OBJECT
Q_PROPERTY_AUTO(QString,initialRoute);
Q_PROPERTY_AUTO(QJsonObject,routes);
Q_PROPERTY_AUTO(bool,useSystemAppBar);
Q_PROPERTY_AUTO(QString,windowIcon);
Q_PROPERTY_AUTO(QLocale,locale);
@ -49,15 +29,8 @@ private:
public:
SINGLETON(FluApp)
static FluApp *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();}
Q_INVOKABLE void run();
Q_INVOKABLE void navigate(const QString& route,const QJsonObject& argument = {},FluWindowRegister* windowRegister = nullptr);
Q_INVOKABLE void init(QObject *target,QLocale locale = QLocale::system());
Q_INVOKABLE void exit(int retCode = 0);
Q_INVOKABLE QVariant createWindowRegister(QQuickWindow* window,const QString& path);
void addWindow(QQuickWindow* window);
void removeWindow(QQuickWindow* window);
private:
QMap<quint64, QQuickWindow*> _windows;
QQmlEngine *_engine;
QTranslator* _translator = nullptr;
};

View File

@ -86,9 +86,9 @@ void FluTools::restoreOverrideCursor(){
qApp->restoreOverrideCursor();
}
void FluTools::deleteItem(QObject *p){
void FluTools::deleteLater(QObject *p){
if(p){
delete p;
p->deleteLater();
p = nullptr;
}
}

View File

@ -34,7 +34,7 @@ public:
Q_INVOKABLE void restoreOverrideCursor();
Q_INVOKABLE QString html2PlantText(const QString& html);
Q_INVOKABLE QString toLocalPath(const QUrl& url);
Q_INVOKABLE void deleteItem(QObject *p);
Q_INVOKABLE void deleteLater(QObject *p);
Q_INVOKABLE QString getFileNameByUrl(const QUrl& url);
Q_INVOKABLE QRect getVirtualGeometry();
Q_INVOKABLE QString getApplicationDirPath();

View File

@ -1,113 +0,0 @@
#include "FluViewModel.h"
#include <QQuickItem>
#include "Def.h"
FluViewModelManager::FluViewModelManager(QObject *parent): QObject{parent}{
}
void FluViewModelManager::insertViewModel(FluViewModel* value){
_viewmodel.append(value);
}
void FluViewModelManager::deleteViewModel(FluViewModel* value){
_viewmodel.removeOne(value);
}
QObject* FluViewModelManager::getModel(const QString& key){
return _data.value(key);
}
void FluViewModelManager::insert(const QString& key,QObject* value){
_data.insert(key,value);
}
bool FluViewModelManager::exist(const QString& key){
return _data.contains(key);
}
void FluViewModelManager::refreshViewModel(FluViewModel* viewModel,QString key,QVariant value){
foreach (auto item, _viewmodel) {
if(item->getKey() == viewModel->getKey()){
item->enablePropertyChange = false;
item->setProperty(key.toLatin1().constData(),value);
item->enablePropertyChange = true;
}
}
}
FluPropertyObserver::FluPropertyObserver(QString name,QObject* model,QObject *parent):QObject{parent}{
_name = name;
_model = model;
_property = QQmlProperty(parent,_name);
_property.connectNotifySignal(this,SLOT(_propertyChange()));
}
FluPropertyObserver::~FluPropertyObserver(){
}
void FluPropertyObserver::_propertyChange(){
auto viewModel = (FluViewModel*)parent();
if(viewModel->enablePropertyChange){
auto value = _property.read();
_model->setProperty(_name.toLatin1().constData(),value);
FluViewModelManager::getInstance()->refreshViewModel(viewModel,_name,value);
}
}
FluViewModel::FluViewModel(QObject *parent):QObject{parent}{
scope(FluViewModelType::Scope::Window);
FluViewModelManager::getInstance()->insertViewModel(this);
}
FluViewModel::~FluViewModel(){
FluViewModelManager::getInstance()->deleteViewModel(this);
}
void FluViewModel::classBegin(){
}
void FluViewModel::componentComplete(){
auto o = parent();
while (nullptr != o) {
_window = o;
o = o->parent();
}
const QMetaObject* obj = metaObject();
if(_scope == FluViewModelType::Scope::Window){
_key = property("objectName").toString()+"-"+QString::number(reinterpret_cast<qulonglong>(_window), 16);
}else{
_key = property("objectName").toString();
}
QObject * model;
if(!FluViewModelManager::getInstance()->exist(_key)){
if(_scope == FluViewModelType::Scope::Window){
model = new QObject(_window);
}else{
model = new QObject();
}
Q_EMIT initData();
for (int i = 0; i < obj->propertyCount(); ++i) {
const QMetaProperty property = obj->property(i);
QString propertyName = property.name();
auto value = property.read(this);
model->setProperty(propertyName.toLatin1().constData(),value);
new FluPropertyObserver(propertyName,model,this);
}
FluViewModelManager::getInstance()->insert(_key,model);
}else{
model = FluViewModelManager::getInstance()->getModel(_key);
for (int i = 0; i < obj->propertyCount(); ++i) {
const QMetaProperty property = obj->property(i);
QString propertyName = property.name();
new FluPropertyObserver(propertyName,model,this);
}
}
foreach (auto key, model->dynamicPropertyNames()) {
setProperty(key,model->property(key));
}
}
QString FluViewModel::getKey(){
return _key;
}

View File

@ -1,69 +0,0 @@
#ifndef FLUVIEWMODEL_H
#define FLUVIEWMODEL_H
#include <QQuickItem>
#include <QtQml/qqml.h>
#include <QQuickWindow>
#include <QQmlProperty>
#include "stdafx.h"
#include "singleton.h"
/**
* @brief The FluViewModel class
*/
class FluViewModel : public QObject, public QQmlParserStatus
{
Q_OBJECT
Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY_AUTO(int,scope);
QML_NAMED_ELEMENT(FluViewModel)
public:
explicit FluViewModel(QObject *parent = nullptr);
~FluViewModel();
void classBegin() override;
void componentComplete() override;
Q_SIGNAL void initData();
QString getKey();
bool enablePropertyChange = true;
private:
QObject* _window = nullptr;
QString _key = "";
};
/**
* @brief The FluPropertyObserver class
*/
class FluPropertyObserver: public QObject{
Q_OBJECT
public:
explicit FluPropertyObserver(QString name,QObject* model,QObject *parent = nullptr);
~FluPropertyObserver();
private:
Q_SLOT void _propertyChange();
private:
QString _name = "";
QQmlProperty _property;
QObject* _model = nullptr;
};
/**
* @brief The FluViewModelManager class
*/
class FluViewModelManager:public QObject{
Q_OBJECT
private:
explicit FluViewModelManager(QObject *parent = nullptr);
public:
SINGLETON(FluViewModelManager)
bool exist(const QString& key);
void insert(const QString& key,QObject* value);
QObject* getModel(const QString& key);
void insertViewModel(FluViewModel* value);
void deleteViewModel(FluViewModel* value);
void refreshViewModel(FluViewModel* viewModel,QString key,QVariant value);
private:
QMap<QString,QObject*> _data;
QList<FluViewModel*> _viewmodel;
};
#endif // FLUVIEWMODEL_H

View File

@ -1,28 +0,0 @@
#include "FluWindowLifecycle.h"
#include "FluApp.h"
FluWindowLifecycle::FluWindowLifecycle(QObject *parent):QObject{parent}{
}
void FluWindowLifecycle::onCompleted(QQuickWindow* window){
_window = window;
if(_window && _window->transientParent() == nullptr){
FluApp::getInstance()->addWindow(_window);
}
}
void FluWindowLifecycle::onDestroyOnClose(){
if(_window && _window->transientParent() == nullptr){
FluApp::getInstance()->removeWindow(_window);
_window = nullptr;
}
}
void FluWindowLifecycle::onDestruction(){
}
void FluWindowLifecycle::onVisible(bool visible){
}

View File

@ -1,28 +0,0 @@
#ifndef FLUWINDOWLIFECYCLE_H
#define FLUWINDOWLIFECYCLE_H
#include <QObject>
#include <QQuickWindow>
#include <QtQml/qqml.h>
#include <QQuickItem>
#include <QWindow>
#include <QJsonObject>
/**
* @brief The FluWindowLifecycle class
*/
class FluWindowLifecycle : public QObject
{
Q_OBJECT
QML_NAMED_ELEMENT(FluWindowLifecycle)
public:
explicit FluWindowLifecycle(QObject *parent = nullptr);
Q_INVOKABLE void onCompleted(QQuickWindow* window);
Q_INVOKABLE void onDestruction();
Q_INVOKABLE void onVisible(bool visible);
Q_INVOKABLE void onDestroyOnClose();
private:
QQuickWindow* _window = nullptr;
};
#endif // FLUWINDOWLIFECYCLE_H

View File

@ -1,7 +1,6 @@
#include "FluentUI.h"
#include <QGuiApplication>
#include "FluWindowLifecycle.h"
#include "Def.h"
#include "FluApp.h"
#include "FluColors.h"
@ -12,7 +11,6 @@
#include "FluCaptcha.h"
#include "FluEventBus.h"
#include "FluTreeModel.h"
#include "FluViewModel.h"
#include "FluRectangle.h"
#include "FluNetwork.h"
#include "FluFramelessHelper.h"
@ -27,13 +25,11 @@ void FluentUI::registerTypes(QQmlEngine *engine){
void FluentUI::registerTypes(const char *uri){
#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
Q_INIT_RESOURCE(fluentui);
qmlRegisterType<FluWindowLifecycle>(uri,major,minor,"FluWindowLifecycle");
qmlRegisterType<FluQrCodeItem>(uri,major,minor,"FluQrCodeItem");
qmlRegisterType<FluCaptcha>(uri,major,minor,"FluCaptcha");
qmlRegisterType<FluWatermark>(uri,major,minor,"FluWatermark");
qmlRegisterType<FluAccentColor>(uri,major,minor,"FluAccentColor");
qmlRegisterType<FluEvent>(uri,major,minor,"FluEvent");
qmlRegisterType<FluViewModel>(uri,major,minor,"FluViewModel");
qmlRegisterType<FluTreeModel>(uri,major,minor,"FluTreeModel");
qmlRegisterType<FluRectangle>(uri,major,minor,"FluRectangle");
qmlRegisterType<FluNetworkCallable>(uri,major,minor,"FluNetworkCallable");
@ -128,6 +124,9 @@ void FluentUI::registerTypes(const char *uri){
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluLoader.qml"),uri,major,minor,"FluLoader");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluShortcutPicker.qml"),uri,major,minor,"FluShortcutPicker");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluSplitLayout.qml"),uri,major,minor,"FluSplitLayout");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluWindowResultLauncher.qml"),uri,major,minor,"FluWindowResultLauncher");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluLauncher.qml"),uri,major,minor,"FluLauncher");
qmlRegisterSingletonType(QUrl("qrc:/qt/qml/FluentUI/Controls/FluRouter.qml"),uri,major,minor,"FluRouter");
qmlRegisterUncreatableMetaObject(Fluent_Awesome::staticMetaObject, uri,major,minor,"FluentIcons", "Access to enums & flags only");
qmlRegisterUncreatableMetaObject(FluThemeType::staticMetaObject, uri,major,minor,"FluThemeType", "Access to enums & flags only");
@ -141,7 +140,6 @@ void FluentUI::registerTypes(const char *uri){
qmlRegisterUncreatableMetaObject(FluTabViewType::staticMetaObject, uri,major,minor,"FluTabViewType", "Access to enums & flags only");
qmlRegisterUncreatableMetaObject(FluNavigationViewType::staticMetaObject, uri,major,minor,"FluNavigationViewType", "Access to enums & flags only");
qmlRegisterUncreatableMetaObject(FluTimelineType::staticMetaObject, uri,major,minor,"FluTimelineType", "Access to enums & flags only");
qmlRegisterUncreatableMetaObject(FluViewModelType::staticMetaObject, uri,major,minor,"FluViewModelType", "Access to enums & flags only");
qmlRegisterUncreatableMetaObject(FluNetworkType::staticMetaObject, uri,major,minor,"FluNetworkType", "Access to enums & flags only");
qmlRegisterModule(uri,major,minor);
@ -154,18 +152,11 @@ void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){
font.setFamily("微软雅黑");
QGuiApplication::setFont(font);
#endif
FluApp* app = FluApp::getInstance();
engine->rootContext()->setContextProperty("FluApp",app);
FluColors* colors = FluColors::getInstance();
engine->rootContext()->setContextProperty("FluColors",colors);
FluTheme* theme = FluTheme::getInstance();
engine->rootContext()->setContextProperty("FluTheme",theme);
FluTools* tools = FluTools::getInstance();
engine->rootContext()->setContextProperty("FluTools",tools);
FluTextStyle* textStyle = FluTextStyle::getInstance();
engine->rootContext()->setContextProperty("FluTextStyle",textStyle);
FluEventBus* eventBus = FluEventBus::getInstance();
engine->rootContext()->setContextProperty("FluEventBus",eventBus);
FluNetwork* network = FluNetwork::getInstance();
engine->rootContext()->setContextProperty("FluNetwork",network);
engine->rootContext()->setContextProperty("FluApp",FluApp::getInstance());
engine->rootContext()->setContextProperty("FluColors",FluColors::getInstance());
engine->rootContext()->setContextProperty("FluTheme",FluTheme::getInstance());
engine->rootContext()->setContextProperty("FluTools",FluTools::getInstance());
engine->rootContext()->setContextProperty("FluTextStyle",FluTextStyle::getInstance());
engine->rootContext()->setContextProperty("FluEventBus",FluEventBus::getInstance());
engine->rootContext()->setContextProperty("FluNetwork",FluNetwork::getInstance());
}

View File

@ -0,0 +1,6 @@
import QtQuick 2.15
import FluentUI 1.0
import "."
FluObject {
}

View File

@ -0,0 +1,71 @@
pragma Singleton
import QtQuick 2.15
QtObject {
property var routes : ({})
property var windows: []
function addWindow(window){
if(!window.transientParent){
windows.push(window)
}
}
function removeWindow(window) {
if(!window.transientParent){
var index = windows.indexOf(window)
if (index !== -1) {
windows.splice(index, 1)
FluTools.deleteLater(window)
}
}
}
function exit(retCode){
for(var i =0 ;i< windows.length; i++){
var item = windows[i]
FluTools.deleteLater(item)
}
windows = []
Qt.exit(retCode)
}
function navigate(route,argument={},windowRegister = undefined){
if(!routes.hasOwnProperty(route)){
console.error("Not Found Route",route)
return
}
var windowComponent = Qt.createComponent(routes[route])
if (windowComponent.status !== Component.Ready) {
console.error(windowComponent.errorString())
return
}
var properties = {}
properties._route = route
if(windowRegister){
properties._windowRegister = windowRegister
}
properties.argument = argument
var win = undefined
for(var i =0 ;i< windows.length; i++){
var item = windows[i]
if(route === item._route){
win = item
break
}
}
if(win){
var launchMode = win.launchMode
if(launchMode === 1){
win.argument = argument
win.show()
win.raise()
win.requestActivate()
return
}else if(launchMode === 2){
win.close()
}
}
win = windowComponent.createObject(null,properties)
if(windowRegister){
windowRegister._to = win
}
}
}

View File

@ -50,7 +50,7 @@ Window {
property int resizeBorderWidth: 1
property var closeListener: function(event){
if(autoDestroy){
destroyOnClose()
FluRouter.removeWindow(window)
}else{
window.visibility = Window.Hidden
event.accepted = false
@ -67,6 +67,7 @@ Window {
id:window
color:"transparent"
Component.onCompleted: {
FluRouter.addWindow(window)
_realHeight = height
_realWidth = width
useSystemAppBar = FluApp.useSystemAppBar
@ -74,7 +75,6 @@ Window {
moveWindowToDesktopCenter()
}
fixWindowSize()
lifecycle.onCompleted(window)
initArgument(argument)
if(!useSystemAppBar){
loader_frameless_helper.sourceComponent = com_frameless_helper
@ -87,9 +87,6 @@ Window {
}
}
}
Component.onDestruction: {
lifecycle.onDestruction()
}
onShowSystemMenu: {
if(loader_frameless_helper.item){
loader_frameless_helper.item.showSystemMenu()
@ -100,7 +97,6 @@ Window {
window.firstVisible()
d.isFirstVisible = false
}
lifecycle.onVisible(visible)
}
QtObject{
id:d
@ -244,9 +240,6 @@ Window {
id:info_bar
root: window
}
FluWindowLifecycle{
id:lifecycle
}
FluLoader{
id:loader_border
anchors.fill: parent
@ -263,9 +256,6 @@ Window {
return com_border
}
}
function destroyOnClose(){
lifecycle.onDestroyOnClose()
}
function showLoading(text = qsTr("Loading..."),cancel = true){
loader_loading.loadingText = text
loader_loading.cancel = cancel
@ -302,9 +292,9 @@ Window {
function registerForWindowResult(path){
return FluApp.createWindowRegister(window,path)
}
function onResult(data){
function setResult(data){
if(_windowRegister){
_windowRegister.onResult(data)
_windowRegister.setResult(data)
}
}
function showMaximized(){

View File

@ -0,0 +1,21 @@
import QtQuick 2.15
import QtQuick.Window 2.15
import FluentUI 1.0
Item {
id:control
property var _from : Window.window
property var _to
property var path
signal result(var data)
function launch(argument = {}){
FluRouter.navigate(control.path,argument,control)
}
function setResult(data = {}){
control.result(data)
}
}

View File

@ -0,0 +1 @@
singleton FluRouter 1.0 FluRouter.qml

View File

@ -90,5 +90,7 @@ FluTour 1.0 Controls/FluTour.qml
FluTreeView 1.0 Controls/FluTreeView.qml
FluWindow 1.0 Controls/FluWindow.qml
FluWindowDialog 1.0 Controls/FluWindowDialog.qml
FluWindowResultLauncher 1.0 Controls/FluWindowResultLauncher.qml
FluLauncher 1.0 Controls/FluLauncher.qml
plugin fluentuiplugin

View File

@ -101,5 +101,10 @@
<file>FluentUI/Controls/FluWindowDialog.qml</file>
<file>FluentUI/i18n/fluentui_en_US.qm</file>
<file>FluentUI/i18n/fluentui_zh_CN.qm</file>
<file>FluentUI/Controls/FluLauncher.qml</file>
<file>FluentUI/Controls/FluRouter.qml</file>
<file>FluentUI/Controls/FluWindowResultLauncher.qml</file>
<file>FluentUI/JS/Global.js</file>
<file>FluentUI/Controls/qmldir</file>
</qresource>
</RCC>

View File

@ -0,0 +1,7 @@
import QtQuick
import FluentUI
import "."
FluObject {
}

View File

@ -0,0 +1,72 @@
pragma Singleton
import QtQuick
import FluentUI
QtObject {
property var routes : ({})
property var windows: []
function addWindow(window){
if(!window.transientParent){
windows.push(window)
}
}
function removeWindow(window) {
if(!window.transientParent){
var index = windows.indexOf(window)
if (index !== -1) {
windows.splice(index, 1)
FluTools.deleteLater(window)
}
}
}
function exit(retCode){
for(var i =0 ;i< windows.length; i++){
var item = windows[i]
FluTools.deleteLater(item)
}
windows = []
Qt.exit(retCode)
}
function navigate(route,argument={},windowRegister = undefined){
if(!routes.hasOwnProperty(route)){
console.error("Not Found Route",route)
return
}
var windowComponent = Qt.createComponent(routes[route])
if (windowComponent.status !== Component.Ready) {
console.error(windowComponent.errorString())
return
}
var properties = {}
properties._route = route
if(windowRegister){
properties._windowRegister = windowRegister
}
properties.argument = argument
var win = undefined
for(var i =0 ;i< windows.length; i++){
var item = windows[i]
if(route === item._route){
win = item
break
}
}
if(win){
var launchMode = win.launchMode
if(launchMode === 1){
win.argument = argument
win.show()
win.raise()
win.requestActivate()
return
}else if(launchMode === 2){
win.close()
}
}
win = windowComponent.createObject(null,properties)
if(windowRegister){
windowRegister._to = win
}
}
}

View File

@ -49,7 +49,7 @@ Window {
property int resizeBorderWidth: 1
property var closeListener: function(event){
if(autoDestroy){
destroyOnClose()
FluRouter.removeWindow(window)
}else{
window.visibility = Window.Hidden
event.accepted = false
@ -66,6 +66,7 @@ Window {
id:window
color:"transparent"
Component.onCompleted: {
FluRouter.addWindow(window)
_realHeight = height
_realWidth = width
useSystemAppBar = FluApp.useSystemAppBar
@ -73,7 +74,6 @@ Window {
moveWindowToDesktopCenter()
}
fixWindowSize()
lifecycle.onCompleted(window)
initArgument(argument)
if(!useSystemAppBar){
loader_frameless_helper.sourceComponent = com_frameless_helper
@ -86,9 +86,6 @@ Window {
}
}
}
Component.onDestruction: {
lifecycle.onDestruction()
}
onShowSystemMenu: {
if(loader_frameless_helper.item){
loader_frameless_helper.item.showSystemMenu()
@ -99,7 +96,6 @@ Window {
window.firstVisible()
d.isFirstVisible = false
}
lifecycle.onVisible(visible)
}
QtObject{
id:d
@ -243,9 +239,6 @@ Window {
id:info_bar
root: window
}
FluWindowLifecycle{
id:lifecycle
}
FluLoader{
id:loader_border
anchors.fill: parent
@ -262,9 +255,6 @@ Window {
return com_border
}
}
function destroyOnClose(){
lifecycle.onDestroyOnClose()
}
function showLoading(text = qsTr("Loading..."),cancel = true){
loader_loading.loadingText = text
loader_loading.cancel = cancel
@ -301,9 +291,9 @@ Window {
function registerForWindowResult(path){
return FluApp.createWindowRegister(window,path)
}
function onResult(data){
function setResult(data){
if(_windowRegister){
_windowRegister.onResult(data)
_windowRegister.setResult(data)
}
}
function showMaximized(){

View File

@ -0,0 +1,20 @@
import QtQuick
import FluentUI
Item {
id:control
property var _from : Window.window
property var _to
property var path
signal result(var data)
function launch(argument = {}){
FluRouter.navigate(control.path,argument,control)
}
function setResult(data = {}){
control.result(data)
}
}

View File

@ -0,0 +1 @@
singleton FluRouter FluRouter.qml