[PATCH] Adds unhide to profile menu context menu

Tim Wootton tim at tee-jay.demon.co.uk
Wed Dec 18 13:55:53 UTC 2013


Unhide menu is only shown when hidden events exist.
Also updates relavent manual section.

Signed-off-by: Tim Wootton <tim at tee-jay.demon.co.uk>
---
 Documentation/user-manual.txt |  2 +-
 qt-ui/profilegraphics.cpp     | 20 ++++++++++++++++++++
 qt-ui/profilegraphics.h       |  1 +
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 46ba698..5f441d9 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -682,7 +682,7 @@ For a more detailed explanation of _gradient factors_, use the following links:
 
 === The Dive Profile context menu
 
-The context menu for the Dive Profile is accessed by right-clicking while the mouse cursor is over the Dive Profile panel. The menu allows the creation of Bookmarks or Gas Change Event markers other than the ones that might have been imported from a Dive Computer. Markers are placed against the depth profile line and with the time of the event set by where the mouse cursor was when the right mouse button was initially clicked to bring up the menu. Gas Change events open a further selection of which gas is being switched to, the list based on the available gases defined in the Equipment Tab. By right-clicking while over an existing marker, the menu extends adding options to allow deletion of the marker or to allow all markers of that type to be hidden.
+The context menu for the Dive Profile is accessed by right-clicking while the mouse cursor is over the Dive Profile panel. The menu allows the creation of Bookmarks or Gas Change Event markers other than the ones that might have been imported from a Dive Computer. Markers are placed against the depth profile line and with the time of the event set by where the mouse cursor was when the right mouse button was initially clicked to bring up the menu. Gas Change events open a further selection of which gas is being switched to, the list based on the available gases defined in the Equipment Tab. By right-clicking while over an existing marker, the menu extends adding options to allow deletion of the marker or to allow all markers of that type to be hidden. Hidden events can be restored to view by selecteing Unhide all events from the context menu.
 
 === The *Information Box*
 
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 19fe81d..f3bb3ba 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -161,6 +161,17 @@ void ProfileGraphicsView::contextMenuEvent(QContextMenuEvent* event)
 		m.addAction(action);
 		break;
 	}
+	bool some_hidden = false;
+	for (int i = 0; i < evn_used; i++) {
+		if (ev_namelist[i].plot_ev == false) {
+			some_hidden = true;
+			break;
+		}
+	}
+	if (some_hidden) {
+		action = m.addAction(tr("Unhde all events"), this, SLOT(unhideEvents()));
+		action->setData(event->globalPos());
+	}	
 	m.exec(event->globalPos());
 }
 
@@ -213,6 +224,15 @@ void ProfileGraphicsView::hideEvents()
 	}
 }
 
+void ProfileGraphicsView::unhideEvents()
+{
+	QAction *action = qobject_cast<QAction*>(sender());
+	for (int i = 0; i < evn_used; i++) {
+		ev_namelist[i].plot_ev = true;
+	}
+	plot(current_dive, TRUE);
+}
+
 void ProfileGraphicsView::removeEvent()
 {
 	QAction *action = qobject_cast<QAction*>(sender());
diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h
index 29315a7..c9d1ef2 100644
--- a/qt-ui/profilegraphics.h
+++ b/qt-ui/profilegraphics.h
@@ -150,6 +150,7 @@ public slots:
 	void on_scaleAction();
 	void changeGas();
 	void hideEvents();
+	void unhideEvents();
 	void removeEvent();
 	void addBookmark();
 private:
-- 
1.8.5.1



More information about the subsurface mailing list