diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt index 42b9bc7..f97a714 100644 --- a/framework/CMakeLists.txt +++ b/framework/CMakeLists.txt @@ -12,7 +12,7 @@ set(CMAKE_AUTORCC ON) find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick REQUIRED) - +add_subdirectory(public-items) add_subdirectory(widget) add_subdirectory(ui) add_subdirectory(test) diff --git a/framework/public-items/CMakeLists.txt b/framework/public-items/CMakeLists.txt new file mode 100644 index 0000000..ecc2a6e --- /dev/null +++ b/framework/public-items/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.16) + +project(ukui-panel-public-items) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +#find QT modules +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Qml Quick REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Qml Quick REQUIRED) + +set (PLUGIN_SRCS + panel-framework-public-plugin.cpp + panel-framework-public-plugin.h +) +add_library(${PROJECT_NAME} SHARED ${PLUGIN_SRCS}) +set(PLUGIN_IMPORT_URI "org.ukui.panel.publicItems") +target_compile_definitions(${PROJECT_NAME} PRIVATE PLUGIN_IMPORT_URI="${PLUGIN_IMPORT_URI}") + +target_link_libraries(${PROJECT_NAME} + PRIVATE + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Qml + Qt${QT_VERSION_MAJOR}::Quick +) +set(PLUGIN_INSTALL_PATH "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/qt5/qml/org/ukui/panel/publicItems") +install(DIRECTORY "qml" DESTINATION "${PLUGIN_INSTALL_PATH}") +install(FILES qmldir DESTINATION ${PLUGIN_INSTALL_PATH}) +install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH}) \ No newline at end of file diff --git a/framework/public-items/panel-framework-public-plugin.cpp b/framework/public-items/panel-framework-public-plugin.cpp new file mode 100644 index 0000000..d4f055d --- /dev/null +++ b/framework/public-items/panel-framework-public-plugin.cpp @@ -0,0 +1,28 @@ +/* + * * Copyright (C) 2023, KylinSoft Co., Ltd. + * * + * * This program is free software: you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation, either version 3 of the License, or + * * (at your option) any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program. If not, see . + * * + * * Authors: iaom + * + */ +#include "panel-framework-public-plugin.h" +#include +#include + +void PanelFrameworkPublicPlugin::registerTypes(const char *uri) +{ + Q_ASSERT(QLatin1String(uri) == QLatin1String(PLUGIN_IMPORT_URI)); + qmlRegisterModule(uri, 1, 0); +} diff --git a/framework/public-items/panel-framework-public-plugin.h b/framework/public-items/panel-framework-public-plugin.h new file mode 100644 index 0000000..8f91629 --- /dev/null +++ b/framework/public-items/panel-framework-public-plugin.h @@ -0,0 +1,35 @@ +/* + * * Copyright (C) 2023, KylinSoft Co., Ltd. + * * + * * This program is free software: you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation, either version 3 of the License, or + * * (at your option) any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program. If not, see . + * * + * * Authors: iaom + * + */ + +#ifndef UKUI_PANEL_PANEL_FRAMEWORK_PUBLIC_PLUGIN_H +#define UKUI_PANEL_PANEL_FRAMEWORK_PUBLIC_PLUGIN_H + +#include +class PanelFrameworkPublicPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + void registerTypes(const char *uri) override; +}; + + +#endif //UKUI_PANEL_PANEL_FRAMEWORK_PUBLIC_PLUGIN_H diff --git a/framework/public-items/qml/BlurItem.qml b/framework/public-items/qml/BlurItem.qml new file mode 100644 index 0000000..4d5e06e --- /dev/null +++ b/framework/public-items/qml/BlurItem.qml @@ -0,0 +1,47 @@ +/* + * * Copyright (C) 2023, KylinSoft Co., Ltd. + * * + * * This program is free software: you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation, either version 3 of the License, or + * * (at your option) any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program. If not, see . + * * + * * Authors: iaom + * + */ +import QtQuick 2.15 +import QtGraphicalEffects 1.15 + +Item { + id: root + property variant source + property int samples: 9 + property real radius: Math.floor(samples / 2) + property bool hideSource: false + + ShaderEffectSource { + id: effectSource + sourceItem: root.source + sourceRect: Qt.rect(root.x, root.y, root.width, root.height) + hideSource: root.hideSource + width: parent.width + height: parent.height + } + + GaussianBlur { + anchors.fill: parent + source: effectSource + radius: root.radius + samples: root.samples + } + //TODO: + //关闭特效时,仅绘制固定透明度的base色 +} \ No newline at end of file diff --git a/framework/public-items/qmldir b/framework/public-items/qmldir new file mode 100644 index 0000000..e5a22c6 --- /dev/null +++ b/framework/public-items/qmldir @@ -0,0 +1,3 @@ +module org.ukui.panel.publicItems +plugin ukui-panel-public-items +BlurItem 1.0 qml/BlurItem.qml \ No newline at end of file diff --git a/framework/test/main.cpp b/framework/test/main.cpp index a4a8ace..fa9dfd0 100644 --- a/framework/test/main.cpp +++ b/framework/test/main.cpp @@ -12,12 +12,13 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); QStringList widgets; - widgets << "org.ukui.panel.taskmanager"; - widgets << "org.ukui.panel.test"; +// widgets << "org.ukui.panel.taskmanager"; +// widgets << "org.ukui.panel.test"; auto view = new QQuickView; view->setResizeMode(QQuickView::SizeRootObjectToView); view->resize(600, 600); + view->setColor(QColor(Qt::transparent)); view->setSource(QUrl("qrc:///main.qml")); UkuiPanel::WidgetLoader loader; diff --git a/framework/test/main.qml b/framework/test/main.qml index c67be47..8162348 100644 --- a/framework/test/main.qml +++ b/framework/test/main.qml @@ -1,5 +1,28 @@ import QtQuick 2.15 +import org.ukui.panel.publicItems 1.0 Rectangle { - color: "pink" + color: "transparent" + + Image{ + id: image + width: 1600 + height: 900 + source: "file:///home/zpf/图片/wallhaven-2y9r39.png" + } + BlurItem{ + x: 100 + y: 100 + width: 500 + height: 500 + radius: 40 + samples: 81 + source: image + Drag.active: dragArea.drag.active + MouseArea { + id: dragArea + anchors.fill: parent + drag.target: parent + } + } } diff --git a/widgets/ukui-task-manager/window-thumbnail/CMakeLists.txt b/widgets/ukui-task-manager/window-thumbnail/CMakeLists.txt index fcc38fc..a848f6a 100644 --- a/widgets/ukui-task-manager/window-thumbnail/CMakeLists.txt +++ b/widgets/ukui-task-manager/window-thumbnail/CMakeLists.txt @@ -96,8 +96,6 @@ target_link_libraries(${PROJECT_NAME} KF5::WaylandClient KF5::WindowSystem ) -message("===" ${UKUI_TASK_MANAGER_EXTERNAL_LIBS}) - set(PLUGIN_INSTALL_PATH "/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/qt5/qml/org/ukui/windowThumbnail") install(DIRECTORY "qml" DESTINATION "${PLUGIN_INSTALL_PATH}")