File indexing completed on 2024-12-22 04:31:17

0001 #ifndef CLOUD_H
0002 #define CLOUD_H
0003 
0004 #include "models/baselist.h"
0005 #include <QObject>
0006 
0007 class FM;
0008 class Cloud : public BaseList
0009 {
0010     Q_OBJECT
0011     Q_PROPERTY(QString account READ getAccount WRITE setAccount NOTIFY accountChanged)
0012 
0013 public:
0014     enum SORTBY : uint_fast8_t {
0015         SIZE = FMH::MODEL_KEY::SIZE,
0016         MODIFIED = FMH::MODEL_KEY::MODIFIED,
0017         DATE = FMH::MODEL_KEY::DATE,
0018         LABEL = FMH::MODEL_KEY::LABEL,
0019         MIME = FMH::MODEL_KEY::MIME
0020 
0021     };
0022     Q_ENUM(SORTBY)
0023 
0024     explicit Cloud(QObject *parent = nullptr);
0025     FMH::MODEL_LIST items() const override;
0026 
0027     void setAccount(const QString value);
0028     QString getAccount() const;
0029 
0030 private:
0031     FMH::MODEL_LIST list;
0032     void setList();
0033     void formatList();
0034 
0035     QHash<QString, int> pending;
0036 
0037     QString account;
0038     FM *fm;
0039 
0040 public slots:
0041     QVariantMap get(const int &index) const override;
0042     void requestImage(const int &index);
0043     bool update(const QVariantMap &data, const int &index) override;
0044 
0045 signals:
0046     void accountChanged();
0047     void cloudImageReady(QVariantMap item);
0048     void warning(QString error);
0049 };
0050 
0051 #endif // CLOUD_H