mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
components/mobileshell: Move to libmobileshell library
This commit is contained in:
parent
f7078d6aa5
commit
cf7e48e65c
100 changed files with 197 additions and 76 deletions
|
|
@ -1,11 +1,14 @@
|
|||
# SPDX-FileCopyrightText: 2014-2020 Marco Martin <mart@kde.org>
|
||||
# SPDX-FileCopyrightText: 2017-2021 Bhushan Shah <bshah@kde.org>
|
||||
# SPDX-FileCopyrightText: 2019-2021 Nicolas Fella <nicolas.fella@kde.org>
|
||||
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(plasma-mobile)
|
||||
set(PROJECT_VERSION "5.24.80")
|
||||
set(PROJECT_VERSION_MAJOR 5)
|
||||
|
||||
set(QT_MIN_VERSION "5.15.0")
|
||||
set(KF5_MIN_VERSION "5.90")
|
||||
|
|
@ -81,6 +84,7 @@ add_subdirectory(containments)
|
|||
add_subdirectory(components)
|
||||
add_subdirectory(quicksettings)
|
||||
add_subdirectory(kcms)
|
||||
add_subdirectory(libmobileshell)
|
||||
|
||||
find_program(PlasmaOpenSettings plasma-open-settings)
|
||||
set_package_properties(PlasmaOpenSettings PROPERTIES
|
||||
|
|
|
|||
|
|
@ -15,9 +15,10 @@ This repository contains shell components for Plasma Mobile.
|
|||
* Development channel: https://matrix.to/#/#plasmamobile:matrix.org
|
||||
|
||||
### Locations
|
||||
* [applets](applets) - plasmoids
|
||||
* [components/mobileshell](components/mobileshell) - shell component library
|
||||
* [libmobileshell](libmobileshell) - shell component library
|
||||
* [containments](containments) - shell panels (homescreen, status bar, task panel)
|
||||
* [homescreens](homescreens) - homescreen packages
|
||||
* [kcms]() - settings modules
|
||||
* [look-and-feel](look-and-feel/contents) - Plasma look-and-feel packages (ex. lockscreen, logout, etc.)
|
||||
* [quicksettings](quicksettings) - quick settings packages for the action drawer
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,3 @@
|
|||
|
||||
add_subdirectory(mmplugin)
|
||||
add_subdirectory(mobilehomescreencomponents)
|
||||
add_subdirectory(mobileshell)
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
qt_add_dbus_interfaces(DBUS_SRCS dbus/org.kde.KWin.ScreenShot2.xml
|
||||
dbus/org.kde.KScreen.xml
|
||||
${KWIN_VIRTUALKEYBOARD_INTERFACE})
|
||||
|
||||
set(mobileshellplugin_SRCS
|
||||
mobileshellplugin.cpp
|
||||
shellutil.cpp
|
||||
mobileshellsettings.cpp
|
||||
vkbdinterface.cpp
|
||||
displaysmodel.cpp
|
||||
|
||||
quicksettings/quicksetting.cpp
|
||||
quicksettings/quicksettingsmodel.cpp
|
||||
|
||||
notifications/notificationthumbnailer.cpp
|
||||
notifications/notificationfilemenu.cpp
|
||||
|
||||
${DBUS_SRCS}
|
||||
)
|
||||
|
||||
if(QUICK_COMPILER)
|
||||
qtquick_compiler_add_resources(RESOURCES resources.qrc)
|
||||
else()
|
||||
qt5_add_resources(RESOURCES resources.qrc)
|
||||
endif()
|
||||
|
||||
add_library(mobileshellplugin ${mobileshellplugin_SRCS} ${RESOURCES})
|
||||
|
||||
target_link_libraries(mobileshellplugin
|
||||
PUBLIC
|
||||
Qt::Core
|
||||
PRIVATE
|
||||
Qt::DBus
|
||||
Qt::Qml
|
||||
Qt::Gui
|
||||
Qt::Quick
|
||||
KF5::ConfigWidgets # for KStandardAction
|
||||
KF5::KIOGui
|
||||
KF5::Plasma
|
||||
KF5::I18n
|
||||
KF5::Notifications
|
||||
KF5::PlasmaQuick
|
||||
KF5::KIOGui
|
||||
KF5::KIOWidgets # for PreviewJob
|
||||
KF5::WaylandClient
|
||||
KF5::Service
|
||||
)
|
||||
|
||||
# we compiled the qml files, just install qmldir
|
||||
install(FILES qml/qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell)
|
||||
|
||||
ecm_generate_qmltypes(org.kde.plasma.private.mobileshell 1.0 DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell)
|
||||
install(TARGETS mobileshellplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell)
|
||||
65
libmobileshell/CMakeLists.txt
Normal file
65
libmobileshell/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
add_subdirectory(declarative)
|
||||
|
||||
if (BUILD_TESTING)
|
||||
add_subdirectory(autotests)
|
||||
endif()
|
||||
|
||||
qt_add_dbus_interfaces(DBUS_SRCS dbus/org.kde.KWin.ScreenShot2.xml
|
||||
dbus/org.kde.KScreen.xml
|
||||
${KWIN_VIRTUALKEYBOARD_INTERFACE})
|
||||
|
||||
set(mobileshell_LIB_SRCS
|
||||
displaysmodel.cpp
|
||||
mobileshellsettings.cpp
|
||||
quicksetting.cpp
|
||||
quicksettingsmodel.cpp
|
||||
shellutil.cpp
|
||||
kwinvirtualkeyboardinterface.cpp
|
||||
|
||||
${DBUS_SRCS}
|
||||
)
|
||||
|
||||
add_library(mobileshell ${mobileshell_LIB_SRCS})
|
||||
add_library(PM::LibMobileShell ALIAS mobileshell)
|
||||
|
||||
generate_export_header(mobileshell)
|
||||
|
||||
target_include_directories(mobileshell PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}/libmobileshell>")
|
||||
target_link_libraries(mobileshell
|
||||
PUBLIC
|
||||
Qt::Core
|
||||
PRIVATE
|
||||
Qt::DBus
|
||||
Qt::Qml
|
||||
Qt::Gui
|
||||
Qt::Quick
|
||||
KF5::ConfigWidgets # for KStandardAction
|
||||
KF5::KIOGui
|
||||
KF5::Plasma
|
||||
KF5::I18n
|
||||
KF5::Notifications
|
||||
KF5::PlasmaQuick
|
||||
KF5::KIOGui
|
||||
KF5::KIOWidgets # for PreviewJob
|
||||
KF5::WaylandClient
|
||||
KF5::Service
|
||||
)
|
||||
|
||||
set_target_properties(mobileshell PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION 1
|
||||
EXPORT_NAME LibMobileShell)
|
||||
|
||||
install(FILES
|
||||
displaysmodel.h
|
||||
kwinvirtualkeyboardinterface.h
|
||||
mobileshellsettings.h
|
||||
quicksetting.h
|
||||
quicksettingsmodel.h
|
||||
shellutil.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/mobileshell_export.h
|
||||
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/mobileshell COMPONENT Devel
|
||||
)
|
||||
8
libmobileshell/LibMobileShellConfig.cmake.in
Normal file
8
libmobileshell/LibMobileShellConfig.cmake.in
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(Qt5Core "@QT_MIN_VERSION@")
|
||||
find_dependency(Qt5Gui "@QT_MIN_VERSION@")
|
||||
find_dependency(Qt5Quick "@QT_MIN_VERSION@")
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/LibMobileShellLibraryTargets.cmake")
|
||||
1
libmobileshell/autotests/CMakeLists.txt
Normal file
1
libmobileshell/autotests/CMakeLists.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
|
||||
46
libmobileshell/declarative/CMakeLists.txt
Normal file
46
libmobileshell/declarative/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/..)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
||||
set(mobileshellplugin_SRCS
|
||||
mobileshellplugin.cpp
|
||||
notifications/notificationthumbnailer.cpp
|
||||
notifications/notificationfilemenu.cpp
|
||||
)
|
||||
|
||||
if(QUICK_COMPILER)
|
||||
qtquick_compiler_add_resources(RESOURCES resources.qrc)
|
||||
else()
|
||||
qt5_add_resources(RESOURCES resources.qrc)
|
||||
endif()
|
||||
|
||||
add_library(mobileshellplugin SHARED ${mobileshellplugin_SRCS} ${RESOURCES})
|
||||
|
||||
target_link_libraries(mobileshellplugin
|
||||
PUBLIC
|
||||
Qt::Core
|
||||
mobileshell
|
||||
PRIVATE
|
||||
Qt::DBus
|
||||
Qt::Qml
|
||||
Qt::Gui
|
||||
Qt::Quick
|
||||
KF5::ConfigWidgets # for KStandardAction
|
||||
KF5::KIOGui
|
||||
KF5::Plasma
|
||||
KF5::I18n
|
||||
KF5::Notifications
|
||||
KF5::PlasmaQuick
|
||||
KF5::KIOGui
|
||||
KF5::KIOWidgets # for PreviewJob
|
||||
KF5::WaylandClient
|
||||
KF5::Service
|
||||
)
|
||||
|
||||
# we compiled the qml files, just install qmldir
|
||||
install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell)
|
||||
|
||||
ecm_generate_qmltypes(org.kde.plasma.private.mobileshell 1.0 DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell)
|
||||
install(TARGETS mobileshellplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/mobileshell)
|
||||
|
|
@ -9,15 +9,17 @@
|
|||
#include <QQmlContext>
|
||||
#include <QQuickItem>
|
||||
|
||||
#include "displaysmodel.h"
|
||||
#include "mobileshellsettings.h"
|
||||
#include "notifications/notificationfilemenu.h"
|
||||
#include "notifications/notificationthumbnailer.h"
|
||||
#include "quicksettings/quicksetting.h"
|
||||
#include "quicksettings/quicksettingsmodel.h"
|
||||
|
||||
#include "displaysmodel.h"
|
||||
#include "kwinvirtualkeyboardinterface.h"
|
||||
#include "mobileshellsettings.h"
|
||||
#include "quicksetting.h"
|
||||
#include "quicksettingsmodel.h"
|
||||
#include "shellutil.h"
|
||||
#include "virtualkeyboardinterface.h"
|
||||
#include "vkbdinterface.h"
|
||||
|
||||
using namespace MobileShell;
|
||||
|
||||
QUrl resolvePath(std::string str)
|
||||
{
|
||||
|
|
@ -40,7 +42,7 @@ void MobileShellPlugin::registerTypes(const char *uri)
|
|||
qmlRegisterType<QuickSettingsModel>(uri, 1, 0, "QuickSettingsModel");
|
||||
|
||||
qmlRegisterType<DisplaysModel>(uri, 1, 0, "DisplaysModel");
|
||||
qmlRegisterSingletonType<OrgKdeKwinVirtualKeyboardInterface>(uri, 1, 0, "KWinVirtualKeyboard", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
||||
qmlRegisterSingletonType<KwinVirtualKeyboardInterface>(uri, 1, 0, "KWinVirtualKeyboard", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
||||
return new KwinVirtualKeyboardInterface;
|
||||
});
|
||||
|
||||
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include <QGuiApplication>
|
||||
|
||||
using namespace MobileShell;
|
||||
|
||||
DisplaysModel::DisplaysModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
|
|
@ -17,7 +17,12 @@
|
|||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
class DisplaysModel : public QAbstractListModel
|
||||
#include "mobileshell_export.h"
|
||||
|
||||
namespace MobileShell
|
||||
{
|
||||
|
||||
class MOBILESHELL_EXPORT DisplaysModel : public QAbstractListModel
|
||||
{
|
||||
public:
|
||||
enum Roles {
|
||||
|
|
@ -42,3 +47,5 @@ private:
|
|||
|
||||
QVector<KWayland::Client::Output *> m_outputs;
|
||||
};
|
||||
|
||||
} // namespace MobileShell
|
||||
|
|
@ -4,7 +4,9 @@
|
|||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "vkbdinterface.h"
|
||||
#include "kwinvirtualkeyboardinterface.h"
|
||||
|
||||
using namespace MobileShell;
|
||||
|
||||
KwinVirtualKeyboardInterface::KwinVirtualKeyboardInterface()
|
||||
: OrgKdeKwinVirtualKeyboardInterface(QStringLiteral("org.kde.KWin"), QStringLiteral("/VirtualKeyboard"), QDBusConnection::sessionBus())
|
||||
|
|
@ -12,7 +12,12 @@
|
|||
|
||||
#include <virtualkeyboardinterface.h>
|
||||
|
||||
class KwinVirtualKeyboardInterface : public OrgKdeKwinVirtualKeyboardInterface
|
||||
#include "mobileshell_export.h"
|
||||
|
||||
namespace MobileShell
|
||||
{
|
||||
|
||||
class MOBILESHELL_EXPORT KwinVirtualKeyboardInterface : public OrgKdeKwinVirtualKeyboardInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
|
||||
|
|
@ -21,3 +26,5 @@ class KwinVirtualKeyboardInterface : public OrgKdeKwinVirtualKeyboardInterface
|
|||
public:
|
||||
KwinVirtualKeyboardInterface();
|
||||
};
|
||||
|
||||
} // namespace MobileShell
|
||||
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include "mobileshellsettings.h"
|
||||
|
||||
using namespace MobileShell;
|
||||
|
||||
const QString CONFIG_FILE = QStringLiteral("plasmamobilerc");
|
||||
const QString GENERAL_CONFIG_GROUP = QStringLiteral("General");
|
||||
|
||||
|
|
@ -11,7 +11,12 @@
|
|||
#include <KSharedConfig>
|
||||
#include <QObject>
|
||||
|
||||
class MobileShellSettings : public QObject
|
||||
#include "mobileshell_export.h"
|
||||
|
||||
namespace MobileShell
|
||||
{
|
||||
|
||||
class MOBILESHELL_EXPORT MobileShellSettings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled NOTIFY navigationPanelEnabledChanged)
|
||||
|
|
@ -30,3 +35,5 @@ private:
|
|||
KConfigWatcher::Ptr m_configWatcher;
|
||||
KSharedConfig::Ptr m_config;
|
||||
};
|
||||
|
||||
} // namespace MobileShell
|
||||
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include "quicksetting.h"
|
||||
|
||||
using namespace MobileShell;
|
||||
|
||||
QuickSetting::QuickSetting(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
|
@ -10,7 +10,12 @@
|
|||
#include <QAbstractListModel>
|
||||
#include <QQmlListProperty>
|
||||
|
||||
class QuickSetting : public QObject
|
||||
#include "mobileshell_export.h"
|
||||
|
||||
namespace MobileShell
|
||||
{
|
||||
|
||||
class MOBILESHELL_EXPORT QuickSetting : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString text READ text WRITE setText REQUIRED NOTIFY textChanged)
|
||||
|
|
@ -67,3 +72,5 @@ private:
|
|||
QString m_settingsCommand;
|
||||
QList<QObject *> m_children;
|
||||
};
|
||||
|
||||
} // namespace MobileShell
|
||||
|
|
@ -11,6 +11,8 @@
|
|||
#include <QQmlComponent>
|
||||
#include <QQmlEngine>
|
||||
|
||||
using namespace MobileShell;
|
||||
|
||||
QuickSettingsModel::QuickSettingsModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
|
|
@ -4,8 +4,7 @@
|
|||
* SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef QUICKSETTINGSMODEL_H
|
||||
#define QUICKSETTINGSMODEL_H
|
||||
#pragma once
|
||||
|
||||
#include "qqml.h"
|
||||
#include "quicksetting.h"
|
||||
|
|
@ -13,7 +12,12 @@
|
|||
#include <QAbstractListModel>
|
||||
#include <QQmlListProperty>
|
||||
|
||||
class QuickSettingsModel : public QAbstractListModel, public QQmlParserStatus
|
||||
#include "mobileshell_export.h"
|
||||
|
||||
namespace MobileShell
|
||||
{
|
||||
|
||||
class MOBILESHELL_EXPORT QuickSettingsModel : public QAbstractListModel, public QQmlParserStatus
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QQmlParserStatus)
|
||||
|
|
@ -42,4 +46,4 @@ private:
|
|||
QList<QuickSetting *> m_external;
|
||||
};
|
||||
|
||||
#endif // QUICKSETTINGSMODEL_H
|
||||
} // namespace MobileShell
|
||||
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#define FORMAT24H "HH:mm:ss"
|
||||
|
||||
using namespace MobileShell;
|
||||
|
||||
constexpr int SCREENSHOT_DELAY = 200;
|
||||
|
||||
/* -- Static Helpers --------------------------------------------------------------------------- */
|
||||
|
|
@ -15,7 +15,12 @@
|
|||
#include "kscreeninterface.h"
|
||||
#include "screenshot2interface.h"
|
||||
|
||||
class ShellUtil : public QObject
|
||||
#include "mobileshell_export.h"
|
||||
|
||||
namespace MobileShell
|
||||
{
|
||||
|
||||
class MOBILESHELL_EXPORT ShellUtil : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool autoRotateEnabled READ autoRotate WRITE setAutoRotate NOTIFY autoRotateChanged);
|
||||
|
|
@ -55,3 +60,5 @@ private:
|
|||
org::kde::KScreen *m_kscreenInterface;
|
||||
OrgKdeKWinScreenShot2Interface *m_screenshotInterface;
|
||||
};
|
||||
|
||||
} // namespace MobileShell
|
||||
Loading…
Reference in a new issue