From 64d49f097f25dd019345a7e913e1c4cf8188e168 Mon Sep 17 00:00:00 2001 From: kh Date: Mon, 24 Nov 2014 17:39:06 +0100 Subject: Implement a way to start the server in debug mode and API cleanup. 1; Passing debug as first argument to the starting server does not start the server side so the server keeps running in an endless loop. This makes it far easier to attach a debugger. 2; API cleanup and unify init function to take port, key, and mode. The address was never able to be changed anyway, so stop passing them around. Change-Id: I2a847f009ed1557a5e136e2b0006de5c62426da2 Reviewed-by: Kai Koehne --- src/sdk/installerbase.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/sdk/installerbase.cpp') diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index 306b37223..6253f3e25 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -57,6 +58,7 @@ #include #include #include +#include InstallerBase::InstallerBase(int &argc, char *argv[]) : SDKApp(argc, argv) @@ -109,8 +111,22 @@ int InstallerBase::run() qDebug() << "Arguments: " << arguments().join(QLatin1String(", ")).toUtf8().constData(); } + CommandLineParser parser; + parser.parse(arguments()); + SDKApp::registerMetaResources(manager.collectionByName("QResources")); - m_core = new QInstaller::PackageManagerCore(magicMarker, oldOperations); + if (parser.isSet(QLatin1String(CommandLineOptions::StartClient))) { + const QStringList arguments = parser.value(QLatin1String(CommandLineOptions::StartServer)) + .split(QLatin1Char(','), QString::SkipEmptyParts); + m_core = new QInstaller::PackageManagerCore(magicMarker, oldOperations, QString(arguments + .value(0, QString::number(QInstaller::Protocol::DefaultPort))).toInt(), + arguments.value(1, QLatin1String(QInstaller::Protocol::DefaultAuthorizationKey)), + QInstaller::Protocol::Mode::Debug); + } else { + m_core = new QInstaller::PackageManagerCore(magicMarker, oldOperations, + 30000 + qrand() % 100, QUuid::createUuid().toString()); + } + { using namespace QInstaller; ProductKeyCheck::instance()->init(m_core); @@ -120,9 +136,6 @@ int InstallerBase::run() if (QInstaller::isVerbose()) dumpResourceTree(); - CommandLineParser parser; - parser.parse(arguments()); - QString controlScript; if (parser.isSet(QLatin1String(CommandLineOptions::Script))) { controlScript = parser.value(QLatin1String(CommandLineOptions::Script)); -- cgit v1.2.3