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 #Cpp
message("---------->${filename}")
file(GLOB_RECURSE CPP_FILES *.cpp *.h) file(GLOB_RECURSE CPP_FILES *.cpp *.h)
foreach(filepath ${CPP_FILES}) foreach(filepath ${CPP_FILES})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath}) string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
message(${filename})
list(APPEND sources_files ${filename}) list(APPEND sources_files ${filename})
endforeach(filepath) endforeach(filepath)

View File

@ -181,8 +181,6 @@
<file>res/image/image_1.jpg</file> <file>res/image/image_1.jpg</file>
<file>qml/window/PageWindow.qml</file> <file>qml/window/PageWindow.qml</file>
<file>qml/page/T_StaggeredLayout.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_Clip.qml</file>
<file>qml/page/T_3D.qml</file> <file>qml/page/T_3D.qml</file>
<file>qml/page/T_Network.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/qml.qrc.in</file>
<file>res/template/src/zh_CN.ts.in</file> <file>res/template/src/zh_CN.ts.in</file>
<file>res/template/src/README.md.in</file> <file>res/template/src/README.md.in</file>
<file>qml/global/GlobalModel.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

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

View File

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

View File

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

View File

@ -462,7 +462,7 @@ FluObject{
FluPaneItem{ FluPaneItem{
title: qsTr("Hot Loader") title: qsTr("Hot Loader")
onTapListener: function(){ onTapListener: function(){
FluApp.navigate("/hotload") FluRouter.navigate("/hotload")
} }
} }
FluPaneItem{ 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 ItemsFooter 1.0 ItemsFooter.qml
singleton GlobalModel 1.0 GlobalModel.qml

View File

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

View File

@ -4,17 +4,12 @@ import QtQuick.Window 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import FluentUI 1.0 import FluentUI 1.0
import "../component" import "../component"
import "../viewmodel"
import "../global" import "../global"
FluScrollablePage{ FluScrollablePage{
title: qsTr("Settings") title: qsTr("Settings")
SettingsViewModel{
id:viewmodel_settings
}
FluEvent{ FluEvent{
id:event_checkupdate_finish id:event_checkupdate_finish
name: "checkUpdateFinish" name: "checkUpdateFinish"
@ -95,7 +90,7 @@ FluScrollablePage{
negativeText: qsTr("Cancel") negativeText: qsTr("Cancel")
positiveText: qsTr("OK") positiveText: qsTr("OK")
onPositiveClicked: { onPositiveClicked: {
FluApp.exit(931) FluRouter.exit(931)
} }
} }
@ -149,10 +144,10 @@ FluScrollablePage{
Repeater{ 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}] 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{ delegate: FluRadioButton{
checked : viewmodel_settings.displayMode===modelData.mode text: modelData.title
text:modelData.title checked: GlobalModel.displayMode === modelData.mode
clickListener:function(){ 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 QtQuick.Window 2.15
import FluentUI 1.0 import FluentUI 1.0
import "../component" import "../component"
import "../viewmodel"
FluScrollablePage{ FluScrollablePage{
title: qsTr("TextBox") title: qsTr("TextBox")
TextBoxViewModel{
id:viewModel
}
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
height: 68 height: 68
@ -24,10 +19,6 @@ FluScrollablePage{
placeholderText: qsTr("Single-line Input Box") placeholderText: qsTr("Single-line Input Box")
disabled: text_box_switch.checked disabled: text_box_switch.checked
cleanEnabled: true cleanEnabled: true
text: viewModel.text1
onTextChanged: {
viewModel.text1 = text
}
anchors{ anchors{
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
@ -82,7 +73,6 @@ FluScrollablePage{
}' }'
} }
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
height: 36+multiine_textbox.height height: 36+multiine_textbox.height
@ -92,10 +82,6 @@ FluScrollablePage{
FluMultilineTextBox{ FluMultilineTextBox{
id: multiine_textbox id: multiine_textbox
placeholderText: qsTr("Multi-line Input Box") placeholderText: qsTr("Multi-line Input Box")
text:viewModel.text2
onTextChanged: {
viewModel.text2 = text
}
disabled: text_box_multi_switch.checked disabled: text_box_multi_switch.checked
anchors{ anchors{
verticalCenter: parent.verticalCenter 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{ MouseArea{
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
FluApp.navigate("/") FluRouter.navigate("/")
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,20 +10,6 @@
#include <QClipboard> #include <QClipboard>
#include <QTranslator> #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}{ FluApp::FluApp(QObject *parent):QObject{parent}{
useSystemAppBar(false); 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 <QObject>
#include <QWindow> #include <QWindow>
#include <QtQml/qqml.h> #include <QtQml/qqml.h>
#include <QJsonArray>
#include <QQmlContext> #include <QQmlContext>
#include <QJsonObject> #include <QJsonObject>
#include <QQmlEngine> #include <QQmlEngine>
@ -13,31 +12,12 @@
#include "stdafx.h" #include "stdafx.h"
#include "singleton.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 * @brief The FluApp class
*/ */
class FluApp : public QObject class FluApp : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY_AUTO(QString,initialRoute);
Q_PROPERTY_AUTO(QJsonObject,routes);
Q_PROPERTY_AUTO(bool,useSystemAppBar); Q_PROPERTY_AUTO(bool,useSystemAppBar);
Q_PROPERTY_AUTO(QString,windowIcon); Q_PROPERTY_AUTO(QString,windowIcon);
Q_PROPERTY_AUTO(QLocale,locale); Q_PROPERTY_AUTO(QLocale,locale);
@ -49,15 +29,8 @@ private:
public: public:
SINGLETON(FluApp) SINGLETON(FluApp)
static FluApp *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return getInstance();} 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 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: private:
QMap<quint64, QQuickWindow*> _windows;
QQmlEngine *_engine; QQmlEngine *_engine;
QTranslator* _translator = nullptr; QTranslator* _translator = nullptr;
}; };

View File

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

View File

@ -34,7 +34,7 @@ public:
Q_INVOKABLE void restoreOverrideCursor(); Q_INVOKABLE void restoreOverrideCursor();
Q_INVOKABLE QString html2PlantText(const QString& html); Q_INVOKABLE QString html2PlantText(const QString& html);
Q_INVOKABLE QString toLocalPath(const QUrl& url); 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 QString getFileNameByUrl(const QUrl& url);
Q_INVOKABLE QRect getVirtualGeometry(); Q_INVOKABLE QRect getVirtualGeometry();
Q_INVOKABLE QString getApplicationDirPath(); 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 "FluentUI.h"
#include <QGuiApplication> #include <QGuiApplication>
#include "FluWindowLifecycle.h"
#include "Def.h" #include "Def.h"
#include "FluApp.h" #include "FluApp.h"
#include "FluColors.h" #include "FluColors.h"
@ -12,7 +11,6 @@
#include "FluCaptcha.h" #include "FluCaptcha.h"
#include "FluEventBus.h" #include "FluEventBus.h"
#include "FluTreeModel.h" #include "FluTreeModel.h"
#include "FluViewModel.h"
#include "FluRectangle.h" #include "FluRectangle.h"
#include "FluNetwork.h" #include "FluNetwork.h"
#include "FluFramelessHelper.h" #include "FluFramelessHelper.h"
@ -27,13 +25,11 @@ void FluentUI::registerTypes(QQmlEngine *engine){
void FluentUI::registerTypes(const char *uri){ void FluentUI::registerTypes(const char *uri){
#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0)) #if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
Q_INIT_RESOURCE(fluentui); Q_INIT_RESOURCE(fluentui);
qmlRegisterType<FluWindowLifecycle>(uri,major,minor,"FluWindowLifecycle");
qmlRegisterType<FluQrCodeItem>(uri,major,minor,"FluQrCodeItem"); qmlRegisterType<FluQrCodeItem>(uri,major,minor,"FluQrCodeItem");
qmlRegisterType<FluCaptcha>(uri,major,minor,"FluCaptcha"); qmlRegisterType<FluCaptcha>(uri,major,minor,"FluCaptcha");
qmlRegisterType<FluWatermark>(uri,major,minor,"FluWatermark"); qmlRegisterType<FluWatermark>(uri,major,minor,"FluWatermark");
qmlRegisterType<FluAccentColor>(uri,major,minor,"FluAccentColor"); qmlRegisterType<FluAccentColor>(uri,major,minor,"FluAccentColor");
qmlRegisterType<FluEvent>(uri,major,minor,"FluEvent"); qmlRegisterType<FluEvent>(uri,major,minor,"FluEvent");
qmlRegisterType<FluViewModel>(uri,major,minor,"FluViewModel");
qmlRegisterType<FluTreeModel>(uri,major,minor,"FluTreeModel"); qmlRegisterType<FluTreeModel>(uri,major,minor,"FluTreeModel");
qmlRegisterType<FluRectangle>(uri,major,minor,"FluRectangle"); qmlRegisterType<FluRectangle>(uri,major,minor,"FluRectangle");
qmlRegisterType<FluNetworkCallable>(uri,major,minor,"FluNetworkCallable"); 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/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/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/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(Fluent_Awesome::staticMetaObject, uri,major,minor,"FluentIcons", "Access to enums & flags only");
qmlRegisterUncreatableMetaObject(FluThemeType::staticMetaObject, uri,major,minor,"FluThemeType", "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(FluTabViewType::staticMetaObject, uri,major,minor,"FluTabViewType", "Access to enums & flags only");
qmlRegisterUncreatableMetaObject(FluNavigationViewType::staticMetaObject, uri,major,minor,"FluNavigationViewType", "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(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"); qmlRegisterUncreatableMetaObject(FluNetworkType::staticMetaObject, uri,major,minor,"FluNetworkType", "Access to enums & flags only");
qmlRegisterModule(uri,major,minor); qmlRegisterModule(uri,major,minor);
@ -154,18 +152,11 @@ void FluentUI::initializeEngine(QQmlEngine *engine, const char *uri){
font.setFamily("微软雅黑"); font.setFamily("微软雅黑");
QGuiApplication::setFont(font); QGuiApplication::setFont(font);
#endif #endif
FluApp* app = FluApp::getInstance(); engine->rootContext()->setContextProperty("FluApp",FluApp::getInstance());
engine->rootContext()->setContextProperty("FluApp",app); engine->rootContext()->setContextProperty("FluColors",FluColors::getInstance());
FluColors* colors = FluColors::getInstance(); engine->rootContext()->setContextProperty("FluTheme",FluTheme::getInstance());
engine->rootContext()->setContextProperty("FluColors",colors); engine->rootContext()->setContextProperty("FluTools",FluTools::getInstance());
FluTheme* theme = FluTheme::getInstance(); engine->rootContext()->setContextProperty("FluTextStyle",FluTextStyle::getInstance());
engine->rootContext()->setContextProperty("FluTheme",theme); engine->rootContext()->setContextProperty("FluEventBus",FluEventBus::getInstance());
FluTools* tools = FluTools::getInstance(); engine->rootContext()->setContextProperty("FluNetwork",FluNetwork::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);
} }

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

View File

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