ssrf: mobile-helper, check return code from qmlRegisterType

add check for return code in qmlRegisterType calls, and log a
message if failed

There are a lot of name restrictions (e.g. must start with a capital letter).

Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
jan Iversen 2018-07-09 10:06:32 +02:00 committed by Dirk Hohndel
parent 8d66633fe7
commit 06593bd642

View file

@ -55,18 +55,37 @@ void init_ui()
void run_ui() void run_ui()
{ {
int rc;
LOG_STP("run_ui starting"); LOG_STP("run_ui starting");
qmlRegisterType<qPref>("org.subsurfacedivelog.mobile", 1, 0, "SsrfPrefs"); rc = qmlRegisterType<qPref>("org.subsurfacedivelog.mobile", 1, 0, "SsrfPrefs");
qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager"); if (rc < 0)
qmlRegisterType<QMLPrefs>("org.subsurfacedivelog.mobile", 1, 0, "QMLPrefs"); qDebug() << "ERROR: Cannot register Prefs (class qPref), QML will not work!!";
qmlRegisterType<QMLProfile>("org.subsurfacedivelog.mobile", 1, 0, "QMLProfile"); rc = qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
if (rc < 0)
qDebug() << "ERROR: Cannot register QMLManager, QML will not work!!";
rc = qmlRegisterType<QMLPrefs>("org.subsurfacedivelog.mobile", 1, 0, "QMLPrefs");
if (rc < 0)
qDebug() << "ERROR: Cannot register QMLPrefs, QML will not work!!";
rc = qmlRegisterType<QMLProfile>("org.subsurfacedivelog.mobile", 1, 0, "QMLProfile");
if (rc < 0)
qDebug() << "ERROR: Cannot register QMLProfile, QML will not work!!";
qmlRegisterType<DownloadThread>("org.subsurfacedivelog.mobile", 1, 0, "DCDownloadThread"); rc = qmlRegisterType<DownloadThread>("org.subsurfacedivelog.mobile", 1, 0, "DCDownloadThread");
qmlRegisterType<DiveImportedModel>("org.subsurfacedivelog.mobile", 1, 0, "DCImportModel"); if (rc < 0)
qDebug() << "ERROR: Cannot register DCDownloadThread, QML will not work!!";
rc = qmlRegisterType<DiveImportedModel>("org.subsurfacedivelog.mobile", 1, 0, "DCImportModel");
if (rc < 0)
qDebug() << "ERROR: Cannot register DCImportModel, QML will not work!!";
qmlRegisterType<MapWidgetHelper>("org.subsurfacedivelog.mobile", 1, 0, "MapWidgetHelper"); rc = qmlRegisterType<MapWidgetHelper>("org.subsurfacedivelog.mobile", 1, 0, "MapWidgetHelper");
qmlRegisterType<MapLocationModel>("org.subsurfacedivelog.mobile", 1, 0, "MapLocationModel"); if (rc < 0)
qmlRegisterType<MapLocation>("org.subsurfacedivelog.mobile", 1, 0, "MapLocation"); qDebug() << "ERROR: Cannot register MapWidgetHelper, QML will not work!!";
rc = qmlRegisterType<MapLocationModel>("org.subsurfacedivelog.mobile", 1, 0, "MapLocationModel");
if (rc < 0)
qDebug() << "ERROR: Cannot register MapLocationModel, QML will not work!!";
rc = qmlRegisterType<MapLocation>("org.subsurfacedivelog.mobile", 1, 0, "MapLocation");
if (rc < 0)
qDebug() << "ERROR: Cannot register MapLocation, QML will not work!!";
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
LOG_STP("run_ui qml engine started"); LOG_STP("run_ui qml engine started");