Merge branch 'master' of ssh://115.28.86.8:29418/~admin/天开景运_0405_250719
24个文件已修改
6个文件已添加
1 文件已重命名
3 文件已复制
copy from "Server/\344\273\230\346\236\227\346\266\233/log/~WRL0001.tmp"
copy to "Client/\345\274\240\345\276\267\350\231\216/log/\346\227\245\345\277\227_\345\274\240\345\276\267\350\231\216_0729 -.doc"
Binary files differ
| | |
| | | QT_WARNING_PUSH |
| | | QT_WARNING_DISABLE_DEPRECATED |
| | | struct qt_meta_stringdata_AddFile_t { |
| | | QByteArrayData data[5]; |
| | | char stringdata0[69]; |
| | | QByteArrayData data[7]; |
| | | char stringdata0[102]; |
| | | }; |
| | | #define QT_MOC_LITERAL(idx, ofs, len) \ |
| | | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ |
| | |
| | | QT_MOC_LITERAL(0, 0, 7), // "AddFile" |
| | | QT_MOC_LITERAL(1, 8, 13), // "addFileSignal" |
| | | QT_MOC_LITERAL(2, 22, 0), // "" |
| | | QT_MOC_LITERAL(3, 23, 23), // "on_pushButton_3_clicked" |
| | | QT_MOC_LITERAL(4, 47, 21) // "on_pushButton_clicked" |
| | | QT_MOC_LITERAL(3, 23, 21), // "std::shared_ptr<char>" |
| | | QT_MOC_LITERAL(4, 45, 10), // "addFileMsg" |
| | | QT_MOC_LITERAL(5, 56, 23), // "on_pushButton_3_clicked" |
| | | QT_MOC_LITERAL(6, 80, 21) // "on_pushButton_clicked" |
| | | |
| | | }, |
| | | "AddFile\0addFileSignal\0\0on_pushButton_3_clicked\0" |
| | | "AddFile\0addFileSignal\0\0std::shared_ptr<char>\0" |
| | | "addFileMsg\0on_pushButton_3_clicked\0" |
| | | "on_pushButton_clicked" |
| | | }; |
| | | #undef QT_MOC_LITERAL |
| | |
| | | 7, // revision |
| | | 0, // classname |
| | | 0, 0, // classinfo |
| | | 3, 14, // methods |
| | | 4, 14, // methods |
| | | 0, 0, // properties |
| | | 0, 0, // enums/sets |
| | | 0, 0, // constructors |
| | | 0, // flags |
| | | 1, // signalCount |
| | | 2, // signalCount |
| | | |
| | | // signals: name, argc, parameters, tag, flags |
| | | 1, 2, 29, 2, 0x06 /* Public */, |
| | | 1, 2, 34, 2, 0x06 /* Public */, |
| | | 4, 1, 39, 2, 0x06 /* Public */, |
| | | |
| | | // slots: name, argc, parameters, tag, flags |
| | | 3, 0, 34, 2, 0x08 /* Private */, |
| | | 4, 0, 35, 2, 0x08 /* Private */, |
| | | 5, 0, 42, 2, 0x08 /* Private */, |
| | | 6, 0, 43, 2, 0x08 /* Private */, |
| | | |
| | | // signals: parameters |
| | | QMetaType::Void, QMetaType::QString, QMetaType::QString, 2, 2, |
| | | QMetaType::Void, 0x80000000 | 3, QMetaType::Int, 2, 2, |
| | | QMetaType::Void, QMetaType::QString, 2, |
| | | |
| | | // slots: parameters |
| | | QMetaType::Void, |
| | |
| | | AddFile *_t = static_cast<AddFile *>(_o); |
| | | Q_UNUSED(_t) |
| | | switch (_id) { |
| | | case 0: _t->addFileSignal((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; |
| | | case 1: _t->on_pushButton_3_clicked(); break; |
| | | case 2: _t->on_pushButton_clicked(); break; |
| | | case 0: _t->addFileSignal((*reinterpret_cast< std::shared_ptr<char>(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; |
| | | case 1: _t->addFileMsg((*reinterpret_cast< QString(*)>(_a[1]))); break; |
| | | case 2: _t->on_pushButton_3_clicked(); break; |
| | | case 3: _t->on_pushButton_clicked(); break; |
| | | default: ; |
| | | } |
| | | } else if (_c == QMetaObject::IndexOfMethod) { |
| | | int *result = reinterpret_cast<int *>(_a[0]); |
| | | { |
| | | typedef void (AddFile::*_t)(QString , QString ); |
| | | typedef void (AddFile::*_t)(std::shared_ptr<char> , int ); |
| | | if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&AddFile::addFileSignal)) { |
| | | *result = 0; |
| | | return; |
| | | } |
| | | } |
| | | { |
| | | typedef void (AddFile::*_t)(QString ); |
| | | if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&AddFile::addFileMsg)) { |
| | | *result = 1; |
| | | return; |
| | | } |
| | | } |
| | |
| | | if (_id < 0) |
| | | return _id; |
| | | if (_c == QMetaObject::InvokeMetaMethod) { |
| | | if (_id < 3) |
| | | if (_id < 4) |
| | | qt_static_metacall(this, _c, _id, _a); |
| | | _id -= 3; |
| | | _id -= 4; |
| | | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { |
| | | if (_id < 3) |
| | | if (_id < 4) |
| | | *reinterpret_cast<int*>(_a[0]) = -1; |
| | | _id -= 3; |
| | | _id -= 4; |
| | | } |
| | | return _id; |
| | | } |
| | | |
| | | // SIGNAL 0 |
| | | void AddFile::addFileSignal(QString _t1, QString _t2) |
| | | void AddFile::addFileSignal(std::shared_ptr<char> _t1, int _t2) |
| | | { |
| | | void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) }; |
| | | QMetaObject::activate(this, &staticMetaObject, 0, _a); |
| | | } |
| | | |
| | | // SIGNAL 1 |
| | | void AddFile::addFileMsg(QString _t1) |
| | | { |
| | | void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; |
| | | QMetaObject::activate(this, &staticMetaObject, 1, _a); |
| | | } |
| | | QT_WARNING_POP |
| | | QT_END_MOC_NAMESPACE |
| | |
| | | QT_WARNING_PUSH |
| | | QT_WARNING_DISABLE_DEPRECATED |
| | | struct qt_meta_stringdata_Release_t { |
| | | QByteArrayData data[1]; |
| | | char stringdata0[8]; |
| | | QByteArrayData data[5]; |
| | | char stringdata0[57]; |
| | | }; |
| | | #define QT_MOC_LITERAL(idx, ofs, len) \ |
| | | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ |
| | |
| | | ) |
| | | static const qt_meta_stringdata_Release_t qt_meta_stringdata_Release = { |
| | | { |
| | | QT_MOC_LITERAL(0, 0, 7) // "Release" |
| | | QT_MOC_LITERAL(0, 0, 7), // "Release" |
| | | QT_MOC_LITERAL(1, 8, 13), // "releaseSignal" |
| | | QT_MOC_LITERAL(2, 22, 0), // "" |
| | | QT_MOC_LITERAL(3, 23, 21), // "std::shared_ptr<char>" |
| | | QT_MOC_LITERAL(4, 45, 11) // "releaseSlot" |
| | | |
| | | }, |
| | | "Release" |
| | | "Release\0releaseSignal\0\0std::shared_ptr<char>\0" |
| | | "releaseSlot" |
| | | }; |
| | | #undef QT_MOC_LITERAL |
| | | |
| | |
| | | 7, // revision |
| | | 0, // classname |
| | | 0, 0, // classinfo |
| | | 0, 0, // methods |
| | | 2, 14, // methods |
| | | 0, 0, // properties |
| | | 0, 0, // enums/sets |
| | | 0, 0, // constructors |
| | | 0, // flags |
| | | 0, // signalCount |
| | | 1, // signalCount |
| | | |
| | | // signals: name, argc, parameters, tag, flags |
| | | 1, 2, 24, 2, 0x06 /* Public */, |
| | | |
| | | // slots: name, argc, parameters, tag, flags |
| | | 4, 0, 29, 2, 0x08 /* Private */, |
| | | |
| | | // signals: parameters |
| | | QMetaType::Void, 0x80000000 | 3, QMetaType::Int, 2, 2, |
| | | |
| | | // slots: parameters |
| | | QMetaType::Void, |
| | | |
| | | 0 // eod |
| | | }; |
| | | |
| | | void Release::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) |
| | | { |
| | | Q_UNUSED(_o); |
| | | Q_UNUSED(_id); |
| | | Q_UNUSED(_c); |
| | | Q_UNUSED(_a); |
| | | if (_c == QMetaObject::InvokeMetaMethod) { |
| | | Release *_t = static_cast<Release *>(_o); |
| | | Q_UNUSED(_t) |
| | | switch (_id) { |
| | | case 0: _t->releaseSignal((*reinterpret_cast< std::shared_ptr<char>(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; |
| | | case 1: _t->releaseSlot(); break; |
| | | default: ; |
| | | } |
| | | } else if (_c == QMetaObject::IndexOfMethod) { |
| | | int *result = reinterpret_cast<int *>(_a[0]); |
| | | { |
| | | typedef void (Release::*_t)(std::shared_ptr<char> , int ); |
| | | if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&Release::releaseSignal)) { |
| | | *result = 0; |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | const QMetaObject Release::staticMetaObject = { |
| | |
| | | int Release::qt_metacall(QMetaObject::Call _c, int _id, void **_a) |
| | | { |
| | | _id = QMainWindow::qt_metacall(_c, _id, _a); |
| | | if (_id < 0) |
| | | return _id; |
| | | if (_c == QMetaObject::InvokeMetaMethod) { |
| | | if (_id < 2) |
| | | qt_static_metacall(this, _c, _id, _a); |
| | | _id -= 2; |
| | | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { |
| | | if (_id < 2) |
| | | *reinterpret_cast<int*>(_a[0]) = -1; |
| | | _id -= 2; |
| | | } |
| | | return _id; |
| | | } |
| | | |
| | | // SIGNAL 0 |
| | | void Release::releaseSignal(std::shared_ptr<char> _t1, int _t2) |
| | | { |
| | | void *_a[] = { nullptr, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) }; |
| | | QMetaObject::activate(this, &staticMetaObject, 0, _a); |
| | | } |
| | | QT_WARNING_POP |
| | | QT_END_MOC_NAMESPACE |
| | |
| | | QT_WARNING_PUSH |
| | | QT_WARNING_DISABLE_DEPRECATED |
| | | struct qt_meta_stringdata_VCSMainWindow_t { |
| | | QByteArrayData data[7]; |
| | | char stringdata0[121]; |
| | | QByteArrayData data[10]; |
| | | char stringdata0[165]; |
| | | }; |
| | | #define QT_MOC_LITERAL(idx, ofs, len) \ |
| | | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ |
| | |
| | | static const qt_meta_stringdata_VCSMainWindow_t qt_meta_stringdata_VCSMainWindow = { |
| | | { |
| | | QT_MOC_LITERAL(0, 0, 13), // "VCSMainWindow" |
| | | QT_MOC_LITERAL(1, 14, 21), // "on_pushButton_clicked" |
| | | QT_MOC_LITERAL(2, 36, 0), // "" |
| | | QT_MOC_LITERAL(3, 37, 23), // "on_pushButton_2_clicked" |
| | | QT_MOC_LITERAL(4, 61, 23), // "on_pushButton_4_clicked" |
| | | QT_MOC_LITERAL(5, 85, 23), // "on_pushButton_3_clicked" |
| | | QT_MOC_LITERAL(6, 109, 11) // "addFileSlot" |
| | | QT_MOC_LITERAL(1, 14, 13), // "releaseSignal" |
| | | QT_MOC_LITERAL(2, 28, 0), // "" |
| | | QT_MOC_LITERAL(3, 29, 21), // "on_pushButton_clicked" |
| | | QT_MOC_LITERAL(4, 51, 23), // "on_pushButton_2_clicked" |
| | | QT_MOC_LITERAL(5, 75, 23), // "on_pushButton_4_clicked" |
| | | QT_MOC_LITERAL(6, 99, 23), // "on_pushButton_3_clicked" |
| | | QT_MOC_LITERAL(7, 123, 11), // "addFileSlot" |
| | | QT_MOC_LITERAL(8, 135, 21), // "std::shared_ptr<char>" |
| | | QT_MOC_LITERAL(9, 157, 7) // "msgSlot" |
| | | |
| | | }, |
| | | "VCSMainWindow\0on_pushButton_clicked\0" |
| | | "\0on_pushButton_2_clicked\0" |
| | | "VCSMainWindow\0releaseSignal\0\0" |
| | | "on_pushButton_clicked\0on_pushButton_2_clicked\0" |
| | | "on_pushButton_4_clicked\0on_pushButton_3_clicked\0" |
| | | "addFileSlot" |
| | | "addFileSlot\0std::shared_ptr<char>\0" |
| | | "msgSlot" |
| | | }; |
| | | #undef QT_MOC_LITERAL |
| | | |
| | |
| | | 7, // revision |
| | | 0, // classname |
| | | 0, 0, // classinfo |
| | | 5, 14, // methods |
| | | 7, 14, // methods |
| | | 0, 0, // properties |
| | | 0, 0, // enums/sets |
| | | 0, 0, // constructors |
| | | 0, // flags |
| | | 0, // signalCount |
| | | 1, // signalCount |
| | | |
| | | // signals: name, argc, parameters, tag, flags |
| | | 1, 0, 49, 2, 0x06 /* Public */, |
| | | |
| | | // slots: name, argc, parameters, tag, flags |
| | | 1, 0, 39, 2, 0x08 /* Private */, |
| | | 3, 0, 40, 2, 0x08 /* Private */, |
| | | 4, 0, 41, 2, 0x08 /* Private */, |
| | | 5, 0, 42, 2, 0x08 /* Private */, |
| | | 6, 2, 43, 2, 0x08 /* Private */, |
| | | 3, 0, 50, 2, 0x08 /* Private */, |
| | | 4, 0, 51, 2, 0x08 /* Private */, |
| | | 5, 0, 52, 2, 0x08 /* Private */, |
| | | 6, 0, 53, 2, 0x08 /* Private */, |
| | | 7, 2, 54, 2, 0x08 /* Private */, |
| | | 9, 1, 59, 2, 0x08 /* Private */, |
| | | |
| | | // signals: parameters |
| | | QMetaType::Void, |
| | | |
| | | // slots: parameters |
| | | QMetaType::Void, |
| | | QMetaType::Void, |
| | | QMetaType::Void, |
| | | QMetaType::Void, |
| | | QMetaType::Void, QMetaType::QString, QMetaType::QString, 2, 2, |
| | | QMetaType::Void, 0x80000000 | 8, QMetaType::Int, 2, 2, |
| | | QMetaType::Void, QMetaType::QString, 2, |
| | | |
| | | 0 // eod |
| | | }; |
| | |
| | | VCSMainWindow *_t = static_cast<VCSMainWindow *>(_o); |
| | | Q_UNUSED(_t) |
| | | switch (_id) { |
| | | case 0: _t->on_pushButton_clicked(); break; |
| | | case 1: _t->on_pushButton_2_clicked(); break; |
| | | case 2: _t->on_pushButton_4_clicked(); break; |
| | | case 3: _t->on_pushButton_3_clicked(); break; |
| | | case 4: _t->addFileSlot((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; |
| | | case 0: _t->releaseSignal(); break; |
| | | case 1: _t->on_pushButton_clicked(); break; |
| | | case 2: _t->on_pushButton_2_clicked(); break; |
| | | case 3: _t->on_pushButton_4_clicked(); break; |
| | | case 4: _t->on_pushButton_3_clicked(); break; |
| | | case 5: _t->addFileSlot((*reinterpret_cast< std::shared_ptr<char>(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; |
| | | case 6: _t->msgSlot((*reinterpret_cast< QString(*)>(_a[1]))); break; |
| | | default: ; |
| | | } |
| | | } else if (_c == QMetaObject::IndexOfMethod) { |
| | | int *result = reinterpret_cast<int *>(_a[0]); |
| | | { |
| | | typedef void (VCSMainWindow::*_t)(); |
| | | if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&VCSMainWindow::releaseSignal)) { |
| | | *result = 0; |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (_id < 0) |
| | | return _id; |
| | | if (_c == QMetaObject::InvokeMetaMethod) { |
| | | if (_id < 5) |
| | | if (_id < 7) |
| | | qt_static_metacall(this, _c, _id, _a); |
| | | _id -= 5; |
| | | _id -= 7; |
| | | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { |
| | | if (_id < 5) |
| | | if (_id < 7) |
| | | *reinterpret_cast<int*>(_a[0]) = -1; |
| | | _id -= 5; |
| | | _id -= 7; |
| | | } |
| | | return _id; |
| | | } |
| | | |
| | | // SIGNAL 0 |
| | | void VCSMainWindow::releaseSignal() |
| | | { |
| | | QMetaObject::activate(this, &staticMetaObject, 0, nullptr); |
| | | } |
| | | QT_WARNING_POP |
| | | QT_END_MOC_NAMESPACE |
| | |
| | | #include <QDebug> |
| | | #include <QDateTime> |
| | | #include <QString> |
| | | |
| | | #include <memory> |
| | | #define DEFAULT_PATH ("E:\soft") |
| | | #define DEFAULT_TYPE (tr("Pkg Files (*.zip *.tar.gz *.rar *.7z *.bz2)")) |
| | | #define UPLOAD 10 |
| | |
| | | + createDate.toString() + "#" |
| | | + description; |
| | | qDebug()<<versionMessage; |
| | | |
| | | emit addFileSignal(file, versionMessage); |
| | | // è·åæä»¶åºæ¬ä¿¡æ¯ |
| | | QString fileName = fileInfo.fileName(); |
| | | qint64 size = fileInfo.size(); |
| | | |
| | | |
| | | |
| | | // 计ç®å¤´æ¶æ¯é¿åº¦ï¼å¹¶åé
ç©ºé´ |
| | | // å¤´æ¶æ¯ï¼ç¤ºä¾ï¼ |
| | | int len = sizeof(UpLoadPkgHead) + fileName.size() + 1; |
| | | |
| | | std::shared_ptr<char> head(new char[len],[](char *p){delete[] p;}); |
| | | UpLoadPkgHead* pHead = reinterpret_cast<UpLoadPkgHead*>(head.get()); |
| | | |
| | | // ç´æ¥æä½æºè½æé管ççå
å |
| | | pHead->head.type = UPLOAD_REQ; |
| | | pHead->head.len = len; |
| | | memcpy(pHead->fileName, fileName.toUtf8().constData(), fileName.size()); |
| | | pHead->fileName[fileName.size()] = '\0'; |
| | | |
| | | emit addFileSignal(head, len); // ç´æ¥ä¼ éæºè½æé |
| | | |
| | | |
| | | QFile *pFile = new QFile(file); |
| | | if(!pFile){ |
| | | return; |
| | | } |
| | | |
| | | // 读æä»¶å
容 |
| | | |
| | | if (!pFile->open(QIODevice::ReadOnly)) { |
| | | qDebug() << "Failed to open file for reading:" << pFile->errorString(); |
| | | return; |
| | | } |
| | | // const int bufferSize = 4 * 1024; |
| | | const int bufferSize = 8 * 1024; |
| | | auto buffer = std::unique_ptr<char>(new char[bufferSize]); |
| | | qint64 totalBytesRead = 0; |
| | | int flag = 0; |
| | | while (!pFile->atEnd()) { |
| | | qint64 bytesRead = pFile->read(buffer.get(), bufferSize); |
| | | if (bytesRead == -1) { |
| | | qDebug() << "Error during read operation:" << pFile->errorString(); |
| | | break; |
| | | } |
| | | totalBytesRead += bytesRead; |
| | | |
| | | // æ°æ®å
æé ï¼ç¤ºä¾ï¼ |
| | | int dtlen = sizeof(UpLoadPkgData) + fileName.size() + bytesRead + 2; |
| | | std::shared_ptr<char> dataPkg(new char[dtlen],[](char *p){delete[] p;}); |
| | | UpLoadPkgData* pData = reinterpret_cast<UpLoadPkgData*>(dataPkg.get()); |
| | | |
| | | // å¡«å
æ°æ® |
| | | pData->head.len = len; |
| | | pData->head.type = UPLOAD_REQ; |
| | | pData->upLoadType = DATA_UPLOAD_REQ; |
| | | pData->fileNameLen = fileName.size(); |
| | | pData->dataLen = bytesRead; |
| | | pData->flag = ++flag; |
| | | pData->dataLen = bytesRead; |
| | | memcpy(pData->data, fileName.toUtf8().constData(), fileName.size()); |
| | | memcpy(pData->data + fileName.size() + 1, buffer.get(), bytesRead); |
| | | |
| | | emit addFileSignal(dataPkg, dtlen); |
| | | // æ éæå¨ freeï¼shared_ptr èªå¨éæ¾ |
| | | |
| | | } |
| | | if(totalBytesRead != size){ |
| | | qDebug()<<"æ°æ®åéä¸å®æ´"; |
| | | return; |
| | | } |
| | | qDebug()<<"æ°æ®åé宿ï¼åéæ°æ®åºå
"; |
| | | |
| | | int finLen = sizeof(UpLoadPkgFin)+fileName.size()+versionMessage.size()+2; |
| | | std::shared_ptr<char> finPkg(new char[finLen],[](char *p){delete[] p;}); |
| | | UpLoadPkgFin* pData = reinterpret_cast<UpLoadPkgFin*>(finPkg.get()); |
| | | |
| | | // å¡«å
æ°æ® |
| | | pData->head.len = finLen; |
| | | pData->head.type = UPLOAD_REQ; |
| | | pData->fileNameLen = fileName.size(); |
| | | pData->cnt = flag; |
| | | memcpy(pData->fileName, fileName.toUtf8().constData(), fileName.size()); |
| | | memcpy(pData->fileName + fileName.size() + 1,versionMessage.data(),versionMessage.size()); |
| | | |
| | | emit addFileSignal(finPkg ,finLen); |
| | | emit addFileMsg(QString("ä¸ä¼ æåï¼")); |
| | | |
| | | delete pFile; |
| | | } |
| | |
| | | #include "addfile.h" |
| | | #include <struct_data.h> |
| | | #include "uploador.h" |
| | | extern std::mutex _mutex; |
| | | extern std::condition_variable _conv; |
| | | extern int g_flag; |
| | | namespace Ui { |
| | | class AddFile; |
| | | } |
| | |
| | | ~AddFile(); |
| | | |
| | | signals: |
| | | void addFileSignal(QString, QString); |
| | | void addFileSignal(std::shared_ptr<char>, int); |
| | | void addFileMsg(QString); |
| | | private slots: |
| | | void on_pushButton_3_clicked(); |
| | | void on_pushButton_clicked(); |
| | |
| | | #include "release.h" |
| | | #include "ui_release.h" |
| | | |
| | | #include "struct_data.h" |
| | | #include <QDebug> |
| | | Release::Release(QWidget *parent) : |
| | | QMainWindow(parent), |
| | | ui(new Ui::Release) |
| | |
| | | { |
| | | delete ui; |
| | | } |
| | | |
| | | void Release::releaseSlot() |
| | | { |
| | | ReleaseReq* req = new ReleaseReq(); |
| | | int len = req->head.len; |
| | | std::shared_ptr<char> buf(new char[len],[](char *p){delete[] p;}); |
| | | memcpy(buf.get(),req,len); |
| | | qDebug()<<"æ¥è¯¢åå¸ä¿¡æ¯"; |
| | | emit releaseSignal(buf,len); |
| | | } |
| | |
| | | #define RELEASE_H |
| | | |
| | | #include <QMainWindow> |
| | | |
| | | #include <memory> |
| | | namespace Ui { |
| | | class Release; |
| | | } |
| | |
| | | public: |
| | | explicit Release(QWidget *parent = 0); |
| | | ~Release(); |
| | | signals: |
| | | void releaseSignal(std::shared_ptr<char>,int); |
| | | private slots: |
| | | void releaseSlot(); |
| | | |
| | | private: |
| | | Ui::Release *ui; |
| | |
| | | #ifndef STRUCT_DATA_H |
| | | #define STRUCT_DATA_H |
| | | |
| | | |
| | | #include <mutex> |
| | | #include <condition_variable> |
| | | enum TypeInfo{ |
| | | UPLOAD_REQ = 100, |
| | | HEAD_UPLOAD_REQ, |
| | | DATA_UPLOAD_REQ, |
| | | UP_LOAD_FIN, |
| | | UPLOAD_SQL_REQ, |
| | | RELEASE_SQL_REQ, |
| | | RELEASE_SQL_RES, |
| | | HEART_CHECK_REQ, |
| | | HEART_CHECK_RES |
| | | }; |
| | |
| | | Head head; |
| | | |
| | | }; |
| | | |
| | | struct ReleaseReq { |
| | | Head head; |
| | | ReleaseReq(){ |
| | | head.len = sizeof(ReleaseReq); |
| | | head.type = RELEASE_SQL_REQ; |
| | | } |
| | | }; |
| | | struct HeartCheckReq // å¿è·³è¯·æ±å
|
| | | { |
| | | Head head; |
| | |
| | | head.len = sizeof(HeartCheckRes); |
| | | } |
| | | }; |
| | | |
| | | #endif // STRUCT_DATA_H |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE QtCreatorProject> |
| | | <!-- Written by QtCreator 4.5.0, 2025-07-28T12:08:12. --> |
| | | <!-- Written by QtCreator 4.5.0, 2025-07-29T15:00:31. --> |
| | | <qtcreator> |
| | | <data> |
| | | <variable>EnvironmentId</variable> |
| | |
| | | } |
| | | } |
| | | |
| | | int UpLoador::upfile(char* data, int rlen) |
| | | int UpLoador::upfile(std::shared_ptr<char> buf, int rlen) |
| | | { |
| | | if(data == nullptr || rlen <= 0){ |
| | | if (!buf || rlen <= 0) { // æ£æ¥æºè½æéæ¯å¦ä¸ºç©º |
| | | return -1; |
| | | } |
| | | if(m_client){ |
| | | int len = m_client->write((char*)data,rlen); |
| | | qDebug()<<len; |
| | | if (m_client) { |
| | | // å
³é®ä¿®æ¹ï¼ç¨ buf.get() è·ååå§æé |
| | | int len = m_client->write(reinterpret_cast<char*>(buf.get()), rlen); |
| | | qDebug() << "Sent bytes:" << len; |
| | | return len; |
| | | } |
| | | return -1; // è¡¥å
è¿åå¼ |
| | | } |
| | | |
| | | void UpLoador::myRead() |
| | |
| | | private: |
| | | void processBuffer(); |
| | | public: |
| | | int upfile(char* data, int rlen); |
| | | int upfile(std::shared_ptr<char> buf, int rlen); |
| | | }; |
| | | |
| | | #endif // UPLOADOR_H |
| | |
| | | |
| | | #include <QFileInfo> |
| | | #include <QMessageBox> |
| | | #include "struct_data.h" |
| | | std::mutex _mutex; |
| | | std::condition_variable _conv; |
| | | int g_flag = 1; |
| | | VCSMainWindow::VCSMainWindow(QWidget *parent) : |
| | | QMainWindow(parent), |
| | | ui(new Ui::VCSMainWindow) |
| | |
| | | ui->stackedWidget->setCurrentWidget(m_addFile); |
| | | |
| | | |
| | | connect(m_addFile,SIGNAL(addFileSignal(QString, QString)),this,SLOT(addFileSlot(QString, QString))); |
| | | |
| | | connect(m_addFile,SIGNAL(addFileSignal(std::shared_ptr<char>,int)),this,SLOT(addFileSlot(std::shared_ptr<char>,int))); |
| | | connect(this,SIGNAL(releaseSignal()),m_release,SLOT(releaseSlot())); |
| | | connect(m_addFile,SIGNAL(addFileMsg(QString)),this,SLOT(msgSlot(QString))); |
| | | connect(m_release,SIGNAL(releaseSignal(std::shared_ptr<char>,int)),this,SLOT(addFileSlot(std::shared_ptr<char>,int))); |
| | | } |
| | | |
| | | VCSMainWindow::~VCSMainWindow() |
| | |
| | | ui->stackedWidget->setCurrentWidget(m_addFile); |
| | | } |
| | | |
| | | // ä¸ä¼ |
| | | void VCSMainWindow::on_pushButton_2_clicked() |
| | | { |
| | | ui->stackedWidget->setCurrentWidget(m_release); |
| | | emit releaseSignal(); |
| | | } |
| | | |
| | | void VCSMainWindow::on_pushButton_4_clicked() |
| | |
| | | ui->stackedWidget->setCurrentWidget(m_readLog); |
| | | } |
| | | |
| | | void VCSMainWindow::addFileSlot(QString file, QString versionMessage) |
| | | void VCSMainWindow::addFileSlot(std::shared_ptr<char> buf, int len) |
| | | { |
| | | QFileInfo fileInfo(file); |
| | | // è·åæä»¶åºæ¬ä¿¡æ¯ |
| | | QString fileName = fileInfo.fileName(); |
| | | qint64 size = fileInfo.size(); |
| | | if (!buf || len <= 0) { |
| | | |
| | | |
| | | |
| | | // 计ç®å¤´æ¶æ¯é¿åº¦ï¼å¹¶åé
ç©ºé´ |
| | | int len = sizeof(UpLoadPkgHead)+fileName.size()+1; |
| | | UpLoadPkgHead *head = (UpLoadPkgHead*)malloc(len); |
| | | |
| | | // å¤´æ¶æ¯ä¿¡æ¯å¡«å
|
| | | head->head.type = UPLOAD_REQ; |
| | | head->head.len = len; |
| | | head->upLoadType = HEAD_UPLOAD_REQ; |
| | | head->fileNameLen = fileName.size(); |
| | | memcpy(head->fileName,fileName.data(),fileName.size()); |
| | | head->fileName[fileName.size()] = '\0'; |
| | | |
| | | // åéå¤´æ¶æ¯ |
| | | |
| | | int ret = m_upLoad->upfile((char*)head,len); |
| | | if(ret < len){ |
| | | qDebug()<<"ä¼ è¾æé®é¢: "; |
| | | free(head); |
| | | head = nullptr; |
| | | return ; |
| | | } |
| | | free(head); |
| | | head = nullptr; |
| | | QFile *pFile = new QFile(file); |
| | | if(!pFile){ |
| | | return; |
| | | } |
| | | |
| | | // 读æä»¶å
容 |
| | | |
| | | if (!pFile->open(QIODevice::ReadOnly)) { |
| | | qDebug() << "Failed to open file for reading:" << pFile->errorString(); |
| | | m_msg->warning(nullptr, "æç¤º", "æä»¶æå¼å¤±è´¥"); |
| | | return; |
| | | } |
| | | const int bufferSize = 8 * 1024; |
| | | char buffer[bufferSize] = {0}; |
| | | |
| | | qint64 totalBytesRead = 0; |
| | | int flag = 0; |
| | | while (!pFile->atEnd()) { |
| | | qint64 bytesRead = pFile->read(buffer, bufferSize); |
| | | if (bytesRead == -1) { |
| | | qDebug() << "Error during read operation:" << pFile->errorString(); |
| | | break; |
| | | return; |
| | | } |
| | | totalBytesRead += bytesRead; |
| | | int dtlen = sizeof(UpLoadPkgData)+fileName.size()+bytesRead+2; |
| | | UpLoadPkgData *dataPkg = (UpLoadPkgData *)malloc(dtlen); |
| | | memset(dataPkg, 0, dtlen); |
| | | dataPkg->head.len = len; |
| | | dataPkg->head.type = UPLOAD_REQ; |
| | | dataPkg->upLoadType = DATA_UPLOAD_REQ; |
| | | dataPkg->fileNameLen = fileName.size(); |
| | | dataPkg->dataLen = bytesRead; |
| | | dataPkg->flag = ++flag; |
| | | memcpy(dataPkg->data,fileName.data(),fileName.size()); |
| | | dataPkg->data[fileName.size()] = '\0'; |
| | | strcpy(&(dataPkg->data[fileName.size()+1]),buffer); |
| | | ret = m_upLoad->upfile((char*)dataPkg,dtlen); |
| | | if(ret < dtlen){ |
| | | qDebug()<<"æ°æ®ä¼ è¾æé®é¢"; |
| | | free(dataPkg); |
| | | dataPkg = nullptr; |
| | | m_msg->warning(nullptr, "æç¤º", "æ°æ®ä¼ è¾æé®é¢"); |
| | | return ; |
| | | int ret = m_upLoad->upfile(buf, len); // å¤çæ°æ® |
| | | if(ret < len){ |
| | | qDebug()<<"ä¼ è¾æé®é¢"; |
| | | } |
| | | free(dataPkg); |
| | | dataPkg = nullptr; |
| | | } |
| | | if(totalBytesRead != size){ |
| | | qDebug()<<"æ°æ®åéä¸å®æ´"; |
| | | m_msg->warning(nullptr, "æç¤º", "æ°æ®åéä¸å®æ´"); |
| | | return; |
| | | } |
| | | qDebug()<<"æ°æ®åé宿ï¼åéæ°æ®åºå
"; |
| | | |
| | | int finLen = sizeof(UpLoadPkgFin)+fileName.size()+versionMessage.size()+2; |
| | | UpLoadPkgFin *finPkg = (UpLoadPkgFin *)malloc(finLen); |
| | | finPkg->head.len = finLen; |
| | | finPkg->head.type = UPLOAD_REQ; |
| | | finPkg->fileNameLen = fileName.size(); |
| | | finPkg->cnt = flag; |
| | | memcpy(finPkg->fileName,fileName.data(),fileName.size()); |
| | | finPkg->fileName[fileName.size()] = '\0'; |
| | | memcpy(&(finPkg->fileName[fileName.size()+1]),versionMessage.data(),versionMessage.size()); |
| | | finPkg->fileName[fileName.size()+versionMessage.size()+1] = '\0'; |
| | | |
| | | ret = m_upLoad->upfile((char*)finPkg,finLen); |
| | | if(ret < finLen){ |
| | | qDebug()<<"finå
ä¼ è¾æé®é¢"; |
| | | free(finPkg); |
| | | finPkg = nullptr; |
| | | m_msg->warning(nullptr, "æç¤º", "ä¸ä¼ 失败ï¼"); |
| | | return ; |
| | | } |
| | | free(finPkg); |
| | | finPkg = nullptr; |
| | | qDebug()<<"æ°æ®åºå
åé宿"; |
| | | |
| | | m_msg->information(nullptr, "æç¤º", "ä¸ä¼ æåï¼"); |
| | | |
| | | } |
| | | |
| | | void VCSMainWindow::msgSlot(QString msg) |
| | | { |
| | | m_msg->information(this,"æç¤º",msg); |
| | | } |
| | | |
| | |
| | | public: |
| | | explicit VCSMainWindow(QWidget *parent = 0); |
| | | ~VCSMainWindow(); |
| | | |
| | | signals: |
| | | void releaseSignal(); |
| | | private slots: |
| | | void on_pushButton_clicked(); |
| | | |
| | |
| | | |
| | | void on_pushButton_3_clicked(); |
| | | |
| | | void addFileSlot(QString, QString); |
| | | void addFileSlot(std::shared_ptr<char>,int); |
| | | void msgSlot(QString); |
| | | |
| | | |
| | | private: |
| | | Ui::VCSMainWindow *ui; |
copy from "Server/\344\273\230\346\236\227\346\266\233/log/~WRL0001.tmp"
copy to "Server/\345\210\230\345\210\233\344\270\226/log/\346\227\245\345\277\227_\345\210\230\345\210\233\344\270\226_2025-07-30.doc"
Binary files differ
copy from "Server/\344\273\230\346\236\227\346\266\233/log/~WRL0001.tmp"
copy to "Server/\346\235\216\346\231\250\351\243\236/log/\346\227\245\345\277\227_\346\235\216\346\231\250\351\243\236_0729.doc"
Binary files differ