From 3e14a855e631d3b76fbd9ee9526adab279d05f18 Mon Sep 17 00:00:00 2001 From: APTX Date: Tue, 9 Apr 2013 21:33:20 +0200 Subject: [PATCH] Add support for editing with aid&epno to MyListAddCommand. If multiple combinations are set aid&epno is preferred, followed by lid, fid and finally ed2k&size. aid can only be used for editing. --- mylistaddcommand.cpp | 64 +++++++++++++++++++++++++++++++++++++++----- mylistaddcommand.h | 17 ++++++++++++ 2 files changed, 75 insertions(+), 6 deletions(-) diff --git a/mylistaddcommand.cpp b/mylistaddcommand.cpp index f8c352b..1c1940b 100644 --- a/mylistaddcommand.cpp +++ b/mylistaddcommand.cpp @@ -36,6 +36,46 @@ MyListAddCommand::MyListAddCommand(int lid) : AbstractCommand() m_edit = true; } +int MyListAddCommand::aid() const +{ + return m_aid; +} + +void MyListAddCommand::setAid(int aid) +{ + m_aid = aid; +} + +int MyListAddCommand::epno() const +{ + return m_epno; +} + +void MyListAddCommand::setEpno(int epno) +{ + m_epno = epno; +} + +int MyListAddCommand::epmin() const +{ + return m_epmin; +} + +void MyListAddCommand::setEpmin(int epmin) +{ + m_epmin = epmin; +} + +QString MyListAddCommand::eptype() const +{ + return m_eptype; +} + +void MyListAddCommand::setEptype(const QString &eptype) +{ + m_eptype = eptype; +} + int MyListAddCommand::fid() const { return m_fid; @@ -115,7 +155,7 @@ bool MyListAddCommand::waitForResult() const bool MyListAddCommand::isValid() const { - return m_fid || (!m_ed2k.isEmpty() && m_size) || (m_lid && m_edit); + return m_fid || (!m_ed2k.isEmpty() && m_size) || (m_lid && m_edit) || (m_aid && m_edit); } Command MyListAddCommand::rawCommand() const @@ -124,7 +164,18 @@ Command MyListAddCommand::rawCommand() const cmd.first = "MYLISTADD"; - if (m_fid) + if (m_edit && m_aid) + { + cmd.second["aid"] = m_aid; + cmd.second["epno"] = m_eptype + QString::number(m_epno); + if (m_epmin) + cmd.second["epmin"] = m_eptype + QString::number(m_epmin); + } + else if (m_edit && m_lid) + { + cmd.second["lid"] = m_lid; + } + else if (m_fid) { cmd.second["fid"] = m_fid; } @@ -133,10 +184,6 @@ Command MyListAddCommand::rawCommand() const cmd.second["ed2k"] = m_ed2k; cmd.second["size"] = m_size; } - else if (m_lid) - { - cmd.second["lid"] = m_lid; - } if (m_edit) { @@ -185,6 +232,11 @@ Command MyListAddCommand::rawCommand() const void MyListAddCommand::init() { + m_aid = 0; + m_epno = 0; + m_epmin = 0; + m_eptype = ""; + m_fid = 0; m_lid = 0; diff --git a/mylistaddcommand.h b/mylistaddcommand.h index 09d6e64..f25d648 100644 --- a/mylistaddcommand.h +++ b/mylistaddcommand.h @@ -36,6 +36,18 @@ public: MyListAddCommand(const QByteArray &ed2k, qint64 size, bool edit); explicit MyListAddCommand(int lid); + int aid() const; + void setAid(int aid); + + int epno() const; + void setEpno(int epno); + + int epmin() const; + void setEpmin(int epmin); + + QString eptype() const; + void setEptype(const QString &eptype); + int fid() const; void setFid(int fid); @@ -62,6 +74,11 @@ public: private: void init(); + int m_aid; + int m_epno; + int m_epmin; + QString m_eptype; + int m_fid; int m_lid; -- 2.52.0