void UiLogin::UserLoginBt() { QSqlQuery query; QString name; name = uLogin->userNameEdit->text(); query.prepare("SELECT * FROM Pwd where usrName=:um"); query.bindValue(":um",name); query.exec(); query.next(); if(query.isValid()) { if(query.value(0).toString()==name) { qDebug()<<query.value(0).toString(); global->loginName = name; if(name=="root") { bool isOK; QString text = QInputDialog::getText(this, tr("提示"), tr("请输入root密码"), QLineEdit::Password, "", &isOK,Qt::Sheet); if(isOK) { if(text!=query.value(1).toString()) QMessageBox::information(this,tr("警告"),tr("密码错误!")); else { emit ChangeUi(2); } } } else { ChangeUi(3); } } } else { if(name=="") QMessageBox::information(this,tr("警告"),tr("请输入用户名!")); else QMessageBox::information(this,tr("警告"),tr("用户名不存在!")); } }
/** * Launch the app */ void System::Run() { try { Log("=============================================================="); Log("=========================Launching !========================="); Log("=============================================================="); //Initialize everything, at each step we check running to be sure the previous step go init correctly if(InitEngine()) { Log("Window opened, Width: "+ToString(_width)+"px, Height: "+ToString(_height)+"px"); if (!_renderer.Init(_width, _height,this)) { _error = true; Log("Renderer Init Error"); } LoadUis(); _renderer.SetMenu(_menu); _currentInput.SetWindowSize(vec2(_width, _height)); _currentUiDescriptor = _uis[_startupUiName]; _currentUi = _currentUiDescriptor->GetUi(); _currentUi->SetUiFunction(this); _renderer.SetupUi(_currentUi); //Reset the clock for delta time calculation Clock::GetRef().GetElapsedTime(); try { while(_running && !_error) { _running = !_currentInput.Update(); if (_uiChangeRequested) ChangeUi(); UiElement::ResetMouseInterception(); float delta = Clock::GetRef().GetElapsedTime(); if(_currentUiDescriptor->DisplayMenu()) _menu->Update(delta,&_currentInput, &_lastInput); _currentUi->Update(delta,&_currentInput,&_lastInput); _renderer.DrawFrame(delta,_displayMenu && _currentUiDescriptor->DisplayMenu()); SDL_GL_SwapWindow(_mainwindowPtr); _lastInput = _currentInput; } } catch(Exception e) { ReportError(e.what()); } _renderer.Unload(); StopEngine(); } } catch(Exception e) { ReportError(e.what()); StopEngine(); } }