https://bugs.kde.org/show_bug.cgi?id=466468

            Bug ID: 466468
           Summary: Implement a spinbox for byte values respecting
                    BinaryUnitDialect
    Classification: Frameworks and Libraries
           Product: frameworks-kcoreaddons
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: mp...@kde.org
          Reporter: k...@huftis.org
                CC: kdelibs-b...@kde.org
  Target Milestone: ---

There is a need for a QSpinBox for byte values (bytes, KiB, kB, MiB, MB etc.)
that supports BinaryUnitDialect (see bug 364321) and localisation (KFormat does
supoprt localisation,
https://api.kde.org/frameworks/kcoreaddons/html/classKFormat.html). Suggested
name: KByteSpinBox

The idea is that it would hold a byte value, but it would be formatted as
either bytes, KiB, kB, MiB, MB etc. depending on the user’s BinaryUnitDialect
and language/locale settings. In other words, when displaying the byte value,
it would be divided 1000, 1024 etc., and the suffix would be set to kB/KB/KiB.

This is needed in Dolphin (bug 453853), Konqueror (bug 466257) and probably
other applications too.

It should be possible to specify a fixed ‘major’ unit (e.g., *always* shows the
value as KiB/kB/KB, even for very large values) or have the widget (by default)
automatically choose the unit based on the value (bytes for values < 1000 or
1024, kB/KiB for larger values, MB/MiB for even larger values), cf. the
AutoAdjust feature in KFormat::UnitPrefix.

Advantages:
* BinaryUnitDialect would be respected (bug 364321)
* The unit suffix would be automatically localised
* The implementation of byte value widgets in applications would be simpler:
  * No need for manually dividing by 1000, 1024 etc. in various functions
  * No need for manually handling large ranges (e.g., from bytes to GiB)
  * No need for manually formatting the values when getting/setting byte
values, adding/stripping suffixes

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to