#ifndef YMCENTERKEYWORDWIDGET
#define YMCENTERKEYWORDWIDGET

#include "ymorpherewidget.h"
#include <QCalendarWidget>
#include <QDateEdit>
#include <QPushButton>
#include <QHBoxLayout>
#include <QComboBox>
#include <QLineEdit>
#include <QGroupBox>
#include <QListWidget>
#include <QTabWidget>
#include <QRadioButton>
#include <QButtonGroup>
#include <QTableWidget>
#include <QProgressBar>
#include <QMenuBar>
#include <QSqlDatabase>
#include <QListWidgetItem>
#include "stable.h"

class YMCenterKeywordWidget:public YMorphereWidget
{
    Q_OBJECT

public:
    YMCenterKeywordWidget(QWidget *parent = 0);
    ~YMCenterKeywordWidget();
    void clearViewResult();
    void clearView();
    void ViewResult();
    QMap<QString, QString> convertToParam();
    void SaveFile();

    //Morphere List
    int getThread();
    unsigned int getDateStart();
    unsigned int getDateEnd();
    int getPeriod();
    QStringList getMorphereList();
    bool getDateAll();
    QString getUserDictList();
    QString getCenterKeyword();
    void setParam(QString strJson);

private:
    // Data
    QListWidget *m_plwData;
    // Date
    QCalendarWidget *m_pcw;
    QDateEdit *m_pdeStart;
    QDateEdit *m_pdeEnd;
    QLineEdit *m_pleDates;
    QComboBox *m_pcbDuring;
    //QPushButton *m_ppbInsertCalc;
    //QComboBox *m_pcbDateCatalog;
    //
    QTabWidget *m_ptwData;
    //
    QProgressBar *m_pProgress;
    // Column
    QVector <QStringList> m_vecColumn;
    // MorphereList
    QListWidget *m_plwMorphereList;
    QListWidget *m_plwMorphereAdd;

    QComboBox *m_pcbDate;
    QComboBox *m_pcbPeriod;

    QLineEdit *m_pleTop;
    QLineEdit *m_pleKeyword;
    QLineEdit *m_pleFront;
    QLineEdit *m_pleBack;

    QComboBox *m_pcbThread;
    QComboBox *m_pcbSort;

    QListWidgetItem **m_plwiMorphere;
    QStringList m_strlistMorphere;
    QStringList m_strlistMorphereko;

    QRadioButton *m_rbDateMorphere;
    QRadioButton *m_rbMorphereDate;
    QButtonGroup *m_bgRadioGroup;

    QComboBox *m_pcbDictionary;
    QList<STable*> m_lTable;
    QList<QTabWidget*> m_lTabWidget;
    QTabWidget* m_ptwTable;


    //QMap<QString, QMap<QString, QMap<int, QString> > > m_mapViewResult;
    QMap<QString, QMap<QString, QMap<QString, int> > > m_mapViewResult;
    QString m_strCKeyword;
    QLineEdit *m_pleCKeyword;
    QComboBox *m_pcbCenterKeywordMethod;
    QComboBox* m_pcbData;




public:
    struct m_mapKey
    {
        QString strDate;
        QString strMorphere;
        QString strKeyword;
    };



private:
    QGroupBox *setMorphereList();
    QGroupBox *setDate();
    QGroupBox *setFilter();
    QGroupBox *setOther();
    QGroupBox *setSort();
    QGroupBox *setDictionary();
    QGroupBox *setCenterKeyword();
    QGroupBox *setData();
    void SortViewResult();

    QTableWidget *AddTable(QString _str);


public slots:
    void CloseTab(int index);
    void DoubleClickTab(int index);
    void FileImport();
    void FileExport();
    void RawFileExport();
    void MemClear();
    void MorphereListAdd();
    void MorphereListDel();
    void AddDictionary();
    void DelDictionary();
    bool setListMorphere(QStringList& MorphereEN, QStringList& MorphereKO);
    QTabWidget* getQTabWidget();
    bool isSortMorphereDateChecked();
    bool isSortDateMorphereChecked();


};
#endif // YMCENTERKEYWORDWIDGET

