Skip to content

Commit

Permalink
Implement setting in QML Plugin
Browse files Browse the repository at this point in the history
Contributes-To: sailfishos-patches#333
  • Loading branch information
nephros committed Jan 6, 2023
1 parent 9fa793e commit e712296
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/qml/patchmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,18 @@ void PatchManager::setDeveloperMode(bool developerMode)
}
}

bool PatchManager::strictCompatability() const
{
return getSettingsSync(QStringLiteral("strictCompatability"), true).toBool();
}

void PatchManager::setStrictCompatability(bool strictCompatability)
{
if (putSettingsSync(QStringLiteral("strictCompatability"), strictCompatability)) {
emit strictCompatabilityChanged(strictCompatability);
}
}

bool PatchManager::applyOnBoot() const
{
return getSettingsSync(QStringLiteral("applyOnBoot"), false).toBool();
Expand Down
4 changes: 4 additions & 0 deletions src/qml/patchmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class PatchManager: public QObject
Q_OBJECT
Q_PROPERTY(QString serverMediaUrl READ serverMediaUrl CONSTANT)
Q_PROPERTY(bool developerMode READ developerMode WRITE setDeveloperMode NOTIFY developerModeChanged)
Q_PROPERTY(bool strictCompatability READ strictCompatability WRITE setStrictCompatability NOTIFY strictCompatabilityChanged)
Q_PROPERTY(bool applyOnBoot READ applyOnBoot WRITE setApplyOnBoot NOTIFY applyOnBootChanged)
Q_PROPERTY(bool notifyOnSuccess READ notifyOnSuccess WRITE setNotifyOnSuccess NOTIFY notifyOnSuccessChanged)
Q_PROPERTY(bool bitnessMangle READ bitnessMangle WRITE setBitnessMangle NOTIFY bitnessMangleChanged)
Expand All @@ -85,6 +86,8 @@ class PatchManager: public QObject
QString serverMediaUrl() const;
bool developerMode() const;
void setDeveloperMode(bool developerMode);
bool strictCompatability() const;
void setStrictCompatability(bool strictCompatability);
bool applyOnBoot() const;
bool notifyOnSuccess() const;
void setApplyOnBoot(bool applyOnBoot);
Expand Down Expand Up @@ -165,6 +168,7 @@ public slots:
signals:
void easterReceived(const QString & easterText);
void developerModeChanged(bool developerMode);
void strictCompatabilityChanged(bool strictCompatability);
void applyOnBootChanged(bool applyOnBoot);
void notifyOnSuccessChanged(bool notifyOnSuccess);
void bitnessMangleChanged(bool bitnessMangle);
Expand Down

0 comments on commit e712296

Please sign in to comment.