[Digikam-devel] Re: [digikam/development/2.0] /: Move Rating filter from statusbar to Tags Filter view from right sidebar.
Johannes Wienke
jwienke at techfak.uni-bielefeld.de
Wed Feb 16 12:01:09 GMT 2011
Hey,
I thought we have an open feature request to move all filtering to the
status bar?
Johannes
On 02/16/2011 12:58 PM, Gilles Caulier wrote:
> Git commit 91a71c0e48780b572ea0c8320c96af6d1a9e8f90 by Gilles Caulier.
> Committed on 16/02/2011 at 12:49.
> Pushed by cgilles into branch 'development/2.0'.
>
> Move Rating filter from statusbar to Tags Filter view from right sidebar.
> As Rating is considerated as a Labels (like Pick or Color), it need to be moved near Pick/Color Label filters.
>
> Note that i plan to move all filters from status bar to right Sidebar and rename "Tag Filters" as "Filters", and to add
> 2 buttons on status bar :
> "Reset" to clean all active filters
> "Settings" (or something like that) to switch on "Filters" panel from right sidebar.
>
> The advantage to use "Filters" panel from right side bar is to be able to host more filters in the future.
> Status bar is limited in space to host more settings. There are a lots of whishes about this subject in bugzilla.
>
> CCBUGS: 241847
>
> M +6 -32 digikam/albumiconviewfilter.cpp
> M +2 -5 digikam/albumiconviewfilter.h
> M +0 -6 digikam/digikamapp.cpp
> M +5 -5 digikam/digikamview.cpp
> M +18 -2 digikam/tagfiltersidebarwidget.cpp
> M +5 -2 digikam/tagfiltersidebarwidget.h
> M +1 -0 digikam/tags/colorlabelfilter.cpp
> M +1 -0 digikam/tags/picklabelfilter.cpp
> M +7 -7 libs/imageproperties/imagedescedittab.cpp
> M +12 -2 libs/models/imagefiltersettings.cpp
> M +3 -1 libs/models/imagefiltersettings.h
>
> http://commits.kde.org/digikam/91a71c0e48780b572ea0c8320c96af6d1a9e8f90
>
> diff --git a/digikam/albumiconviewfilter.cpp b/digikam/albumiconviewfilter.cpp
> index b3f2f7c..08a4bfd 100644
> --- a/digikam/albumiconviewfilter.cpp
> +++ b/digikam/albumiconviewfilter.cpp
> @@ -23,6 +23,10 @@
>
> #include "albumiconviewfilter.moc"
>
> +// Qt includes
> +
> +#include <QMouseEvent>
> +
> // KDE includes
>
> #include <klocale.h>
> @@ -30,8 +34,6 @@
>
> // Local includes
>
> -#include "albumsettings.h"
> -#include "ratingfilter.h"
> #include "mimefilter.h"
> #include "statusled.h"
>
> @@ -46,14 +48,12 @@ public:
> {
> textFilter = 0;
> mimeFilter = 0;
> - ratingFilter = 0;
> led = 0;
> }
>
> SearchTextBar* textFilter;
> StatusLed* led;
> MimeFilter* mimeFilter;
> - RatingFilter* ratingFilter;
> ImageFilterSettings settings;
> };
>
> @@ -78,9 +78,7 @@ AlbumIconViewFilter::AlbumIconViewFilter(QWidget* parent)
> "file names, captions (comments), and tags"));
>
> d->mimeFilter = new MimeFilter(this);
> - d->ratingFilter = new RatingFilter(this);
>
> - layout()->setAlignment(d->ratingFilter, Qt::AlignCenter);
> setSpacing(KDialog::spacingHint());
> setMargin(0);
>
> @@ -89,9 +87,6 @@ AlbumIconViewFilter::AlbumIconViewFilter(QWidget* parent)
>
> connect(d->mimeFilter, SIGNAL(activated(int)),
> this, SIGNAL(mimeTypeFilterChanged(int)));
> -
> - connect(d->ratingFilter, SIGNAL(signalRatingFilterChanged(int, ImageFilterSettings::RatingCondition)),
> - this, SIGNAL(ratingFilterChanged(int, ImageFilterSettings::RatingCondition)));
> }
>
> AlbumIconViewFilter::~AlbumIconViewFilter()
> @@ -99,25 +94,6 @@ AlbumIconViewFilter::~AlbumIconViewFilter()
> delete d;
> }
>
> -void AlbumIconViewFilter::readSettings()
> -{
> - AlbumSettings* settings = AlbumSettings::instance();
> - d->ratingFilter->setRatingFilterCondition((Digikam::ImageFilterSettings::RatingCondition)
> - (settings->getRatingFilterCond()));
> - /*
> - Bug 181705: always enable filters
> - d->ratingFilter->setEnabled(settings->getIconShowRating());
> - d->textFilter->setEnabled(settings->getIconShowName() ||
> - settings->getIconShowComments() ||
> - settings->getIconShowTags());
> - */
> -}
> -
> -void AlbumIconViewFilter::saveSettings()
> -{
> - AlbumSettings::instance()->setRatingFilterCond(d->ratingFilter->ratingFilterCondition());
> -}
> -
> void AlbumIconViewFilter::slotFilterMatches(bool match)
> {
> QStringList filtersList;
> @@ -133,7 +109,7 @@ void AlbumIconViewFilter::slotFilterMatches(bool match)
> filtersList.append(i18n("<br/><nobr><i>Mime Type</i></nobr>"));
> }
>
> - if (d->ratingFilter->rating() != 0 || d->ratingFilter->ratingFilterCondition() != ImageFilterSettings::GreaterEqualCondition)
> + if (d->settings.isFilteringByRating())
> {
> filtersList.append(i18n("<br/><nobr><i>Rating</i></nobr>"));
> }
> @@ -198,10 +174,8 @@ bool AlbumIconViewFilter::eventFilter(QObject* object, QEvent* e)
> {
> // Reset all filters settings.
> d->textFilter->setText(QString());
> - d->ratingFilter->setRating(0);
> - d->ratingFilter->setRatingFilterCondition(ImageFilterSettings::GreaterEqualCondition);
> d->mimeFilter->setMimeFilter(MimeFilter::AllFiles);
> - emit resetTagFilters();
> + emit signalResetFilters();
> }
> }
>
> diff --git a/digikam/albumiconviewfilter.h b/digikam/albumiconviewfilter.h
> index b844507..43b9dbf 100644
> --- a/digikam/albumiconviewfilter.h
> +++ b/digikam/albumiconviewfilter.h
> @@ -27,6 +27,7 @@
> // Qt includes
>
> #include <QString>
> +#include <QEvent>
>
> // KDE includes
>
> @@ -52,9 +53,6 @@ public:
> AlbumIconViewFilter(QWidget* parent);
> ~AlbumIconViewFilter();
>
> - void readSettings();
> - void saveSettings();
> -
> public Q_SLOTS:
>
> void slotFilterMatches(bool);
> @@ -63,8 +61,7 @@ public Q_SLOTS:
>
> Q_SIGNALS:
>
> - void resetTagFilters();
> - void ratingFilterChanged(int, ImageFilterSettings::RatingCondition);
> + void signalResetFilters();
> void mimeTypeFilterChanged(int);
> void textFilterChanged(const SearchTextSettings&);
>
> diff --git a/digikam/digikamapp.cpp b/digikam/digikamapp.cpp
> index 7bcf83b..06af35b 100644
> --- a/digikam/digikamapp.cpp
> +++ b/digikam/digikamapp.cpp
> @@ -308,7 +308,6 @@ DigikamApp::~DigikamApp()
>
> delete d->view;
>
> - d->albumIconViewFilter->saveSettings();
> AlbumSettings::instance()->setRecurseAlbums(d->recurseAlbumsAction->isChecked());
> AlbumSettings::instance()->setRecurseTags(d->recurseTagsAction->isChecked());
> AlbumSettings::instance()->setShowThumbbar(d->showBarAction->isChecked());
> @@ -1328,10 +1327,6 @@ void DigikamApp::initGui()
> d->showBarAction->setChecked(AlbumSettings::instance()->getShowThumbbar());
> d->showMenuBarAction->setChecked(!menuBar()->isHidden()); // NOTE: workaround for B.K.O #171080
>
> - // Setting the filter condition also updates the tooltip.
> - // (So `setRating` is called first, as otherwise the filter value is not respected).
> - d->albumIconViewFilter->readSettings();
> -
> slotSwitchedToIconView();
> }
>
> @@ -2399,7 +2394,6 @@ void DigikamApp::slotSetupChanged()
> }
>
> d->view->applySettings();
> - d->albumIconViewFilter->readSettings();
>
> AlbumThumbnailLoader::instance()->setThumbnailSize(AlbumSettings::instance()->getTreeViewIconSize());
>
> diff --git a/digikam/digikamview.cpp b/digikam/digikamview.cpp
> index 4f2d725..b720df2 100644
> --- a/digikam/digikamview.cpp
> +++ b/digikam/digikamview.cpp
> @@ -455,6 +455,9 @@ void DigikamView::setupConnections()
> SLOT(setTagFilter(const QList<int>&, const QList<int>&,
> ImageFilterSettings::MatchingCondition, bool, const QList<int>&, const QList<int>&)));
>
> + connect(d->tagFilterWidget, SIGNAL(signalRatingFilterChanged(int, ImageFilterSettings::RatingCondition)),
> + d->iconView->imageAlbumFilterModel(), SLOT(setRatingFilter(int, ImageFilterSettings::RatingCondition)));
> +
> // -- Preview image widget Connections ------------------------
>
> connect(d->albumWidgetStack, SIGNAL(signalNextItem()),
> @@ -570,9 +573,6 @@ void DigikamView::connectIconViewFilter(AlbumIconViewFilter* filter)
> {
> ImageAlbumFilterModel* model = d->iconView->imageAlbumFilterModel();
>
> - connect(filter, SIGNAL(ratingFilterChanged(int, ImageFilterSettings::RatingCondition)),
> - model, SLOT(setRatingFilter(int, ImageFilterSettings::RatingCondition)));
> -
> connect(filter, SIGNAL(mimeTypeFilterChanged(int)),
> model, SLOT(setMimeTypeFilter(int)));
>
> @@ -588,8 +588,8 @@ void DigikamView::connectIconViewFilter(AlbumIconViewFilter* filter)
> connect(model, SIGNAL(filterSettingsChanged(const ImageFilterSettings&)),
> filter, SLOT(slotFilterSettingsChanged(const ImageFilterSettings&)));
>
> - connect(filter, SIGNAL(resetTagFilters()),
> - d->tagFilterWidget, SLOT(slotResetTagFilters()));
> + connect(filter, SIGNAL(signalResetFilters()),
> + d->tagFilterWidget, SLOT(slotResetFilters()));
> }
>
> void DigikamView::loadViewState()
> diff --git a/digikam/tagfiltersidebarwidget.cpp b/digikam/tagfiltersidebarwidget.cpp
> index 8af8e59..9f0f517 100644
> --- a/digikam/tagfiltersidebarwidget.cpp
> +++ b/digikam/tagfiltersidebarwidget.cpp
> @@ -38,11 +38,13 @@
>
> // Local includes
>
> +#include "albumsettings.h"
> #include "albummodel.h"
> #include "contextmenuhelper.h"
> #include "tagcheckview.h"
> #include "colorlabelfilter.h"
> #include "picklabelfilter.h"
> +#include "ratingfilter.h"
>
> namespace Digikam
> {
> @@ -166,6 +168,7 @@ public:
> tagFilterModel(0),
> colorLabelFilter(0),
> pickLabelFilter(0),
> + ratingFilter(0),
> withoutTagCheckBox(0),
> matchingConditionComboBox(0)
> {
> @@ -181,10 +184,10 @@ public:
>
> ColorLabelFilter* colorLabelFilter;
> PickLabelFilter* pickLabelFilter;
> + RatingFilter* ratingFilter;
>
> QCheckBox* withoutTagCheckBox;
> KComboBox* matchingConditionComboBox;
> -
> };
>
> const QString TagFilterSideBarWidget::TagFilterSideBarWidgetPriv::configLastShowUntaggedEntry("Show Untagged");
> @@ -232,7 +235,9 @@ TagFilterSideBarWidget::TagFilterSideBarWidget(QWidget* parent, TagModel* tagFil
>
> KHBox* hbox3 = new KHBox(this);
> d->pickLabelFilter = new PickLabelFilter(hbox3);
> + d->ratingFilter = new RatingFilter(hbox3);
> QLabel* space3 = new QLabel(hbox3);
> + hbox3->layout()->setAlignment(d->ratingFilter, Qt::AlignVCenter|Qt::AlignRight);
> hbox3->setStretchFactor(space3, 10);
> hbox3->setSpacing(0);
> hbox3->setMargin(0);
> @@ -263,6 +268,9 @@ TagFilterSideBarWidget::TagFilterSideBarWidget(QWidget* parent, TagModel* tagFil
>
> connect(d->matchingConditionComboBox, SIGNAL(currentIndexChanged(int)),
> this, SLOT(slotMatchingConditionChanged(int)));
> +
> + connect(d->ratingFilter, SIGNAL(signalRatingFilterChanged(int, ImageFilterSettings::RatingCondition)),
> + this, SIGNAL(signalRatingFilterChanged(int, ImageFilterSettings::RatingCondition)));
> }
>
> TagFilterSideBarWidget::~TagFilterSideBarWidget()
> @@ -270,11 +278,14 @@ TagFilterSideBarWidget::~TagFilterSideBarWidget()
> delete d;
> }
>
> -void TagFilterSideBarWidget::slotResetTagFilters()
> +void TagFilterSideBarWidget::slotResetFilters()
> {
> d->tagFilterView->slotResetCheckState();
> d->withoutTagCheckBox->setChecked(false);
> d->colorLabelFilter->reset();
> + d->pickLabelFilter->reset();
> + d->ratingFilter->setRating(0);
> + d->ratingFilter->setRatingFilterCondition(ImageFilterSettings::GreaterEqualCondition);
> }
>
> void TagFilterSideBarWidget::slotMatchingConditionChanged(int index)
> @@ -364,6 +375,9 @@ void TagFilterSideBarWidget::setConfigGroup(KConfigGroup group)
>
> void TagFilterSideBarWidget::doLoadState()
> {
> + d->ratingFilter->setRatingFilterCondition((Digikam::ImageFilterSettings::RatingCondition)
> + (AlbumSettings::instance()->getRatingFilterCond()));
> +
> d->matchingConditionComboBox->setCurrentIndex(getConfigGroup().readEntry(
> entryName(d->configMatchingConditionEntry), 0));
> d->tagFilterView->loadState();
> @@ -379,6 +393,8 @@ void TagFilterSideBarWidget::doLoadState()
>
> void TagFilterSideBarWidget::doSaveState()
> {
> + AlbumSettings::instance()->setRatingFilterCond(d->ratingFilter->ratingFilterCondition());
> +
> getConfigGroup().writeEntry(entryName(d->configMatchingConditionEntry),
> d->matchingConditionComboBox->currentIndex());
> d->tagFilterView->saveState();
> diff --git a/digikam/tagfiltersidebarwidget.h b/digikam/tagfiltersidebarwidget.h
> index 3da2d00..3195605 100644
> --- a/digikam/tagfiltersidebarwidget.h
> +++ b/digikam/tagfiltersidebarwidget.h
> @@ -123,12 +123,15 @@ Q_SIGNALS:
> ImageFilterSettings::MatchingCondition matchingCond, bool showUnTagged,
> const QList<int>& clTagIds, const QList<int>& plTagIds);
>
> + void signalRatingFilterChanged(int, ImageFilterSettings::RatingCondition);
> +
> +
> public Q_SLOTS:
>
> /**
> - * Resets all selected tag filters.
> + * Resets all selected filters.
> */
> - void slotResetTagFilters();
> + void slotResetFilters();
>
> private Q_SLOTS:
>
> diff --git a/digikam/tags/colorlabelfilter.cpp b/digikam/tags/colorlabelfilter.cpp
> index 15839ce..f1b302d 100644
> --- a/digikam/tags/colorlabelfilter.cpp
> +++ b/digikam/tags/colorlabelfilter.cpp
> @@ -54,6 +54,7 @@ ColorLabelFilter::~ColorLabelFilter()
> void ColorLabelFilter::reset()
> {
> setColorLabels(QList<ColorLabel>());
> + slotColorLabelSelectionChanged();
> }
>
> QList<TAlbum*> ColorLabelFilter::getCheckedColorLabelTags()
> diff --git a/digikam/tags/picklabelfilter.cpp b/digikam/tags/picklabelfilter.cpp
> index 0d46ba5..00afb32 100644
> --- a/digikam/tags/picklabelfilter.cpp
> +++ b/digikam/tags/picklabelfilter.cpp
> @@ -54,6 +54,7 @@ PickLabelFilter::~PickLabelFilter()
> void PickLabelFilter::reset()
> {
> setPickLabels(QList<PickLabel>());
> + slotPickLabelSelectionChanged();
> }
>
> QList<TAlbum*> PickLabelFilter::getCheckedPickLabelTags()
> diff --git a/libs/imageproperties/imagedescedittab.cpp b/libs/imageproperties/imagedescedittab.cpp
> index 3fb410c..98048df 100644
> --- a/libs/imageproperties/imagedescedittab.cpp
> +++ b/libs/imageproperties/imagedescedittab.cpp
> @@ -188,12 +188,12 @@ ImageDescEditTab::ImageDescEditTab(QWidget* parent)
> new QLabel(i18n("Date:"), dateBox);
> d->dateTimeEdit = new KDateTimeEdit(dateBox, "datepicker");
>
> - KHBox* ratingBox = new KHBox(captionTagsArea);
> - new QLabel(i18n("Labels:"), ratingBox);
> - d->pickLabelSelector = new PickLabelSelector(ratingBox);
> - d->colorLabelSelector = new ColorLabelSelector(ratingBox);
> - d->ratingWidget = new RatingWidget(ratingBox);
> - ratingBox->layout()->setAlignment(d->ratingWidget, Qt::AlignVCenter|Qt::AlignRight);
> + KHBox* labelsBox = new KHBox(captionTagsArea);
> + new QLabel(i18n("Labels:"), labelsBox);
> + d->pickLabelSelector = new PickLabelSelector(labelsBox);
> + d->colorLabelSelector = new ColorLabelSelector(labelsBox);
> + d->ratingWidget = new RatingWidget(labelsBox);
> + labelsBox->layout()->setAlignment(d->ratingWidget, Qt::AlignVCenter|Qt::AlignRight);
>
> // Tags view ---------------------------------------------------
>
> @@ -269,7 +269,7 @@ ImageDescEditTab::ImageDescEditTab(QWidget* parent)
>
> grid1->addWidget(d->captionsEdit, 0, 0, 1, 2);
> grid1->addWidget(dateBox, 1, 0, 1, 2);
> - grid1->addWidget(ratingBox, 2, 0, 1, 2);
> + grid1->addWidget(labelsBox, 2, 0, 1, 2);
> grid1->addWidget(d->newTagEdit, 3, 0, 1, 2);
> grid1->addWidget(d->tagCheckView, 4, 0, 1, 2);
> grid1->addWidget(tagsSearch, 5, 0, 1, 2);
> diff --git a/libs/models/imagefiltersettings.cpp b/libs/models/imagefiltersettings.cpp
> index eb77c1f..898238f 100644
> --- a/libs/models/imagefiltersettings.cpp
> +++ b/libs/models/imagefiltersettings.cpp
> @@ -48,8 +48,8 @@ ImageFilterSettings::ImageFilterSettings()
> untaggedFilter = false;
> ratingFilter = 0;
> mimeTypeFilter = MimeFilter::AllFiles;
> - ratingCond = ImageFilterSettings::GreaterEqualCondition;
> - matchingCond = ImageFilterSettings::OrCondition;
> + ratingCond = GreaterEqualCondition;
> + matchingCond = OrCondition;
> }
>
> void ImageFilterSettings::setDayFilter(const QList<QDateTime>& days)
> @@ -102,6 +102,16 @@ bool ImageFilterSettings::isFilteringByText() const
> return false;
> }
>
> +bool ImageFilterSettings::isFilteringByRating() const
> +{
> + if (ratingFilter != 0 || ratingCond != GreaterEqualCondition)
> + {
> + return true;
> + }
> +
> + return false;
> +}
> +
> bool ImageFilterSettings::isFiltering() const
> {
> return !dayFilter.isEmpty() || !includeTagFilter.isEmpty() || !excludeTagFilter.isEmpty() ||
> diff --git a/libs/models/imagefiltersettings.h b/libs/models/imagefiltersettings.h
> index 19cc979..c892d35 100644
> --- a/libs/models/imagefiltersettings.h
> +++ b/libs/models/imagefiltersettings.h
> @@ -117,9 +117,11 @@ public:
>
> /// --- Mime filter ---
>
> - MimeFilter::TypeMimeFilter mimeTypeFilter;
> + MimeFilter::TypeMimeFilter mimeTypeFilter;
> void setMimeTypeFilter(int mimeTypeFilter);
>
> + /// Returns if the rating is a filter criteria
> + bool isFilteringByRating() const;
> /// Returns if the pick labels is a filter criteria
> bool isFilteringByPickLabels() const;
> /// Returns if the color labels is a filter criteria
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/digikam-devel/attachments/20110216/f13456e2/attachment.sig>
More information about the Digikam-devel
mailing list