Context menu for images: add loading from file / web

Signed-off-by: Guido Lerch <guido.lerch@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Guido Lerch 2015-10-20 22:36:59 +02:00 committed by Dirk Hohndel
parent b73b312673
commit fb24210ad9
2 changed files with 15 additions and 0 deletions

View file

@ -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) \ #define SHOW_SELECTIVE(_component) \
if (what._component) \ if (what._component) \
ui._component->setText(displayed_dive._component); ui._component->setText(displayed_dive._component);
@ -1627,6 +1637,9 @@ void MainTab::showAndTriggerEditSelective(struct dive_components what)
void MainTab::contextMenuEvent(QContextMenuEvent *event) void MainTab::contextMenuEvent(QContextMenuEvent *event)
{ {
QMenu popup(this); 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 selected images"), this, SLOT(removeSelectedPhotos()));
popup.addAction(tr("Delete all images"), this, SLOT(removeAllPhotos())); popup.addAction(tr("Delete all images"), this, SLOT(removeAllPhotos()));
QAction *actionTaken = popup.exec(event->globalPos()); QAction *actionTaken = popup.exec(event->globalPos());

View file

@ -98,6 +98,8 @@ slots:
void photoDoubleClicked(const QString filePath); void photoDoubleClicked(const QString filePath);
void removeSelectedPhotos(); void removeSelectedPhotos();
void removeAllPhotos(); void removeAllPhotos();
void addPhotosFromFile();
void addPhotosFromURL();
void showLocation(); void showLocation();
void enableGeoLookupEdition(); void enableGeoLookupEdition();
void disableGeoLookupEdition(); void disableGeoLookupEdition();