This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
92 lines (69 loc) · 2.34 KB
/
main.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
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 <qtwebengineglobal.h>
#include "demo/mainwindow.h"
#include "qt/webengine/customschemehandler.h"
#include <stdio.h>
#include <execinfo.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
// IMPORTANT: This must match the scheme of the redirect-URI configured in the OAuth2-backend
static const QByteArray CUSTOM_SCHEME = "tenduke";
void handler(int sig) {
void *array[50];
size_t size;
// get void*'s for all entries on the stack
size = backtrace(array, 50);
// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, STDERR_FILENO);
exit(1);
}
int main(int argc, char *argv[])
{
signal(SIGSEGV, handler); // install our handler
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
std::shared_ptr<tenduke::qt::webengine::CustomSchemeHandler> schemeHandler (new tenduke::qt::webengine::CustomSchemeHandler(CUSTOM_SCHEME));
QCoreApplication::setOrganizationName("10Duke SSO demo");
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
schemeHandler->setup();
QtWebEngine::initialize();
#else
// Initialize QtWebEngine first. Initialization order is essential.
QtWebEngine::initialize();
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// Setup the application:
QApplication app(argc, argv);
QCoreApplication::setOrganizationName("10Duke SSO demo");
// Initialize and register the custom scheme handler.
std::shared_ptr<tenduke::qt::webengine::CustomSchemeHandler> schemeHandler (new tenduke::qt::webengine::CustomSchemeHandler(CUSTOM_SCHEME));
schemeHandler->setup();
#endif
tenduke::qt::demo::MainWindow mainWindow(
schemeHandler,
std::shared_ptr<QNetworkAccessManager>(new QNetworkAccessManager()),
nullptr
);
mainWindow.show();
return app.exec();
}
/*
#include "tst/testdefaultlicensing.h"
int main (int argc, char *argv[])
{
tenduke::tst::licensing::testDefaultLicensingWithAutoDiscovery();
return 0;
}
*/
/*
#include "qt/http/testqthttpclient.h"
#include "http/testlibcurlhttpclient.h"
int main (int argc, char *argv[])
{
QApplication app(argc, argv);
tenduke::http::curl::testLibCurlHTTPClient();
tenduke::qt::http::testQtHttpClient();
return 0;
}
*/