Allow running only one instance of application.
This commit is contained in:
+10
-1
@@ -3,6 +3,9 @@
|
||||
#include <QDesktopWidget>
|
||||
#include <QTranslator>
|
||||
#include <QLibraryInfo>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "application.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
@@ -10,7 +13,13 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
Application a(argc, argv);
|
||||
|
||||
if (!a.lock())
|
||||
{
|
||||
QMessageBox::warning(NULL, "Prodejna is running", "Prodejna is allready running. Only one instance can be started.");
|
||||
return -42;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
QString exePath = a.applicationDirPath();
|
||||
|
||||
Reference in New Issue
Block a user