libmobileshell: Move back to QML plugin

Move from a C++ library + QML plugin to a QML plugin only for simplicity, since the homescreen switching architecture will be done from Plasma, and so use of the shell library only needs to be from QML.
This commit is contained in:
Devin Lin 2022-03-21 10:00:03 -04:00
parent d407bbcd18
commit 210042a6bf
96 changed files with 15 additions and 148 deletions

View file

@ -84,7 +84,6 @@ 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,7 +15,7 @@ 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
* [libmobileshell](libmobileshell) - shell component library (not guaranteed to be binary compatible between releases!) * [components/mobileshell](mobileshell) - private shell component library (API not guaranteed to be stable!)
* [containments](containments) - shell panels (homescreen, status bar, task panel) * [containments](containments) - shell panels (homescreen, status bar, task panel)
* [homescreens](homescreens) - homescreen packages * [homescreens](homescreens) - homescreen packages
* [kcms](kcms) - settings modules * [kcms](kcms) - settings modules

View file

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

View file

@ -6,6 +6,11 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
set(mobileshellplugin_SRCS set(mobileshellplugin_SRCS
mobileshellplugin.cpp mobileshellplugin.cpp
mobileshellsettings.cpp
quicksetting.cpp
quicksettingsmodel.cpp
savedquicksettings.cpp
savedquicksettingsmodel.cpp
shellutil.cpp shellutil.cpp
notifications/notificationthumbnailer.cpp notifications/notificationthumbnailer.cpp
notifications/notificationfilemenu.cpp notifications/notificationfilemenu.cpp
@ -23,7 +28,6 @@ add_library(mobileshellplugin SHARED ${mobileshellplugin_SRCS} ${RESOURCES})
target_link_libraries(mobileshellplugin target_link_libraries(mobileshellplugin
PUBLIC PUBLIC
Qt::Core Qt::Core
mobileshell
PRIVATE PRIVATE
Qt::DBus Qt::DBus
Qt::Qml Qt::Qml

View file

@ -18,8 +18,6 @@
#include "shellutil.h" #include "shellutil.h"
#include "taskswitcher/displaysmodel.h" #include "taskswitcher/displaysmodel.h"
using namespace MobileShell;
QUrl resolvePath(std::string str) QUrl resolvePath(std::string str)
{ {
return QUrl("qrc:/org/kde/plasma/private/mobileshell/qml/" + QString::fromStdString(str)); return QUrl("qrc:/org/kde/plasma/private/mobileshell/qml/" + QString::fromStdString(str));

View file

@ -8,8 +8,6 @@
#include <QDebug> #include <QDebug>
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");
const QString QUICKSETTINGS_CONFIG_GROUP = QStringLiteral("QuickSettings"); const QString QUICKSETTINGS_CONFIG_GROUP = QStringLiteral("QuickSettings");

View file

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

View file

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

View file

@ -10,12 +10,7 @@
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QQmlListProperty> #include <QQmlListProperty>
#include "mobileshell_export.h" class QuickSetting : public QObject
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)
@ -72,5 +67,3 @@ private:
QString m_settingsCommand; QString m_settingsCommand;
QList<QObject *> m_children; QList<QObject *> m_children;
}; };
} // namespace MobileShell

View file

@ -13,8 +13,6 @@
#include <QQmlComponent> #include <QQmlComponent>
#include <QQmlEngine> #include <QQmlEngine>
using namespace MobileShell;
QuickSettingsModel::QuickSettingsModel(QObject *parent) QuickSettingsModel::QuickSettingsModel(QObject *parent)
: QAbstractListModel{parent} : QAbstractListModel{parent}
, m_savedQuickSettings{new SavedQuickSettings{this}} , m_savedQuickSettings{new SavedQuickSettings{this}}

View file

@ -15,12 +15,7 @@
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QQmlListProperty> #include <QQmlListProperty>
#include "mobileshell_export.h" class QuickSettingsModel : public QAbstractListModel, public QQmlParserStatus
namespace MobileShell
{
class MOBILESHELL_EXPORT QuickSettingsModel : public QAbstractListModel, public QQmlParserStatus
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(QQmlParserStatus) Q_INTERFACES(QQmlParserStatus)
@ -35,6 +30,7 @@ public:
void classBegin() override; void classBegin() override;
void componentComplete() override; void componentComplete() override;
private: private:
void loadQuickSettings(); void loadQuickSettings();
@ -42,5 +38,3 @@ private:
QList<QuickSetting *> m_quickSettings; QList<QuickSetting *> m_quickSettings;
SavedQuickSettings *m_savedQuickSettings; SavedQuickSettings *m_savedQuickSettings;
}; };
} // namespace MobileShell

View file

@ -7,8 +7,6 @@
#include <QFileInfo> #include <QFileInfo>
using namespace MobileShell;
SavedQuickSettings::SavedQuickSettings(QObject *parent) SavedQuickSettings::SavedQuickSettings(QObject *parent)
: QObject{parent} : QObject{parent}
, m_settings{new MobileShellSettings{this}} , m_settings{new MobileShellSettings{this}}

View file

@ -15,17 +15,13 @@
#include <QQmlListProperty> #include <QQmlListProperty>
#include <QTimer> #include <QTimer>
#include "mobileshell_export.h"
namespace MobileShell
{
/** /**
* @short A model that reads quick settings configurations * @short A model that reads quick settings configurations
* from the config and presents models to display them. * from the config and presents models to display them.
* *
* @author Devin Lin <devin@kde.org> * @author Devin Lin <devin@kde.org>
**/ **/
class MOBILESHELL_EXPORT SavedQuickSettings : public QObject class SavedQuickSettings : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(SavedQuickSettingsModel *enabledModel READ enabledQuickSettingsModel CONSTANT) Q_PROPERTY(SavedQuickSettingsModel *enabledModel READ enabledQuickSettingsModel CONSTANT)
@ -51,5 +47,3 @@ private:
QTimer *m_updateTimer; QTimer *m_updateTimer;
}; };
} // namespace MobileShell

View file

@ -3,8 +3,6 @@
#include "savedquicksettingsmodel.h" #include "savedquicksettingsmodel.h"
using namespace MobileShell;
SavedQuickSettingsModel::SavedQuickSettingsModel(QObject *parent) SavedQuickSettingsModel::SavedQuickSettingsModel(QObject *parent)
: QAbstractListModel{parent} : QAbstractListModel{parent}
{ {

View file

@ -12,16 +12,12 @@
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QQmlListProperty> #include <QQmlListProperty>
#include "mobileshell_export.h"
namespace MobileShell
{
/** /**
* @short A list model for serving quick settings metadata. * @short A list model for serving quick settings metadata.
* *
* @author Devin Lin <devin@kde.org> * @author Devin Lin <devin@kde.org>
**/ **/
class MOBILESHELL_EXPORT SavedQuickSettingsModel : public QAbstractListModel class SavedQuickSettingsModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
@ -53,5 +49,3 @@ Q_SIGNALS:
private: private:
QList<KPluginMetaData *> m_data; QList<KPluginMetaData *> m_data;
}; };
} // namespace MobileShell

View file

@ -29,8 +29,6 @@
#define FORMAT24H "HH:mm:ss" #define FORMAT24H "HH:mm:ss"
using namespace MobileShell;
ShellUtil::ShellUtil(QObject *parent) ShellUtil::ShellUtil(QObject *parent)
: QObject{parent} : QObject{parent}
{ {

View file

@ -12,12 +12,7 @@
#include <KConfigWatcher> #include <KConfigWatcher>
#include <KSharedConfig> #include <KSharedConfig>
#include "mobileshell_export.h" class ShellUtil : public QObject
namespace MobileShell
{
class MOBILESHELL_EXPORT ShellUtil : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool isSystem24HourFormat READ isSystem24HourFormat NOTIFY isSystem24HourFormatChanged); Q_PROPERTY(bool isSystem24HourFormat READ isSystem24HourFormat NOTIFY isSystem24HourFormatChanged);
@ -40,5 +35,3 @@ private:
KConfigWatcher::Ptr m_localeConfigWatcher; KConfigWatcher::Ptr m_localeConfigWatcher;
KSharedConfig::Ptr m_localeConfig; KSharedConfig::Ptr m_localeConfig;
}; };
} // namespace MobileShell

View file

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

View file

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

View file

@ -1,62 +0,0 @@
# 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()
set(mobileshell_LIB_SRCS
mobileshellsettings.cpp
quicksetting.cpp
quicksettingsmodel.cpp
savedquicksettingsmodel.cpp
savedquicksettings.cpp
)
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(TARGETS mobileshell EXPORT mobileshellLibraryTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
install(FILES
mobileshellsettings.h
quicksetting.h
quicksettingsmodel.h
savedquicksettingsmodel.h
savedquicksettings.h
${CMAKE_CURRENT_BINARY_DIR}/mobileshell_export.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/mobileshell COMPONENT Devel
)

View file

@ -1,13 +0,0 @@
# SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later
include(ECMAddTests)
find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG REQUIRED Test)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../src")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/../src")
#ecm_add_tests(
#LINK_LIBRARIES KF5::KWeatherCore Qt${QT_MAJOR_VERSION}::Test
#)