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"]
path = 3rdparty/zxing-cpp
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)
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}")

View File

@ -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()})

View File

@ -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()})

View File

@ -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
)
#

View File

@ -8,15 +8,10 @@
#include <QUuid>
#include <QFontDatabase>
#include <QClipboard>
#include <FramelessHelper/Quick/framelessquickmodule.h>
#include <FramelessHelper/Core/private/framelessconfig_p.h>
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));

View File

@ -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<FluRectangle>(uri,major,minor,"FluRectangle");
qmlRegisterType<NetworkCallable>(uri,major,minor,"FluNetworkCallable");
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/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.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)

View File

@ -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)