[Digikam-devel] [digikam/development/2.0] digikam/items: Remaining glue code to make grouping work.
Marcel Wiesweg
marcel.wiesweg at gmx.de
Sun Feb 27 21:06:08 GMT 2011
Git commit 05b535ee33d61a201dc4dcd0e2b126da8c7cfccd by Marcel Wiesweg.
Committed on 27/02/2011 at 21:58.
Pushed by mwiesweg into branch 'development/2.0'.
Remaining glue code to make grouping work.
Current status:
There is basic support for grouping by drag-drop and context menu.
TODO: The visual representation is to be improved - we'll probably need some
custom drawing, as there are no suitable icons. Some visual indication
for items that come from opened groups.
The actions are very context-sensitive, so adding to the main menu
is not straight-forward.
CCMAIL: digikam-devel at kde.org
M +31 -0 digikam/items/digikamimageview.cpp
M +4 -0 digikam/items/digikamimageview.h
http://commits.kde.org/digikam/05b535ee33d61a201dc4dcd0e2b126da8c7cfccd
diff --git a/digikam/items/digikamimageview.cpp b/digikam/items/digikamimageview.cpp
index 0e1af91..f1384e2 100644
--- a/digikam/items/digikamimageview.cpp
+++ b/digikam/items/digikamimageview.cpp
@@ -137,6 +137,9 @@ DigikamImageView::DigikamImageView(QWidget* parent)
connect(imageModel()->dragDropHandler(), SIGNAL(assignTags(const QList<ImageInfo>&, const QList<int>&)),
MetadataManager::instance(), SLOT(assignTags(const QList<ImageInfo>&, const QList<int>&)));
+ connect(imageModel()->dragDropHandler(), SIGNAL(addToGroup(const ImageInfo&, const QList<ImageInfo>&)),
+ MetadataManager::instance(), SLOT(addToGroup(const ImageInfo&, const QList<ImageInfo>&)));
+
connect(imageModel()->dragDropHandler(), SIGNAL(dioResult(KJob*)),
d->utilities, SLOT(slotDIOResult(KJob*)));
@@ -257,6 +260,7 @@ void DigikamImageView::showContextMenuOnInfo(QContextMenuEvent* event, const Ima
DPopupMenu popmenu(this);
ContextMenuHelper cmhelper(&popmenu);
+ cmhelper.setImageFilterModel(imageFilterModel());
cmhelper.addAction("move_selection_to_album");
cmhelper.addAction(viewAction);
@@ -285,6 +289,7 @@ void DigikamImageView::showContextMenuOnInfo(QContextMenuEvent* event, const Ima
cmhelper.addSeparator();
// --------------------------------------------------------
cmhelper.addLabelsAction();
+ cmhelper.addGroupMenu(selectedImageIDs);
// special action handling --------------------------------
@@ -321,6 +326,15 @@ void DigikamImageView::showContextMenuOnInfo(QContextMenuEvent* event, const Ima
connect(&cmhelper, SIGNAL(signalAddToExistingQueue(int)),
this, SLOT(insertSelectedToExistingQueue(int)));
+ connect(&cmhelper, SIGNAL(signalCreateGroup()),
+ this, SLOT(createGroupFromSelection()));
+
+ connect(&cmhelper, SIGNAL(signalUngroup()),
+ this, SLOT(ungroupSelected()));
+
+ connect(&cmhelper, SIGNAL(signalRemoveFromGroup()),
+ this, SLOT(removeSelectedFromGroup()));
+
// --------------------------------------------------------
QAction* choice = cmhelper.exec(event->globalPos());
@@ -554,6 +568,23 @@ void DigikamImageView::createNewAlbumForSelected()
d->utilities->createNewAlbumForInfos(selectedImageInfos(), currentAlbum());
}
+void DigikamImageView::createGroupFromSelection()
+{
+ QList<ImageInfo> selectedInfos = selectedImageInfosCurrentFirst();
+ ImageInfo groupLeader = selectedInfos.takeFirst();
+ MetadataManager::instance()->addToGroup(groupLeader, selectedInfos);
+}
+
+void DigikamImageView::ungroupSelected()
+{
+ MetadataManager::instance()->ungroup(selectedImageInfos());
+}
+
+void DigikamImageView::removeSelectedFromGroup()
+{
+ MetadataManager::instance()->removeFromGroup(selectedImageInfos());
+}
+
void DigikamImageView::setExifOrientationOfSelected(int orientation)
{
MetadataManager::instance()->setExifOrientation(selectedImageInfos(), orientation);
diff --git a/digikam/items/digikamimageview.h b/digikam/items/digikamimageview.h
index 8fab7cd..dd0f60f 100644
--- a/digikam/items/digikamimageview.h
+++ b/digikam/items/digikamimageview.h
@@ -84,6 +84,10 @@ public Q_SLOTS:
void assignRating(const QModelIndex& index, int rating);
void assignTag(const QModelIndex& index, const QString& name);
+ void createGroupFromSelection();
+ void ungroupSelected();
+ void removeSelectedFromGroup();
+
void setFaceMode(bool on);
void addRejectionOverlay(ImageDelegate* delegate = 0);
void addTagEditOverlay(ImageDelegate* delegate = 0);
More information about the Digikam-devel
mailing list