mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
This MR does several things as a followup to https://invent.kde.org/plasma/plasma-mobile/-/merge_requests/748: - Use the word "lock" instead of "sleep" since we are locking the device, not putting it to sleep - Simplify usage by using existing MouseAreas instead of including our own for this feature (I encountered several focus captures in folio that prevented the SwipeArea from getting events)
56 lines
No EOL
1.4 KiB
C++
56 lines
No EOL
1.4 KiB
C++
// SPDX-FileCopyrightText: 2025 Devin Lin <devin@kde.org>
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "halcyonsettings.h"
|
|
|
|
const QString CFG_KEY_SHOW_WALLPAPER_BLUR = QStringLiteral("showWallpaperBlur");
|
|
const QString CFG_KEY_DOUBLE_TAP_TO_LOCK = QStringLiteral("doubleTapToLock");
|
|
|
|
HalcyonSettings::HalcyonSettings(QObject *parent, KConfigGroup config)
|
|
: QObject{parent}
|
|
, m_config{config}
|
|
{
|
|
load();
|
|
}
|
|
|
|
bool HalcyonSettings::showWallpaperBlur() const
|
|
{
|
|
return m_showWallpaperBlur;
|
|
}
|
|
|
|
void HalcyonSettings::setShowWallpaperBlur(bool showWallpaperBlur)
|
|
{
|
|
if (m_showWallpaperBlur != showWallpaperBlur) {
|
|
m_showWallpaperBlur = showWallpaperBlur;
|
|
Q_EMIT showWallpaperBlurChanged();
|
|
save();
|
|
}
|
|
}
|
|
|
|
bool HalcyonSettings::doubleTapToLock() const
|
|
{
|
|
return m_doubleTapToLock;
|
|
}
|
|
|
|
void HalcyonSettings::setDoubleTapToLock(bool doubleTapToLock)
|
|
{
|
|
if (m_doubleTapToLock != doubleTapToLock) {
|
|
m_doubleTapToLock = doubleTapToLock;
|
|
Q_EMIT doubleTapToLockChanged();
|
|
save();
|
|
}
|
|
}
|
|
|
|
void HalcyonSettings::save()
|
|
{
|
|
m_config.writeEntry(CFG_KEY_SHOW_WALLPAPER_BLUR, m_showWallpaperBlur);
|
|
m_config.writeEntry(CFG_KEY_DOUBLE_TAP_TO_LOCK, m_doubleTapToLock);
|
|
|
|
m_config.sync();
|
|
}
|
|
|
|
void HalcyonSettings::load()
|
|
{
|
|
m_showWallpaperBlur = m_config.readEntry(CFG_KEY_SHOW_WALLPAPER_BLUR, false);
|
|
m_doubleTapToLock = m_config.readEntry(CFG_KEY_DOUBLE_TAP_TO_LOCK, true);
|
|
} |