|
SVN commit 1204275 by mklapetek:
Add a button to tags sidebar, that will allow to assign the changes to all versions of a particular image. So far the button is enabled only when 1 image is selected. But I'm not too happy with the new button layout, does anyone have any better idea of how to place these? CCMAIL:[hidden email] M +64 -5 imagedescedittab.cpp M +1 -0 imagedescedittab.h --- branches/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.cpp #1204274:1204275 @@ -65,6 +65,8 @@ #include "statusprogressbar.h" #include "tagmodificationhelper.h" #include "template.h" +#include "imageinfolist.h" +#include "imageinfo.h" namespace Digikam { @@ -94,6 +96,7 @@ assignedTagsBtn = 0; applyBtn = 0; revertBtn = 0; + applyToAllVersionsButton = 0; recentTagsMapper = 0; newTagEdit = 0; lastSelectedWidget = 0; @@ -118,6 +121,7 @@ QPushButton* applyBtn; QPushButton* moreButton; + QPushButton* applyToAllVersionsButton; QWidget* lastSelectedWidget; @@ -225,6 +229,15 @@ // Buttons ----------------------------------------- + KHBox* applyButtonBox = new KHBox(this); + applyButtonBox->setSpacing(KDialog::spacingHint()); + + d->applyBtn = new QPushButton(i18n("Apply"), applyButtonBox); + d->applyBtn->setIcon(SmallIcon("dialog-ok-apply")); + d->applyBtn->setEnabled(false); + d->applyBtn->setToolTip( i18n("Apply all changes to images")); + //buttonsBox->setStretchFactor(d->applyBtn, 10); + KHBox* buttonsBox = new KHBox(this); buttonsBox->setSpacing(KDialog::spacingHint()); @@ -233,11 +246,10 @@ d->revertBtn->setToolTip( i18n("Revert all changes")); d->revertBtn->setEnabled(false); - d->applyBtn = new QPushButton(i18n("Apply"), buttonsBox); - d->applyBtn->setIcon(SmallIcon("dialog-ok-apply")); - d->applyBtn->setEnabled(false); - d->applyBtn->setToolTip( i18n("Apply all changes to images")); - buttonsBox->setStretchFactor(d->applyBtn, 10); + d->applyToAllVersionsButton = new QPushButton(i18n("Apply to all versions"), buttonsBox); + d->applyToAllVersionsButton->setIcon(SmallIcon("dialog-ok-apply")); + d->applyToAllVersionsButton->setEnabled(false); + d->applyToAllVersionsButton->setToolTip(i18n("Apply all changes to all versions of this image")); d->moreButton = new QPushButton(i18n("More"), buttonsBox); d->moreMenu = new KMenu(captionTagsArea); @@ -309,6 +321,9 @@ connect(d->applyBtn, SIGNAL(clicked()), this, SLOT(slotApplyAllChanges())); + connect(d->applyToAllVersionsButton, SIGNAL(clicked()), + this, SLOT(slotApplyChangesToAllVersions())); + connect(d->revertBtn, SIGNAL(clicked()), this, SLOT(slotRevertAllChanges())); @@ -530,6 +545,7 @@ d->hub.resetChanged(); d->applyBtn->setEnabled(false); d->revertBtn->setEnabled(false); + d->applyToAllVersionsButton->setEnabled(false); } void ImageDescEditTab::slotRevertAllChanges() @@ -755,7 +771,12 @@ d->modified = true; d->applyBtn->setEnabled(true); d->revertBtn->setEnabled(true); + + if(d->currInfos.size() == 1) + { + d->applyToAllVersionsButton->setEnabled(true); } +} void ImageDescEditTab::slotCreateNewTag() { @@ -1158,4 +1179,42 @@ d->lastSelectedWidget = 0; } +void ImageDescEditTab::slotApplyChangesToAllVersions() +{ + if (!d->modified) + { + return; + } + + if (d->currInfos.isEmpty()) + { + return; + } + + QSet<qlonglong> tmpSet; + QList<QPair<qlonglong, qlonglong> > relations; + + foreach(const ImageInfo& info, d->currInfos) + { + // Collect all ids in all image's relations + relations.append(info.relationCloud()); + } + + for(int i = 0; i < relations.size(); i++) + { + // Use QSet to prevent duplicates + tmpSet.insert(relations.at(i).first); + tmpSet.insert(relations.at(i).second); + } + + MetadataManager::instance()->applyMetadata(ImageInfoList(tmpSet.toList()), d->hub); + + d->modified = false; + d->hub.resetChanged(); + d->applyBtn->setEnabled(false); + d->revertBtn->setEnabled(false); + d->applyToAllVersionsButton->setEnabled(false); +} + + } // namespace Digikam --- branches/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.h #1204274:1204275 @@ -99,6 +99,7 @@ private Q_SLOTS: void slotApplyAllChanges(); + void slotApplyChangesToAllVersions(); void slotRevertAllChanges(); void slotChangingItems(); void slotTagsSearchChanged(const SearchTextSettings& settings); _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
| Free forum by Nabble | Edit this page |
