mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Qt-Scaling: first cleanup pass
This commit is contained in:
+65
-65
@@ -19,7 +19,7 @@ Popup {
|
||||
property var nameFilters: ["*"]
|
||||
property bool showDirs: true
|
||||
property bool showHiddenFiles: false
|
||||
property real scaling: 1.0
|
||||
|
||||
property var selectedPaths: []
|
||||
property string currentPath: initialPath
|
||||
property bool shouldResetSelection: false
|
||||
@@ -137,23 +137,23 @@ Popup {
|
||||
}
|
||||
}
|
||||
|
||||
width: 900 * scaling
|
||||
height: 700 * scaling
|
||||
width: 900
|
||||
height: 700
|
||||
modal: true
|
||||
closePolicy: Popup.CloseOnEscape
|
||||
anchors.centerIn: Overlay.overlay
|
||||
|
||||
background: Rectangle {
|
||||
color: Color.mSurfaceVariant
|
||||
radius: Style.radiusL * scaling
|
||||
radius: Style.radiusL
|
||||
border.color: Color.mOutline
|
||||
border.width: Math.max(1, Style.borderS * scaling)
|
||||
border.width: Math.max(1, Style.borderS)
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: filePickerPanel
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginL * scaling
|
||||
anchors.margins: Style.marginL
|
||||
color: Color.transparent
|
||||
|
||||
property string filterText: ""
|
||||
@@ -181,21 +181,21 @@ Popup {
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: Style.marginM * scaling
|
||||
spacing: Style.marginM
|
||||
|
||||
// Header
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginM * scaling
|
||||
spacing: Style.marginM
|
||||
|
||||
NIcon {
|
||||
icon: "filepicker-folder"
|
||||
color: Color.mPrimary
|
||||
pointSize: Style.fontSizeXXL * scaling
|
||||
pointSize: Style.fontSizeXXL
|
||||
}
|
||||
NText {
|
||||
text: root.title
|
||||
pointSize: Style.fontSizeXL * scaling
|
||||
pointSize: Style.fontSizeXL
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Color.mPrimary
|
||||
Layout.fillWidth: true
|
||||
@@ -240,19 +240,19 @@ Popup {
|
||||
// Navigation toolbar
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 45 * scaling
|
||||
Layout.preferredHeight: 45
|
||||
color: Color.mSurfaceVariant
|
||||
radius: Style.radiusS * scaling
|
||||
radius: Style.radiusS
|
||||
border.color: Color.mOutline
|
||||
border.width: Math.max(1, Style.borderS * scaling)
|
||||
border.width: Math.max(1, Style.borderS)
|
||||
|
||||
RowLayout {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.leftMargin: Style.marginS * scaling
|
||||
anchors.rightMargin: Style.marginS * scaling
|
||||
spacing: Style.marginS * scaling
|
||||
anchors.leftMargin: Style.marginS
|
||||
anchors.rightMargin: Style.marginS
|
||||
spacing: Style.marginS
|
||||
|
||||
NIconButton {
|
||||
icon: "filepicker-arrow-up"
|
||||
@@ -339,25 +339,25 @@ Popup {
|
||||
// Search bar
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 45 * scaling
|
||||
Layout.preferredHeight: 45
|
||||
color: Color.mSurfaceVariant
|
||||
radius: Style.radiusS * scaling
|
||||
radius: Style.radiusS
|
||||
border.color: Color.mOutline
|
||||
border.width: Math.max(1, Style.borderS * scaling)
|
||||
border.width: Math.max(1, Style.borderS)
|
||||
visible: filePickerPanel.showSearchBar
|
||||
|
||||
RowLayout {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.leftMargin: Style.marginS * scaling
|
||||
anchors.rightMargin: Style.marginS * scaling
|
||||
spacing: Style.marginS * scaling
|
||||
anchors.leftMargin: Style.marginS
|
||||
anchors.rightMargin: Style.marginS
|
||||
spacing: Style.marginS
|
||||
|
||||
NIcon {
|
||||
icon: "filepicker-search"
|
||||
color: Color.mOnSurfaceVariant
|
||||
pointSize: Style.fontSizeS * scaling
|
||||
pointSize: Style.fontSizeS
|
||||
}
|
||||
NTextInput {
|
||||
id: searchInput
|
||||
@@ -396,9 +396,9 @@ Popup {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
color: Color.mSurface
|
||||
radius: Style.radiusM * scaling
|
||||
radius: Style.radiusM
|
||||
border.color: Color.mOutline
|
||||
border.width: Math.max(1, Style.borderS * scaling)
|
||||
border.width: Math.max(1, Style.borderS)
|
||||
|
||||
FolderListModel {
|
||||
id: folderModel
|
||||
@@ -447,9 +447,9 @@ Popup {
|
||||
ScrollBar {
|
||||
policy: ScrollBar.AsNeeded
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: 6 * scaling
|
||||
implicitWidth: 6
|
||||
implicitHeight: 100
|
||||
radius: Style.radiusM * scaling
|
||||
radius: Style.radiusM
|
||||
color: parent.pressed ? Qt.alpha(Color.mTertiary, 0.8) : parent.hovered ? Qt.alpha(Color.mTertiary, 0.8) : Qt.alpha(Color.mTertiary, 0.8)
|
||||
opacity: parent.policy === ScrollBar.AlwaysOn || parent.active ? 1.0 : 0.0
|
||||
Behavior on opacity {
|
||||
@@ -464,11 +464,11 @@ Popup {
|
||||
}
|
||||
}
|
||||
background: Rectangle {
|
||||
implicitWidth: 6 * scaling
|
||||
implicitWidth: 6
|
||||
implicitHeight: 100
|
||||
color: Color.transparent
|
||||
opacity: parent.policy === ScrollBar.AlwaysOn || parent.active ? 0.3 : 0.0
|
||||
radius: (Style.radiusM * scaling) / 2
|
||||
radius: (Style.radiusM) / 2
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Style.animationFast
|
||||
@@ -482,22 +482,22 @@ Popup {
|
||||
GridView {
|
||||
id: gridView
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginM * scaling
|
||||
anchors.margins: Style.marginM
|
||||
model: filteredModel
|
||||
visible: filePickerPanel.viewMode
|
||||
clip: true
|
||||
reuseItems: true
|
||||
|
||||
property int columns: Math.max(1, Math.floor(width / (120 * scaling)))
|
||||
property int itemSize: Math.floor((width - leftMargin - rightMargin - (columns * Style.marginS * scaling)) / columns)
|
||||
property int columns: Math.max(1, Math.floor(width / (120)))
|
||||
property int itemSize: Math.floor((width - leftMargin - rightMargin - (columns * Style.marginS)) / columns)
|
||||
|
||||
cellWidth: Math.floor((width - leftMargin - rightMargin) / columns)
|
||||
cellHeight: Math.floor(itemSize * 0.8) + Style.marginXS * scaling + Style.fontSizeS * scaling + Style.marginM * scaling
|
||||
cellHeight: Math.floor(itemSize * 0.8) + Style.marginXS + Style.fontSizeS + Style.marginM
|
||||
|
||||
leftMargin: Style.marginS * scaling
|
||||
rightMargin: Style.marginS * scaling
|
||||
topMargin: Style.marginS * scaling
|
||||
bottomMargin: Style.marginS * scaling
|
||||
leftMargin: Style.marginS
|
||||
rightMargin: Style.marginS
|
||||
topMargin: Style.marginS
|
||||
bottomMargin: Style.marginS
|
||||
|
||||
ScrollBar.vertical: scrollBarComponent.createObject(gridView, {
|
||||
"parent": gridView,
|
||||
@@ -511,7 +511,7 @@ Popup {
|
||||
width: gridView.itemSize
|
||||
height: gridView.cellHeight
|
||||
color: Color.transparent
|
||||
radius: Style.radiusM * scaling
|
||||
radius: Style.radiusM
|
||||
|
||||
property bool isSelected: filePickerPanel.currentSelection.includes(model.filePath)
|
||||
|
||||
@@ -520,7 +520,7 @@ Popup {
|
||||
color: Color.transparent
|
||||
radius: parent.radius
|
||||
border.color: isSelected ? Color.mSecondary : Color.mSurface
|
||||
border.width: Math.max(1, Style.borderL * scaling)
|
||||
border.width: Math.max(1, Style.borderL)
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationFast
|
||||
@@ -533,7 +533,7 @@ Popup {
|
||||
color: (mouseArea.containsMouse && !isSelected) ? Color.mTertiary : Color.transparent
|
||||
radius: parent.radius
|
||||
border.color: (mouseArea.containsMouse && !isSelected) ? Color.mTertiary : Color.transparent
|
||||
border.width: Math.max(1, Style.borderS * scaling)
|
||||
border.width: Math.max(1, Style.borderS)
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationFast
|
||||
@@ -548,8 +548,8 @@ Popup {
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginS * scaling
|
||||
spacing: Style.marginXS * scaling
|
||||
anchors.margins: Style.marginS
|
||||
spacing: Style.marginXS
|
||||
|
||||
Rectangle {
|
||||
id: iconContainer
|
||||
@@ -567,15 +567,15 @@ Popup {
|
||||
Image {
|
||||
id: thumbnail
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginXS * scaling
|
||||
anchors.margins: Style.marginXS
|
||||
source: iconContainer.isImage ? "file://" + model.filePath : ""
|
||||
fillMode: Image.PreserveAspectFit
|
||||
visible: iconContainer.isImage && status === Image.Ready
|
||||
smooth: false
|
||||
cache: true
|
||||
asynchronous: true
|
||||
sourceSize.width: 120 * scaling
|
||||
sourceSize.height: 120 * scaling
|
||||
sourceSize.width: 120
|
||||
sourceSize.height: 120
|
||||
onStatusChanged: {
|
||||
if (status === Image.Error)
|
||||
visible = false
|
||||
@@ -584,11 +584,11 @@ Popup {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Color.mSurfaceVariant
|
||||
radius: Style.radiusS * scaling
|
||||
radius: Style.radiusS
|
||||
visible: thumbnail.status === Image.Loading
|
||||
NIcon {
|
||||
icon: "filepicker-photo"
|
||||
pointSize: Style.fontSizeL * scaling
|
||||
pointSize: Style.fontSizeL
|
||||
color: Color.mOnSurfaceVariant
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
@@ -597,7 +597,7 @@ Popup {
|
||||
|
||||
NIcon {
|
||||
icon: model.fileIsDir ? "filepicker-folder" : root.getFileIcon(model.fileName)
|
||||
pointSize: Style.fontSizeXXL * 2 * scaling
|
||||
pointSize: Style.fontSizeXXL * 2
|
||||
color: {
|
||||
if (isSelected)
|
||||
return Color.mSecondary
|
||||
@@ -613,17 +613,17 @@ Popup {
|
||||
Rectangle {
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.margins: Style.marginS * scaling
|
||||
width: 24 * scaling
|
||||
height: 24 * scaling
|
||||
anchors.margins: Style.marginS
|
||||
width: 24
|
||||
height: 24
|
||||
radius: width / 2
|
||||
color: Color.mSecondary
|
||||
border.color: Color.mOutline
|
||||
border.width: Math.max(1, Style.borderS * scaling)
|
||||
border.width: Math.max(1, Style.borderS)
|
||||
visible: isSelected
|
||||
NIcon {
|
||||
icon: "filepicker-check"
|
||||
pointSize: Style.fontSizeS * scaling
|
||||
pointSize: Style.fontSizeS
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Color.mOnSecondary
|
||||
anchors.centerIn: parent
|
||||
@@ -641,7 +641,7 @@ Popup {
|
||||
else
|
||||
return Color.mOnSurfaceVariant
|
||||
}
|
||||
pointSize: Style.fontSizeS * scaling
|
||||
pointSize: Style.fontSizeS
|
||||
font.weight: isSelected ? Style.fontWeightBold : Style.fontWeightRegular
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
@@ -697,14 +697,14 @@ Popup {
|
||||
NListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
anchors.margins: Style.marginS * scaling
|
||||
anchors.margins: Style.marginS
|
||||
model: filteredModel
|
||||
visible: !filePickerPanel.viewMode
|
||||
|
||||
delegate: Rectangle {
|
||||
id: listItem
|
||||
width: listView.width
|
||||
height: 40 * scaling
|
||||
height: 40
|
||||
color: {
|
||||
if (filePickerPanel.currentSelection.includes(model.filePath))
|
||||
return Color.mSecondary
|
||||
@@ -712,7 +712,7 @@ Popup {
|
||||
return Color.mTertiary
|
||||
return Color.transparent
|
||||
}
|
||||
radius: Style.radiusS * scaling
|
||||
radius: Style.radiusS
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationFast
|
||||
@@ -721,20 +721,20 @@ Popup {
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Style.marginM * scaling
|
||||
anchors.rightMargin: Style.marginM * scaling
|
||||
spacing: Style.marginM * scaling
|
||||
anchors.leftMargin: Style.marginM
|
||||
anchors.rightMargin: Style.marginM
|
||||
spacing: Style.marginM
|
||||
|
||||
NIcon {
|
||||
icon: model.fileIsDir ? "filepicker-folder" : root.getFileIcon(model.fileName)
|
||||
pointSize: Style.fontSizeL * scaling
|
||||
pointSize: Style.fontSizeL
|
||||
color: model.fileIsDir ? (filePickerPanel.currentSelection.includes(model.filePath) ? Color.mOnSecondary : Color.mPrimary) : Color.mOnSurfaceVariant
|
||||
}
|
||||
|
||||
NText {
|
||||
text: model.fileName
|
||||
color: filePickerPanel.currentSelection.includes(model.filePath) ? Color.mOnSecondary : Color.mOnSurface
|
||||
pointSize: Style.fontSizeM * scaling
|
||||
pointSize: Style.fontSizeM
|
||||
font.weight: filePickerPanel.currentSelection.includes(model.filePath) ? Style.fontWeightBold : Style.fontWeightRegular
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
@@ -743,7 +743,7 @@ Popup {
|
||||
NText {
|
||||
text: model.fileIsDir ? "" : root.formatFileSize(model.fileSize)
|
||||
color: filePickerPanel.currentSelection.includes(model.filePath) ? Color.mOnSecondary : Color.mOnSurfaceVariant
|
||||
pointSize: Style.fontSizeS * scaling
|
||||
pointSize: Style.fontSizeS
|
||||
visible: !model.fileIsDir
|
||||
Layout.preferredWidth: implicitWidth
|
||||
}
|
||||
@@ -795,7 +795,7 @@ Popup {
|
||||
// Footer
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginM * scaling
|
||||
spacing: Style.marginM
|
||||
|
||||
NText {
|
||||
text: {
|
||||
@@ -809,7 +809,7 @@ Popup {
|
||||
}
|
||||
}
|
||||
color: filePickerPanel.searchText.length > 0 ? Color.mPrimary : Color.mOnSurfaceVariant
|
||||
pointSize: Style.fontSizeS * scaling
|
||||
pointSize: Style.fontSizeS
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user