Version: 0.9-svn 2006-08-06 (using KDE KDE 3.5.3) It's a quite simple feature, but imo really needed! When I process the raw files and then have a raw file (.nef) and a tiff (.tiff) and jpeg (.jpg) of the same image, and i want to look through them, i dont want to see the raws and tiffs, i just want to see the end result! So there should be a tab at the right which can filter the file type... Should be easy to implement, i hope, and add much to the usability for people working with different formats!
We could use the same File types as defined in Settings -> Mime Types: - Image - Movie - Audio - RAW Since we already have "Tag Filters" in the right sidebar, maybe we should just rename it to more generic "Filter" and have two sections: - Tag Filters - File Type Filters
SVN commit 728404 by cgilles: digiKam from KDE3 branch : added a mime type pattern selection to the Album GUI status bar to filter album content based on file mime type. Current options available are: - All files (default) - JPEG files - PNG files - TIFF files. - RAW files. - Movies files - Audio files This new feature can be used accordinly with the new Rating Filter tool and of course the Tags Filter sidebar tab. Of course digiKam remember MimeType/Rating Filter settings between sessions. A fresh screenshot can be seen at this url: http://digikam3rdparty.free.fr/Screenshots/ratingandmimetypefilters.png M +1 -0 Makefile.am M +61 -3 albumlister.cpp M +4 -0 albumlister.h M +17 -0 albumsettings.cpp M +3 -0 albumsettings.h M +19 -1 digikamapp.cpp M +1 -0 digikamapp.h M +3 -0 digikamappprivate.h AM mimefilter.cpp [License: GPL] AM mimefilter.h [License: GPL] M +1 -1 ratingfilter.cpp M +1 -1 ratingfilter.h --- branches/extragear/kde3/graphics/digikam/digikam/Makefile.am #728403:728404 @@ -77,6 +77,7 @@ kdatepickerpopup.cpp \ kipiinterface.cpp \ mediaplayerview.cpp \ + mimefilter.cpp \ monthwidget.cpp \ pixmapmanager.cpp \ ratingfilter.cpp \ --- branches/extragear/kde3/graphics/digikam/digikam/albumlister.cpp #728403:728404 @@ -7,6 +7,8 @@ * Description : Albums lister. * * Copyright (C) 2004-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * Copyright (C) 2007 by Gilles Caulier <caulier dot gilles at gmail dot com> + * Copyright (C) 2007 by Arnd Baecker <arnd dot baecker at web dot de> * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General @@ -58,6 +60,7 @@ #include "album.h" #include "albummanager.h" #include "albumsettings.h" +#include "mimefilter.h" #include "albumlister.h" #include "albumlister.moc" @@ -100,6 +103,8 @@ Album *currAlbum; + MimeFilter::TypeMimeFilter mimeTypeFilter; + AlbumLister::MatchingCondition matchingCond; AlbumLister::RatingCondition ratingCond; @@ -232,6 +237,12 @@ d->filterTimer->start(100, true); } +void AlbumLister::setMimeTypeFilter(int mimeTypeFilter) +{ + d->mimeTypeFilter = (MimeFilter::TypeMimeFilter)mimeTypeFilter; + d->filterTimer->start(100, true); +} + bool AlbumLister::matchesFilter(const ImageInfo* info) const { if (d->dayFilter.isEmpty() && d->tagFilter.isEmpty() && @@ -315,6 +326,56 @@ } } + QFileInfo fi(info->filePath()); + QString mimeType = fi.extension(false).upper(); + + // Filter by mime type. + switch(d->mimeTypeFilter) + { + case MimeFilter::JPGFiles: + { + if (mimeType != QString("JPG") && mimeType != QString("JPE") && + mimeType != QString("JPEG")) + match = false; + break; + } + case MimeFilter::PNGFiles: + { + if (mimeType != QString("PNG")) + match = false; + break; + } + case MimeFilter::TIFFiles: + { + if (mimeType != QString("TIF") && mimeType != QString("TIFF")) + match = false; + break; + } + case MimeFilter::RAWFiles: + { + QString rawFilesExt(AlbumSettings::instance()->getRawFileFilter()); + if (!rawFilesExt.upper().contains(mimeType)) + match = false; + break; + } + case MimeFilter::MoviesFiles: + { + QString moviesFilesExt(AlbumSettings::instance()->getMovieFileFilter()); + if (!moviesFilesExt.upper().contains(mimeType)) + match = false; + break; + } + case MimeFilter::AudioFiles: + { + QString audioFilesExt(AlbumSettings::instance()->getAudioFileFilter()); + if (!audioFilesExt.upper().contains(mimeType)) + match = false; + break; + } + default: // All Files: do nothing... + break; + } + return match; } @@ -489,6 +550,3 @@ } } // namespace Digikam - - - --- branches/extragear/kde3/graphics/digikam/digikam/albumlister.h #728403:728404 @@ -7,6 +7,8 @@ * Description : Albums lister. * * Copyright (C) 2004-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu> + * Copyright (C) 2007 by Gilles Caulier <caulier dot gilles at gmail dot com> + * Copyright (C) 2007 by Arnd Baecker <arnd dot baecker at web dot de> * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General @@ -105,6 +107,8 @@ bool showUnTagged=false); void setRatingFilter(int rating, const RatingCondition& ratingCond); + + void setMimeTypeFilter(int mimeTypeFilter); /** * Trigger a recreation of the given ImageInfo object --- branches/extragear/kde3/graphics/digikam/digikam/albumsettings.cpp #728403:728404 @@ -41,6 +41,7 @@ // Local includes. #include "thumbnailsize.h" +#include "mimefilter.h" #include "albumlister.h" #include "albumsettings.h" @@ -100,6 +101,7 @@ int thumbnailSize; int treeThumbnailSize; + int mimeTypeFilter; int ratingFilterValue; int ratingFilterCond; @@ -190,6 +192,8 @@ d->thumbnailSize = ThumbnailSize::Medium; d->treeThumbnailSize = 32; + d->mimeTypeFilter = MimeFilter::AllFiles; + d->ratingFilterValue = 0; d->ratingFilterCond = AlbumLister::GreaterEqualCondition; @@ -274,6 +278,8 @@ d->treeThumbnailSize = config->readNumEntry("Default Tree Icon Size", ThumbnailSize::Tiny); d->currentTheme = config->readEntry("Theme", i18n("Default")); + d->mimeTypeFilter = config->readNumEntry("Mime Type Filter", MimeFilter::AllFiles); + d->ratingFilterValue = config->readNumEntry("Rating Filter Value", 0); d->ratingFilterCond = config->readNumEntry("Rating Filter Condition", AlbumLister::GreaterEqualCondition); @@ -362,6 +368,7 @@ config->writeEntry("Raw File Filter", d->rawFilefilter); config->writeEntry("Default Icon Size", QString::number(d->thumbnailSize)); config->writeEntry("Default Tree Icon Size", QString::number(d->treeThumbnailSize)); + config->writeEntry("Mime Type Filter", d->mimeTypeFilter); config->writeEntry("Rating Filter Value", d->ratingFilterValue); config->writeEntry("Rating Filter Condition", d->ratingFilterCond); config->writeEntry("Theme", d->currentTheme); @@ -598,6 +605,16 @@ return ((d->treeThumbnailSize < 8) || (d->treeThumbnailSize > 48)) ? 48 : d->treeThumbnailSize; } +void AlbumSettings::setMimeTypeFilter(int val) +{ + d->mimeTypeFilter = val; +} + +int AlbumSettings::getMimeTypeFilter() const +{ + return d->mimeTypeFilter; +} + void AlbumSettings::setRatingFilterValue(int val) { d->ratingFilterValue = val; --- branches/extragear/kde3/graphics/digikam/digikam/albumsettings.h #728403:728404 @@ -119,6 +119,9 @@ void setDefaultTreeIconSize(int val); int getDefaultTreeIconSize() const; + void setMimeTypeFilter(int val); + int getMimeTypeFilter() const; + void setRatingFilterValue(int val); int getRatingFilterValue() const; --- branches/extragear/kde3/graphics/digikam/digikam/digikamapp.cpp #728403:728404 @@ -196,7 +196,8 @@ if (d->view) delete d->view; - d->albumSettings->setRatingFilterCond(d->statusRatingFilterBar->RatingFilterCondition()); + d->albumSettings->setMimeTypeFilter(d->statusMimeFilterBar->mimeFilter()); + d->albumSettings->setRatingFilterCond(d->statusRatingFilterBar->ratingFilterCondition()); d->albumSettings->setRatingFilterValue(d->statusRatingFilterBar->rating()); d->albumSettings->saveSettings(); delete d->albumSettings; @@ -361,6 +362,12 @@ //------------------------------------------------------------------------------ + d->statusMimeFilterBar = new MimeFilter(statusBar()); + d->statusMimeFilterBar->setMaximumHeight(fontMetrics().height()+2); + statusBar()->addWidget(d->statusMimeFilterBar, 1, true); + + //------------------------------------------------------------------------------ + QHBox *hbox = new QHBox(statusBar()); d->statusRatingFilterBar = new RatingFilter(hbox); hbox->setMaximumHeight(fontMetrics().height()+2); @@ -383,6 +390,9 @@ connect(d->statusRatingFilterBar, SIGNAL(signalRatingFilterChanged(int, AlbumLister::RatingCondition)), this, SLOT(slotRatingFilterChanged(int, AlbumLister::RatingCondition))); + connect(d->statusMimeFilterBar, SIGNAL(activated(int)), + this, SLOT(slotMimeTypeFilterChanged(int))); + connect(d->statusZoomBar, SIGNAL(signalZoomMinusClicked()), d->view, SLOT(slotZoomOut())); @@ -995,6 +1005,9 @@ d->albumSortAction->setCurrentItem((int)d->albumSettings->getAlbumSortOrder()); d->imageSortAction->setCurrentItem((int)d->albumSettings->getImageSortOrder()); + + d->statusMimeFilterBar->setMimeFilter(d->albumSettings->getMimeTypeFilter()); + d->statusRatingFilterBar->setRating(d->albumSettings->getRatingFilterValue()); // Setting the filter condition also updates the tooltip. // (So `setRating` is called first, as otherwise the filter value is not respected). @@ -1913,6 +1926,11 @@ AlbumLister::instance()->setRatingFilter(rating, cond); } +void DigikamApp::slotMimeTypeFilterChanged(int mimeTypeFilter) +{ + AlbumLister::instance()->setMimeTypeFilter(mimeTypeFilter); +} + void DigikamApp::slotZoomSliderChanged(int size) { d->view->setThumbSize(size); --- branches/extragear/kde3/graphics/digikam/digikam/digikamapp.h #728403:728404 @@ -122,6 +122,7 @@ void slotShowKipiHelp(); void slotDonateMoney(); void slotRatingFilterChanged(int, AlbumLister::RatingCondition); + void slotMimeTypeFilterChanged(int); void slotAboutToShowForwardMenu(); void slotAboutToShowBackwardMenu(); --- branches/extragear/kde3/graphics/digikam/digikam/digikamappprivate.h #728403:728404 @@ -54,6 +54,7 @@ #include "statusnavigatebar.h" #include "digikamview.h" #include "ratingfilter.h" +#include "mimefilter.h" class KToolBarPopupAction; class KToggleAction; @@ -136,6 +137,7 @@ kipiInterface = 0; cameraList = 0; statusProgressBar = 0; + statusMimeFilterBar = 0; statusRatingFilterBar = 0; statusNavigateBar = 0; statusZoomBar = 0; @@ -252,6 +254,7 @@ StatusProgressBar *statusProgressBar; StatusNavigateBar *statusNavigateBar; RatingFilter *statusRatingFilterBar; + MimeFilter *statusMimeFilterBar; KIPI::PluginLoader *kipiPluginLoader; }; ** branches/extragear/kde3/graphics/digikam/digikam/mimefilter.cpp #property svn:eol-style + native ** branches/extragear/kde3/graphics/digikam/digikam/mimefilter.h #property svn:eol-style + native --- branches/extragear/kde3/graphics/digikam/digikam/ratingfilter.cpp #728403:728404 @@ -104,7 +104,7 @@ slotRatingChanged(); } -AlbumLister::RatingCondition RatingFilter::RatingFilterCondition() +AlbumLister::RatingCondition RatingFilter::ratingFilterCondition() { return d->filterCond; } --- branches/extragear/kde3/graphics/digikam/digikam/ratingfilter.h #728403:728404 @@ -45,7 +45,7 @@ ~RatingFilter(); void setRatingFilterCondition(AlbumLister::RatingCondition cond); - AlbumLister::RatingCondition RatingFilterCondition(); + AlbumLister::RatingCondition ratingFilterCondition(); signals:
To close this file, patch #728404 need to be ported to KDE4... Gilles
SVN commit 728420 by cgilles: digiKam from trunk (KDE4) : backport commit #728404 from KDE3 branch BUG: 131963 M +1 -0 CMakeLists.txt M +61 -0 albumlister.cpp M +2 -0 albumlister.h M +118 -98 albumsettings.cpp M +3 -0 albumsettings.h M +15 -0 digikamapp.cpp M +1 -0 digikamapp.h M +94 -90 digikamappprivate.h AM mimefilter.cpp [License: GPL] AM mimefilter.h [License: GPL] WebSVN link: http://websvn.kde.org/?view=rev&revision=728420