Some improvements

This commit is contained in:
cutefishd 2021-04-13 10:46:20 +08:00
parent 9b838e58a9
commit 2fb64748b6
8 changed files with 37 additions and 8 deletions

11
images/drive-harddisk-root.svg Executable file
View file

@ -0,0 +1,11 @@
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color:#363636; }</style>
</defs>
<g class="ColorScheme-Text" fill="currentColor">
<path d="m6 2c-1.4995 0-2.5425 1.0366-2.9316 2.0332l-2.8691 7.4844c-0.003232 0.0076-0.004654 0.01581-0.007813 0.02344l-0.058594 0.15039h0.011719c-0.08705 0.25475-0.14453 0.52362-0.14453 0.80859 0 1.385 1.115 2.5 2.5 2.5h11c1.385 0 2.5-1.115 2.5-2.5 0-0.28498-0.05748-0.55384-0.14453-0.80859h0.01172l-0.05859-0.15039-0.0039-0.01563c-0.0011-0.0027-0.0028-0.0051-0.0039-0.0078l-2.8692-7.4844c-0.38916-0.99659-1.4322-2.0332-2.9316-2.0332h-2zm0 1h4c1.108 0 1.7085 0.6499 2 1.3965l2.1875 5.7109c-0.21961-0.062705-0.44722-0.10742-0.6875-0.10742h-11c-0.24028 0-0.46789 0.04472-0.6875 0.10742l2.1875-5.7109c0.29153-0.74658 0.892-1.3965 2-1.3965zm-3.5 8h11c0.831 0 1.5 0.669 1.5 1.5s-0.669 1.5-1.5 1.5h-11c-0.831 0-1.5-0.669-1.5-1.5s0.669-1.5 1.5-1.5z"/>
<circle cx="12.5" cy="12.5" r=".5"/>
<circle cx="10.5" cy="12.5" r=".5"/>
<circle cx="8.5" cy="12.5" r=".5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

11
images/drive-harddisk.svg Executable file
View file

@ -0,0 +1,11 @@
<svg version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<defs>
<style id="current-color-scheme" type="text/css">.ColorScheme-Text { color:#363636; }</style>
</defs>
<g class="ColorScheme-Text" fill="currentColor">
<path d="m6 2c-1.4995 0-2.5425 1.0366-2.9316 2.0332l-2.8691 7.4844c-0.003232 0.0076-0.004654 0.01581-0.007813 0.02344l-0.058594 0.15039h0.011719c-0.08705 0.25475-0.14453 0.52362-0.14453 0.80859 0 1.385 1.115 2.5 2.5 2.5h11c1.385 0 2.5-1.115 2.5-2.5 0-0.28498-0.05748-0.55384-0.14453-0.80859h0.01172l-0.05859-0.15039-0.0039-0.01563c-0.0011-0.0027-0.0028-0.0051-0.0039-0.0078l-2.8692-7.4844c-0.38916-0.99659-1.4322-2.0332-2.9316-2.0332h-2zm0 1h4c1.108 0 1.7085 0.6499 2 1.3965l2.1875 5.7109c-0.21961-0.062705-0.44722-0.10742-0.6875-0.10742h-11c-0.24028 0-0.46789 0.04472-0.6875 0.10742l2.1875-5.7109c0.29153-0.74658 0.892-1.3965 2-1.3965zm-3.5 8h11c0.831 0 1.5 0.669 1.5 1.5s-0.669 1.5-1.5 1.5h-11c-0.831 0-1.5-0.669-1.5-1.5s0.669-1.5 1.5-1.5z"/>
<circle cx="12.5" cy="12.5" r=".5"/>
<circle cx="10.5" cy="12.5" r=".5"/>
<circle cx="8.5" cy="12.5" r=".5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -113,6 +113,7 @@ void PlacesItem::updateDeviceInfo(const QString &udi)
if (m_device.isValid()) { if (m_device.isValid()) {
m_access = m_device.as<Solid::StorageAccess>(); m_access = m_device.as<Solid::StorageAccess>();
m_iconName = m_device.icon(); m_iconName = m_device.icon();
m_iconPath = QString("qrc:/images/%1.svg").arg(m_iconName);
m_displayName = m_device.displayName(); m_displayName = m_device.displayName();
if (m_access) { if (m_access) {

View file

@ -116,7 +116,7 @@ PlacesModel::~PlacesModel()
QHash<int, QByteArray> PlacesModel::roleNames() const QHash<int, QByteArray> PlacesModel::roleNames() const
{ {
QHash<int, QByteArray> roleNames; // = QAbstractItemModel::roleNames(); QHash<int, QByteArray> roleNames;
roleNames[PlacesModel::NameRole] = "name"; roleNames[PlacesModel::NameRole] = "name";
roleNames[PlacesModel::IconNameRole] = "icon"; roleNames[PlacesModel::IconNameRole] = "icon";
roleNames[PlacesModel::IconPathRole] = "iconPath"; roleNames[PlacesModel::IconPathRole] = "iconPath";

View file

@ -29,5 +29,7 @@
<file>qml/GlobalSettings.qml</file> <file>qml/GlobalSettings.qml</file>
<file>qml/FolderGridItem.qml</file> <file>qml/FolderGridItem.qml</file>
<file>qml/Dialogs/CreateFolderDialog.qml</file> <file>qml/Dialogs/CreateFolderDialog.qml</file>
<file>images/drive-harddisk.svg</file>
<file>images/drive-harddisk-root.svg</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -297,7 +297,9 @@ GridView {
if (control.ctrlPressed) { if (control.ctrlPressed) {
dirModel.toggleSelected(hoveredItem.index) dirModel.toggleSelected(hoveredItem.index)
} else { } else {
if (mouse.button == Qt.LeftButton)
dirModel.clearSelection() dirModel.clearSelection()
dirModel.setSelected(hoveredItem.index) dirModel.setSelected(hoveredItem.index)
} }
} }

View file

@ -27,7 +27,7 @@ ListView {
property Item editor: null property Item editor: null
property int anchorIndex: 0 property int anchorIndex: 0
property var itemHeight: FishUI.Units.fontMetrics.height * 2 + FishUI.Units.largeSpacing property var itemHeight: FishUI.Units.fontMetrics.height * 2 + FishUI.Units.smallSpacing
property variant cachedRectangleSelection: null property variant cachedRectangleSelection: null
@ -214,7 +214,9 @@ ListView {
if (control.ctrlPressed) { if (control.ctrlPressed) {
dirModel.toggleSelected(hoveredItem.index) dirModel.toggleSelected(hoveredItem.index)
} else { } else {
if (mouse.button == Qt.LeftButton)
dirModel.clearSelection() dirModel.clearSelection()
dirModel.setSelected(hoveredItem.index) dirModel.setSelected(hoveredItem.index)
} }
} }
@ -245,7 +247,7 @@ ListView {
control.shiftPressed = (mouse.modifiers & Qt.ShiftModifier) control.shiftPressed = (mouse.modifiers & Qt.ShiftModifier)
var cPos = mapToItem(control.contentItem, mouse.x, mouse.y) var cPos = mapToItem(control.contentItem, mouse.x, mouse.y)
var item = control.itemAt(mouse.x, mouse.y + control.contentY) var item = control.itemAt(mouse.x - control.leftMargin, mouse.y + control.contentY)
var leftEdge = Math.min(control.contentX, control.originX) var leftEdge = Math.min(control.contentX, control.originX)
if (!item || item.blank) { if (!item || item.blank) {
@ -347,8 +349,8 @@ ListView {
function rectangleSelect(x, y, width, height) { function rectangleSelect(x, y, width, height) {
var indexes = [] var indexes = []
for (var i = y; i <= y + height; i += 10) { for (var i = y; i <= y + height; i += 10) {
const index = control.indexAt(x, i) const index = control.indexAt(control.leftMargin, i)
if(!indexes.includes(index) && index > -1 && index< control.count) if(!indexes.includes(index) && index > -1 && index < control.count)
indexes.push(index) indexes.push(index)
} }
cachedRectangleSelection = indexes cachedRectangleSelection = indexes

View file

@ -181,7 +181,7 @@ Item {
id: _folderListView id: _folderListView
model: dirModel model: dirModel
topMargin: FishUI.Units.largeSpacing topMargin: FishUI.Units.smallSpacing
leftMargin: FishUI.Units.largeSpacing leftMargin: FishUI.Units.largeSpacing
rightMargin: FishUI.Units.largeSpacing + FishUI.Theme.smallRadius rightMargin: FishUI.Units.largeSpacing + FishUI.Theme.smallRadius
spacing: FishUI.Units.largeSpacing spacing: FishUI.Units.largeSpacing