Add QMLManager class

Add a QMLManager class. This class will be used as a link between
the C++ and QML aspects of the mobile application.

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Grace Karanja 2015-06-04 13:29:50 +03:00 committed by Dirk Hohndel
parent 6ba5b45c00
commit 59be048549
2 changed files with 62 additions and 0 deletions

31
qt-mobile/qmlmanager.cpp Normal file
View file

@ -0,0 +1,31 @@
#include "qmlmanager.h"
QMLManager::QMLManager()
{
}
QMLManager::~QMLManager()
{
}
QString QMLManager::filename()
{
return m_fileName;
}
void QMLManager::setFilename(const QString &f)
{
m_fileName = f;
emit filenameChanged();
loadFile();
}
void QMLManager::loadFile()
{
QUrl url(m_fileName);
QString strippedFileName = url.toLocalFile();
}

31
qt-mobile/qmlmanager.h Normal file
View file

@ -0,0 +1,31 @@
#ifndef QMLMANAGER_H
#define QMLMANAGER_H
#include <QObject>
#include <QString>
class QMLManager : public QObject
{
Q_OBJECT
Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged)
public:
QMLManager();
~QMLManager();
QString filename();
void getFile();
public slots:
void setFilename(const QString &f);
private:
QString m_fileName;
void loadFile();
signals:
void filenameChanged();
};
#endif