summaryrefslogtreecommitdiffstats
path: root/src/sdk/installerbase.cpp
diff options
context:
space:
mode:
authorkh <karsten.heimrich@theqtcompany.com>2014-11-24 17:39:06 +0100
committerKarsten Heimrich <karsten.heimrich@theqtcompany.com>2014-11-26 14:49:23 +0100
commit64d49f097f25dd019345a7e913e1c4cf8188e168 (patch)
treeda6670298b59bd04db7d1f5dc62a9ceb79082b7b /src/sdk/installerbase.cpp
parentd18b9696e573aa7b3f38784f6c5764b9fe6fd81b (diff)
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 <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/sdk/installerbase.cpp')
-rw-r--r--src/sdk/installerbase.cpp21
1 files changed, 17 insertions, 4 deletions
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 <packagemanagercore.h>
#include <packagemanagerproxyfactory.h>
#include <qprocesswrapper.h>
+#include <protocol.h>
#include <productkeycheck.h>
#include <settings.h>
#include <utils.h>
@@ -57,6 +58,7 @@
#include <QDirIterator>
#include <QTemporaryFile>
#include <QTranslator>
+#include <QUuid>
InstallerBase::InstallerBase(int &argc, char *argv[])
: SDKApp<QApplication>(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));