#ifndef WIDGET_H #define WIDGET_H #include #include "stable.h" #include #include class QPushButton; class QHBoxLayout; class QSqlQueryModel; class QStringList; class QWebPage; class SleepThread:public QThread { public: void run(); }; namespace Ui { class Widget; } class Widget : public QWidget { Q_OBJECT public: explicit Widget(QWidget *parent = 0); ~Widget(); enum E_COLUMN { E_COLUMN_ID = 0, E_COLUMN_URL, E_COLUMN_GROUP, E_COLUMN_CLUBID, E_COLUMN_MAX, }; private: Ui::Widget *ui; STable *m_pTable; QLineEdit *m_pleUrl, *m_pleGroup, *m_pleClubId; QPushButton *m_pbtnAdd, *m_pbtnDel, *m_pbtnModify, *m_pbtnRefresh, *m_pbtnGetClubid; QSqlDatabase m_db; QSqlQueryModel *m_pQueryTable; QWebPage *m_pPage; bool m_bUsed; SleepThread m_thread; public slots: void pushAdd(); void pushDel(); void pushModify(); void pushRefresh(); void pushGetClubId(); void readWebPage(bool ok); //void clickTable(const QModelIndex & row, const QModelIndex & column); void clickTable(const QModelIndex & index); private: QHBoxLayout* initButtonLayout(); QHBoxLayout* initInputLayout(); void initTable(); bool initDatabase(); bool connectDatabase(); void showMessage(QString strMessage); bool checkGroup(); bool checkUrl(); QStringList selectedIds(); bool isClubIdNull(); bool checkClubId(); void loadUrl(QString url); void initWebPage(); void updateAllClubId(QString url, QString clubid); }; #endif // WIDGET_H