├── 4.jpg ├── pic.qrc ├── main.cpp ├── kaoqin.h ├── teacher.h ├── info.h ├── .gitignore ├── jasonqt_face.h ├── loginwidget.h ├── RLSB.pro ├── JasonQt_Net.h ├── kaoqin.cpp ├── mainwindow.h ├── loginwidget.cpp ├── info.ui ├── loginwidget.ui ├── teacher.ui ├── jasonqt_face.cpp ├── info.cpp ├── teacher.cpp ├── kaoqin.ui ├── README.md ├── mainwindow.ui ├── JasonQt_Net.cpp ├── mainwindow.cpp ├── RLSB.pro.user.070ba77.4.8-pre1 ├── RLSB.pro.user └── LICENSE /4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Color-l/FaceSignSystem/HEAD/4.jpg -------------------------------------------------------------------------------- /pic.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.jpg 5 | 6 | 7 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | //#include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | int m=0;//记录签到人数 8 | QApplication a(argc, argv); 9 | MainWindow w; 10 | w.show(); 11 | return a.exec(); 12 | } 13 | -------------------------------------------------------------------------------- /kaoqin.h: -------------------------------------------------------------------------------- 1 | #ifndef KAOQIN_H 2 | #define KAOQIN_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class Kaoqin; 8 | } 9 | 10 | class Kaoqin : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit Kaoqin(QWidget *parent = 0); 16 | ~Kaoqin(); 17 | 18 | signals: 19 | void mysig(); 20 | 21 | private slots: 22 | void on_return_2_clicked(); 23 | 24 | private: 25 | Ui::Kaoqin *ui; 26 | }; 27 | 28 | #endif // KAOQIN_H 29 | -------------------------------------------------------------------------------- /teacher.h: -------------------------------------------------------------------------------- 1 | #ifndef TEACHER_H 2 | #define TEACHER_H 3 | 4 | #include 5 | #include"info.h" 6 | 7 | namespace Ui { 8 | class teacher; 9 | } 10 | 11 | class teacher : public QWidget 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit teacher(QWidget *parent = 0); 17 | ~teacher(); 18 | 19 | private slots: 20 | void on_return_2_clicked(); 21 | 22 | 23 | void on_addinfo_clicked(); 24 | 25 | void on_delinfo_clicked(); 26 | 27 | void on_reflash_clicked(); 28 | 29 | signals: 30 | void mysig(); 31 | 32 | private: 33 | Ui::teacher *ui; 34 | info* ma; 35 | }; 36 | 37 | #endif // TEACHER_H 38 | -------------------------------------------------------------------------------- /info.h: -------------------------------------------------------------------------------- 1 | #ifndef INFO_H 2 | #define INFO_H 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include "jasonqt_face.h" 10 | 11 | namespace Ui { 12 | class info; 13 | } 14 | 15 | class info : public QWidget 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | explicit info(QWidget *parent = nullptr); 21 | ~info(); 22 | 23 | signals: 24 | void mysig(); 25 | 26 | private slots: 27 | 28 | void on_exit_clicked(); 29 | 30 | void on_ok_clicked(); 31 | 32 | private: 33 | Ui::info *ui; 34 | QCamera *m_camera;//系统摄像头设备 35 | QCameraViewfinder *m_cameraViewFinder;//摄像头取景器部件 36 | QCameraImageCapture *m_cameraImageCapture;//截图部件 37 | JasonQt_Face *m_BaiduFace; //百度人脸接口 38 | 39 | int m_ControlType; 40 | 41 | }; 42 | 43 | #endif // INFO_H 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | *.slo 3 | *.lo 4 | *.o 5 | *.a 6 | *.la 7 | *.lai 8 | *.so 9 | *.so.* 10 | *.dll 11 | *.dylib 12 | 13 | # Qt-es 14 | object_script.*.Release 15 | object_script.*.Debug 16 | *_plugin_import.cpp 17 | /.qmake.cache 18 | /.qmake.stash 19 | *.pro.user 20 | *.pro.user.* 21 | *.qbs.user 22 | *.qbs.user.* 23 | *.moc 24 | moc_*.cpp 25 | moc_*.h 26 | qrc_*.cpp 27 | ui_*.h 28 | *.qmlc 29 | *.jsc 30 | Makefile* 31 | *build-* 32 | *.qm 33 | *.prl 34 | 35 | # Qt unit tests 36 | target_wrapper.* 37 | 38 | # QtCreator 39 | *.autosave 40 | 41 | # QtCreator Qml 42 | *.qmlproject.user 43 | *.qmlproject.user.* 44 | 45 | # QtCreator CMake 46 | CMakeLists.txt.user* 47 | 48 | # QtCreator 4.8< compilation database 49 | compile_commands.json 50 | 51 | # QtCreator local machine specific files for imported projects 52 | *creator.user* 53 | -------------------------------------------------------------------------------- /jasonqt_face.h: -------------------------------------------------------------------------------- 1 | #ifndef JASONQT_FACE_H 2 | #define JASONQT_FACE_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "JasonQt_Net.h" 10 | class JasonQt_Face :public QObject 11 | { 12 | Q_OBJECT 13 | public: 14 | JasonQt_Face(const QString &apiKey, const QString &secretKey);//返回相似度 15 | bool RegisterMember(QString qstrImage,QString UserId);//注册人脸 16 | int Identifyface(QString qstrImage);//比对人脸 17 | private: 18 | //baidu.ai的 FACE相关key 19 | QString m_apiKey; 20 | QString m_secretKey; 21 | QString m_token; 22 | QByteArray m_buf; 23 | JasonQt_Net::HTTP m_http; 24 | QString m_UserId; 25 | double m_dThresholdValue; //人脸识别阈值 26 | public slots: 27 | bool refreshToken(void);//更新Token 28 | }; 29 | 30 | #endif // JASONQT_FACE_H 31 | -------------------------------------------------------------------------------- /loginwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGINWIDGET_H 2 | #define LOGINWIDGET_H 3 | 4 | #include 5 | /************************************** 6 | *@projectName LoginWidget 7 | *@brief 登录界面设计 8 | *@date 2020-07-8 9 | *@author 杨英凡 10 | *@version V0.1 11 | *****************************************/ 12 | namespace Ui { 13 | class LoginWidget; 14 | } 15 | #define LOGIN_SUCCEED 1//登录成功 16 | #define LOGIN_ERROR_NAME 2//用户名错误 17 | #define LOGIN_ERROR_PASSD 3//密码错误 18 | #define LOGIN_ERROR 4//用户名和密码均错误 19 | class LoginWidget : public QDialog 20 | { 21 | Q_OBJECT 22 | 23 | public: 24 | explicit LoginWidget(QWidget *parent = nullptr); 25 | ~LoginWidget(); 26 | int GetLoginInfo(); 27 | private slots: 28 | void OnOKBtn(); 29 | void OnCancelBtn(); 30 | 31 | private: 32 | Ui::LoginWidget *ui; 33 | QString m_UserName; 34 | QString m_PassWord; 35 | int m_LoginInfo; 36 | }; 37 | 38 | #endif // LOGINWIDGET_H 39 | -------------------------------------------------------------------------------- /RLSB.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2020-07-08T00:23:25 4 | # 5 | #------------------------------------------------- 6 | QT += core gui multimedia multimediawidgets 7 | QT += core gui 8 | QT += sql 9 | 10 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 11 | 12 | TARGET = RLSB 13 | TEMPLATE = app 14 | 15 | 16 | SOURCES += main.cpp\ 17 | info.cpp \ 18 | loginwidget.cpp \ 19 | mainwindow.cpp \ 20 | kaoqin.cpp \ 21 | teacher.cpp \ 22 | JasonQt_Net.cpp \ 23 | jasonqt_face.cpp 24 | 25 | HEADERS += mainwindow.h \ 26 | info.h \ 27 | kaoqin.h \ 28 | loginwidget.h \ 29 | teacher.h \ 30 | JasonQt_Net.h \#链接百度AI相关函数封装 31 | jasonqt_face.h 32 | 33 | FORMS += mainwindow.ui \ 34 | info.ui \ 35 | kaoqin.ui \ 36 | loginwidget.ui \ 37 | teacher.ui 38 | 39 | RESOURCES += \ 40 | pic.qrc 41 | 42 | # Default rules for deployment. 43 | qnx: target.path = /tmp/$${TARGET}/bin 44 | else: unix:!android: target.path = /opt/$${TARGET}/bin 45 | !isEmpty(target.path): INSTALLS += target 46 | 47 | DISTFILES += 48 | -------------------------------------------------------------------------------- /JasonQt_Net.h: -------------------------------------------------------------------------------- 1 | /************************************** 2 | *@projectName JasonQt_Net 3 | *@brief 链接百度ai相关函数封装 4 | *@date 2020-07-08 5 | *@author 翁飞龙 6 | *@version V0.1 7 | *****************************************/ 8 | #ifndef __JasonQt_Net_h__ 9 | #define __JasonQt_Net_h__ 10 | 11 | // Qt lib import 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace JasonQt_Net 25 | { 26 | 27 | QNetworkAddressEntry getNetworkAddressEntry(void); 28 | 29 | QString getDeviceName(void); 30 | 31 | class HTTP: public QObject 32 | { 33 | Q_OBJECT 34 | 35 | private: 36 | QNetworkAccessManager m_manage; 37 | QNetworkReply *m_reply = nullptr; 38 | QTimer m_timer; 39 | 40 | public: 41 | HTTP(void); 42 | 43 | public slots: 44 | void get(const QUrl &url, const int &maxTime = 30000); 45 | 46 | void post(const QNetworkRequest &networkRequest, const QByteArray &append, const int &maxTime = 30000); 47 | 48 | void stop(void); 49 | 50 | bool get(const QUrl &url, QByteArray &target, const int &maxTime = 30000); 51 | 52 | bool post(const QNetworkRequest &networkRequest, const QByteArray &append, QByteArray &target, const int &maxTime = 30000); 53 | 54 | private slots: 55 | void onFinished(QNetworkReply *reply); 56 | 57 | void onTimeout(void); 58 | 59 | void onError(const QNetworkReply::NetworkError &error); 60 | 61 | signals: 62 | void finished(const QByteArray data); 63 | 64 | void error(const QNetworkReply::NetworkError error); 65 | }; 66 | 67 | } 68 | 69 | #endif//__JasonQt_Net_h__ 70 | -------------------------------------------------------------------------------- /kaoqin.cpp: -------------------------------------------------------------------------------- 1 | #include "kaoqin.h" 2 | #include"mainwindow.h" 3 | #include "ui_kaoqin.h" 4 | #include 5 | 6 | Kaoqin::Kaoqin(QWidget *parent) : 7 | QWidget(parent), 8 | ui(new Ui::Kaoqin) 9 | { 10 | 11 | ui->setupUi(this); 12 | ui->studaka->setColumnWidth(4,200); 13 | //打开数据库 14 | QSqlDatabase database; 15 | if (QSqlDatabase::contains("qt_sql_default_connection")) 16 | { 17 | database = QSqlDatabase::database("qt_sql_default_connection"); 18 | } 19 | else 20 | { 21 | database = QSqlDatabase::addDatabase("QSQLITE"); 22 | database.setDatabaseName("MyDataBase.db"); 23 | database.setUserName("123456"); 24 | database.setPassword("123456"); 25 | } 26 | 27 | if (!database.open()) 28 | { 29 | qDebug() << "Error: Failed to connect database..." << database.lastError(); 30 | 31 | } 32 | else 33 | { 34 | qDebug() << "Succeed to connect database..." ; 35 | 36 | } 37 | 38 | QSqlQuery query; 39 | QString sql = QString("SELECT * FROM student "); 40 | query.exec(sql); 41 | QString id; 42 | QString name; 43 | QString class_2; 44 | QString school; 45 | ui->studaka->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); 46 | ui->studaka->setSelectionBehavior(QAbstractItemView::SelectRows); 47 | ui->studaka->setEditTriggers(QAbstractItemView::NoEditTriggers); 48 | int cow=0; 49 | while(query.next()){ 50 | for(int row=0;row<5;row++){ 51 | ui->studaka->setItem(cow,row,new QTableWidgetItem(query.value(row).toString())); 52 | } 53 | cow++; 54 | } 55 | database.close(); 56 | } 57 | 58 | Kaoqin::~Kaoqin() 59 | { 60 | delete ui; 61 | } 62 | 63 | void Kaoqin::on_return_2_clicked() 64 | { 65 | this->hide(); 66 | emit mysig(); 67 | } 68 | -------------------------------------------------------------------------------- /mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "jasonqt_face.h" 11 | #include 12 | //#include 13 | #include 14 | #include"kaoqin.h" 15 | #include"teacher.h" 16 | #include"loginwidget.h" 17 | #include"info.h" 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | 29 | namespace Ui { 30 | class MainWindow; 31 | } 32 | QT_END_NAMESPACE 33 | #define LOGIN_TYPE 1//登陆 34 | #define REGISTER_TYPE 2//注册 35 | #define LOGIN_SUCCEED 1//登录成功 36 | #define LOGIN_ERROR_NAME 2//用户名错误 37 | #define LOGIN_ERROR_PASSD 3//密码错误 38 | #define LOGIN_ERROR 4//用户名和密码均错误 39 | class MainWindow : public QMainWindow 40 | { 41 | Q_OBJECT 42 | 43 | public: 44 | explicit MainWindow(QWidget *parent = 0); 45 | ~MainWindow(); 46 | 47 | private slots: 48 | void on_kaoqin_clicked(); 49 | 50 | void on_teacher_clicked(); 51 | 52 | void on_sure_clicked(); 53 | 54 | void on_open_clicked(); 55 | 56 | void on_quit_clicked(); 57 | 58 | void timerUpdate(void); 59 | 60 | int cameraImageCaptured(int id, QImage image); 61 | 62 | 63 | void on_pushButton_clicked(); 64 | 65 | private: 66 | Ui::MainWindow *ui; 67 | Kaoqin* mf; 68 | teacher* mff; 69 | LoginWidget* login; 70 | info* ma; 71 | QCamera *m_camera;//系统摄像头设备 72 | QCameraViewfinder *m_cameraViewFinder;//摄像头取景器部件 73 | QCameraImageCapture *m_cameraImageCapture;//截图部件 74 | JasonQt_Face *m_BaiduFace; //百度人脸接口 75 | 76 | int m_ControlType; 77 | 78 | 79 | }; 80 | 81 | #endif // MAINWINDOW_H 82 | -------------------------------------------------------------------------------- /loginwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "loginwidget.h" 2 | #include "ui_loginwidget.h" 3 | /************************************** 4 | *@brief LoginWidget 登录构造函数 5 | *@param QWidget *parent父窗口指针 6 | *@return 无 7 | *@author 孔令辉 8 | *@date 2020-07-09 9 | *****************************************/ 10 | LoginWidget::LoginWidget(QWidget *parent) : 11 | QDialog(parent), 12 | ui(new Ui::LoginWidget) 13 | { 14 | ui->setupUi(this); 15 | m_UserName ="123"; 16 | m_PassWord = "123"; 17 | m_LoginInfo= LOGIN_ERROR; 18 | connect(this,SIGNAL(accepted()),this,SLOT(OnOKBtn())); 19 | connect(this,SIGNAL(rejected()),this,SLOT(OnCancelBtn())); 20 | } 21 | /************************************** 22 | *@brief GetLoginInfo获取登录信息 23 | *@param 无 24 | *@return int登录结果 25 | *@author 孔令辉 26 | *@date 2020-07-09 27 | *****************************************/ 28 | int LoginWidget::GetLoginInfo() 29 | { 30 | return m_LoginInfo; 31 | } 32 | /************************************** 33 | *@brief OnOKBtn 接受按钮相应函数 34 | *@param 无 35 | *@return 无 36 | *@author 孔令辉 37 | *@date 2020-07-09 38 | *****************************************/ 39 | void LoginWidget::OnOKBtn() 40 | { 41 | QString qstrUserName=ui->UserEdt->text(); 42 | QString qstrPassWord=ui->PassWordEdt->text(); 43 | if((qstrUserName==m_UserName)&&(qstrPassWord==m_PassWord)) 44 | { 45 | m_LoginInfo= LOGIN_SUCCEED; 46 | } 47 | else if((qstrUserName!=m_UserName)&&(qstrPassWord!=m_PassWord)) 48 | { 49 | m_LoginInfo= LOGIN_ERROR; 50 | } 51 | else if(qstrUserName!=m_UserName) 52 | { 53 | m_LoginInfo= LOGIN_ERROR_NAME; 54 | } 55 | else 56 | { 57 | m_LoginInfo= LOGIN_ERROR_PASSD; 58 | } 59 | } 60 | /************************************** 61 | *@brief OnCancelBtn 取消按钮相应函数 62 | *@param 无 63 | *@return 无 64 | *@author 孔令辉 65 | *@date 2020-07-09 66 | *****************************************/ 67 | void LoginWidget::OnCancelBtn() 68 | { 69 | //nothing to do 70 | } 71 | LoginWidget::~LoginWidget() 72 | { 73 | delete ui; 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /info.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | info 4 | 5 | 6 | 7 | 0 8 | 0 9 | 650 10 | 374 11 | 12 | 13 | 14 | 信息录入 15 | 16 | 17 | 18 | 19 | 20 20 | -30 21 | 171 22 | 241 23 | 24 | 25 | 26 | 27 | 28 | 姓名 29 | 30 | 学号 31 | 32 | 班级 33 | 34 | 学院 35 | 36 | 37 | 38 | 39 | 40 | 70 41 | 40 42 | 131 43 | 25 44 | 45 | 46 | 47 | 48 | 49 | 50 | 70 51 | 80 52 | 131 53 | 25 54 | 55 | 56 | 57 | 58 | 59 | 60 | 70 61 | 120 62 | 131 63 | 25 64 | 65 | 66 | 67 | 68 | 69 | 70 | 70 71 | 160 72 | 131 73 | 25 74 | 75 | 76 | 77 | 78 | 79 | 80 | 70 81 | 310 82 | 131 83 | 31 84 | 85 | 86 | 87 | 返回 88 | 89 | 90 | 91 | 92 | 93 | 340 94 | 10 95 | 301 96 | 331 97 | 98 | 99 | 100 | 101 | 102 | 103 | 70 104 | 250 105 | 131 106 | 31 107 | 108 | 109 | 110 | 确认提交 111 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /loginwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | LoginWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | 登陆 15 | 16 | 17 | 18 | 19 | 70 20 | 240 21 | 221 22 | 32 23 | 24 | 25 | 26 | Qt::Horizontal 27 | 28 | 29 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 30 | 31 | 32 | 33 | 34 | 35 | 50 36 | 40 37 | 81 38 | 31 39 | 40 | 41 | 42 | 用 户 名: 43 | 44 | 45 | 46 | 47 | 48 | 50 49 | 100 50 | 81 51 | 31 52 | 53 | 54 | 55 | 密 码: 56 | 57 | 58 | 59 | 60 | 61 | 130 62 | 45 63 | 201 64 | 31 65 | 66 | 67 | 68 | 69 | 70 | 71 | 130 72 | 98 73 | 201 74 | 31 75 | 76 | 77 | 78 | QLineEdit::Password 79 | 80 | 81 | 82 | 83 | 84 | 85 | buttonBox 86 | accepted() 87 | LoginWidget 88 | accept() 89 | 90 | 91 | 248 92 | 254 93 | 94 | 95 | 157 96 | 274 97 | 98 | 99 | 100 | 101 | buttonBox 102 | rejected() 103 | LoginWidget 104 | reject() 105 | 106 | 107 | 316 108 | 260 109 | 110 | 111 | 286 112 | 274 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /teacher.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | teacher 4 | 5 | 6 | 7 | 0 8 | 0 9 | 671 10 | 375 11 | 12 | 13 | 14 | 教师端 15 | 16 | 17 | 18 | 19 | 10 20 | 10 21 | 451 22 | 321 23 | 24 | 25 | 26 | 27 | 1 28 | 29 | 30 | 31 | 32 | 2 33 | 34 | 35 | 36 | 37 | 3 38 | 39 | 40 | 41 | 42 | 4 43 | 44 | 45 | 46 | 47 | 5 48 | 49 | 50 | 51 | 52 | 6 53 | 54 | 55 | 56 | 57 | 7 58 | 59 | 60 | 61 | 62 | 8 63 | 64 | 65 | 66 | 67 | 9 68 | 69 | 70 | 71 | 72 | 学号 73 | 74 | 75 | 76 | 77 | 姓名 78 | 79 | 80 | 81 | 82 | 班级 83 | 84 | 85 | 86 | 87 | 学院 88 | 89 | 90 | 91 | 92 | 93 | 94 | 480 95 | 10 96 | 160 97 | 291 98 | 99 | 100 | 101 | 102 | 103 | 104 | 增加学生信息 105 | 106 | 107 | 108 | 109 | 110 | 111 | 删除学生信息 112 | 113 | 114 | 115 | 116 | 117 | 118 | 刷新列表 119 | 120 | 121 | 122 | 123 | 124 | 125 | 返回 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /jasonqt_face.cpp: -------------------------------------------------------------------------------- 1 | #include "jasonqt_face.h" 2 | /************************************** 3 | *@brief 摘要 4 | *@param 无 5 | *@return 无 6 | *@author 翁飞龙 7 | *@date 2020-07-08 8 | *****************************************/ 9 | JasonQt_Face::JasonQt_Face(const QString &apiKey, const QString &secretKey): 10 | m_apiKey(apiKey),m_secretKey(secretKey),m_dThresholdValue(80.1)//默认为80分以上通过 11 | { 12 | 13 | } 14 | bool JasonQt_Face::RegisterMember(QString qstrImage,QString UserId)//人脸注册 15 | { 16 | QUrl url("https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/add?access_token="+m_token); 17 | QNetworkRequest request(url); 18 | QJsonObject append; 19 | m_UserId = UserId; 20 | request.setRawHeader("Content-Type", "aspplication/json"); 21 | append["face_token"] = m_token; 22 | append["image"] = qstrImage;//face dat 23 | append["image_type"] = "BASE64"; 24 | append["group_id"] = "Color";//member owner 25 | append["user_id"] =UserId; 26 | // append["quality_control"]="NORMAL"; 27 | QByteArray buf; 28 | m_http.post(request, QJsonDocument(append).toJson(), buf, 15000); 29 | QJsonObject acceptedData(QJsonDocument::fromJson(buf).object()); 30 | if(buf.isEmpty() || acceptedData.isEmpty() || !acceptedData.contains("result")) 31 | { 32 | return false; 33 | } 34 | else 35 | { 36 | return true; 37 | } 38 | } 39 | int JasonQt_Face::Identifyface(QString qstrImage)//人脸搜索 40 | { 41 | QUrl url("https://aip.baidubce.com/rest/2.0/face/v3/search?access_token="+m_token); 42 | QNetworkRequest request(url); 43 | QJsonObject append; 44 | request.setRawHeader("Content-Type", "aspplication/json"); 45 | append["image"] = qstrImage;//face dat 46 | append["image_type"]="BASE64"; 47 | append["group_id_list"] = "Color"; 48 | //append["quality_control"]="NORMAL"; 49 | QByteArray buf; 50 | m_http.post(request, QJsonDocument(append).toJson(), buf, 15000); 51 | QJsonObject acceptedData(QJsonDocument::fromJson(buf).object()); 52 | if(buf.isEmpty() || acceptedData.isEmpty() || !acceptedData.contains("result")) 53 | { 54 | return false; 55 | } 56 | QJsonObject result=acceptedData.take("result").toObject(); 57 | if(result.contains("user_list")) 58 | { 59 | QJsonArray user_list = result.take("user_list").toArray(); 60 | QJsonObject userObj = user_list.at(0).toObject(); 61 | double score = userObj["score"].toDouble(); 62 | QString user_id=userObj["user_id"].toString(); 63 | int tmp=user_id.toInt(); 64 | if(score>=m_dThresholdValue) 65 | return tmp; 66 | else 67 | return false; 68 | } 69 | return false; 70 | } 71 | bool JasonQt_Face::refreshToken(void)//自动获取token 72 | { 73 | QNetworkRequest request(QUrl(QString("https://aip.baidubce.com/oauth/2.0/token?"))); 74 | QByteArray append = QString("grant_type=client_credentials&client_id=%1&client_secret=%2").arg(m_apiKey).arg(m_secretKey).toUtf8(); 75 | QByteArray buf; 76 | 77 | request.setRawHeader("Content-Type", "application/json"); 78 | //超时为15000ms 79 | const auto &&flag = m_http.post(request, append, buf, 15000); 80 | if(!flag) { return false; } 81 | 82 | const auto &&data = QJsonDocument::fromJson(buf).object(); 83 | if(data.isEmpty() || !data.contains("access_token")) { return false; } 84 | 85 | m_token = data["access_token"].toString(); 86 | return true; 87 | } 88 | -------------------------------------------------------------------------------- /info.cpp: -------------------------------------------------------------------------------- 1 | #include "info.h" 2 | #include "ui_info.h" 3 | #include"mainwindow.h" 4 | info::info(QWidget *parent) : 5 | QWidget(parent), 6 | ui(new Ui::info) 7 | { 8 | ui->setupUi(this); 9 | ui->school->setPlaceholderText("请输入学院全称"); 10 | ui->class_2->setPlaceholderText("例:计算机1702"); 11 | ui->number->setPlaceholderText("请输入学号"); 12 | ui->name->setPlaceholderText("请输入姓名"); 13 | //ui->photo->setPlaceholderText("请选择头像"); 14 | //ui->photo->setReadOnly(false); 15 | // ui->photo->setEnabled(false); 16 | 17 | } 18 | 19 | info::~info() 20 | { 21 | delete ui; 22 | } 23 | 24 | void info::on_exit_clicked() 25 | { 26 | this->hide(); 27 | emit mysig(); 28 | } 29 | 30 | void info::on_ok_clicked() 31 | { 32 | 33 | 34 | //建立并打开数据库 35 | QSqlDatabase database; 36 | if (QSqlDatabase::contains("qt_sql_default_connection")) 37 | { 38 | database = QSqlDatabase::database("qt_sql_default_connection"); 39 | } 40 | else 41 | { 42 | database = QSqlDatabase::addDatabase("QSQLITE"); 43 | database.setDatabaseName("MyDataBase.db"); 44 | database.setUserName("123456"); 45 | database.setPassword("123456"); 46 | } 47 | 48 | if (!database.open()) 49 | { 50 | qDebug() << "Error: Failed to connect database..." << database.lastError(); 51 | ui->listWidget->addItem(tr("Error: Failed to connect database...")); 52 | 53 | } 54 | else 55 | { 56 | qDebug() << "Succeed to connect database..." ; 57 | ui->listWidget->addItem(tr("Succeed to connect database...")); 58 | 59 | } 60 | 61 | //创建表格 62 | QSqlQuery sql_query; 63 | 64 | 65 | if(!sql_query.exec("create table IF NOT EXISTS student(id int primary key, name varchar(20), class_2 int, school varchar(20),time Text)")) 66 | { 67 | qDebug() << "Error: Fail to create table."<< sql_query.lastError(); 68 | ui->listWidget->addItem(tr("Error: Fail to create student table.")); 69 | } 70 | else 71 | { 72 | qDebug() << "student Table created!"; 73 | ui->listWidget->addItem(tr("student Table created Success!")); 74 | } 75 | 76 | QDateTime time = QDateTime::currentDateTime(); 77 | QString str = time.toString("yyyy-MM-dd hh:mm"); 78 | QString arg[5]={ui->number->text(),ui->name->text(),ui->class_2->text(),ui->school->text(),str}; 79 | 80 | QSqlQuery query; 81 | QString sql = QString("insert into student values ('%1','%2','%3','%4','%5')").arg(arg[0]).arg(arg[1]).arg(arg[2]).arg(arg[3]).arg(arg[4]); 82 | 83 | query.prepare(sql); 84 | if(!query.exec(sql)){ 85 | qDebug() << "Database inserted Failed!"<< sql_query.lastError(); 86 | ui->listWidget->addItem(tr("Database inserted Failed!")); 87 | 88 | database.close(); 89 | 90 | } 91 | else{ 92 | qDebug() << "Database inserted successfully!"; 93 | ui->listWidget->addItem(tr("Database inserted successfully")); 94 | database.close(); 95 | 96 | } 97 | } 98 | 99 | 100 | 101 | /*void info::on_pushButton_clicked() 102 | { 103 | QString s = QFileDialog::getOpenFileName(this,"选择文件","/", "Files(*.png *jpg)"); 104 | ui->photo->setText(s); 105 | }*/ 106 | -------------------------------------------------------------------------------- /teacher.cpp: -------------------------------------------------------------------------------- 1 | #include "teacher.h" 2 | #include "ui_teacher.h" 3 | #include "mainwindow.h" 4 | 5 | teacher::teacher(QWidget *parent) : 6 | QWidget(parent), 7 | ui(new Ui::teacher) 8 | { 9 | ui->setupUi(this); 10 | ma = new info(); 11 | connect(ma,SIGNAL(mysig()),this,SLOT(show())); 12 | 13 | } 14 | 15 | teacher::~teacher() 16 | { 17 | delete ui; 18 | } 19 | 20 | 21 | void teacher::on_return_2_clicked() 22 | { 23 | this->hide(); 24 | emit mysig(); 25 | } 26 | 27 | void teacher::on_addinfo_clicked() 28 | { 29 | this->hide(); 30 | ma->show(); 31 | } 32 | 33 | void teacher::on_delinfo_clicked() 34 | { 35 | bool ok; 36 | QString text = QInputDialog::getText(this, tr("User_Id"),tr("请输入学号"), QLineEdit::Password,0, &ok); 37 | 38 | if(text.isEmpty()){ 39 | QMessageBox::information(NULL, "错误", "请输入正确的学号!", 40 | QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); 41 | } 42 | //text = QInputDialog::getText(this, tr("User_Id"),tr("请输入学号"), QLineEdit::Password,0, &ok); 43 | 44 | 45 | QSqlDatabase database; 46 | if (QSqlDatabase::contains("qt_sql_default_connection")) 47 | { 48 | database = QSqlDatabase::database("qt_sql_default_connection"); 49 | } 50 | else 51 | { 52 | database = QSqlDatabase::addDatabase("QSQLITE"); 53 | database.setDatabaseName("MyDataBase.db"); 54 | database.setUserName("123456"); 55 | database.setPassword("123456"); 56 | } 57 | 58 | if (!database.open()) 59 | { 60 | qDebug() << "Error: Failed to connect database..." << database.lastError(); 61 | 62 | } 63 | else 64 | { 65 | qDebug() << "Succeed to connect database..." ; 66 | 67 | } 68 | QSqlQuery query; 69 | QString sql = QString("DELETE FROM student WHERE id = '%1'").arg(text); 70 | query.prepare( sql); 71 | if( !query.exec() ) 72 | qDebug() << "删除数据失败!"<< query.lastError(); 73 | else 74 | qDebug( "Deleted Success!" ); 75 | database.close(); 76 | } 77 | 78 | void teacher::on_reflash_clicked() 79 | { 80 | for(int cow=0;cow<40;cow++){ 81 | for(int row=0;row<4;row++){ 82 | ui->student->setItem(cow,row,new QTableWidgetItem(nullptr)); 83 | } 84 | } 85 | 86 | //打开数据库 87 | QSqlDatabase database; 88 | if (QSqlDatabase::contains("qt_sql_default_connection")) 89 | { 90 | database = QSqlDatabase::database("qt_sql_default_connection"); 91 | } 92 | else 93 | { 94 | database = QSqlDatabase::addDatabase("QSQLITE"); 95 | database.setDatabaseName("MyDataBase.db"); 96 | database.setUserName("123456"); 97 | database.setPassword("123456"); 98 | } 99 | 100 | if (!database.open()) 101 | { 102 | qDebug() << "Error: Failed to connect database..." << database.lastError(); 103 | 104 | } 105 | else 106 | { 107 | qDebug() << "Succeed to connect database..." ; 108 | 109 | } 110 | QSqlQuery query; 111 | QString sql = QString("SELECT * FROM student "); 112 | query.exec(sql); 113 | ui->student->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); 114 | ui->student->setSelectionBehavior(QAbstractItemView::SelectRows); 115 | ui->student->setEditTriggers(QAbstractItemView::NoEditTriggers); 116 | int cow=0; 117 | while(query.next()){ 118 | for(int row=0;row<4;row++){ 119 | ui->student->setItem(cow,row,new QTableWidgetItem(query.value(row).toString())); 120 | } 121 | cow++; 122 | } 123 | database.close(); 124 | } 125 | -------------------------------------------------------------------------------- /kaoqin.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kaoqin 4 | 5 | 6 | 7 | 0 8 | 0 9 | 720 10 | 445 11 | 12 | 13 | 14 | 考勤记录 15 | 16 | 17 | image: url(:/p/4.jpg); 18 | 19 | 20 | 21 | 22 | 0 23 | 0 24 | 721 25 | 391 26 | 27 | 28 | 29 | 30 | 1 31 | 32 | 33 | 34 | 35 | 2 36 | 37 | 38 | 39 | 40 | 3 41 | 42 | 43 | 44 | 45 | 4 46 | 47 | 48 | 49 | 50 | 5 51 | 52 | 53 | 54 | 55 | 6 56 | 57 | 58 | 59 | 60 | 7 61 | 62 | 63 | 64 | 65 | 8 66 | 67 | 68 | 69 | 70 | 9 71 | 72 | 73 | 74 | 75 | 10 76 | 77 | 78 | 79 | 80 | 11 81 | 82 | 83 | 84 | 85 | 12 86 | 87 | 88 | 89 | 90 | 13 91 | 92 | 93 | 94 | 95 | 14 96 | 97 | 98 | 99 | 100 | 15 101 | 102 | 103 | 104 | 105 | 16 106 | 107 | 108 | 109 | 110 | 17 111 | 112 | 113 | 114 | 115 | 18 116 | 117 | 118 | 119 | 120 | 20 121 | 122 | 123 | 124 | 125 | 学号 126 | 127 | 128 | 129 | 130 | 姓名 131 | 132 | 133 | 134 | 135 | 班级 136 | 137 | 138 | 139 | 140 | 学院 141 | 142 | 143 | 144 | 145 | 打卡时间 146 | 147 | 148 | 149 | 150 | 151 | 152 | 610 153 | 400 154 | 99 155 | 27 156 | 157 | 158 | 159 | 返回 160 | 161 | 162 | 163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FaceSignSystem 2 | 本项目为实习期间做的一款基于百度AI的QT人脸考勤打卡系统 3 | 4 | 欢迎访问个人博客:https://www.ikunl.com 5 | 6 | 项目地址:https://www.ikunl.com/2.html 7 | 8 | FaceSignSystem 9 | 10 | 本项目为本人做的一款基于百度AI的人脸识别考勤打卡系统,作者某双非二本院校,写于2020/09/04。 11 | 12 | 作者 翁飞龙 13 | QQ交流群 692695467(点击跳转) 14 | 博客地址 https://www.ikunl.com 15 | 源码地址 Github 码云 16 | 使用环境 17 | 支持C++编译器的QT5,Sqlite数据库,本项目在Ubuntu20.04系统下制作完成 18 | 19 | 准备材料 20 | 1、QT5 C/C++ 21 | 2、Sqlite数据库 22 | 3、一台自带摄像头的电脑或者Linux单片机 23 | 百度AI接入 24 | 接入步骤 25 | 26 | 1、注册百度账号,用来登录百度AI开发平台(https://ai.baidu.com/),有账号的可以直接登录 27 | 2、注册成为开发者 28 | 3、创建应用,应用创建成功之后也就开通了人脸检测、人脸比对等等相关业务 29 | 4、获取密钥,AppID、API Key和Secret key 30 | 5、生成签名(Access Token),这个写代码的时候要用到,每个应用的Access Token有效期为30天,到期后要重新获取,或者是在写代码时每次都获取一下 31 | 百度AI开放平台上有详细的接入指南:https://ai.baidu.com/docs#/Begin/top 32 | 33 | 一、项目结构 34 | 35 | 36 | 二、核心源码 37 | 1.网络编程 38 | 39 | 这里使用了QtNetwork模块中的网络接口来实现http编程,需要在.pro文件中添加 QT += network,主要用到了下面三个类: 40 | 41 | 1、QNetworkAccessManager:该类允许应用程序发送网络请求和接收回复,类似于一个中转站或者一个容器,每当有请求创建或者接收到回复都由该类进行调度 42 | 43 | 2、QNetworkRequest:网络请求 44 | 45 | 3、QNetworkReply:网络请求的应答,在请求被完成调度是由QNetworkAccessManager创建 46 | 47 | get、put、post请求方式的区别 48 | 49 | 1、GET请求(类似于数据库select操作),会向数据库发送数据的请求,从而来获取信息,不会改变数据内容,并且无论进行多少次操作,结果都是一样的 50 | 51 | 2、PUT请求(类似于数据库update操作),是会向服务器端发送数据的,会修改数据的内容,但是不会增加数据的种类,并且无论进行多少次操作,结果都是一样的 52 | 53 | 3、POST请求(类似于数据库insert操作),是会向服务器端发送数据的,但是该请求会改变数据的种类等资源,会创建新的内容 54 | 55 | POST 提交数据方式 56 | 57 | application/x-www-form-urlencoded 58 | multipart/form-data 59 | application/json 60 | text/xml 61 | 62 | 百度AI使用application/json方式提交数据 63 | 64 | 2.获取Token 65 | 向授权服务地址https://aip.baidubce.com/oauth/2.0/token发送请求(推荐使用POST),并在URL中带上以下参数: 66 | 67 | grant_type: 必须参数,固定为client_credentials; 68 | client_id: 必须参数,应用的API Key; 69 | client_secret: 必须参数,应用的Secret Key; 70 | 71 | 自动获取Token 72 | 73 | bool JasonQt_Face::refreshToken(void)//自动获取token 74 | { 75 | QNetworkRequest request(QUrl(QString("https://aip.baidubce.com/oauth/2.0/token?")));//api接口 76 | QByteArray append = QString("grant_type=client_credentials&client_id=%1&client_secret=%2").arg(m_apiKey).arg(m_secretKey).toUtf8(); 77 | QByteArray buf; 78 | 79 | request.setRawHeader("Content-Type", "application/json"); 80 | //超时为15000ms 81 | const auto &&flag = m_http.post(request, append, buf, 15000); 82 | if(!flag) { return false; } 83 | 84 | const auto &&data = QJsonDocument::fromJson(buf).object(); 85 | if(data.isEmpty() || !data.contains("access_token")) { return false; } 86 | 87 | m_token = data["access_token"].toString(); 88 | return true; 89 | } 90 | 91 | 3.图片Base64编码 92 | 1、提取图片 93 | 2、数据转换为BASE64编码 94 | 实现代码 95 | 96 | QByteArray ba; 97 | QBuffer buf(&ba); 98 | image.save(&buf, "png"); 99 | QString imgData = QString(ba.toBase64()); 100 | buf.close(); 101 | 全选代码复制 102 | 4.JSON数据解析 103 | 数据上传 104 | 105 | bool JasonQt_Face::RegisterMember(QString qstrImage,QString UserId)//人脸注册 106 | { 107 | //设置请求地址 108 | QUrl url("https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/add?access_token="+m_token); 109 | QNetworkRequest request(url); 110 | QJsonObject append; 111 | m_UserId = UserId; 112 | //设置数据提交格式 113 | request.setRawHeader("Content-Type", "aspplication/json"); 114 | append["face_token"] = m_token; 115 | append["image"] = qstrImage;//face dat 116 | append["image_type"] = "BASE64"; 117 | append["group_id"] = "Color";//member owner 118 | append["user_id"] =UserId; 119 | // append["quality_control"]="NORMAL"; 120 | QByteArray buf; 121 | //发送请求 122 | m_http.post(request, QJsonDocument(append).toJson(), buf, 15000); 123 | QJsonObject acceptedData(QJsonDocument::fromJson(buf).object()); 124 | if(buf.isEmpty() || acceptedData.isEmpty() || !acceptedData.contains("result")) 125 | { 126 | return false; 127 | } 128 | else 129 | { 130 | return true; 131 | } 132 | } 133 | 134 | 人脸库搜索 135 | 136 | QUrl url("https://aip.baidubce.com/rest/2.0/face/v3/search?access_token="+m_token); 137 | QNetworkRequest request(url); 138 | QJsonObject append; 139 | request.setRawHeader("Content-Type", "aspplication/json"); 140 | append["image"] = qstrImage;//face dat 141 | append["image_type"]="BASE64"; 142 | append["group_id_list"] = "Color"; 143 | //append["quality_control"]="NORMAL"; 144 | QByteArray buf; 145 | m_http.post(request, QJsonDocument(append).toJson(), buf, 15000); 146 | QJsonObject acceptedData(QJsonDocument::fromJson(buf).object()); 147 | if(buf.isEmpty() || acceptedData.isEmpty() || !acceptedData.contains("result")) 148 | { 149 | return false; 150 | } 151 | 152 | 数据解析 153 | 154 | QJsonObject result=acceptedData.take("result").toObject(); 155 | if(result.contains("user_list")) 156 | { 157 | QJsonArray user_list = result.take("user_list").toArray(); 158 | QJsonObject userObj = user_list.at(0).toObject(); 159 | double score = userObj["score"].toDouble(); 160 | QString user_id=userObj["user_id"].toString(); 161 | int tmp=user_id.toInt(); 162 | if(score>=m_dThresholdValue) 163 | return tmp; 164 | else 165 | return false; 166 | } 167 | return false; 168 | 169 | 170 | 三、运行效果展示 171 | 见:https://www.ikunl.com/2.html 172 | -------------------------------------------------------------------------------- /mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 810 10 | 568 11 | 12 | 13 | 14 | 人脸识别考勤系统 15 | 16 | 17 | #MainWindow{border-image: url(:/4.jpg);} 18 | 19 | 20 | 21 | 22 | 23 | 24 | 50 25 | 110 26 | 171 27 | 291 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 姓名 41 | 42 | 学号 43 | 44 | 班级 45 | 46 | 学院 47 | 48 | 49 | 50 | 51 | 52 | 160 53 | 440 54 | 99 55 | 27 56 | 57 | 58 | 59 | 考勤记录 60 | 61 | 62 | 63 | 64 | 65 | 330 66 | 440 67 | 99 68 | 27 69 | 70 | 71 | 72 | 教师登录 73 | 74 | 75 | 76 | 77 | 78 | 510 79 | 440 80 | 99 81 | 27 82 | 83 | 84 | 85 | 退出 86 | 87 | 88 | 89 | 90 | 91 | 650 92 | 180 93 | 99 94 | 31 95 | 96 | 97 | 98 | 打开摄像头 99 | 100 | 101 | 102 | 103 | 104 | 650 105 | 290 106 | 99 107 | 27 108 | 109 | 110 | 111 | 确认打卡 112 | 113 | 114 | 115 | 116 | 117 | 260 118 | 50 119 | 361 120 | 251 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 110 129 | 260 130 | 113 131 | 27 132 | 133 | 134 | 135 | 136 | 137 | 138 | 110 139 | 300 140 | 113 141 | 27 142 | 143 | 144 | 145 | 146 | 147 | 148 | 110 149 | 340 150 | 113 151 | 27 152 | 153 | 154 | 155 | 156 | 157 | 158 | 110 159 | 380 160 | 113 161 | 27 162 | 163 | 164 | 165 | 166 | 167 | 168 | 576 169 | 20 170 | 201 171 | 20 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 650 182 | 70 183 | 101 184 | 31 185 | 186 | 187 | 188 | 学生信息录入 189 | 190 | 191 | 192 | 193 | 194 | 30 195 | 10 196 | 341 197 | 31 198 | 199 | 200 | 201 | 欢迎使用人脸识别考勤系统 202 | 203 | 204 | 205 | 206 | 207 | 30 208 | 120 209 | 211 210 | 25 211 | 212 | 213 | 214 | 215 | 216 | 217 | 100 218 | 80 219 | 67 220 | 17 221 | 222 | 223 | 224 | 打卡时间 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | TopToolBarArea 234 | 235 | 236 | false 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | -------------------------------------------------------------------------------- /JasonQt_Net.cpp: -------------------------------------------------------------------------------- 1 | #include "JasonQt_Net.h" 2 | 3 | using namespace JasonQt_Net; 4 | /************************************** 5 | *@brief getNetworkAddressEntry 6 | *@param 无 7 | *@return QNetworkAddressEntry NetWork 8 | *@author 翁飞龙 9 | *@date 2020-07-09 10 | *****************************************/ 11 | QNetworkAddressEntry JasonQt_Net::getNetworkAddressEntry(void) 12 | { 13 | auto allInterfaces = QNetworkInterface::allInterfaces(); 14 | 15 | // Scan en0 16 | for(const auto &interface: allInterfaces) 17 | { 18 | if(interface.name().indexOf("en0") != -1) 19 | { 20 | for(const auto &entry: interface.addressEntries()) 21 | { 22 | if(entry.ip().toIPv4Address()) 23 | { 24 | return entry; 25 | } 26 | } 27 | } 28 | } 29 | 30 | // Scan other 31 | for(const auto &interface: allInterfaces) 32 | { 33 | for(const auto &entry: interface.addressEntries()) 34 | { 35 | if(entry.ip().toIPv4Address()) 36 | { 37 | if(entry.ip().toString().indexOf("10.0.") == 0) 38 | { 39 | return entry; 40 | } 41 | else if(entry.ip().toString().indexOf("192.168.") == 0) 42 | { 43 | return entry; 44 | } 45 | } 46 | } 47 | } 48 | 49 | return QNetworkAddressEntry(); 50 | } 51 | /************************************** 52 | *@brief getDeviceName 获取本地Host 53 | *@param 无 54 | *@return QString 返回本地host 55 | *@author 翁飞龙 56 | *@date 2020-07-09 57 | *****************************************/ 58 | QString JasonQt_Net::getDeviceName(void) 59 | { 60 | #ifdef Q_OS_MAC 61 | return QHostInfo::localHostName().replace(".local", ""); 62 | #endif 63 | return QHostInfo::localHostName(); 64 | } 65 | /************************************** 66 | *@brief HTTP构造函数 67 | *@param 无 68 | *@return 无 69 | *@author 翁飞龙 70 | *@date 2020-07-09 71 | *****************************************/ 72 | // HTTP 73 | HTTP::HTTP(void) 74 | { 75 | connect(&m_manage, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*))); 76 | connect(&m_timer, SIGNAL(timeout()), this, SLOT(onTimeout())); 77 | 78 | m_timer.setSingleShot(true); 79 | } 80 | /************************************** 81 | *@brief get 82 | *@param const QUrl &url url地址, const int &maxTime最大超时时间 83 | *@return 无 84 | *@author 翁飞龙 85 | *@date 2020-07-09 86 | *****************************************/ 87 | void HTTP::get(const QUrl &url, const int &maxTime) 88 | { 89 | if(m_reply) 90 | { 91 | this->stop(); 92 | } 93 | 94 | m_reply = m_manage.get(QNetworkRequest(url)); 95 | connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onError(QNetworkReply::NetworkError))); 96 | 97 | if(m_timer.isActive()) 98 | { 99 | m_timer.stop(); 100 | } 101 | m_timer.start(maxTime); 102 | } 103 | /************************************** 104 | *@brief 网络post 105 | *@param const QNetworkRequest &networkRequest网络请求引用, 106 | * const QByteArray &append, 字符 107 | * const int &maxTime 最大超时时间 108 | *@return 无 109 | *@author 翁飞龙 110 | *@date 2020-07-09 111 | *****************************************/ 112 | void HTTP::post(const QNetworkRequest &networkRequest, const QByteArray &append, const int &maxTime) 113 | { 114 | if(m_reply) 115 | { 116 | this->stop(); 117 | } 118 | 119 | m_reply = m_manage.post(networkRequest, append); 120 | connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onError(QNetworkReply::NetworkError))); 121 | 122 | if(m_timer.isActive()) 123 | { 124 | m_timer.stop(); 125 | } 126 | m_timer.start(maxTime); 127 | } 128 | /************************************** 129 | *@brief stop 130 | *@param 无 131 | *@return 无 132 | *@author 翁飞龙 133 | *@date 2020-07-09 134 | *****************************************/ 135 | void HTTP::stop(void) 136 | { 137 | if(m_reply) 138 | { 139 | disconnect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onError(QNetworkReply::NetworkError))); 140 | m_reply = nullptr; 141 | } 142 | 143 | if(m_timer.isActive()) 144 | { 145 | m_timer.stop(); 146 | } 147 | } 148 | /************************************** 149 | *@brief get获取http 150 | *@param const QUrl &url, QByteArray &target, const int &maxTime 151 | *@return bool 1表示成功,0表示失败 152 | *@author 翁飞龙 153 | *@date 2020-07-09 154 | *****************************************/ 155 | bool HTTP::get(const QUrl &url, QByteArray &target, const int &maxTime) 156 | { 157 | QEventLoop eventLoop; 158 | 159 | connect(this, &HTTP::finished, [&](const QByteArray &data) 160 | { 161 | target = data; 162 | 163 | eventLoop.exit(1); 164 | }); 165 | connect(this, &HTTP::error, [&]() 166 | { 167 | eventLoop.exit(0); 168 | }); 169 | 170 | this->get(url, maxTime); 171 | 172 | return eventLoop.exec(); 173 | } 174 | /************************************** 175 | *@brief get获取http 176 | *@param const QNetworkRequest &networkRequest, const QByteArray &append, QByteArray &target, const int &maxTime 177 | *@return bool 1表示成功,0表示失败 178 | *@author 翁飞龙 179 | *@date 2020-07-09 180 | *****************************************/ 181 | bool HTTP::post(const QNetworkRequest &networkRequest, const QByteArray &append, QByteArray &target, const int &maxTime) 182 | { 183 | QEventLoop eventLoop; 184 | 185 | auto c1 = connect(this, &HTTP::finished, [&](const QByteArray &data) 186 | { 187 | target = data; 188 | 189 | eventLoop.exit(1); 190 | }); 191 | auto c2 = connect(this, &HTTP::error, [&]() 192 | { 193 | eventLoop.exit(0); 194 | }); 195 | 196 | this->post(networkRequest, append, maxTime); 197 | 198 | const auto &&flag = eventLoop.exec(); 199 | 200 | disconnect(c1); 201 | disconnect(c2); 202 | 203 | return flag; 204 | } 205 | /************************************** 206 | *@brief onFinished 完成槽函数 207 | *@param const QNetworkRequest &networkRequest, const QByteArray &append, QByteArray &target, const int &maxTime 208 | *@return bool 1表示成功,0表示失败 209 | *@author 翁飞龙 210 | *@date 2020-07-09 211 | *****************************************/ 212 | void HTTP::onFinished(QNetworkReply *reply) 213 | { 214 | if(m_reply == reply) 215 | { 216 | if(m_reply->error() != QNetworkReply::NoError) 217 | { 218 | emit error(m_reply->error()); 219 | } 220 | else 221 | { 222 | emit finished(m_reply->readAll()); 223 | } 224 | 225 | this->stop(); 226 | } 227 | } 228 | /************************************** 229 | *@brief onTimeout超时相应函数 230 | *@param 无 231 | *@return 无 232 | *@author 翁飞龙 233 | *@date 2020-07-09 234 | *****************************************/ 235 | void HTTP::onTimeout(void) 236 | { 237 | if(m_reply) 238 | { 239 | this->stop(); 240 | emit error(QNetworkReply::TimeoutError); 241 | } 242 | } 243 | /************************************** 244 | *@brief onError错误响应函数 245 | *@param const QNetworkReply::NetworkError &error_网络错误信息 246 | *@return 无 247 | *@author 翁飞龙 248 | *@date 2020-07-09 249 | *****************************************/ 250 | void HTTP::onError(const QNetworkReply::NetworkError &error_) 251 | { 252 | if(m_reply) 253 | { 254 | this->stop(); 255 | emit error(error_); 256 | } 257 | } 258 | -------------------------------------------------------------------------------- /mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | static int tmp=0; 4 | MainWindow::MainWindow(QWidget *parent) : 5 | QMainWindow(parent), 6 | ui(new Ui::MainWindow) 7 | { 8 | ui->setupUi(this); 9 | mf = new Kaoqin(); 10 | mff = new teacher(); 11 | ma = new info(); 12 | connect(mf,SIGNAL(mysig()),this,SLOT(show())); 13 | connect(mff,SIGNAL(mysig()),this,SLOT(show())); 14 | connect(ma,SIGNAL(mysig()),this,SLOT(show())); 15 | m_BaiduFace = new JasonQt_Face("qqnMw0WtZXAagB5F0Bojcecq", "zmr2zGUURpWFYHexS4LMIoDGoH0BuLqp"); 16 | m_BaiduFace->refreshToken(); 17 | m_camera = new QCamera(this);//系统摄像头设备 18 | m_cameraViewFinder = new QCameraViewfinder(this);//摄像头取景器部件 19 | m_cameraImageCapture = new QCameraImageCapture(m_camera);//截图部件 20 | ui->tupian->addWidget(m_cameraViewFinder); 21 | connect(m_cameraImageCapture,SIGNAL(imageCaptured(int,QImage)),this,SLOT(cameraImageCaptured(int,QImage))); 22 | m_cameraImageCapture->setCaptureDestination(QCameraImageCapture::CaptureToFile); 23 | m_camera->setCaptureMode(QCamera::CaptureStillImage); 24 | m_camera->setViewfinder(m_cameraViewFinder); 25 | m_camera->start();//启动摄像头 26 | m_ControlType = LOGIN_TYPE; 27 | QTimer *timer = new QTimer(this); 28 | connect(timer,SIGNAL(timeout()),this,SLOT(timerUpdate())); 29 | timer->start(1000); 30 | 31 | } 32 | 33 | MainWindow::~MainWindow() 34 | { 35 | delete ui; 36 | } 37 | int MainWindow::cameraImageCaptured(int index, QImage image) 38 | { 39 | if(index>=0) 40 | { 41 | QByteArray ba; 42 | QBuffer buf(&ba); 43 | image.save(&buf, "png"); 44 | QString imgData = QString(ba.toBase64()); 45 | buf.close(); 46 | if (m_ControlType==REGISTER_TYPE) //注册人脸的情况 47 | { 48 | //QDateTime time = QDateTime::currentDateTime();//获取系统现在的时间 49 | // QString str = time.toString("yyyyMMddhhmmss"); //设置显示格式 50 | bool ok; 51 | QString text = QInputDialog::getText(this, tr("User_Id"),tr("请输入学号"), QLineEdit::Password,0, &ok); 52 | while(text.isEmpty()) 53 | { 54 | QMessageBox::information(NULL, "错误", "请输入正确的学号!", 55 | QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); 56 | text = QInputDialog::getText(this, tr("User_Id"),tr("请输入学号"), QLineEdit::Password,0, &ok); 57 | 58 | } 59 | if(m_BaiduFace->RegisterMember(imgData, text)) 60 | { 61 | qDebug() << "人脸信息录入成功"; 62 | QMessageBox::information(NULL, "完成", "您的人脸信息已经录入!请录入其他信息!", 63 | QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); 64 | 65 | this->hide(); 66 | ma->show(); 67 | 68 | } 69 | else 70 | { 71 | qDebug() << "人脸信息录入失败"; 72 | QMessageBox::information(NULL, "错误", "请检查您的网络或与管理员联系!", 73 | QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); 74 | 75 | 76 | } 77 | 78 | } 79 | else if(m_ControlType==LOGIN_TYPE) 80 | { 81 | int success = m_BaiduFace->Identifyface(imgData); 82 | tmp=success; 83 | if (!success) 84 | { 85 | qDebug() << "比对失败"; 86 | QMessageBox::information(NULL, "错误", "打卡失败,人脸信息不匹配或人脸库中查无此人,请重新打卡!", 87 | QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); 88 | 89 | 90 | } 91 | else 92 | { 93 | 94 | //打开数据库 95 | QSqlDatabase database; 96 | if (QSqlDatabase::contains("qt_sql_default_connection")) 97 | { 98 | database = QSqlDatabase::database("qt_sql_default_connection"); 99 | } 100 | else 101 | { 102 | database = QSqlDatabase::addDatabase("QSQLITE"); 103 | database.setDatabaseName("MyDataBase.db"); 104 | database.setUserName("123456"); 105 | database.setPassword("123456"); 106 | } 107 | 108 | if (!database.open()) 109 | { 110 | qDebug() << "Error: Failed to connect database..." << database.lastError(); 111 | 112 | } 113 | else 114 | { 115 | qDebug() << "Succeed to connect database..." ; 116 | 117 | } 118 | QSqlQuery query; 119 | QString sql = QString("SELECT * FROM student WHERE id='%1'").arg(success); 120 | query.exec(sql); 121 | while(query.next()) 122 | { 123 | QString id = query.value(0).toString(); 124 | QString name = query.value(1).toString(); 125 | QString class_2 = query.value(2).toString(); 126 | QString school = query.value(3).toString(); 127 | QString time = query.value(4).toString(); 128 | qDebug()<number->setText(id); 130 | ui->name->setText(name); 131 | ui->class_2->setText(class_2); 132 | ui->school->setText(school); 133 | ui->time->setText(time); 134 | } 135 | qDebug() << "比对成功"; 136 | QMessageBox::information(NULL, "完成", "打卡成功!", 137 | QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); 138 | 139 | database.close(); 140 | m_camera->stop(); 141 | } 142 | } 143 | } 144 | } 145 | 146 | void MainWindow::on_sure_clicked() 147 | { 148 | QSqlDatabase database; 149 | if (QSqlDatabase::contains("qt_sql_default_connection")) 150 | { 151 | database = QSqlDatabase::database("qt_sql_default_connection"); 152 | } 153 | else 154 | { 155 | database = QSqlDatabase::addDatabase("QSQLITE"); 156 | database.setDatabaseName("MyDataBase.db"); 157 | database.setUserName("123456"); 158 | database.setPassword("123456"); 159 | } 160 | 161 | if (!database.open()) 162 | { 163 | qDebug() << "Error: Failed to connect database..." << database.lastError(); 164 | 165 | } 166 | else 167 | { 168 | qDebug() << "Succeed to connect database..." ; 169 | 170 | } 171 | QDateTime time = QDateTime::currentDateTime(); 172 | QString str = time.toString("yyyy-MM-dd hh:mm"); 173 | QSqlQuery query; 174 | QString sql = QString( "UPDATE student SET time = '%1' WHERE id = '%2'" ).arg(str).arg(tmp); 175 | query.prepare(sql); 176 | if( !query.exec() ) 177 | qDebug() << "打卡时间更新失败!"<capture(); 183 | qDebug() << "正在进行人脸比对."; 184 | } 185 | 186 | void MainWindow::on_pushButton_clicked() 187 | { 188 | m_ControlType=REGISTER_TYPE; 189 | m_cameraImageCapture->capture(); 190 | //开始注册人脸信息 191 | qDebug() << "开始注册人脸信息库!."; 192 | } 193 | void MainWindow::on_kaoqin_clicked() 194 | { 195 | this->hide(); 196 | mf->show(); 197 | } 198 | 199 | void MainWindow::on_teacher_clicked() 200 | { 201 | this->hide(); 202 | login = new LoginWidget(nullptr); 203 | login->exec(); 204 | int result = login->GetLoginInfo(); 205 | while(result!=LOGIN_SUCCEED){ 206 | QMessageBox::information(NULL, "错误", "管理员密码错误,请重新输入", 207 | QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); 208 | login->exec(); 209 | result = login->GetLoginInfo(); 210 | } 211 | mff->show(); 212 | } 213 | 214 | void MainWindow::on_open_clicked() 215 | { 216 | m_camera = new QCamera(this);//系统摄像头设备 217 | m_cameraViewFinder = new QCameraViewfinder(this);//摄像头取景器部件 218 | m_cameraImageCapture = new QCameraImageCapture(m_camera);//截图部件 219 | ui->tupian->addWidget(m_cameraViewFinder); 220 | connect(m_cameraImageCapture,SIGNAL(imageCaptured(int,QImage)),this,SLOT(cameraImageCaptured(int,QImage))); 221 | m_cameraImageCapture->setCaptureDestination(QCameraImageCapture::CaptureToFile); 222 | m_camera->setCaptureMode(QCamera::CaptureStillImage); 223 | m_camera->setViewfinder(m_cameraViewFinder); 224 | m_camera->start();//启动摄像头 225 | m_ControlType = LOGIN_TYPE; 226 | 227 | } 228 | 229 | 230 | 231 | void MainWindow::on_quit_clicked() 232 | { 233 | this->close(); 234 | 235 | } 236 | 237 | void MainWindow::timerUpdate() 238 | { 239 | QDateTime time = QDateTime::currentDateTime(); 240 | QString str = time.toString("yyyy-MM-dd hh:mm:ss dddd"); 241 | ui->datalable->setText(str); 242 | } 243 | 244 | -------------------------------------------------------------------------------- /RLSB.pro.user.070ba77.4.8-pre1: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EnvironmentId 7 | {070ba777-6c33-4b47-a638-7e3d7ddc4109} 8 | 9 | 10 | ProjectExplorer.Project.ActiveTarget 11 | 0 12 | 13 | 14 | ProjectExplorer.Project.EditorSettings 15 | 16 | true 17 | false 18 | true 19 | 20 | Cpp 21 | 22 | CppGlobal 23 | 24 | 25 | 26 | QmlJS 27 | 28 | QmlJSGlobal 29 | 30 | 31 | 2 32 | UTF-8 33 | false 34 | 4 35 | false 36 | 80 37 | true 38 | true 39 | 1 40 | true 41 | false 42 | 0 43 | true 44 | 0 45 | 8 46 | true 47 | 1 48 | true 49 | true 50 | true 51 | false 52 | 53 | 54 | 55 | ProjectExplorer.Project.PluginSettings 56 | 57 | 58 | 59 | ProjectExplorer.Project.Target.0 60 | 61 | Desktop Qt 5.4.2 GCC 32bit 62 | Desktop Qt 5.4.2 GCC 32bit 63 | qt.54.gcc_kit 64 | 0 65 | 0 66 | 0 67 | 68 | /home/farsight/build-RLSB-Desktop_Qt_5_4_2_GCC_32bit-Debug 69 | 70 | 71 | true 72 | qmake 73 | 74 | QtProjectManager.QMakeBuildStep 75 | false 76 | true 77 | 78 | false 79 | false 80 | false 81 | 82 | 83 | true 84 | Make 85 | 86 | Qt4ProjectManager.MakeStep 87 | 88 | -w 89 | -r 90 | 91 | false 92 | 93 | 94 | 95 | 2 96 | 构建 97 | 98 | ProjectExplorer.BuildSteps.Build 99 | 100 | 101 | 102 | true 103 | Make 104 | 105 | Qt4ProjectManager.MakeStep 106 | 107 | -w 108 | -r 109 | 110 | true 111 | clean 112 | 113 | 114 | 1 115 | 清理 116 | 117 | ProjectExplorer.BuildSteps.Clean 118 | 119 | 2 120 | false 121 | 122 | Debug 123 | 124 | Qt4ProjectManager.Qt4BuildConfiguration 125 | 2 126 | true 127 | 128 | 129 | /home/farsight/build-RLSB-Desktop_Qt_5_4_2_GCC_32bit-Release 130 | 131 | 132 | true 133 | qmake 134 | 135 | QtProjectManager.QMakeBuildStep 136 | false 137 | true 138 | 139 | false 140 | false 141 | false 142 | 143 | 144 | true 145 | Make 146 | 147 | Qt4ProjectManager.MakeStep 148 | 149 | -w 150 | -r 151 | 152 | false 153 | 154 | 155 | 156 | 2 157 | 构建 158 | 159 | ProjectExplorer.BuildSteps.Build 160 | 161 | 162 | 163 | true 164 | Make 165 | 166 | Qt4ProjectManager.MakeStep 167 | 168 | -w 169 | -r 170 | 171 | true 172 | clean 173 | 174 | 175 | 1 176 | 清理 177 | 178 | ProjectExplorer.BuildSteps.Clean 179 | 180 | 2 181 | false 182 | 183 | Release 184 | 185 | Qt4ProjectManager.Qt4BuildConfiguration 186 | 0 187 | true 188 | 189 | 2 190 | 191 | 192 | 0 193 | 部署 194 | 195 | ProjectExplorer.BuildSteps.Deploy 196 | 197 | 1 198 | 在本地部署 199 | 200 | ProjectExplorer.DefaultDeployConfiguration 201 | 202 | 1 203 | 204 | 205 | 206 | false 207 | false 208 | false 209 | false 210 | true 211 | 0.01 212 | 10 213 | true 214 | 1 215 | 25 216 | 217 | 1 218 | true 219 | false 220 | true 221 | valgrind 222 | 223 | 0 224 | 1 225 | 2 226 | 3 227 | 4 228 | 5 229 | 6 230 | 7 231 | 8 232 | 9 233 | 10 234 | 11 235 | 12 236 | 13 237 | 14 238 | 239 | -1 240 | 241 | 242 | 243 | false 244 | %{buildDir} 245 | 自定义执行档 246 | 247 | ProjectExplorer.CustomExecutableRunConfiguration 248 | 3768 249 | false 250 | true 251 | false 252 | false 253 | true 254 | 255 | 1 256 | 257 | 258 | 259 | ProjectExplorer.Project.TargetCount 260 | 1 261 | 262 | 263 | ProjectExplorer.Project.Updater.FileVersion 264 | 18 265 | 266 | 267 | Version 268 | 18 269 | 270 | 271 | -------------------------------------------------------------------------------- /RLSB.pro.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EnvironmentId 7 | {7be1b5c3-f07a-424e-8786-cf25a17c53c0} 8 | 9 | 10 | ProjectExplorer.Project.ActiveTarget 11 | 0 12 | 13 | 14 | ProjectExplorer.Project.EditorSettings 15 | 16 | true 17 | false 18 | true 19 | 20 | Cpp 21 | 22 | CppGlobal 23 | 24 | 25 | 26 | QmlJS 27 | 28 | QmlJSGlobal 29 | 30 | 31 | 2 32 | UTF-8 33 | false 34 | 4 35 | false 36 | 80 37 | true 38 | true 39 | 1 40 | true 41 | false 42 | 0 43 | true 44 | true 45 | 0 46 | 8 47 | true 48 | 1 49 | true 50 | true 51 | true 52 | false 53 | 54 | 55 | 56 | ProjectExplorer.Project.PluginSettings 57 | 58 | 59 | true 60 | 61 | 62 | 63 | ProjectExplorer.Project.Target.0 64 | 65 | Desktop Qt 5.13.2 GCC 64bit 66 | Desktop Qt 5.13.2 GCC 64bit 67 | qt.qt5.5132.gcc_64_kit 68 | 0 69 | 0 70 | 0 71 | 72 | /home/wengfeilong/桌面/QT人脸考勤系统/build-RLSB-Desktop_Qt_5_13_2_GCC_64bit-Debug 73 | 74 | 75 | true 76 | qmake 77 | 78 | QtProjectManager.QMakeBuildStep 79 | true 80 | 81 | false 82 | false 83 | false 84 | 85 | 86 | true 87 | Make 88 | 89 | Qt4ProjectManager.MakeStep 90 | 91 | false 92 | 93 | 94 | false 95 | 96 | 2 97 | Build 98 | 99 | ProjectExplorer.BuildSteps.Build 100 | 101 | 102 | 103 | true 104 | Make 105 | 106 | Qt4ProjectManager.MakeStep 107 | 108 | true 109 | clean 110 | 111 | false 112 | 113 | 1 114 | Clean 115 | 116 | ProjectExplorer.BuildSteps.Clean 117 | 118 | 2 119 | false 120 | 121 | Debug 122 | Debug 123 | Qt4ProjectManager.Qt4BuildConfiguration 124 | 2 125 | true 126 | 127 | 128 | /home/wengfeilong/桌面/QT人脸考勤系统/build-RLSB-Desktop_Qt_5_13_2_GCC_64bit-Release 129 | 130 | 131 | true 132 | qmake 133 | 134 | QtProjectManager.QMakeBuildStep 135 | false 136 | 137 | false 138 | false 139 | true 140 | 141 | 142 | true 143 | Make 144 | 145 | Qt4ProjectManager.MakeStep 146 | 147 | false 148 | 149 | 150 | false 151 | 152 | 2 153 | Build 154 | 155 | ProjectExplorer.BuildSteps.Build 156 | 157 | 158 | 159 | true 160 | Make 161 | 162 | Qt4ProjectManager.MakeStep 163 | 164 | true 165 | clean 166 | 167 | false 168 | 169 | 1 170 | Clean 171 | 172 | ProjectExplorer.BuildSteps.Clean 173 | 174 | 2 175 | false 176 | 177 | Release 178 | Release 179 | Qt4ProjectManager.Qt4BuildConfiguration 180 | 0 181 | true 182 | 183 | 184 | /home/wengfeilong/桌面/QT人脸考勤系统/build-RLSB-Desktop_Qt_5_13_2_GCC_64bit-Profile 185 | 186 | 187 | true 188 | qmake 189 | 190 | QtProjectManager.QMakeBuildStep 191 | true 192 | 193 | false 194 | true 195 | true 196 | 197 | 198 | true 199 | Make 200 | 201 | Qt4ProjectManager.MakeStep 202 | 203 | false 204 | 205 | 206 | false 207 | 208 | 2 209 | Build 210 | 211 | ProjectExplorer.BuildSteps.Build 212 | 213 | 214 | 215 | true 216 | Make 217 | 218 | Qt4ProjectManager.MakeStep 219 | 220 | true 221 | clean 222 | 223 | false 224 | 225 | 1 226 | Clean 227 | 228 | ProjectExplorer.BuildSteps.Clean 229 | 230 | 2 231 | false 232 | 233 | Profile 234 | Profile 235 | Qt4ProjectManager.Qt4BuildConfiguration 236 | 0 237 | true 238 | 239 | 3 240 | 241 | 242 | 0 243 | 部署 244 | 245 | ProjectExplorer.BuildSteps.Deploy 246 | 247 | 1 248 | Deploy Configuration 249 | 250 | ProjectExplorer.DefaultDeployConfiguration 251 | 252 | 1 253 | 254 | 255 | dwarf 256 | 257 | cpu-cycles 258 | 259 | 260 | 250 261 | -F 262 | true 263 | 4096 264 | false 265 | false 266 | 1000 267 | 268 | true 269 | 270 | false 271 | false 272 | false 273 | false 274 | true 275 | 0.01 276 | 10 277 | true 278 | kcachegrind 279 | 1 280 | 25 281 | 282 | 1 283 | true 284 | false 285 | true 286 | valgrind 287 | 288 | 0 289 | 1 290 | 2 291 | 3 292 | 4 293 | 5 294 | 6 295 | 7 296 | 8 297 | 9 298 | 10 299 | 11 300 | 12 301 | 13 302 | 14 303 | 304 | 2 305 | 306 | RLSB 307 | 308 | Qt4ProjectManager.Qt4RunConfiguration:/home/wengfeilong/桌面/QT人脸考勤系统/RLSB/RLSB.pro 309 | 310 | 3768 311 | false 312 | true 313 | true 314 | false 315 | false 316 | true 317 | 318 | /home/wengfeilong/桌面/QT人脸考勤系统/build-RLSB-Desktop_Qt_5_13_2_GCC_64bit-Debug 319 | 320 | 1 321 | 322 | 323 | 324 | ProjectExplorer.Project.TargetCount 325 | 1 326 | 327 | 328 | ProjectExplorer.Project.Updater.FileVersion 329 | 22 330 | 331 | 332 | Version 333 | 22 334 | 335 | 336 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------