forked from openkylin/ukui-panel
parent
9b33cfd68d
commit
5f50d06b1d
|
@ -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)
|
||||
|
|
|
@ -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})
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
* *
|
||||
* * Authors: iaom <zhangpengfei@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
#include "panel-framework-public-plugin.h"
|
||||
#include <QQmlContext>
|
||||
#include <QQmlEngine>
|
||||
|
||||
void PanelFrameworkPublicPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(QLatin1String(uri) == QLatin1String(PLUGIN_IMPORT_URI));
|
||||
qmlRegisterModule(uri, 1, 0);
|
||||
}
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
* *
|
||||
* * Authors: iaom <zhangpengfei@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UKUI_PANEL_PANEL_FRAMEWORK_PUBLIC_PLUGIN_H
|
||||
#define UKUI_PANEL_PANEL_FRAMEWORK_PUBLIC_PLUGIN_H
|
||||
|
||||
#include <QQmlExtensionPlugin>
|
||||
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
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
* *
|
||||
* * Authors: iaom <zhangpengfei@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
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色
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
module org.ukui.panel.publicItems
|
||||
plugin ukui-panel-public-items
|
||||
BlurItem 1.0 qml/BlurItem.qml
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}")
|
||||
|
|
Loading…
Reference in New Issue