mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr725'
This commit is contained in:
commit
a80409b01f
23
src/main.cpp
23
src/main.cpp
|
@ -21,11 +21,12 @@
|
|||
#include "src/widget/toxsave.h"
|
||||
#include "src/autoupdate.h"
|
||||
#include <QApplication>
|
||||
#include <QFontDatabase>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QCommandLineParser>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFontDatabase>
|
||||
#include <QMutexLocker>
|
||||
|
||||
#include <sodium.h>
|
||||
|
@ -57,6 +58,15 @@ int main(int argc, char *argv[])
|
|||
QApplication a(argc, argv);
|
||||
a.setApplicationName("qTox");
|
||||
a.setOrganizationName("Tox");
|
||||
a.setApplicationVersion("\nGit commit: " + QString(GIT_VERSION));
|
||||
|
||||
// Process arguments
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("qTox, version: " + QString(GIT_VERSION) + "\nBuilt: " + __TIME__ + " " + __DATE__);
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addPositionalArgument("uri", QObject::tr("Tox URI to parse"));
|
||||
parser.process(a);
|
||||
|
||||
Settings::getInstance(); // Build our Settings singleton as soon as QApplication is ready, not before
|
||||
|
||||
|
@ -101,10 +111,9 @@ int main(int argc, char *argv[])
|
|||
ipc.registerEventHandler(&toxURIEventHandler);
|
||||
ipc.registerEventHandler(&toxSaveEventHandler);
|
||||
|
||||
// Process arguments
|
||||
if (argc >= 2)
|
||||
if (parser.positionalArguments().size() > 0)
|
||||
{
|
||||
QString firstParam(argv[1]);
|
||||
QString firstParam(parser.positionalArguments()[0]);
|
||||
// Tox URIs. If there's already another qTox instance running, we ask it to handle the URI and we exit
|
||||
// Otherwise we start a new qTox instance and process it ourselves
|
||||
if (firstParam.startsWith("tox:"))
|
||||
|
|
Loading…
Reference in New Issue
Block a user