Commit cfda69eb authored by Marco Martin's avatar Marco Martin
Browse files

keep the same context object around

don't create/destory the translation object every time.
create it once in the ctor and keep it repurposing it for the whole
facecontroller lifecycle

BUG:423040
parent ecacb745
...@@ -274,6 +274,8 @@ SensorFaceController::SensorFaceController(KConfigGroup &config, QQmlEngine *eng ...@@ -274,6 +274,8 @@ SensorFaceController::SensorFaceController(KConfigGroup &config, QQmlEngine *eng
d->sensorsGroup.sync(); d->sensorsGroup.sync();
}); });
d->contextObj = new KLocalizedContext(this);
d->totalSensors = d->resolveSensors(QJsonDocument::fromJson(d->sensorsGroup.readEntry("totalSensors", QString()).toUtf8()).array()); d->totalSensors = d->resolveSensors(QJsonDocument::fromJson(d->sensorsGroup.readEntry("totalSensors", QString()).toUtf8()).array());
d->lowPrioritySensorIds = d->resolveSensors(QJsonDocument::fromJson(d->sensorsGroup.readEntry("lowPrioritySensorIds", QString()).toUtf8()).array()); d->lowPrioritySensorIds = d->resolveSensors(QJsonDocument::fromJson(d->sensorsGroup.readEntry("lowPrioritySensorIds", QString()).toUtf8()).array());
d->highPrioritySensorIds = d->resolveSensors(QJsonDocument::fromJson(d->sensorsGroup.readEntry("highPrioritySensorIds", QString()).toUtf8()).array()); d->highPrioritySensorIds = d->resolveSensors(QJsonDocument::fromJson(d->sensorsGroup.readEntry("highPrioritySensorIds", QString()).toUtf8()).array());
...@@ -431,7 +433,6 @@ void SensorFaceController::setFaceId(const QString &face) ...@@ -431,7 +433,6 @@ void SensorFaceController::setFaceId(const QString &face)
d->facePackage = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("KSysguard/SensorFace"), face); d->facePackage = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("KSysguard/SensorFace"), face);
d->contextObj->deleteLater();
if (d->faceConfiguration) { if (d->faceConfiguration) {
d->faceConfiguration->deleteLater(); d->faceConfiguration->deleteLater();
d->faceConfiguration = nullptr; d->faceConfiguration = nullptr;
...@@ -446,7 +447,6 @@ void SensorFaceController::setFaceId(const QString &face) ...@@ -446,7 +447,6 @@ void SensorFaceController::setFaceId(const QString &face)
return; return;
} }
d->contextObj = new KLocalizedContext(d->engine);
d->contextObj->setTranslationDomain(QLatin1String("ksysguard_face_") + face); d->contextObj->setTranslationDomain(QLatin1String("ksysguard_face_") + face);
//TODO: should be in a different config file rather than metadata //TODO: should be in a different config file rather than metadata
......
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