-
Notifications
You must be signed in to change notification settings - Fork 23
/
showboard.cpp
60 lines (51 loc) · 1.48 KB
/
showboard.cpp
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
#include "showboard.h"
#include "core/workthread.h"
#include "core/resource.h"
#include "core/resourceview.h"
#include "core/control.h"
#include "widget/qsshelper.h"
#ifdef SHOWBOARD_QUICK
#else
#include "quick/whitecanvasquick.h"
#include "quick/quickwidgetitem.h"
#endif
#include "views/whitecanvastools.h"
#include "data/localhttpserver.h"
#include "data/resourcecache.h"
#include "controls/controls.h"
#include <qcomponentcontainer.h>
#include <QQuickWidget>
static QExport<WhiteCanvasTools, ToolButtonProvider> export_tools(QPart::shared);
QComponentContainer & ShowBoard::containter()
{
static QComponentContainer c;
return c;
}
void ShowBoard::init(QScreen * screen)
{
static bool done = false;
if (done) return;
done = true;
QssHelper::applyToAllStylesheet(screen);
qRegisterMetaType<Resource*>();
qRegisterMetaType<QQuickWidget*>();
qRegisterMetaType<ResourceView*>();
qRegisterMetaType<Control*>();
qRegisterMetaType<QHash<QString, QObject*>>();
// qml types
#ifdef SHOWBOARD_QUICK
#else
qmlRegisterType<WhiteCanvasQuick>("ShowBoard", 1, 0, "WhiteCanvasQuick");
qmlRegisterType<QuickWidgetItem>("ShowBoard", 1, 0, "QuickWidgetItem");
#endif
qmlRegisterSingletonType<Destiny>("ShowBoard", 1, 0, "Destiny", [](QQmlEngine *, QJSEngine *) {
return new Destiny();
});
LocalHttpServer::instance()->start();
}
void ShowBoard::exit()
{
LocalHttpServer::instance()->stop();
ResourceCache::stop();
WorkThread::quitAll();
}