]> Some of my projects - anidbudpclient.git/commitdiff
Fix line endings
authorAPTX <marek321@gmail.com>
Mon, 29 Nov 2010 18:49:43 +0000 (19:49 +0100)
committerAPTX <marek321@gmail.com>
Mon, 29 Nov 2010 18:49:43 +0000 (19:49 +0100)
authcommand.h
clientqueuedcommandsmodel.cpp
clientqueuedcommandsmodel.h
clientsentcommandsmodel.cpp
clientsentcommandsmodel.h
filecommand.h
mylistcommand.cpp
votecommand.cpp
votecommand.h

index 806e5edb74706ed9d80b45539aecc68e4c13c7a6..ac44be8da752bcac4de86f790917148737784b49 100644 (file)
@@ -1,67 +1,67 @@
-#ifndef AUTHCOMMAND_H\r
-#define AUTHCOMMAND_H\r
-\r
-#include "abstractcommand.h"\r
-\r
-namespace AniDBUdpClient {\r
-\r
-class AuthReply;\r
-\r
-class AuthCommand : public AbstractCommand\r
-{\r
-/*\r
-       Q_PROPERTY(QString user READ user WRITE setUser);\r
-       Q_PROPERTY(QString pass READ pass WRITE setPass);\r
-       Q_PROPERTY(bool compression READ compression WRITE setCompression);\r
-*/\r
-public:\r
-       typedef AuthReply ReplyType;\r
-       AuthCommand();\r
-       AuthCommand(const QString &user, const QString &pass);\r
-\r
-       QString user() const;\r
-       void setUser(const QString &user);\r
-\r
-       QString pass() const;\r
-       void setPass(const QString &pass);\r
-\r
-       bool compression() const;\r
-       void setCompression(bool compress);\r
-\r
-\r
-       bool waitForResult() const;\r
-       bool requiresSession() const;\r
-\r
-       Command rawCommand() const;\r
-\r
-private:\r
-       QString m_user;\r
-       QString m_pass;\r
-\r
-       bool m_compression;\r
-};\r
-\r
-class AuthReply : public AbstractReply\r
-{\r
-       Q_OBJECT\r
-       REPLY_DEFINITION_HELPER(Auth)\r
-\r
-       Q_PROPERTY(QString sessionId READ sessionId);\r
-       Q_PROPERTY(QString errorString READ errorString RESET clearError);\r
-\r
-public:\r
-\r
-       QString sessionId() const;\r
-       QString errorString() const;\r
-       void clearError();\r
-\r
-       void setRawReply(ReplyCode replyCode, const QString &reply);\r
-\r
-private:\r
-       QString m_sessionId;\r
-       QString m_errorString;\r
-};\r
-\r
-} // namespace AniDBUdpClient\r
-\r
-#endif // AUTHCOMMAND_H\r
+#ifndef AUTHCOMMAND_H
+#define AUTHCOMMAND_H
+
+#include "abstractcommand.h"
+
+namespace AniDBUdpClient {
+
+class AuthReply;
+
+class AuthCommand : public AbstractCommand
+{
+/*
+       Q_PROPERTY(QString user READ user WRITE setUser);
+       Q_PROPERTY(QString pass READ pass WRITE setPass);
+       Q_PROPERTY(bool compression READ compression WRITE setCompression);
+*/
+public:
+       typedef AuthReply ReplyType;
+       AuthCommand();
+       AuthCommand(const QString &user, const QString &pass);
+
+       QString user() const;
+       void setUser(const QString &user);
+
+       QString pass() const;
+       void setPass(const QString &pass);
+
+       bool compression() const;
+       void setCompression(bool compress);
+
+
+       bool waitForResult() const;
+       bool requiresSession() const;
+
+       Command rawCommand() const;
+
+private:
+       QString m_user;
+       QString m_pass;
+
+       bool m_compression;
+};
+
+class AuthReply : public AbstractReply
+{
+       Q_OBJECT
+       REPLY_DEFINITION_HELPER(Auth)
+
+       Q_PROPERTY(QString sessionId READ sessionId);
+       Q_PROPERTY(QString errorString READ errorString RESET clearError);
+
+public:
+
+       QString sessionId() const;
+       QString errorString() const;
+       void clearError();
+
+       void setRawReply(ReplyCode replyCode, const QString &reply);
+
+private:
+       QString m_sessionId;
+       QString m_errorString;
+};
+
+} // namespace AniDBUdpClient
+
+#endif // AUTHCOMMAND_H
index 92a2f0de8ac0b3537d8f0254479ffecefc934de5..58bd1e0b57f913ce19a85e6a880b754879242e13 100644 (file)
-#include "clientqueuedcommandsmodel.h"\r
-\r
-#include "client.h"\r
-\r
-namespace AniDBUdpClient {\r
-\r
-ClientQueuedCommandsModel::ClientQueuedCommandsModel(Client *client, QObject *parent) :\r
-       m_client(0), QAbstractTableModel(parent)\r
-{\r
-       setClient(client);\r
-}\r
-\r
-Client *ClientQueuedCommandsModel::client() const\r
-{\r
-       return m_client;\r
-}\r
-\r
-void ClientQueuedCommandsModel::setClient(Client *client)\r
-{\r
-       if (m_client)\r
-               disconnect(m_client, 0, this, 0);\r
-\r
-       beginResetModel();\r
-       if (client)\r
-       {\r
-               connect(client, SIGNAL(model_queuedCommandAdded(int)), this, SLOT(commandAdded(int)));\r
-               connect(client, SIGNAL(model_queuedCommandRemoved(int)), this, SLOT(commandRemoved(int)));\r
-       }\r
-       m_client = client;\r
-       endResetModel();\r
-}\r
-\r
-int ClientQueuedCommandsModel::rowCount(const QModelIndex &/*parent*/) const\r
-{\r
-       if (!m_client)\r
-               return 0;\r
-       return m_client->controlCommandQueue.count() + m_client->commandQueue.count();\r
-}\r
-\r
-int ClientQueuedCommandsModel::columnCount(const QModelIndex &/*parent*/) const\r
-{\r
-       return 3;\r
-}\r
-\r
-QVariant ClientQueuedCommandsModel::headerData(int section, Qt::Orientation orientation, int role) const\r
-{\r
-       if (role != Qt::DisplayRole)\r
-               return QVariant();\r
-\r
-       if (orientation == Qt::Vertical)\r
-       {\r
-               return section + 1;\r
-       }\r
-\r
-       switch (section)\r
-       {\r
-               case 0:\r
-                       return tr("Control command");\r
-               case 1:\r
-                       return tr("Command");\r
-               case 2:\r
-                       return tr("Arguments");\r
-       }\r
-\r
-       return QVariant();\r
-}\r
-\r
-QVariant ClientQueuedCommandsModel::data(const QModelIndex &index, int role) const\r
-{\r
-       if (role != Qt::DisplayRole)\r
-               return QVariant();\r
-\r
-       AbstractReply *currentReply;\r
-       if (index.row() < m_client->controlCommandQueue.count())\r
-               currentReply = m_client->controlCommandQueue.at(index.row());\r
-       else\r
-               currentReply = m_client->commandQueue.at(index.row() - m_client->controlCommandQueue.count());\r
-\r
-       switch (index.column())\r
-       {\r
-               case 0:\r
-                       return currentReply->controlCommand() ? tr("Yes") : tr("No");\r
-               case 1:\r
-                       return currentReply->command().rawCommand().first;\r
-               case 2:\r
-               {\r
-                       Command rawCommand = currentReply->command().rawCommand();\r
-                       QString s = QString("(%1) ").arg(rawCommand.second.count());\r
-                       for (QVariantMap::const_iterator i = rawCommand.second.constBegin(); i != rawCommand.second.constEnd(); ++i)\r
-                       {\r
-                               s += QString("%1=%2; ").arg(i.key(), i.value().toString());\r
-                       }\r
-                       return s;\r
-               }\r
-       }\r
-       return QVariant();\r
-}\r
-\r
-\r
-void ClientQueuedCommandsModel::commandAdded(int index)\r
-{\r
-       beginInsertRows(QModelIndex(), index, index);\r
-       endInsertRows();\r
-}\r
-\r
-void ClientQueuedCommandsModel::commandRemoved(int index)\r
-{\r
-       beginRemoveRows(QModelIndex(), index, index);\r
-       endRemoveRows();\r
-}\r
-\r
-} // namespace AniDBUdpClient\r
+#include "clientqueuedcommandsmodel.h"
+
+#include "client.h"
+
+namespace AniDBUdpClient {
+
+ClientQueuedCommandsModel::ClientQueuedCommandsModel(Client *client, QObject *parent) :
+       m_client(0), QAbstractTableModel(parent)
+{
+       setClient(client);
+}
+
+Client *ClientQueuedCommandsModel::client() const
+{
+       return m_client;
+}
+
+void ClientQueuedCommandsModel::setClient(Client *client)
+{
+       if (m_client)
+               disconnect(m_client, 0, this, 0);
+
+       beginResetModel();
+       if (client)
+       {
+               connect(client, SIGNAL(model_queuedCommandAdded(int)), this, SLOT(commandAdded(int)));
+               connect(client, SIGNAL(model_queuedCommandRemoved(int)), this, SLOT(commandRemoved(int)));
+       }
+       m_client = client;
+       endResetModel();
+}
+
+int ClientQueuedCommandsModel::rowCount(const QModelIndex &/*parent*/) const
+{
+       if (!m_client)
+               return 0;
+       return m_client->controlCommandQueue.count() + m_client->commandQueue.count();
+}
+
+int ClientQueuedCommandsModel::columnCount(const QModelIndex &/*parent*/) const
+{
+       return 3;
+}
+
+QVariant ClientQueuedCommandsModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+       if (role != Qt::DisplayRole)
+               return QVariant();
+
+       if (orientation == Qt::Vertical)
+       {
+               return section + 1;
+       }
+
+       switch (section)
+       {
+               case 0:
+                       return tr("Control command");
+               case 1:
+                       return tr("Command");
+               case 2:
+                       return tr("Arguments");
+       }
+
+       return QVariant();
+}
+
+QVariant ClientQueuedCommandsModel::data(const QModelIndex &index, int role) const
+{
+       if (role != Qt::DisplayRole)
+               return QVariant();
+
+       AbstractReply *currentReply;
+       if (index.row() < m_client->controlCommandQueue.count())
+               currentReply = m_client->controlCommandQueue.at(index.row());
+       else
+               currentReply = m_client->commandQueue.at(index.row() - m_client->controlCommandQueue.count());
+
+       switch (index.column())
+       {
+               case 0:
+                       return currentReply->controlCommand() ? tr("Yes") : tr("No");
+               case 1:
+                       return currentReply->command().rawCommand().first;
+               case 2:
+               {
+                       Command rawCommand = currentReply->command().rawCommand();
+                       QString s = QString("(%1) ").arg(rawCommand.second.count());
+                       for (QVariantMap::const_iterator i = rawCommand.second.constBegin(); i != rawCommand.second.constEnd(); ++i)
+                       {
+                               s += QString("%1=%2; ").arg(i.key(), i.value().toString());
+                       }
+                       return s;
+               }
+       }
+       return QVariant();
+}
+
+
+void ClientQueuedCommandsModel::commandAdded(int index)
+{
+       beginInsertRows(QModelIndex(), index, index);
+       endInsertRows();
+}
+
+void ClientQueuedCommandsModel::commandRemoved(int index)
+{
+       beginRemoveRows(QModelIndex(), index, index);
+       endRemoveRows();
+}
+
+} // namespace AniDBUdpClient
index 304ec476638753d3d4239e7382ff8ffe5e693746..e6f2c255d95595b566871dba2003ecb3252c6c32 100644 (file)
@@ -1,40 +1,40 @@
-#ifndef CLIENTQUEUEDCOMMANDSMODEL_H\r
-#define CLIENTQUEUEDCOMMANDSMODEL_H\r
-\r
-#include "anidbudpclient_global.h"\r
-\r
-#include <QAbstractTableModel>\r
-\r
-namespace AniDBUdpClient {\r
-\r
-class Client;\r
-\r
-class ANIDBUDPCLIENTSHARED_EXPORT ClientQueuedCommandsModel : public QAbstractTableModel\r
-{\r
-    Q_OBJECT\r
-public:\r
-       explicit ClientQueuedCommandsModel(Client *client, QObject *parent = 0);\r
-\r
-       Client *client() const;\r
-       void setClient(Client *client);\r
-\r
-       int rowCount(const QModelIndex &parent = QModelIndex()) const;\r
-       int columnCount(const QModelIndex &/*parent*/) const;\r
-\r
-       QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;\r
-       QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;\r
-\r
-signals:\r
-\r
-private slots:\r
-       void commandAdded(int index);\r
-       void commandRemoved(int index);\r
-\r
-private:\r
-\r
-       Client *m_client;\r
-};\r
-\r
-} // namespace AniDBUdpClient\r
-\r
-#endif // CLIENTQUEUEDCOMMANDSMODEL_H\r
+#ifndef CLIENTQUEUEDCOMMANDSMODEL_H
+#define CLIENTQUEUEDCOMMANDSMODEL_H
+
+#include "anidbudpclient_global.h"
+
+#include <QAbstractTableModel>
+
+namespace AniDBUdpClient {
+
+class Client;
+
+class ANIDBUDPCLIENTSHARED_EXPORT ClientQueuedCommandsModel : public QAbstractTableModel
+{
+    Q_OBJECT
+public:
+       explicit ClientQueuedCommandsModel(Client *client, QObject *parent = 0);
+
+       Client *client() const;
+       void setClient(Client *client);
+
+       int rowCount(const QModelIndex &parent = QModelIndex()) const;
+       int columnCount(const QModelIndex &/*parent*/) const;
+
+       QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+       QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+
+signals:
+
+private slots:
+       void commandAdded(int index);
+       void commandRemoved(int index);
+
+private:
+
+       Client *m_client;
+};
+
+} // namespace AniDBUdpClient
+
+#endif // CLIENTQUEUEDCOMMANDSMODEL_H
index 4603de41b3f38f97d12b00d289ad15fc102cecbb..1da571529a6ae9324e16dbff7575fe1c6e3dd4e4 100644 (file)
-#include "clientsentcommandsmodel.h"\r
-\r
-#include "client.h"\r
-\r
-namespace AniDBUdpClient {\r
-\r
-ClientSentCommandsModel::ClientSentCommandsModel(Client *client, QObject *parent) :\r
-       m_client(0), QAbstractTableModel(parent)\r
-{\r
-       setClient(client);\r
-}\r
-\r
-Client *ClientSentCommandsModel::client() const\r
-{\r
-       return m_client;\r
-}\r
-\r
-void ClientSentCommandsModel::setClient(Client *client)\r
-{\r
-       if (m_client)\r
-               disconnect(m_client, 0, this, 0);\r
-\r
-       beginResetModel();\r
-       if (client)\r
-       {\r
-               connect(client, SIGNAL(model_sentCommandAdded(int)), this, SLOT(commandAdded(int)));\r
-               connect(client, SIGNAL(model_sentCommandRemoved(int)), this, SLOT(commandRemoved(int)));\r
-       }\r
-       m_client = client;\r
-       endResetModel();\r
-}\r
-\r
-int ClientSentCommandsModel::rowCount(const QModelIndex &/*parent*/) const\r
-{\r
-       if (!m_client)\r
-               return 0;\r
-       return m_client->sentCommandOrder.count();\r
-}\r
-\r
-int ClientSentCommandsModel::columnCount(const QModelIndex &/*parent*/) const\r
-{\r
-       return 3;\r
-}\r
-\r
-QVariant ClientSentCommandsModel::headerData(int section, Qt::Orientation orientation, int role) const\r
-{\r
-       if (role != Qt::DisplayRole)\r
-               return QVariant();\r
-\r
-       if (orientation == Qt::Vertical)\r
-       {\r
-               return section + 1;\r
-       }\r
-\r
-       switch (section)\r
-       {\r
-               case 0:\r
-                       return tr("Time Sent");\r
-               case 1:\r
-                       return tr("Command");\r
-               case 2:\r
-                       return tr("Arguments");\r
-       }\r
-\r
-       return QVariant();\r
-}\r
-\r
-QVariant ClientSentCommandsModel::data(const QModelIndex &index, int role) const\r
-{\r
-       if (role != Qt::DisplayRole)\r
-               return QVariant();\r
-\r
-       AbstractReply *currentReply = m_client->sentCommands[m_client->sentCommandOrder[index.row()]];\r
-\r
-       switch (index.column())\r
-       {\r
-               case 0:\r
-                       return currentReply->timeSent();\r
-               case 1:\r
-                       return currentReply->command().rawCommand().first;\r
-               case 2:\r
-               {\r
-                       Command rawCommand = currentReply->command().rawCommand();\r
-                       QString s = QString("(%1) ").arg(rawCommand.second.count());\r
-                       for (QVariantMap::const_iterator i = rawCommand.second.constBegin(); i != rawCommand.second.constEnd(); ++i)\r
-                       {\r
-                               s += QString("%1=%2; ").arg(i.key(), i.value().toString());\r
-                       }\r
-                       return s;\r
-               }\r
-       }\r
-       return QVariant();\r
-}\r
-\r
-\r
-void ClientSentCommandsModel::commandAdded(int index)\r
-{\r
-       beginInsertRows(QModelIndex(), index, index);\r
-       endInsertRows();\r
-}\r
-\r
-void ClientSentCommandsModel::commandRemoved(int index)\r
-{\r
-       beginRemoveRows(QModelIndex(), index, index);\r
-       endRemoveRows();\r
-}\r
-\r
-} // namespace AniDBUdpClient\r
+#include "clientsentcommandsmodel.h"
+
+#include "client.h"
+
+namespace AniDBUdpClient {
+
+ClientSentCommandsModel::ClientSentCommandsModel(Client *client, QObject *parent) :
+       m_client(0), QAbstractTableModel(parent)
+{
+       setClient(client);
+}
+
+Client *ClientSentCommandsModel::client() const
+{
+       return m_client;
+}
+
+void ClientSentCommandsModel::setClient(Client *client)
+{
+       if (m_client)
+               disconnect(m_client, 0, this, 0);
+
+       beginResetModel();
+       if (client)
+       {
+               connect(client, SIGNAL(model_sentCommandAdded(int)), this, SLOT(commandAdded(int)));
+               connect(client, SIGNAL(model_sentCommandRemoved(int)), this, SLOT(commandRemoved(int)));
+       }
+       m_client = client;
+       endResetModel();
+}
+
+int ClientSentCommandsModel::rowCount(const QModelIndex &/*parent*/) const
+{
+       if (!m_client)
+               return 0;
+       return m_client->sentCommandOrder.count();
+}
+
+int ClientSentCommandsModel::columnCount(const QModelIndex &/*parent*/) const
+{
+       return 3;
+}
+
+QVariant ClientSentCommandsModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+       if (role != Qt::DisplayRole)
+               return QVariant();
+
+       if (orientation == Qt::Vertical)
+       {
+               return section + 1;
+       }
+
+       switch (section)
+       {
+               case 0:
+                       return tr("Time Sent");
+               case 1:
+                       return tr("Command");
+               case 2:
+                       return tr("Arguments");
+       }
+
+       return QVariant();
+}
+
+QVariant ClientSentCommandsModel::data(const QModelIndex &index, int role) const
+{
+       if (role != Qt::DisplayRole)
+               return QVariant();
+
+       AbstractReply *currentReply = m_client->sentCommands[m_client->sentCommandOrder[index.row()]];
+
+       switch (index.column())
+       {
+               case 0:
+                       return currentReply->timeSent();
+               case 1:
+                       return currentReply->command().rawCommand().first;
+               case 2:
+               {
+                       Command rawCommand = currentReply->command().rawCommand();
+                       QString s = QString("(%1) ").arg(rawCommand.second.count());
+                       for (QVariantMap::const_iterator i = rawCommand.second.constBegin(); i != rawCommand.second.constEnd(); ++i)
+                       {
+                               s += QString("%1=%2; ").arg(i.key(), i.value().toString());
+                       }
+                       return s;
+               }
+       }
+       return QVariant();
+}
+
+
+void ClientSentCommandsModel::commandAdded(int index)
+{
+       beginInsertRows(QModelIndex(), index, index);
+       endInsertRows();
+}
+
+void ClientSentCommandsModel::commandRemoved(int index)
+{
+       beginRemoveRows(QModelIndex(), index, index);
+       endRemoveRows();
+}
+
+} // namespace AniDBUdpClient
index 73ac46fa458422d023902a3d6b4fd1cd9479f151..3a4a2dbd2007b874be8e4f90fc3209c2582e2da4 100644 (file)
@@ -1,40 +1,40 @@
-#ifndef CLIENTCOMMANDMODEL_H\r
-#define CLIENTCOMMANDMODEL_H\r
-\r
-#include "anidbudpclient_global.h"\r
-\r
-#include <QAbstractTableModel>\r
-\r
-namespace AniDBUdpClient {\r
-\r
-class Client;\r
-\r
-class ANIDBUDPCLIENTSHARED_EXPORT ClientSentCommandsModel : public QAbstractTableModel\r
-{\r
-    Q_OBJECT\r
-public:\r
-       explicit ClientSentCommandsModel(Client *client = 0, QObject *parent = 0);\r
-\r
-       Client *client() const;\r
-       void setClient(Client *client);\r
-\r
-       int rowCount(const QModelIndex &parent = QModelIndex()) const;\r
-       int columnCount(const QModelIndex &/*parent*/) const;\r
-\r
-       QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;\r
-       QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;\r
-\r
-signals:\r
-\r
-private slots:\r
-       void commandAdded(int index);\r
-       void commandRemoved(int index);\r
-\r
-private:\r
-\r
-       Client *m_client;\r
-};\r
-\r
-} // namespace AniDBUdpClient\r
-\r
-#endif // CLIENTCOMMANDMODEL_H\r
+#ifndef CLIENTCOMMANDMODEL_H
+#define CLIENTCOMMANDMODEL_H
+
+#include "anidbudpclient_global.h"
+
+#include <QAbstractTableModel>
+
+namespace AniDBUdpClient {
+
+class Client;
+
+class ANIDBUDPCLIENTSHARED_EXPORT ClientSentCommandsModel : public QAbstractTableModel
+{
+    Q_OBJECT
+public:
+       explicit ClientSentCommandsModel(Client *client = 0, QObject *parent = 0);
+
+       Client *client() const;
+       void setClient(Client *client);
+
+       int rowCount(const QModelIndex &parent = QModelIndex()) const;
+       int columnCount(const QModelIndex &/*parent*/) const;
+
+       QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+       QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+
+signals:
+
+private slots:
+       void commandAdded(int index);
+       void commandRemoved(int index);
+
+private:
+
+       Client *m_client;
+};
+
+} // namespace AniDBUdpClient
+
+#endif // CLIENTCOMMANDMODEL_H
index dabc761533a9e4d6d97d94715762be61364701cc..b3e80f47c0a13a464e7ce769e2ff450e98108f5d 100644 (file)
-#ifndef FILECOMMAND_H\r
-#define FILECOMMAND_H\r
-\r
-#include "anidbudpclient_global.h"\r
-#include "abstractcommand.h"\r
-\r
-#include <QVariant>\r
-\r
-namespace AniDBUdpClient {\r
-\r
-class FileReply;\r
-\r
-class ANIDBUDPCLIENTSHARED_EXPORT FileCommand : public AbstractCommand\r
-{\r
-/*\r
-       Q_PROPERTY(int fid READ fid WRITE setFid);\r
-\r
-       Q_PROPERTY(QByteArray ed2k READ ed2k WRITE setEd2k);\r
-       Q_PROPERTY(qint64 size READ size WRITE setSize);\r
-\r
-       Q_PROPERTY(QString aname READ aname WRITE setAname);\r
-       Q_PROPERTY(int aid READ aid WRITE setAid);\r
-       Q_PROPERTY(QString gname READ gname WRITE setGname);\r
-       Q_PROPERTY(int gid READ gid WRITE setGid);\r
-       Q_PROPERTY(int epno READ epno WRITE setEpno);\r
-\r
-       Q_PROPERTY(FileFlags fmask READ fmask WRITE setFmask);\r
-       Q_PROPERTY(FileAnimeFlags amask READ amask WRITE setAmask);\r
-*/\r
-public:\r
-       typedef FileReply ReplyType;\r
-       FileCommand();\r
-       FileCommand(int fid, FileFlags fmask = FileFlags(0), FileAnimeFlags = FileAnimeFlags(0));\r
-       FileCommand(const QByteArray &ed2k, qint64 size, FileFlags fmask = FileFlags(0), FileAnimeFlags = FileAnimeFlags(0));\r
-       FileCommand(const QString &aname, const QString &gname, int epno, FileFlags fmask = FileFlags(0), FileAnimeFlags = FileAnimeFlags(0));\r
-       FileCommand(const QString &aname, int gid, int epno, FileFlags fmask = FileFlags(0), FileAnimeFlags = FileAnimeFlags(0));\r
-       FileCommand(int aid, const QString &gname, int epno, FileFlags fmask = FileFlags(0), FileAnimeFlags = FileAnimeFlags(0));\r
-       FileCommand(int aid, int gid, int epno, FileFlags fmask = FileFlags(0), FileAnimeFlags = FileAnimeFlags(0));\r
-\r
-       int fid() const;\r
-       void setFid(int fid);\r
-\r
-       QByteArray ed2k() const;\r
-       void setEd2k(const QByteArray &ed2k);\r
-       qint64 size() const;\r
-       void setSize(qint64 size);\r
-\r
-       QString aname() const;\r
-       void setAname(const QString &aname);\r
-       int aid() const;\r
-       void setAid(int aid);\r
-       QString gname() const;\r
-       void setGname(const QString &gname);\r
-       int gid() const;\r
-       void setGid(int gid);\r
-       int epno() const;\r
-       void setEpno(int epno);\r
-\r
-       FileFlags fmask() const;\r
-       void setFmask(FileFlags fmask);\r
-       FileAnimeFlags amask() const;\r
-       void setAmask(FileAnimeFlags amask);\r
-\r
-       bool waitForResult() const;\r
-       Command rawCommand() const;\r
-\r
-private:\r
-       void init();\r
-\r
-       int m_fid;\r
-\r
-       QByteArray m_ed2k;\r
-       qint64 m_size;\r
-\r
-       QString m_aname;\r
-       int m_aid;\r
-       QString m_gname;\r
-       int m_gid;\r
-       int m_epno;\r
-\r
-       FileFlags m_fmask;\r
-       FileAnimeFlags m_amask;\r
-};\r
-\r
-class ANIDBUDPCLIENTSHARED_EXPORT FileReply : public AbstractReply\r
-{\r
-       Q_OBJECT\r
-       REPLY_DEFINITION_HELPER2(File)\r
-\r
-       Q_PROPERTY(int fid READ fid);\r
-\r
-public:\r
-       int fid() const;\r
-\r
-       QVariant value(FileFlags f) const;\r
-       QVariant value(FileAnimeFlags f) const;\r
-\r
-       void setRawReply(ReplyCode replyCode, const QString &reply);\r
-\r
-private:\r
-       void readReplyData(const QString &reply);\r
-       void init();\r
-\r
-       int m_fid;\r
-\r
-       QMap<FileFlags, QVariant> fileFlagData;\r
-       QMap<FileAnimeFlags, QVariant> fileAnimeFlagData;\r
-};\r
-\r
-} // namespace AniDBUdpClient\r
-\r
-#endif // FILECOMMAND_H\r
+#ifndef FILECOMMAND_H
+#define FILECOMMAND_H
+
+#include "anidbudpclient_global.h"
+#include "abstractcommand.h"
+
+#include <QVariant>
+
+namespace AniDBUdpClient {
+
+class FileReply;
+
+class ANIDBUDPCLIENTSHARED_EXPORT FileCommand : public AbstractCommand
+{
+/*
+       Q_PROPERTY(int fid READ fid WRITE setFid);
+
+       Q_PROPERTY(QByteArray ed2k READ ed2k WRITE setEd2k);
+       Q_PROPERTY(qint64 size READ size WRITE setSize);
+
+       Q_PROPERTY(QString aname READ aname WRITE setAname);
+       Q_PROPERTY(int aid READ aid WRITE setAid);
+       Q_PROPERTY(QString gname READ gname WRITE setGname);
+       Q_PROPERTY(int gid READ gid WRITE setGid);
+       Q_PROPERTY(int epno READ epno WRITE setEpno);
+
+       Q_PROPERTY(FileFlags fmask READ fmask WRITE setFmask);
+       Q_PROPERTY(FileAnimeFlags amask READ amask WRITE setAmask);
+*/
+public:
+       typedef FileReply ReplyType;
+       FileCommand();
+       FileCommand(int fid, FileFlags fmask = FileFlags(0), FileAnimeFlags = FileAnimeFlags(0));
+       FileCommand(const QByteArray &ed2k, qint64 size, FileFlags fmask = FileFlags(0), FileAnimeFlags = FileAnimeFlags(0));
+       FileCommand(const QString &aname, const QString &gname, int epno, FileFlags fmask = FileFlags(0), FileAnimeFlags = FileAnimeFlags(0));
+       FileCommand(const QString &aname, int gid, int epno, FileFlags fmask = FileFlags(0), FileAnimeFlags = FileAnimeFlags(0));
+       FileCommand(int aid, const QString &gname, int epno, FileFlags fmask = FileFlags(0), FileAnimeFlags = FileAnimeFlags(0));
+       FileCommand(int aid, int gid, int epno, FileFlags fmask = FileFlags(0), FileAnimeFlags = FileAnimeFlags(0));
+
+       int fid() const;
+       void setFid(int fid);
+
+       QByteArray ed2k() const;
+       void setEd2k(const QByteArray &ed2k);
+       qint64 size() const;
+       void setSize(qint64 size);
+
+       QString aname() const;
+       void setAname(const QString &aname);
+       int aid() const;
+       void setAid(int aid);
+       QString gname() const;
+       void setGname(const QString &gname);
+       int gid() const;
+       void setGid(int gid);
+       int epno() const;
+       void setEpno(int epno);
+
+       FileFlags fmask() const;
+       void setFmask(FileFlags fmask);
+       FileAnimeFlags amask() const;
+       void setAmask(FileAnimeFlags amask);
+
+       bool waitForResult() const;
+       Command rawCommand() const;
+
+private:
+       void init();
+
+       int m_fid;
+
+       QByteArray m_ed2k;
+       qint64 m_size;
+
+       QString m_aname;
+       int m_aid;
+       QString m_gname;
+       int m_gid;
+       int m_epno;
+
+       FileFlags m_fmask;
+       FileAnimeFlags m_amask;
+};
+
+class ANIDBUDPCLIENTSHARED_EXPORT FileReply : public AbstractReply
+{
+       Q_OBJECT
+       REPLY_DEFINITION_HELPER2(File)
+
+       Q_PROPERTY(int fid READ fid);
+
+public:
+       int fid() const;
+
+       QVariant value(FileFlags f) const;
+       QVariant value(FileAnimeFlags f) const;
+
+       void setRawReply(ReplyCode replyCode, const QString &reply);
+
+private:
+       void readReplyData(const QString &reply);
+       void init();
+
+       int m_fid;
+
+       QMap<FileFlags, QVariant> fileFlagData;
+       QMap<FileAnimeFlags, QVariant> fileAnimeFlagData;
+};
+
+} // namespace AniDBUdpClient
+
+#endif // FILECOMMAND_H
index a37bef14b1d8bf94b316472380c0e9dd2538792c..3a9892470b00afad30a06b0bb4fecc17d45b07d3 100644 (file)
-#include "mylistcommand.h"\r
-\r
-#include <QStringList>\r
-\r
-namespace AniDBUdpClient {\r
-\r
-MyListCommand::MyListCommand() : AbstractCommand()\r
-{\r
-       init();\r
-}\r
-\r
-MyListCommand::MyListCommand(int lid) : AbstractCommand()\r
-{\r
-       init();\r
-       m_lid = lid;\r
-}\r
-\r
-MyListCommand::MyListCommand(int fid, bool isFid) : AbstractCommand()\r
-{\r
-       Q_UNUSED(isFid);\r
-       init();\r
-       m_fid = fid;\r
-}\r
-\r
-MyListCommand::MyListCommand(const QByteArray &ed2k, qint64 size) : AbstractCommand()\r
-{\r
-       init();\r
-       m_ed2k = ed2k;\r
-       m_size = size;\r
-}\r
-\r
-MyListCommand::MyListCommand(const QString &aname, const QString &gname, int epno) : AbstractCommand()\r
-{\r
-       init();\r
-       m_aname = aname;\r
-       m_gname = gname;\r
-       m_epno = epno;\r
-}\r
-\r
-MyListCommand::MyListCommand(const QString &aname, int gid, int epno) : AbstractCommand()\r
-{\r
-       init();\r
-       m_aname = aname;\r
-       m_gid = gid;\r
-       m_epno = epno;\r
-}\r
-\r
-MyListCommand::MyListCommand(int aid, const QString &gname, int epno) : AbstractCommand()\r
-{\r
-       init();\r
-       m_aid = aid;\r
-       m_gname = gname;\r
-       m_epno = epno;\r
-}\r
-\r
-MyListCommand::MyListCommand(int aid, int gid, int epno) : AbstractCommand()\r
-{\r
-       init();\r
-       m_aid = aid;\r
-       m_gid = gid;\r
-       m_epno = epno;\r
-}\r
-\r
-int MyListCommand::lid() const\r
-{\r
-       return m_lid;\r
-}\r
-\r
-void MyListCommand::setLid(int lid)\r
-{\r
-       m_lid = lid;\r
-}\r
-\r
-int MyListCommand::fid() const\r
-{\r
-       return m_fid;\r
-}\r
-\r
-void MyListCommand::setFid(int fid)\r
-{\r
-       m_fid = fid;\r
-}\r
-\r
-QByteArray MyListCommand::ed2k() const\r
-{\r
-       return m_ed2k;\r
-}\r
-\r
-void MyListCommand::setEd2k(const QByteArray &ed2k)\r
-{\r
-       m_ed2k = ed2k;\r
-}\r
-\r
-qint64 MyListCommand::size() const\r
-{\r
-       return m_size;\r
-}\r
-\r
-void MyListCommand::setSize(qint64 size)\r
-{\r
-       m_size = size;\r
-}\r
-\r
-QString MyListCommand::aname() const\r
-{\r
-       return m_aname;\r
-}\r
-\r
-void MyListCommand::setAname(const QString &aname)\r
-{\r
-       m_aname = aname;\r
-}\r
-\r
-int MyListCommand::aid() const\r
-{\r
-       return m_aid;\r
-}\r
-\r
-void MyListCommand::setAid(int aid)\r
-{\r
-       m_aid = aid;\r
-}\r
-\r
-QString MyListCommand::gname() const\r
-{\r
-       return m_gname;\r
-}\r
-\r
-void MyListCommand::setGname(const QString &gname)\r
-{\r
-       m_gname = gname;\r
-}\r
-\r
-int MyListCommand::gid() const\r
-{\r
-       return m_gid;\r
-}\r
-\r
-void MyListCommand::setGid(int gid)\r
-{\r
-       m_gid = gid;\r
-}\r
-\r
-\r
-int MyListCommand::epno() const\r
-{\r
-       return m_epno;\r
-}\r
-\r
-void MyListCommand::setEpno(int epno)\r
-{\r
-       m_epno = epno;\r
-}\r
-\r
-bool MyListCommand::isValid() const\r
-{\r
-       return m_lid || m_fid || m_aid\r
-                       || !m_aname.isEmpty()\r
-                       || (!m_ed2k.isEmpty() && m_size);\r
-}\r
-\r
-bool MyListCommand::waitForResult() const\r
-{\r
-       return true;\r
-}\r
-\r
-Command MyListCommand::rawCommand() const\r
-{\r
-       Command cmd;\r
-\r
-       cmd.first = "MYLIST";\r
-\r
-       if (m_lid)\r
-       {\r
-               cmd.second["lid"] = m_lid;\r
-       }\r
-       else if (m_fid)\r
-       {\r
-               cmd.second["fid"] = m_fid;\r
-       }\r
-       else if (!m_ed2k.isEmpty() && m_size)\r
-       {\r
-               cmd.second["ed2k"] = m_ed2k;\r
-               cmd.second["size"] = m_size;\r
-       }\r
-       else if (!m_aname.isEmpty())\r
-       {\r
-               cmd.second["aname"] = m_aname;\r
-               if (!m_gname.isEmpty() && m_epno)\r
-               {\r
-                       cmd.second["gname"] = m_gname;\r
-                       cmd.second["epno"] = m_epno;\r
-               }\r
-               else if (m_gid && m_epno)\r
-               {\r
-                       cmd.second["gid"] = m_gid;\r
-                       cmd.second["epno"] = m_epno;\r
-               }\r
-       }\r
-       else if (m_aid)\r
-       {\r
-               cmd.second["aid"] = m_aid;\r
-               if (!m_gname.isEmpty() && m_epno)\r
-               {\r
-                       cmd.second["gname"] = m_gname;\r
-                       cmd.second["epno"] = m_epno;\r
-               }\r
-               else if (m_gid && m_epno)\r
-               {\r
-                       cmd.second["gid"] = m_gid;\r
-                       cmd.second["epno"] = m_epno;\r
-               }\r
-       }\r
-       else\r
-       {\r
-               // TODO WTF NOW?!?\r
-       }\r
-       return cmd;\r
-}\r
-\r
-void MyListCommand::init()\r
-{\r
-       m_lid = 0;\r
-       m_fid = 0;\r
-       m_aid = 0;\r
-       m_gid = 0;\r
-\r
-       m_size = 0;\r
-       m_epno = 0;\r
-}\r
-\r
-\r
-// ===\r
-\r
-int MyListReply::lid() const\r
-{\r
-       return m_lid;\r
-}\r
-\r
-int MyListReply::fid() const\r
-{\r
-       return m_fid;\r
-}\r
-\r
-int MyListReply::aid() const\r
-{\r
-       return m_aid;\r
-}\r
-\r
-\r
-int MyListReply::gid() const\r
-{\r
-       return m_gid;\r
-}\r
-\r
-\r
-int MyListReply::eid() const\r
-{\r
-       return m_eid;\r
-}\r
-\r
-QDateTime MyListReply::date() const\r
-{\r
-       return m_date;\r
-}\r
-\r
-State MyListReply::state() const\r
-{\r
-       return m_state;\r
-}\r
-\r
-QDateTime MyListReply::viewDate() const\r
-{\r
-       return m_viewDate;\r
-}\r
-\r
-QString MyListReply::storage() const\r
-{\r
-       return m_storage;\r
-}\r
-\r
-QString MyListReply::source() const\r
-{\r
-       return m_source;\r
-}\r
-\r
-QString MyListReply::other() const\r
-{\r
-       return m_other;\r
-}\r
-\r
-FileState MyListReply::fileState() const\r
-{\r
-       return m_fileState;\r
-}\r
-\r
-QStringList MyListReply::multipleEntries() const\r
-{\r
-       return m_multipleEntries;\r
-}\r
-\r
-void MyListReply::setRawReply(ReplyCode replyCode, const QString &reply)\r
-{\r
-       AbstractReply::setRawReply(replyCode, reply);\r
-\r
-       switch (replyCode)\r
-       {\r
-               case MYLIST:\r
-               {\r
-                       QStringList parts = reply.mid(reply.indexOf("\n")).split('|', QString::KeepEmptyParts);\r
-                       bool ok;\r
-                       m_lid = parts[0].toInt(&ok, 10);\r
-                       m_fid = parts[1].toInt(&ok, 10);\r
-                       m_eid = parts[2].toInt(&ok, 10);\r
-                       m_aid = parts[3].toInt(&ok, 10);\r
-                       m_gid = parts[4].toInt(&ok, 10);\r
-                       m_date = QDateTime::fromTime_t(parts[5].toUInt(&ok, 10));\r
-                       m_state = State(parts[6].toInt(&ok, 10));\r
-                       m_viewDate = QDateTime::fromTime_t(parts[7].toUInt(&ok, 10));\r
-                       m_storage = parts[8];\r
-                       m_source = parts[9];\r
-                       m_other = parts[10];\r
-                       m_fileState = FileState(parts[11].toInt(&ok, 10));\r
-                       emit replyReady(true);\r
-               }\r
-               break;\r
-               case MULTIPLE_MYLIST_ENTRIES:\r
-               {\r
-                       m_multipleEntries = reply.mid(reply.indexOf("\n")).split('|', QString::KeepEmptyParts);\r
-                       emit replyReady(true);\r
-               }\r
-               break;\r
-               case NO_SUCH_ENTRY:\r
-               default:\r
-                       emit replyReady(false);\r
-               break;\r
-       }\r
-}\r
-\r
-void MyListReply::init()\r
-{\r
-       m_lid = 0;\r
-       m_fid = 0;\r
-       m_aid = 0;\r
-       m_gid = 0;\r
-       m_eid = 0;\r
-\r
-       m_state = State(0);\r
-       m_fileState = FileState(0);\r
-}\r
-\r
-} // namespace AniDBUdpClient\r
+#include "mylistcommand.h"
+
+#include <QStringList>
+
+namespace AniDBUdpClient {
+
+MyListCommand::MyListCommand() : AbstractCommand()
+{
+       init();
+}
+
+MyListCommand::MyListCommand(int lid) : AbstractCommand()
+{
+       init();
+       m_lid = lid;
+}
+
+MyListCommand::MyListCommand(int fid, bool isFid) : AbstractCommand()
+{
+       Q_UNUSED(isFid);
+       init();
+       m_fid = fid;
+}
+
+MyListCommand::MyListCommand(const QByteArray &ed2k, qint64 size) : AbstractCommand()
+{
+       init();
+       m_ed2k = ed2k;
+       m_size = size;
+}
+
+MyListCommand::MyListCommand(const QString &aname, const QString &gname, int epno) : AbstractCommand()
+{
+       init();
+       m_aname = aname;
+       m_gname = gname;
+       m_epno = epno;
+}
+
+MyListCommand::MyListCommand(const QString &aname, int gid, int epno) : AbstractCommand()
+{
+       init();
+       m_aname = aname;
+       m_gid = gid;
+       m_epno = epno;
+}
+
+MyListCommand::MyListCommand(int aid, const QString &gname, int epno) : AbstractCommand()
+{
+       init();
+       m_aid = aid;
+       m_gname = gname;
+       m_epno = epno;
+}
+
+MyListCommand::MyListCommand(int aid, int gid, int epno) : AbstractCommand()
+{
+       init();
+       m_aid = aid;
+       m_gid = gid;
+       m_epno = epno;
+}
+
+int MyListCommand::lid() const
+{
+       return m_lid;
+}
+
+void MyListCommand::setLid(int lid)
+{
+       m_lid = lid;
+}
+
+int MyListCommand::fid() const
+{
+       return m_fid;
+}
+
+void MyListCommand::setFid(int fid)
+{
+       m_fid = fid;
+}
+
+QByteArray MyListCommand::ed2k() const
+{
+       return m_ed2k;
+}
+
+void MyListCommand::setEd2k(const QByteArray &ed2k)
+{
+       m_ed2k = ed2k;
+}
+
+qint64 MyListCommand::size() const
+{
+       return m_size;
+}
+
+void MyListCommand::setSize(qint64 size)
+{
+       m_size = size;
+}
+
+QString MyListCommand::aname() const
+{
+       return m_aname;
+}
+
+void MyListCommand::setAname(const QString &aname)
+{
+       m_aname = aname;
+}
+
+int MyListCommand::aid() const
+{
+       return m_aid;
+}
+
+void MyListCommand::setAid(int aid)
+{
+       m_aid = aid;
+}
+
+QString MyListCommand::gname() const
+{
+       return m_gname;
+}
+
+void MyListCommand::setGname(const QString &gname)
+{
+       m_gname = gname;
+}
+
+int MyListCommand::gid() const
+{
+       return m_gid;
+}
+
+void MyListCommand::setGid(int gid)
+{
+       m_gid = gid;
+}
+
+
+int MyListCommand::epno() const
+{
+       return m_epno;
+}
+
+void MyListCommand::setEpno(int epno)
+{
+       m_epno = epno;
+}
+
+bool MyListCommand::isValid() const
+{
+       return m_lid || m_fid || m_aid
+                       || !m_aname.isEmpty()
+                       || (!m_ed2k.isEmpty() && m_size);
+}
+
+bool MyListCommand::waitForResult() const
+{
+       return true;
+}
+
+Command MyListCommand::rawCommand() const
+{
+       Command cmd;
+
+       cmd.first = "MYLIST";
+
+       if (m_lid)
+       {
+               cmd.second["lid"] = m_lid;
+       }
+       else if (m_fid)
+       {
+               cmd.second["fid"] = m_fid;
+       }
+       else if (!m_ed2k.isEmpty() && m_size)
+       {
+               cmd.second["ed2k"] = m_ed2k;
+               cmd.second["size"] = m_size;
+       }
+       else if (!m_aname.isEmpty())
+       {
+               cmd.second["aname"] = m_aname;
+               if (!m_gname.isEmpty() && m_epno)
+               {
+                       cmd.second["gname"] = m_gname;
+                       cmd.second["epno"] = m_epno;
+               }
+               else if (m_gid && m_epno)
+               {
+                       cmd.second["gid"] = m_gid;
+                       cmd.second["epno"] = m_epno;
+               }
+       }
+       else if (m_aid)
+       {
+               cmd.second["aid"] = m_aid;
+               if (!m_gname.isEmpty() && m_epno)
+               {
+                       cmd.second["gname"] = m_gname;
+                       cmd.second["epno"] = m_epno;
+               }
+               else if (m_gid && m_epno)
+               {
+                       cmd.second["gid"] = m_gid;
+                       cmd.second["epno"] = m_epno;
+               }
+       }
+       else
+       {
+               // TODO WTF NOW?!?
+       }
+       return cmd;
+}
+
+void MyListCommand::init()
+{
+       m_lid = 0;
+       m_fid = 0;
+       m_aid = 0;
+       m_gid = 0;
+
+       m_size = 0;
+       m_epno = 0;
+}
+
+
+// ===
+
+int MyListReply::lid() const
+{
+       return m_lid;
+}
+
+int MyListReply::fid() const
+{
+       return m_fid;
+}
+
+int MyListReply::aid() const
+{
+       return m_aid;
+}
+
+
+int MyListReply::gid() const
+{
+       return m_gid;
+}
+
+
+int MyListReply::eid() const
+{
+       return m_eid;
+}
+
+QDateTime MyListReply::date() const
+{
+       return m_date;
+}
+
+State MyListReply::state() const
+{
+       return m_state;
+}
+
+QDateTime MyListReply::viewDate() const
+{
+       return m_viewDate;
+}
+
+QString MyListReply::storage() const
+{
+       return m_storage;
+}
+
+QString MyListReply::source() const
+{
+       return m_source;
+}
+
+QString MyListReply::other() const
+{
+       return m_other;
+}
+
+FileState MyListReply::fileState() const
+{
+       return m_fileState;
+}
+
+QStringList MyListReply::multipleEntries() const
+{
+       return m_multipleEntries;
+}
+
+void MyListReply::setRawReply(ReplyCode replyCode, const QString &reply)
+{
+       AbstractReply::setRawReply(replyCode, reply);
+
+       switch (replyCode)
+       {
+               case MYLIST:
+               {
+                       QStringList parts = reply.mid(reply.indexOf("\n")).split('|', QString::KeepEmptyParts);
+                       bool ok;
+                       m_lid = parts[0].toInt(&ok, 10);
+                       m_fid = parts[1].toInt(&ok, 10);
+                       m_eid = parts[2].toInt(&ok, 10);
+                       m_aid = parts[3].toInt(&ok, 10);
+                       m_gid = parts[4].toInt(&ok, 10);
+                       m_date = QDateTime::fromTime_t(parts[5].toUInt(&ok, 10));
+                       m_state = State(parts[6].toInt(&ok, 10));
+                       m_viewDate = QDateTime::fromTime_t(parts[7].toUInt(&ok, 10));
+                       m_storage = parts[8];
+                       m_source = parts[9];
+                       m_other = parts[10];
+                       m_fileState = FileState(parts[11].toInt(&ok, 10));
+                       emit replyReady(true);
+               }
+               break;
+               case MULTIPLE_MYLIST_ENTRIES:
+               {
+                       m_multipleEntries = reply.mid(reply.indexOf("\n")).split('|', QString::KeepEmptyParts);
+                       emit replyReady(true);
+               }
+               break;
+               case NO_SUCH_ENTRY:
+               default:
+                       emit replyReady(false);
+               break;
+       }
+}
+
+void MyListReply::init()
+{
+       m_lid = 0;
+       m_fid = 0;
+       m_aid = 0;
+       m_gid = 0;
+       m_eid = 0;
+
+       m_state = State(0);
+       m_fileState = FileState(0);
+}
+
+} // namespace AniDBUdpClient
index 1bb28c69ca0389c4d67e4d3fad295f5004ad8b55..5de008287059126c6b828bda3ac9352abd1bc66e 100644 (file)
-#include "votecommand.h"\r
-\r
-namespace AniDBUdpClient {\r
-\r
-VoteCommand::VoteCommand()\r
-{\r
-       init();\r
-}\r
-\r
-VoteCommand::VoteCommand(VoteType voteType, int id, int value, int epno)\r
-{\r
-       init();\r
-       m_voteType = voteType;\r
-       m_id = id;\r
-       m_value = value;\r
-       m_epno = epno;\r
-}\r
-\r
-VoteCommand::VoteCommand(VoteType voteType, const QString &name, int value, int epno)\r
-{\r
-       init();\r
-       m_voteType = voteType;\r
-       m_name = name;\r
-       m_value = value;\r
-       m_epno = epno;\r
-}\r
-\r
-VoteCommand::VoteType VoteCommand::voteType() const\r
-{\r
-       return m_voteType;\r
-}\r
-\r
-void VoteCommand::setVoteType(VoteType voteType)\r
-{\r
-       m_voteType = voteType;\r
-}\r
-\r
-\r
-int VoteCommand::value() const\r
-{\r
-       return m_value;\r
-}\r
-\r
-void VoteCommand::setValue(int value)\r
-{\r
-       m_value = value;\r
-}\r
-\r
-\r
-int VoteCommand::id() const\r
-{\r
-       return m_id;\r
-}\r
-\r
-void VoteCommand::setId(int id)\r
-{\r
-       m_id = id;\r
-}\r
-\r
-\r
-QString VoteCommand::name() const\r
-{\r
-       return m_name;\r
-}\r
-\r
-void VoteCommand::setName(const QString &name)\r
-{\r
-       m_name = name;\r
-}\r
-\r
-\r
-int VoteCommand::epno() const\r
-{\r
-       return m_epno;\r
-}\r
-\r
-void VoteCommand::setEpno(int epno)\r
-{\r
-       m_epno = epno;\r
-}\r
-\r
-\r
-bool VoteCommand::waitForResult() const\r
-{\r
-       return true;\r
-}\r
-\r
-Command VoteCommand::rawCommand() const\r
-{\r
-       Command cmd;\r
-\r
-       cmd.first = "VOTE";\r
-\r
-       cmd.second["type"] = m_voteType;\r
-\r
-       if (m_id != 0)\r
-               cmd.second["id"] = m_id;\r
-       else if (!m_name.isEmpty())\r
-               cmd.second["name"] = m_name;\r
-       else\r
-               cmd.second["id"] = 0;\r
-\r
-       int value = (m_value > 0 && m_value < 100)\r
-                               || m_value > 1000 ? 0 : m_value;\r
-\r
-       cmd.second["value"] = value;\r
-\r
-       if (m_epno != 0)\r
-               cmd.second["epno"] = m_epno;\r
-\r
-       return cmd;\r
-}\r
-\r
-void VoteCommand::init()\r
-{\r
-       m_voteType = AnimeVote;\r
-       m_id = 0;\r
-       m_value = 0;\r
-       m_epno = 0;\r
-}\r
-\r
-// ===\r
-\r
-QString VoteReply::entityName() const\r
-{\r
-       return m_entityName;\r
-}\r
-\r
-int VoteReply::value() const\r
-{\r
-       return m_value;\r
-}\r
-\r
-AniDBUdpClient::VoteCommand::VoteType VoteReply::voteType() const\r
-{\r
-       return m_voteType;\r
-}\r
-\r
-int VoteReply::entityId() const\r
-{\r
-       return m_entityId;\r
-}\r
-\r
-void VoteReply::setRawReply(ReplyCode replyCode, const QString &reply)\r
-{\r
-       AbstractReply::setRawReply(replyCode, reply);\r
-}\r
-\r
-void VoteReply::init()\r
-{\r
-       m_value = 0;\r
-       m_voteType = VoteCommand::AnimeVote;\r
-       m_entityId = 0;\r
-}\r
-\r
-} // namespace AniDBUdpClient\r
+#include "votecommand.h"
+
+namespace AniDBUdpClient {
+
+VoteCommand::VoteCommand()
+{
+       init();
+}
+
+VoteCommand::VoteCommand(VoteType voteType, int id, int value, int epno)
+{
+       init();
+       m_voteType = voteType;
+       m_id = id;
+       m_value = value;
+       m_epno = epno;
+}
+
+VoteCommand::VoteCommand(VoteType voteType, const QString &name, int value, int epno)
+{
+       init();
+       m_voteType = voteType;
+       m_name = name;
+       m_value = value;
+       m_epno = epno;
+}
+
+VoteCommand::VoteType VoteCommand::voteType() const
+{
+       return m_voteType;
+}
+
+void VoteCommand::setVoteType(VoteType voteType)
+{
+       m_voteType = voteType;
+}
+
+
+int VoteCommand::value() const
+{
+       return m_value;
+}
+
+void VoteCommand::setValue(int value)
+{
+       m_value = value;
+}
+
+
+int VoteCommand::id() const
+{
+       return m_id;
+}
+
+void VoteCommand::setId(int id)
+{
+       m_id = id;
+}
+
+
+QString VoteCommand::name() const
+{
+       return m_name;
+}
+
+void VoteCommand::setName(const QString &name)
+{
+       m_name = name;
+}
+
+
+int VoteCommand::epno() const
+{
+       return m_epno;
+}
+
+void VoteCommand::setEpno(int epno)
+{
+       m_epno = epno;
+}
+
+
+bool VoteCommand::waitForResult() const
+{
+       return true;
+}
+
+Command VoteCommand::rawCommand() const
+{
+       Command cmd;
+
+       cmd.first = "VOTE";
+
+       cmd.second["type"] = m_voteType;
+
+       if (m_id != 0)
+               cmd.second["id"] = m_id;
+       else if (!m_name.isEmpty())
+               cmd.second["name"] = m_name;
+       else
+               cmd.second["id"] = 0;
+
+       int value = (m_value > 0 && m_value < 100)
+                               || m_value > 1000 ? 0 : m_value;
+
+       cmd.second["value"] = value;
+
+       if (m_epno != 0)
+               cmd.second["epno"] = m_epno;
+
+       return cmd;
+}
+
+void VoteCommand::init()
+{
+       m_voteType = AnimeVote;
+       m_id = 0;
+       m_value = 0;
+       m_epno = 0;
+}
+
+// ===
+
+QString VoteReply::entityName() const
+{
+       return m_entityName;
+}
+
+int VoteReply::value() const
+{
+       return m_value;
+}
+
+AniDBUdpClient::VoteCommand::VoteType VoteReply::voteType() const
+{
+       return m_voteType;
+}
+
+int VoteReply::entityId() const
+{
+       return m_entityId;
+}
+
+void VoteReply::setRawReply(ReplyCode replyCode, const QString &reply)
+{
+       AbstractReply::setRawReply(replyCode, reply);
+}
+
+void VoteReply::init()
+{
+       m_value = 0;
+       m_voteType = VoteCommand::AnimeVote;
+       m_entityId = 0;
+}
+
+} // namespace AniDBUdpClient
index f1153821dd383acfd44058f7a9a7255b6a79126f..8e8e78f436e9774d7ccdc2e6a758ffa63948b8eb 100644 (file)
@@ -1,88 +1,88 @@
-#ifndef VOTECOMMAND_H\r
-#define VOTECOMMAND_H\r
-\r
-#include "abstractcommand.h"\r
-\r
-namespace AniDBUdpClient {\r
-\r
-class VoteReply;\r
-\r
-class ANIDBUDPCLIENTSHARED_EXPORT VoteCommand : public AbstractCommand\r
-{\r
-\r
-public:\r
-\r
-       enum VoteType\r
-       {\r
-               AnimeVote               = 1,\r
-               AnimeTempVote   = 2,\r
-               GroupVote               = 3,\r
-       };\r
-\r
-       typedef VoteReply ReplyType;\r
-\r
-       VoteCommand();\r
-       VoteCommand(VoteType type, int id, int value, int epno = 0);\r
-       VoteCommand(VoteType type, const QString &name, int value, int epno = 0);\r
-\r
-       VoteType voteType() const;\r
-       void setVoteType(VoteType voteType);\r
-\r
-       int value() const;\r
-       void setValue(int value);\r
-\r
-       int id() const;\r
-       void setId(int id);\r
-\r
-       QString name() const;\r
-       void setName(const QString &name);\r
-\r
-       int epno() const;\r
-       void setEpno(int epno);\r
-\r
-       bool waitForResult() const;\r
-       Command rawCommand() const;\r
-\r
-private:\r
-       void init();\r
-\r
-       VoteType m_voteType;\r
-       int m_value;\r
-\r
-       int m_id;\r
-       QString m_name;\r
-       int m_epno;\r
-};\r
-\r
-class ANIDBUDPCLIENTSHARED_EXPORT VoteReply : public AbstractReply\r
-{\r
-       Q_OBJECT\r
-       REPLY_DEFINITION_HELPER2(Vote)\r
-\r
-       Q_PROPERTY(QString entityName READ entityName);\r
-       Q_PROPERTY(int value READ value);\r
-//     Q_PROPERTY(AniDBUdpClient::VoteCommand::VoteType voteType READ voteType);\r
-       Q_PROPERTY(int entityId READ entityId);\r
-\r
-public:\r
-       QString entityName() const;\r
-       int value() const;\r
-       AniDBUdpClient::VoteCommand::VoteType voteType() const;\r
-       int entityId() const;\r
-\r
-       void setRawReply(ReplyCode replyCode, const QString &reply);\r
-\r
-private:\r
-       void init();\r
-\r
-       QString m_entityName;\r
-       int m_value;\r
-       VoteCommand::VoteType m_voteType;\r
-       int m_entityId;\r
-\r
-};\r
-\r
-\r
-} // namespace AniDBUdpClient\r
-\r
-#endif // VOTECOMMAND_H\r
+#ifndef VOTECOMMAND_H
+#define VOTECOMMAND_H
+
+#include "abstractcommand.h"
+
+namespace AniDBUdpClient {
+
+class VoteReply;
+
+class ANIDBUDPCLIENTSHARED_EXPORT VoteCommand : public AbstractCommand
+{
+
+public:
+
+       enum VoteType
+       {
+               AnimeVote               = 1,
+               AnimeTempVote   = 2,
+               GroupVote               = 3,
+       };
+
+       typedef VoteReply ReplyType;
+
+       VoteCommand();
+       VoteCommand(VoteType type, int id, int value, int epno = 0);
+       VoteCommand(VoteType type, const QString &name, int value, int epno = 0);
+
+       VoteType voteType() const;
+       void setVoteType(VoteType voteType);
+
+       int value() const;
+       void setValue(int value);
+
+       int id() const;
+       void setId(int id);
+
+       QString name() const;
+       void setName(const QString &name);
+
+       int epno() const;
+       void setEpno(int epno);
+
+       bool waitForResult() const;
+       Command rawCommand() const;
+
+private:
+       void init();
+
+       VoteType m_voteType;
+       int m_value;
+
+       int m_id;
+       QString m_name;
+       int m_epno;
+};
+
+class ANIDBUDPCLIENTSHARED_EXPORT VoteReply : public AbstractReply
+{
+       Q_OBJECT
+       REPLY_DEFINITION_HELPER2(Vote)
+
+       Q_PROPERTY(QString entityName READ entityName);
+       Q_PROPERTY(int value READ value);
+//     Q_PROPERTY(AniDBUdpClient::VoteCommand::VoteType voteType READ voteType);
+       Q_PROPERTY(int entityId READ entityId);
+
+public:
+       QString entityName() const;
+       int value() const;
+       AniDBUdpClient::VoteCommand::VoteType voteType() const;
+       int entityId() const;
+
+       void setRawReply(ReplyCode replyCode, const QString &reply);
+
+private:
+       void init();
+
+       QString m_entityName;
+       int m_value;
+       VoteCommand::VoteType m_voteType;
+       int m_entityId;
+
+};
+
+
+} // namespace AniDBUdpClient
+
+#endif // VOTECOMMAND_H