Bug 416446

Summary: Import dialog: wrong pop-up media capacity in status bar.
Product: [Applications] digikam Reporter: Michael Hähnel <m.haehnel>
Component: Import-MainViewAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version First Reported In: 8.2.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In: 8.2.0
Sentry Crash Report:

Description Michael Hähnel 2020-01-19 11:21:01 UTC
SUMMARY
In import dialog main window (Import from card reader) in the status line on buttom of dialog there are the two fields "Camera media" and "Album Library" ( use German interface language: "Kameramedium", "Albumbibliothek"). When hovering the mouse pointer on either fields there pops up a mouse menu telling about available and needed file storage space. All numbers a mixed up in meaning and unit, hence display wrong values.

STEPS TO REPRODUCE
1. Open import dialog: main menu --> Import --> Card Reader.
2. Select import media
3. hover mouse over the two percentage values in status line

OBSERVED RESULT
Camera Media: (64GB memory card plugged into card reader, 2.4 GiB space used)
Display Values:
  Capacity: 64.0 MiB (display as Mega...)
  Available: 2.4 GiB

Album library:
Display Values:
  Capacity: 2.1 GiB
  Available: 2.5 GiB
  Needed: 28.1 MiB

EXPECTED RESULT
Camera Media: (64GB memory card plugged into card reader, 2.4 GiB space used)
Correct values should be :
  Capacity: 64.0 GiB (show as Giga...)
  Available: 61.6 GiB or different label when using displayed value "Space used": 2.4 GiB

Album library:
Correct values should be (256 GiB harddrive with 26.3 GiB free space (after import of the pictures from card reader) if I understand correctly:
  Capacity: 256 GiB or different label when using displayed value "Space needed: 2.1 GiB
  Available: I am not sure what should be expressed
  Needed: I am not sure what should be expressed. Likely the space available an hard drive.


SOFTWARE/OS VERSIONS
Windows: 10 Version 1909 (Build 18363.592)
KDE Frameworks Version:  5.61.0
Qt Version: 5.13.1 (kompiliert gegen 5.13.1)

ADDITIONAL INFORMATION
Comment 1 Maik Qualmann 2020-01-19 12:29:25 UTC
So, here on Linux the information is correct. Tested under Windows with the system drive C: the information is also correct. My VM for Windows has no USB support, I will test it tomorrow on a real Windows computer. There could be a bug in the Solid API on Windows that we use for these tasks.

Maik
Comment 2 Maik Qualmann 2020-01-19 12:35:29 UTC
Correction, the information from the system drive C: Windows are also incorrect, i.e. Windows-specific problem from Solid.

Maik
Comment 3 caulier.gilles 2022-01-09 21:53:12 UTC
Hi Michael and happy new year,

Can you check if problem remain with digiKam 7.5.0 pre-release Windows installer available
here :

https://files.kde.org/digikam/

Thanks in advance

Gilles Caulier
Comment 4 Michael Hähnel 2022-01-10 20:56:24 UTC
Hi Gilles,

thanks and Happy New Year to you as well.

I have installed latest DigiKam 7.5.0 as an update to 7.0.0.:
Build date: 10.01.2022 11:14 (target: RelWithDebInfo)
Rev.: 87fce0c873575d19c87f395c514cee7fe5e1c302

I inserted a SD-Card with capacity of 59.4 GB and an occupied space of 57.1 MB according to windows drive properties.  
DigiKam displays in import dialog status bar for camera medium:
Capacity: 3.4 GB
Available: 3.4 GB
For the status bar field "Albumbibliothek" (German interface language)
Capcity: 2.1 GB
Available: 3.5

Both values are wrong. I can not guess what numbers are displayed.

Second test with some USB-Stick: Capacity 29.2 GB, occupied 168 MB.
Statusbar display for camera medium:
Capacity: 1.3 GB
Available: 1.1 GB
--> Again, for my some random numbers.

Only correct number appears, is when I select files for download. In this case the sum of files sizes disaply correctly in field "Albumbibliothek"

Cheers
Michael
Comment 5 Michael Hähnel 2022-11-06 18:34:05 UTC
Hi,
still does not work. Still wrong numbers. Digikam 7.8.
Michael
Comment 6 caulier.gilles 2023-04-29 19:31:14 UTC
@Michael,

digiKam 8.0.0 is out. This entry still valid with this release ?

Best regards

Gilles Caulier
Comment 7 caulier.gilles 2023-10-15 12:32:18 UTC
@Michael,


This problem still reproducible with the new digiKam 8.2.0 pre-release Windows
installer available at usual place:

https://files.kde.org/digikam/

This new bundle is based on last Qt framework 5.15.11 and KDE framework 5.110.

Thanks in advance

Gilles Caulier
Comment 8 Michael Hähnel 2023-10-24 20:22:11 UTC
Hi Gilles,

I am afraid, no. Still wrong values:
SD-Card with 64 GB (Windows Explorer says: 64.189.628.416 Byte or 59,7 GB capacity; 57,1 GB free, 2,63 GB allocated) inserted.
DigiKam displays in statusbar in Import dialog for Camera Medium: 
4% and on mouse-over menu Capacity: 3.8 GiB and Available: 1.1 GiB.
The value "4%" is ok, if this stands for allocated volume. But mouse-over values are wrong.

Best regards and thanks for the over-all work! Love using DigiKam
Michael
Comment 9 Michael Hähnel 2023-10-24 20:24:08 UTC
sorry: tested digikam version: 8.2.0, Revision: 6ba286200a56bd479ed60ac8a06a9a6dde101b88
Michael
Comment 10 Maik Qualmann 2023-10-25 06:32:22 UTC
Git commit c9676c76538875498dbe05d465933227575fb664 by Maik Qualmann.
Committed on 25/10/2023 at 08:30.
Pushed by mqualmann into branch 'master'.

replace unsigned long with qin64, long is only 32 bit on Windows

M  +1    -1    core/utilities/import/main/importui.cpp
M  +28   -27   core/utilities/import/widgets/freespacewidget.cpp
M  +11   -11   core/utilities/import/widgets/freespacewidget.h

https://invent.kde.org/graphics/digikam/-/commit/c9676c76538875498dbe05d465933227575fb664
Comment 11 Maik Qualmann 2023-10-25 06:40:15 UTC
Further corrections are necessary, we calculate with KB because we only assumed memory cards with MB size. We have to calculate bytes throughout. I'll fix it tonight.

Maik
Comment 12 Maik Qualmann 2023-10-25 17:27:56 UTC
Git commit fba1c0ea02f6d99385350cc0c7c120750bd397dc by Maik Qualmann.
Committed on 25/10/2023 at 19:27.
Pushed by mqualmann into branch 'master'.

use int64 bytes for camera storage size

M  +4    -4    core/utilities/import/backend/cameracontroller.cpp
M  +2    -2    core/utilities/import/backend/cameracontroller.h
M  +1    -1    core/utilities/import/backend/dkcamera.h
M  +9    -10   core/utilities/import/backend/gpcamera.cpp
M  +1    -1    core/utilities/import/backend/gpcamera.h
M  +1    -1    core/utilities/import/backend/umscamera.cpp
M  +1    -1    core/utilities/import/backend/umscamera.h
M  +29   -32   core/utilities/import/main/importui.cpp
M  +2    -2    core/utilities/import/main/importui.h
M  +56   -56   core/utilities/import/widgets/freespacewidget.cpp
M  +11   -11   core/utilities/import/widgets/freespacewidget.h

https://invent.kde.org/graphics/digikam/-/commit/fba1c0ea02f6d99385350cc0c7c120750bd397dc