int main(void) { int iChoice = 0; // size console window to 100x40 if(!initConsole()) { // show error box showError("Error", "Console Window could not be initialized.\nExiting program."); return EXIT_FAILURE; } // LogIn / Register Menu showStartScreen(); do { // choose between LogIn and Register getUserInput("%i", &iChoice, "\tChoose: ", "\n\tYour input is invalid. Please choose again.\n"); } while(iChoice != 1 && iChoice != 2); // LogIn / Register if(iChoice == 1) { // loop until valid login while(!showLogin()); } else { // loop until valid registration while(!showRegister()); } // loop until user quits manually while(startApplication()); return EXIT_SUCCESS; }
Scanner::Scanner(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) , _model(this) , _delegate(this) , _dynamicButtons(Qt::Vertical, this) , _thread(this) , _setting(this) { _ui.setupUi(this); _ui.horizontalLayout->addWidget(&_dynamicButtons); _ui.vehicleList->setModel(&_model); _ui.vehicleList->setItemDelegate(&_delegate); _dynamicButtons.addBtn(trUtf8("Enter")); _dynamicButtons.addBtn(trUtf8("Quit")); connect(&_dynamicButtons, SIGNAL(sendBtnClkByInx(int)), this, SLOT(btnClked(int))); connect(_ui.actionSettings, SIGNAL(triggered()), this, SLOT(showSetting())); connect(_ui.actionRegister, SIGNAL(triggered()), this, SLOT(showRegister())); showSetting(); scanVehicles(); }
void CController::insertWidgets() { QWidget* pMainWidget = new CMainWidget(); m_mapWidget.insert(s_sigMainWidget, pMainWidget); bool VARIABLE_IS_NOT_USED bIsLogoutOK = connect( pMainWidget, SIGNAL(logout()), this, SLOT(logout())); Q_ASSERT(bIsLogoutOK); QWidget* pLoginWidget = new CLoginWidget(); bool VARIABLE_IS_NOT_USED bIsLoginConOK = connect( pLoginWidget, SIGNAL(request(const QString&, const QString&)), this, SLOT(showLogining(const QString&, const QString&))); Q_ASSERT(bIsLoginConOK); bool VARIABLE_IS_NOT_USED bIsLogin2RegisterConOK = connect( pLoginWidget, SIGNAL(switch2Register()), this, SLOT(showRegister())); Q_ASSERT(bIsLogin2RegisterConOK); m_mapWidget.insert(s_sigLoginWidget, pLoginWidget); QWidget* pLoginingWidget = new CLoginingWidget(); bool VARIABLE_IS_NOT_USED bIsLogingStatusConOK = connect( pLoginingWidget, SIGNAL(requestEnd(const GuiCommon::ERequestStatus&)), this, SLOT(endLogining(const GuiCommon::ERequestStatus&))); Q_ASSERT(bIsLogingStatusConOK); m_mapWidget.insert(s_sigLoginingWidget, pLoginingWidget); QWidget* pRegisterWidget = new CRegisterWidget(); bool VARIABLE_IS_NOT_USED bIsRegisterConOK = connect( pRegisterWidget, SIGNAL(request(const QString&, const QString&)), this, SLOT(showRegistering(const QString&, const QString&))); Q_ASSERT(bIsRegisterConOK); bool VARIABLE_IS_NOT_USED bIsRegister2LoginConOK = connect( pRegisterWidget, SIGNAL(switch2Login()), this, SLOT(showLogin())); Q_ASSERT(bIsRegister2LoginConOK); bool VARIABLE_IS_NOT_USED bIsRegister2VerifyConOK = connect( pRegisterWidget, SIGNAL(switch2Verify()), this, SLOT(showVerify())); Q_ASSERT(bIsRegister2VerifyConOK); m_mapWidget.insert(s_sigRegisterWidget, pRegisterWidget); QWidget* pRegisteringWidget = new CRegisteringWidget(); bool VARIABLE_IS_NOT_USED bIsReigsteringConOK = connect( pRegisteringWidget, SIGNAL(requestEnd(const GuiCommon::ERequestStatus&)), this, SLOT(endRegistering(const GuiCommon::ERequestStatus&))); Q_ASSERT(bIsReigsteringConOK); m_mapWidget.insert(s_sigRegisteringWidget, pRegisteringWidget); QWidget* pVerifyWidget = new CVerifyWidget(); bool VARIABLE_IS_NOT_USED bIsVerifyConOK = connect( pVerifyWidget, SIGNAL(request(const QString&, const QString&)), this, SLOT(showVerifying(const QString&, const QString&))); Q_ASSERT(bIsVerifyConOK); bool VARIABLE_IS_NOT_USED bIsVerify2Login = connect( pVerifyWidget, SIGNAL(switch2Login()), this, SLOT(showLogin())); Q_ASSERT(bIsVerify2Login); m_mapWidget.insert(s_sigVerifyWidget, pVerifyWidget); QWidget* pVerifyingWidget = new CVerifyingWidget(); bool VARIABLE_IS_NOT_USED bIsVerifyingConOK = connect( pVerifyingWidget, SIGNAL(requestEnd(const GuiCommon::ERequestStatus&)), this, SLOT(endVerifying(const GuiCommon::ERequestStatus&))); Q_ASSERT(bIsVerifyingConOK); m_mapWidget.insert(s_sigVerifyingWidget, pVerifyingWidget); }
void PCloudApp::createMenus(){ notloggedmenu=new QMenu(); registerAction=new QAction(tr ("Register"), this); connect(registerAction, SIGNAL(triggered()), this, SLOT(showRegister())); loginAction=new QAction(tr("Login"), this); connect(loginAction, SIGNAL(triggered()), this, SLOT(showLogin())); settingsAction=new QAction(tr("Settings"), this); connect(settingsAction, SIGNAL(triggered()), this, SLOT(showSettings())); helpAction = new QAction(tr("Help"),this); connect(helpAction, SIGNAL(triggered()), this, SLOT(showpcloudHelp())); aboutPCloudAction = new QAction(tr("About"), this); connect(aboutPCloudAction, SIGNAL(triggered()), this, SLOT(showpCloudAbout())); exitAction=new QAction(tr("Exit"), this); // to be hidden in account tab connect(exitAction, SIGNAL(triggered()), this, SLOT(doExit())); notloggedmenu->addAction(registerAction); notloggedmenu->addAction(loginAction); notloggedmenu->addAction(settingsAction); notloggedmenu->addAction(helpAction); notloggedmenu->addAction(aboutPCloudAction); notloggedmenu->addSeparator(); notloggedmenu->addAction(exitAction); // to be hidden in account tab or settings accountAction = new QAction(tr("Account"), this); // Account tab // to remove username from menu connect(accountAction, SIGNAL(triggered()),this, SLOT(showAccount())); openAction=new QAction("Open pCloud folder", this); connect(openAction, SIGNAL(triggered()), this, SLOT(openCloudDir())); //shareFolderAction=new QAction("Share folder", this); //to del //connect(shareFolderAction, SIGNAL(triggered()), this, SLOT(shareFolder())); outgoingSharesAction=new QAction("My Shares", this); //to del connect(outgoingSharesAction, SIGNAL(triggered()), this, SLOT(outgoingShares())); incomingSharesAction=new QAction("Shared with Me", this); //to del connect(incomingSharesAction, SIGNAL(triggered()), this, SLOT(incomingShares())); sharesAction = new QAction(tr("Shares"),this); connect(sharesAction, SIGNAL(triggered()), this, SLOT(showShares())); logoutAction=new QAction("Logout", this); connect(logoutAction, SIGNAL(triggered()), this, SLOT(logOut())); openPCloudWinAction = new QAction("Open PCloud Window", this); // to del connect(openPCloudWinAction, SIGNAL(triggered()), this, SLOT(openpCloudWindow())); loggedmenu = new QMenu(); loggedmenu->addAction(openAction); loggedmenu->addAction(accountAction); // loggedmenu->addSeparator(); //loggedmenu->addAction(shareFolderAction); // to del // loggedmenu->addAction(outgoingSharesAction); //loggedmenu->addAction(incomingSharesAction); loggedmenu->addAction(sharesAction); loggedmenu->addAction(settingsAction); loggedmenu->addAction(helpAction); loggedmenu->addAction(aboutPCloudAction); loggedmenu->addSeparator(); loggedmenu->addAction(logoutAction); // to hide in acc tab loggedmenu->addAction(exitAction); // loggedmenu->addAction(openpCloudFormAction); // first form }