Bug 331240

Summary: Provide a GUI setting to configure the size cut-off for local folder previews
Product: [Applications] dolphin Reporter: richlv
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: a403910, dev, elvis.angelaccio, harogaston, michal.dybczak, nate, tosiara, utkarshupadhyaya5, wbauer1
Priority: NOR Keywords: junior-jobs
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=341276
https://bugs.kde.org/show_bug.cgi?id=238690
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: testcase image
Dolphin - define maximum file size for preview

Description richlv 2014-02-17 16:15:20 UTC
this is a followup report from bug #330868

there seems to be a hardcoded limit of 3mb which cuts off image previews on the folder (showing previews for contained images). for example, if the image is 3106009 bytes, preview is shown, if it's 3230231 bytes - not shown.

images are from the same camera and have the same settings. this has been showing with a fairly large amount of images

Reproducible: Always
Comment 1 richlv 2014-02-17 16:22:48 UTC
Created attachment 85196 [details]
testcase image
Comment 2 richlv 2014-02-17 16:26:32 UTC
this is a companion bug to bug #331242 (preview in file properties)
Comment 3 bugtractor 2014-03-26 20:56:27 UTC
I'm having the same issue. We've got a folder of ~5MB/piece JPEG files. When I look at the folder in Dolphin, the previews work. However, when I go to that folder from a Dolphin file browser window created by another program (for example, the "File Upload" dialog in Firefox), there are no previews shown. However, previews are shown for other folders, which have images of around ~1MB/piece, in both the "File Upload" dialog and in Dolphin.

So there seems to be some file size limit which is being imposed on some file browser windows, but not on others. I'd guess there's probably a work-around by changing the file size setting which used to be in KDE, but I don't know where that setting is stored in order to change in manually.
Comment 4 tosiara 2014-11-30 14:17:27 UTC
That issue is in openSUSE since 12.3
To workaround you must specify MaximumSize manually in .kde4/share/config/kdeglobals

Like this:

[PreviewSettings]
MaximumSize=10000000
Comment 5 Wolfgang Bauer 2014-11-30 16:25:13 UTC
(In reply to tosiara from comment #4)
> That issue is in openSUSE since 12.3
> To workaround you must specify MaximumSize manually in
> .kde4/share/config/kdeglobals

openSUSE sets MaximumSize=31457280 in /etc/kde4/share/config/kdeglobals.

Still, the KDE default is 5MiB, and there's no way to change this without manually editing the config file AFAICT.
See https://projects.kde.org/projects/kde/kde-runtime/repository/revisions/master/entry/kioslave/thumbnail/thumbnail.cpp#L480

So this bug is about the missing possibility to configure it in the GUI, IIUIC.
Comment 6 Nate Graham 2018-06-15 02:01:47 UTC
No longer an issue for most file types, but still an issue for videos. Let's close this and track that remaining issue with Bug 238690.
Comment 7 Nate Graham 2019-02-21 19:41:16 UTC
*** Bug 404657 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2019-02-21 19:41:29 UTC
Not actually fixed, sorry.
Comment 9 Michał Dybczak 2019-02-21 19:45:37 UTC
I can confirm it on the Plasma 5.15 on Manjaro, so it's still happening after all these years.

Operating System: Manjaro Linux 
KDE Plasma Version: 5.15.1
KDE Frameworks Version: 5.55.0
Qt Version: 5.12.1
Kernel Version: 4.20.10-1-MANJARO
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 7,7 GiB
Comment 10 Nate Graham 2019-02-21 19:49:14 UTC
Yeah, I'm working on it now.
Comment 11 Nate Graham 2019-03-16 21:26:07 UTC
This is strange. With seemingly identical settings, I am able to reproduce the issue on my Manjaro machine, but not my Neon machine.
Comment 12 Wolfgang Bauer 2019-03-17 11:36:53 UTC
(In reply to Nate Graham from comment #11)
> This is strange. With seemingly identical settings, I am able to reproduce
> the issue on my Manjaro machine, but not my Neon machine.

Maybe there's a global or local config file (e.g. /etc/xdg/kdeglobals, ~/.config/kdeglobals) that sets MaximumSize?

https://cgit.kde.org/kio-extras.git/commit/?id=1b334712ed0fd2d81b4aa1478acca3bd4630948b only changed the default to unlimited, it didn't remove the config option completely.
Comment 13 Nate Graham 2019-03-17 15:33:51 UTC
Oh jeez, there it is, right there in /etc/xdg/kdeglobals. Now it works for me everywhere.

I guess this bug is still about exposing this somewhere in the GUI, so we'll keep it open for that.
Comment 14 Michał Dybczak 2019-03-18 19:04:51 UTC
Yeah, that works. I increased the value in /etc/xdg/kdeglobals and the preview was generated. Awesome :). So it's only a matter of waiting for the GUI option :).
Comment 15 Wolfgang Bauer 2019-03-19 14:23:46 UTC
(In reply to Michał Dybczak from comment #14)
> So it's only a matter of waiting for the
> GUI option :).

Or ask your distribution to not ship /etc/xdg/kdeglobals (with that setting at least)...
Comment 16 Michał Dybczak 2020-02-18 17:22:37 UTC
Created attachment 126135 [details]
Dolphin - define maximum file size for preview

This is fixed with Plasma 5.18.0.

Now in Dolphin settings there is a place to define maximum file size to get the previews. See the attachement.
Comment 17 Nate Graham 2020-02-18 17:25:05 UTC
That's been there for ages. :) It only affects preview generation for remote files (Samba, SFTP, etc).

Also Dolphin is not distributed with Plasma; it's on the Release Service schedule; see https://community.kde.org/Schedules.
Comment 18 Michał Dybczak 2020-02-18 18:56:50 UTC
As to the Dolphin's releases, I totally forgot. I remember Plasma version but apps or frameworks version numbers... I have to check every time.

When you said it only affected the preview generation for remote files, what did you mean?

The topic says "local folder previews" and my bug report was a duplicate of this one, so I should know what this bug is about. And if you meant that the GUI I showed was for remote files this doesn't make sense either.
Comment 19 Michał Dybczak 2020-02-18 19:02:17 UTC
Ah, you're right. I somehow didn't notice the word "remote" in the description.

This is super strange because the local preview is also by default limited to 3MB and there is GUI to set it for remote files (which is used rarely) but there is nothing for local files? This preview card is the exact place I would look for that local setting.

I'm surprised that this isn't resolved yet. The settings are there, the GUI is almost there, it's a matter of adding another sentence and checkbox that would be referring to LOCAL preview. Sure, this is a crude GUI solution and this needs some rewrite but it's better than nothing.
Comment 20 Nate Graham 2020-02-18 19:15:58 UTC
Or you could just make the checkbox affect local files as well as remote files.

Either one doesn't seem too hard. Wanna try your hand at it? :) I can help!
Comment 21 Michał Dybczak 2020-02-18 20:06:20 UTC
I'm not sure if I have time for it. I'm sure that it's fairly easy, but for a complete newbie, each steps requires pointers, reading, trying, etc. so in the end result at least few hours. So much time I have only on weekends and not on every weekend.

Plus, I would need an assistance as well. I've never made any commit to gitlab and that's also something to learn. I like to provide feedback, but coding and similar stuff are completely foreign things to me, so I'm not sure if that "easy" thing is not a huge undertaking for me.

At the moment I have only ideas of the steps I would have to take and those look like a fuzzy cloud.

Also, this kind of activity have a point if I was able to develop my skills somehow and help with other things in the future. I'm not sure if I want to spend time on it since I'm currently focused on my work and that takes most of my time. I'm torn. Fun doesn't always have a point... ;) Hmm... but my works is also fun so it beats many side projects.

If you are available on some chat services (IRC?) and we could synchronize despite different time zones, then maybe. I'll think about it.
Comment 22 pingala98 2020-03-13 16:06:41 UTC
(In reply to Nate Graham from comment #20)
> Or you could just make the checkbox affect local files as well as remote
> files.
> 
> Either one doesn't seem too hard. Wanna try your hand at it? :) I can help!

I tried to build it, I am actually quite new to this, so as far as I understood I built the UI (which is perfect) and made code to write the setting MaximumSize in the kdeglobals file, but its not doing what its supposed to do.
I am using KDE neon and its showing all thumbnails no matter what limit I set in the field. (also by default there was no field names MaximumSize in kdeglobals)
  
Here are my changes: https://phabricator.kde.org/D27976
I would be grateful if you can guide me right direction.(In reply to Nate Graham from comment #20)
> Or you could just make the checkbox affect local files as well as remote
> files.
> 
> Either one doesn't seem too hard. Wanna try your hand at it? :) I can help!
Comment 23 Gastón Haro 2020-03-29 11:33:55 UTC
Hi all! I have sent a patch https://phabricator.kde.org/D28402 but currently it has a flaw. It is that it doesn't pick up all the configuration changes 'on the fly' but only after restarting Dolphin.

If the check "Local files" is checked then the file size limit affects immediately. But changes to the checkbox itself only take effect after restarting dolphing. I know why it happens but I couldn't code a solution. Maybe Nate can give me a hand or point to someone that can.

Cheers!
Comment 24 Nate Graham 2020-06-09 17:06:02 UTC
Git commit 0f0d14d4c236eee7f1df4f0c21c60f6b784dab75 by Nate Graham, on behalf of Gastón Haro.
Committed on 09/06/2020 at 17:05.
Pushed by ngraham into branch 'master'.

Provide ability to configure size cut-off for local file previews

Summary:
FileWidgets read from kdeglobals the property "MaximumSize" under "PreviewSettings" to decide if a preview will be generated for that file.
There is no current GUI to change that file size limit. On the other hand Dolphin ignores it.

This patch aims to fix that by adding new configuration options to Dolphin. That is a new spinbox in Dolphin settings under General -> Previews tab.

Test Plan:
1 - Set up a local folder with 2 jpg images of less and more than 1 MB respectively.
2 - Go to Dolphin Preferences. General -> Previews and check "JPEG Images" from
    the list. And set "Skip previews for files above:" to 1MB.
3 - Navigate to the afore mentioned folder. Only the image of size less than 1 MB should
    show a preview.

Reviewers: ngraham, #dolphin, meven, elvisangelaccio

Reviewed By: ngraham, #dolphin, meven, elvisangelaccio

Subscribers: cfeck, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D28402

M  +12   -0    src/kitemviews/kfileitemlistview.cpp
M  +11   -0    src/kitemviews/kfileitemlistview.h
M  +14   -2    src/kitemviews/kfileitemmodelrolesupdater.cpp
M  +12   -0    src/kitemviews/kfileitemmodelrolesupdater.h
M  +37   -8    src/settings/general/previewssettingspage.cpp
M  +1    -0    src/settings/general/previewssettingspage.h
M  +1    -1    src/views/dolphinitemlistview.cpp

https://invent.kde.org/system/dolphin/commit/0f0d14d4c236eee7f1df4f0c21c60f6b784dab75
Comment 25 Michał Dybczak 2020-10-24 07:56:02 UTC
I know that this is marked as resolved/fixed, but I want to clear something out.

If I check Dolphin settings, I find in Preview settings an option that is a solution provided here:

Omit preview for files above: X value


Previously, when there was no GUI, we had to manually change:

/etc/xdg/kdeglobals

So I checked the current value in my system:

[PreviewSettings]
MaximumSize=19145728


Then played with the GUI settings, and the value stayed the same, as if the GUI option was not linked to it. It's very possible that this was moved to use settings under ~/.config somewhere, because /etc/ provides defaults, but where?

Thank you for clarification.
Comment 26 Gastón Haro 2020-10-25 02:38:26 UTC
(In reply to Michał Dybczak from comment #25)
> I know that this is marked as resolved/fixed, but I want to clear something
> out.
> 
> If I check Dolphin settings, I find in Preview settings an option that is a
> solution provided here:
> 
> Omit preview for files above: X value
> 
> 
> Previously, when there was no GUI, we had to manually change:
> 
> /etc/xdg/kdeglobals
> 
> So I checked the current value in my system:
> 
> [PreviewSettings]
> MaximumSize=19145728
> 
> 
> Then played with the GUI settings, and the value stayed the same, as if the
> GUI option was not linked to it. It's very possible that this was moved to
> use settings under ~/.config somewhere, because /etc/ provides defaults, but
> where?
> 
> Thank you for clarification.

The configuration file should be located at ~/.config/kdeglobals
Comment 27 Michał Dybczak 2020-10-25 06:51:28 UTC
Thanks! This is exactly what I was looking for. The GUI is properly changing this in mentioned config.