2015-10-20 23:55 GMT+02:00 Dirk Hohndel <[email protected]>: > For 4.5.1 I'm not sure... it does change user visible behavior, would > require new strings, user manual updates... I'd say no. > But once I cut 4.5.1 I will take this for 4.6 > I wish you could consider this for 4.5.1. Yes it does add strings, depending on how our translation works only 2, worst case 4.
> > /D > > On Tue, Oct 20, 2015 at 10:08:29PM +0200, Guido Lerch wrote: > > adding context menu to images for multi selection deletion and deleting > all > > images. > > > > ideally we add a menu for adding dives as well but I have not done this > > yet, waiting for > > you input. > > > > purpose of this: usability > > > > is someone working on getting images and eventually multi format files in > > to git yet ? > > > > -- > > Best regards, > > Guido > > > From 65241f94f08ebcd5165d488067b32ba64c0620dc Mon Sep 17 00:00:00 2001 > > From: Guido Lerch <[email protected]> > > Date: Tue, 20 Oct 2015 21:02:41 +0200 > > Subject: [PATCH 1/6] Adding context menu to Images > > > > Allowing to delete selected or all photos from the > > dive images > > > > Signed-off-by: Guido Lerch <[email protected]> > > --- > > qt-ui/maintab.cpp | 9 +++++++++ > > qt-ui/maintab.h | 1 + > > 2 files changed, 10 insertions(+) > > > > diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp > > index 0afb7b4..a1f0438 100644 > > --- a/qt-ui/maintab.cpp > > +++ b/qt-ui/maintab.cpp > > @@ -1610,3 +1610,12 @@ void MainTab::showAndTriggerEditSelective(struct > dive_components what) > > weightModel->changed = true; > > } > > } > > + > > +void MainTab::contextMenuEvent(QContextMenuEvent *event) > > +{ > > + QMenu popup(this); > > + popup.addAction(tr("Delete selected images"), this, > SLOT(removeSelectedPhotos())); > > + popup.addAction(tr("Delete all images"), this, > SLOT(removeAllPhotos())); > > + QAction *actionTaken = popup.exec(event->globalPos()); > > + event->accept(); > > +} > > diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h > > index 20b4da6..7b2bb86 100644 > > --- a/qt-ui/maintab.h > > +++ b/qt-ui/maintab.h > > @@ -54,6 +54,7 @@ public: > > void refreshDisplayedDiveSite(); > > void nextInputField(QKeyEvent *event); > > void showAndTriggerEditSelective(struct dive_components what); > > + void contextMenuEvent(QContextMenuEvent *event); > > > > signals: > > void addDiveFinished(); > > -- > > 2.3.8 (Apple Git-58) > > > > > From bf989a642f9bb50cf6cf6f266fb0f8407f3916c9 Mon Sep 17 00:00:00 2001 > > From: Guido Lerch <[email protected]> > > Date: Tue, 20 Oct 2015 21:03:53 +0200 > > Subject: [PATCH 2/6] Context menu support for images > > > > Altering DivePicture model to allow deleting images > > from the QListView without immediate updating of the > > list. Updating is determined by an additioanl parameter > > > > Signed-off-by: Guido Lerch <[email protected]> > > --- > > qt-models/divepicturemodel.cpp | 10 ++++++---- > > qt-models/divepicturemodel.h | 2 +- > > 2 files changed, 7 insertions(+), 5 deletions(-) > > > > diff --git a/qt-models/divepicturemodel.cpp > b/qt-models/divepicturemodel.cpp > > index 1f37423..bb5db33 100644 > > --- a/qt-models/divepicturemodel.cpp > > +++ b/qt-models/divepicturemodel.cpp > > @@ -111,12 +111,14 @@ QVariant DivePictureModel::data(const QModelIndex > &index, int role) const > > return ret; > > } > > > > -void DivePictureModel::removePicture(const QString &fileUrl) > > +void DivePictureModel::removePicture(const QString &fileUrl, bool last) > > { > > dive_remove_picture(fileUrl.toUtf8().data()); > > - copy_dive(current_dive, &displayed_dive); > > - updateDivePictures(); > > - mark_divelist_changed(true); > > + if (last) { > > + copy_dive(current_dive, &displayed_dive); > > + updateDivePictures(); > > + mark_divelist_changed(true); > > + } > > } > > > > int DivePictureModel::rowCount(const QModelIndex &parent) const > > diff --git a/qt-models/divepicturemodel.h b/qt-models/divepicturemodel.h > > index d6393e4..7390fc5 100644 > > --- a/qt-models/divepicturemodel.h > > +++ b/qt-models/divepicturemodel.h > > @@ -33,7 +33,7 @@ public: > > virtual int rowCount(const QModelIndex &parent = QModelIndex()) > const; > > virtual void updateDivePictures(); > > void updateDivePicturesWhenDone(QList<QFuture<void> >); > > - void removePicture(const QString& fileUrl); > > + void removePicture(const QString& fileUrl, bool last); > > > > protected: > > DivePictureModel(); > > -- > > 2.3.8 (Apple Git-58) > > > > > From a62e8f94408dded8cff07d8bec3c8cefb50200ff Mon Sep 17 00:00:00 2001 > > From: Guido Lerch <[email protected]> > > Date: Tue, 20 Oct 2015 21:07:43 +0200 > > Subject: [PATCH 3/6] Context menu support for images > > > > removing obsolete code > > > > Signed-off-by: Guido Lerch <[email protected]> > > --- > > qt-ui/maintab.cpp | 7 ------- > > 1 file changed, 7 deletions(-) > > > > diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp > > index a1f0438..595e9da 100644 > > --- a/qt-ui/maintab.cpp > > +++ b/qt-ui/maintab.cpp > > @@ -177,13 +177,6 @@ MainTab::MainTab(QWidget *parent) : > QTabWidget(parent), > > > ui.cylinders->view()->horizontalHeader()->addAction(action); > > } > > > > - QAction *deletePhoto = new QAction(this); > > - deletePhoto->setShortcut(Qt::Key_Delete); > > - deletePhoto->setShortcutContext(Qt::WidgetShortcut); > > - ui.photosView->addAction(deletePhoto); > > - > ui.photosView->setSelectionMode(QAbstractItemView::SingleSelection); > > - connect(deletePhoto, SIGNAL(triggered(bool)), this, > SLOT(removeSelectedPhotos())); > > - > > ui.waitingSpinner->setRoundness(70.0); > > ui.waitingSpinner->setMinimumTrailOpacity(15.0); > > ui.waitingSpinner->setTrailFadePercentage(70.0); > > -- > > 2.3.8 (Apple Git-58) > > > > > From f7f3e711262989f2ae095fc49af173b3c1909167 Mon Sep 17 00:00:00 2001 > > From: Guido Lerch <[email protected]> > > Date: Tue, 20 Oct 2015 21:08:59 +0200 > > Subject: [PATCH 4/6] Context menu support for images > > > > Adding modified code to support deletion of selected images as > > well as deleting of all images (with warning messagebox) > > > > Signed-off-by: Guido Lerch <[email protected]> > > --- > > qt-ui/maintab.cpp | 25 ++++++++++++++++++++++--- > > qt-ui/maintab.h | 1 + > > 2 files changed, 23 insertions(+), 3 deletions(-) > > > > diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp > > index 595e9da..88f7903 100644 > > --- a/qt-ui/maintab.cpp > > +++ b/qt-ui/maintab.cpp > > @@ -1556,12 +1556,31 @@ void MainTab::photoDoubleClicked(const QString > filePath) > > > > void MainTab::removeSelectedPhotos() > > { > > + bool last = false; > > if (!ui.photosView->selectionModel()->hasSelection()) > > return; > > + QModelIndexList indexes = > ui.photosView->selectionModel()->selectedRows(); > > + if (indexes.count() == 0) > > + indexes = > ui.photosView->selectionModel()->selectedIndexes(); > > + QModelIndex photo = indexes.first(); > > + do { > > + photo = indexes.first(); > > + last = indexes.count() == 1; > > + if (photo.isValid()) { > > + QString fileUrl = > photo.data(Qt::DisplayPropertyRole).toString(); > > + if (fileUrl.length() > 0) > > + > DivePictureModel::instance()->removePicture(fileUrl, last); > > + } > > + indexes.removeFirst(); > > + } while(!indexes.isEmpty()); > > +} > > > > - QModelIndex photoIndex = > ui.photosView->selectionModel()->selectedIndexes().first(); > > - QString fileUrl = > photoIndex.data(Qt::DisplayPropertyRole).toString(); > > - DivePictureModel::instance()->removePicture(fileUrl); > > +void MainTab::removeAllPhotos() > > +{ > > + if (QMessageBox::warning(this, tr("Deleting Images"), tr("Are you > sure you want to delete all images?"), QMessageBox::Cancel | > QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Cancel ) { > > + ui.photosView->selectAll(); > > + removeSelectedPhotos(); > > + } > > } > > > > #define SHOW_SELECTIVE(_component) \ > > diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h > > index 7b2bb86..c3f6649 100644 > > --- a/qt-ui/maintab.h > > +++ b/qt-ui/maintab.h > > @@ -97,6 +97,7 @@ slots: > > void escDetected(void); > > void photoDoubleClicked(const QString filePath); > > void removeSelectedPhotos(); > > + void removeAllPhotos(); > > void showLocation(); > > void enableGeoLookupEdition(); > > void disableGeoLookupEdition(); > > -- > > 2.3.8 (Apple Git-58) > > > > > From 16905ded34691e42655de562147a4e6e456cf4c4 Mon Sep 17 00:00:00 2001 > > From: Guido Lerch <[email protected]> > > Date: Tue, 20 Oct 2015 21:10:44 +0200 > > Subject: [PATCH 5/6] Context menu support for images > > > > Required change within DivePictureItem, adding update > > parameter defaulted to true in this case. > > > > Signed-off-by: Guido Lerch <[email protected]> > > --- > > qt-ui/profile/divepixmapitem.cpp | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/qt-ui/profile/divepixmapitem.cpp > b/qt-ui/profile/divepixmapitem.cpp > > index 581f6f9..2be21ae 100644 > > --- a/qt-ui/profile/divepixmapitem.cpp > > +++ b/qt-ui/profile/divepixmapitem.cpp > > @@ -126,5 +126,5 @@ void > DivePictureItem::mousePressEvent(QGraphicsSceneMouseEvent *event) > > > > void DivePictureItem::removePicture() > > { > > - DivePictureModel::instance()->removePicture(fileUrl); > > + DivePictureModel::instance()->removePicture(fileUrl, true); > > } > > -- > > 2.3.8 (Apple Git-58) > > > > > From 8e48d93bf256e74ce2b483d2a11f71b8734fe12c Mon Sep 17 00:00:00 2001 > > From: Guido Lerch <[email protected]> > > Date: Tue, 20 Oct 2015 22:04:40 +0200 > > Subject: [PATCH 6/6] Context menu suport for images > > > > Enabling multi selection > > > > Signed-off-by: Guido Lerch <[email protected]> > > --- > > qt-ui/maintab.cpp | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp > > index 88f7903..57e9a36 100644 > > --- a/qt-ui/maintab.cpp > > +++ b/qt-ui/maintab.cpp > > @@ -198,6 +198,7 @@ MainTab::MainTab(QWidget *parent) : > QTabWidget(parent), > > acceptingEdit = false; > > > > ui.diveTripLocation->hide(); > > + ui.photosView->setSelectionMode(QAbstractItemView::MultiSelection); > > } > > > > MainTab::~MainTab() > > -- > > 2.3.8 (Apple Git-58) > > > > > _______________________________________________ > > subsurface mailing list > > [email protected] > > http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface > > -- Best regards, Guido
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
