#ifndef MESSAGESENDER_H
#define MESSAGESENDER_H

#include <QObject>
#include <QUrl>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QTimer>
#include <QList>
#include <QTime>
#include "Msg.h"
#include "QReplyTimeout.h"

class MessageSender : public QObject
{
    Q_OBJECT
public:
    explicit MessageSender(QObject *parent = 0, QString serverPath="", QString key="", QString id="");
    void appendMsg(Msg msg);
    
signals:
    void sent(QString id);
public slots:
    void time_out();
    void query_finishedSlot(QNetworkReply *reply);
    void beep_finishedSlot(QNetworkReply *reply);
    void reply_timeout();
private:
    bool waitting;
    QString ServerPath,UKey,SID;
    QList<Msg> msgList;
    QTimer *timer;
    QNetworkAccessManager *queryManager, *beepManager;
    int hour,minutes;
};

#endif // MESSAGESENDER_H
