2015-07-10 21:37:22 +00:00
|
|
|
#include <QApplication>
|
|
|
|
|
#include <QQmlApplicationEngine>
|
|
|
|
|
#include <QtQml>
|
|
|
|
|
|
2015-07-22 15:10:52 +00:00
|
|
|
#include "GrapheneApplication.hpp"
|
|
|
|
|
#include "ChainDataModel.hpp"
|
2015-07-22 21:38:44 +00:00
|
|
|
#include "Transaction.hpp"
|
2015-07-21 21:09:44 +00:00
|
|
|
#include "Operations.hpp"
|
2015-07-22 15:10:52 +00:00
|
|
|
#include "Balance.hpp"
|
2015-07-29 19:50:12 +00:00
|
|
|
#include "Wallet.hpp"
|
2015-07-22 15:10:52 +00:00
|
|
|
|
|
|
|
|
class Crypto {
|
|
|
|
|
Q_GADGET
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Q_INVOKABLE QString sha256(QByteArray data) {
|
|
|
|
|
return QCryptographicHash::hash(data, QCryptographicHash::Sha256).toHex();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
QML_DECLARE_TYPE(Crypto)
|
2015-07-10 21:37:22 +00:00
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
2015-07-27 20:01:16 +00:00
|
|
|
#ifndef NDEBUG
|
|
|
|
|
QQmlDebuggingEnabler enabler;
|
|
|
|
|
#endif
|
|
|
|
|
fc::thread::current().set_name("main");
|
2015-07-10 21:37:22 +00:00
|
|
|
QApplication app(argc, argv);
|
2015-07-13 18:35:17 +00:00
|
|
|
app.setApplicationName("Graphene Client");
|
|
|
|
|
app.setOrganizationDomain("cryptonomex.org");
|
|
|
|
|
app.setOrganizationName("Cryptonomex, Inc.");
|
2015-07-10 21:37:22 +00:00
|
|
|
|
2015-07-13 18:14:58 +00:00
|
|
|
qRegisterMetaType<std::function<void()>>();
|
2015-07-14 19:06:00 +00:00
|
|
|
qRegisterMetaType<ObjectId>();
|
2015-07-27 20:01:16 +00:00
|
|
|
qRegisterMetaType<QList<OperationBase*>>();
|
2015-07-13 18:14:58 +00:00
|
|
|
|
2015-07-10 21:37:22 +00:00
|
|
|
qmlRegisterType<Asset>("Graphene.Client", 0, 1, "Asset");
|
|
|
|
|
qmlRegisterType<Balance>("Graphene.Client", 0, 1, "Balance");
|
|
|
|
|
qmlRegisterType<Account>("Graphene.Client", 0, 1, "Account");
|
2015-07-13 17:19:07 +00:00
|
|
|
qmlRegisterType<ChainDataModel>("Graphene.Client", 0, 1, "DataModel");
|
2015-07-29 19:50:12 +00:00
|
|
|
qmlRegisterType<Wallet>("Graphene.Client", 0, 1, "Wallet");
|
2015-07-13 17:19:07 +00:00
|
|
|
qmlRegisterType<GrapheneApplication>("Graphene.Client", 0, 1, "GrapheneApplication");
|
2015-07-22 21:38:44 +00:00
|
|
|
qmlRegisterType<Transaction>("Graphene.Client", 0, 1, "Transaction");
|
|
|
|
|
|
|
|
|
|
qmlRegisterInterface<OperationBase>("OperationBase");
|
|
|
|
|
qmlRegisterType<TransferOperation>("Graphene.Client", 0, 1, "TransferOperation");
|
|
|
|
|
|
2015-07-21 21:09:44 +00:00
|
|
|
qmlRegisterUncreatableType<OperationBuilder>("Graphene.Client", 0, 1, "OperationBuilder",
|
|
|
|
|
QStringLiteral("OperationBuilder cannot be created from QML"));
|
2015-07-10 21:37:22 +00:00
|
|
|
|
|
|
|
|
QQmlApplicationEngine engine;
|
2015-07-13 21:22:06 +00:00
|
|
|
QVariant crypto;
|
|
|
|
|
crypto.setValue(Crypto());
|
|
|
|
|
engine.rootContext()->setContextProperty("Crypto", crypto);
|
2015-07-13 18:16:02 +00:00
|
|
|
#ifdef NDEBUG
|
2015-07-10 21:37:22 +00:00
|
|
|
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
2015-07-13 18:16:02 +00:00
|
|
|
#else
|
|
|
|
|
engine.load(QUrl(QStringLiteral("qml/main.qml")));
|
|
|
|
|
#endif
|
2015-07-10 21:37:22 +00:00
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
|
}
|
2015-07-22 15:10:52 +00:00
|
|
|
|
|
|
|
|
#include "main.moc"
|