You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
#include "mainwindow.h"
|
|
#include <QApplication>
|
|
//#include <QDesktopWidget>
|
|
#include <QSharedPointer>
|
|
#include <QTranslator>
|
|
#include <QLibraryInfo>
|
|
#include <QMessageBox>
|
|
|
|
#include "application.h"
|
|
|
|
#ifdef _WIN32
|
|
#include <Windows.h>
|
|
#endif
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
Application a(argc, argv);
|
|
|
|
if (!a.lock())
|
|
{
|
|
QMessageBox::warning(nullptr, "Prodejna is running", "Prodejna is allready running. Only one instance can be started.");
|
|
return -42;
|
|
}
|
|
|
|
#ifdef _WIN32
|
|
QString exePath = a.applicationDirPath();
|
|
exePath = exePath.append("\\plugins");
|
|
|
|
wchar_t Path[10000];
|
|
::GetEnvironmentVariable(L"PATH", Path, sizeof(Path) / sizeof(TCHAR));
|
|
QString pathVar = QString::fromWCharArray(Path);
|
|
QString newPath = exePath.append(";").append(pathVar);
|
|
|
|
::SetEnvironmentVariable(TEXT("PATH"), newPath.toStdWString().c_str());
|
|
#endif
|
|
|
|
QTranslator qtTranslator;
|
|
if (qtTranslator.load("qt_" + QLocale::system().name(),
|
|
QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
|
|
qDebug() << "Cannot load translation";
|
|
}
|
|
a.installTranslator(&qtTranslator);
|
|
|
|
QTranslator myappTranslator;
|
|
if (myappTranslator.load(":/translations/prodejna_" + QLocale::system().name())) {
|
|
qDebug() << "Cannot load translation";
|
|
}
|
|
a.installTranslator(&myappTranslator);
|
|
|
|
MainWindow w;
|
|
w.showMaximized();
|
|
|
|
return a.exec();
|
|
}
|