aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Boris Barbulovski <bbarbulovski@gmail.com>2014-02-12 15:22:54 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-12 11:42:59 -0800
commitc86822c2f47973528b3441d633b2b9df98ed465a (patch)
tree211d6b282dab31c3956e1fb4d5aaaa9811203c62 /qt-ui/mainwindow.cpp
parentcc37d2e94ae34b8f260a1426e49c0ca082226502 (diff)
downloadsubsurface-c86822c2f47973528b3441d633b2b9df98ed465a.tar.gz
Replace mainWindow() with MainWindow::instance()
C++ style of accessing single instance class object. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 217c66dbb..8795b93df 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -36,12 +36,7 @@
#include "printdialog.h"
#include "divelogimportdialog.h"
-static MainWindow* instance = 0;
-
-MainWindow* mainWindow()
-{
- return instance;
-}
+MainWindow *MainWindow::m_Instance = NULL;
MainWindow::MainWindow() : QMainWindow(),
actionNextDive(0),
@@ -49,7 +44,7 @@ MainWindow::MainWindow() : QMainWindow(),
helpView(0),
state(VIEWALL)
{
- instance = this;
+ m_Instance = this;
ui.setupUi(this);
setWindowIcon(QIcon(":subsurface-icon"));
connect(ui.ListWidget, SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int)));
@@ -79,6 +74,16 @@ MainWindow::MainWindow() : QMainWindow(),
#endif
}
+MainWindow::~MainWindow()
+{
+ m_Instance = NULL;
+}
+
+MainWindow *MainWindow::instance()
+{
+ return m_Instance;
+}
+
// this gets called after we download dives from a divecomputer
void MainWindow::refreshDisplay(bool recreateDiveList)
{