-#ifndef _REMOTE_H_
-#define _REMOTE_H_
-
-#include "iremote.h"
-#include "model.h"
+#ifndef REMOTE_H
+#define REMOTE_H
+#include <QObject>
#include <QString>
+#include <QNetworkReply>
+#include <QNetworkAccessManager>
-class IrCtrl;
-class NetIO;
-class QSettings;
+namespace Rating {
+ typedef bool Rating;
+ Rating Up = true;
+ Rating Down = false;
+}
-class Remote : public IRemote
+class Remote : public QObject
{
+ Q_OBJECT
public:
- Remote();
- Remote(const QString &id, NetIO *);
- ~Remote();
+ Remote(const QString &name);
+ Remote(const QString &name, const QString &mfg,
+ int rating, int voteCount);
- const QString &id() const;
- void setId(const QString &id);
- void setNetIO(NetIO *);
+ //getters
+ QString name() const { return m_name; }
+ QString mfg() const { return m_mfg; }
+ int rating() const { return m_rating; }
+ int voteCount() const { return m_voteCount; }
- // visible for gui
- void updateRating();
- void sendRating(bool good);
- void sendCmd(RemoteCmd);
+public slots:
+ void saveToFile();
+ void updateInfo();
+ void sendRating(Rating::Rating);
-private:
- Remote(const Remote &remote);
+signals:
+ void infoUpdated();
private:
- bool rated;
- Model model;
- QSettings *settings;
- IrCtrl *irCtrl;
- NetIO *netIO;
+ QString m_name;
+ QString m_mfg;
+ int m_rating;
+ int m_voteCount;
+
+ QNetworkAccessManager m_infoNAM;
+ QNetworkAccessManager m_remoteNAM;
+ QNetworkAccessManager m_ratingNAM;
+
+ void init();
+
+ void remoteDownloadFinished(QNetworkReply *reply);
+ void infoRequestFinished(QNetworkReply *reply);
};
-#endif // _REMOTE_H_
-
-
+#endif