-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement scheduled "Display on Lift Wrist"
Fixes #100 AmazfishConfig files re-saved with unix line-endings
- Loading branch information
Showing
4 changed files
with
350 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,67 @@ | ||
#include "amazfishconfig.h" | ||
|
||
#include <QCoreApplication> | ||
|
||
#ifdef MER_EDITION_SAILFISH | ||
#include <MDConfGroup> | ||
#endif | ||
|
||
#include <functional> | ||
|
||
|
||
AmazfishConfig::AmazfishConfig(QObject *parent) | ||
: QObject(parent) | ||
#ifdef MER_EDITION_SAILFISH | ||
, m_group(new MDConfGroup(QStringLiteral("/uk/co/piggz/amazfish"), this)) | ||
#endif | ||
{ | ||
|
||
} | ||
|
||
AmazfishConfig *AmazfishConfig::instance() | ||
{ | ||
static AmazfishConfig *inst = nullptr; | ||
if (!inst) { | ||
inst = new AmazfishConfig(qApp); | ||
} | ||
return inst; | ||
} | ||
|
||
QVariant AmazfishConfig::value(const QString &key, const QVariant &def) const | ||
{ | ||
#ifdef MER_EDITION_SAILFISH | ||
return m_group->value(key, def); | ||
#else | ||
QSettings settings; | ||
return settings.value(key, def); | ||
#endif | ||
} | ||
|
||
void AmazfishConfig::setValue(const QString &key, const QVariant &value) | ||
{ | ||
#ifdef MER_EDITION_SAILFISH | ||
m_group->setValue(key, value); | ||
#else | ||
QSettings settings; | ||
settings.setValue(key, value); | ||
#endif | ||
} | ||
|
||
void AmazfishConfig::setValue(const QString &key, const QVariant &value, signal_ptr signal) | ||
{ | ||
#ifdef MER_EDITION_SAILFISH | ||
auto prev = m_group->value(key); | ||
#else | ||
QSettings settings; | ||
auto prev = settings.value(key); | ||
#endif | ||
|
||
if (value != prev) { | ||
#ifdef MER_EDITION_SAILFISH | ||
m_group->setValue(key, value); | ||
#else | ||
settings.setValue(key, value); | ||
#endif | ||
emit std::bind(signal, this)(); | ||
} | ||
} | ||
#include "amazfishconfig.h" | ||
|
||
#include <QCoreApplication> | ||
|
||
#ifdef MER_EDITION_SAILFISH | ||
#include <MDConfGroup> | ||
#endif | ||
|
||
#include <functional> | ||
|
||
|
||
AmazfishConfig::AmazfishConfig(QObject *parent) | ||
: QObject(parent) | ||
#ifdef MER_EDITION_SAILFISH | ||
, m_group(new MDConfGroup(QStringLiteral("/uk/co/piggz/amazfish"), this)) | ||
#endif | ||
{ | ||
|
||
} | ||
|
||
AmazfishConfig *AmazfishConfig::instance() | ||
{ | ||
static AmazfishConfig *inst = nullptr; | ||
if (!inst) { | ||
inst = new AmazfishConfig(qApp); | ||
} | ||
return inst; | ||
} | ||
|
||
QVariant AmazfishConfig::value(const QString &key, const QVariant &def) const | ||
{ | ||
#ifdef MER_EDITION_SAILFISH | ||
return m_group->value(key, def); | ||
#else | ||
QSettings settings; | ||
return settings.value(key, def); | ||
#endif | ||
} | ||
|
||
void AmazfishConfig::setValue(const QString &key, const QVariant &value) | ||
{ | ||
#ifdef MER_EDITION_SAILFISH | ||
m_group->setValue(key, value); | ||
#else | ||
QSettings settings; | ||
settings.setValue(key, value); | ||
#endif | ||
} | ||
|
||
void AmazfishConfig::setValue(const QString &key, const QVariant &value, signal_ptr signal) | ||
{ | ||
#ifdef MER_EDITION_SAILFISH | ||
auto prev = m_group->value(key); | ||
#else | ||
QSettings settings; | ||
auto prev = settings.value(key); | ||
#endif | ||
|
||
if (value != prev) { | ||
#ifdef MER_EDITION_SAILFISH | ||
m_group->setValue(key, value); | ||
#else | ||
settings.setValue(key, value); | ||
#endif | ||
emit std::bind(signal, this)(); | ||
} | ||
} |
Oops, something went wrong.