forked from qt-creator/qt-creator
Boot2Qt: Remove dead ends
Detected by Axivion plugin. Change-Id: Ia06762eb7de7c7c52f4366d624c7c2c510d778e8 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
const int qdbHostMessageVersion = 1;
|
||||||
|
|
||||||
const QString responseField = "response";
|
const QString responseField = "response";
|
||||||
const QString requestField = "request";
|
const QString requestField = "request";
|
||||||
const QString versionField = "_version";
|
const QString versionField = "_version";
|
||||||
@@ -14,39 +16,7 @@ void setVersionField(QJsonObject &obj)
|
|||||||
obj[versionField] = qdbHostMessageVersion;
|
obj[versionField] = qdbHostMessageVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkHostMessageVersion(const QJsonObject &obj)
|
static QString requestTypeString(const RequestType &type)
|
||||||
{
|
|
||||||
return obj[versionField].toInt() == qdbHostMessageVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray createRequest(const RequestType &type)
|
|
||||||
{
|
|
||||||
QJsonObject obj;
|
|
||||||
setVersionField(obj);
|
|
||||||
obj[requestField] = requestTypeString(type);
|
|
||||||
return QJsonDocument{obj}.toJson(QJsonDocument::Compact).append('\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
RequestType requestType(const QJsonObject &obj)
|
|
||||||
{
|
|
||||||
const auto fieldValue = obj[requestField];
|
|
||||||
if (fieldValue == requestTypeString(RequestType::Devices))
|
|
||||||
return RequestType::Devices;
|
|
||||||
if (fieldValue == requestTypeString(RequestType::WatchDevices))
|
|
||||||
return RequestType::WatchDevices;
|
|
||||||
if (fieldValue == requestTypeString(RequestType::StopServer))
|
|
||||||
return RequestType::StopServer;
|
|
||||||
if (fieldValue == requestTypeString(RequestType::Messages))
|
|
||||||
return RequestType::Messages;
|
|
||||||
if (fieldValue == requestTypeString(RequestType::WatchMessages))
|
|
||||||
return RequestType::WatchMessages;
|
|
||||||
if (fieldValue == requestTypeString(RequestType::MessagesAndClear))
|
|
||||||
return RequestType::MessagesAndClear;
|
|
||||||
|
|
||||||
return RequestType::Unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString requestTypeString(const RequestType &type)
|
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case RequestType::Devices:
|
case RequestType::Devices:
|
||||||
@@ -64,15 +34,15 @@ QString requestTypeString(const RequestType &type)
|
|||||||
case RequestType::Unknown:
|
case RequestType::Unknown:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QTC_ASSERT(false, return QString());
|
QTC_ASSERT(false, return {});
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject initializeResponse(const ResponseType &type)
|
QByteArray createRequest(const RequestType &type)
|
||||||
{
|
{
|
||||||
QJsonObject obj;
|
QJsonObject obj;
|
||||||
setVersionField(obj);
|
setVersionField(obj);
|
||||||
obj[responseField] = responseTypeString(type);
|
obj[requestField] = requestTypeString(type);
|
||||||
return obj;
|
return QJsonDocument{obj}.toJson(QJsonDocument::Compact).append('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
ResponseType responseType(const QJsonObject &obj)
|
ResponseType responseType(const QJsonObject &obj)
|
||||||
@@ -118,8 +88,3 @@ QString responseTypeString(const ResponseType &type)
|
|||||||
}
|
}
|
||||||
QTC_ASSERT(false, return QString());
|
QTC_ASSERT(false, return QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray serialiseResponse(const QJsonObject &obj)
|
|
||||||
{
|
|
||||||
return QJsonDocument{obj}.toJson(QJsonDocument::Compact).append('\n');
|
|
||||||
}
|
|
||||||
|
@@ -7,9 +7,6 @@
|
|||||||
#include <QtCore/qjsondocument.h>
|
#include <QtCore/qjsondocument.h>
|
||||||
#include <QtCore/qjsonobject.h>
|
#include <QtCore/qjsonobject.h>
|
||||||
|
|
||||||
const int qdbHostMessageVersion = 1;
|
|
||||||
bool checkHostMessageVersion(const QJsonObject &obj);
|
|
||||||
|
|
||||||
enum class RequestType
|
enum class RequestType
|
||||||
{
|
{
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
@@ -22,8 +19,6 @@ enum class RequestType
|
|||||||
};
|
};
|
||||||
|
|
||||||
QByteArray createRequest(const RequestType &type);
|
QByteArray createRequest(const RequestType &type);
|
||||||
RequestType requestType(const QJsonObject &obj);
|
|
||||||
QString requestTypeString(const RequestType &type);
|
|
||||||
|
|
||||||
enum class ResponseType
|
enum class ResponseType
|
||||||
{
|
{
|
||||||
@@ -37,7 +32,5 @@ enum class ResponseType
|
|||||||
Messages,
|
Messages,
|
||||||
};
|
};
|
||||||
|
|
||||||
QJsonObject initializeResponse(const ResponseType &type);
|
|
||||||
ResponseType responseType(const QJsonObject &obj);
|
ResponseType responseType(const QJsonObject &obj);
|
||||||
QString responseTypeString(const ResponseType &type);
|
QString responseTypeString(const ResponseType &type);
|
||||||
QByteArray serialiseResponse(const QJsonObject &obj);
|
|
||||||
|
@@ -89,11 +89,6 @@ private:
|
|||||||
return tasks;
|
return tasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString defaultDisplayName() const
|
|
||||||
{
|
|
||||||
return RunConfigurationFactory::decoratedTargetName(buildKey(), target());
|
|
||||||
}
|
|
||||||
|
|
||||||
ExecutableAspect executable{this};
|
ExecutableAspect executable{this};
|
||||||
SymbolFileAspect symbolFile{this};
|
SymbolFileAspect symbolFile{this};
|
||||||
RemoteLinux::RemoteLinuxEnvironmentAspect environment{this};
|
RemoteLinux::RemoteLinuxEnvironmentAspect environment{this};
|
||||||
|
Reference in New Issue
Block a user