Networkpacket: Let Qt generate property setters

We don't need to call this explicitly, it is only called by assigning properties
This commit is contained in:
Alexander Lohnau 2023-08-12 13:36:21 +02:00 committed by Albert Vaca Cintora
parent 13ff8832fb
commit 473589cd32

View file

@ -23,11 +23,11 @@ class FileTransferJob;
class KDECONNECTCORE_EXPORT NetworkPacket class KDECONNECTCORE_EXPORT NetworkPacket
{ {
Q_GADGET Q_GADGET
Q_PROPERTY(QString id READ id WRITE setId) Q_PROPERTY(QString id READ id MEMBER m_id)
Q_PROPERTY(QString type READ type WRITE setType) Q_PROPERTY(QString type READ type MEMBER m_type)
Q_PROPERTY(QVariantMap body READ body WRITE setBody) Q_PROPERTY(QVariantMap body READ body MEMBER m_body)
Q_PROPERTY(QVariantMap payloadTransferInfo READ payloadTransferInfo WRITE setPayloadTransferInfo) Q_PROPERTY(QVariantMap payloadTransferInfo READ payloadTransferInfo MEMBER m_payloadTransferInfo)
Q_PROPERTY(qint64 payloadSize READ payloadSize WRITE setPayloadSize) Q_PROPERTY(qint64 payloadSize READ payloadSize MEMBER m_payloadSize)
public: public:
const static int s_protocolVersion; const static int s_protocolVersion;
@ -39,19 +39,15 @@ public:
QByteArray serialize() const; QByteArray serialize() const;
static bool unserialize(const QByteArray &json, NetworkPacket *out); static bool unserialize(const QByteArray &json, NetworkPacket *out);
const QString &id() const inline QString id() const
{ {
return m_id; return m_id;
} }
const QString &type() const inline QString type() const
{ {
return m_type; return m_type;
} }
QVariantMap &body() QVariantMap body() const
{
return m_body;
}
const QVariantMap &body() const
{ {
return m_body; return m_body;
} }
@ -107,23 +103,6 @@ public:
} }
private: private:
void setId(const QString &id)
{
m_id = id;
}
void setType(const QString &t)
{
m_type = t;
}
void setBody(const QVariantMap &b)
{
m_body = b;
}
void setPayloadSize(qint64 s)
{
m_payloadSize = s;
}
QString m_id; QString m_id;
QString m_type; QString m_type;
QVariantMap m_body; QVariantMap m_body;