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(quicksettings)
add_subdirectory(kcms)
add_subdirectory(libmobileshell)
find_program(PlasmaOpenSettings plasma-open-settings)
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
### 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)
* [homescreens](homescreens) - homescreen packages
* [kcms](kcms) - settings modules

View file

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

View file

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

View file

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

View file

@ -8,8 +8,6 @@
#include <QDebug>
using namespace MobileShell;
const QString CONFIG_FILE = QStringLiteral("plasmamobilerc");
const QString GENERAL_CONFIG_GROUP = QStringLiteral("General");
const QString QUICKSETTINGS_CONFIG_GROUP = QStringLiteral("QuickSettings");

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -17,12 +17,7 @@
#include <KWayland/Client/registry.h>
#include <KWayland/Client/surface.h>
#include "mobileshell_export.h"
namespace MobileShell
{
class MOBILESHELL_EXPORT DisplaysModel : public QAbstractListModel
class DisplaysModel : public QAbstractListModel
{
public:
enum Roles {
@ -47,5 +42,3 @@ private:
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
#)