void MainWindow::on_login_clicked() { QString str_userno = ui->lineEditUserno->text(); QString *info; if(!str_userno.length()) { info = new QString("please input userno!"); QMessageBox::information(NULL, "login", *info); delete info; return; }else if( str_userno.length() != 6){ info = new QString("check userno!"); QMessageBox::information(NULL, "login", *info); delete info; return; } QString str_passwd = ui->lineEditPasswd->text(); if(!str_passwd.length()) { info = new QString("please input password!"); QMessageBox::information(NULL, "login", *info); delete info; return; } // QString inputinfo = str_userno + str_passwd; //QMessageBox::information(NULL, "login", inputinfo); int loginflag = login(); if(loginflag == 1) { //login success emit gotoView(3); }else if( -1 == loginflag){ //server wrong QMessageBox::information(NULL, "ERROR", "cannot connect with server!Check server information!"); }else if( -2 == loginflag){ //user or userno wrong QMessageBox::information(NULL, "ERROR", "Userno and password is not match!"); } }
int MainWindow::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) { switch (_id) { case 0: gotoView((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: on_login_clicked(); break; case 2: on_quit_clicked(); break; case 3: gotoViewSlots((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: setServerSlots(); break; case 5: applyidSlots(); break; case 6: userViewSlots(); break; default: ; } _id -= 7; } return _id; }
/* ============================================================================= =============================================================================== */ bool CWorld::setNewView(string strView, double &dStart, double &dFinish, bool bUpdateCamera) { if (strView == "") return true; int iView = -1; if (strView[0] >= '0' && strView[0] <= '9') iView = atoi(strView.c_str()); else iView = getViewSet().getView(strView); if (!getViewSet().isValid(iView)) { cout << ("Unable to find view: " + strView); return false; } if (iView != getViewSet().getCur()) gotoView(iView, 0, bUpdateCamera); dStart = getTimeLine().getStart(); dFinish = getTimeLine().getFinish(); if (dStart > 0.0) { getTimeLine().setStart(dStart); getTimeLine().setCurTime(dStart); if (dFinish > 0.0 || getTimeLine().getFinish() < dStart) { dFinish = max(dStart, dFinish); getTimeLine().setFinish(dFinish); } updateTime(); } return true; }
//û¼ɹʱ void MainWindow::userViewSlots() { emit gotoView(3); }
//û¼ɹʱ void MainWindow::applyidSlots() { emit gotoView(2); }
//÷Ϣ void MainWindow::setServerSlots() { emit gotoView(1); }