diff --git a/qml/Desktop/main.qml b/qml/Desktop/main.qml index de4daa7..dd85b22 100644 --- a/qml/Desktop/main.qml +++ b/qml/Desktop/main.qml @@ -72,10 +72,15 @@ Item { isDesktopView: true iconSize: globalSettings.desktopIconSize + maximumIconSize: globalSettings.maximumIconSize + minimumIconSize: globalSettings.minimumIconSize focus: true - model: folderModel + onIconSizeChanged: { + globalSettings.desktopIconSize = _folderView.iconSize + } + leftMargin: desktopView.screenAvailableRect ? desktopView.screenAvailableRect.x : 0 topMargin: desktopView.screenAvailableRect ? desktopView.screenAvailableRect.y : 0 rightMargin: desktopView.screenRect.width - (desktopView.screenAvailableRect.x + desktopView.screenAvailableRect.width) @@ -84,6 +89,11 @@ Item { flow: GridView.FlowTopToBottom delegate: FolderGridItem {} + + onActiveFocusChanged: { + if (!activeFocus) + folderModel.clearSelection() + } } Connections { diff --git a/qml/FolderGridView.qml b/qml/FolderGridView.qml index 66f794b..6d1ca8b 100644 --- a/qml/FolderGridView.qml +++ b/qml/FolderGridView.qml @@ -31,6 +31,8 @@ GridView { property int anchorIndex: 0 property var iconSize: settings.gridIconSize + property var maximumIconSize: settings.maximumIconSize + property var minimumIconSize: settings.minimumIconSize property variant cachedRectangleSelection: null @@ -276,6 +278,15 @@ GridView { onReleased: pressCanceled() onCanceled: pressCanceled() + + onWheel: { + if (wheel.modifiers & Qt.ControlModifier) { + if (wheel.angleDelta.y > 0) + control.increaseIconSize() + else + control.decreaseIconSize() + } + } } function clearPressState() { @@ -376,6 +387,24 @@ GridView { return Math.floor(extraSpacing) } + function increaseIconSize() { + if (iconSize >= control.maximumIconSize) { + iconSize = control.maximumIconSize + return + } + + iconSize += (iconSize * 0.1) + } + + function decreaseIconSize() { + if (iconSize <= control.minimumIconSize) { + iconSize = control.minimumIconSize + return + } + + iconSize -= (iconSize * 0.1) + } + Component { id: editorComponent diff --git a/qml/FolderPage.qml b/qml/FolderPage.qml index dca7f8f..0b4a0f7 100644 --- a/qml/FolderPage.qml +++ b/qml/FolderPage.qml @@ -129,6 +129,11 @@ Item { topMargin: Meui.Units.smallSpacing bottomMargin: Meui.Units.smallSpacing + onIconSizeChanged: { + // Save + settings.gridIconSize = _gridView.iconSize + } + onCountChanged: { _fileTips.visible = count === 0 } diff --git a/qml/GlobalSettings.qml b/qml/GlobalSettings.qml index 2b0284c..3b6a200 100644 --- a/qml/GlobalSettings.qml +++ b/qml/GlobalSettings.qml @@ -2,7 +2,7 @@ import QtQuick 2.12 import Qt.labs.settings 1.0 Settings { - property int viewMethod: 0 + property int viewMethod: 1 property bool showHidden: false property int width: 900 property int height: 580