From f30d7a0f57cba5e178fe1088ffe6f4443581eaae Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Tue, 22 Mar 2022 10:50:47 +0800 Subject: [PATCH] wip Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- .../Quick/FramelessQuickWindow | 1 + .../Quick/framelessquickwindow.h | 22 +--------------- src/core/framelesshelpercore.qrc | 2 -- src/quick/CMakeLists.txt | 2 ++ src/quick/framelesshelper_quick.cpp | 1 - src/quick/framelesshelperquick.qrc | 1 - src/quick/framelessquickwindow.cpp | 25 +++++++++++++++++++ src/quick/framelessquickwindow.h | 25 +++++++++++++++++++ 8 files changed, 54 insertions(+), 25 deletions(-) create mode 100644 include/FramelessHelper/Quick/FramelessQuickWindow rename src/quick/qml/FramelessWindow.qml => include/FramelessHelper/Quick/framelessquickwindow.h (65%) create mode 100644 src/quick/framelessquickwindow.cpp create mode 100644 src/quick/framelessquickwindow.h diff --git a/include/FramelessHelper/Quick/FramelessQuickWindow b/include/FramelessHelper/Quick/FramelessQuickWindow new file mode 100644 index 0000000..06e08be --- /dev/null +++ b/include/FramelessHelper/Quick/FramelessQuickWindow @@ -0,0 +1 @@ +#include diff --git a/src/quick/qml/FramelessWindow.qml b/include/FramelessHelper/Quick/framelessquickwindow.h similarity index 65% rename from src/quick/qml/FramelessWindow.qml rename to include/FramelessHelper/Quick/framelessquickwindow.h index 2ac0e62..f00cb06 100644 --- a/src/quick/qml/FramelessWindow.qml +++ b/include/FramelessHelper/Quick/framelessquickwindow.h @@ -22,24 +22,4 @@ * SOFTWARE. */ -import QtQuick 2.0 -import QtQuick.Window 2.0 -import org.wangwenx190.FramelessHelper 1.0 - -Window { - property alias windowTopBorder: windowTopBorder - - id: window - Component.onCompleted: FramelessHelper.addWindow(window) - - Rectangle { - id: windowTopBorder - anchors { - top: parent.top - left: parent.left - right: parent.right - } - height: ((window.visibility === Window.Windowed) && FramelessUtils.frameBorderVisible) ? 1 : 0 - color: window.active ? FramelessUtils.frameBorderActiveColor : FramelessUtils.frameBorderInactiveColor - } -} +#pragma once diff --git a/src/core/framelesshelpercore.qrc b/src/core/framelesshelpercore.qrc index 2c99254..2bad58a 100644 --- a/src/core/framelesshelpercore.qrc +++ b/src/core/framelesshelpercore.qrc @@ -1,7 +1,5 @@ - images/LICENSE - images/LICENSE-CODE images/dark/chrome-close.svg images/dark/chrome-maximize.svg images/dark/chrome-minimize.svg diff --git a/src/quick/CMakeLists.txt b/src/quick/CMakeLists.txt index 31bf7d0..aa3e404 100644 --- a/src/quick/CMakeLists.txt +++ b/src/quick/CMakeLists.txt @@ -9,12 +9,14 @@ set(SOURCES ${INCLUDE_PREFIX}/framelesshelperimageprovider.h ${INCLUDE_PREFIX}/framelessquickeventfilter.h ${INCLUDE_PREFIX}/framelesshelper_quick.h + ${INCLUDE_PREFIX}/framelessquickwindow.h framelesshelperquick.qrc framelesshelper_quick.cpp framelessquickhelper.cpp framelessquickutils.cpp framelesshelperimageprovider.cpp framelessquickeventfilter.cpp + framelessquickwindow.cpp ) if(WIN32 AND NOT FRAMELESSHELPER_BUILD_STATIC) diff --git a/src/quick/framelesshelper_quick.cpp b/src/quick/framelesshelper_quick.cpp index 389a0a0..754e771 100644 --- a/src/quick/framelesshelper_quick.cpp +++ b/src/quick/framelesshelper_quick.cpp @@ -69,7 +69,6 @@ void FramelessHelper::Quick::registerTypes(QQmlEngine *engine) qmlRegisterType(getQmlFileUrl(QStringLiteral("MaximizeButton")), FRAMELESSHELPER_QUICK_URI, 1, 0, "MaximizeButton"); qmlRegisterType(getQmlFileUrl(QStringLiteral("CloseButton")), FRAMELESSHELPER_QUICK_URI, 1, 0, "CloseButton"); qmlRegisterType(getQmlFileUrl(QStringLiteral("StandardTitleBar")), FRAMELESSHELPER_QUICK_URI, 1, 0, "StandardTitleBar"); - qmlRegisterType(getQmlFileUrl(QStringLiteral("FramelessWindow")), FRAMELESSHELPER_QUICK_URI, 1, 0, "FramelessWindow"); } FRAMELESSHELPER_END_NAMESPACE diff --git a/src/quick/framelesshelperquick.qrc b/src/quick/framelesshelperquick.qrc index f9288ca..9a1cf51 100644 --- a/src/quick/framelesshelperquick.qrc +++ b/src/quick/framelesshelperquick.qrc @@ -1,7 +1,6 @@ qml/CloseButton.qml - qml/FramelessWindow.qml qml/MaximizeButton.qml qml/MinimizeButton.qml qml/StandardTitleBar.qml diff --git a/src/quick/framelessquickwindow.cpp b/src/quick/framelessquickwindow.cpp new file mode 100644 index 0000000..ad5201a --- /dev/null +++ b/src/quick/framelessquickwindow.cpp @@ -0,0 +1,25 @@ +/* + * MIT License + * + * Copyright (C) 2022 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "framelessquickwindow.h" diff --git a/src/quick/framelessquickwindow.h b/src/quick/framelessquickwindow.h new file mode 100644 index 0000000..ecd96bd --- /dev/null +++ b/src/quick/framelessquickwindow.h @@ -0,0 +1,25 @@ +/* + * MIT License + * + * Copyright (C) 2022 by wangwenx190 (Yuhang Zhao) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "../../include/FramelessHelper/Quick/framelessquickwindow.h"