Review Request 114187: KFormat - Add new KFormat class

Kevin Ottens ervin at kde.org
Fri Nov 29 08:36:15 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/114187/#review44768
-----------------------------------------------------------


Some extra comments.

I'm not exactly sure I get your concerns regarding the tr() use, to me it looks like it cover our needs here but I might be missing something.


tier1/kcoreaddons/src/lib/util/kformat.h
<http://git.reviewboard.kde.org/r/114187/#comment32007>

    In the vein of something used by value and not inheritable it should use Q_DECL_FINAL.



tier1/kcoreaddons/src/lib/util/kformat.h
<http://git.reviewboard.kde.org/r/114187/#comment32006>

    Is it really something we want to be able to inherit from? I think Alex's comment about not inheriting from QObject is right, in which case the virtual should be dropped here.
    
    This class really feels like something to be used by value and not inheritable.



tier1/kcoreaddons/src/lib/util/kformatprivate.cpp
<http://git.reviewboard.kde.org/r/114187/#comment32008>

    Definitely Q_ASSERT here. As for the compiler cleverness... depends on the gcc version, and I'm not sure if VS is clever enough for it.


- Kevin Ottens


On Nov. 28, 2013, 8 p.m., John Layt wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/114187/
> -----------------------------------------------------------
> 
> (Updated Nov. 28, 2013, 8 p.m.)
> 
> 
> Review request for KDE Frameworks, Albert Astals Cid, David Faure, and Kevin Ottens.
> 
> 
> Repository: kdelibs
> 
> 
> Description
> -------
> 
> KFormat - Add new KFormat class
> 
> KLocale offers a number of extra formatting options not yet available
> in Qt.  The KFormat class adds these options to KCoreAddons:
> 
> * formatByteSize()
> * formatDuration()
> * formatDecimalDuration()
> * formatSpelloutDuration()
> * formatRelativeDate()
> * formatRelativeDateTime()
> 
> The KFormat class can be initialised with any QLocale to use in the
> date and number formatting, or the default locale can be easily
> accessed via KFormat():
> 
>   QString result = KFormat().formatDuration(1000);
> 
> ----------------------------------------
> 
> There's a few things that need looking at here.  The main one is the translation stuff because I had to convert from using ki18n to tr and it may have lost something in the process.  In particular it looks like we'll actually need an en_US translation done to get the plurals right?  If we can't make tr() work for these we'll have to move the class into  k18n.  The second is to look at the formatting options provided and decide if they are actually useful to have.  The third is to confirm that the design is OK, I did think about making these simple static methods with an extra parm for QLocale, but I think this approach offers more future flexibility, and writing KFormat().formatDuration() is just as convenient as KFormat::formatDuration().
> 
> 
> Diffs
> -----
> 
>   tier1/kcoreaddons/autotests/CMakeLists.txt c8043576181e7d06663195d017be930d0bdcbde9 
>   tier1/kcoreaddons/autotests/kformattest.h PRE-CREATION 
>   tier1/kcoreaddons/autotests/kformattest.cpp PRE-CREATION 
>   tier1/kcoreaddons/src/lib/CMakeLists.txt 638525f7b719bcd0bc1dfdf94debd51296521334 
>   tier1/kcoreaddons/src/lib/util/kformat.h PRE-CREATION 
>   tier1/kcoreaddons/src/lib/util/kformat.cpp PRE-CREATION 
>   tier1/kcoreaddons/src/lib/util/kformatprivate.cpp PRE-CREATION 
>   tier1/kcoreaddons/src/lib/util/kformatprivate_p.h PRE-CREATION 
> 
> Diff: http://git.reviewboard.kde.org/r/114187/diff/
> 
> 
> Testing
> -------
> 
> Autotests copied from KLocale tests and improved.
> 
> 
> Thanks,
> 
> John Layt
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20131129/cbdc525b/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list