answerWidget.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #ifndef ANSWERWIDGET_H
  2. #define ANSWERWIDGET_H
  3. #include <QWidget>
  4. #include <QTimer>
  5. #include <QPushButton>
  6. #include "CHttpBll.h"
  7. #include "question.h"
  8. #include "questionSet.h"
  9. #include "awHandinPaper.h"
  10. #include "awResumeExam.h"
  11. #include "faceLiveness.h"
  12. #include "awTimeLeftTips.h"
  13. #include <opencv2/opencv.hpp>
  14. #include "CLiveViodeProc.h"
  15. #include "CMultiMonitorEnumerator.h"
  16. namespace Ui {
  17. class answerWidget;
  18. }
  19. class answerWidget : public QWidget , ITRTCVideoRenderCallback
  20. {
  21. Q_OBJECT
  22. signals:
  23. void showExamScore();
  24. void showPracticeInfo();
  25. void gobackCourseList();
  26. void gobackLogin();
  27. public:
  28. explicit answerWidget(QWidget *parent = nullptr);
  29. ~answerWidget();
  30. void setUI(const int nLeft, const int nTop, const int nWidth, const int nHeight);
  31. private slots:
  32. void onGetExamProperty(CGetExamProperty getExamProperty);
  33. void onWeiXinAnswerEnabled(CWeiXinAnswerEnabled weiXinAnswerEnabled);
  34. void onGetExamById(CGetExamById getExamById);
  35. void onFindExamQuestionList(CFindExamQuestionList findExamQuestionList);
  36. void onGetExamRecordPaperStruct(CGetExamRecordPaperStruct getExamRecordPaperStruct);
  37. void onGetQuestionContent(CGetQuestionContent getQuestionContent);
  38. void onStartAnswer(CStartAnswer startAnswer);
  39. void onExamHeartbeat(CExamHeartbeat examHeartbeat);
  40. void onSubmitQuestionAnswer(CSubmitQuestionAnswer submitQuestionAnswer);
  41. void onEndExam(CEndExam endExam);
  42. void onGetOrgPropertiesByGroupWithoutCache(CGetOrgPropertiesByGroupWithoutCache orgProperties);
  43. void onStartFaceLiveVerify(CStartFaceLiveVerify startFaceLiveVerify);
  44. void onGetSoftwareConfig(CGetSoftwareConfig getSoftwareConfig);
  45. void on_btn_handInPaper_clicked();
  46. void on_btn_all_clicked();
  47. void on_btn_answered_clicked();
  48. void on_btn_unanswered_clicked();
  49. void on_btn_marked_clicked();
  50. void on_btn_allNum_clicked();
  51. void on_btn_answeredNum_clicked();
  52. void on_btn_unansweredNum_clicked();
  53. void on_btn_markedNum_clicked();
  54. private:
  55. void getQuestionContent(QString sQuestionId, int nOrder);
  56. void showSubQuestion(CQuestionStruct &qs, int nOrder, QString sTitle, QString sProgress);
  57. CAnsweredQuestion findQuestionByOrder(CFindExamQuestionList &feql, int nOrder);
  58. void heartBreat();
  59. void uploadAnswer(int nIndex, QString sAnswer);
  60. void showQuestionByOrder(int nOrder);
  61. void handinPaper();
  62. void refreshStatus();
  63. bool checkAnswer();
  64. void startCapture();
  65. void stopCapture();
  66. void onRenderVideoFrame(const char* userId, TRTCVideoStreamType streamType, TRTCVideoFrame* frame);
  67. void checkRemoteBreach();
  68. void setChecked(QPushButton *btn, bool bChecked);
  69. Ui::answerWidget *ui;
  70. int m_nSnapshotInterval;
  71. QString m_sPracticeType;
  72. int m_nFreezeTime;
  73. std::vector<CPaperGroupStruct> m_vPaperGroupStruct;
  74. std::shared_ptr<question> m_pQuestion;
  75. std::shared_ptr<questionSet> m_pQuestionSet;
  76. std::shared_ptr<QTimer> m_pCountDownTimer;
  77. std::shared_ptr<QTimer> m_pHeartbeatTimer;
  78. std::shared_ptr<awHandinPaper> m_pHandinPaper;
  79. std::shared_ptr<awResumeExam> m_pResumeExam;
  80. std::shared_ptr<QTimer> m_pHandinPaperTimer;
  81. std::shared_ptr<faceLiveness> m_pFaceLiveness;
  82. std::shared_ptr<awTimeLeftTips> m_ptimeLeftTips;
  83. std::shared_ptr<QTimer> m_pNetWorkErrorTimerPtr;
  84. int m_nLeftSeconds = 0;
  85. int m_nEnterExamTime = 0;
  86. int m_nUsedExamSeconds = 0;
  87. int m_nEnterLivenessFaceSeconds = 0;
  88. bool bShowLivenessTip;//活体检测前提示
  89. bool bShowLeftHint;
  90. int m_nHeartBreatFailedCount;
  91. const int m_nHeartBreatFailedExitCount = 10;
  92. std::shared_ptr<QTimer> m_pVideoTimer;
  93. // std::shared_ptr<QTimer> m_pinitTimer;
  94. // cv::VideoCapture m_cam;
  95. cv::Mat m_nCurImage;
  96. std::mutex m_imageMutex;
  97. __int64 m_lastFaceTime = 0;
  98. int m_nLastCaptureSecond = 0;
  99. int m_nNextFaceCountSecond = 0;
  100. QStringList m_sRemoteList;
  101. QStringList m_sRemoteTipList;
  102. };
  103. #endif // ANSWERWIDGET_H