nesca/main.cpp

81 lines
1.9 KiB
C++
Raw Permalink Normal View History

2015-02-24 14:00:19 +00:00
#include "nesca_3.h"
#include <QApplication>
2015-02-24 14:14:32 +00:00
#include <qfontdatabase.h>
#include <QMessageBox>
2015-08-07 22:37:28 +00:00
#include <qpixmap.h>
#include "Utils.h"
#include "externData.h"
2015-02-24 14:00:19 +00:00
int main(int argc, char *argv[])
{
2015-08-07 22:37:28 +00:00
bool isWM = false;
2015-09-27 23:29:09 +00:00
//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);
2015-03-23 12:52:07 +00:00
2015-09-27 23:29:09 +00:00
// 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;
//};
2015-03-07 17:31:48 +00:00
2015-08-07 22:37:28 +00:00
QApplication a(argc, argv);
if (isWM) {
2015-09-27 23:29:09 +00:00
//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();
2015-08-07 22:37:28 +00:00
} 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);
2015-09-27 23:29:09 +00:00
//if (isWM) {
// Utils::emitScaryError();
//}
2015-08-07 22:37:28 +00:00
gui->showNormal();
}
2015-02-24 14:00:19 +00:00
return a.exec();
}
2015-02-24 14:14:32 +00:00