mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
This is partially an emergency fix also for https://invent.kde.org/plasma/plasma-mobile/-/issues/404, which was potentially introduced by https://invent.kde.org/plasma/plasma-mobile/-/merge_requests/582 This MR extracts the screen brightness implementation from initialstart to a QML plugin, and also ports the action drawer brightness slider implementation to it. This avoids importing the powerdevil screen brightness plugin on the lockscreen, which apparently has a race condition that causes it to sometimes segfault.
41 lines
978 B
C++
41 lines
978 B
C++
// SPDX-FileCopyrightText: 2023 by Devin Lin <devin@kde.org>
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <QDBusServiceWatcher>
|
|
#include <QObject>
|
|
|
|
#include <kscreen/config.h>
|
|
|
|
#include "colorssettings.h"
|
|
|
|
class PrepareUtil : public QObject
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(int scaling READ scaling WRITE setScaling NOTIFY scalingChanged);
|
|
Q_PROPERTY(QStringList scalingOptions READ scalingOptions CONSTANT);
|
|
Q_PROPERTY(bool usingDarkTheme READ usingDarkTheme WRITE setUsingDarkTheme NOTIFY usingDarkThemeChanged)
|
|
|
|
public:
|
|
PrepareUtil(QObject *parent = nullptr);
|
|
|
|
int scaling() const;
|
|
void setScaling(int scaling);
|
|
|
|
QStringList scalingOptions();
|
|
|
|
bool usingDarkTheme() const;
|
|
void setUsingDarkTheme(bool usingDarkTheme);
|
|
|
|
Q_SIGNALS:
|
|
void scalingChanged();
|
|
void usingDarkThemeChanged();
|
|
|
|
private:
|
|
int m_scaling;
|
|
bool m_usingDarkTheme;
|
|
|
|
ColorsSettings *m_colorsSettings;
|
|
KScreen::ConfigPtr m_config;
|
|
};
|