mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
libmobileshell: Move non-API components to declarative and use PW API for keyboard
t
This commit is contained in:
parent
c2474b385e
commit
72f36f1bf6
12 changed files with 24 additions and 70 deletions
|
|
@ -10,6 +10,7 @@ import QtQuick.Window 2.15
|
||||||
|
|
||||||
import org.kde.plasma.plasmoid 2.0
|
import org.kde.plasma.plasmoid 2.0
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
import org.kde.plasma.workspace.keyboardlayout 1.0 as Keyboards
|
||||||
|
|
||||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
||||||
|
|
||||||
|
|
@ -25,7 +26,7 @@ MobileShell.NavigationPanel {
|
||||||
if (root.taskSwitcher.visible) {
|
if (root.taskSwitcher.visible) {
|
||||||
return Qt.rgba(0, 0, 0, 0.1);
|
return Qt.rgba(0, 0, 0, 0.1);
|
||||||
} else {
|
} else {
|
||||||
return (MobileShell.KWinVirtualKeyboard.visible || appIsShown) ? PlasmaCore.ColorScope.backgroundColor : "transparent";
|
return (Keyboards.KWinVirtualKeyboard.visible || appIsShown) ? PlasmaCore.ColorScope.backgroundColor : "transparent";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foregroundColorGroup: (!root.taskSwitcher.visible && appIsShown) ? PlasmaCore.Theme.NormalColorGroup : PlasmaCore.Theme.ComplementaryColorGroup
|
foregroundColorGroup: (!root.taskSwitcher.visible && appIsShown) ? PlasmaCore.Theme.NormalColorGroup : PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
|
|
@ -81,15 +82,15 @@ MobileShell.NavigationPanel {
|
||||||
rightAction: MobileShell.NavigationPanelAction {
|
rightAction: MobileShell.NavigationPanelAction {
|
||||||
id: closeAppAction
|
id: closeAppAction
|
||||||
|
|
||||||
enabled: MobileShell.KWinVirtualKeyboard.visible || root.taskSwitcher.visible || plasmoid.nativeInterface.hasCloseableActiveWindow
|
enabled: Keyboards.KWinVirtualKeyboard.visible || root.taskSwitcher.visible || plasmoid.nativeInterface.hasCloseableActiveWindow
|
||||||
iconSource: MobileShell.KWinVirtualKeyboard.visible ? "go-down-symbolic" : "mobile-close-app"
|
iconSource: Keyboards.KWinVirtualKeyboard.visible ? "go-down-symbolic" : "mobile-close-app"
|
||||||
// mobile-close-app (from plasma-frameworks) seems to have less margins than icons from breeze-icons
|
// mobile-close-app (from plasma-frameworks) seems to have less margins than icons from breeze-icons
|
||||||
iconSizeFactor: MobileShell.KWinVirtualKeyboard.visible ? 1 : 0.75
|
iconSizeFactor: Keyboards.KWinVirtualKeyboard.visible ? 1 : 0.75
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (MobileShell.KWinVirtualKeyboard.active) {
|
if (Keyboards.KWinVirtualKeyboard.active) {
|
||||||
// close keyboard if it is open
|
// close keyboard if it is open
|
||||||
MobileShell.KWinVirtualKeyboard.active = false;
|
Keyboards.KWinVirtualKeyboard.active = false;
|
||||||
} else if (taskSwitcher.visible) {
|
} else if (taskSwitcher.visible) {
|
||||||
// if task switcher is open, close the current window shown
|
// if task switcher is open, close the current window shown
|
||||||
let indexToClose = root.taskSwitcher.tasksModel.index(root.taskSwitcher.currentTaskIndex, 0);
|
let indexToClose = root.taskSwitcher.tasksModel.index(root.taskSwitcher.currentTaskIndex, 0);
|
||||||
|
|
|
||||||
|
|
@ -7,20 +7,13 @@ if (BUILD_TESTING)
|
||||||
add_subdirectory(autotests)
|
add_subdirectory(autotests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
qt_add_dbus_interfaces(DBUS_SRCS ${KWIN_VIRTUALKEYBOARD_INTERFACE})
|
|
||||||
|
|
||||||
set(mobileshell_LIB_SRCS
|
set(mobileshell_LIB_SRCS
|
||||||
displaysmodel.cpp
|
|
||||||
mobileshellsettings.cpp
|
mobileshellsettings.cpp
|
||||||
shellutil.cpp
|
|
||||||
kwinvirtualkeyboardinterface.cpp
|
|
||||||
|
|
||||||
quicksetting.cpp
|
quicksetting.cpp
|
||||||
quicksettingsmodel.cpp
|
quicksettingsmodel.cpp
|
||||||
savedquicksettingsmodel.cpp
|
savedquicksettingsmodel.cpp
|
||||||
savedquicksettings.cpp
|
savedquicksettings.cpp
|
||||||
|
|
||||||
${DBUS_SRCS}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(mobileshell ${mobileshell_LIB_SRCS})
|
add_library(mobileshell ${mobileshell_LIB_SRCS})
|
||||||
|
|
@ -57,10 +50,7 @@ set_target_properties(mobileshell PROPERTIES
|
||||||
install(TARGETS mobileshell EXPORT mobileshellLibraryTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
|
install(TARGETS mobileshell EXPORT mobileshellLibraryTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
displaysmodel.h
|
|
||||||
kwinvirtualkeyboardinterface.h
|
|
||||||
mobileshellsettings.h
|
mobileshellsettings.h
|
||||||
shellutil.h
|
|
||||||
|
|
||||||
quicksetting.h
|
quicksetting.h
|
||||||
quicksettingsmodel.h
|
quicksettingsmodel.h
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||||
|
|
||||||
set(mobileshellplugin_SRCS
|
set(mobileshellplugin_SRCS
|
||||||
mobileshellplugin.cpp
|
mobileshellplugin.cpp
|
||||||
|
shellutil.cpp
|
||||||
notifications/notificationthumbnailer.cpp
|
notifications/notificationthumbnailer.cpp
|
||||||
notifications/notificationfilemenu.cpp
|
notifications/notificationfilemenu.cpp
|
||||||
|
taskswitcher/displaysmodel.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(QUICK_COMPILER)
|
if(QUICK_COMPILER)
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,11 @@
|
||||||
#include "notifications/notificationfilemenu.h"
|
#include "notifications/notificationfilemenu.h"
|
||||||
#include "notifications/notificationthumbnailer.h"
|
#include "notifications/notificationthumbnailer.h"
|
||||||
|
|
||||||
#include "displaysmodel.h"
|
|
||||||
#include "kwinvirtualkeyboardinterface.h"
|
|
||||||
#include "mobileshellsettings.h"
|
#include "mobileshellsettings.h"
|
||||||
#include "quicksetting.h"
|
#include "quicksetting.h"
|
||||||
#include "quicksettingsmodel.h"
|
#include "quicksettingsmodel.h"
|
||||||
#include "shellutil.h"
|
#include "shellutil.h"
|
||||||
|
#include "taskswitcher/displaysmodel.h"
|
||||||
|
|
||||||
using namespace MobileShell;
|
using namespace MobileShell;
|
||||||
|
|
||||||
|
|
@ -44,9 +43,6 @@ void MobileShellPlugin::registerTypes(const char *uri)
|
||||||
qmlRegisterType<SavedQuickSettingsModel>(uri, 1, 0, "SavedQuickSettingsModel");
|
qmlRegisterType<SavedQuickSettingsModel>(uri, 1, 0, "SavedQuickSettingsModel");
|
||||||
|
|
||||||
qmlRegisterType<DisplaysModel>(uri, 1, 0, "DisplaysModel");
|
qmlRegisterType<DisplaysModel>(uri, 1, 0, "DisplaysModel");
|
||||||
qmlRegisterSingletonType<KwinVirtualKeyboardInterface>(uri, 1, 0, "KWinVirtualKeyboard", [](QQmlEngine *, QJSEngine *) -> QObject * {
|
|
||||||
return new KwinVirtualKeyboardInterface;
|
|
||||||
});
|
|
||||||
|
|
||||||
// notifications
|
// notifications
|
||||||
qmlRegisterType<NotificationThumbnailer>(uri, 1, 0, "NotificationThumbnailer");
|
qmlRegisterType<NotificationThumbnailer>(uri, 1, 0, "NotificationThumbnailer");
|
||||||
|
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2021 Aleix Pol <apol@kde.org>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "kwinvirtualkeyboardinterface.h"
|
|
||||||
|
|
||||||
using namespace MobileShell;
|
|
||||||
|
|
||||||
KwinVirtualKeyboardInterface::KwinVirtualKeyboardInterface()
|
|
||||||
: OrgKdeKwinVirtualKeyboardInterface(QStringLiteral("org.kde.KWin"), QStringLiteral("/VirtualKeyboard"), QDBusConnection::sessionBus())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2021 Aleix Pol <apol@kde.org>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QDBusConnection>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
#include <virtualkeyboardinterface.h>
|
|
||||||
|
|
||||||
#include "mobileshell_export.h"
|
|
||||||
|
|
||||||
namespace MobileShell
|
|
||||||
{
|
|
||||||
|
|
||||||
class MOBILESHELL_EXPORT KwinVirtualKeyboardInterface : public OrgKdeKwinVirtualKeyboardInterface
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
|
|
||||||
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
|
|
||||||
Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
|
|
||||||
public:
|
|
||||||
KwinVirtualKeyboardInterface();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace MobileShell
|
|
||||||
|
|
@ -19,7 +19,12 @@
|
||||||
|
|
||||||
namespace MobileShell
|
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 MOBILESHELL_EXPORT SavedQuickSettings : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,11 @@
|
||||||
|
|
||||||
namespace MobileShell
|
namespace MobileShell
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @short A list model for serving quick settings metadata.
|
||||||
|
*
|
||||||
|
* @author Devin Lin <devin@kde.org>
|
||||||
|
**/
|
||||||
class MOBILESHELL_EXPORT SavedQuickSettingsModel : public QAbstractListModel
|
class MOBILESHELL_EXPORT SavedQuickSettingsModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
@ -25,9 +29,9 @@ public:
|
||||||
SavedQuickSettingsModel(QObject *parent = nullptr);
|
SavedQuickSettingsModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NameRole,
|
NameRole, /**< The name of the quick setting. */
|
||||||
IdRole,
|
IdRole, /**< The plugin id of the quick setting package. */
|
||||||
IconRole,
|
IconRole, /**< The icon of the quick setting. */
|
||||||
};
|
};
|
||||||
|
|
||||||
QVariant data(const QModelIndex &index, int role) const override;
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue