# HG changeset patch # User dag10 # Date 1358166483 -3600 # Node ID a6e7a95f3b2e1ed3b72a9a1b238248c58a6e2e98 # Parent b557c73a75934d23f0f76a724b24287af6ee6e8e GCI2012: Abstract Page Load diff -r b557c73a7593 -r a6e7a95f3b2e QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Mon Jan 14 13:19:47 2013 +0100 +++ b/QTfrontend/hwform.cpp Mon Jan 14 13:28:03 2013 +0100 @@ -352,6 +352,7 @@ } PagesStack.push(ID_PAGE_MAIN); + ((AbstractPage*)ui.Pages->widget(ID_PAGE_MAIN))->triggerPageEnter(); GoBack(); } @@ -597,6 +598,10 @@ qDebug("Leaving %s, entering %s", qPrintable(stringifyPageId(lastid)), qPrintable(stringifyPageId(id))); + // pageEnter and pageLeave events + ((AbstractPage*)ui.Pages->widget(lastid))->triggerPageLeave(); + ((AbstractPage*)ui.Pages->widget(id))->triggerPageEnter(); + if (id == ID_PAGE_DATADOWNLOAD) { ui.pageDataDownload->fetchList(); @@ -668,10 +673,6 @@ curTeamSelWidget->resetPlayingTeams(teamsList); } } - else if (id == ID_PAGE_GAMESTATS) - { - ui.pageGameStats->renderStats(); - } if (id == ID_PAGE_MAIN) { @@ -701,6 +702,7 @@ unnecessary. */ + #if (QT_VERSION >= 0x040600) if (!stopAnim) { @@ -768,6 +770,7 @@ int curid = ui.Pages->currentIndex(); if (curid == ID_PAGE_MAIN) { + ((AbstractPage*)ui.Pages->widget(ID_PAGE_MAIN))->triggerPageLeave(); if (!ui.pageVideos->tryQuit(this)) return; stopAnim = true; diff -r b557c73a7593 -r a6e7a95f3b2e QTfrontend/ui/page/AbstractPage.cpp --- a/QTfrontend/ui/page/AbstractPage.cpp Mon Jan 14 13:19:47 2013 +0100 +++ b/QTfrontend/ui/page/AbstractPage.cpp Mon Jan 14 13:28:03 2013 +0100 @@ -25,6 +25,7 @@ #include #include #include +#include #include "qpushbuttonwithsound.h" @@ -163,3 +164,13 @@ { return defautDesc; } + +void AbstractPage::triggerPageEnter() +{ + emit pageEnter(); +} + +void AbstractPage::triggerPageLeave() +{ + emit pageLeave(); +} diff -r b557c73a7593 -r a6e7a95f3b2e QTfrontend/ui/page/AbstractPage.h --- a/QTfrontend/ui/page/AbstractPage.h Mon Jan 14 13:19:47 2013 +0100 +++ b/QTfrontend/ui/page/AbstractPage.h Mon Jan 14 13:28:03 2013 +0100 @@ -78,12 +78,35 @@ QString * getDefautDescription(); signals: + /** * @brief This signal is emitted when going back to the previous is * requested - e.g. when the back-button is clicked. */ void goBack(); + /** + * @brief This signal is emitted when the page is displayed + */ + void pageEnter(); + + /** + * @brief This signal is emitted when this page is left + */ + void pageLeave(); + + public slots: + + /** + * @brief This slot is called to trigger this page's pageEnter signal + */ + void triggerPageEnter(); + + /** + * @brief This slot is called to trigger this page's pageLeave signal + */ + void triggerPageLeave(); + protected: /** * @brief Class constructor diff -r b557c73a7593 -r a6e7a95f3b2e QTfrontend/ui/page/pageeditteam.cpp --- a/QTfrontend/ui/page/pageeditteam.cpp Mon Jan 14 13:19:47 2013 +0100 +++ b/QTfrontend/ui/page/pageeditteam.cpp Mon Jan 14 13:28:03 2013 +0100 @@ -175,7 +175,7 @@ void PageEditTeam::connectSignals() { - connect(this, SIGNAL(goBack()), this, SLOT(saveTeam())); + connect(this, SIGNAL(pageLeave()), this, SLOT(saveTeam())); signalMapper1 = new QSignalMapper(this); signalMapper2 = new QSignalMapper(this); diff -r b557c73a7593 -r a6e7a95f3b2e QTfrontend/ui/page/pagegamestats.cpp --- a/QTfrontend/ui/page/pagegamestats.cpp Mon Jan 14 13:19:47 2013 +0100 +++ b/QTfrontend/ui/page/pagegamestats.cpp Mon Jan 14 13:28:03 2013 +0100 @@ -110,6 +110,7 @@ void PageGameStats::connectSignals() { + connect(this, SIGNAL(pageEnter()), this, SLOT(renderStats())); connect(btnSave, SIGNAL(clicked()), this, SIGNAL(saveDemoRequested())); } diff -r b557c73a7593 -r a6e7a95f3b2e QTfrontend/ui/page/pageoptions.cpp --- a/QTfrontend/ui/page/pageoptions.cpp Mon Jan 14 13:19:47 2013 +0100 +++ b/QTfrontend/ui/page/pageoptions.cpp Mon Jan 14 13:28:03 2013 +0100 @@ -682,6 +682,7 @@ connect(btnDefaults, SIGNAL(clicked()), this, SLOT(setDefaultOptions())); #endif + connect(this, SIGNAL(pageEnter()), this, SLOT(setTeamOptionsEnabled())); connect(SLQuality, SIGNAL(valueChanged(int)), this, SLOT(setQuality(int))); connect(CBResolution, SIGNAL(currentIndexChanged(int)), this, SLOT(setResolution(int))); connect(CBFullscreen, SIGNAL(stateChanged(int)), this, SLOT(setFullscreen(int)));