diff options
author | Boris Barbulovski <bbarbulovski@gmail.com> | 2014-02-12 15:22:54 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-02-12 11:42:59 -0800 |
commit | c86822c2f47973528b3441d633b2b9df98ed465a (patch) | |
tree | 211d6b282dab31c3956e1fb4d5aaaa9811203c62 /qt-ui/profilegraphics.cpp | |
parent | cc37d2e94ae34b8f260a1426e49c0ca082226502 (diff) | |
download | subsurface-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/profilegraphics.cpp')
-rw-r--r-- | qt-ui/profilegraphics.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 14df03eb1..6ae765d7a 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -196,7 +196,7 @@ void ProfileGraphicsView::changeGas() add_gas_switch_event(current_dive, current_dc, seconds, get_gasidx(current_dive, o2, he)); // this means we potentially have a new tank that is being used and needs to be shown fixup_dive(current_dive); - mainWindow()->information()->updateDiveInfo(selected_dive); + MainWindow::instance()->information()->updateDiveInfo(selected_dive); mark_divelist_changed(true); plot(current_dive, true); } @@ -207,7 +207,7 @@ void ProfileGraphicsView::hideEvents() EventItem *item = static_cast<EventItem*>(action->data().value<void*>()); struct event *event = item->ev; - if (QMessageBox::question(mainWindow(), TITLE_OR_TEXT( + if (QMessageBox::question(MainWindow::instance(), TITLE_OR_TEXT( tr("Hide events"), tr("Hide all %1 events?").arg(event->name)), QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) { @@ -237,7 +237,7 @@ void ProfileGraphicsView::removeEvent() EventItem *item = static_cast<EventItem*>(action->data().value<void*>()); struct event *event = item->ev; - if (QMessageBox::question(mainWindow(), TITLE_OR_TEXT( + if (QMessageBox::question(MainWindow::instance(), TITLE_OR_TEXT( tr("Remove the selected event?"), tr("%1 @ %2:%3").arg(event->name) .arg(event->time.seconds / 60) @@ -375,13 +375,13 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw) diveId = d ? d->id : 0; diveDC = d ? dc : NULL; - if (!isVisible() || !d || !mainWindow()) { + if (!isVisible() || !d || !MainWindow::instance()) { return; } setBackgroundBrush(getColor(BACKGROUND)); // best place to put the focus stealer code. - setFocusProxy(mainWindow()->dive_list()); + setFocusProxy(MainWindow::instance()->dive_list()); scene()->setSceneRect(0,0, viewport()->width()-50, viewport()->height()-50); toolTip = new ToolTipItem(); @@ -546,7 +546,7 @@ void ProfileGraphicsView::addControlItems(struct dive *d) if (defaultDC == "manually added dive" || defaultDC == "planned dive") { QAction *editAction = new QAction(QIcon(":edit"), tr("Edit"), this); toolBar->addAction(editAction); - connect(editAction, SIGNAL(triggered()), mainWindow(), SLOT(editCurrentDive())); + connect(editAction, SIGNAL(triggered()), MainWindow::instance(), SLOT(editCurrentDive())); } toolBarProxy = scene()->addWidget(toolBar); toolBarProxy->setPos(mapToScene(TOOLBAR_POS)); @@ -1628,7 +1628,7 @@ GraphicsTextEditor::GraphicsTextEditor(QGraphicsItem* parent): QGraphicsTextItem void GraphicsTextEditor::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) { // Remove the proxy filter so we can focus here. - mainWindow()->graphics()->setFocusProxy(0); + MainWindow::instance()->graphics()->setFocusProxy(0); setTextInteractionFlags(Qt::TextEditorInteraction | Qt::TextEditable); } @@ -1637,7 +1637,7 @@ void GraphicsTextEditor::keyReleaseEvent(QKeyEvent* event) if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { setTextInteractionFlags(Qt::NoTextInteraction); emit editingFinished( toPlainText() ); - mainWindow()->graphics()->setFocusProxy(mainWindow()->dive_list()); + MainWindow::instance()->graphics()->setFocusProxy(MainWindow::instance()->dive_list()); return; } emit textChanged( toPlainText() ); |