diff --git a/LibManageSystem_Server/addbook.cpp b/LibManageSystem_Server/addbook.cpp index 8b6f072a0d6e1c3c83a1c2ee9e0ec1e7e15457f9..1475dfcf19d723ea8ac0c3b281d91d4dadcaa658 100644 --- a/LibManageSystem_Server/addbook.cpp +++ b/LibManageSystem_Server/addbook.cpp @@ -16,7 +16,7 @@ addbook::addbook(Operat* _db,QWidget *parent) : ); QRegularExpression regExp1("[0-9-]+"); ui->datelEdit->setValidator(new QRegularExpressionValidator(regExp1,this)); - QRegularExpression regExp2("[0-9]+"); + QRegularExpression regExp2("[0-9-]+"); ui->numlEdit->setValidator(new QRegularExpressionValidator(regExp2,this)); QRegularExpression regExp3("[0-9.]+"); ui->pricelEdit->setValidator(new QRegularExpressionValidator(regExp3,this)); diff --git a/LibManageSystem_Server/mythread.cpp b/LibManageSystem_Server/mythread.cpp index 3b04cfcd3f7ca5ee4b26f27e1377332763af0426..64e58d070de2531dfa57773d31a9849fc9925d2f 100644 --- a/LibManageSystem_Server/mythread.cpp +++ b/LibManageSystem_Server/mythread.cpp @@ -576,7 +576,7 @@ void MyThread::FirstTransfer() cur_msg=first_transfer_header + msg_tobe_sent; cur_msg=HammingEncode(cur_msg); socket->write(cur_msg); - socket->waitForReadyRead(500); + socket->waitForDisconnected(1000); } else{ sentsize+=MAX_DAT_SIZE_PER_CLOCK; @@ -613,7 +613,7 @@ void MyThread::ContinueTransfer() sentsize=totalsize; cur_msg=HammingEncode(cur_msg); socket->write(cur_msg); - socket->waitForReadyRead(500); + socket->waitForDisconnected(1000); } else{ transfer_header += QString::number(sentsize+MAX_DAT_SIZE_PER_CLOCK).toStdString() + stopChar; diff --git a/LibManageSystem_Server/mythread.h b/LibManageSystem_Server/mythread.h index 2d23b80edc1e5a596ab5e6e4397560493af2db4a..d9c6b1c8eada474a97b32a69524b7936b19ab219 100644 --- a/LibManageSystem_Server/mythread.h +++ b/LibManageSystem_Server/mythread.h @@ -9,7 +9,7 @@ #include //每轮循环最大发送数据长度 -#define MAX_DAT_SIZE_PER_CLOCK 5000 +#define MAX_DAT_SIZE_PER_CLOCK 4000 class MyThread : public QObject { diff --git a/LibManageSystem_Server/tcpserver.cpp b/LibManageSystem_Server/tcpserver.cpp index 89f72f38e78014aaa47174f9ae48f667175feb80..614179222ca04a9a8d79aea4780d78a8e7786959 100644 --- a/LibManageSystem_Server/tcpserver.cpp +++ b/LibManageSystem_Server/tcpserver.cpp @@ -342,7 +342,7 @@ void TcpServer::visitDataBase(int threadhandle) if(errorType==0) db_data[pos].first.second.message="此书已被预约"; if(errorType==-1) - db_data[pos].first.second.message="您无权预约此书,请检查是否有书籍逾期未还,或是否已经预约其他书籍"; + db_data[pos].first.second.message="您无权预约此书,请检查是否有书籍逾期未还,或是否已经预约其他书籍 "; break; case 6: //取消预约书籍操作 diff --git a/LibManagementSystem/communication_module.cpp b/LibManagementSystem/communication_module.cpp index 63a327406cd486270d42b9d398093c6ea8181e7d..3f7cca17833437118552fbaf23226bdd6309cf94 100644 --- a/LibManagementSystem/communication_module.cpp +++ b/LibManagementSystem/communication_module.cpp @@ -121,9 +121,16 @@ void communication_module::receiveMsg() QByteArray _msg=socket->readAll(); _msg=HammingDecode(_msg); + char backChar=_msg.back(); + + while(backChar=='\0'){ + _msg.remove(_msg.size()-1,1); + backChar=_msg.back(); + } + qsizetype _msgSize=_msg.size(),start; - if(_msg[0]=='['&&_msg.size()==15){ + if(_msg[0]=='['&&_msg.size()==14){ send(); emit process_update(20); } @@ -141,7 +148,7 @@ void communication_module::receiveMsg() else cur_size=size_dat.toInt(); start=_msg.indexOf(stopChar) + 1; - received_msg += _msg.sliced(start,_msgSize - start - 1); + received_msg += _msg.sliced(start,_msgSize - start); emit process_update(20+int(60*float(cur_size)/float(totalsize))); diff --git a/LibManagementSystem/mainwindow.cpp b/LibManagementSystem/mainwindow.cpp index cbaf8e88d47fe548dcfdce92bb94b10e35a690ef..12278248a70f537bb0465c61f95efa6f0ab887e5 100644 --- a/LibManagementSystem/mainwindow.cpp +++ b/LibManagementSystem/mainwindow.cpp @@ -30,8 +30,6 @@ MainWindow::MainWindow(QWidget *parent) u_i = new user_info(¤t_user); re = new returnBook(¤t_user); -// lo->setStyleSheet(QString("background-image:url(:images/clientRes/Login.png)")); - // current_user.account = QString("21311144"); // current_user.nickname = QString("哈哈哈名字再长也不怕会自动省略"); // current_user.telephone_number = QString("18320280001");