diff --git a/QtSource/BaiduAccessToken/BaiduAccessToken.pro b/QtSource/BaiduAccessToken/BaiduAccessToken.pro new file mode 100644 index 0000000..5ea3f4f --- /dev/null +++ b/QtSource/BaiduAccessToken/BaiduAccessToken.pro @@ -0,0 +1,31 @@ +QT += core gui network + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++17 + +# You can make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + getaccesstoken.cpp \ + main.cpp \ + mainwindow.cpp \ + qfacesearchr.cpp + +HEADERS += \ + getaccesstoken.h \ + mainwindow.h \ + qfacesearchr.h + +FORMS += \ + mainwindow.ui + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +RESOURCES += \ + Face.qrc diff --git a/QtSource/BaiduAccessToken/BaiduAccessToken.pro.user b/QtSource/BaiduAccessToken/BaiduAccessToken.pro.user new file mode 100644 index 0000000..b77915d --- /dev/null +++ b/QtSource/BaiduAccessToken/BaiduAccessToken.pro.user @@ -0,0 +1,589 @@ + + + + + + EnvironmentId + {706fde59-1f6f-4587-ab55-a6cfcd222b29} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + false + true + false + 0 + true + true + 0 + 8 + true + false + 1 + true + true + true + *.md, *.MD, Makefile + false + true + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + + 0 + true + + true + true + Builtin.DefaultTidyAndClazy + 8 + true + + + + true + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop Qt 5.9.0 MinGW 32bit + Desktop Qt 5.9.0 MinGW 32bit + qt.59.win32_mingw53_kit + 0 + 0 + 0 + + 0 + D:\Github\QtStudyDemo\build-BaiduAccessToken-Desktop_Qt_5_9_0_MinGW_32bit-Debug + D:/Github/QtStudyDemo/build-BaiduAccessToken-Desktop_Qt_5_9_0_MinGW_32bit-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + D:\Github\QtStudyDemo\build-BaiduAccessToken-Desktop_Qt_5_9_0_MinGW_32bit-Release + D:/Github/QtStudyDemo/build-BaiduAccessToken-Desktop_Qt_5_9_0_MinGW_32bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + 0 + D:\Github\QtStudyDemo\build-BaiduAccessToken-Desktop_Qt_5_9_0_MinGW_32bit-Profile + D:/Github/QtStudyDemo/build-BaiduAccessToken-Desktop_Qt_5_9_0_MinGW_32bit-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + 3 + + + 0 + 部署 + 部署 + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + false + Qt4ProjectManager.Qt4RunConfiguration:D:/Github/QtStudyDemo/BaiduAccessToken/BaiduAccessToken.pro + D:/Github/QtStudyDemo/BaiduAccessToken/BaiduAccessToken.pro + true + true + true + D:/Github/QtStudyDemo/build-BaiduAccessToken-Desktop_Qt_5_9_0_MinGW_32bit-Debug + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop + Desktop Qt 6.5.2 MSVC2019 64bit + Desktop Qt 6.5.2 MSVC2019 64bit + qt.qt6.652.win64_msvc2019_64_kit + 0 + 0 + 0 + + 0 + D:\Github\QtStudyDemo\build-BaiduAccessToken-Desktop_Qt_6_5_2_MSVC2019_64bit-Debug + D:/Github/QtStudyDemo/build-BaiduAccessToken-Desktop_Qt_6_5_2_MSVC2019_64bit-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + D:\Github\QtStudyDemo\build-BaiduAccessToken-Desktop_Qt_6_5_2_MSVC2019_64bit-Release + D:/Github/QtStudyDemo/build-BaiduAccessToken-Desktop_Qt_6_5_2_MSVC2019_64bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + D:\Github\QtStudyDemo\build-BaiduAccessToken-Desktop_Qt_6_5_2_MSVC2019_64bit-Profile + D:/Github/QtStudyDemo/build-BaiduAccessToken-Desktop_Qt_6_5_2_MSVC2019_64bit-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + 部署 + 部署 + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + false + Qt4ProjectManager.Qt4RunConfiguration:D:/Github/QtStudyDemo/BaiduAccessToken/BaiduAccessToken.pro + D:/Github/QtStudyDemo/BaiduAccessToken/BaiduAccessToken.pro + true + true + true + + 1 + + + + ProjectExplorer.Project.Target.2 + + Desktop + Desktop Qt 6.5.2 MinGW 64-bit + Desktop Qt 6.5.2 MinGW 64-bit + qt.qt6.652.win64_mingw_kit + 0 + 0 + 0 + + 0 + D:\Github\QtStudyDemo\build-BaiduAccessToken-Desktop_Qt_6_5_2_MinGW_64_bit-Debug + D:/Github/QtStudyDemo/build-BaiduAccessToken-Desktop_Qt_6_5_2_MinGW_64_bit-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + D:\Github\QtStudyDemo\build-BaiduAccessToken-Desktop_Qt_6_5_2_MinGW_64_bit-Release + D:/Github/QtStudyDemo/build-BaiduAccessToken-Desktop_Qt_6_5_2_MinGW_64_bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + D:\Github\QtStudyDemo\build-BaiduAccessToken-Desktop_Qt_6_5_2_MinGW_64_bit-Profile + D:/Github/QtStudyDemo/build-BaiduAccessToken-Desktop_Qt_6_5_2_MinGW_64_bit-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + 部署 + 部署 + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + false + ProjectExplorer.CustomExecutableRunConfiguration + + true + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 3 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/QtSource/BaiduAccessToken/Face.qrc b/QtSource/BaiduAccessToken/Face.qrc new file mode 100644 index 0000000..15eab8a --- /dev/null +++ b/QtSource/BaiduAccessToken/Face.qrc @@ -0,0 +1,5 @@ + + + Image/OIP-C.jpg + + diff --git a/QtSource/BaiduAccessToken/Image/OIP-C.jpg b/QtSource/BaiduAccessToken/Image/OIP-C.jpg new file mode 100644 index 0000000..68d854a Binary files /dev/null and b/QtSource/BaiduAccessToken/Image/OIP-C.jpg differ diff --git a/QtSource/BaiduAccessToken/getaccesstoken.cpp b/QtSource/BaiduAccessToken/getaccesstoken.cpp new file mode 100644 index 0000000..0ce9428 --- /dev/null +++ b/QtSource/BaiduAccessToken/getaccesstoken.cpp @@ -0,0 +1,45 @@ +#include "getaccesstoken.h" + + +GetAccessToken::GetAccessToken(QObject *parent) + : QObject{parent} +{ + +} + +QString GetAccessToken::GiveMeAccess() +{ + //qDebug()<post(Rst,buf); + + connect(Rpl,&QNetworkReply::readyRead, + [=]{ + + QByteArray JsonData=Rpl->readAll(); + JSO=QJsonDocument::fromJson(JsonData).object(); + //qDebug()< + +#include +#include +#include + +#include +#include + +#include + +class GetAccessToken : public QObject +{ + Q_OBJECT +public: + explicit GetAccessToken(QObject *parent = nullptr); + + + QString GiveMeAccess(); + void SendHttp(); + +signals: + + +private slots: + + +private: + QNetworkReply * Rpl; + QNetworkAccessManager * Manager; + QNetworkRequest Rst; + + + QJsonDocument JSD; + QJsonObject JSO; + + QString AcessToken; + +}; + +#endif // GETACCESSTOKEN_H diff --git a/QtSource/BaiduAccessToken/main.cpp b/QtSource/BaiduAccessToken/main.cpp new file mode 100644 index 0000000..fd3e533 --- /dev/null +++ b/QtSource/BaiduAccessToken/main.cpp @@ -0,0 +1,11 @@ +#include "mainwindow.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + return a.exec(); +} diff --git a/QtSource/BaiduAccessToken/mainwindow.cpp b/QtSource/BaiduAccessToken/mainwindow.cpp new file mode 100644 index 0000000..60eb015 --- /dev/null +++ b/QtSource/BaiduAccessToken/mainwindow.cpp @@ -0,0 +1,47 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::MainWindow) +{ + ui->setupUi(this); + this->SetWindow(); + + + NewGetAccessToken=new GetAccessToken(); + NewGetAccessToken->SendHttp(); + + NewFaceSerchR=new QFaceSearchR; + NewFaceSerchR->SetImage(QImage(":/Face/Image/OIP-C.jpg")); + + +} + +MainWindow::~MainWindow() +{ + delete ui; +} + +void MainWindow::SetWindow() +{ + QScreen * MainScreen=QGuiApplication::primaryScreen(); + this->setGeometry(0,0,MainScreen->geometry().width()/2,MainScreen->geometry().height()/2); +} + + + + +void MainWindow::on_GetACButton_clicked() +{ + + Access_Token=NewGetAccessToken->GiveMeAccess(); + ui->lineEdit->setText(Access_Token); +} + + +void MainWindow::on_SendFace_clicked() +{ + NewFaceSerchR->SendRequest(); +} + diff --git a/QtSource/BaiduAccessToken/mainwindow.h b/QtSource/BaiduAccessToken/mainwindow.h new file mode 100644 index 0000000..ddc3152 --- /dev/null +++ b/QtSource/BaiduAccessToken/mainwindow.h @@ -0,0 +1,37 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +#include +#include + +#include + +QT_BEGIN_NAMESPACE +namespace Ui { class MainWindow; } +QT_END_NAMESPACE + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); + + void SetWindow(); + +private slots: + + void on_GetACButton_clicked(); + + void on_SendFace_clicked(); + +private: + Ui::MainWindow *ui; + GetAccessToken * NewGetAccessToken; + QFaceSearchR * NewFaceSerchR; + QString Access_Token; +}; +#endif // MAINWINDOW_H diff --git a/QtSource/BaiduAccessToken/mainwindow.ui b/QtSource/BaiduAccessToken/mainwindow.ui new file mode 100644 index 0000000..9ef8ee3 --- /dev/null +++ b/QtSource/BaiduAccessToken/mainwindow.ui @@ -0,0 +1,159 @@ + + + MainWindow + + + + 0 + 0 + 800 + 600 + + + + + 0 + 0 + + + + MainWindow + + + + + + 10 + 10 + 781 + 161 + + + + + + + 1 + + + + + 0 + 0 + 779 + 69 + + + + 获取AccessToken + + + + + 0 + 10 + 771 + 55 + + + + + + + Show the Access Key + + + + + + + + + + + + + 0 + 0 + 779 + 69 + + + + 学生签到 + + + + + 10 + 0 + 761 + 61 + + + + + + + 拍照并签到 + + + + + + + + + + 0 + 0 + 779 + 69 + + + + Qt::DefaultContextMenu + + + 查看签到情况 + + + + + 0 + 20 + 781 + 71 + + + + + + + 查看 + + + + + + + + + + + + + + + 0 + 0 + 800 + 21 + + + + + + + + diff --git a/QtSource/BaiduAccessToken/qfacesearchr.cpp b/QtSource/BaiduAccessToken/qfacesearchr.cpp new file mode 100644 index 0000000..fc4375e --- /dev/null +++ b/QtSource/BaiduAccessToken/qfacesearchr.cpp @@ -0,0 +1,42 @@ +#include "qfacesearchr.h" + +QFaceSearchR::QFaceSearchR(QObject *parent) + : QObject{parent} +{ + +} + +void QFaceSearchR::SetImage(QImage Img) +{ + QByteArray byteArray; + QBuffer buffer(&byteArray); + buffer.open(QIODevice::WriteOnly); + Img.save(&buffer,"jpg"); + ImageBase64=QString::fromUtf8(byteArray.toBase64().data()); +} + +void QFaceSearchR::SendRequest() +{ + Manager=new QNetworkAccessManager(); + Request.setUrl(QUrl(tr("https://aip.baidubce.com/rest/2.0/face/v3/search?access_token=%1").arg(AcessToken))); + Request.setHeader(QNetworkRequest::ContentTypeHeader, "Content-Type: application/json"); + + jsob1.insert("group_id_list",group_id_list); + jsob1.insert("image", ImageBase64); + jsob1.insert("image_type","BASE64"); + + Reply=Manager->post(Request,QJsonDocument(jsob1).toJson()); + connect(Reply,&QNetworkReply::readyRead,this,&QFaceSearchR::On_Ready_Read); +} + +void QFaceSearchR::On_Ready_Read() +{ + QByteArray JsonData=Reply->readAll(); + QJsonObject obj=QJsonDocument::fromJson(JsonData).object(); + qDebug()< +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +class QFaceSearchR : public QObject +{ + Q_OBJECT +public: + explicit QFaceSearchR(QObject *parent = nullptr); + + void SetImage(QImage); //这个函数要吧传入的QImage写到这个类的ImageBase64里备用 + void SetToken(); //这个是用来设置SetToken; + + + void SendRequest(); +private: + QNetworkAccessManager * Manager; + QNetworkReply * Reply; + QNetworkRequest Request; + + QJsonDocument JSDocToSend; + QJsonObject jsob1; + + const QString AcessToken="24.97aea7f047412ad8b7d1a6f5ce4e43a2.2592000.1698292037.282335-39923179"; + QString ImageBase64; + QString StudenetName(); + QString group_id_list="Student"; +signals: + + + +private slots: + void On_Ready_Read(); + +}; + +#endif // QFACESEARCHR_H diff --git a/README.md b/README.md index d16b076..fd45fda 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,20 @@ # TeademiaRepository -Hello Every One and this is a test repository I created to test our own git repository \ No newline at end of file +Hello Every One and this is a test repository I created to test our own git repository + +## This is the structure of my project + +### Developments + +Here is where i note my mistake and difficulties that I have meet + +### Qtsource + +Where to find my Qt Source code + +The Qt Version I mainly used is 6.52 along with 5.9.0 + +6.52 Is usually used on Pc and 5.9.0 for RasperyPi + + +