Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kdiroperator.cpp
Show First 20 Lines • Show All 2145 Lines • ▼ Show 20 Line(s) | 2102 | { | |||
---|---|---|---|---|---|
2146 | if (configGroup.readEntry(QStringLiteral("Sort reversed"), DefaultSortReversed)) { | 2146 | if (configGroup.readEntry(QStringLiteral("Sort reversed"), DefaultSortReversed)) { | ||
2147 | sorting |= QDir::Reversed; | 2147 | sorting |= QDir::Reversed; | ||
2148 | } | 2148 | } | ||
2149 | d->updateSorting(sorting); | 2149 | d->updateSorting(sorting); | ||
2150 | 2150 | | |||
2151 | if (d->inlinePreviewState == Private::NotForced) { | 2151 | if (d->inlinePreviewState == Private::NotForced) { | ||
2152 | d->showPreviews = configGroup.readEntry(QStringLiteral("Previews"), false); | 2152 | d->showPreviews = configGroup.readEntry(QStringLiteral("Previews"), false); | ||
2153 | } | 2153 | } | ||
2154 | QStyleOptionViewItem::Position pos = (QStyleOptionViewItem::Position) configGroup.readEntry(QStringLiteral("Decoration position"), (int) QStyleOptionViewItem::Left); | 2154 | QStyleOptionViewItem::Position pos = (QStyleOptionViewItem::Position) configGroup.readEntry(QStringLiteral("Decoration position"), (int) QStyleOptionViewItem::Top); | ||
2155 | setDecorationPosition(pos); | 2155 | setDecorationPosition(pos); | ||
2156 | } | 2156 | } | ||
2157 | 2157 | | |||
2158 | void KDirOperator::writeConfig(KConfigGroup &configGroup) | 2158 | void KDirOperator::writeConfig(KConfigGroup &configGroup) | ||
2159 | { | 2159 | { | ||
2160 | QString sortBy = QStringLiteral("Name"); | 2160 | QString sortBy = QStringLiteral("Name"); | ||
2161 | if (KFile::isSortBySize(d->sorting)) { | 2161 | if (KFile::isSortBySize(d->sorting)) { | ||
2162 | sortBy = QStringLiteral("Size"); | 2162 | sortBy = QStringLiteral("Size"); | ||
▲ Show 20 Lines • Show All 432 Lines • ▼ Show 20 Line(s) | |||||
2595 | 2595 | | |||
2596 | int KDirOperator::Private::iconSizeForViewType(QAbstractItemView *itemView) const | 2596 | int KDirOperator::Private::iconSizeForViewType(QAbstractItemView *itemView) const | ||
2597 | { | 2597 | { | ||
2598 | if (!itemView || !configGroup) { | 2598 | if (!itemView || !configGroup) { | ||
2599 | return 0; | 2599 | return 0; | ||
2600 | } | 2600 | } | ||
2601 | 2601 | | |||
2602 | if (qobject_cast<QListView *>(itemView)) { | 2602 | if (qobject_cast<QListView *>(itemView)) { | ||
2603 | return configGroup->readEntry("listViewIconSize", 0); | 2603 | // Used for short view | ||
2604 | // "43" Corresponds to a default size of 64px | ||||
2605 | return configGroup->readEntry("listViewIconSize", 43); | ||||
anemeth: What is the relation between 43 and 64px?
Does this hardcoded number also work when scaled? | |||||
The number is a 0-100 scale, with 0 corresponding to 16px, and 100 corresponding to 128px, and all other numbers corresponding to in-between sized along that same linear scale. It's a bit odd, and not the way I would have implemented it, but that's what we've got, so I decided to work with it and just add comments to improve the comprehensibility. And yeah, it works fine with a HiDPI scale factor. ngraham: The number is a 0-100 scale, with 0 corresponding to 16px, and 100 corresponding to 128px, and… | |||||
2604 | } else { | 2606 | } else { | ||
2607 | // Used for all other views | ||||
2608 | // "0" corresponds to a default size of 16px | ||||
2605 | return configGroup->readEntry("detailedViewIconSize", 0); | 2609 | return configGroup->readEntry("detailedViewIconSize", 0); | ||
2606 | } | 2610 | } | ||
2607 | } | 2611 | } | ||
2608 | 2612 | | |||
2609 | void KDirOperator::setViewConfig(KConfigGroup &configGroup) | 2613 | void KDirOperator::setViewConfig(KConfigGroup &configGroup) | ||
2610 | { | 2614 | { | ||
2611 | delete d->configGroup; | 2615 | delete d->configGroup; | ||
2612 | d->configGroup = new KConfigGroup(configGroup); | 2616 | d->configGroup = new KConfigGroup(configGroup); | ||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |
What is the relation between 43 and 64px?
Does this hardcoded number also work when scaled?