Bug 340581

Summary: Ratings with rating == 0 cannot be selected on the left sidebar [patch]
Product: [Applications] digikam Reporter: Maik Qualmann <metzpinguin>
Component: Tags-RatingAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, mohammed.ahmed.anwer, px79
Priority: NOR    
Version: 4.4.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 4.5.0
Sentry Crash Report:
Attachments: Rating
albumlabelstreeview.patch
databaseworkeriface.patch
albumlabelstreeview2.patch

Description Maik Qualmann 2014-11-02 18:17:06 UTC
Images are imported with rating == -1 (no rating). If the rating changed and then deleted, is the rating == 0. This images cannot be selected on the left sidebar.

Reproducible: Always
Comment 1 Maik Qualmann 2014-11-02 18:18:00 UTC
Created attachment 89404 [details]
Rating
Comment 2 Maik Qualmann 2014-11-02 18:18:47 UTC
Created attachment 89405 [details]
albumlabelstreeview.patch
Comment 3 caulier.gilles 2014-11-02 19:32:15 UTC
Mohamed,

What do you think about this patch please ?

Gilles Caulier
Comment 4 Mohamed 2014-11-02 20:27:52 UTC
Hi all,

I don't mind implementing this patch, But it will add the "0 Rating" to digikam, So I think digikam will need more work to implement the "0 Rating" everywhere.

But there is another way: We can simply change the "0 rated images" into "-1 rated images" so we can search for "images without rating" from the labels tree view.

Thanks,
Mohamed Anwer
Comment 5 Maik Qualmann 2014-11-02 21:02:32 UTC
Hi,

this new Patch set rating == 0 to rating = -1

Thanks
Comment 6 Maik Qualmann 2014-11-02 21:03:14 UTC
Created attachment 89409 [details]
databaseworkeriface.patch
Comment 7 Mohamed 2014-11-02 21:10:42 UTC
(In reply to Maik Qualmann from comment #6)
> Created attachment 89409 [details]
> databaseworkeriface.patch

Much simpler.

Thanks
Mohamed Anwer
Comment 8 Mohamed 2014-11-02 21:17:09 UTC
Mr Gilles, 

I think the last patch is the simplest solution for the problem as I mentioned in my previous comment, It doesn't need to add the "0 Rating" to digiKam anyway.

Mohamed Anwer.
Comment 9 caulier.gilles 2014-11-02 21:51:57 UTC
Well, if patch is acceptable for you, feel free to apply it to git/master.

Q : does others part of digiKam which play with rating will be affected by this change ? For example, rating filter, rating assignment from Captions&Tags, rating from Advanced Search tool...

Gilles Caulier
Comment 10 Mohamed 2014-11-02 23:13:07 UTC
(In reply to Gilles Caulier from comment #9)
> Well, if patch is acceptable for you, feel free to apply it to git/master.
> 
> Q : does others part of digiKam which play with rating will be affected by
> this change ? For example, rating filter, rating assignment from
> Captions&Tags, rating from Advanced Search tool...
> 
> Gilles Caulier

OK, I'll test the patch and double check it's functionality as soon as possible
Comment 11 Maik Qualmann 2014-11-03 12:21:43 UTC
Hi,
please wait still with the patch, I might even be a better idea...
Comment 12 Mohamed 2014-11-03 12:45:27 UTC
(In reply to Maik Qualmann from comment #11)
> Hi,
> please wait still with the patch, I might even be a better idea...

OK, We are waiting...
We appreciate your work, Keep it up.

Thanks
Mohamed Anwer
Comment 13 Maik Qualmann 2014-11-03 18:28:03 UTC
Hi, 

is no rating selected, adds the patch "albumlabelstreeview2.patch" both ratings to list (0 and -1). It works fine for me.

Thanks
Comment 14 Maik Qualmann 2014-11-03 18:28:51 UTC
Created attachment 89422 [details]
albumlabelstreeview2.patch
Comment 15 Mohamed 2014-11-04 17:37:37 UTC
Git commit b8ccc7b36f033ddd17eec186fcfccad0c25cff6e by Mohamed Anwer.
Committed on 04/11/2014 at 17:36.
Pushed by mohamedanwer into branch 'master'.

M  +3    -2    app/album/albumlabelstreeview.cpp

http://commits.kde.org/digikam/b8ccc7b36f033ddd17eec186fcfccad0c25cff6e
Comment 16 Peter Albrecht 2015-01-17 13:22:29 UTC
(In reply to Mohamed from comment #4)
> I don't mind implementing this patch, But it will add the "0 Rating" to
> digikam, So I think digikam will need more work to implement the "0 Rating"
> everywhere.
> [...]

In digikam 4.4.0, there is already a "0 rating". Not in the "Labels" side view, but in "Advanced Search":

The options for "Rating" are:
  - (No value selected)   - meaning: ignore rating at all
  - No rating assigned    - meaning: no rating set
  - 0 stars                       - meaning: rating set to value 0
  - 1 star
  - 2 stars
  - 3 stars
  - 4 stars
  - 5 stars

The options "No rating assigned" and "0 stars" give different search results on my system.

I can move pictures from the "No rating" group to the "0 star rating" group with the keyboard shortcut "CTRL + 0".

Importing files from SD-card seems to set a small default XMP-section with "rating = 0". While importing via Copy&Paste seems to leave the image as is (no metadata -> no rating).
Comment 17 Mohamed 2015-01-17 14:22:19 UTC
(In reply to Peter Albrecht from comment #16)
> (In reply to Mohamed from comment #4)
> > I don't mind implementing this patch, But it will add the "0 Rating" to
> > digikam, So I think digikam will need more work to implement the "0 Rating"
> > everywhere.
> > [...]
> 
> In digikam 4.4.0, there is already a "0 rating". Not in the "Labels" side
> view, but in "Advanced Search":
> 
> The options for "Rating" are:
>   - (No value selected)   - meaning: ignore rating at all
>   - No rating assigned    - meaning: no rating set
>   - 0 stars                       - meaning: rating set to value 0
>   - 1 star
>   - 2 stars
>   - 3 stars
>   - 4 stars
>   - 5 stars
> 
> The options "No rating assigned" and "0 stars" give different search results
> on my system.
> 
> I can move pictures from the "No rating" group to the "0 star rating" group
> with the keyboard shortcut "CTRL + 0".
> 
> Importing files from SD-card seems to set a small default XMP-section with
> "rating = 0". While importing via Copy&Paste seems to leave the image as is
> (no metadata -> no rating).

You are right but from your point of view, What I meant is when you hover over a photo,  You can see the rating stars indicating the rating of this photo,

Can you differentiate between the (unrated) photo and the (0 rated) photo ? , No you can't.

That's what I mean by implementing the 0 rating, Even if it already exists in some parts of the code, But the user can't feel it, unless he use the advanced search window.

If we would implement this, I suggest adding another icon beside the rating stars to (Un-rate) the photo, Of course we must ask the community about this.

There are some plans in my head dedicated to digiKam, But I'm waiting until I finish my final exams.