summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/remoteclient.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/libs/installer/remoteclient.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/libs/installer/remoteclient.cpp')
-rw-r--r--src/libs/installer/remoteclient.cpp43
1 files changed, 9 insertions, 34 deletions
diff --git a/src/libs/installer/remoteclient.cpp b/src/libs/installer/remoteclient.cpp
index ce317847f..d8c8478b6 100644
--- a/src/libs/installer/remoteclient.cpp
+++ b/src/libs/installer/remoteclient.cpp
@@ -39,14 +39,6 @@
namespace QInstaller {
-class RemoteClientGuard
-{
-public:
- RemoteClient client;
-};
-Q_GLOBAL_STATIC(RemoteClientGuard, remoteClientGuard);
-static RemoteClientGuard *gGuard = remoteClientGuard();
-
RemoteClient::RemoteClient()
: d_ptr(new RemoteClientPrivate(this))
{
@@ -60,7 +52,8 @@ RemoteClient::~RemoteClient()
RemoteClient &RemoteClient::instance()
{
- return gGuard->client;
+ static RemoteClient instance;
+ return instance;
}
quint16 RemoteClient::port() const
@@ -81,18 +74,15 @@ QString RemoteClient::authorizationKey() const
return d->m_key;
}
-void RemoteClient::setAuthorizationKey(const QString &key)
-{
- Q_D(RemoteClient);
- if (d->m_serverStarted)
- return;
- d->m_key = key;
-}
-
-void RemoteClient::init(quint16 port, const QHostAddress &address, Protocol::Mode mode)
+/*!
+ Initializes the client with \a port, the port to write to, with \a key, the key the client
+ sends to authenticate with the server, \a mode and \a startAs.
+*/
+void RemoteClient::init(quint16 port, const QString &key, Protocol::Mode mode,
+ Protocol::StartAs startAs)
{
Q_D(RemoteClient);
- d->init(port, address, mode);
+ d->init(port, key, mode, startAs);
}
void RemoteClient::shutdown()
@@ -155,19 +145,4 @@ void RemoteClient::setActive(bool active)
}
}
-void RemoteClient::setStartServerCommand(const QString &command, Protocol::StartAs startAs)
-{
- setStartServerCommand(command, QStringList(), startAs);
-}
-
-void RemoteClient::setStartServerCommand(const QString &command, const QStringList &arguments,
- Protocol::StartAs startAs)
-{
- Q_D(RemoteClient);
- d->maybeStopServer();
- d->m_serverCommand = command;
- d->m_serverArguments = arguments;
- d->m_startServerAs = startAs;
-}
-
} // namespace QInstaller