forked from SaschaWillems/VulkanCapsViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
53 lines (46 loc) · 1.65 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
#include "vulkancapsviewer.h"
#include <QtWidgets/QApplication>
#include <QDebug>
#include <QCommandLineParser>
#include <QApplication>
#include <QtGlobal>
int main(int argc, char *argv[])
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QApplication a(argc, argv);
a.setApplicationVersion(QString::fromStdString(vulkanCapsViewer::version));
QCommandLineParser parser;
QCommandLineOption optionDBUser("u", "User name for protected database access", "dbuser", "");
QCommandLineOption optionDBPass("p", "Password for protected database access", "dbpass", "");
QCommandLineOption optionSaveReport("s", "Save report to file without starting the GUI", "savereport", "");
parser.setApplicationDescription("Vulkan Hardware Capability Viewer");
parser.addHelpOption();
parser.addVersionOption();
parser.addOption(optionDBUser);
parser.addOption(optionDBPass);
parser.addOption(optionSaveReport);
//parser.parse(a.arguments());
parser.process(a);
if (parser.isSet(optionDBUser))
{
VulkanDatabase::dbUser = parser.value(optionDBUser);
}
if (parser.isSet(optionDBPass))
{
VulkanDatabase::dbPass = parser.value(optionDBPass);
}
VulkanDatabase::dbLogin = (!VulkanDatabase::dbUser.isEmpty()) && (!VulkanDatabase::dbPass.isEmpty());
vulkanCapsViewer w;
if (parser.isSet(optionSaveReport))
{
w.exportReportAsJSON(parser.value(optionSaveReport).toStdString(), "", "");
return 0;
}
else
{
w.show();
return a.exec();
}
}