┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/dolphinitemlistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/views/dolphinitemlistview.cpp')
-rw-r--r--src/views/dolphinitemlistview.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/views/dolphinitemlistview.cpp b/src/views/dolphinitemlistview.cpp
index f9e710a31..53d1c6c34 100644
--- a/src/views/dolphinitemlistview.cpp
+++ b/src/views/dolphinitemlistview.cpp
@@ -45,13 +45,22 @@ void DolphinItemListView::setZoomLevel(int level)
m_zoomLevel = level;
+ const bool useGlobalViewProps = GeneralSettings::globalViewProps();
ViewModeSettings settings(itemLayout());
+
if (previewsShown()) {
- const int previewSize = ZoomLevelInfo::iconSizeForZoomLevel(level);
- settings.setPreviewSize(previewSize);
+ m_previewSize = ZoomLevelInfo::iconSizeForZoomLevel(level);
+ // Only update the icon size settings if we're using global view props
+ // to prevent inconsistent state on zoom level changes
+ if (useGlobalViewProps) {
+ settings.setPreviewSize(m_previewSize);
+ }
} else {
- const int iconSize = ZoomLevelInfo::iconSizeForZoomLevel(level);
- settings.setIconSize(iconSize);
+ // Same as above
+ m_iconSize = ZoomLevelInfo::iconSizeForZoomLevel(level);
+ if (useGlobalViewProps) {
+ settings.setIconSize(m_iconSize);
+ }
}
updateGridSize();
@@ -167,9 +176,11 @@ void DolphinItemListView::updateFont()
void DolphinItemListView::updateGridSize()
{
const ViewModeSettings settings(itemLayout());
+ const bool useGlobalViewProps = GeneralSettings::globalViewProps();
// Calculate the size of the icon
- const int iconSize = previewsShown() ? settings.previewSize() : settings.iconSize();
+ // Only use zoom stored in settings if we're using global view props
+ const int iconSize = useGlobalViewProps ? (previewsShown() ? settings.previewSize() : settings.iconSize()) : (previewsShown() ? m_previewSize : m_iconSize);
m_zoomLevel = ZoomLevelInfo::zoomLevelForIconSize(QSize(iconSize, iconSize));
KItemListStyleOption option = styleOption();
@@ -190,7 +201,7 @@ void DolphinItemListView::updateGridSize()
// 9 is the average char width for 10pt Noto Sans, making fontFactor =1
// by each pixel the font gets larger the factor increases by 1/9
auto fontFactor = option.fontMetrics.averageCharWidth() / 9.0;
- itemWidth = 48 + IconsModeSettings::textWidthIndex() * 64 * fontFactor * zoomFactor;
+ itemWidth = 16 + IconsModeSettings::textWidthIndex() * 64 * fontFactor * zoomFactor;
if (itemWidth < iconSize + padding * 2 * zoomFactor) {
itemWidth = iconSize + padding * 2 * zoomFactor;