#ifndef CLOPERATION_H
#define CLOPERATION_H

#include <QWidget>

namespace Ui {
class clOperation;
}

enum class CL_OPERATION_TYPE
{
    cot_online_exam = 1,
    cot_online_finish_exam,
    cot_online_homework,
    cot_online_practice,
	cot_online_practice_result,
	cot_offline_init_exam,
    cot_offline_exam,
    cot_offline_status_null,
    cot_offline_status_download,
};

class clOperation : public QWidget
{
    Q_OBJECT
signals:
    void showObjectiveScore(CL_OPERATION_TYPE cot, int nRow);
    void hideObjectiveScore(CL_OPERATION_TYPE cot, int nRow);
    void enterExam(CL_OPERATION_TYPE cot, int nRow);
    void viewPracticeDetail(int nRow);
    void viewPracticePaper(int nRow);
    void offlineExamStart(int nRow);
    void viewOfflinePaper(int nRow);
    void downloadOfflinePaper(int nRow);
    void uploadOfflineAnswer(int nRow);
    void downloadOfflineAnswer(int nRow);
public:
    explicit clOperation(const int nRow, QWidget *parent = nullptr);
    ~clOperation();

    void setUI(const int nWidth, const int nHeight, CL_OPERATION_TYPE cot);
	void setOperationType(CL_OPERATION_TYPE cot);
	void setBtn1Enable(bool bEnable);
    void setBtn2Enable(bool bEnable);
private slots:
    void on_btn1_clicked();

    void on_btn2_clicked();

    void on_btn3_clicked();

    void on_btn4_clicked();

private:
    bool eventFilter(QObject *obj, QEvent *ev);

    Ui::clOperation *ui;
    CL_OPERATION_TYPE m_operationType;
    int m_nRow;
};

#endif // CLOPERATION_H
