Only create UpdateManager once it is needed

Instead of unconditionally creating the object at program start let's
create it the first time we need it. That should avoid adding more and
more delays at program start (not to mention the usually unnecessary
memory use).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-04-02 12:56:14 -07:00
parent 4ee94167f1
commit 59912568d0

View file

@ -54,7 +54,8 @@ MainWindow::MainWindow() : QMainWindow(),
helpView(0),
yearlyStats(0),
yearlyStatsModel(0),
state(VIEWALL)
state(VIEWALL),
updateManager(0)
{
Q_ASSERT_X(m_Instance == NULL, "MainWindow", "MainWindow recreated!");
m_Instance = this;
@ -85,7 +86,6 @@ MainWindow::MainWindow() : QMainWindow(),
ui.divePlanner->settingsChanged();
ui.divePlannerWidget->settingsChanged();
updateManager = new UpdateManager(this);
#ifndef ENABLE_PLANNER
// ui.menuLog->removeAction(ui.actionDivePlanner);
@ -580,6 +580,9 @@ void MainWindow::on_actionAboutSubsurface_triggered()
void MainWindow::on_action_Check_for_Updates_triggered()
{
if (!updateManager)
updateManager = new UpdateManager(this);
updateManager->checkForUpdates();
}