make sure that only one instance of the application runs

This commit is contained in:
Martin Brodbeck 2018-11-07 16:02:07 +01:00
parent 6c51f8cec5
commit 7a8c7a9d0b
1 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#include <QMessageBox>
#include <QSettings>
#include <QTranslator>
#include <QSharedMemory>
int main(int argc, char* argv[])
{
@ -16,6 +17,13 @@ int main(int argc, char* argv[])
QCoreApplication::setOrganizationDomain("rustysoft.de");
QCoreApplication::setApplicationName("kima2");
// Make sure that only one instance of the application runs
// Of course the uuid used here is unique to this application
QSharedMemory shared("26297455-946a-4607-bfb7-5025a5f1e136");
if (!shared.create(512, QSharedMemory::ReadWrite)) {
exit(0);
}
QTranslator qTranslator;
QLocale german(QLocale::German);
#ifdef __linux__