diff --git a/cutefish-filemanager.desktop b/cutefish-filemanager.desktop index 457fc85..cfaa980 100644 --- a/cutefish-filemanager.desktop +++ b/cutefish-filemanager.desktop @@ -4,7 +4,7 @@ Name=File Manager Name[zh_CN]=文件管理器 GenericName=File Manager Comment=Cutefish File Manager -Exec=cutefish-fm %U +Exec=cutefish-filemanager %U MimeType=inode/directory; Icon=file-system-manager Categories=FileManager;Utility;Core;Qt; diff --git a/qml/BrowserView.qml b/qml/BrowserView.qml index 6b71668..be74dd7 100644 --- a/qml/BrowserView.qml +++ b/qml/BrowserView.qml @@ -84,7 +84,7 @@ Item { FolderIconView { id: _gridViewBrowser anchors.fill: parent - model: dirModel + model: positioner leftMargin: Meui.Units.largeSpacing rightMargin: Meui.Units.largeSpacing diff --git a/qml/Desktop/DesktopFolderView.qml b/qml/Desktop/DesktopFolderView.qml index 06398d5..c1ea895 100644 --- a/qml/Desktop/DesktopFolderView.qml +++ b/qml/Desktop/DesktopFolderView.qml @@ -5,6 +5,7 @@ import QtQuick.Layouts 1.12 import Cutefish.FileManager 1.0 as FM import MeuiKit 1.0 as Meui +import "../" import "FolderTools.js" as FolderTools FocusScope { @@ -104,6 +105,10 @@ FocusScope { } } + GlobalSettings { + id: settings + } + MouseArea { id: listener anchors.fill: parent @@ -133,6 +138,15 @@ FocusScope { acceptedButtons: Qt.LeftButton | Qt.RightButton + onWheel: { + if (wheel.modifiers & Qt.ControlModifier) { + if (wheel.angleDelta.y > 0) + gridView.increaseIconSize() + else + gridView.decreaseIconSize() + } + } + onPressed: { gridView.focus = true gridView.forceActiveFocus() @@ -382,7 +396,7 @@ FocusScope { } } - property var iconSize: 150 + Meui.Units.largeSpacing + property var iconSize: settings.desktopIconSize + Meui.Units.largeSpacing cellWidth: { var extraWidth = calcExtraSpacing(iconSize, gridView.width - leftMargin - rightMargin); @@ -394,6 +408,26 @@ FocusScope { return iconSize + extraHeight; } + function increaseIconSize() { + if (iconSize >= settings.maximumIconSize) { + iconSize = settings.maximumIconSize + return + } + + iconSize += (iconSize * 0.1) + settings.desktopIconSize = iconSize + } + + function decreaseIconSize() { + if (iconSize <= settings.minimumIconSize) { + iconSize = settings.minimumIconSize + return + } + + iconSize -= (iconSize * 0.1) + settings.desktopIconSize = iconSize + } + function calcExtraSpacing(cellSize, containerSize) { var availableColumns = Math.floor(containerSize / cellSize); var extraSpacing = 0; diff --git a/qml/Dialogs/PropertiesDialog.qml b/qml/Dialogs/PropertiesDialog.qml index a501fc9..796d06b 100644 --- a/qml/Dialogs/PropertiesDialog.qml +++ b/qml/Dialogs/PropertiesDialog.qml @@ -15,10 +15,6 @@ Window { if (visible) updateWindowSize() } - Component.onCompleted: { - updateWindowSize() - } - function updateWindowSize() { if (visible) { control.width = _mainLayout.implicitWidth + _mainLayout.anchors.leftMargin + _mainLayout.anchors.rightMargin @@ -77,6 +73,7 @@ Window { Layout.alignment: Qt.AlignTop onHeightChanged: updateWindowSize() + onImplicitHeightChanged: updateWindowSize() Label { text: qsTr("Type:") diff --git a/qml/GlobalSettings.qml b/qml/GlobalSettings.qml index f0fca51..31de75a 100644 --- a/qml/GlobalSettings.qml +++ b/qml/GlobalSettings.qml @@ -6,4 +6,7 @@ Settings { property bool showHidden: false property int width: 1080 property int height: 645 + property int desktopIconSize: 128 + property int maximumIconSize: 256 + property int minimumIconSize: 128 } diff --git a/src/lib/foldermodel.cpp b/src/lib/foldermodel.cpp index e428352..35ab493 100644 --- a/src/lib/foldermodel.cpp +++ b/src/lib/foldermodel.cpp @@ -1648,6 +1648,9 @@ void FolderModel::createActions() QAction *actOpen = new QAction(tr("&Open"), this); connect(actOpen, &QAction::triggered, this, &FolderModel::openSelected); + QAction *propertiesAction = new QAction(tr("Properties"), this); + QObject::connect(propertiesAction, &QAction::triggered, this, &FolderModel::openPropertiesDialog); + m_actionCollection.addAction(QStringLiteral("open"), actOpen); m_actionCollection.addAction(QStringLiteral("cut"), cut); m_actionCollection.addAction(QStringLiteral("undo"), undo); @@ -1661,6 +1664,7 @@ void FolderModel::createActions() m_actionCollection.addAction(QStringLiteral("emptyTrash"), emptyTrash); m_actionCollection.addAction(QStringLiteral("new_folder"), newFolderAction); m_actionCollection.addAction(QStringLiteral("new_documents"), newDocAction); + m_actionCollection.addAction(QStringLiteral("properties"), propertiesAction); m_newMenu = new KNewFileMenu(&m_actionCollection, QStringLiteral("newMenu"), this); m_newMenu->setModal(false); @@ -1819,13 +1823,8 @@ void FolderModel::openContextMenu(QQuickItem *visualParent, Qt::KeyboardModifier menu->addAction(setWallpaper); } - // Properties - if (KPropertiesDialog::canDisplay(KFileItemList() << rootItem())) { - menu->addSeparator(); - QAction *act = new QAction(tr("Properties"), menu); - QObject::connect(act, &QAction::triggered, this, &FolderModel::openPropertiesDialog); - menu->addAction(act); - } + menu->addSeparator(); + menu->addAction(m_actionCollection.action(QStringLiteral("properties"))); } else { KFileItemList items; QList urls; @@ -1875,13 +1874,8 @@ void FolderModel::openContextMenu(QQuickItem *visualParent, Qt::KeyboardModifier menu->addAction(setAswallpaper); } - // Properties - if (KPropertiesDialog::canDisplay(items)) { - menu->addSeparator(); - QAction *act = new QAction(tr("&Properties"), menu); - QObject::connect(act, &QAction::triggered, this, &FolderModel::openPropertiesDialog); - menu->addAction(act); - } + menu->addSeparator(); + menu->addAction(m_actionCollection.action(QStringLiteral("properties"))); } if (visualParent) {