logoutcommand.cpp \
uptimecommand.cpp \
mylistcommand.cpp \
- filecommand.cpp
+ filecommand.cpp \
+ file.cpp
HEADERS += client.h \
anidbudpclient_global.h \
abstractcommand.h \
logoutcommand.h \
uptimecommand.h \
mylistcommand.h \
- filecommand.h
+ filecommand.h \
+ file.h
CONV_HEADERS += include/AniDBUdpClient/Client \
include/AniDBUdpClient/AbstractCommand \
include/AniDBUdpClient/RawCommand \
include/AniDBUdpClient/MyListCommand \
include/AniDBUdpClient/MyListAddCommand \
include/AniDBUdpClient/UptimeCommand \
- include/AniDBUdpClient/FileCommand
+ include/AniDBUdpClient/FileCommand \
+ include/AniDBUdpClient/File
include(../../lib/qtstatemachine/src/qtstatemachine.pri)
--- /dev/null
+#include "file.h"
+
+namespace AniDBUdpClient {
+
+File::File(QObject *parent) : QObject(parent)
+{
+}
+
+QString File::file() const
+{
+ return m_file;
+}
+
+void File::setFile(const QString &file)
+{
+ m_file = file;
+}
+
+qint64 File::size()
+{
+ return m_size;
+}
+
+QByteArray File::ed2k()
+{
+ return m_ed2k;
+}
+
+void File::hash()
+{
+
+}
+
+bool File::rename()
+{
+ return false;
+}
+
+bool File::markWatched(bool watched)
+{
+ return watched;
+}
+
+
+void File::finishHashing()
+{
+
+}
+
+void File::finishRenaming()
+{
+
+}
+
+void File::finishMarking()
+{
+
+}
+
+} // namespace AniDBUdpClient
--- /dev/null
+#ifndef FILE_H
+#define FILE_H
+
+#include "anidbudpclient_global.h"
+#include <QObject>
+
+namespace AniDBUdpClient {
+
+class FileCommand;
+class MyListCommand;
+
+class ANIDBUDPCLIENTSHARED_EXPORT File : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString file READ file WRITE setFile);
+
+ Q_PROPERTY(qint64 size READ size);
+ Q_PROPERTY(QByteArray ed2k READ ed2k);
+
+public:
+
+ enum Action {
+ Hashing,
+ Renaming,
+ MarkingWatched,
+
+ All = -1,
+ };
+
+ File(QObject *parent = 0);
+
+ QString file() const;
+ void setFile(const QString &file);
+
+ qint64 size();
+ QByteArray ed2k();
+
+public slots:
+ void hash();
+ bool rename();
+ bool markWatched(bool watched = true);
+
+signals:
+ void finished(Action action);
+
+private slots:
+ void finishHashing();
+ void finishRenaming();
+ void finishMarking();
+
+private:
+
+ QString m_file;
+ qint64 m_size;
+ QByteArray m_ed2k;
+
+};
+
+} // namespace AniDBUdpClient
+
+#endif // FILE_H
--- /dev/null
+#include "../../file.h"
\ No newline at end of file