diff --git a/.gitmodules b/.gitmodules index 24737ea4..b7bc368e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "framelesshelper"] - path = 3rdparty/framelesshelper - url = https://github.com/zhuzichu520/framelesshelper.git [submodule "zxing-cpp"] path = 3rdparty/zxing-cpp url = https://github.com/zhuzichu520/zxing-cpp.git \ No newline at end of file diff --git a/3rdparty/framelesshelper b/3rdparty/framelesshelper deleted file mode 160000 index 27fcd913..00000000 --- a/3rdparty/framelesshelper +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 27fcd913b4b21b51d5cca307e47e93d1ae75e1bb diff --git a/CMakeLists.txt b/CMakeLists.txt index cd253704..15227920 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,11 +37,6 @@ if (FLUENTUI_BUILD_EXAMPLES) add_subdirectory(example) endif () -set(FRAMELESSHELPER_BUILD_STATIC ON) -set(FRAMELESSHELPER_NO_DEBUG_OUTPUT ON) -set(FRAMELESSHELPER_BUILD_WIDGETS OFF) -add_subdirectory(3rdparty/framelesshelper) - message("------------------------ FluentUI ------------------------") message("Build FluentUI demo applications.: ${FLUENTUI_BUILD_EXAMPLES}") message("Build static library.: ${FLUENTUI_BUILD_STATIC_LIB}") diff --git a/example/qml-Qt6/window/MainWindow.qml b/example/qml-Qt6/window/MainWindow.qml index e2e61312..37838afc 100644 --- a/example/qml-Qt6/window/MainWindow.qml +++ b/example/qml-Qt6/window/MainWindow.qml @@ -297,7 +297,7 @@ FluWindow { id:tour steps:{ var data = [] - if(!window.useSystemAppBar){ + if(!FluApp.useSystemAppBar){ data.push({title:"夜间模式",description: "这里可以切换夜间模式.",target:()=>appBar.darkButton()}) } data.push({title:"隐藏彩蛋",description: "多点几下试试!!",target:()=>nav_view.logoButton()}) diff --git a/example/qml/window/MainWindow.qml b/example/qml/window/MainWindow.qml index 26c168ae..0d70319d 100644 --- a/example/qml/window/MainWindow.qml +++ b/example/qml/window/MainWindow.qml @@ -300,7 +300,7 @@ FluWindow { id:tour steps:{ var data = [] - if(!window.useSystemAppBar){ + if(!FluApp.useSystemAppBar){ data.push({title:"夜间模式",description: "这里可以切换夜间模式.",target:()=>appBar.darkButton()}) } data.push({title:"隐藏彩蛋",description: "多点几下试试!!",target:()=>nav_view.logoButton()}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 05729fd2..895dfe14 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -138,8 +138,6 @@ target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::QuickPrivate Qt${QT_VERSION_MAJOR}::QmlPrivate ZXing - FramelessHelper::Core - FramelessHelper::Quick ) #安装 diff --git a/src/FluApp.cpp b/src/FluApp.cpp index 409ca27d..7fbbb765 100644 --- a/src/FluApp.cpp +++ b/src/FluApp.cpp @@ -8,15 +8,10 @@ #include #include #include -#include -#include - -FRAMELESSHELPER_USE_NAMESPACE FluApp::FluApp(QObject *parent):QObject{parent}{ vsync(true); useSystemAppBar(false); - connect(this,&FluApp::useSystemAppBarChanged,this,[=]{FramelessConfig::instance()->set(Global::Option::UseSystemAppBar,_useSystemAppBar);}); } FluApp::~FluApp(){ @@ -24,11 +19,6 @@ FluApp::~FluApp(){ void FluApp::init(QObject *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); std::string jsFunction = R"( (function () { console.log("FluentUI");}) )"; QJSValue function = jsEngine->evaluate(QString::fromStdString(jsFunction)); diff --git a/src/FluentUI.cpp b/src/FluentUI.cpp index b476be87..bc8749fa 100644 --- a/src/FluentUI.cpp +++ b/src/FluentUI.cpp @@ -16,6 +16,7 @@ #include "Screenshot.h" #include "FluRectangle.h" #include "FluNetwork.h" +#include "FluFrameless.h" #include "QRCode.h" void FluentUI::registerTypes(QQmlEngine *engine){ @@ -40,6 +41,7 @@ void FluentUI::registerTypes(const char *uri){ qmlRegisterType(uri,major,minor,"FluRectangle"); qmlRegisterType(uri,major,minor,"FluNetworkCallable"); qmlRegisterType(uri,major,minor,"FluNetworkParams"); + qmlRegisterType(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/Content/Checkerboard.qml"),uri,major,minor,"Checkerboard"); diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index c3611db4..7099062e 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -3,7 +3,6 @@ import QtQuick.Window 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import FluentUI 1.0 -import org.wangwenx190.FramelessHelper 1.0 Window { default property alias content: container.data @@ -38,7 +37,7 @@ Window { property bool showMinimize: true property bool showMaximize: true property bool showStayTop: true - property bool useSystemAppBar + flags: Qt.Window | Qt.WindowTitleHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint | Qt.WindowCloseButtonHint property bool autoMaximize: false property var closeListener: function(event){ if(closeDestory){ @@ -51,26 +50,21 @@ Window { signal initArgument(var argument) signal firstVisible() id:window - maximumWidth: useSystemAppBar&&fixSize ? width : 16777215 - maximumHeight: useSystemAppBar&&fixSize ? height : 16777215 - minimumWidth: useSystemAppBar&&fixSize ? width : 0 - minimumHeight: useSystemAppBar&&fixSize ? height : 0 + maximumWidth: fixSize ? width : 16777215 + maximumHeight: fixSize ? height : 16777215 + minimumWidth: fixSize ? width : 0 + minimumHeight: fixSize ? height : 0 color:"transparent" onStayTopChanged: { d.changedStayTop() } Component.onCompleted: { - useSystemAppBar = FluApp.useSystemAppBar lifecycle.onCompleted(window) initArgument(argument) - d.changedStayTop() - if(useSystemAppBar){ - window.moveWindowToDesktopCenter() - if(window.autoMaximize){ - window.showMaximized() - }else{ - window.show() - } + if(window.autoMaximize){ + window.showMaximized() + }else{ + window.show() } } Component.onDestruction: { @@ -83,6 +77,14 @@ Window { } lifecycle.onVisible(visible) } + Component{ + id:com_frameless + FluFrameless{ + } + } + FluLoader{ + sourceComponent: FluApp.useSystemAppBar ? undefined : com_frameless + } QtObject{ id:d property bool isFirstVisible: true @@ -124,7 +126,7 @@ Window { left: parent.left right: parent.right } - sourceComponent: window.useSystemAppBar ? undefined : com_app_bar + sourceComponent: FluApp.useSystemAppBar ? undefined : com_app_bar } Component{ id:com_app_bar @@ -220,33 +222,6 @@ Window { id:infoBar 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{ id:lifecycle } @@ -259,10 +234,6 @@ Window { Component{ id:com_window_border Item{ - WindowBorder{ - anchors.fill: parent - visible: !FluTools.isLinux() - } Rectangle{ anchors.fill: parent color: Qt.rgba(0,0,0,0) @@ -303,9 +274,6 @@ Window { function registerForWindowResult(path){ return lifecycle.createRegister(window,path) } - function moveWindowToDesktopCenter(){ - return framless_helper.moveWindowToDesktopCenter() - } function onResult(data){ if(_pageRegister){ _pageRegister.onResult(data) diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index b3855535..64a36262 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts import FluentUI -import org.wangwenx190.FramelessHelper Window { default property alias content: container.data @@ -37,7 +36,7 @@ Window { property bool showMinimize: true property bool showMaximize: 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 var closeListener: function(event){ if(closeDestory){ @@ -50,26 +49,21 @@ Window { signal initArgument(var argument) signal firstVisible() id:window - maximumWidth: useSystemAppBar&&fixSize ? width : 16777215 - maximumHeight: useSystemAppBar&&fixSize ? height : 16777215 - minimumWidth: useSystemAppBar&&fixSize ? width : 0 - minimumHeight: useSystemAppBar&&fixSize ? height : 0 + maximumWidth: fixSize ? width : 16777215 + maximumHeight: fixSize ? height : 16777215 + minimumWidth: fixSize ? width : 0 + minimumHeight: fixSize ? height : 0 color:"transparent" onStayTopChanged: { d.changedStayTop() } Component.onCompleted: { - useSystemAppBar = FluApp.useSystemAppBar lifecycle.onCompleted(window) initArgument(argument) - d.changedStayTop() - if(useSystemAppBar){ - window.moveWindowToDesktopCenter() - if(window.autoMaximize){ - window.showMaximized() - }else{ - window.show() - } + if(window.autoMaximize){ + window.showMaximized() + }else{ + window.show() } } Component.onDestruction: { @@ -82,6 +76,14 @@ Window { } lifecycle.onVisible(visible) } + Component{ + id:com_frameless + FluFrameless{ + } + } + FluLoader{ + sourceComponent: FluApp.useSystemAppBar ? undefined : com_frameless + } QtObject{ id:d property bool isFirstVisible: true @@ -123,7 +125,7 @@ Window { left: parent.left right: parent.right } - sourceComponent: window.useSystemAppBar ? undefined : com_app_bar + sourceComponent: FluApp.useSystemAppBar ? undefined : com_app_bar } Component{ id:com_app_bar @@ -219,33 +221,6 @@ Window { id:infoBar 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{ id:lifecycle } @@ -258,10 +233,6 @@ Window { Component{ id:com_window_border Item{ - WindowBorder{ - anchors.fill: parent - visible: !FluTools.isLinux() - } Rectangle{ anchors.fill: parent color: Qt.rgba(0,0,0,0) @@ -302,9 +273,6 @@ Window { function registerForWindowResult(path){ return lifecycle.createRegister(window,path) } - function moveWindowToDesktopCenter(){ - return framless_helper.moveWindowToDesktopCenter() - } function onResult(data){ if(_pageRegister){ _pageRegister.onResult(data)