mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:03:24 +00:00
core/settings: correct UserSurvey -> userSurvey in qPrefDisplay
QML is quite special, the variables needs to start with lower case in C++ and are used starting with upper case in QML Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
parent
7129ad92a4
commit
7e243fe363
3 changed files with 84 additions and 14 deletions
|
@ -17,8 +17,8 @@ static const QString st_lastDir_default = "";
|
||||||
QString qPrefDisplay::st_theme;
|
QString qPrefDisplay::st_theme;
|
||||||
static const QString st_theme_default = "Blue";
|
static const QString st_theme_default = "Blue";
|
||||||
|
|
||||||
QString qPrefDisplay::st_UserSurvey;
|
QString qPrefDisplay::st_userSurvey;
|
||||||
static const QString st_UserSurvey_default = "";
|
static const QString st_userSurvey_default = "";
|
||||||
|
|
||||||
QByteArray qPrefDisplay::st_mainSplitter;
|
QByteArray qPrefDisplay::st_mainSplitter;
|
||||||
static const QByteArray st_mainSplitter_default = "";
|
static const QByteArray st_mainSplitter_default = "";
|
||||||
|
@ -61,7 +61,7 @@ void qPrefDisplay::loadSync(bool doSync)
|
||||||
if (!doSync) {
|
if (!doSync) {
|
||||||
load_tooltip_position();
|
load_tooltip_position();
|
||||||
load_theme();
|
load_theme();
|
||||||
load_UserSurvey();
|
load_userSurvey();
|
||||||
load_mainSplitter();
|
load_mainSplitter();
|
||||||
load_topSplitter();
|
load_topSplitter();
|
||||||
load_bottomSplitter();
|
load_bottomSplitter();
|
||||||
|
@ -156,7 +156,7 @@ HANDLE_PROP_QSTRING(Display, "Theme/currentTheme", theme);
|
||||||
|
|
||||||
HANDLE_PROP_QPOINTF(Display, "ProfileMap/tooltip_position", tooltip_position);
|
HANDLE_PROP_QPOINTF(Display, "ProfileMap/tooltip_position", tooltip_position);
|
||||||
|
|
||||||
HANDLE_PROP_QSTRING(Display, "UserSurvey/SurveyDone", UserSurvey);
|
HANDLE_PROP_QSTRING(Display, "UserSurvey/SurveyDone", userSurvey);
|
||||||
|
|
||||||
HANDLE_PROP_QBYTEARRAY(Display, "MainWindow/mainSplitter", mainSplitter);
|
HANDLE_PROP_QBYTEARRAY(Display, "MainWindow/mainSplitter", mainSplitter);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class qPrefDisplay : public QObject {
|
||||||
Q_PROPERTY(bool show_developer READ show_developer WRITE set_show_developer NOTIFY show_developerChanged);
|
Q_PROPERTY(bool show_developer READ show_developer WRITE set_show_developer NOTIFY show_developerChanged);
|
||||||
Q_PROPERTY(QString theme READ theme WRITE set_theme NOTIFY themeChanged);
|
Q_PROPERTY(QString theme READ theme WRITE set_theme NOTIFY themeChanged);
|
||||||
Q_PROPERTY(QPointF tooltip_position READ tooltip_position WRITE set_tooltip_position NOTIFY tooltip_positionChanged);
|
Q_PROPERTY(QPointF tooltip_position READ tooltip_position WRITE set_tooltip_position NOTIFY tooltip_positionChanged);
|
||||||
Q_PROPERTY(QString UserSurvey READ UserSurvey WRITE set_UserSurvey NOTIFY UserSurveyChanged);
|
Q_PROPERTY(QString userSurvey READ userSurvey WRITE set_userSurvey NOTIFY userSurveyChanged);
|
||||||
Q_PROPERTY(QByteArray mainSplitter READ mainSplitter WRITE set_mainSplitter NOTIFY mainSplitterChanged);
|
Q_PROPERTY(QByteArray mainSplitter READ mainSplitter WRITE set_mainSplitter NOTIFY mainSplitterChanged);
|
||||||
Q_PROPERTY(QByteArray topSplitter READ topSplitter WRITE set_topSplitter NOTIFY topSplitterChanged);
|
Q_PROPERTY(QByteArray topSplitter READ topSplitter WRITE set_topSplitter NOTIFY topSplitterChanged);
|
||||||
Q_PROPERTY(QByteArray bottomSplitter READ bottomSplitter WRITE set_bottomSplitter NOTIFY bottomSplitterChanged);
|
Q_PROPERTY(QByteArray bottomSplitter READ bottomSplitter WRITE set_bottomSplitter NOTIFY bottomSplitterChanged);
|
||||||
|
@ -43,7 +43,7 @@ public:
|
||||||
static bool show_developer() { return prefs.show_developer; }
|
static bool show_developer() { return prefs.show_developer; }
|
||||||
static QString theme() { return st_theme; }
|
static QString theme() { return st_theme; }
|
||||||
static QPointF tooltip_position() { return st_tooltip_position; }
|
static QPointF tooltip_position() { return st_tooltip_position; }
|
||||||
static QString UserSurvey() { return st_UserSurvey; }
|
static QString userSurvey() { return st_userSurvey; }
|
||||||
static QByteArray mainSplitter() { return st_mainSplitter; }
|
static QByteArray mainSplitter() { return st_mainSplitter; }
|
||||||
static QByteArray topSplitter() { return st_topSplitter; }
|
static QByteArray topSplitter() { return st_topSplitter; }
|
||||||
static QByteArray bottomSplitter() { return st_bottomSplitter; }
|
static QByteArray bottomSplitter() { return st_bottomSplitter; }
|
||||||
|
@ -61,7 +61,7 @@ public slots:
|
||||||
static void set_show_developer(bool value);
|
static void set_show_developer(bool value);
|
||||||
static void set_theme(const QString &value);
|
static void set_theme(const QString &value);
|
||||||
static void set_tooltip_position(const QPointF &value);
|
static void set_tooltip_position(const QPointF &value);
|
||||||
static void set_UserSurvey(const QString &value);
|
static void set_userSurvey(const QString &value);
|
||||||
static void set_mainSplitter(const QByteArray &value);
|
static void set_mainSplitter(const QByteArray &value);
|
||||||
static void set_topSplitter(const QByteArray &value);
|
static void set_topSplitter(const QByteArray &value);
|
||||||
static void set_bottomSplitter(const QByteArray &value);
|
static void set_bottomSplitter(const QByteArray &value);
|
||||||
|
@ -79,7 +79,7 @@ signals:
|
||||||
void show_developerChanged(bool value);
|
void show_developerChanged(bool value);
|
||||||
void themeChanged(const QString &value);
|
void themeChanged(const QString &value);
|
||||||
void tooltip_positionChanged(const QPointF &value);
|
void tooltip_positionChanged(const QPointF &value);
|
||||||
void UserSurveyChanged(const QString &value);
|
void userSurveyChanged(const QString &value);
|
||||||
void mainSplitterChanged(const QByteArray &value);
|
void mainSplitterChanged(const QByteArray &value);
|
||||||
void topSplitterChanged(const QByteArray &value);
|
void topSplitterChanged(const QByteArray &value);
|
||||||
void bottomSplitterChanged(const QByteArray &value);
|
void bottomSplitterChanged(const QByteArray &value);
|
||||||
|
@ -100,7 +100,7 @@ private:
|
||||||
static void load_lastDir();
|
static void load_lastDir();
|
||||||
static void load_theme();
|
static void load_theme();
|
||||||
static void load_tooltip_position();
|
static void load_tooltip_position();
|
||||||
static void load_UserSurvey();
|
static void load_userSurvey();
|
||||||
static void load_mainSplitter();
|
static void load_mainSplitter();
|
||||||
static void load_topSplitter();
|
static void load_topSplitter();
|
||||||
static void load_bottomSplitter();
|
static void load_bottomSplitter();
|
||||||
|
@ -116,7 +116,7 @@ private:
|
||||||
static QString st_lastDir;
|
static QString st_lastDir;
|
||||||
static QString st_theme;
|
static QString st_theme;
|
||||||
static QPointF st_tooltip_position;
|
static QPointF st_tooltip_position;
|
||||||
static QString st_UserSurvey;
|
static QString st_userSurvey;
|
||||||
static QByteArray st_mainSplitter;
|
static QByteArray st_mainSplitter;
|
||||||
static QByteArray st_topSplitter;
|
static QByteArray st_topSplitter;
|
||||||
static QByteArray st_bottomSplitter;
|
static QByteArray st_bottomSplitter;
|
||||||
|
|
|
@ -49,7 +49,7 @@ void TestQPrefDisplay::test_set_struct()
|
||||||
display->set_theme("myTheme");
|
display->set_theme("myTheme");
|
||||||
display->set_lastDir("test1");
|
display->set_lastDir("test1");
|
||||||
display->set_tooltip_position(QPointF(512, 3));
|
display->set_tooltip_position(QPointF(512, 3));
|
||||||
display->set_UserSurvey("my1");
|
display->set_userSurvey("my1");
|
||||||
display->set_mainSplitter("main1");
|
display->set_mainSplitter("main1");
|
||||||
display->set_topSplitter("top1");
|
display->set_topSplitter("top1");
|
||||||
display->set_bottomSplitter("bottom1");
|
display->set_bottomSplitter("bottom1");
|
||||||
|
@ -66,7 +66,7 @@ void TestQPrefDisplay::test_set_struct()
|
||||||
QCOMPARE(display->theme(), QString("myTheme"));
|
QCOMPARE(display->theme(), QString("myTheme"));
|
||||||
QCOMPARE(display->lastDir(), QString("test1"));
|
QCOMPARE(display->lastDir(), QString("test1"));
|
||||||
QCOMPARE(display->tooltip_position(), QPointF(512, 3));
|
QCOMPARE(display->tooltip_position(), QPointF(512, 3));
|
||||||
QCOMPARE(display->UserSurvey(), QString("my1"));
|
QCOMPARE(display->userSurvey(), QString("my1"));
|
||||||
QCOMPARE(display->mainSplitter(), QByteArray("main1"));
|
QCOMPARE(display->mainSplitter(), QByteArray("main1"));
|
||||||
QCOMPARE(display->topSplitter(), QByteArray("top1"));
|
QCOMPARE(display->topSplitter(), QByteArray("top1"));
|
||||||
QCOMPARE(display->bottomSplitter(), QByteArray("bottom1"));
|
QCOMPARE(display->bottomSplitter(), QByteArray("bottom1"));
|
||||||
|
@ -90,7 +90,7 @@ void TestQPrefDisplay::test_set_load_struct()
|
||||||
display->set_theme("myTheme2");
|
display->set_theme("myTheme2");
|
||||||
display->set_lastDir("test2");
|
display->set_lastDir("test2");
|
||||||
display->set_tooltip_position(QPointF(612, 3));
|
display->set_tooltip_position(QPointF(612, 3));
|
||||||
display->set_UserSurvey("my2");
|
display->set_userSurvey("my2");
|
||||||
display->set_mainSplitter("main2");
|
display->set_mainSplitter("main2");
|
||||||
display->set_topSplitter("top2");
|
display->set_topSplitter("top2");
|
||||||
display->set_bottomSplitter("bottom2");
|
display->set_bottomSplitter("bottom2");
|
||||||
|
@ -114,7 +114,7 @@ void TestQPrefDisplay::test_set_load_struct()
|
||||||
QCOMPARE(display->theme(), QString("myTheme2"));
|
QCOMPARE(display->theme(), QString("myTheme2"));
|
||||||
QCOMPARE(display->lastDir(), QString("test2"));
|
QCOMPARE(display->lastDir(), QString("test2"));
|
||||||
QCOMPARE(display->tooltip_position(), QPointF(612, 3));
|
QCOMPARE(display->tooltip_position(), QPointF(612, 3));
|
||||||
QCOMPARE(display->UserSurvey(), QString("my2"));
|
QCOMPARE(display->userSurvey(), QString("my2"));
|
||||||
QCOMPARE(display->mainSplitter(), QByteArray("main2"));
|
QCOMPARE(display->mainSplitter(), QByteArray("main2"));
|
||||||
QCOMPARE(display->topSplitter(), QByteArray("top2"));
|
QCOMPARE(display->topSplitter(), QByteArray("top2"));
|
||||||
QCOMPARE(display->bottomSplitter(), QByteArray("bottom2"));
|
QCOMPARE(display->bottomSplitter(), QByteArray("bottom2"));
|
||||||
|
@ -166,4 +166,74 @@ void TestQPrefDisplay::test_multiple()
|
||||||
QCOMPARE(display->font_size(), 15.0);
|
QCOMPARE(display->font_size(), 15.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestQPrefDisplay::test_signals()
|
||||||
|
{
|
||||||
|
QSignalSpy spy1(qPrefDisplay::instance(), SIGNAL(animation_speedChanged(int)));
|
||||||
|
QSignalSpy spy2(qPrefDisplay::instance(), SIGNAL(display_invalid_divesChanged(bool)));
|
||||||
|
QSignalSpy spy3(qPrefDisplay::instance(), SIGNAL(divelist_fontChanged(QString)));
|
||||||
|
QSignalSpy spy4(qPrefDisplay::instance(), SIGNAL(font_sizeChanged(double)));
|
||||||
|
QSignalSpy spy5(qPrefDisplay::instance(), SIGNAL(show_developerChanged(bool)));
|
||||||
|
QSignalSpy spy6(qPrefDisplay::instance(), SIGNAL(themeChanged(QString)));
|
||||||
|
QSignalSpy spy7(qPrefDisplay::instance(), SIGNAL(lastDirChanged(QString)));
|
||||||
|
QSignalSpy spy8(qPrefDisplay::instance(), SIGNAL(tooltip_positionChanged(QPointF)));
|
||||||
|
QSignalSpy spy9(qPrefDisplay::instance(), SIGNAL(userSurveyChanged(QString)));
|
||||||
|
QSignalSpy spy9(qPrefDisplay::instance(), SIGNAL(userSurveyChanged(QString)));
|
||||||
|
QSignalSpy spy10(qPrefDisplay::instance(), SIGNAL(mainSplitterChanged(QByteArray)));
|
||||||
|
QSignalSpy spy11(qPrefDisplay::instance(), SIGNAL(topSplitterChanged(QByteArray)));
|
||||||
|
QSignalSpy spy12(qPrefDisplay::instance(), SIGNAL(bottomSplitterChanged(QByteArray)));
|
||||||
|
QSignalSpy spy13(qPrefDisplay::instance(), SIGNAL(maximizedChanged(bool)));
|
||||||
|
QSignalSpy spy14(qPrefDisplay::instance(), SIGNAL(geometryChanged(QByteArray)));
|
||||||
|
QSignalSpy spy15(qPrefDisplay::instance(), SIGNAL(windowStateChanged(QByteArray)));
|
||||||
|
QSignalSpy spy16(qPrefDisplay::instance(), SIGNAL(lastStateChanged(int)));
|
||||||
|
|
||||||
|
qPrefDisplay::set_animation_speed(1);
|
||||||
|
qPrefDisplay::set_display_invalid_dives(false);
|
||||||
|
qPrefDisplay::set_divelist_font("signal doNotCareAtAll");
|
||||||
|
qPrefDisplay::set_font_size(2.0);
|
||||||
|
qPrefDisplay::set_show_developer(true);
|
||||||
|
qPrefDisplay::set_theme("signal myTheme");
|
||||||
|
qPrefDisplay::set_lastDir("signal test1");
|
||||||
|
qPrefDisplay::set_tooltip_position(QPointF(12, 3));
|
||||||
|
qPrefDisplay::set_userSurvey("signal my1");
|
||||||
|
qPrefDisplay::set_mainSplitter("signal main1");
|
||||||
|
qPrefDisplay::set_topSplitter("signal top1");
|
||||||
|
qPrefDisplay::set_bottomSplitter("signal bottom1");
|
||||||
|
qPrefDisplay::set_maximized(false);
|
||||||
|
qPrefDisplay::set_geometry("signal geo1");
|
||||||
|
qPrefDisplay::set_windowState("signal win1");
|
||||||
|
qPrefDisplay::set_lastState(17);
|
||||||
|
|
||||||
|
QCOMPARE(spy1.count(), 1);
|
||||||
|
QCOMPARE(spy2.count(), 1);
|
||||||
|
QCOMPARE(spy3.count(), 1);
|
||||||
|
QCOMPARE(spy4.count(), 1);
|
||||||
|
QCOMPARE(spy5.count(), 1);
|
||||||
|
QCOMPARE(spy6.count(), 1);
|
||||||
|
QCOMPARE(spy7.count(), 1);
|
||||||
|
QCOMPARE(spy8.count(), 1);
|
||||||
|
QCOMPARE(spy9.count(), 1);
|
||||||
|
QCOMPARE(spy10.count(), 1);
|
||||||
|
QCOMPARE(spy11.count(), 1);
|
||||||
|
QCOMPARE(spy12.count(), 1);
|
||||||
|
QCOMPARE(spy13.count(), 1);
|
||||||
|
QCOMPARE(spy14.count(), 1);
|
||||||
|
QCOMPARE(spy15.count(), 1);
|
||||||
|
|
||||||
|
QVERIFY(spy1.takeFirst().at(0).toInt() == 1);
|
||||||
|
QVERIFY(spy2.takeFirst().at(0).toBool() == false);
|
||||||
|
QVERIFY(spy3.takeFirst().at(0).toString() == "signal doNotCareAtAll");
|
||||||
|
QVERIFY(spy4.takeFirst().at(0).toDouble() == 2.0);
|
||||||
|
QVERIFY(spy5.takeFirst().at(0).toBool() == true);
|
||||||
|
QVERIFY(spy6.takeFirst().at(0).toString() == "signal myTheme");
|
||||||
|
QVERIFY(spy7.takeFirst().at(0).toString() == "signal test1");
|
||||||
|
QVERIFY(spy8.takeFirst().at(0).toPointF() == QPointF(12, 3));
|
||||||
|
QVERIFY(spy9.takeFirst().at(0).toString() == "signal my1");
|
||||||
|
QVERIFY(spy10.takeFirst().at(0).toByteArray() == QByteArray("signal main1"));
|
||||||
|
QVERIFY(spy11.takeFirst().at(0).toByteArray() == QByteArray("signal top1"));
|
||||||
|
QVERIFY(spy12.takeFirst().at(0).toByteArray() == QByteArray("signal bottom1"));
|
||||||
|
QVERIFY(spy13.takeFirst().at(0).toBool() == false);
|
||||||
|
QVERIFY(spy14.takeFirst().at(0).toByteArray() == QByteArray("signal geo1"));
|
||||||
|
QVERIFY(spy15.takeFirst().at(0).toByteArray() == QByteArray("signal win1"));
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_MAIN(TestQPrefDisplay)
|
QTEST_MAIN(TestQPrefDisplay)
|
||||||
|
|
Loading…
Add table
Reference in a new issue