From 9a106d5ba3da1db369751fc24bc8d6bbdbd5edac Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Fri, 30 Jun 2023 16:08:17 +0100 Subject: [PATCH] style: more file system icons Signed-off-by: Pedro Lamas --- .../widgets/filesystem/FileSystemBrowser.vue | 32 +++++++++++++------ src/globals.ts | 8 ++++- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/components/widgets/filesystem/FileSystemBrowser.vue b/src/components/widgets/filesystem/FileSystemBrowser.vue index d64b03a05c..61012f8ced 100644 --- a/src/components/widgets/filesystem/FileSystemBrowser.vue +++ b/src/components/widgets/filesystem/FileSystemBrowser.vue @@ -393,20 +393,34 @@ export default class FileSystemBrowser extends Mixins(FilesMixin) { } getItemIcon (item: FileBrowserEntry) { + const readonly = ( + this.readonly || + ( + item.permissions !== undefined && + !item.permissions.includes('w') + ) + ) + if (item.type === 'file') { - if (item.extension === 'zip') { - return '$fileZip' - } else if (item.permissions === 'r' || this.readonly) { - return '$fileLock' - } else { - return '$file' + switch (item.extension) { + case 'bmp': + case 'gif': + case 'jpg': + case 'jpeg': + case 'png': + case 'tif': + case 'tiff': + case 'webp': + return readonly ? '$fileImageLock' : '$fileImage' + case 'zip': + return readonly ? '$fileZipLock' : '$fileZip' + default: + return readonly ? '$fileLock' : '$file' } } else if (item.name === '..') { return '$folderUp' - } else if (item.permissions === 'r' || this.readonly) { - return '$folderLock' } else { - return '$folder' + return readonly ? '$folderLock' : '$folder' } } diff --git a/src/globals.ts b/src/globals.ts index 358120e3d3..b16bf9794e 100644 --- a/src/globals.ts +++ b/src/globals.ts @@ -143,11 +143,14 @@ import { mdiTableColumn, mdiShape, mdiSync, - mdiContentDuplicate + mdiContentDuplicate, + mdiArchiveLock, + mdiFileImage } from '@mdi/js' const mdiFilamentDown = 'M 12 2 A 10 10 0 0 0 10.871094 2.0800781 A 10 10 0 0 0 9.8515625 2.2597656 A 10 10 0 0 0 8.5371094 2.6464844 A 10 10 0 0 0 7.671875 3 A 10 10 0 0 0 7.6699219 3 A 10 10 0 0 0 6.375 3.7519531 A 10 10 0 0 0 5.6210938 4.3164062 A 10 10 0 0 0 4.640625 5.2539062 A 10 10 0 0 0 4.0429688 5.9863281 A 10 10 0 0 0 3.9179688 6.1542969 A 10 10 0 0 0 3.3769531 6.9804688 A 10 10 0 0 0 3.3417969 7.0449219 A 10 10 0 0 0 2.4726562 9.0019531 A 10 10 0 0 0 2.1582031 10.316406 A 10 10 0 0 0 2.0527344 11.248047 A 10 10 0 0 0 2.0527344 11.255859 A 10 10 0 0 0 2 12 A 10 10 0 0 0 2.0527344 12.742188 A 10 10 0 0 0 2.0527344 12.748047 A 10 10 0 0 0 2.1582031 13.683594 A 10 10 0 0 0 2.4726562 14.998047 A 10 10 0 0 0 3.3417969 16.955078 A 10 10 0 0 0 3.3769531 17.019531 A 10 10 0 0 0 3.9179688 17.845703 A 10 10 0 0 0 4.0429688 18.013672 A 10 10 0 0 0 4.640625 18.746094 A 10 10 0 0 0 5.6210938 19.683594 A 10 10 0 0 0 6.375 20.248047 A 10 10 0 0 0 7.6699219 21 A 10 10 0 0 0 7.671875 21 A 10 10 0 0 0 8.5371094 21.353516 A 10 10 0 0 0 9.8515625 21.740234 A 10 10 0 0 0 10.871094 21.919922 A 10 10 0 0 0 12 22 A 10 10 0 0 0 13.128906 21.919922 A 10 10 0 0 0 13.71875 21.816406 A 6 6 0 0 1 13.042969 19.601562 L 12.433594 19.25 L 12.433594 18.25 L 12.867188 18 L 13.125 17.851562 A 6 6 0 0 1 13.732422 16.160156 L 13.732422 16 L 13.859375 15.925781 A 6 6 0 0 1 15.201172 14.367188 A 4 4 0 0 0 15.763672 13.326172 L 15.896484 13.25 L 16.455078 13.572266 A 6 6 0 0 1 19 13 A 6 6 0 0 1 21.833984 13.712891 A 10 10 0 0 0 21.841797 13.683594 A 10 10 0 0 0 21.947266 12.751953 A 10 10 0 0 0 21.947266 12.75 A 10 10 0 0 0 21.947266 12.748047 A 10 10 0 0 0 21.947266 12.746094 A 10 10 0 0 0 21.947266 12.744141 A 10 10 0 0 0 22 12 A 10 10 0 0 0 21.96875 11.244141 A 10 10 0 0 0 21.966797 11.232422 A 10 10 0 0 0 21.853516 10.310547 A 10 10 0 0 0 21.541016 9.0097656 A 10 10 0 0 0 21.160156 7.9960938 A 10 10 0 0 0 21.154297 7.9824219 A 10 10 0 0 0 21.146484 7.96875 A 10 10 0 0 0 20.658203 7.0019531 A 10 10 0 0 0 20.65625 7 A 10 10 0 0 0 20.056641 6.0800781 A 10 10 0 0 0 19.359375 5.2324219 A 10 10 0 0 0 18.390625 4.3105469 A 10 10 0 0 0 17.638672 3.7441406 A 10 10 0 0 0 16.330078 2.9882812 A 10 10 0 0 0 16.328125 2.9882812 A 10 10 0 0 0 15.462891 2.6210938 A 10 10 0 0 0 14.177734 2.2421875 A 10 10 0 0 0 14.175781 2.2421875 A 10 10 0 0 0 13.140625 2.0683594 A 10 10 0 0 0 13.0625 2.0585938 A 10 10 0 0 0 12 2 z M 10.701172 4.25 L 11.132812 4.5 L 11.566406 4.75 L 11.566406 5.75 L 10.701172 6.25 L 10.267578 6 L 9.8359375 5.75 L 9.8359375 4.75 L 10.103516 4.5957031 L 10.701172 4.25 z M 13.298828 4.25 L 14.164062 4.75 L 14.164062 5.75 L 13.298828 6.25 L 12.433594 5.75 L 12.433594 4.75 L 13.298828 4.25 z M 15.181641 4.6640625 A 8 8 0 0 1 16.761719 5.5742188 L 16.761719 5.75 L 16.103516 6.1308594 L 15.896484 6.25 L 15.03125 5.75 L 15.03125 4.75 L 15.181641 4.6640625 z M 8.8398438 4.6757812 L 8.96875 4.75 L 8.96875 5.75 L 8.5371094 6 L 8.1035156 6.25 L 7.2382812 5.75 L 7.2382812 5.578125 A 8 8 0 0 1 8.8398438 4.6757812 z M 6.8046875 6.5 L 7.6699219 7 L 7.6699219 8 L 6.8046875 8.5 L 6.7011719 8.4394531 L 5.9394531 8 L 5.9394531 7.75 L 5.9394531 7 L 6.8046875 6.5 z M 9.4023438 6.5 L 10.267578 7 L 10.267578 8 L 9.8339844 8.25 L 9.4023438 8.5 L 8.9707031 8.25 L 8.5371094 8 L 8.5371094 7 L 8.96875 6.75 L 9.4023438 6.5 z M 12 6.5 L 12.865234 7 L 12.865234 7.75 L 12.865234 8 L 12.744141 8.0703125 A 4 4 0 0 0 12 8 A 4 4 0 0 0 11.267578 8.0761719 L 11.134766 8 L 11.134766 7 L 12 6.5 z M 14.597656 6.5 L 15.462891 7 L 15.462891 7.75 L 15.462891 8 L 14.597656 8.5 L 13.732422 8 L 13.732422 7.75 L 13.732422 7 L 14.597656 6.5 z M 17.195312 6.5 L 18.060547 7 L 18.060547 8 L 17.195312 8.5 L 16.330078 8 L 16.330078 7 L 17.195312 6.5 z M 5.5058594 8.75 L 6.3710938 9.25 L 6.3710938 10.25 L 5.5058594 10.75 L 4.640625 10.25 L 4.640625 9.25 L 5.5058594 8.75 z M 8.1035156 8.75 L 8.96875 9.25 L 8.96875 9.390625 A 4 4 0 0 0 8.2363281 10.673828 L 8.1035156 10.75 L 7.2382812 10.25 L 7.2382812 9.25 L 8.1035156 8.75 z M 15.896484 8.75 L 16.761719 9.25 L 16.761719 10.25 L 15.896484 10.75 L 15.775391 10.679688 A 4 4 0 0 0 15.03125 9.3925781 L 15.03125 9.25 L 15.896484 8.75 z M 18.494141 8.75 L 19.359375 9.25 L 19.359375 10.25 L 18.494141 10.75 L 18.287109 10.630859 L 17.628906 10.25 L 17.628906 9.25 L 18.494141 8.75 z M 12 10 A 2 2 0 0 1 14 12 A 2 2 0 0 1 12 14 A 2 2 0 0 1 10 12 A 2 2 0 0 1 12 10 z M 4.2070312 11 L 5.0722656 11.5 L 5.0722656 12.5 L 4.2070312 13 L 4.0722656 12.921875 A 8 8 0 0 1 4 12 A 8 8 0 0 1 4.0722656 11.078125 L 4.2070312 11 z M 6.8046875 11 L 7.6699219 11.5 L 7.6699219 12.5 L 6.8046875 13 L 6.7011719 12.939453 L 5.9394531 12.5 L 5.9394531 11.5 L 6.7011719 11.060547 L 6.8046875 11 z M 17.195312 11 L 18.060547 11.5 L 18.060547 12.5 L 17.195312 13 L 16.763672 12.75 L 16.330078 12.5 L 16.330078 11.5 L 17.195312 11 z M 19.792969 11 L 19.947266 11.089844 A 8 8 0 0 1 20 12 A 8 8 0 0 1 19.927734 12.921875 L 19.792969 13 L 18.927734 12.5 L 18.927734 12.25 L 18.927734 11.5 L 19.792969 11 z M 5.5058594 13.25 L 6.3710938 13.75 L 6.3710938 14.75 L 5.5058594 15.25 L 4.640625 14.75 L 4.640625 13.75 L 5.5058594 13.25 z M 8.1035156 13.25 L 8.2363281 13.326172 A 4 4 0 0 0 8.96875 14.609375 L 8.96875 14.75 L 8.5371094 15 L 8.1035156 15.25 L 7.2382812 14.75 L 7.2382812 13.75 L 7.671875 13.5 L 8.1035156 13.25 z M 6.8046875 15.5 L 7.6699219 16 L 7.6699219 17 L 6.8046875 17.5 L 6.7011719 17.439453 L 5.9394531 17 L 5.9394531 16.75 L 5.9394531 16 L 6.7011719 15.560547 L 6.8046875 15.5 z M 9.4023438 15.5 L 9.8339844 15.75 L 10.267578 16 L 10.267578 17 L 9.8339844 17.25 L 9.4023438 17.5 L 8.9707031 17.25 L 8.5371094 17 L 8.5371094 16 L 8.96875 15.75 L 8.9707031 15.75 L 9.4023438 15.5 z M 11.267578 15.923828 A 4 4 0 0 0 12 16 A 4 4 0 0 0 12.732422 15.923828 L 12.865234 16 L 12.865234 16.75 L 12.865234 17 L 12.103516 17.439453 L 12 17.5 L 11.134766 17 L 11.134766 16 L 11.267578 15.923828 z M 18 16 L 18 20 L 16 20 L 19 23 L 22 20 L 20 20 L 20 16 L 18 16 z M 8.1035156 17.75 L 8.96875 18.25 L 8.96875 19.25 L 8.8398438 19.324219 A 8 8 0 0 1 7.2382812 18.421875 L 7.2382812 18.25 L 8.1035156 17.75 z M 10.701172 17.75 L 11.566406 18.25 L 11.566406 19.25 L 10.701172 19.75 L 9.8359375 19.25 L 9.8359375 18.25 L 10.701172 17.75 z' const mdiFilamentUp = 'M 12 2 A 10 10 0 0 0 10.871094 2.0800781 A 10 10 0 0 0 9.8515625 2.2597656 A 10 10 0 0 0 8.5371094 2.6464844 A 10 10 0 0 0 7.671875 3 A 10 10 0 0 0 7.6699219 3 A 10 10 0 0 0 6.375 3.7519531 A 10 10 0 0 0 5.6210938 4.3164062 A 10 10 0 0 0 4.640625 5.2539062 A 10 10 0 0 0 4.0429688 5.9863281 A 10 10 0 0 0 3.9179688 6.1542969 A 10 10 0 0 0 3.3769531 6.9804688 A 10 10 0 0 0 3.3417969 7.0449219 A 10 10 0 0 0 2.4726562 9.0019531 A 10 10 0 0 0 2.1582031 10.316406 A 10 10 0 0 0 2.0527344 11.248047 A 10 10 0 0 0 2.0527344 11.255859 A 10 10 0 0 0 2 12 A 10 10 0 0 0 2.0527344 12.742188 A 10 10 0 0 0 2.0527344 12.748047 A 10 10 0 0 0 2.1582031 13.683594 A 10 10 0 0 0 2.4726562 14.998047 A 10 10 0 0 0 3.3417969 16.955078 A 10 10 0 0 0 3.3769531 17.019531 A 10 10 0 0 0 3.9179688 17.845703 A 10 10 0 0 0 4.0429688 18.013672 A 10 10 0 0 0 4.640625 18.746094 A 10 10 0 0 0 5.6210938 19.683594 A 10 10 0 0 0 6.375 20.248047 A 10 10 0 0 0 7.6699219 21 A 10 10 0 0 0 7.671875 21 A 10 10 0 0 0 8.5371094 21.353516 A 10 10 0 0 0 9.8515625 21.740234 A 10 10 0 0 0 10.871094 21.919922 A 10 10 0 0 0 12 22 A 10 10 0 0 0 13.128906 21.919922 A 10 10 0 0 0 13.71875 21.816406 A 6 6 0 0 1 13.042969 19.601562 L 12.433594 19.25 L 12.433594 18.25 L 12.867188 18 L 13.125 17.851562 A 6 6 0 0 1 13.732422 16.160156 L 13.732422 16 L 13.859375 15.925781 A 6 6 0 0 1 15.201172 14.367188 A 4 4 0 0 0 15.763672 13.326172 L 15.896484 13.25 L 16.455078 13.572266 A 6 6 0 0 1 19 13 A 6 6 0 0 1 21.833984 13.712891 A 10 10 0 0 0 21.841797 13.683594 A 10 10 0 0 0 21.947266 12.751953 A 10 10 0 0 0 21.947266 12.75 A 10 10 0 0 0 21.947266 12.748047 A 10 10 0 0 0 21.947266 12.746094 A 10 10 0 0 0 21.947266 12.744141 A 10 10 0 0 0 22 12 A 10 10 0 0 0 21.96875 11.244141 A 10 10 0 0 0 21.966797 11.232422 A 10 10 0 0 0 21.853516 10.310547 A 10 10 0 0 0 21.541016 9.0097656 A 10 10 0 0 0 21.160156 7.9960938 A 10 10 0 0 0 21.154297 7.9824219 A 10 10 0 0 0 21.146484 7.96875 A 10 10 0 0 0 20.658203 7.0019531 A 10 10 0 0 0 20.65625 7 A 10 10 0 0 0 20.056641 6.0800781 A 10 10 0 0 0 19.359375 5.2324219 A 10 10 0 0 0 18.390625 4.3105469 A 10 10 0 0 0 17.638672 3.7441406 A 10 10 0 0 0 16.330078 2.9882812 A 10 10 0 0 0 16.328125 2.9882812 A 10 10 0 0 0 15.462891 2.6210938 A 10 10 0 0 0 14.177734 2.2421875 A 10 10 0 0 0 14.175781 2.2421875 A 10 10 0 0 0 13.140625 2.0683594 A 10 10 0 0 0 13.0625 2.0585938 A 10 10 0 0 0 12 2 z M 10.701172 4.25 L 11.132812 4.5 L 11.566406 4.75 L 11.566406 5.75 L 10.701172 6.25 L 10.267578 6 L 9.8359375 5.75 L 9.8359375 4.75 L 10.103516 4.5957031 L 10.701172 4.25 z M 13.298828 4.25 L 14.164062 4.75 L 14.164062 5.75 L 13.298828 6.25 L 12.433594 5.75 L 12.433594 4.75 L 13.298828 4.25 z M 15.181641 4.6640625 A 8 8 0 0 1 16.761719 5.5742188 L 16.761719 5.75 L 16.103516 6.1308594 L 15.896484 6.25 L 15.03125 5.75 L 15.03125 4.75 L 15.181641 4.6640625 z M 8.8398438 4.6757812 L 8.96875 4.75 L 8.96875 5.75 L 8.5371094 6 L 8.1035156 6.25 L 7.2382812 5.75 L 7.2382812 5.578125 A 8 8 0 0 1 8.8398438 4.6757812 z M 6.8046875 6.5 L 7.6699219 7 L 7.6699219 8 L 6.8046875 8.5 L 6.7011719 8.4394531 L 5.9394531 8 L 5.9394531 7.75 L 5.9394531 7 L 6.8046875 6.5 z M 9.4023438 6.5 L 10.267578 7 L 10.267578 8 L 9.8339844 8.25 L 9.4023438 8.5 L 8.9707031 8.25 L 8.5371094 8 L 8.5371094 7 L 8.96875 6.75 L 9.4023438 6.5 z M 12 6.5 L 12.865234 7 L 12.865234 7.75 L 12.865234 8 L 12.744141 8.0703125 A 4 4 0 0 0 12 8 A 4 4 0 0 0 11.267578 8.0761719 L 11.134766 8 L 11.134766 7 L 12 6.5 z M 14.597656 6.5 L 15.462891 7 L 15.462891 7.75 L 15.462891 8 L 14.597656 8.5 L 13.732422 8 L 13.732422 7.75 L 13.732422 7 L 14.597656 6.5 z M 17.195312 6.5 L 18.060547 7 L 18.060547 8 L 17.195312 8.5 L 16.330078 8 L 16.330078 7 L 17.195312 6.5 z M 5.5058594 8.75 L 6.3710938 9.25 L 6.3710938 10.25 L 5.5058594 10.75 L 4.640625 10.25 L 4.640625 9.25 L 5.5058594 8.75 z M 8.1035156 8.75 L 8.96875 9.25 L 8.96875 9.390625 A 4 4 0 0 0 8.2363281 10.673828 L 8.1035156 10.75 L 7.2382812 10.25 L 7.2382812 9.25 L 8.1035156 8.75 z M 15.896484 8.75 L 16.761719 9.25 L 16.761719 10.25 L 15.896484 10.75 L 15.775391 10.679688 A 4 4 0 0 0 15.03125 9.3925781 L 15.03125 9.25 L 15.896484 8.75 z M 18.494141 8.75 L 19.359375 9.25 L 19.359375 10.25 L 18.494141 10.75 L 18.287109 10.630859 L 17.628906 10.25 L 17.628906 9.25 L 18.494141 8.75 z M 12 10 A 2 2 0 0 1 14 12 A 2 2 0 0 1 12 14 A 2 2 0 0 1 10 12 A 2 2 0 0 1 12 10 z M 4.2070312 11 L 5.0722656 11.5 L 5.0722656 12.5 L 4.2070312 13 L 4.0722656 12.921875 A 8 8 0 0 1 4 12 A 8 8 0 0 1 4.0722656 11.078125 L 4.2070312 11 z M 6.8046875 11 L 7.6699219 11.5 L 7.6699219 12.5 L 6.8046875 13 L 6.7011719 12.939453 L 5.9394531 12.5 L 5.9394531 11.5 L 6.7011719 11.060547 L 6.8046875 11 z M 17.195312 11 L 18.060547 11.5 L 18.060547 12.5 L 17.195312 13 L 16.763672 12.75 L 16.330078 12.5 L 16.330078 11.5 L 17.195312 11 z M 19.792969 11 L 19.947266 11.089844 A 8 8 0 0 1 20 12 A 8 8 0 0 1 19.927734 12.921875 L 19.792969 13 L 18.927734 12.5 L 18.927734 12.25 L 18.927734 11.5 L 19.792969 11 z M 5.5058594 13.25 L 6.3710938 13.75 L 6.3710938 14.75 L 5.5058594 15.25 L 4.640625 14.75 L 4.640625 13.75 L 5.5058594 13.25 z M 8.1035156 13.25 L 8.2363281 13.326172 A 4 4 0 0 0 8.96875 14.609375 L 8.96875 14.75 L 8.5371094 15 L 8.1035156 15.25 L 7.2382812 14.75 L 7.2382812 13.75 L 7.671875 13.5 L 8.1035156 13.25 z M 19 15 L 16 18 L 18 18 L 18 22 L 20 22 L 20 18 L 22 18 L 19 15 z M 6.8046875 15.5 L 7.6699219 16 L 7.6699219 17 L 6.8046875 17.5 L 6.7011719 17.439453 L 5.9394531 17 L 5.9394531 16.75 L 5.9394531 16 L 6.7011719 15.560547 L 6.8046875 15.5 z M 9.4023438 15.5 L 9.8339844 15.75 L 10.267578 16 L 10.267578 17 L 9.8339844 17.25 L 9.4023438 17.5 L 8.9707031 17.25 L 8.5371094 17 L 8.5371094 16 L 8.96875 15.75 L 8.9707031 15.75 L 9.4023438 15.5 z M 11.267578 15.923828 A 4 4 0 0 0 12 16 A 4 4 0 0 0 12.732422 15.923828 L 12.865234 16 L 12.865234 16.75 L 12.865234 17 L 12.103516 17.439453 L 12 17.5 L 11.134766 17 L 11.134766 16 L 11.267578 15.923828 z M 8.1035156 17.75 L 8.96875 18.25 L 8.96875 19.25 L 8.8398438 19.324219 A 8 8 0 0 1 7.2382812 18.421875 L 7.2382812 18.25 L 8.1035156 17.75 z M 10.701172 17.75 L 11.566406 18.25 L 11.566406 19.25 L 10.701172 19.75 L 9.8359375 19.25 L 9.8359375 18.25 L 10.701172 17.75 z' +const mdiFileImageLock = 'M 6 2 C 4.8900022 2 4 2.8900022 4 4 L 4 20 C 4 21.099998 4.8900022 22 6 22 L 12.009766 22 C 11.95662 21.34327 12.005856 20.659203 12.011719 20 L 6 20 L 12 14 L 13.220703 15.220703 C 13.493877 12.99107 15.651414 11.209302 17.896484 11.201172 C 18.62275 11.179377 19.34355 11.336699 20 11.632812 L 20 8 L 14 2 L 6 2 z M 13 3.5 L 18.5 9 L 13 9 L 13 3.5 z M 8 9 A 2 2 0 0 1 10 11 A 2 2 0 0 1 8 13 A 2 2 0 0 1 6 11 A 2 2 0 0 1 8 9 z M 18 13.199219 C 16.600001 13.199219 15.199219 14.29922 15.199219 15.699219 L 15.199219 17.199219 C 14.599219 17.199219 14 17.800391 14 18.400391 L 14 21.900391 C 14 22.60039 14.599219 23.199219 15.199219 23.199219 L 20.699219 23.199219 C 21.399218 23.199219 22 22.599999 22 22 L 22 18.5 C 22 17.800001 21.400781 17.199219 20.800781 17.199219 L 20.800781 15.699219 C 20.800781 14.29922 19.399999 13.199219 18 13.199219 z M 18 14.400391 C 18.799999 14.400391 19.5 14.89922 19.5 15.699219 L 19.5 17.199219 L 16.5 17.199219 L 16.5 15.699219 C 16.5 14.89922 17.200001 14.400391 18 14.400391 z' /** * Global, static constants. @@ -371,7 +374,10 @@ export const Icons = Object.freeze({ tableColumn: mdiTableColumn, parts: mdiShape, folderOpen: mdiFolderOpen, + fileImage: mdiFileImage, + fileImageLock: mdiFileImageLock, fileZip: mdiArchive, + fileZipLock: mdiArchiveLock, fileZipAdd: mdiArchivePlus, loadFilament: mdiFilamentDown, unloadFilament: mdiFilamentUp,