Commit 895b9986 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Support disabling config sync in FaceController

In KSysGuardQML, the config group is part of the page configuration.
Since we now want to move page configuration to explicitly save instead
of autosaving, we need control over when syncs happen. So add a boolean
to indicate that we should sync the config, that defaults to true.
parent 325c7ec9
......@@ -169,6 +169,7 @@ public:
QJsonArray lowPrioritySensorIds;
QTimer *syncTimer;
bool shouldSync = true;
FacesModel *availableFacesModel = nullptr;
PresetsModel *availablePresetsModel = nullptr;
};
......@@ -270,6 +271,9 @@ SensorFaceController::SensorFaceController(KConfigGroup &config, QQmlEngine *eng
d->syncTimer->setSingleShot(true);
d->syncTimer->setInterval(5000);
connect(d->syncTimer, &QTimer::timeout, this, [this]() {
if (!d->shouldSync) {
return;
}
d->appearanceGroup.sync();
d->sensorsGroup.sync();
});
......@@ -739,4 +743,18 @@ void SensorFaceController::uninstallPreset(const QString &pluginId)
});
}
bool SensorFaceController::shouldSync() const
{
return d->shouldSync;
}
void SensorFaceController::setShouldSync(bool sync)
{
d->shouldSync = sync;
if (!d->shouldSync && d->syncTimer->isActive()) {
d->syncTimer->stop();
}
}
#include "moc_SensorFaceController.cpp"
......@@ -114,6 +114,9 @@ public:
Q_INVOKABLE void savePreset();
Q_INVOKABLE void uninstallPreset(const QString &pluginId);
bool shouldSync() const;
void setShouldSync(bool sync);
Q_SIGNALS:
void faceIdChanged();
void titleChanged();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment