summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qmlinterface.cpp10
-rw-r--r--mobile-widgets/qmlinterface.h4
2 files changed, 3 insertions, 11 deletions
diff --git a/mobile-widgets/qmlinterface.cpp b/mobile-widgets/qmlinterface.cpp
index 67d4196a3..4bf23dedf 100644
--- a/mobile-widgets/qmlinterface.cpp
+++ b/mobile-widgets/qmlinterface.cpp
@@ -81,16 +81,11 @@ QMLInterface::QMLInterface()
this, &QMLInterface::display_variationsChanged);
}
-QMLInterface *QMLInterface::instance()
-{
- static QMLInterface *self = new QMLInterface;
- return self;
-}
-
void QMLInterface::setup(QQmlContext *ct)
{
// Register interface class
- ct->setContextProperty("Backend", QMLInterface::instance());
+ static QMLInterface self;
+ ct->setContextProperty("Backend", &self);
// Make enums available as types
qmlRegisterUncreatableType<QMLInterface>("org.subsurfacedivelog.mobile",1,0,"Enums","Enum is not a type");
@@ -100,7 +95,6 @@ void QMLInterface::setup(QQmlContext *ct)
diveSummary::summaryCalculation(0, 3);
}
-
void QMLInterface::summaryCalculation(int primaryPeriod, int secondaryPeriod)
{
diveSummary::summaryCalculation(primaryPeriod, secondaryPeriod);
diff --git a/mobile-widgets/qmlinterface.h b/mobile-widgets/qmlinterface.h
index 3c6022daa..1aced7a9d 100644
--- a/mobile-widgets/qmlinterface.h
+++ b/mobile-widgets/qmlinterface.h
@@ -81,9 +81,7 @@ class QMLInterface : public QObject {
Q_PROPERTY(QStringList diveSummaryText READ diveSummaryText NOTIFY diveSummaryTextChanged);
public:
- static QMLInterface *instance();
-
- // function to do the needed setup and do connect of signal/signal
+ // function to do the needed setup
static void setup(QQmlContext *ct);
// Duplicated enums, these enums are properly defined in the C/C++ structure