forked from pantyusha/nesca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
80 lines (74 loc) · 1.9 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
#include "nesca_3.h"
#include <QApplication>
#include <qfontdatabase.h>
#include <QMessageBox>
#include <qpixmap.h>
#include "Utils.h"
#include "externData.h"
int main(int argc, char *argv[])
{
bool isWM = false;
//DWORD Type;
//char value[512] = { 0 };
//char resultString[512] = { 0 };
//HKEY hkey;
//if (RegOpenKey(HKEY_LOCAL_MACHINE,
// TEXT("HARDWARE\\DESCRIPTION\\System"), &hkey) == ERROR_SUCCESS)
//{
// DWORD value_length = 512;
// RegQueryValueEx(hkey, L"VideoBiosVersion", 0, &Type, (BYTE*)&value, &value_length);
// RegCloseKey(hkey);
// for (int i = 0, j = 0; i < 256; ++i, j += 2) {
// char ch = value[j];
// if (ch != '\0') {
// resultString[i] = ch;
// }
// else {
// resultString[i] = '\n';
// }
// }
// resultString[256] = '\0';
//}
//if (strstr(resultString, "VirtualBox") ||
// strstr(resultString, "virtualbox")) {
// isWM = true;
//};
QApplication a(argc, argv);
if (isWM) {
//QMessageBox msgBox(
// QMessageBox::Information,
// "Nope",
// "");
//QPalette palette;
//palette.setBrush(QPalette::Background, Qt::cyan);
//msgBox.setIconPixmap(QPixmap(":/nesca_3/xc.jpg"));
//msgBox.setPalette(palette);
//msgBox.setVisible(true);
//msgBox.exec();
} else {
QStringList list;
list << "small_font.ttf";
int fontID(-1);
bool fontWarningShown(false);
for (QStringList::const_iterator constIterator = list.constBegin(); constIterator != list.constEnd(); ++constIterator) {
QFile res(":/nesca_3/" + *constIterator);
if (res.open(QIODevice::ReadOnly) == false) {
if (fontWarningShown == false) {
fontWarningShown = true;
}
}
else {
fontID = QFontDatabase::addApplicationFontFromData(res.readAll());
if (fontID == -1 && fontWarningShown == false) {
fontWarningShown = true;
}
}
}
nesca_3 *gui = new nesca_3(isWM, 0);
//if (isWM) {
// Utils::emitScaryError();
//}
gui->showNormal();
}
return a.exec();
}