Long live FsdClient

This commit is contained in:
Roland Rossgotterer
2019-09-13 11:19:26 +02:00
parent fa6e7108c7
commit acf540be34
90 changed files with 7646 additions and 3699 deletions

View File

@@ -10,8 +10,11 @@
#include "blackcore/context/contextnetworkempty.h"
#include "blackcore/context/contextnetworkimpl.h"
#include "blackcore/context/contextnetworkproxy.h"
#include "blackcore/application.h"
#include "blackmisc/dbusserver.h"
#include "blackconfig/buildconfig.h"
using namespace BlackConfig;
using namespace BlackCore;
using namespace BlackMisc;
@@ -31,5 +34,38 @@ namespace BlackCore
return new CContextNetworkEmpty(runtime);
}
}
const QList<QCommandLineOption> &IContextNetwork::getCmdLineOptions()
{
static const QList<QCommandLineOption> e;
static const QList<QCommandLineOption> opts
{
QCommandLineOption({ "idAndKey", "clientIdAndKey" },
QCoreApplication::translate("CContextNetwork", "Client id and key pair separated by ':', e.g. <id>:<key>."), "clientIdAndKey")
};
// only in not officially shipped versions
return (CBuildConfig::isLocalDeveloperDebugBuild()) ? opts : e;
}
bool IContextNetwork::getCmdLineClientIdAndKey(int &id, QString &key)
{
// init values
id = 0;
key = "";
// split parser values
if (IContextNetwork::getCmdLineOptions().isEmpty()) { return false; } // no such option, avoid warnings
const QString clientIdAndKey = sApp->getParserValue("clientIdAndKey").toLower();
if (clientIdAndKey.isEmpty() || !clientIdAndKey.contains(':')) { return false; }
const QStringList stringList = clientIdAndKey.split(':');
const QString clientIdAsString = stringList[0];
bool ok = true;
id = clientIdAsString.toInt(&ok, 0); // base 0 means C convention
if (!ok || id == 0) { return false; }
key = stringList[1];
return true;
}
} // namesapce
} // namesapce