shift-shell/components/mobileshell/shellutil.h
Micah Stanley 681d1683f5 VolumeOSD: Improve design, and prevent touch events from being taken from outside the osd
Fixes: https://invent.kde.org/plasma/plasma-mobile/-/issues/274

Any feedback on these changes would be much appreciated.

![Screenshot_20241024_093458-1](/uploads/7b4f89ace1a53c559737d1c05d591329/Screenshot_20241024_093458-1.png)
![Screenshot_20241023_070919](/uploads/c7b9a8de7c9bba2de01d734408e02b2b/Screenshot_20241023_070919.png)

Change Log:
- NanoShell FullScreenOverlay was changed to a LayerShellQt Window to keep it on the top layer and to prevent the popup from obsorbing all touch inputs.
- New animations were added to the volume popup.
- User can now change the volume by touching and dragging on the popup
- The mute button on the popup was fixed
- Mute buttons were added next to the volume sliders in the AudioApplet page
- Volume icons now dynamically update to the volume level
- Visual design adjustments
2024-10-25 15:52:49 +00:00

80 lines
2 KiB
C++

/*
* SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
* SPDX-FileCopyrightText: 2021-2022 Devin Lin <devin@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QObject>
#include <QQuickItem>
#include <QQuickWindow>
#include <qqmlregistration.h>
#include <KConfigWatcher>
#include <KIO/ApplicationLauncherJob>
#include <KSharedConfig>
/**
* Miscellaneous class to put utility functions used in the shell.
*
* @author Devin Lin <devin@kde.org>
**/
class ShellUtil : public QObject
{
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(bool isSystem24HourFormat READ isSystem24HourFormat NOTIFY isSystem24HourFormatChanged)
public:
ShellUtil(QObject *parent = nullptr);
/**
* Change the stacking order to have the first item behind the second item.
*
* @param item1 The item to move behind.
* @param item2 The item to move in front.
*/
Q_INVOKABLE void stackItemBefore(QQuickItem *item1, QQuickItem *item2);
/**
* Change the stacking order to have the first item in front of the second item.
*
* @param item1 The item to move in front.
* @param item2 The item to move behind.
*/
Q_INVOKABLE void stackItemAfter(QQuickItem *item1, QQuickItem *item2);
/**
* Execute the command given.
*
* @param command The command to execute.
*/
Q_INVOKABLE void executeCommand(const QString &command);
/**
* Launch an application by name.
*
* @param storageId The storage id of the application to launch.
*/
Q_INVOKABLE void launchApp(const QString &storageId);
/**
* Whether the system is using 24 hour format.
*/
Q_INVOKABLE bool isSystem24HourFormat();
/**
* Set window input to be transparent.
*/
Q_INVOKABLE void setInputTransparent(QQuickWindow *window, bool transparent);
Q_SIGNALS:
void isSystem24HourFormatChanged();
private:
KConfigWatcher::Ptr m_localeConfigWatcher;
KSharedConfig::Ptr m_localeConfig;
};