新增开始菜单扩展界面开发接口

This commit is contained in:
hewenfei 2022-12-26 15:21:43 +08:00
parent bcada80b0d
commit add50cca1a
8 changed files with 131 additions and 1 deletions

View File

@ -61,10 +61,13 @@ message(STATUS "QML_IMPORT_PATH: ${QML_IMPORT_PATH}")
# #
set(UKUI_MENU_DATA_DIR "/usr/share/ukui-menu") set(UKUI_MENU_DATA_DIR "/usr/share/ukui-menu")
set(UKUI_MENU_TRANSLATION_DIR "${UKUI_MENU_DATA_DIR}/translations") set(UKUI_MENU_TRANSLATION_DIR "${UKUI_MENU_DATA_DIR}/translations")
set(UKUI_MENU_EXTENSION_DIR "${UKUI_MENU_DATA_DIR}/extensions")
#set(UKUI_MENU_EXTENSION_IFACE_QML_DIR "/usr/lib/x86_64-linux-gnu/qt5/qml/org/ukui/menu/extension")
# #
add_compile_definitions(UKUI_MENU_TRANSLATION_DIR="${UKUI_MENU_TRANSLATION_DIR}" add_compile_definitions(UKUI_MENU_TRANSLATION_DIR="${UKUI_MENU_TRANSLATION_DIR}"
UKUI_MENU_DATA_DIR="${UKUI_MENU_DATA_DIR}" UKUI_MENU_DATA_DIR="${UKUI_MENU_DATA_DIR}"
UKUI_MENU_EXTENSION_DIR="${UKUI_MENU_EXTENSION_DIR}"
) )
# ukui-menu # ukui-menu
@ -80,6 +83,8 @@ set(SOURCE_FILES
src/model/model-manager.cpp src/model/model-manager.h src/model/model-manager.cpp src/model/model-manager.h
src/appdata/app-icon-provider.cpp src/appdata/app-icon-provider.h src/appdata/app-icon-provider.cpp src/appdata/app-icon-provider.h
src/windows/menu-main-window.cpp src/windows/menu-main-window.h src/windows/menu-main-window.cpp src/windows/menu-main-window.h
src/extension/menu-extension.cpp src/extension/menu-extension.h
src/extension/menu-extension-iface.h
) )
# qrc # qrc
@ -89,6 +94,8 @@ set(DESKTOP_FILE data/ukui-menu.desktop)
set(GSETTING_FILE data/org.ukui.menu.settings.gschema.xml) set(GSETTING_FILE data/org.ukui.menu.settings.gschema.xml)
# data files # data files
#set(DATA_FILES data/xxx) #set(DATA_FILES data/xxx)
# extension
#file(GLOB EXTENSION_IFACE_QML_FILES "qml/org/ukui/menu/extension/*")
# #
file(GLOB TS_FILES "${PROJECT_SOURCE_DIR}/translations/*.ts") file(GLOB TS_FILES "${PROJECT_SOURCE_DIR}/translations/*.ts")
@ -126,3 +133,4 @@ install(FILES ${QM_FILES} DESTINATION "${UKUI_MENU_TRANSLATION_DIR}")
# desktop # desktop
install(FILES ${DESKTOP_FILE} DESTINATION "/etc/xdg/autostart") install(FILES ${DESKTOP_FILE} DESTINATION "/etc/xdg/autostart")
install(FILES ${GSETTING_FILE} DESTINATION "/usr/share/glib-2.0/schemas") install(FILES ${GSETTING_FILE} DESTINATION "/usr/share/glib-2.0/schemas")
#install(FILES ${EXTENSION_IFACE_QML_FILES} DESTINATION "${UKUI_MENU_EXTENSION_IFACE_QML_DIR}")

View File

@ -1,5 +1,6 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.0 as QQC2 import QtQuick.Controls 2.0 as QQC2
import org.ukui.menu.extension 1.0
Item { Item {
Row { Row {
@ -11,7 +12,7 @@ Item {
} }
Sidebar { Sidebar {
width: parent.width - 300; width: parent.width - 400;
height: parent.height; height: parent.height;
MouseArea { MouseArea {
@ -21,5 +22,10 @@ Item {
} }
} }
} }
UkuiMenuExtension {
width: 100;
height: parent.height;
}
} }
} }

View File

@ -0,0 +1,7 @@
import QtQuick 2.0
Item {
id: extensionView;
property var data;
signal send(var data);
}

View File

@ -0,0 +1,2 @@
module org.ukui.menu.extension
UkuiMenuExtension 1.0 UkuiMenuExtension.qml

View File

@ -1,6 +1,8 @@
<RCC> <RCC>
<qresource prefix="/qml"> <qresource prefix="/qml">
<file>main.qml</file> <file>main.qml</file>
<file>org/ukui/menu/extension/qmldir</file>
<file>org/ukui/menu/extension/UkuiMenuExtension.qml</file>
<file>AppUI/qmldir</file> <file>AppUI/qmldir</file>
<file>AppUI/NormalUI.qml</file> <file>AppUI/NormalUI.qml</file>
<file>AppUI/FullScreenUI.qml</file> <file>AppUI/FullScreenUI.qml</file>

View File

@ -0,0 +1,45 @@
/*
* Copyright (C) 2022, 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/>.
*
*/
#ifndef UKUI_MENU_MENU_EXTENSION_I_FACE_H
#define UKUI_MENU_MENU_EXTENSION_I_FACE_H
#include <QObject>
#include <QString>
#include <QVariant>
namespace UkuiMenu {
class MenuExtensionIFace : public QObject
{
Q_OBJECT
public:
virtual int index() = 0;
virtual QString name() = 0;
virtual QString url() = 0;
virtual QVariantMap data() = 0;
virtual void receive(QVariantMap data) = 0;
Q_SIGNALS:
void dataUpdated();
};
}
#endif //UKUI_MENU_MENU_EXTENSION_I_FACE_H

View File

@ -0,0 +1,24 @@
/*
* Copyright (C) 2022, 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/>.
*
*/
#include "menu-extension.h"
namespace UkuiMenu {
} // UkuiMenu

View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 2022, 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/>.
*
*/
#ifndef UKUI_MENU_MENU_EXTENSION_H
#define UKUI_MENU_MENU_EXTENSION_H
#include <QObject>
namespace UkuiMenu {
class MenuExtension : public QObject
{
Q_OBJECT
public:
};
} // UkuiMenu
#endif //UKUI_MENU_MENU_EXTENSION_H