void MainWindow::on_loginButon_clicked() { UsersDBManager udb; HomeWindow *home = new HomeWindow(); //passes the value of username from MainWindow to Welcome Label of HomeWindow connect(this,SIGNAL(setUName(QString)),home,SLOT(setWelcomeLabel(QString))); //Checking the input username and password are give or not if(ui->userName_txt->text().isEmpty() || ui->password_txt->text().isEmpty()){ mainMsgBox.setText("Please input the username and password"); mainMsgBox.exec(); } setUserName(ui->userName_txt->text()); setPassword(ui->password_txt->text()); bool successLogin = udb.checkLogin(getUserName(),getPassword()); if(successLogin){ //display another home window emit setUName(ui->userName_txt->text()); home->show(); this->close(); } else { //display qmessage login failed mainMsgBox.setText("Login failed. Please enter correct \nusername and password"); mainMsgBox.exec(); } }
DiaryView::DiaryView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_DIARY) { DiarySidebar *s = new DiarySidebar(context); HomeWindow *d = new HomeWindow(context, "diary", "Diary"); controls->addWidget(d->controls()); controls->setCurrentIndex(0); BlankStateDiaryPage *b = new BlankStateDiaryPage(context); setSidebar(s); setPage(d); setBlank(b); connect(s, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange))); }
AnalysisView::AnalysisView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_ANALYSIS) { analSidebar = new AnalysisSidebar(context); HomeWindow *a = new HomeWindow(context, "analysis", "Rides"); controls->addWidget(a->controls()); controls->setCurrentIndex(0); BlankStateAnalysisPage *b = new BlankStateAnalysisPage(context); setSidebar(analSidebar); setPage(a); setBlank(b); setBottom(new ComparePane(context, this, ComparePane::interval)); connect(bottomSplitter(), SIGNAL(compareChanged(bool)), this, SLOT(compareChanged(bool))); connect(bottomSplitter(), SIGNAL(compareClear()), bottom(), SLOT(clear())); }
HomeView::HomeView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_HOME) { LTMSidebar *s = new LTMSidebar(context); HomeWindow *h = new HomeWindow(context, "home", "Trends"); controls->addWidget(h->controls()); controls->setCurrentIndex(0); BlankStateHomePage *b = new BlankStateHomePage(context); setSidebar(s); setPage(h); setBlank(b); setBottom(new ComparePane(context, this, ComparePane::season)); connect(s, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange))); connect(this, SIGNAL(onSelectionChanged()), this, SLOT(justSelected())); connect(bottomSplitter(), SIGNAL(compareChanged(bool)), this, SLOT(compareChanged(bool))); connect(bottomSplitter(), SIGNAL(compareClear()), bottom(), SLOT(clear())); }
TrainView::TrainView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_TRAIN) { trainTool = new TrainSidebar(context); trainTool->hide(); HomeWindow *t = new HomeWindow(context, "train", "train"); controls->addWidget(t->controls()); controls->setCurrentIndex(0); BlankStateTrainPage *b = new BlankStateTrainPage(context); setSidebar(trainTool->controls()); setPage(t); setBlank(b); trainBottom = new TrainBottom(trainTool, this); setBottom(trainBottom); setHideBottomOnIdle(false); connect(this, SIGNAL(onSelectionChanged()), this, SLOT(onSelectionChanged())); connect(trainBottom, SIGNAL(autoHideChanged(bool)), this, SLOT(onAutoHideChanged(bool))); }
TrainView::TrainView(Context *context, QStackedWidget *controls) : TabView(context, VIEW_TRAIN) { trainTool = new TrainSidebar(context); trainTool->hide(); HomeWindow *t = new HomeWindow(context, "train", "train"); controls->addWidget(t->controls()); controls->setCurrentIndex(0); BlankStateTrainPage *b = new BlankStateTrainPage(context); setSidebar(trainTool->controls()); setPage(t); setBlank(b); p = new QDialog(NULL); QVBoxLayout *m = new QVBoxLayout(p); m->addWidget(trainTool->getToolbarButtons()); trainTool->getToolbarButtons()->show(); p->setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint | Qt::Tool); p->hide(); connect(this, SIGNAL(onSelectionChanged()), this, SLOT(onSelectionChanged())); }
void UserProfilPageTest::testConnexion() { HomeWindow window; window.show(); QVERIFY( window.isOnProfilPage() ); window.newMessageArrive( makeMessage( 1 ) ); window.newMessageArrive( makeMessage( 2 ) ); window.newMessageArrive( makeMessage( 1, false, false, false, false, true ) ); window.newMessageArrive( makeMessage( 2, false, false, false, false, true ) ); QTimer::singleShot( 1000, qApp, SLOT( quit() ) ); qApp->exec(); QVERIFY( window.isOnGameSelectionPage() ); }
int HomeApp::run() { HomeWindow wnd; wnd.show(); return exec(); }