clientsentcommandsmodel.cpp \\r
clientqueuedcommandsmodel.cpp \\r
filerenamedelegate.cpp \\r
- clientinterface.cpp\r
+ clientinterface.cpp \\r
+ myliststate.cpp\r
\r
HEADERS += client.h \\r
anidbudpclient_global.h \\r
clientsentcommandsmodel.h \\r
clientqueuedcommandsmodel.h \\r
filerenamedelegate.h \\r
- clientinterface.h\r
+ clientinterface.h \\r
+ myliststate.h\r
\r
CONV_HEADERS += include/AniDBUdpClient/Client \\r
include/AniDBUdpClient/AbstractCommand \\r
--- /dev/null
+#include "../../myliststate.h"
\ No newline at end of file
m_edit = edit;
}
-State MyListAddCommand::state() const
-{
- return m_state;
-}
-
-void MyListAddCommand::setState(State state)
-{
- m_state = state;
-}
-
-MyListAddCommand::ViewedState MyListAddCommand::viewed() const
-{
- return m_viewed;
-}
-
-void MyListAddCommand::setViewed(MyListAddCommand::ViewedState viewed)
-{
- m_viewed = viewed;
-}
-
-void MyListAddCommand::setViewed(bool viewed)
-{
- m_viewed = viewed ? Viewed : NotViewed;
-}
-
-QDateTime MyListAddCommand::viewDate() const
-{
- return m_viewDate;
-}
-
-void MyListAddCommand::setViewDate(QDateTime viewDate)
-{
- m_viewDate = viewDate;
-}
-
-QString MyListAddCommand::source() const
-{
- return m_source;
-}
-
-void MyListAddCommand::setSource(QString source)
-{
- m_source = source;
-}
-
-QString MyListAddCommand::storage() const
-{
- return m_storage;
-}
-
-void MyListAddCommand::setStorage(QString storage)
-{
- m_storage = storage;
-}
-
-QString MyListAddCommand::other() const
-{
- return m_other;
-}
-
-void MyListAddCommand::setOther(QString other)
-{
- m_other = other;
+MyListState MyListAddCommand::myListState() const
+{
+ MyListState state;
+ state.m_state = m_state;
+ state.m_viewed = m_viewed;
+ state.m_viewDate = m_viewDate;
+ state.m_source = m_source;
+ state.m_storage = m_storage;
+ state.m_other = m_other;
+ return state;
+}
+
+void MyListAddCommand::setMyListState(const MyListState &state)
+{
+ m_state = state.m_state;
+ m_viewed = state.m_viewed;
+ m_viewDate = state.m_viewDate;
+ m_source = state.m_source;
+ m_storage = state.m_storage;
+ m_other = state.m_other;
}
bool MyListAddCommand::waitForResult() const
#define MYLISTADDCOMMAND_H
#include "abstractcommand.h"
-
-#include <QFuture>
-#include <QFutureWatcher>
-#include <QTime>
+#include "myliststate.h"
namespace AniDBUdpClient {
class MyListAddReply;
-class ANIDBUDPCLIENTSHARED_EXPORT MyListAddCommand : public AbstractCommand
+class ANIDBUDPCLIENTSHARED_EXPORT MyListAddCommand : public AbstractCommand, public MyListState
{
/*
Q_ENUMS(ViewedState);
*/
public:
typedef MyListAddReply ReplyType;
- enum ViewedState {
- Unset = -1,
- NotViewed = 0,
- Viewed = 1,
- };
MyListAddCommand();
MyListAddCommand(int fid, bool edit);
bool edit() const;
void setEdit(bool edit);
- State state() const;
- void setState(State state);
-
- ViewedState viewed() const;
- void setViewed(ViewedState viewed);
- void setViewed(bool viewed);
-
- QDateTime viewDate() const;
- void setViewDate(QDateTime viewDate);
-
- QString source() const;
- void setSource(QString source);
-
- QString storage() const;
- void setStorage(QString storage);
-
- QString other() const;
- void setOther(QString other);
+ MyListState myListState() const;
+ void setMyListState(const MyListState &state);
bool waitForResult() const;
qint64 m_size;
bool m_edit;
-
- State m_state;
- ViewedState m_viewed;
- QDateTime m_viewDate;
- QString m_source;
- QString m_storage;
- QString m_other;
};
class ANIDBUDPCLIENTSHARED_EXPORT MyListAddReply : public AbstractReply
--- /dev/null
+#include "myliststate.h"
+
+namespace AniDBUdpClient {
+
+MyListState::MyListState()
+{
+ init();
+}
+
+State MyListState::state() const
+{
+ return m_state;
+}
+
+void MyListState::setState(State state)
+{
+ m_state = state;
+}
+
+MyListState::ViewedState MyListState::viewed() const
+{
+ return m_viewed;
+}
+
+void MyListState::setViewed(ViewedState viewed)
+{
+ m_viewed = viewed;
+}
+
+void MyListState::setViewed(bool viewed)
+{
+ m_viewed = viewed ? Viewed : NotViewed;
+}
+
+QDateTime MyListState::viewDate() const
+{
+ return m_viewDate;
+}
+
+void MyListState::setViewDate(QDateTime viewDate)
+{
+ m_viewDate = viewDate;
+}
+
+QString MyListState::source() const
+{
+ return m_source;
+}
+
+void MyListState::setSource(QString source)
+{
+ m_source = source;
+}
+
+QString MyListState::storage() const
+{
+ return m_storage;
+}
+
+void MyListState::setStorage(QString storage)
+{
+ m_storage = storage;
+}
+
+QString MyListState::other() const
+{
+ return m_other;
+}
+
+void MyListState::setOther(QString other)
+{
+ m_other = other;
+}
+
+void MyListState::init()
+{
+ m_state = StateUnknown;
+ m_viewed = Unset;
+}
+
+} // namespace AniDBUdpClient
--- /dev/null
+#ifndef MYLISTSTATE_H
+#define MYLISTSTATE_H
+
+#include "anidbudpclient_global.h"
+
+#include <QDateTime>
+
+namespace AniDBUdpClient {
+
+class ANIDBUDPCLIENTSHARED_EXPORT MyListState
+{
+ friend class MyListAddCommand;
+public:
+ enum ViewedState {
+ Unset = -1,
+ NotViewed = 0,
+ Viewed = 1,
+ };
+
+ MyListState();
+
+ State state() const;
+ void setState(State state);
+
+ ViewedState viewed() const;
+ void setViewed(ViewedState viewed);
+ void setViewed(bool viewed);
+
+ QDateTime viewDate() const;
+ void setViewDate(QDateTime viewDate);
+
+ QString source() const;
+ void setSource(QString source);
+
+ QString storage() const;
+ void setStorage(QString storage);
+
+ QString other() const;
+ void setOther(QString other);
+
+private:
+ void init();
+
+ State m_state;
+ ViewedState m_viewed;
+ QDateTime m_viewDate;
+ QString m_source;
+ QString m_storage;
+ QString m_other;
+};
+
+} // namespace AniDBUdpClient
+
+#endif // MYLISTSTATE_H