[GUI] Build out infrastructure a bit
This commit is contained in:
parent
eb4f39e78c
commit
7d18c286a4
4 changed files with 33 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
#include "ClientDataModel.hpp"
|
#include "ClientDataModel.hpp"
|
||||||
|
|
||||||
|
|
||||||
Account* ClientDataModel::getAccount(quint64 id) const
|
Account* ChainDataModel::getAccount(quint64 id) const
|
||||||
{
|
{
|
||||||
auto acct = new Account;
|
auto acct = new Account;
|
||||||
acct->setProperty("id", id);
|
acct->setProperty("id", id);
|
||||||
|
|
@ -9,7 +9,7 @@ Account* ClientDataModel::getAccount(quint64 id) const
|
||||||
return acct;
|
return acct;
|
||||||
}
|
}
|
||||||
|
|
||||||
Account*ClientDataModel::getAccount(QString name) const
|
Account*ChainDataModel::getAccount(QString name) const
|
||||||
{
|
{
|
||||||
auto acct = new Account;
|
auto acct = new Account;
|
||||||
acct->setProperty("id", 800);
|
acct->setProperty("id", 800);
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,36 @@ public:
|
||||||
QQmlListProperty<Balance> balances();
|
QQmlListProperty<Balance> balances();
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClientDataModel : public QObject {
|
class ChainDataModel : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Q_INVOKABLE Account* getAccount(quint64 id)const;
|
Q_INVOKABLE Account* getAccount(quint64 id)const;
|
||||||
Q_INVOKABLE Account* getAccount(QString name)const;
|
Q_INVOKABLE Account* getAccount(QString name)const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class GrapheneApplication : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_PROPERTY(ChainDataModel* model READ model CONSTANT)
|
||||||
|
Q_PROPERTY(bool isConnected READ isConnected NOTIFY isConnectedChanged)
|
||||||
|
|
||||||
|
ChainDataModel* m_model;
|
||||||
|
bool m_isConnected;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ChainDataModel* model() const
|
||||||
|
{
|
||||||
|
return m_model;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_INVOKABLE void initialize(QString dataDirectory, QString apiUrl);
|
||||||
|
|
||||||
|
bool isConnected() const
|
||||||
|
{
|
||||||
|
return m_isConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void isConnectedChanged(bool isConnected);
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ int main(int argc, char *argv[])
|
||||||
qmlRegisterType<Asset>("Graphene.Client", 0, 1, "Asset");
|
qmlRegisterType<Asset>("Graphene.Client", 0, 1, "Asset");
|
||||||
qmlRegisterType<Balance>("Graphene.Client", 0, 1, "Balance");
|
qmlRegisterType<Balance>("Graphene.Client", 0, 1, "Balance");
|
||||||
qmlRegisterType<Account>("Graphene.Client", 0, 1, "Account");
|
qmlRegisterType<Account>("Graphene.Client", 0, 1, "Account");
|
||||||
qmlRegisterType<ClientDataModel>("Graphene.Client", 0, 1, "DataModel");
|
qmlRegisterType<ChainDataModel>("Graphene.Client", 0, 1, "DataModel");
|
||||||
|
qmlRegisterType<GrapheneApplication>("Graphene.Client", 0, 1, "GrapheneApplication");
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DataModel {
|
GrapheneApplication {
|
||||||
id: model
|
id: app
|
||||||
}
|
}
|
||||||
Settings {
|
Settings {
|
||||||
id: appSettings
|
id: appSettings
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue