Window icon

This commit is contained in:
reionwong 2021-08-17 09:53:52 +08:00
parent 9a14fa541b
commit dede872fac
11 changed files with 34 additions and 11 deletions

View file

@ -66,7 +66,7 @@ QRect DesktopView::screenAvailableRect()
void DesktopView::onGeometryChanged() void DesktopView::onGeometryChanged()
{ {
m_screenRect = qApp->primaryScreen()->geometry(); m_screenRect = qApp->primaryScreen()->geometry().adjusted(0, 0, 1, 1);
setGeometry(m_screenRect); setGeometry(m_screenRect);
emit screenRectChanged(); emit screenRectChanged();
} }

View file

@ -41,10 +41,12 @@
int main(int argc, char *argv[]) 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); QApplication app(argc, argv);
app.setOrganizationName("cutefishos"); app.setOrganizationName("cutefishos");
app.setWindowIcon(QIcon::fromTheme("file-manager"));
// Translations // Translations
QLocale locale; QLocale locale;

View file

@ -135,11 +135,13 @@ QHash<int, QByteArray> FolderModel::staticRoleNames()
roleNames[SelectedRole] = "selected"; roleNames[SelectedRole] = "selected";
roleNames[IsDirRole] = "isDir"; roleNames[IsDirRole] = "isDir";
roleNames[UrlRole] = "url"; roleNames[UrlRole] = "url";
roleNames[DisplayNameRole] = "displayName";
roleNames[FileNameRole] = "fileName"; roleNames[FileNameRole] = "fileName";
roleNames[FileSizeRole] = "fileSize"; roleNames[FileSizeRole] = "fileSize";
roleNames[IconNameRole] = "iconName"; roleNames[IconNameRole] = "iconName";
roleNames[ThumbnailRole] = "thumbnail"; roleNames[ThumbnailRole] = "thumbnail";
roleNames[ModifiedRole] = "modified"; roleNames[ModifiedRole] = "modified";
roleNames[IsDesktopFileRole] = "desktopFile";
return roleNames; return roleNames;
} }
@ -157,9 +159,18 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
return m_selectionModel->isSelected(index); return m_selectionModel->isSelected(index);
case UrlRole: case UrlRole:
return item.url(); return item.url();
case DisplayNameRole: {
if (item.isDesktopFile())
return "";
return item.url().fileName();
}
case FileNameRole: { case FileNameRole: {
return item.url().fileName(); return item.url().fileName();
} }
case IsDesktopFileRole: {
return item.isDesktopFile();
}
case FileSizeRole: { case FileSizeRole: {
if (item.isDir()) { if (item.isDir()) {
QDir dir(item.url().toLocalFile()); QDir dir(item.url().toLocalFile());

View file

@ -61,11 +61,13 @@ public:
SelectedRole, SelectedRole,
IsDirRole, IsDirRole,
UrlRole, UrlRole,
DisplayNameRole,
FileNameRole, FileNameRole,
FileSizeRole, FileSizeRole,
IconNameRole, IconNameRole,
ThumbnailRole, ThumbnailRole,
ModifiedRole ModifiedRole,
IsDesktopFileRole
}; };
enum FilterMode { enum FilterMode {

View file

@ -49,6 +49,7 @@ Item {
height: width height: width
sourceSize: Qt.size(width, height) sourceSize: Qt.size(width, height)
smooth: false smooth: false
antialiasing: true
} }
MouseArea { MouseArea {

View file

@ -41,6 +41,7 @@ Item {
Loader { Loader {
id: backgroundLoader id: backgroundLoader
anchors.fill: parent anchors.fill: parent
anchors.margins: 0
sourceComponent: settings.backgroundType === 0 ? wallpaper : background sourceComponent: settings.backgroundType === 0 ? wallpaper : background
} }

View file

@ -95,6 +95,7 @@ Item {
source: "image://icontheme/" + model.iconName source: "image://icontheme/" + model.iconName
visible: !_image.visible visible: !_image.visible
smooth: false smooth: false
antialiasing: true
ColorOverlay { ColorOverlay {
anchors.fill: _icon anchors.fill: _icon
@ -123,12 +124,12 @@ Item {
visible: status === Image.Ready visible: status === Image.Ready
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter
sourceSize.width: width sourceSize: Qt.size(width, height)
sourceSize.height: height
source: model.thumbnail ? model.thumbnail : "" source: model.thumbnail ? model.thumbnail : ""
asynchronous: true asynchronous: true
cache: false cache: false
smooth: false smooth: false
antialiasing: true
// Because of the effect of OpacityMask. // Because of the effect of OpacityMask.
ColorOverlay { ColorOverlay {

View file

@ -127,6 +127,7 @@ Item {
text: model.fileName text: model.fileName
Layout.fillWidth: true Layout.fillWidth: true
color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor
textFormat: Text.PlainText
elide: Qt.ElideMiddle elide: Qt.ElideMiddle
} }
@ -134,12 +135,14 @@ Item {
id: _label2 id: _label2
text: model.fileSize text: model.fileSize
color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.disabledTextColor color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.disabledTextColor
textFormat: Text.PlainText
Layout.fillWidth: true Layout.fillWidth: true
} }
} }
Label { Label {
text: model.modified text: model.modified
textFormat: Text.PlainText
color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.disabledTextColor color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.disabledTextColor
} }
} }

View file

@ -209,11 +209,11 @@ Item {
height: statusBarHeight height: statusBarHeight
z: 999 z: 999
Rectangle { // Rectangle {
anchors.fill: parent // anchors.fill: parent
color: FishUI.Theme.backgroundColor // color: FishUI.Theme.backgroundColor
opacity: 0.7 // opacity: 0.7
} // }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent

View file

@ -105,12 +105,14 @@ ListView {
source: "qrc:/images/" + (FishUI.Theme.darkMode || _item.checked ? "dark/" : "light/") + model.iconPath source: "qrc:/images/" + (FishUI.Theme.darkMode || _item.checked ? "dark/" : "light/") + model.iconPath
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
smooth: false smooth: false
antialiasing: true
} }
Label { Label {
id: _label id: _label
text: model.name text: model.name
color: checked ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor color: checked ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor
elide: Text.ElideRight
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
} }

View file

@ -35,7 +35,7 @@ FishUI.Window {
title: qsTr("File Manager") title: qsTr("File Manager")
header.height: 36 + FishUI.Units.largeSpacing header.height: 36 + FishUI.Units.largeSpacing
background.opacity: 0.95 background.opacity: 0.9
FishUI.WindowBlur { FishUI.WindowBlur {
view: root view: root