Commit 254fdddb863e4d95af1a468f63873cef8099bc10

Authored by Arthur Bikmullin
1 parent d301ffa0

Fixed MServer start

Showing 1 changed file with 14 additions and 4 deletions
1   -#include <QCoreApplication>
2   -#include <QTcpServer>
3   -
  1 +#include <QProcess>
4 2 #include "singleapplication.h"
5 3 #include "mainwindow.h"
6 4
... ... @@ -10,7 +8,19 @@ int main(int argc, char *argv[])
10 8
11 9 if (app.isRunning())
12 10 {
13   - app.sendMessage(QString(argv[1]));
  11 + if (argc > 1)
  12 + app.sendMessage(QString(argv[1]));
  13 + return 0;
  14 + }
  15 + else if (argc > 1 && (argc < 3 || QString(argv[2]) != "--server"))
  16 + {
  17 + app.quit();
  18 +
  19 + QStringList args;
  20 + args.append(QString(argv[1]));
  21 + args.append("--server");
  22 +
  23 + QProcess::startDetached(QString(argv[0]), args);
14 24 return 0;
15 25 }
16 26
... ...