#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QMenuBar>
#include <QDebug>
#include <QSqlQuery>
#include <QSqlDatabase>
#include <QSqlError>
#include <QProgressBar>
#include <QSqlDatabase>
#include <QTimer>
#include <QWebView>
#include "sloaddlg.h"
#include "sdatadlg.h"
#include "scountdlg.h"
#include "sfilterobject.h"
#include "sfilterdlg.h"
#include "sbatchrun.h"
#include "scolumn.h"

#define D_DIALOG_MAX 5

class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    MainWindow(QWidget *parent = 0);    
    ~MainWindow();
    void InsertLog(QString str);    
    bool initDb();
private:
    void setMenu();    
    bool ReloadColumn();    
    void setDialog();
private slots:
    void FileNew();
    void FileImport();
    void FileExport();
    void FileExit();
    void WindowLoad();    
    void WindowData();
    void WindowFilter();
    void WindowCount();
    void WindowFilterObject();
    void Alive();
public:
    SLoadDlg *m_ploadDlg;
    SDataDlg *m_pDataDlg;
    SCountDlg *m_pCountDlg;
    SFilterObject *m_pFilterObjectDlg;
    SFilterDlg *m_pFilterDlg;
    SBatchRun *m_pBatchRunDlg;
    QWebView m_graph;
    QSqlDatabase m_db;
    QProgressBar m_progress;
private:        
    QDialog *m_pDialogs[D_DIALOG_MAX];
    QTimer m_timerAlive;
protected:
    void closeEvent(QCloseEvent * event);
};

MainWindow *GetMainWindow();
SColumn GetColumn();

#endif // MAINWINDOW_H
