2011-11-03 22:04:35 +04:00
|
|
|
#include <QtGui/QApplication>
|
|
|
|
#include "SyncWindow.h"
|
2011-11-04 23:01:42 +04:00
|
|
|
#include <QSharedMemory>
|
2011-11-03 22:04:35 +04:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2011-11-04 23:01:42 +04:00
|
|
|
// Technique for having only one application running at the same time per
|
|
|
|
// computer.
|
|
|
|
QSharedMemory sharedMemory;
|
|
|
|
sharedMemory.setKey("8SyGEyz2kcI0UNrqxc7wcuKLjD1pSL8GezlBM1W0QckgpjMon0");
|
|
|
|
if(sharedMemory.attach()) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!sharedMemory.create(1)) {
|
|
|
|
return -1; // Exit already a process running
|
|
|
|
}
|
|
|
|
|
|
|
|
// Great. No other instance is running, so we can run the program.
|
2011-11-03 22:04:35 +04:00
|
|
|
QApplication a(argc, argv);
|
|
|
|
SyncWindow w;
|
|
|
|
w.show();
|
|
|
|
|
|
|
|
return a.exec();
|
|
|
|
}
|