Context menu support for images

Guido Lerch guido.lerch at gmail.com
Tue Oct 20 13:39:12 PDT 2015


could not resist, this patch adds adding images from file and web.

-- 
Best regards,
Guido
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20151020/1230a18b/attachment.html>
-------------- next part --------------
From f7594fbbd54197abb7a20b65cc8d394afc8f07e8 Mon Sep 17 00:00:00 2001
From: Guido Lerch <guido.lerch at gmail.com>
Date: Tue, 20 Oct 2015 22:36:59 +0200
Subject: [PATCH 7/7] Context menu support for images

Adding loading from file and loading from web.

Signed-off-by: Guido Lerch <guido.lerch at gmail.com>
---
 qt-ui/maintab.cpp | 13 +++++++++++++
 qt-ui/maintab.h   |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 57e9a36..8a9f2c7 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -1584,6 +1584,16 @@ void MainTab::removeAllPhotos()
 	}
 }
 
+void MainTab::addPhotosFromFile()
+{
+	MainWindow::instance()->dive_list()->loadImages();
+}
+
+void MainTab::addPhotosFromURL()
+{
+	MainWindow::instance()->dive_list()->loadWebImages();
+}
+
 #define SHOW_SELECTIVE(_component) \
 	if (what._component)       \
 		ui._component->setText(displayed_dive._component);
@@ -1627,6 +1637,9 @@ void MainTab::showAndTriggerEditSelective(struct dive_components what)
 void MainTab::contextMenuEvent(QContextMenuEvent *event)
 {
 	QMenu popup(this);
+	popup.addAction(tr("Load image(s) from file(s)"), this, SLOT(addPhotosFromFile()));
+	popup.addAction(tr("Load image(s) from web"), this, SLOT(addPhotosFromURL()));
+	popup.addSeparator();
 	popup.addAction(tr("Delete selected images"), this, SLOT(removeSelectedPhotos()));
 	popup.addAction(tr("Delete all images"), this, SLOT(removeAllPhotos()));
 	QAction *actionTaken = popup.exec(event->globalPos());
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index c3f6649..d4f7aaa 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -98,6 +98,8 @@ slots:
 	void photoDoubleClicked(const QString filePath);
 	void removeSelectedPhotos();
 	void removeAllPhotos();
+	void addPhotosFromFile();
+	void addPhotosFromURL();
 	void showLocation();
 	void enableGeoLookupEdition();
 	void disableGeoLookupEdition();
-- 
2.3.8 (Apple Git-58)



More information about the subsurface mailing list