mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-02 01:34:46 +00:00
mobileshell: Move quicksettings to folder
This commit is contained in:
parent
5e04c65550
commit
b92ba78e00
6 changed files with 113 additions and 92 deletions
|
|
@ -8,11 +8,13 @@ qt_add_dbus_interfaces(DBUS_SRCS dbus/org.kde.KWin.ScreenShot2.xml
|
||||||
set(mobileshellplugin_SRCS
|
set(mobileshellplugin_SRCS
|
||||||
mobileshellplugin.cpp
|
mobileshellplugin.cpp
|
||||||
shellutil.cpp
|
shellutil.cpp
|
||||||
quicksettingsmodel.cpp
|
|
||||||
mobileshellsettings.cpp
|
mobileshellsettings.cpp
|
||||||
vkbdinterface.cpp
|
vkbdinterface.cpp
|
||||||
displaysmodel.cpp
|
displaysmodel.cpp
|
||||||
|
|
||||||
|
quicksettings/quicksetting.cpp
|
||||||
|
quicksettings/quicksettingsmodel.cpp
|
||||||
|
|
||||||
notifications/notificationthumbnailer.cpp
|
notifications/notificationthumbnailer.cpp
|
||||||
notifications/notificationfilemenu.cpp
|
notifications/notificationfilemenu.cpp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
#include "mobileshellsettings.h"
|
#include "mobileshellsettings.h"
|
||||||
#include "notifications/notificationfilemenu.h"
|
#include "notifications/notificationfilemenu.h"
|
||||||
#include "notifications/notificationthumbnailer.h"
|
#include "notifications/notificationthumbnailer.h"
|
||||||
#include "quicksettingsmodel.h"
|
#include "quicksettings/quicksetting.h"
|
||||||
|
#include "quicksettings/quicksettingsmodel.h"
|
||||||
#include "shellutil.h"
|
#include "shellutil.h"
|
||||||
#include "virtualkeyboardinterface.h"
|
#include "virtualkeyboardinterface.h"
|
||||||
#include "vkbdinterface.h"
|
#include "vkbdinterface.h"
|
||||||
|
|
|
||||||
62
components/mobileshell/quicksettings/quicksetting.cpp
Normal file
62
components/mobileshell/quicksettings/quicksetting.cpp
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: LGPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "quicksetting.h"
|
||||||
|
|
||||||
|
QuickSetting::QuickSetting(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickSetting::setEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
if (m_enabled == enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_enabled = enabled;
|
||||||
|
Q_EMIT enabledChanged(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickSetting::setSettingsCommand(const QString &settingsCommand)
|
||||||
|
{
|
||||||
|
if (m_settingsCommand == settingsCommand)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_settingsCommand = settingsCommand;
|
||||||
|
Q_EMIT settingsCommandChanged(settingsCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickSetting::setIconName(const QString &iconName)
|
||||||
|
{
|
||||||
|
if (m_iconName == iconName)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_iconName = iconName;
|
||||||
|
Q_EMIT iconNameChanged(iconName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickSetting::setText(const QString &text)
|
||||||
|
{
|
||||||
|
if (m_text == text)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_text = text;
|
||||||
|
Q_EMIT textChanged(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QuickSetting::setStatus(const QString &status)
|
||||||
|
{
|
||||||
|
if (m_status == status)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_status = status;
|
||||||
|
Q_EMIT statusChanged(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
QQmlListProperty<QObject> QuickSetting::children()
|
||||||
|
{
|
||||||
|
return QQmlListProperty<QObject>(this, &m_children);
|
||||||
|
}
|
||||||
|
|
@ -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 <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
|
@ -68,34 +67,3 @@ private:
|
||||||
QString m_settingsCommand;
|
QString m_settingsCommand;
|
||||||
QList<QObject *> m_children;
|
QList<QObject *> m_children;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QuickSettingsModel : public QAbstractListModel, public QQmlParserStatus
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_INTERFACES(QQmlParserStatus)
|
|
||||||
Q_PROPERTY(QQmlListProperty<QuickSetting> children READ children NOTIFY childrenChanged)
|
|
||||||
Q_CLASSINFO("DefaultProperty", "children")
|
|
||||||
QML_ELEMENT
|
|
||||||
|
|
||||||
public:
|
|
||||||
QuickSettingsModel(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
QVariant data(const QModelIndex &index, int role) const override;
|
|
||||||
int rowCount(const QModelIndex &parent) const override;
|
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
|
||||||
|
|
||||||
QQmlListProperty<QuickSetting> children();
|
|
||||||
|
|
||||||
void classBegin() override;
|
|
||||||
void componentComplete() override;
|
|
||||||
Q_SCRIPTABLE void include(QuickSetting *item);
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void childrenChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QList<QuickSetting *> m_children;
|
|
||||||
QList<QuickSetting *> m_external;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QUICKSETTINGSMODEL_H
|
|
||||||
|
|
@ -80,63 +80,6 @@ void QuickSettingsModel::componentComplete()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////
|
|
||||||
|
|
||||||
QuickSetting::QuickSetting(QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickSetting::setEnabled(bool enabled)
|
|
||||||
{
|
|
||||||
if (m_enabled == enabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_enabled = enabled;
|
|
||||||
Q_EMIT enabledChanged(enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickSetting::setSettingsCommand(const QString &settingsCommand)
|
|
||||||
{
|
|
||||||
if (m_settingsCommand == settingsCommand)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_settingsCommand = settingsCommand;
|
|
||||||
Q_EMIT settingsCommandChanged(settingsCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickSetting::setIconName(const QString &iconName)
|
|
||||||
{
|
|
||||||
if (m_iconName == iconName)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_iconName = iconName;
|
|
||||||
Q_EMIT iconNameChanged(iconName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickSetting::setText(const QString &text)
|
|
||||||
{
|
|
||||||
if (m_text == text)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_text = text;
|
|
||||||
Q_EMIT textChanged(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickSetting::setStatus(const QString &status)
|
|
||||||
{
|
|
||||||
if (m_status == status)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_status = status;
|
|
||||||
Q_EMIT statusChanged(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
QQmlListProperty<QObject> QuickSetting::children()
|
|
||||||
{
|
|
||||||
return QQmlListProperty<QObject>(this, &m_children);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickSettingsModel::include(QuickSetting *item)
|
void QuickSettingsModel::include(QuickSetting *item)
|
||||||
{
|
{
|
||||||
const int c = m_children.count() + m_external.count();
|
const int c = m_children.count() + m_external.count();
|
||||||
45
components/mobileshell/quicksettings/quicksettingsmodel.h
Normal file
45
components/mobileshell/quicksettings/quicksettingsmodel.h
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: LGPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef QUICKSETTINGSMODEL_H
|
||||||
|
#define QUICKSETTINGSMODEL_H
|
||||||
|
|
||||||
|
#include "qqml.h"
|
||||||
|
#include "quicksetting.h"
|
||||||
|
|
||||||
|
#include <QAbstractListModel>
|
||||||
|
#include <QQmlListProperty>
|
||||||
|
|
||||||
|
class QuickSettingsModel : public QAbstractListModel, public QQmlParserStatus
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(QQmlParserStatus)
|
||||||
|
Q_PROPERTY(QQmlListProperty<QuickSetting> children READ children NOTIFY childrenChanged)
|
||||||
|
Q_CLASSINFO("DefaultProperty", "children")
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
|
public:
|
||||||
|
QuickSettingsModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
|
int rowCount(const QModelIndex &parent) const override;
|
||||||
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
|
QQmlListProperty<QuickSetting> children();
|
||||||
|
|
||||||
|
void classBegin() override;
|
||||||
|
void componentComplete() override;
|
||||||
|
Q_SCRIPTABLE void include(QuickSetting *item);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void childrenChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<QuickSetting *> m_children;
|
||||||
|
QList<QuickSetting *> m_external;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QUICKSETTINGSMODEL_H
|
||||||
Loading…
Reference in a new issue