Implement GUI for setting compression level
ClosedPublic

Authored by rthomsen on Apr 8 2016, 10:38 PM.

Details

Summary

Three new ints were added to plugin json files specifying minimum, maximum and default compression level for each readwrite mimetype. A new KCollapsibleGroupBox with a QSlider was added to CreateDialog to allow setting the compression level.

Diff Detail

Repository
R36 Ark
Lint
Lint Skipped
Unit
Unit Tests Skipped
rthomsen updated this revision to Diff 3227.Apr 8 2016, 10:38 PM
rthomsen retitled this revision from to Implement GUI for setting compression level.
rthomsen updated this object.
rthomsen edited the test plan for this revision. (Show Details)
rthomsen added a reviewer: elvisangelaccio.
rthomsen set the repository for this revision to R36 Ark.
rthomsen added a project: Ark.
Restricted Application added a subscriber: kde-utils-devel. · View Herald TranscriptApr 8 2016, 10:38 PM
rthomsen updated this object.Apr 8 2016, 10:42 PM
elvisangelaccio requested changes to this revision.Apr 9 2016, 10:24 AM
elvisangelaccio edited edge metadata.
elvisangelaccio added inline comments.
kerfuffle/archiveformat.cpp
63

Initialize this to Archive::Unencrypted, so that you can drop the else branch below.

kerfuffle/archiveformat.h
41–70

What about using an enum here? Something like:

enum CompressionLevel
{
    MIN,
    MAX,
    DEFAULT
}

Then you would only need one class member and one accessor method.

kerfuffle/cliinterface.cpp
255–258

Shorter version: options.value(QStringLiteral("CompressionLevel"), -1).toInt()

656

Please move this check within compressionLevelSwitch() (to be consistent with the other switch functions). If the level is -1, the function should return an empty string.

kerfuffle/createdialog.ui
148

I don't think we should expand it by default. Otherwise the user might think that he's forced to choose a compression level.

154

Not sure about the "Less" and "More" labels. Maybe "Min" and "Max" would be better?

plugins/clizipplugin/kerfuffle_clizip.json
61

Call this key CompressionLevelDefault ?

plugins/libarchive/kerfuffle_libarchive.json
59–63

These are unnecessary, you can remove them. QJsonValue::toInt() already defaults to 0 if the key is not found.
Same for the other formats that don't support compression levels.

This revision now requires changes to proceed.Apr 9 2016, 10:24 AM
rthomsen updated this revision to Diff 3245.Apr 9 2016, 7:01 PM
rthomsen edited edge metadata.

Implement Elvis' suggestions.

rthomsen updated this revision to Diff 3246.Apr 9 2016, 7:03 PM
rthomsen marked 7 inline comments as done.
rthomsen edited edge metadata.

Undo erroneous addition of enum.

elvisangelaccio accepted this revision.Apr 9 2016, 7:15 PM
elvisangelaccio edited edge metadata.

Great work, just some more minor nitpicks.

kerfuffle/archiveformat.h
61–63

Do you mind renaming these min/max/defaultCompressionLevel() ?

kerfuffle/cliinterface.cpp
723

if (level < 0) || level > 9) is more bullet-proof ;)

This revision is now accepted and ready to land.Apr 9 2016, 7:15 PM
This revision was automatically updated to reflect the committed changes.