-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.cpp
More file actions
92 lines (89 loc) · 3.31 KB
/
main.cpp
File metadata and controls
92 lines (89 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQmlEngine>
#include <QMessageBox>
#include <QFont>
#include <QDebug>
#include "core/common/ddnstylemanager.h"
#include "core/common/ddtextimpwidth.h"
#include "src/widnow/dduiquickview.h"
#include <src/api/httpclient.h>
static QObject * qapp_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine)
Q_UNUSED(scriptEngine)
DDTextImpWidth *example = new DDTextImpWidth();
return example;
}
static QObject * qapp_singletontype_style(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine)
Q_UNUSED(scriptEngine)
DDNStyleManager *example = new DDNStyleManager();
//example->getAllTagsSkins();
//
return example;
}
bool checkExpired(){
QString curData = QDateTime::currentDateTime().toString("yyyyMMdd");
if(curData.toInt() >= 20180912){
QMessageBox::warning(NULL, QObject::tr("DDN Application"),
QObject::tr("The App has a Expired license.\n"
"Do you want to Fees for renewal?"),
QMessageBox::Ok | QMessageBox::Discard
| QMessageBox::Cancel,
QMessageBox::Ok);
return false;
}
return true;
}
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
// if(!checkExpired()){
// return 0;
// }
app.setFont(QFont(QStringLiteral("微软雅黑")));
qmlRegisterSingletonType<DDTextImpWidth>("DDui.ddn", 1, 0, "DDTextImpWidth", qapp_singletontype_provider);
qmlRegisterSingletonType<DDNStyleManager>("DDui.style", 1, 0, "DDNSkin", qapp_singletontype_style);
qmlRegisterType<HttpClient>("HttpClient",1,0,"HttpClient");
DDuiQuickView window;
window.setFlags(Qt::FramelessWindowHint|Qt::Window);
#ifndef QT_DEBUG
window.setSourceAndRegsiterObj(QUrl("qrc:/qml/apps/poetry/DDPoeLogin.qml"));
#else
#ifdef Q_OS_MACOS
window.setSourceAndRegsiterObj(QUrl::fromLocalFile("../../../main.qml"));
#else
window.setSourceAndRegsiterObj(QUrl::fromLocalFile("./../../DDNBlockViewer/qml/apps/poetry/DDPoeLogin.qml"));
#endif
#endif
window.setWindowResizable(true);
window.show();
window.showTrayIcon();
window.notifyToUi();
window.slotCheckUpdater();
#if 0
DDNHttpApi ddnObject;
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("ddnObject", &ddnObject);
DDNTableModel mTableModel;//区块model
DDNTransDetailsModel mTransModel;//交易model
DDNPeerDetailsModel mPeersModel;//节点model
DDNAccountsModel mAccountsModel;
engine.rootContext()->setContextProperty("mTableModel", &mTableModel);
engine.rootContext()->setContextProperty("mTransModel", &mTransModel);
engine.rootContext()->setContextProperty("mPeersModel", &mPeersModel);
engine.rootContext()->setContextProperty("mAccountsModel", &mAccountsModel);
#ifdef QT_NO_DEBUG
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
#else
engine.load(QUrl::fromLocalFile(QStringLiteral("main.qml")));
#endif
if (engine.rootObjects().isEmpty())
return -1;
#endif
return app.exec();
}