diff --git a/src/FileRow.qml b/src/FileRow.qml
index 26031f46..065d7cf4 100644
--- a/src/FileRow.qml
+++ b/src/FileRow.qml
@@ -31,12 +31,16 @@ Item {
// In the list, a tree: each level indented, and a folder's arrow opens
// it in place (or closes it).
property bool tree: false
+ // How much bigger than the columns' rows this one is: its height and
+ // its picture grow, the name and details don't, as with the grid's
+ // tiles. The list sets it from its size step.
+ property real zoom: 1
signal clicked(int modifiers)
signal activated()
signal toggled()
- implicitHeight: 32
+ implicitHeight: Math.round(32 * zoom)
// The name always gets room: in a narrow window the date goes first,
// then the size. (The icon says what kind a file is; there's no column
@@ -77,7 +81,13 @@ Item {
RowLayout {
anchors.fill: parent
- anchors.leftMargin: row.tree ? 4 + row.depth * 20 : 14
+ // Each level is indented by half the picture's width plus a fixed
+ // 10: an open folder's items have their arrow under the folder's
+ // own picture at any size. (The arrow is a fixed 18 wide, so
+ // indenting by the picture's whole width, which grows twice as
+ // fast as the picture's middle moves, left the arrows drifting
+ // further out with every size step.)
+ anchors.leftMargin: row.tree ? 4 + row.depth * (Math.round(10 * row.zoom) + 10) : 14
anchors.rightMargin: 14
spacing: 12
@@ -106,8 +116,8 @@ Item {
}
Item {
- implicitWidth: 20
- implicitHeight: 20
+ implicitWidth: Math.round(20 * row.zoom)
+ implicitHeight: Math.round(20 * row.zoom)
Image {
id: thumb
anchors.fill: parent
@@ -129,8 +139,8 @@ Item {
}
Rectangle {
id: rowMask
- width: 20
- height: 20
+ width: Math.round(20 * row.zoom)
+ height: Math.round(20 * row.zoom)
radius: Math.min(4, theme.radius)
visible: false
layer.enabled: true
@@ -139,7 +149,7 @@ Item {
anchors.centerIn: parent
visible: !thumb.visible
name: row.glyph
- size: 16
+ size: Math.round(16 * row.zoom)
color: row.isDir ? theme.accent : theme.secondaryForeground
}
}
diff --git a/src/FolderGrid.qml b/src/FolderGrid.qml
index 27dbcaf1..487db9a9 100644
--- a/src/FolderGrid.qml
+++ b/src/FolderGrid.qml
@@ -73,22 +73,7 @@ GridView {
property real zoom: 1
readonly property real tileZoom: Math.max(0.5, Math.min(zoom, (width - 40) / 128))
signal zoomRequested(int step)
- WheelHandler {
- acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
- acceptedModifiers: Qt.ControlModifier
- // A touchpad sends many small deltas: a step per notch's worth
- // (120), and nothing for an event that doesn't move up or down.
- property real pending: 0
- onWheel: (event) => {
- // Every whole notch is a step; the rest waits for the next event.
- pending += event.angleDelta.y
- while (Math.abs(pending) >= 120) {
- const step = pending > 0 ? 1 : -1
- grid.zoomRequested(step)
- pending -= step * 120
- }
- }
- }
+ ZoomWheel { onZoomRequested: (step) => grid.zoomRequested(step) }
// The rows reflow, so bring the cursor's tile back into view.
onTileZoomChanged: Qt.callLater(() => { if (currentIndex >= 0) { forceLayout(); positionViewAtIndex(currentIndex, GridView.Contain) } })
readonly property int columns: Math.max(1, Math.floor(width / (40 + 128 * tileZoom)))
diff --git a/src/FolderList.qml b/src/FolderList.qml
index 2a79ebe9..68e4b598 100644
--- a/src/FolderList.qml
+++ b/src/FolderList.qml
@@ -19,13 +19,24 @@ FileListView {
// Where the keyboard's menu (Alt+Return) opens: beside the cursor's item.
function menuAnchor() { return currentItem }
- Selecting { id: selecting; view: list; pageStep: Math.max(1, Math.floor(list.height / 32) - 1) }
+ // Rows grow with the size step, as the grid's tiles do with theirs: their
+ // height and picture, not the name and details. A value outside the
+ // steps (a hand-edited setting) is held to the ends.
+ property real zoom: 1
+ readonly property real rowZoom: Math.max(1, Math.min(zoom, 2))
+ readonly property int rowHeight: Math.round(32 * rowZoom)
+ signal zoomRequested(int step)
+ ZoomWheel { onZoomRequested: (step) => list.zoomRequested(step) }
+ // The rows reflow, so bring the cursor's row back into view.
+ onRowHeightChanged: Qt.callLater(() => { if (currentIndex >= 0) { forceLayout(); positionViewAtIndex(currentIndex, ListView.Contain) } })
+
+ Selecting { id: selecting; view: list; pageStep: Math.max(1, Math.floor(list.height / list.rowHeight) - 1) }
onCurrentIndexChanged: selecting.cursorMoved()
Keys.onPressed: (event) => selecting.page(event) || selecting.extendBy(event, event.key === Qt.Key_Up ? -1 : event.key === Qt.Key_Down ? 1 : 0)
Band {
view: list
- rectOf: (i) => Qt.rect(0, i * 32, list.width, 32)
+ rectOf: (i) => Qt.rect(0, i * list.rowHeight, list.width, list.rowHeight)
}
// → opens the selected folder in place, and on one open already steps
@@ -82,6 +93,7 @@ FileListView {
delegate: FileRow {
width: list.width
+ zoom: list.rowZoom
detailed: true
tree: backend.folder.expandable
current: selected
diff --git a/src/FolderPane.qml b/src/FolderPane.qml
index 7a377a5e..530a4a71 100644
--- a/src/FolderPane.qml
+++ b/src/FolderPane.qml
@@ -33,9 +33,31 @@ FocusScope {
property real zoom: host ? host.zoom : 1
onZoomChanged: if (host && !closable) host.zoom = zoom
readonly property var zoomSteps: [0.75, 1, 1.25, 1.5, 2]
+ // The list's rows have steps of their own, three: its normal size, and
+ // two bigger. They're kept apart from the grid's, so each view is
+ // remembered at the size it was left at.
+ property real listZoom: host ? host.listZoom : 1
+ onListZoomChanged: if (host && !closable) host.listZoom = listZoom
+ readonly property var listZoomSteps: [1, 1.5, 2]
+ // The step `step` away from `current` among `steps`, held to the ends; a
+ // value that's none of them (a hand-edited setting) counts as normal.
+ function stepped(steps, current, step) {
+ const at = steps.indexOf(current)
+ return steps[Math.max(0, Math.min(steps.length - 1, (at < 0 ? steps.indexOf(1) : at) + step))]
+ }
+ // The keys and the wheel size what's showing: the list's rows, or else
+ // the grid's tiles.
function zoomBy(step) {
- const at = zoomSteps.indexOf(zoom)
- zoom = zoomSteps[Math.max(0, Math.min(zoomSteps.length - 1, (at < 0 ? 1 : at) + step))]
+ if (viewMode === "list")
+ listZoom = stepped(listZoomSteps, listZoom, step)
+ else
+ zoom = stepped(zoomSteps, zoom, step)
+ }
+ function resetZoom() {
+ if (viewMode === "list")
+ listZoom = 1
+ else
+ zoom = 1
}
function cycleView() {
viewMode = viewMode === "columns" ? "list" : viewMode === "list" ? "grid" : "columns"
@@ -205,7 +227,7 @@ FocusScope {
Shortcut { sequence: "Ctrl+3"; enabled: pane.active; onActivated: pane.viewMode = "grid" }
Shortcut { sequences: [StandardKey.ZoomIn, "Ctrl+="]; enabled: pane.active; onActivated: pane.zoomBy(1) }
Shortcut { sequences: [StandardKey.ZoomOut]; enabled: pane.active; onActivated: pane.zoomBy(-1) }
- Shortcut { sequence: "Ctrl+0"; enabled: pane.active; onActivated: pane.zoom = 1 }
+ Shortcut { sequence: "Ctrl+0"; enabled: pane.active; onActivated: pane.resetZoom() }
Shortcut { sequences: ["Return", "Enter"]; enabled: pane.keys; onActivated: if (pane.current.path) backend.open(pane.current.path) }
Shortcut { sequences: ["Backspace", "Alt+Up"]; enabled: pane.keys; onActivated: backend.goUp() }
Shortcut { sequences: ["Alt+Left", "Back"]; enabled: pane.active; onActivated: backend.back() }
@@ -483,7 +505,7 @@ FocusScope {
}
}
Component { id: gridView; FolderGrid { zoom: pane.zoom; onZoomRequested: (step) => pane.zoomBy(step) } }
- Component { id: listView; FolderList { } }
+ Component { id: listView; FolderList { zoom: pane.listZoom; onZoomRequested: (step) => pane.zoomBy(step) } }
Component { id: columnsView; FolderColumns { detailsPane: pane } }
}
diff --git a/src/HelpOverlay.qml b/src/HelpOverlay.qml
index d5cda688..ad34dbef 100644
--- a/src/HelpOverlay.qml
+++ b/src/HelpOverlay.qml
@@ -72,7 +72,7 @@ Rectangle {
]},
{ title: qsTr("View"), shortcuts: [
[qsTr("Columns, list or grid"), [["Ctrl", "1"], ["Ctrl", "2"], ["Ctrl", "3"]]],
- [qsTr("Bigger, smaller or normal tiles"), [["Ctrl", "="], ["Ctrl", "-"], ["Ctrl", "0"]]],
+ [qsTr("Bigger, smaller or normal tiles and rows"), [["Ctrl", "="], ["Ctrl", "-"], ["Ctrl", "0"]]],
[qsTr("Next or previous sort order"), [["S"], ["Shift", "S"]]],
[qsTr("Show hidden files"), [["Ctrl", "H"]]],
[qsTr("Reload"), [["F5"]]]
diff --git a/src/Main.qml b/src/Main.qml
index 9be2f931..75cb083e 100644
--- a/src/Main.qml
+++ b/src/Main.qml
@@ -59,6 +59,8 @@ ApplicationWindow {
// Columns on a first launch; after that, whichever view was used last.
property string viewMode: "columns"
property real zoom: 1
+ // The list's own size step, apart from the grid's.
+ property real listZoom: 1
// The pane keys, the sidebar and the details go to.
property var activePane: leftPane
@@ -78,6 +80,7 @@ ApplicationWindow {
Settings {
property alias viewMode: win.viewMode
property alias zoom: win.zoom
+ property alias listZoom: win.listZoom
}
// Ctrl+Alt+N: a second pane on the right, starting where the active
@@ -92,6 +95,7 @@ ApplicationWindow {
rightPane.closable = true
rightPane.viewMode = activePane.viewMode
rightPane.zoom = activePane.zoom
+ rightPane.listZoom = activePane.listZoom
rightPane.closeRequested.connect(closeSplit)
}
rightPane.focusView()
diff --git a/src/ZoomWheel.qml b/src/ZoomWheel.qml
new file mode 100644
index 00000000..0fbc132a
--- /dev/null
+++ b/src/ZoomWheel.qml
@@ -0,0 +1,23 @@
+import QtQuick
+
+// Ctrl+scroll over a view asks for a size step, the way Ctrl+= and Ctrl+-
+// do: one step per notch of the wheel, up for bigger. The view says what
+// a step means (the grid's tiles, the list's rows).
+WheelHandler {
+ signal zoomRequested(int step)
+
+ acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
+ acceptedModifiers: Qt.ControlModifier
+ // A touchpad sends many small deltas: a step per notch's worth
+ // (120), and nothing for an event that doesn't move up or down.
+ property real pending: 0
+ onWheel: (event) => {
+ // Every whole notch is a step; the rest waits for the next event.
+ pending += event.angleDelta.y
+ while (Math.abs(pending) >= 120) {
+ const step = pending > 0 ? 1 : -1
+ zoomRequested(step)
+ pending -= step * 120
+ }
+ }
+}
diff --git a/src/i18n/en.json b/src/i18n/en.json
index c2bd349a..618f972d 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -48,7 +48,7 @@
"Archive": "Archive",
"Back / ahead 5 seconds": "Back / ahead 5 seconds",
"Back / forward": "Back / forward",
- "Bigger, smaller or normal tiles": "Bigger, smaller or normal tiles",
+ "Bigger, smaller or normal tiles and rows": "Bigger, smaller or normal tiles and rows",
"Biggest first": "Biggest first",
"Burn": "Burn",
"Burn %1?": "Burn %1?",
diff --git a/src/resources.qrc b/src/resources.qrc
index 4912c739..b3c1bcce 100644
--- a/src/resources.qrc
+++ b/src/resources.qrc
@@ -16,6 +16,7 @@
HelpOverlay.qml
Selecting.qml
Band.qml
+ ZoomWheel.qml
FolioMenu.qml
FolioMenuItem.qml
MenuLine.qml
diff --git a/tests/folio_tests.cpp b/tests/folio_tests.cpp
index 1de00c72..5a1342e4 100644
--- a/tests/folio_tests.cpp
+++ b/tests/folio_tests.cpp
@@ -1141,6 +1141,7 @@ private slots:
width: 900; height: 620; visible: true
property string viewMode: "columns"
property real zoom: 1
+ property real listZoom: 1
property bool split: false
property bool helpVisible: false
property var activePane: null
@@ -1211,6 +1212,7 @@ private slots:
width: 900; height: 620; visible: true
property string viewMode: "columns"
property real zoom: 1
+ property real listZoom: 1
property bool split: false
property bool helpVisible: false
property var activePane: null
@@ -7351,6 +7353,7 @@ private slots:
width: 900; height: 620; visible: true
property string viewMode: "list"
property real zoom: 1
+ property real listZoom: 1
property bool split: false
property bool helpVisible: false
property var activePane: null