void MainWindow::rcvAuthorise (int flag) { switch(flag) { case 1://验证通过 //nowAt { QMessageBox *box = new QMessageBox; box->addButton (QMessageBox::Ok); box->setText ("登陆成功!"); box->show(); connect(box,SIGNAL(buttonClicked(QAbstractButton*)),login,SLOT(close())); enable_all(); del_login (); emit callClientTimeEvent(); break; } case 0://验证没通过 login->auth_fail (); break; default: ; } }
void Window::goto_pos()//begin animation { std::cout<<"Animation to position: "<<m_destpos_list->currentText().toStdString()<<std::endl; scene->get_skel()->set_origin_dest_pos(m_pos_list->currentText(),m_destpos_list->currentText()); scene->draw_skel(false); timer->start(TIMER_TIME); run_animation=true; anim_time=0.0; //see if needs to save it to files : if (m_animfile_edit->text()!=""){ m_animation_number=1001; //shot QString filename=QString::number(m_animation_number);//how to add leading zeros ? filename="out/"+m_animfile_edit->text()+filename+".png"; std::cout<<"Write to "<<filename.toStdString()<<std::endl; graph_view->ask_shot(filename); } enable_all(false); }
void Window::timer_timeout() { //std::cout<<"BIP"<<std::endl; if (run_animation){ scene->get_skel()->update_anim(ANIM_SPEED,anim_time); anim_time+=ANIM_SPEED; run_animation=anim_time<1.0; scene->draw_skel(false); //save img if (m_animation_number>0) { m_animation_number+=1; QString filename=QString::number(m_animation_number);//how to add leading zeros ? filename="out/"+m_animfile_edit->text()+filename+".png"; std::cout<<"Write to "<<filename.toStdString()<<std::endl; graph_view->ask_shot(filename); } if (!run_animation) { run_animation=false; std::cout<<"Animation finished"<<std::endl; timer->stop();m_animation_number=0; //invert current pos and goto pos int pos1=m_pos_list->currentIndex(); int pos2=m_destpos_list->currentIndex(); m_pos_list->setCurrentIndex(pos2); m_destpos_list->setCurrentIndex(pos1); enable_all(true); } else { timer->start(TIMER_TIME); //std::cout<<"run_animation=true;"<<std::endl; } } }