//Main function for the code. It opens the login window, and when the log in button is clicked //returns here to login with the credentials to the right program (teacher or student side) int main(int argc, char *argv[]) { QApplication a(argc, argv); LogInDialog login; int exitValue = 0; bool _continue = true; while(_continue) { if(login.exec() == QDialog::Accepted) { int accountID = 0; bool docent = false; login.getValues(accountID, docent); StudentWindow s(accountID); DocentWindow d; if(!docent) { s.show(); exitValue = a.exec(); _continue = s.keepGoing(); } else { d.show(); exitValue = a.exec(); _continue = d.keepGoing(); } } else { _continue = false; exitValue = 1; } } return exitValue; }
void MainWindow::connect_dispatcher() { LogInDialog *logindialog = new LogInDialog(&platforminfo_); if(logindialog->exec() == LogInDialog::Accepted) { disp_ = DispatcherFactory::createDispatcher(platforminfo_); if(disp_ != nullptr) { ui_->action_Connect->setEnabled(false); insertswing_->setEnabled(true); insertcombo_->setEnabled(true); } else { std::cerr<<"create Dispatcher failed."<<std::endl; } } }