Clear blankstate screen if conditions change

The diary, home and analysis blank state screens will
now close if rides are added.

Still need to make the train view blank state screen
close when devices and workouts are added.
This commit is contained in:
Mark Liversedge
2013-01-12 21:52:38 +00:00
parent 0a4daa0072
commit b7502b80bd
2 changed files with 29 additions and 0 deletions

View File

@@ -983,6 +983,9 @@ MainWindow::MainWindow(const QDir &home) :
connect(this,SIGNAL(rideAdded(RideItem*)),this,SLOT(checkCPX(RideItem*)));
connect(this,SIGNAL(rideDeleted(RideItem*)),this,SLOT(checkCPX(RideItem*)));
// when metricDB updates check if BlankState needs to be closed
connect(metricDB, SIGNAL(dataChanged()), this, SLOT(checkBlankState()));
// Kick off
rideTreeWidgetSelectionChanged();
selectAnalysis();
@@ -1504,6 +1507,31 @@ MainWindow::helpView()
QDesktopServices::openUrl(QUrl("http://www.goldencheetah.org/wiki.html"));
}
void
MainWindow::checkBlankState()
{
// Home?
if (views->currentWidget() == blankStateHomePage) {
// should it be closed?
if (allRides->childCount() > 0) closeBlankHome();
}
// Diary?
if (views->currentWidget() == blankStateDiaryPage) {
// should it be closed?
if (allRides->childCount() > 0) closeBlankDiary();
}
// Analysis??
if (views->currentWidget() == blankStateAnalysisPage) {
// should it be closed?
if (allRides->childCount() > 0) closeBlankAnal();
}
// Train??
if (views->currentWidget() == blankStateTrainPage) {
// should it be closed?
if (appsettings->value(this, GC_DEV_COUNT).toInt() > 0 && trainDB->getCount() > 2) closeBlankTrain();
}
}
void
MainWindow::closeBlankTrain()
{