components/mobileshell: Move to libmobileshell library

This commit is contained in:
Devin Lin 2022-03-13 16:27:14 -04:00
parent f7078d6aa5
commit cf7e48e65c
100 changed files with 197 additions and 76 deletions

View file

@ -1,11 +1,14 @@
# SPDX-FileCopyrightText: 2014-2020 Marco Martin <mart@kde.org> # SPDX-FileCopyrightText: 2014-2020 Marco Martin <mart@kde.org>
# SPDX-FileCopyrightText: 2017-2021 Bhushan Shah <bshah@kde.org> # SPDX-FileCopyrightText: 2017-2021 Bhushan Shah <bshah@kde.org>
# SPDX-FileCopyrightText: 2019-2021 Nicolas Fella <nicolas.fella@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 # SPDX-License-Identifier: GPL-2.0-or-later
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(plasma-mobile) project(plasma-mobile)
set(PROJECT_VERSION "5.24.80")
set(PROJECT_VERSION_MAJOR 5)
set(QT_MIN_VERSION "5.15.0") set(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.90") set(KF5_MIN_VERSION "5.90")
@ -81,6 +84,7 @@ add_subdirectory(containments)
add_subdirectory(components) add_subdirectory(components)
add_subdirectory(quicksettings) add_subdirectory(quicksettings)
add_subdirectory(kcms) add_subdirectory(kcms)
add_subdirectory(libmobileshell)
find_program(PlasmaOpenSettings plasma-open-settings) find_program(PlasmaOpenSettings plasma-open-settings)
set_package_properties(PlasmaOpenSettings PROPERTIES set_package_properties(PlasmaOpenSettings PROPERTIES

View file

@ -15,9 +15,10 @@ This repository contains shell components for Plasma Mobile.
* Development channel: https://matrix.to/#/#plasmamobile:matrix.org * Development channel: https://matrix.to/#/#plasmamobile:matrix.org
### Locations ### Locations
* [applets](applets) - plasmoids * [libmobileshell](libmobileshell) - shell component library
* [components/mobileshell](components/mobileshell) - shell component library
* [containments](containments) - shell panels (homescreen, status bar, task panel) * [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.) * [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 * [quicksettings](quicksettings) - quick settings packages for the action drawer

View file

@ -4,4 +4,3 @@
add_subdirectory(mmplugin) add_subdirectory(mmplugin)
add_subdirectory(mobilehomescreencomponents) add_subdirectory(mobilehomescreencomponents)
add_subdirectory(mobileshell)

View file

@ -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)

View 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
)

View 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")

View file

@ -0,0 +1 @@

View 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)

View file

@ -9,15 +9,17 @@
#include <QQmlContext> #include <QQmlContext>
#include <QQuickItem> #include <QQuickItem>
#include "displaysmodel.h"
#include "mobileshellsettings.h"
#include "notifications/notificationfilemenu.h" #include "notifications/notificationfilemenu.h"
#include "notifications/notificationthumbnailer.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 "shellutil.h"
#include "virtualkeyboardinterface.h"
#include "vkbdinterface.h" using namespace MobileShell;
QUrl resolvePath(std::string str) QUrl resolvePath(std::string str)
{ {
@ -40,7 +42,7 @@ void MobileShellPlugin::registerTypes(const char *uri)
qmlRegisterType<QuickSettingsModel>(uri, 1, 0, "QuickSettingsModel"); qmlRegisterType<QuickSettingsModel>(uri, 1, 0, "QuickSettingsModel");
qmlRegisterType<DisplaysModel>(uri, 1, 0, "DisplaysModel"); 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; return new KwinVirtualKeyboardInterface;
}); });

View file

@ -9,6 +9,8 @@
#include <QGuiApplication> #include <QGuiApplication>
using namespace MobileShell;
DisplaysModel::DisplaysModel(QObject *parent) DisplaysModel::DisplaysModel(QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
{ {

View file

@ -17,7 +17,12 @@
#include <KWayland/Client/registry.h> #include <KWayland/Client/registry.h>
#include <KWayland/Client/surface.h> #include <KWayland/Client/surface.h>
class DisplaysModel : public QAbstractListModel #include "mobileshell_export.h"
namespace MobileShell
{
class MOBILESHELL_EXPORT DisplaysModel : public QAbstractListModel
{ {
public: public:
enum Roles { enum Roles {
@ -42,3 +47,5 @@ private:
QVector<KWayland::Client::Output *> m_outputs; QVector<KWayland::Client::Output *> m_outputs;
}; };
} // namespace MobileShell

View file

@ -4,7 +4,9 @@
* SPDX-License-Identifier: GPL-2.0-or-later * SPDX-License-Identifier: GPL-2.0-or-later
*/ */
#include "vkbdinterface.h" #include "kwinvirtualkeyboardinterface.h"
using namespace MobileShell;
KwinVirtualKeyboardInterface::KwinVirtualKeyboardInterface() KwinVirtualKeyboardInterface::KwinVirtualKeyboardInterface()
: OrgKdeKwinVirtualKeyboardInterface(QStringLiteral("org.kde.KWin"), QStringLiteral("/VirtualKeyboard"), QDBusConnection::sessionBus()) : OrgKdeKwinVirtualKeyboardInterface(QStringLiteral("org.kde.KWin"), QStringLiteral("/VirtualKeyboard"), QDBusConnection::sessionBus())

View file

@ -12,7 +12,12 @@
#include <virtualkeyboardinterface.h> #include <virtualkeyboardinterface.h>
class KwinVirtualKeyboardInterface : public OrgKdeKwinVirtualKeyboardInterface #include "mobileshell_export.h"
namespace MobileShell
{
class MOBILESHELL_EXPORT KwinVirtualKeyboardInterface : public OrgKdeKwinVirtualKeyboardInterface
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged) Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
@ -21,3 +26,5 @@ class KwinVirtualKeyboardInterface : public OrgKdeKwinVirtualKeyboardInterface
public: public:
KwinVirtualKeyboardInterface(); KwinVirtualKeyboardInterface();
}; };
} // namespace MobileShell

View file

@ -6,6 +6,8 @@
#include "mobileshellsettings.h" #include "mobileshellsettings.h"
using namespace MobileShell;
const QString CONFIG_FILE = QStringLiteral("plasmamobilerc"); const QString CONFIG_FILE = QStringLiteral("plasmamobilerc");
const QString GENERAL_CONFIG_GROUP = QStringLiteral("General"); const QString GENERAL_CONFIG_GROUP = QStringLiteral("General");

View file

@ -11,7 +11,12 @@
#include <KSharedConfig> #include <KSharedConfig>
#include <QObject> #include <QObject>
class MobileShellSettings : public QObject #include "mobileshell_export.h"
namespace MobileShell
{
class MOBILESHELL_EXPORT MobileShellSettings : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled NOTIFY navigationPanelEnabledChanged) Q_PROPERTY(bool navigationPanelEnabled READ navigationPanelEnabled NOTIFY navigationPanelEnabledChanged)
@ -30,3 +35,5 @@ private:
KConfigWatcher::Ptr m_configWatcher; KConfigWatcher::Ptr m_configWatcher;
KSharedConfig::Ptr m_config; KSharedConfig::Ptr m_config;
}; };
} // namespace MobileShell

View file

@ -6,6 +6,8 @@
#include "quicksetting.h" #include "quicksetting.h"
using namespace MobileShell;
QuickSetting::QuickSetting(QObject *parent) QuickSetting::QuickSetting(QObject *parent)
: QObject(parent) : QObject(parent)
{ {

View file

@ -10,7 +10,12 @@
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QQmlListProperty> #include <QQmlListProperty>
class QuickSetting : public QObject #include "mobileshell_export.h"
namespace MobileShell
{
class MOBILESHELL_EXPORT QuickSetting : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText REQUIRED NOTIFY textChanged) Q_PROPERTY(QString text READ text WRITE setText REQUIRED NOTIFY textChanged)
@ -67,3 +72,5 @@ private:
QString m_settingsCommand; QString m_settingsCommand;
QList<QObject *> m_children; QList<QObject *> m_children;
}; };
} // namespace MobileShell

View file

@ -11,6 +11,8 @@
#include <QQmlComponent> #include <QQmlComponent>
#include <QQmlEngine> #include <QQmlEngine>
using namespace MobileShell;
QuickSettingsModel::QuickSettingsModel(QObject *parent) QuickSettingsModel::QuickSettingsModel(QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
{ {

View file

@ -4,8 +4,7 @@
* SPDX-License-Identifier: LGPL-2.0-or-later * SPDX-License-Identifier: LGPL-2.0-or-later
*/ */
#ifndef QUICKSETTINGSMODEL_H #pragma once
#define QUICKSETTINGSMODEL_H
#include "qqml.h" #include "qqml.h"
#include "quicksetting.h" #include "quicksetting.h"
@ -13,7 +12,12 @@
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QQmlListProperty> #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_OBJECT
Q_INTERFACES(QQmlParserStatus) Q_INTERFACES(QQmlParserStatus)
@ -42,4 +46,4 @@ private:
QList<QuickSetting *> m_external; QList<QuickSetting *> m_external;
}; };
#endif // QUICKSETTINGSMODEL_H } // namespace MobileShell

View file

@ -29,6 +29,8 @@
#define FORMAT24H "HH:mm:ss" #define FORMAT24H "HH:mm:ss"
using namespace MobileShell;
constexpr int SCREENSHOT_DELAY = 200; constexpr int SCREENSHOT_DELAY = 200;
/* -- Static Helpers --------------------------------------------------------------------------- */ /* -- Static Helpers --------------------------------------------------------------------------- */

View file

@ -15,7 +15,12 @@
#include "kscreeninterface.h" #include "kscreeninterface.h"
#include "screenshot2interface.h" #include "screenshot2interface.h"
class ShellUtil : public QObject #include "mobileshell_export.h"
namespace MobileShell
{
class MOBILESHELL_EXPORT ShellUtil : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool autoRotateEnabled READ autoRotate WRITE setAutoRotate NOTIFY autoRotateChanged); Q_PROPERTY(bool autoRotateEnabled READ autoRotate WRITE setAutoRotate NOTIFY autoRotateChanged);
@ -55,3 +60,5 @@ private:
org::kde::KScreen *m_kscreenInterface; org::kde::KScreen *m_kscreenInterface;
OrgKdeKWinScreenShot2Interface *m_screenshotInterface; OrgKdeKWinScreenShot2Interface *m_screenshotInterface;
}; };
} // namespace MobileShell