You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

widget.h 2.5 kB

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright (C) 2021 刘臣轩
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of 
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef WIDGET_H
  18. #define WIDGET_H
  19. #include <QDebug>
  20. #include <QMessageBox>
  21. #include <QThread>
  22. #include <QWidget>
  23. #include <QFileDialog>
  24. #include <QMediaPlayer>
  25. #include <QMediaPlaylist>
  26. #include <QVideoWidget>
  27. #include <QBuffer>
  28. #include <QByteArray>
  29. #include <QFile>
  30. #include <QDateTime>
  31. #include <QTextCodec>
  32. #include <QTimer>
  33. #include <QSerialPort>
  34. #include <QSerialPortInfo>
  35. #include <QCamera>
  36. #include <QCameraImageCapture>
  37. #include <QCameraInfo>
  38. #include <QCameraViewfinder>
  39. #include <QNetworkAccessManager>
  40. #include <QNetworkReply>
  41. #include <QNetworkRequest>
  42. #include <QUrlQuery>
  43. #include <QCryptographicHash>
  44. #include <QJsonArray>
  45. #include <QJsonDocument>
  46. #include <QJsonObject>
  47. #if _MSC_VER >= 1600
  48. #pragma execution_character_set("utf-8")
  49. #endif
  50. QT_BEGIN_NAMESPACE
  51. namespace Ui {
  52. class Widget;
  53. }
  54. QT_END_NAMESPACE
  55. class Widget : public QWidget {
  56. Q_OBJECT
  57. public:
  58. Widget(QWidget* parent = nullptr);
  59. ~Widget();
  60. private:
  61. Ui::Widget* ui;
  62. QTimer* videoTimer;
  63. QMediaPlayer* player;
  64. QVideoWidget* videoWidget;
  65. QMediaPlaylist* playList;
  66. QSerialPort* serialPort;
  67. void initSerial();
  68. void serialWrite(const char data);
  69. QCamera* camera;
  70. QCameraViewfinder* viewFinder;
  71. QCameraImageCapture* imageCapture;
  72. void initCamera();
  73. void captureImage();
  74. QNetworkAccessManager* networkManager;
  75. QNetworkRequest* networkRequest;
  76. QUrl* url;
  77. void sendRequest(QByteArray& imageBase64);
  78. void classifyFinished(QString cate_name);
  79. qint64 number;
  80. private slots:
  81. void timerUpdate();
  82. void videoTimerUpdate();
  83. void serialRead();
  84. void onImageCaptured(int, QImage image);
  85. void onRequestFinished(QNetworkReply* reply);
  86. signals:
  87. void imageCaptured(int, QImage);
  88. };
  89. #endif // WIDGET_H

No Description

Contributors (1)