answerWidget.h 3.7 KB

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