This commit is contained in:
朱子楚\zhuzi 2023-12-11 23:43:17 +08:00
parent 6c86e61916
commit dc37a151c8
10 changed files with 40 additions and 123 deletions

3
.gitmodules vendored
View File

@ -1,6 +1,3 @@
[submodule "framelesshelper"]
path = 3rdparty/framelesshelper
url = https://github.com/zhuzichu520/framelesshelper.git
[submodule "zxing-cpp"] [submodule "zxing-cpp"]
path = 3rdparty/zxing-cpp path = 3rdparty/zxing-cpp
url = https://github.com/zhuzichu520/zxing-cpp.git url = https://github.com/zhuzichu520/zxing-cpp.git

@ -1 +0,0 @@
Subproject commit 27fcd913b4b21b51d5cca307e47e93d1ae75e1bb

View File

@ -37,11 +37,6 @@ if (FLUENTUI_BUILD_EXAMPLES)
add_subdirectory(example) add_subdirectory(example)
endif () endif ()
set(FRAMELESSHELPER_BUILD_STATIC ON)
set(FRAMELESSHELPER_NO_DEBUG_OUTPUT ON)
set(FRAMELESSHELPER_BUILD_WIDGETS OFF)
add_subdirectory(3rdparty/framelesshelper)
message("------------------------ FluentUI ------------------------") message("------------------------ FluentUI ------------------------")
message("Build FluentUI demo applications.: ${FLUENTUI_BUILD_EXAMPLES}") message("Build FluentUI demo applications.: ${FLUENTUI_BUILD_EXAMPLES}")
message("Build static library.: ${FLUENTUI_BUILD_STATIC_LIB}") message("Build static library.: ${FLUENTUI_BUILD_STATIC_LIB}")

View File

@ -297,7 +297,7 @@ FluWindow {
id:tour id:tour
steps:{ steps:{
var data = [] var data = []
if(!window.useSystemAppBar){ if(!FluApp.useSystemAppBar){
data.push({title:"夜间模式",description: "这里可以切换夜间模式.",target:()=>appBar.darkButton()}) data.push({title:"夜间模式",description: "这里可以切换夜间模式.",target:()=>appBar.darkButton()})
} }
data.push({title:"隐藏彩蛋",description: "多点几下试试!!",target:()=>nav_view.logoButton()}) data.push({title:"隐藏彩蛋",description: "多点几下试试!!",target:()=>nav_view.logoButton()})

View File

@ -300,7 +300,7 @@ FluWindow {
id:tour id:tour
steps:{ steps:{
var data = [] var data = []
if(!window.useSystemAppBar){ if(!FluApp.useSystemAppBar){
data.push({title:"夜间模式",description: "这里可以切换夜间模式.",target:()=>appBar.darkButton()}) data.push({title:"夜间模式",description: "这里可以切换夜间模式.",target:()=>appBar.darkButton()})
} }
data.push({title:"隐藏彩蛋",description: "多点几下试试!!",target:()=>nav_view.logoButton()}) data.push({title:"隐藏彩蛋",description: "多点几下试试!!",target:()=>nav_view.logoButton()})

View File

@ -138,8 +138,6 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
Qt${QT_VERSION_MAJOR}::QuickPrivate Qt${QT_VERSION_MAJOR}::QuickPrivate
Qt${QT_VERSION_MAJOR}::QmlPrivate Qt${QT_VERSION_MAJOR}::QmlPrivate
ZXing ZXing
FramelessHelper::Core
FramelessHelper::Quick
) )
# #

View File

@ -8,15 +8,10 @@
#include <QUuid> #include <QUuid>
#include <QFontDatabase> #include <QFontDatabase>
#include <QClipboard> #include <QClipboard>
#include <FramelessHelper/Quick/framelessquickmodule.h>
#include <FramelessHelper/Core/private/framelessconfig_p.h>
FRAMELESSHELPER_USE_NAMESPACE
FluApp::FluApp(QObject *parent):QObject{parent}{ FluApp::FluApp(QObject *parent):QObject{parent}{
vsync(true); vsync(true);
useSystemAppBar(false); useSystemAppBar(false);
connect(this,&FluApp::useSystemAppBarChanged,this,[=]{FramelessConfig::instance()->set(Global::Option::UseSystemAppBar,_useSystemAppBar);});
} }
FluApp::~FluApp(){ FluApp::~FluApp(){
@ -24,11 +19,6 @@ FluApp::~FluApp(){
void FluApp::init(QObject *application){ void FluApp::init(QObject *application){
this->_application = application; this->_application = application;
FramelessHelperQuickInitialize();
FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial);
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
QQmlEngine *engine = qmlEngine(_application);
FramelessHelper::Quick::registerTypes(engine);
QJSEngine * jsEngine = qjsEngine(_application); QJSEngine * jsEngine = qjsEngine(_application);
std::string jsFunction = R"( (function () { console.log("FluentUI");}) )"; std::string jsFunction = R"( (function () { console.log("FluentUI");}) )";
QJSValue function = jsEngine->evaluate(QString::fromStdString(jsFunction)); QJSValue function = jsEngine->evaluate(QString::fromStdString(jsFunction));

View File

@ -16,6 +16,7 @@
#include "Screenshot.h" #include "Screenshot.h"
#include "FluRectangle.h" #include "FluRectangle.h"
#include "FluNetwork.h" #include "FluNetwork.h"
#include "FluFrameless.h"
#include "QRCode.h" #include "QRCode.h"
void FluentUI::registerTypes(QQmlEngine *engine){ void FluentUI::registerTypes(QQmlEngine *engine){
@ -40,6 +41,7 @@ void FluentUI::registerTypes(const char *uri){
qmlRegisterType<FluRectangle>(uri,major,minor,"FluRectangle"); qmlRegisterType<FluRectangle>(uri,major,minor,"FluRectangle");
qmlRegisterType<NetworkCallable>(uri,major,minor,"FluNetworkCallable"); qmlRegisterType<NetworkCallable>(uri,major,minor,"FluNetworkCallable");
qmlRegisterType<NetworkParams>(uri,major,minor,"FluNetworkParams"); qmlRegisterType<NetworkParams>(uri,major,minor,"FluNetworkParams");
qmlRegisterType<FluFrameless>(uri,major,minor,"FluFrameless");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/ColorPicker/ColorPicker.qml"),uri,major,minor,"ColorPicker"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/ColorPicker/ColorPicker.qml"),uri,major,minor,"ColorPicker");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/ColorPicker/Content/Checkerboard.qml"),uri,major,minor,"Checkerboard"); qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/ColorPicker/Content/Checkerboard.qml"),uri,major,minor,"Checkerboard");

View File

@ -3,7 +3,6 @@ import QtQuick.Window 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import FluentUI 1.0 import FluentUI 1.0
import org.wangwenx190.FramelessHelper 1.0
Window { Window {
default property alias content: container.data default property alias content: container.data
@ -38,7 +37,7 @@ Window {
property bool showMinimize: true property bool showMinimize: true
property bool showMaximize: true property bool showMaximize: true
property bool showStayTop: true property bool showStayTop: true
property bool useSystemAppBar flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint
property bool autoMaximize: false property bool autoMaximize: false
property var closeListener: function(event){ property var closeListener: function(event){
if(closeDestory){ if(closeDestory){
@ -51,28 +50,23 @@ Window {
signal initArgument(var argument) signal initArgument(var argument)
signal firstVisible() signal firstVisible()
id:window id:window
maximumWidth: useSystemAppBar&&fixSize ? width : 16777215 maximumWidth: fixSize ? width : 16777215
maximumHeight: useSystemAppBar&&fixSize ? height : 16777215 maximumHeight: fixSize ? height : 16777215
minimumWidth: useSystemAppBar&&fixSize ? width : 0 minimumWidth: fixSize ? width : 0
minimumHeight: useSystemAppBar&&fixSize ? height : 0 minimumHeight: fixSize ? height : 0
color:"transparent" color:"transparent"
onStayTopChanged: { onStayTopChanged: {
d.changedStayTop() d.changedStayTop()
} }
Component.onCompleted: { Component.onCompleted: {
useSystemAppBar = FluApp.useSystemAppBar
lifecycle.onCompleted(window) lifecycle.onCompleted(window)
initArgument(argument) initArgument(argument)
d.changedStayTop()
if(useSystemAppBar){
window.moveWindowToDesktopCenter()
if(window.autoMaximize){ if(window.autoMaximize){
window.showMaximized() window.showMaximized()
}else{ }else{
window.show() window.show()
} }
} }
}
Component.onDestruction: { Component.onDestruction: {
lifecycle.onDestruction() lifecycle.onDestruction()
} }
@ -83,6 +77,14 @@ Window {
} }
lifecycle.onVisible(visible) lifecycle.onVisible(visible)
} }
Component{
id:com_frameless
FluFrameless{
}
}
FluLoader{
sourceComponent: FluApp.useSystemAppBar ? undefined : com_frameless
}
QtObject{ QtObject{
id:d id:d
property bool isFirstVisible: true property bool isFirstVisible: true
@ -124,7 +126,7 @@ Window {
left: parent.left left: parent.left
right: parent.right right: parent.right
} }
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar sourceComponent: FluApp.useSystemAppBar ? undefined : com_app_bar
} }
Component{ Component{
id:com_app_bar id:com_app_bar
@ -220,33 +222,6 @@ Window {
id:infoBar id:infoBar
root: window root: window
} }
Connections{
target: FluTheme
function onDarkChanged(){
if (FluTheme.dark)
FramelessUtils.systemTheme = FramelessHelperConstants.Dark
else
FramelessUtils.systemTheme = FramelessHelperConstants.Light
}
}
FramelessHelper{
id:framless_helper
onReady: {
flags = flags | Qt.Window | Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint
if(appBar){
var appbar = window.appBar
window.moveWindowToDesktopCenter()
setWindowFixedSize(fixSize)
if (blurBehindWindowEnabled)
window.background = undefined
}
if(window.autoMaximize){
window.showMaximized()
}else{
window.show()
}
}
}
WindowLifecycle{ WindowLifecycle{
id:lifecycle id:lifecycle
} }
@ -259,10 +234,6 @@ Window {
Component{ Component{
id:com_window_border id:com_window_border
Item{ Item{
WindowBorder{
anchors.fill: parent
visible: !FluTools.isLinux()
}
Rectangle{ Rectangle{
anchors.fill: parent anchors.fill: parent
color: Qt.rgba(0,0,0,0) color: Qt.rgba(0,0,0,0)
@ -303,9 +274,6 @@ Window {
function registerForWindowResult(path){ function registerForWindowResult(path){
return lifecycle.createRegister(window,path) return lifecycle.createRegister(window,path)
} }
function moveWindowToDesktopCenter(){
return framless_helper.moveWindowToDesktopCenter()
}
function onResult(data){ function onResult(data){
if(_pageRegister){ if(_pageRegister){
_pageRegister.onResult(data) _pageRegister.onResult(data)

View File

@ -2,7 +2,6 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import FluentUI import FluentUI
import org.wangwenx190.FramelessHelper
Window { Window {
default property alias content: container.data default property alias content: container.data
@ -37,7 +36,7 @@ Window {
property bool showMinimize: true property bool showMinimize: true
property bool showMaximize: true property bool showMaximize: true
property bool showStayTop: true property bool showStayTop: true
property bool useSystemAppBar flags: Qt.Window | Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint
property bool autoMaximize: false property bool autoMaximize: false
property var closeListener: function(event){ property var closeListener: function(event){
if(closeDestory){ if(closeDestory){
@ -50,28 +49,23 @@ Window {
signal initArgument(var argument) signal initArgument(var argument)
signal firstVisible() signal firstVisible()
id:window id:window
maximumWidth: useSystemAppBar&&fixSize ? width : 16777215 maximumWidth: fixSize ? width : 16777215
maximumHeight: useSystemAppBar&&fixSize ? height : 16777215 maximumHeight: fixSize ? height : 16777215
minimumWidth: useSystemAppBar&&fixSize ? width : 0 minimumWidth: fixSize ? width : 0
minimumHeight: useSystemAppBar&&fixSize ? height : 0 minimumHeight: fixSize ? height : 0
color:"transparent" color:"transparent"
onStayTopChanged: { onStayTopChanged: {
d.changedStayTop() d.changedStayTop()
} }
Component.onCompleted: { Component.onCompleted: {
useSystemAppBar = FluApp.useSystemAppBar
lifecycle.onCompleted(window) lifecycle.onCompleted(window)
initArgument(argument) initArgument(argument)
d.changedStayTop()
if(useSystemAppBar){
window.moveWindowToDesktopCenter()
if(window.autoMaximize){ if(window.autoMaximize){
window.showMaximized() window.showMaximized()
}else{ }else{
window.show() window.show()
} }
} }
}
Component.onDestruction: { Component.onDestruction: {
lifecycle.onDestruction() lifecycle.onDestruction()
} }
@ -82,6 +76,14 @@ Window {
} }
lifecycle.onVisible(visible) lifecycle.onVisible(visible)
} }
Component{
id:com_frameless
FluFrameless{
}
}
FluLoader{
sourceComponent: FluApp.useSystemAppBar ? undefined : com_frameless
}
QtObject{ QtObject{
id:d id:d
property bool isFirstVisible: true property bool isFirstVisible: true
@ -123,7 +125,7 @@ Window {
left: parent.left left: parent.left
right: parent.right right: parent.right
} }
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar sourceComponent: FluApp.useSystemAppBar ? undefined : com_app_bar
} }
Component{ Component{
id:com_app_bar id:com_app_bar
@ -219,33 +221,6 @@ Window {
id:infoBar id:infoBar
root: window root: window
} }
Connections{
target: FluTheme
function onDarkChanged(){
if (FluTheme.dark)
FramelessUtils.systemTheme = FramelessHelperConstants.Dark
else
FramelessUtils.systemTheme = FramelessHelperConstants.Light
}
}
FramelessHelper{
id:framless_helper
onReady: {
flags = flags | Qt.Window | Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint
if(appBar){
var appbar = window.appBar
window.moveWindowToDesktopCenter()
setWindowFixedSize(fixSize)
if (blurBehindWindowEnabled)
window.background = undefined
}
if(window.autoMaximize){
window.showMaximized()
}else{
window.show()
}
}
}
WindowLifecycle{ WindowLifecycle{
id:lifecycle id:lifecycle
} }
@ -258,10 +233,6 @@ Window {
Component{ Component{
id:com_window_border id:com_window_border
Item{ Item{
WindowBorder{
anchors.fill: parent
visible: !FluTools.isLinux()
}
Rectangle{ Rectangle{
anchors.fill: parent anchors.fill: parent
color: Qt.rgba(0,0,0,0) color: Qt.rgba(0,0,0,0)
@ -302,9 +273,6 @@ Window {
function registerForWindowResult(path){ function registerForWindowResult(path){
return lifecycle.createRegister(window,path) return lifecycle.createRegister(window,path)
} }
function moveWindowToDesktopCenter(){
return framless_helper.moveWindowToDesktopCenter()
}
function onResult(data){ function onResult(data){
if(_pageRegister){ if(_pageRegister){
_pageRegister.onResult(data) _pageRegister.onResult(data)