SVN commit 969241 by cgilles:
bugfix : LightTable : when items are loaded to lightTable and are removed from Album gui, we need to refresh light table contents CCMAIL: [hidden email] M +57 -0 lighttablebar.cpp M +6 -0 lighttablebar.h M +1 -2 lighttablewindow.cpp --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.cpp #969240:969241 @@ -61,6 +61,8 @@ #include "imageattributeswatch.h" #include "metadatahub.h" #include "ratingpopupmenu.h" +#include "databasewatch.h" +#include "databasechangesets.h" #include "themeengine.h" namespace Digikam @@ -100,6 +102,10 @@ { connect(this, SIGNAL(signalItemSelected(ThumbBarItem*)), this, SLOT(slotItemSelected(ThumbBarItem*))); + + connect(DatabaseAccess::databaseWatch(), SIGNAL(collectionImageChange(const CollectionImageChangeset&)), + this, SLOT(slotCollectionImageChange(const CollectionImageChangeset&)), + Qt::QueuedConnection); } LightTableBar::~LightTableBar() @@ -308,6 +314,32 @@ if (item) ThumbBarView::removeItem(item); } +ImagePreviewBarItem* LightTableBar::removeItemById(qlonglong id) +{ + ImagePreviewBarItem* ltItem = findItemById(id); + ThumbBarItem *item = dynamic_cast<ThumbBarItem*>(ltItem); + if (item) + { + ThumbBarView::removeItem(item); + return ltItem; + } + return 0; +} + +ImagePreviewBarItem* LightTableBar::findItemById(qlonglong id) const +{ + for (ThumbBarItem *item = firstItem(); item; item = item->next()) + { + ImagePreviewBarItem *ltItem = dynamic_cast<ImagePreviewBarItem*>(item); + if (ltItem) + { + if (ltItem->info().id() == id) + return ltItem; + } + } + return 0; +} + void LightTableBar::viewportPaintEvent(QPaintEvent* e) { ThemeEngine* te = ThemeEngine::instance(); @@ -649,6 +681,31 @@ } } +void LightTableBar::slotCollectionImageChange(const CollectionImageChangeset& changeset) +{ + // ignore when closed + if (!isVisible()) + return; + + switch(changeset.operation()) + { + case CollectionImageChangeset::Removed: + case CollectionImageChangeset::RemovedAll: + { + foreach(qlonglong id, changeset.ids()) + { + ImagePreviewBarItem* item = removeItemById(id); + emit signalRemoveItem(item->info()); + } + break; + } + default: + { + break; + } + } +} + // ------------------------------------------------------------------------- LightTableBarItem::LightTableBarItem(LightTableBar *view, const ImageInfo& info) --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablebar.h #969240:969241 @@ -31,6 +31,7 @@ namespace Digikam { +class CollectionImageChangeset; class LightTableBarItem; class LightTableBarItemPriv; class LightTableBarPriv; @@ -49,7 +50,10 @@ void setOnRightPanel(const ImageInfo& info); void removeItemByInfo(const ImageInfo& info); + ImagePreviewBarItem* removeItemById(qlonglong id); + ImagePreviewBarItem* findItemById(qlonglong id) const; + void setNavigateByPair(bool b); Q_SIGNALS: @@ -82,6 +86,8 @@ void slotAssignRatingFiveStar(); void slotAssignRating(int); + void slotCollectionImageChange(const CollectionImageChangeset&); + private: LightTableBarPriv* const d; --- trunk/extragear/graphics/digikam/utilities/lighttable/lighttablewindow.cpp #969240:969241 @@ -358,8 +358,7 @@ // -- FileWatch connections ------------------------------ - LoadingCacheInterface::connectToSignalFileChanged(this, - SLOT(slotFileChanged(const QString &))); + LoadingCacheInterface::connectToSignalFileChanged(this, SLOT(slotFileChanged(const QString&))); } void LightTableWindow::setupActions() _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |