Fixup reset layout

Moved to the view menu and initialised 'currentWindow'
to the analysis window on startup to avoid a SEGV if
you reset the layout without having ever switched views.
This commit is contained in:
Mark Liversedge
2011-10-17 20:10:29 +01:00
parent 27c056ad20
commit 550d054f35

View File

@@ -358,6 +358,7 @@ MainWindow::MainWindow(const QDir &home) :
// ANALYSIS WINDOW & CONTRAOLS
analWindow = new HomeWindow(this, "analysis", "Analysis");
analysisControls->addWidget(analWindow->controls());
currentWindow = analWindow;
// POPULATE TOOLBOX
toolBox->addItem(listView, QIcon(":images/activity.png"), "Activity History");
@@ -475,7 +476,6 @@ MainWindow::MainWindow(const QDir &home) :
optionsMenu->addAction(tr("&Options..."), this, SLOT(showOptions()), tr("Ctrl+O"));
optionsMenu->addAction(tr("Critical Power Calculator..."), this, SLOT(showTools()));
optionsMenu->addAction(tr("Workout Wizard"), this, SLOT(showWorkoutWizard()));
optionsMenu->addAction(tr("Reset Window Layout"), this, SLOT(resetWindowLayout()));
#ifdef GC_HAVE_ICAL
optionsMenu->addSeparator();
@@ -527,6 +527,8 @@ MainWindow::MainWindow(const QDir &home) :
#ifdef GC_HAVE_ICAL
viewMenu->addAction(tr("Diary"), this, SLOT(selectDiary()));
#endif
viewMenu->addSeparator();
viewMenu->addAction(tr("Reset Layout"), this, SLOT(resetWindowLayout()));
windowMenu = menuBar()->addMenu(tr("&Window"));
connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(setWindowMenu()));