mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
preferences: remove pointless member
This could never have worked the way it was used. Some whitespace fixes snuck into this commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d63910caa3
commit
76136010bf
4 changed files with 8 additions and 50 deletions
|
@ -47,7 +47,6 @@ enum def_file_behavior {
|
|||
|
||||
typedef struct {
|
||||
bool dont_check_for_updates;
|
||||
bool dont_check_exists;
|
||||
const char *last_version_used;
|
||||
int next_check;
|
||||
} update_manager_prefs_t;
|
||||
|
|
|
@ -14,7 +14,6 @@ qPrefUpdateManager *qPrefUpdateManager::instance()
|
|||
return self;
|
||||
}
|
||||
|
||||
|
||||
void qPrefUpdateManager::loadSync(bool doSync)
|
||||
{
|
||||
disk_dont_check_for_updates(doSync);
|
||||
|
@ -25,22 +24,9 @@ void qPrefUpdateManager::loadSync(bool doSync)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
HANDLE_PREFERENCE_BOOL_EXT(UpdateManager, "DontCheckForUpdates", dont_check_for_updates, update_manager.);
|
||||
|
||||
void qPrefUpdateManager::set_dont_check_exists(bool value)
|
||||
{
|
||||
if (value != prefs.update_manager.dont_check_exists) {
|
||||
prefs.update_manager.dont_check_exists = value;
|
||||
emit instance()->dont_check_existsChanged(value);
|
||||
}
|
||||
// DO NOT STORE ON DISK
|
||||
}
|
||||
|
||||
|
||||
HANDLE_PREFERENCE_TXT_EXT(UpdateManager, "LastVersionUsed", last_version_used, update_manager.);
|
||||
|
||||
|
||||
void qPrefUpdateManager::set_next_check(const QDate& value)
|
||||
{
|
||||
long time_value = value.toJulianDay();
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
class qPrefUpdateManager : public QObject {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool dont_check_for_updates READ dont_check_for_updates WRITE set_dont_check_for_updates NOTIFY dont_check_for_updatesChanged)
|
||||
Q_PROPERTY(bool dont_check_exists READ dont_check_exists WRITE set_dont_check_exists NOTIFY dont_check_existsChanged)
|
||||
Q_PROPERTY(const QString last_version_used READ last_version_used WRITE set_last_version_used NOTIFY last_version_usedChanged)
|
||||
Q_PROPERTY(const QDate next_check READ next_check WRITE set_next_check NOTIFY next_checkChanged)
|
||||
Q_PROPERTY(const QString uuidString READ uuidString WRITE set_uuidString NOTIFY uuidStringChanged)
|
||||
|
@ -24,21 +23,18 @@ public:
|
|||
|
||||
public:
|
||||
static bool dont_check_for_updates() { return prefs.update_manager.dont_check_for_updates; }
|
||||
static bool dont_check_exists() { return prefs.update_manager.dont_check_exists; }
|
||||
static const QString last_version_used() { return prefs.update_manager.last_version_used; }
|
||||
static const QDate next_check() { return QDate::fromJulianDay(prefs.update_manager.next_check); }
|
||||
static const QString uuidString() { return st_uuidString; }
|
||||
|
||||
public slots:
|
||||
static void set_dont_check_for_updates(bool value);
|
||||
static void set_dont_check_exists(bool value);
|
||||
static void set_last_version_used(const QString& value);
|
||||
static void set_next_check(const QDate& value);
|
||||
static void set_uuidString(const QString& value);
|
||||
|
||||
signals:
|
||||
void dont_check_for_updatesChanged(bool value);
|
||||
void dont_check_existsChanged(bool value);
|
||||
void last_version_usedChanged(const QString& value);
|
||||
void next_checkChanged(const QDate& value);
|
||||
void uuidStringChanged(const QString& value);
|
||||
|
|
|
@ -22,12 +22,10 @@ void TestQPrefUpdateManager::test_struct_get()
|
|||
auto tst = qPrefUpdateManager::instance();
|
||||
|
||||
prefs.update_manager.dont_check_for_updates = true;
|
||||
prefs.update_manager.dont_check_exists = true;
|
||||
prefs.update_manager.last_version_used = copy_qstring("last_version");
|
||||
prefs.update_manager.next_check = QDate::fromString("11/09/1957", "dd/MM/yyyy").toJulianDay();
|
||||
|
||||
QCOMPARE(tst->dont_check_for_updates(), true);
|
||||
QCOMPARE(tst->dont_check_exists(), true);
|
||||
QCOMPARE(tst->last_version_used(), QString("last_version"));
|
||||
QCOMPARE(tst->next_check(), QDate::fromString("11/09/1957", "dd/MM/yyyy"));
|
||||
}
|
||||
|
@ -39,13 +37,11 @@ void TestQPrefUpdateManager::test_set_struct()
|
|||
auto tst = qPrefUpdateManager::instance();
|
||||
|
||||
tst->set_dont_check_for_updates(false);
|
||||
tst->set_dont_check_exists(false);
|
||||
tst->set_last_version_used("last_version2");
|
||||
tst->set_next_check(QDate::fromString("11/09/1957", "dd/MM/yyyy"));
|
||||
tst->set_uuidString("uuid");
|
||||
|
||||
QCOMPARE(prefs.update_manager.dont_check_for_updates, false);
|
||||
QCOMPARE(prefs.update_manager.dont_check_exists, false);
|
||||
QCOMPARE(QString(prefs.update_manager.last_version_used), QString("last_version2"));
|
||||
QCOMPARE(QDate::fromJulianDay(prefs.update_manager.next_check), QDate::fromString("11/09/1957", "dd/MM/yyyy"));
|
||||
QCOMPARE(tst->uuidString(), QString("uuid"));
|
||||
|
@ -59,17 +55,14 @@ void TestQPrefUpdateManager::test_set_load_struct()
|
|||
|
||||
// secure set_ stores on disk
|
||||
prefs.update_manager.dont_check_for_updates = true;
|
||||
prefs.update_manager.dont_check_exists = true;
|
||||
prefs.update_manager.next_check = 100;
|
||||
|
||||
tst->set_dont_check_for_updates(false);
|
||||
tst->set_dont_check_exists(false);
|
||||
tst->set_last_version_used("last_version2");
|
||||
tst->set_next_check(QDate::fromString("11/09/1957", "dd/MM/yyyy"));
|
||||
tst->set_uuidString("uuid2");
|
||||
|
||||
prefs.update_manager.dont_check_for_updates = true;
|
||||
prefs.update_manager.dont_check_exists = true;
|
||||
prefs.update_manager.last_version_used = copy_qstring("last_version");
|
||||
prefs.update_manager.next_check = 1000;
|
||||
|
||||
|
@ -78,9 +71,6 @@ void TestQPrefUpdateManager::test_set_load_struct()
|
|||
QCOMPARE(QString(prefs.update_manager.last_version_used), QString("last_version2"));
|
||||
QCOMPARE(QDate::fromJulianDay(prefs.update_manager.next_check), QDate::fromString("11/09/1957", "dd/MM/yyyy"));
|
||||
QCOMPARE(tst->uuidString(), QString("uuid2"));
|
||||
|
||||
// dont_check_exists is NOT stored on disk
|
||||
QCOMPARE(prefs.update_manager.dont_check_exists, true);
|
||||
}
|
||||
|
||||
void TestQPrefUpdateManager::test_struct_disk()
|
||||
|
@ -90,13 +80,11 @@ void TestQPrefUpdateManager::test_struct_disk()
|
|||
auto tst = qPrefUpdateManager::instance();
|
||||
|
||||
prefs.update_manager.dont_check_for_updates = true;
|
||||
prefs.update_manager.dont_check_exists = true;
|
||||
prefs.update_manager.last_version_used = copy_qstring("last_version");
|
||||
prefs.update_manager.next_check = QDate::fromString("11/09/1957", "dd/MM/yyyy").toJulianDay();
|
||||
|
||||
tst->sync();
|
||||
prefs.update_manager.dont_check_for_updates = false;
|
||||
prefs.update_manager.dont_check_exists = false;
|
||||
prefs.update_manager.last_version_used = copy_qstring("");
|
||||
prefs.update_manager.next_check = 1000;
|
||||
|
||||
|
@ -104,9 +92,6 @@ void TestQPrefUpdateManager::test_struct_disk()
|
|||
QCOMPARE(tst->dont_check_for_updates(), true);
|
||||
QCOMPARE(tst->last_version_used(), QString("last_version"));
|
||||
QCOMPARE(tst->next_check(), QDate::fromString("11/09/1957", "dd/MM/yyyy"));
|
||||
|
||||
// dont_check_exists is NOT stored on disk
|
||||
QCOMPARE(tst->dont_check_exists(), false);
|
||||
}
|
||||
|
||||
void TestQPrefUpdateManager::test_multiple()
|
||||
|
@ -115,13 +100,10 @@ void TestQPrefUpdateManager::test_multiple()
|
|||
|
||||
prefs.update_manager.dont_check_for_updates = false;
|
||||
|
||||
prefs.update_manager.dont_check_exists = false;
|
||||
auto tst = qPrefUpdateManager::instance();
|
||||
|
||||
QCOMPARE(tst->dont_check_for_updates(), qPrefUpdateManager::dont_check_for_updates());
|
||||
QCOMPARE(tst->dont_check_for_updates(), false);
|
||||
QCOMPARE(tst->dont_check_exists(), qPrefUpdateManager::dont_check_exists());
|
||||
QCOMPARE(qPrefUpdateManager::dont_check_exists(), false);
|
||||
}
|
||||
|
||||
void TestQPrefUpdateManager::test_next_check()
|
||||
|
@ -166,27 +148,22 @@ void TestQPrefUpdateManager::test_oldPreferences()
|
|||
void TestQPrefUpdateManager::test_signals()
|
||||
{
|
||||
QSignalSpy spy1(qPrefUpdateManager::instance(), &qPrefUpdateManager::dont_check_for_updatesChanged);
|
||||
QSignalSpy spy2(qPrefUpdateManager::instance(), &qPrefUpdateManager::dont_check_existsChanged);
|
||||
QSignalSpy spy3(qPrefUpdateManager::instance(), &qPrefUpdateManager::last_version_usedChanged);
|
||||
QSignalSpy spy4(qPrefUpdateManager::instance(), &qPrefUpdateManager::next_checkChanged);
|
||||
QSignalSpy spy5(qPrefUpdateManager::instance(), &qPrefUpdateManager::uuidStringChanged);
|
||||
|
||||
prefs.update_manager.dont_check_for_updates = true;
|
||||
qPrefUpdateManager::set_dont_check_for_updates(false);
|
||||
prefs.update_manager.dont_check_exists = true;
|
||||
qPrefUpdateManager::set_dont_check_exists(false);
|
||||
qPrefUpdateManager::set_last_version_used("signal last_version2");
|
||||
qPrefUpdateManager::set_next_check(QDate::fromString("11/09/1967", "dd/MM/yyyy"));
|
||||
qPrefUpdateManager::set_uuidString("signal uuid");
|
||||
|
||||
QCOMPARE(spy1.count(), 1);
|
||||
QCOMPARE(spy2.count(), 1);
|
||||
QCOMPARE(spy3.count(), 1);
|
||||
QCOMPARE(spy4.count(), 1);
|
||||
QCOMPARE(spy5.count(), 1);
|
||||
|
||||
QVERIFY(spy1.takeFirst().at(0).toBool() == false);
|
||||
QVERIFY(spy2.takeFirst().at(0).toBool() == false);
|
||||
QVERIFY(spy3.takeFirst().at(0).toString() == "signal last_version2");
|
||||
QVERIFY(spy4.takeFirst().at(0).toDate() == QDate::fromString("11/09/1967", "dd/MM/yyyy"));
|
||||
QVERIFY(spy5.takeFirst().at(0).toString() == "signal uuid");
|
||||
|
|
Loading…
Reference in a new issue