#ifndef SMANAGE_H
#define SMANAGE_H

#include <QObject>
#include <QSqlDatabase>
#include <QDate>
#include <QStringList>
#include <QVector>
#include "SProcess.h"

class Widget;
class SManage : public QObject
{
    Q_OBJECT
public:
    explicit SManage(QObject *parent = 0);
public:
    void Start(QDate _StartDate,QDate _EndDate,QString _strKeyword,QString _strAuthorship,QString _strKeywordID,QString _strGroupID,int _nStart,int _nTime);
    void SetParent(Widget *pWidget);        
    void WaitExitProcess();
    virtual bool Update() = 0;
signals:
public slots:
protected:
   virtual void Start() = 0;
   QString EncodetoUtf8(QString _str,bool _bExt=false);
   virtual void processFinished(SProcess *pPro,QString _strOut) = 0;
   bool UseProcess();
   void CheckLast();
protected:
   Widget *m_pMain;
   QDate m_date,m_dateEnd;
   int m_nMode;
   QString m_strKeyword;
   QString m_strKeywordID;
   QString m_strGroupID;
   QString m_strAuthorship;
   bool m_bFinalLast;
   int m_nTime;
   int m_nID;
   bool m_bLast;
   int m_ncList;
   int m_ncUrl;
   int m_nWait;
   static const int C_PROCESS_MAX = 1;
   SProcess m_pro[C_PROCESS_MAX];
private:
   QVector <QStringList> m_vecList;
private slots:
   void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
};

#endif // SMANAGE_H
