diff options
| author | Julian Schraner <[email protected]> | 2018-04-01 11:26:49 -0600 |
|---|---|---|
| committer | Nathaniel Graham <[email protected]> | 2018-04-01 11:27:44 -0600 |
| commit | 1441fefc07f126c1c9eddc3e9f1babff8b762b28 (patch) | |
| tree | fbd20b104e95874d6d766814c47d3ebfdfa364df /src/kitemviews/private/kbaloorolesprovider.cpp | |
| parent | 6f3b0e3d00e12c8f6d6cbc3953ee31d3c4cfa7c7 (diff) | |
Split Image Size into Width/Height
Summary:
This patch splits the single property "Image Size" into "Width" and "Height", providing more fine-tuned control for power users.
FEATURE: 374559
Test Plan:
- Sorting works correctly
- No real change, only exposed differently
Reviewers: #dolphin, elvisangelaccio, ngraham
Reviewed By: #dolphin, elvisangelaccio, ngraham
Subscribers: ngraham, elvisangelaccio
Differential Revision: https://phabricator.kde.org/D11816
Diffstat (limited to 'src/kitemviews/private/kbaloorolesprovider.cpp')
| -rw-r--r-- | src/kitemviews/private/kbaloorolesprovider.cpp | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp index bbd0927f2..3d3923b1b 100644 --- a/src/kitemviews/private/kbaloorolesprovider.cpp +++ b/src/kitemviews/private/kbaloorolesprovider.cpp @@ -56,9 +56,6 @@ QHash<QByteArray, QVariant> KBalooRolesProvider::roleValues(const Baloo::File& f { QHash<QByteArray, QVariant> values; - int width = -1; - int height = -1; - QMapIterator<KFileMetaData::Property::Property, QVariant> it(file.properties()); while (it.hasNext()) { it.next(); @@ -72,23 +69,7 @@ QHash<QByteArray, QVariant> KBalooRolesProvider::roleValues(const Baloo::File& f const QVariant value = it.value(); - if (role == "imageSize") { - // Merge the two properties for width and height - // as one string into the "imageSize" role - if (property == QLatin1String("width")) { - width = value.toInt(); - } - else if (property == QLatin1String("height")) { - height = value.toInt(); - } - - if (width >= 0 && height >= 0) { - QString widthAndHeight = QString::number(width); - widthAndHeight += QLatin1String(" x "); - widthAndHeight += QString::number(height); - values.insert(role, widthAndHeight); - } - } else if (role == "orientation") { + if (role == "orientation") { const QString orientation = orientationFromValue(value.toInt()); values.insert(role, orientation); } else if (role == "duration") { @@ -135,8 +116,7 @@ KBalooRolesProvider::KBalooRolesProvider() : }; // Mapping from the URIs to the KFileItemModel roles. Note that this must not be - // a 1:1 mapping: One role may contain several URI-values (e.g. the URIs for height and - // width of an image are mapped to the role "imageSize") + // a 1:1 mapping: One role may contain several URI-values static const PropertyInfo propertyInfoList[] = { { "rating", "rating" }, { "tag", "tags" }, @@ -144,8 +124,8 @@ KBalooRolesProvider::KBalooRolesProvider() : { "title", "title" }, { "wordCount", "wordCount" }, { "lineCount", "lineCount" }, - { "width", "imageSize" }, - { "height", "imageSize" }, + { "width", "width" }, + { "height", "height" }, { "imageDateTime", "imageDateTime"}, { "nexif.orientation", "orientation", }, { "artist", "artist" }, |
