From dede872fac4e028491d402a52e1f49b7a931886e Mon Sep 17 00:00:00 2001 From: reionwong Date: Tue, 17 Aug 2021 09:53:52 +0800 Subject: [PATCH] Window icon --- desktop/desktopview.cpp | 2 +- main.cpp | 4 +++- model/foldermodel.cpp | 11 +++++++++++ model/foldermodel.h | 4 +++- qml/Controls/IconButton.qml | 1 + qml/Desktop/Main.qml | 1 + qml/FolderGridItem.qml | 5 +++-- qml/FolderListItem.qml | 3 +++ qml/FolderPage.qml | 10 +++++----- qml/SideBar.qml | 2 ++ qml/main.qml | 2 +- 11 files changed, 34 insertions(+), 11 deletions(-) diff --git a/desktop/desktopview.cpp b/desktop/desktopview.cpp index 2410768..e408bd5 100644 --- a/desktop/desktopview.cpp +++ b/desktop/desktopview.cpp @@ -66,7 +66,7 @@ QRect DesktopView::screenAvailableRect() void DesktopView::onGeometryChanged() { - m_screenRect = qApp->primaryScreen()->geometry(); + m_screenRect = qApp->primaryScreen()->geometry().adjusted(0, 0, 1, 1); setGeometry(m_screenRect); emit screenRectChanged(); } diff --git a/main.cpp b/main.cpp index 07e8da9..86ead10 100644 --- a/main.cpp +++ b/main.cpp @@ -41,10 +41,12 @@ int main(int argc, char *argv[]) { - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); QApplication app(argc, argv); app.setOrganizationName("cutefishos"); + app.setWindowIcon(QIcon::fromTheme("file-manager")); // Translations QLocale locale; diff --git a/model/foldermodel.cpp b/model/foldermodel.cpp index 6022eed..824002d 100644 --- a/model/foldermodel.cpp +++ b/model/foldermodel.cpp @@ -135,11 +135,13 @@ QHash FolderModel::staticRoleNames() roleNames[SelectedRole] = "selected"; roleNames[IsDirRole] = "isDir"; roleNames[UrlRole] = "url"; + roleNames[DisplayNameRole] = "displayName"; roleNames[FileNameRole] = "fileName"; roleNames[FileSizeRole] = "fileSize"; roleNames[IconNameRole] = "iconName"; roleNames[ThumbnailRole] = "thumbnail"; roleNames[ModifiedRole] = "modified"; + roleNames[IsDesktopFileRole] = "desktopFile"; return roleNames; } @@ -157,9 +159,18 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const return m_selectionModel->isSelected(index); case UrlRole: return item.url(); + case DisplayNameRole: { + if (item.isDesktopFile()) + return ""; + + return item.url().fileName(); + } case FileNameRole: { return item.url().fileName(); } + case IsDesktopFileRole: { + return item.isDesktopFile(); + } case FileSizeRole: { if (item.isDir()) { QDir dir(item.url().toLocalFile()); diff --git a/model/foldermodel.h b/model/foldermodel.h index e1cbb59..6bf1672 100644 --- a/model/foldermodel.h +++ b/model/foldermodel.h @@ -61,11 +61,13 @@ public: SelectedRole, IsDirRole, UrlRole, + DisplayNameRole, FileNameRole, FileSizeRole, IconNameRole, ThumbnailRole, - ModifiedRole + ModifiedRole, + IsDesktopFileRole }; enum FilterMode { diff --git a/qml/Controls/IconButton.qml b/qml/Controls/IconButton.qml index f8a0208..e390b64 100644 --- a/qml/Controls/IconButton.qml +++ b/qml/Controls/IconButton.qml @@ -49,6 +49,7 @@ Item { height: width sourceSize: Qt.size(width, height) smooth: false + antialiasing: true } MouseArea { diff --git a/qml/Desktop/Main.qml b/qml/Desktop/Main.qml index 6ce4437..9ce8c8a 100644 --- a/qml/Desktop/Main.qml +++ b/qml/Desktop/Main.qml @@ -41,6 +41,7 @@ Item { Loader { id: backgroundLoader anchors.fill: parent + anchors.margins: 0 sourceComponent: settings.backgroundType === 0 ? wallpaper : background } diff --git a/qml/FolderGridItem.qml b/qml/FolderGridItem.qml index e5a9c93..201fa61 100644 --- a/qml/FolderGridItem.qml +++ b/qml/FolderGridItem.qml @@ -95,6 +95,7 @@ Item { source: "image://icontheme/" + model.iconName visible: !_image.visible smooth: false + antialiasing: true ColorOverlay { anchors.fill: _icon @@ -123,12 +124,12 @@ Item { visible: status === Image.Ready horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter - sourceSize.width: width - sourceSize.height: height + sourceSize: Qt.size(width, height) source: model.thumbnail ? model.thumbnail : "" asynchronous: true cache: false smooth: false + antialiasing: true // Because of the effect of OpacityMask. ColorOverlay { diff --git a/qml/FolderListItem.qml b/qml/FolderListItem.qml index 8ef892c..5a96050 100644 --- a/qml/FolderListItem.qml +++ b/qml/FolderListItem.qml @@ -127,6 +127,7 @@ Item { text: model.fileName Layout.fillWidth: true color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor + textFormat: Text.PlainText elide: Qt.ElideMiddle } @@ -134,12 +135,14 @@ Item { id: _label2 text: model.fileSize color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.disabledTextColor + textFormat: Text.PlainText Layout.fillWidth: true } } Label { text: model.modified + textFormat: Text.PlainText color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.disabledTextColor } } diff --git a/qml/FolderPage.qml b/qml/FolderPage.qml index 5d8d75a..addd1fe 100644 --- a/qml/FolderPage.qml +++ b/qml/FolderPage.qml @@ -209,11 +209,11 @@ Item { height: statusBarHeight z: 999 - Rectangle { - anchors.fill: parent - color: FishUI.Theme.backgroundColor - opacity: 0.7 - } +// Rectangle { +// anchors.fill: parent +// color: FishUI.Theme.backgroundColor +// opacity: 0.7 +// } MouseArea { anchors.fill: parent diff --git a/qml/SideBar.qml b/qml/SideBar.qml index 165f004..d72c4c9 100644 --- a/qml/SideBar.qml +++ b/qml/SideBar.qml @@ -105,12 +105,14 @@ ListView { source: "qrc:/images/" + (FishUI.Theme.darkMode || _item.checked ? "dark/" : "light/") + model.iconPath Layout.alignment: Qt.AlignVCenter smooth: false + antialiasing: true } Label { id: _label text: model.name color: checked ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor + elide: Text.ElideRight Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter } diff --git a/qml/main.qml b/qml/main.qml index 95df297..5633343 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -35,7 +35,7 @@ FishUI.Window { title: qsTr("File Manager") header.height: 36 + FishUI.Units.largeSpacing - background.opacity: 0.95 + background.opacity: 0.9 FishUI.WindowBlur { view: root