Update FishUI

This commit is contained in:
cutefishd 2021-04-09 22:49:19 +08:00
parent 29ce0f551d
commit 3c0d077970
13 changed files with 157 additions and 140 deletions

View file

@ -12,7 +12,7 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 COMPONENTS Core DBus Quick LinguistTools REQUIRED) find_package(Qt5 COMPONENTS Core DBus Quick LinguistTools REQUIRED)
find_package(MeuiKit REQUIRED) find_package(FishUI REQUIRED)
find_package(KF5KIO) find_package(KF5KIO)
find_package(KF5Solid) find_package(KF5Solid)
@ -53,7 +53,7 @@ target_link_libraries(cutefish-filemanager
KF5::KIOWidgets KF5::KIOWidgets
KF5::Solid KF5::Solid
MeuiKit FishUI
) )
file(GLOB TS_FILES translations/*.ts) file(GLOB TS_FILES translations/*.ts)

View file

@ -1,5 +1,5 @@
import QtQuick 2.12 import QtQuick 2.12
import MeuiKit 1.0 as Meui import FishUI 1.0 as FishUI
Item { Item {
id: control id: control
@ -7,18 +7,18 @@ Item {
height: 24 height: 24
property alias source: _image.source property alias source: _image.source
property color hoveredColor: Meui.Theme.darkMode ? Qt.lighter(Meui.Theme.backgroundColor, 1.1) property color hoveredColor: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.backgroundColor, 1.1)
: Qt.darker(Meui.Theme.backgroundColor, 1.2) : Qt.darker(FishUI.Theme.backgroundColor, 1.2)
property color pressedColor: Meui.Theme.darkMode ? Qt.lighter(Meui.Theme.backgroundColor, 1.2) property color pressedColor: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.backgroundColor, 1.2)
: Qt.darker(Meui.Theme.backgroundColor, 1.3) : Qt.darker(FishUI.Theme.backgroundColor, 1.3)
signal clicked() signal clicked()
Rectangle { Rectangle {
id: _background id: _background
anchors.fill: parent anchors.fill: parent
radius: Meui.Theme.smallRadius radius: FishUI.Theme.smallRadius
color: _mouseArea.pressed ? pressedColor : _mouseArea.containsMouse ? control.hoveredColor : Meui.Theme.backgroundColor color: _mouseArea.pressed ? pressedColor : _mouseArea.containsMouse ? control.hoveredColor : FishUI.Theme.backgroundColor
} }
Image { Image {

View file

@ -4,7 +4,7 @@ import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import Cutefish.FileManager 1.0 import Cutefish.FileManager 1.0
import MeuiKit 1.0 as Meui import FishUI 1.0 as FishUI
import "../" import "../"
Item { Item {
@ -48,7 +48,7 @@ Item {
anchors.fill: parent anchors.fill: parent
source: parent source: parent
color: "#000000" color: "#000000"
opacity: Meui.Theme.darkMode && settings.dimsWallpaper ? 0.4 : 0.0 opacity: FishUI.Theme.darkMode && settings.dimsWallpaper ? 0.4 : 0.0
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
@ -128,6 +128,8 @@ Item {
dirModel.requestRename() dirModel.requestRename()
else if (event.key === Qt.Key_A && event.modifiers & Qt.ControlModifier) else if (event.key === Qt.Key_A && event.modifiers & Qt.ControlModifier)
dirModel.selectAll() dirModel.selectAll()
else if (event.key === Qt.Key_Delete)
dirModel.keyDeletePress()
} }
} }
@ -140,7 +142,7 @@ Item {
width: 0 width: 0
height: 0 height: 0
z: 99999 z: 99999
color: Meui.Theme.highlightColor color: FishUI.Theme.highlightColor
function close() { function close() {
opacityAnimation.restart() opacityAnimation.restart()

View file

@ -2,7 +2,7 @@ import QtQuick 2.12
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import QtQuick.Window 2.12 import QtQuick.Window 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import MeuiKit 1.0 as Meui import FishUI 1.0 as FishUI
Window { Window {
id: control id: control
@ -11,8 +11,8 @@ Window {
flags: Qt.Dialog flags: Qt.Dialog
visible: true visible: true
width: 400 + Meui.Units.largeSpacing * 2 width: 400 + FishUI.Units.largeSpacing * 2
height: _mainLayout.implicitHeight + Meui.Units.largeSpacing * 2 height: _mainLayout.implicitHeight + FishUI.Units.largeSpacing * 2
minimumWidth: width minimumWidth: width
minimumHeight: height minimumHeight: height
@ -21,14 +21,14 @@ Window {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Meui.Theme.backgroundColor color: FishUI.Theme.backgroundColor
} }
ColumnLayout { ColumnLayout {
id: _mainLayout id: _mainLayout
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: Meui.Units.largeSpacing anchors.leftMargin: FishUI.Units.largeSpacing
anchors.rightMargin: Meui.Units.largeSpacing anchors.rightMargin: FishUI.Units.largeSpacing
spacing: 0 spacing: 0
TextField { TextField {

View file

@ -2,7 +2,7 @@ import QtQuick 2.12
import QtQuick.Window 2.12 import QtQuick.Window 2.12
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import MeuiKit 1.0 as Meui import FishUI 1.0 as FishUI
Window { Window {
id: control id: control
@ -13,7 +13,7 @@ Window {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Meui.Theme.backgroundColor color: FishUI.Theme.backgroundColor
} }
onVisibleChanged: { onVisibleChanged: {
@ -45,14 +45,14 @@ Window {
ColumnLayout { ColumnLayout {
id: _mainLayout id: _mainLayout
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: Meui.Units.largeSpacing * 2 anchors.leftMargin: FishUI.Units.largeSpacing * 2
anchors.rightMargin: Meui.Units.largeSpacing * 2 anchors.rightMargin: FishUI.Units.largeSpacing * 2
anchors.topMargin: Meui.Units.largeSpacing anchors.topMargin: FishUI.Units.largeSpacing
anchors.bottomMargin: Meui.Units.largeSpacing anchors.bottomMargin: FishUI.Units.largeSpacing
spacing: Meui.Units.largeSpacing spacing: FishUI.Units.largeSpacing
RowLayout { RowLayout {
spacing: Meui.Units.largeSpacing * 2 spacing: FishUI.Units.largeSpacing * 2
Image { Image {
width: 64 width: 64
@ -73,8 +73,8 @@ Window {
GridLayout { GridLayout {
columns: 2 columns: 2
columnSpacing: Meui.Units.largeSpacing columnSpacing: FishUI.Units.largeSpacing
rowSpacing: Meui.Units.largeSpacing rowSpacing: FishUI.Units.largeSpacing
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
onHeightChanged: updateWindowSize() onHeightChanged: updateWindowSize()
@ -83,7 +83,7 @@ Window {
Label { Label {
text: qsTr("Type:") text: qsTr("Type:")
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
color: Meui.Theme.disabledTextColor color: FishUI.Theme.disabledTextColor
visible: mimeType.visible visible: mimeType.visible
} }
@ -96,7 +96,7 @@ Window {
Label { Label {
text: qsTr("Location:") text: qsTr("Location:")
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
color: Meui.Theme.disabledTextColor color: FishUI.Theme.disabledTextColor
} }
Label { Label {
@ -107,7 +107,7 @@ Window {
Label { Label {
text: qsTr("Size:") text: qsTr("Size:")
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
color: Meui.Theme.disabledTextColor color: FishUI.Theme.disabledTextColor
// visible: size.visible // visible: size.visible
} }
@ -120,7 +120,7 @@ Window {
Label { Label {
text: qsTr("Created:") text: qsTr("Created:")
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
color: Meui.Theme.disabledTextColor color: FishUI.Theme.disabledTextColor
visible: creationTime.visible visible: creationTime.visible
} }
@ -133,7 +133,7 @@ Window {
Label { Label {
text: qsTr("Modified:") text: qsTr("Modified:")
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
color: Meui.Theme.disabledTextColor color: FishUI.Theme.disabledTextColor
visible: modifiedTime.visible visible: modifiedTime.visible
} }
@ -146,7 +146,7 @@ Window {
Label { Label {
text: qsTr("Accessed:") text: qsTr("Accessed:")
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
color: Meui.Theme.disabledTextColor color: FishUI.Theme.disabledTextColor
visible: accessTime.visible visible: accessTime.visible
} }
@ -158,12 +158,12 @@ Window {
} }
Item { Item {
height: Meui.Units.largeSpacing height: FishUI.Units.largeSpacing
} }
RowLayout { RowLayout {
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
spacing: Meui.Units.largeSpacing spacing: FishUI.Units.largeSpacing
Button { Button {
text: qsTr("Cancel") text: qsTr("Cancel")

View file

@ -4,7 +4,7 @@ import QtQuick.Controls 2.12
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import Cutefish.FileManager 1.0 import Cutefish.FileManager 1.0
import MeuiKit 1.0 as Meui import FishUI 1.0 as FishUI
Item { Item {
id: control id: control
@ -25,11 +25,11 @@ Item {
Rectangle { Rectangle {
id: _background id: _background
width: Math.max(_iconItem.width, _label.paintedWidth) width: Math.max(_iconItem.width, _label.paintedWidth)
height: _iconItem.height + _label.paintedHeight + Meui.Units.largeSpacing height: _iconItem.height + _label.paintedHeight + FishUI.Units.largeSpacing
x: (parent.width - width) / 2 x: (parent.width - width) / 2
y: _iconItem.y y: _iconItem.y
color: selected || hovered ? Meui.Theme.highlightColor : "transparent" color: selected || hovered ? FishUI.Theme.highlightColor : "transparent"
radius: Meui.Theme.mediumRadius radius: FishUI.Theme.mediumRadius
visible: selected || hovered visible: selected || hovered
opacity: selected ? 1.0 : 0.2 opacity: selected ? 1.0 : 0.2
} }
@ -38,11 +38,11 @@ Item {
id: _iconItem id: _iconItem
anchors.top: parent.top anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: Meui.Units.largeSpacing anchors.topMargin: FishUI.Units.largeSpacing
anchors.bottomMargin: Meui.Units.largeSpacing anchors.bottomMargin: FishUI.Units.largeSpacing
z: 2 z: 2
width: parent.width - Meui.Units.largeSpacing * 2 width: parent.width - FishUI.Units.largeSpacing * 2
height: control.GridView.view.iconSize height: control.GridView.view.iconSize
Image { Image {
@ -58,9 +58,9 @@ Item {
Image { Image {
id: _image id: _image
anchors.fill: parent anchors.fill: parent
anchors.topMargin: Meui.Units.smallSpacing anchors.topMargin: FishUI.Units.smallSpacing
anchors.leftMargin: Meui.Units.smallSpacing anchors.leftMargin: FishUI.Units.smallSpacing
anchors.rightMargin: Meui.Units.smallSpacing anchors.rightMargin: FishUI.Units.smallSpacing
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
visible: status === Image.Ready visible: status === Image.Ready
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
@ -93,16 +93,16 @@ Item {
z: 2 z: 2
anchors.top: _iconItem.bottom anchors.top: _iconItem.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: Meui.Units.smallSpacing anchors.topMargin: FishUI.Units.smallSpacing
maximumLineCount: 2 maximumLineCount: 2
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
width: parent.width - Meui.Units.largeSpacing * 2 - Meui.Units.smallSpacing width: parent.width - FishUI.Units.largeSpacing * 2 - FishUI.Units.smallSpacing
textFormat: Text.PlainText textFormat: Text.PlainText
elide: Qt.ElideRight elide: Qt.ElideRight
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: model.fileName text: model.fileName
color: control.GridView.view.isDesktopView ? "white" color: control.GridView.view.isDesktopView ? "white"
: selected ? Meui.Theme.highlightedTextColor : Meui.Theme.textColor : selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor
} }
DropShadow { DropShadow {
@ -111,7 +111,7 @@ Item {
z: 1 z: 1
horizontalOffset: 1 horizontalOffset: 1
verticalOffset: 1 verticalOffset: 1
radius: Math.round(4 * Meui.Units.devicePixelRatio) radius: Math.round(4 * FishUI.Units.devicePixelRatio)
samples: radius * 2 + 1 samples: radius * 2 + 1
spread: 0.35 spread: 0.35
color: Qt.rgba(0, 0, 0, 0.3) color: Qt.rgba(0, 0, 0, 0.3)

View file

@ -3,7 +3,7 @@ import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import Cutefish.FileManager 1.0 import Cutefish.FileManager 1.0
import MeuiKit 1.0 as Meui import FishUI 1.0 as FishUI
GridView { GridView {
id: control id: control
@ -188,7 +188,7 @@ GridView {
} }
cellHeight: { cellHeight: {
var iconHeight = iconSize + (Meui.Units.fontMetrics.height * 2) + Meui.Units.largeSpacing * 2 var iconHeight = iconSize + (FishUI.Units.fontMetrics.height * 2) + FishUI.Units.largeSpacing * 2
if (isDesktopView) { if (isDesktopView) {
var extraHeight = calcExtraSpacing(iconHeight, control.height - topMargin - bottomMargin) var extraHeight = calcExtraSpacing(iconHeight, control.height - topMargin - bottomMargin)
return iconHeight + extraHeight return iconHeight + extraHeight
@ -197,7 +197,7 @@ GridView {
} }
cellWidth: { cellWidth: {
var iconWidth = iconSize + Meui.Units.largeSpacing * 4 var iconWidth = iconSize + FishUI.Units.largeSpacing * 4
var extraWidth = calcExtraSpacing(iconWidth, control.width - leftMargin - rightMargin) var extraWidth = calcExtraSpacing(iconWidth, control.width - leftMargin - rightMargin)
return iconWidth + extraWidth return iconWidth + extraWidth
} }
@ -317,7 +317,8 @@ GridView {
// //
if (mouse.buttons & Qt.RightButton) { if (mouse.buttons & Qt.RightButton) {
clearPressState() clearPressState()
dirModel.openContextMenu(null, mouse.modifiers) // dirModel.openContextMenu(null, mouse.modifiers)
folderMenu.open()
mouse.accepted = true mouse.accepted = true
} }
} }
@ -453,8 +454,8 @@ GridView {
var step = rows ? cellWidth : cellHeight var step = rows ? cellWidth : cellHeight
var perStripe = Math.floor(axis / step) var perStripe = Math.floor(axis / step)
var stripes = Math.ceil(control.count / perStripe) var stripes = Math.ceil(control.count / perStripe)
var cWidth = control.cellWidth - (2 * Meui.Units.smallSpacing) var cWidth = control.cellWidth - (2 * FishUI.Units.smallSpacing)
var cHeight = control.cellHeight - (2 * Meui.Units.smallSpacing) var cHeight = control.cellHeight - (2 * FishUI.Units.smallSpacing)
var midWidth = control.cellWidth / 2 var midWidth = control.cellWidth / 2
var midHeight = control.cellHeight / 2 var midHeight = control.cellHeight / 2
var indices = [] var indices = []
@ -482,7 +483,7 @@ GridView {
// Check if the rubberband intersects this cell first to avoid doing more // Check if the rubberband intersects this cell first to avoid doing more
// expensive work. // expensive work.
if (control.rubberBand.intersects(Qt.rect(itemX + Meui.Units.smallSpacing, itemY + Meui.Units.smallSpacing, if (control.rubberBand.intersects(Qt.rect(itemX + FishUI.Units.smallSpacing, itemY + FishUI.Units.smallSpacing,
cWidth, cHeight))) { cWidth, cHeight))) {
var item = control.contentItem.childAt(itemX + midWidth, itemY + midHeight) var item = control.contentItem.childAt(itemX + midWidth, itemY + midHeight)
@ -520,7 +521,7 @@ GridView {
var extraSpacing = 0 var extraSpacing = 0
if (availableColumns > 0) { if (availableColumns > 0) {
var allColumnSize = availableColumns * cellSize var allColumnSize = availableColumns * cellSize
var extraSpace = Math.max(containerSize - allColumnSize, Meui.Units.largeSpacing) var extraSpace = Math.max(containerSize - allColumnSize, FishUI.Units.largeSpacing)
extraSpacing = extraSpace / availableColumns extraSpacing = extraSpace / availableColumns
} }
return Math.floor(extraSpacing) return Math.floor(extraSpacing)
@ -565,18 +566,18 @@ GridView {
wrapMode: TextEdit.Wrap wrapMode: TextEdit.Wrap
horizontalAlignment: TextEdit.AlignHCenter horizontalAlignment: TextEdit.AlignHCenter
z: 999 z: 999
topPadding: Meui.Units.smallSpacing topPadding: FishUI.Units.smallSpacing
bottomPadding: Meui.Units.smallSpacing bottomPadding: FishUI.Units.smallSpacing
property Item targetItem: null property Item targetItem: null
onTargetItemChanged: { onTargetItemChanged: {
if (targetItem != null) { if (targetItem != null) {
var pos = control.mapFromItem(targetItem, targetItem.labelArea.x, targetItem.labelArea.y) var pos = control.mapFromItem(targetItem, targetItem.labelArea.x, targetItem.labelArea.y)
width = targetItem.width - Meui.Units.smallSpacing width = targetItem.width - FishUI.Units.smallSpacing
height = targetItem.labelArea.paintedHeight + Meui.Units.largeSpacing * 2 height = targetItem.labelArea.paintedHeight + FishUI.Units.largeSpacing * 2
x = targetItem.x + Math.abs(Math.min(control.contentX, control.originX)) x = targetItem.x + Math.abs(Math.min(control.contentX, control.originX))
y = pos.y - Meui.Units.largeSpacing y = pos.y - FishUI.Units.largeSpacing
text = targetItem.labelArea.text text = targetItem.labelArea.text
targetItem.labelArea.visible = false targetItem.labelArea.visible = false
_editor.select(0, dirModel.fileExtensionBoundary(targetItem.index)) _editor.select(0, dirModel.fileExtensionBoundary(targetItem.index))

View file

@ -2,7 +2,7 @@ import QtQuick 2.12
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import MeuiKit 1.0 as Meui import FishUI 1.0 as FishUI
Item { Item {
id: _listItem id: _listItem
@ -21,10 +21,10 @@ Item {
property bool selected: model.selected property bool selected: model.selected
property bool blank: model.blank property bool blank: model.blank
property color hoveredColor: Meui.Theme.darkMode ? Qt.lighter(Meui.Theme.backgroundColor, 1.1) property color hoveredColor: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.backgroundColor, 1.1)
: Qt.darker(Meui.Theme.backgroundColor, 1.05) : Qt.darker(FishUI.Theme.backgroundColor, 1.05)
property color selectedColor: Meui.Theme.darkMode ? Qt.lighter(Meui.Theme.backgroundColor, 1.2) property color selectedColor: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.backgroundColor, 1.2)
: Qt.darker(Meui.Theme.backgroundColor, 1.15) : Qt.darker(FishUI.Theme.backgroundColor, 1.15)
// onSelectedChanged: { // onSelectedChanged: {
// if (selected && !blank) { // if (selected && !blank) {
// _listItem.grabToImage(function(result) { // _listItem.grabToImage(function(result) {
@ -39,17 +39,17 @@ Item {
Rectangle { Rectangle {
id: _background id: _background
anchors.fill: parent anchors.fill: parent
radius: Meui.Theme.smallRadius radius: FishUI.Theme.smallRadius
color: selected ? Meui.Theme.highlightColor : hovered ? hoveredColor : "transparent" color: selected ? FishUI.Theme.highlightColor : hovered ? hoveredColor : "transparent"
visible: selected || hovered visible: selected || hovered
} }
RowLayout { RowLayout {
id: _mainLayout id: _mainLayout
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: Meui.Units.smallSpacing anchors.leftMargin: FishUI.Units.smallSpacing
anchors.rightMargin: Meui.Units.smallSpacing anchors.rightMargin: FishUI.Units.smallSpacing
spacing: Meui.Units.largeSpacing spacing: FishUI.Units.largeSpacing
Item { Item {
id: iconItem id: iconItem
@ -104,21 +104,21 @@ Item {
id: _label id: _label
text: model.fileName text: model.fileName
Layout.fillWidth: true Layout.fillWidth: true
color: selected ? Meui.Theme.highlightedTextColor : Meui.Theme.textColor color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor
elide: Qt.ElideMiddle elide: Qt.ElideMiddle
} }
Label { Label {
id: _label2 id: _label2
text: model.fileSize text: model.fileSize
color: selected ? Meui.Theme.highlightedTextColor : Meui.Theme.disabledTextColor color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.disabledTextColor
Layout.fillWidth: true Layout.fillWidth: true
} }
} }
Label { Label {
text: model.modified text: model.modified
color: selected ? Meui.Theme.highlightedTextColor : Meui.Theme.disabledTextColor color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.disabledTextColor
} }
} }
} }

View file

@ -1,7 +1,7 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import MeuiKit 1.0 as Meui import FishUI 1.0 as FishUI
import Cutefish.FileManager 1.0 import Cutefish.FileManager 1.0
ListView { ListView {
@ -27,7 +27,7 @@ ListView {
property Item editor: null property Item editor: null
property int anchorIndex: 0 property int anchorIndex: 0
property var itemHeight: Meui.Units.fontMetrics.height * 2 + Meui.Units.largeSpacing property var itemHeight: FishUI.Units.fontMetrics.height * 2 + FishUI.Units.largeSpacing
property variant cachedRectangleSelection: null property variant cachedRectangleSelection: null
@ -380,7 +380,7 @@ ListView {
if (targetItem != null) { if (targetItem != null) {
var pos = control.mapFromItem(targetItem, targetItem.labelArea.x, targetItem.labelArea.y) var pos = control.mapFromItem(targetItem, targetItem.labelArea.x, targetItem.labelArea.y)
width = targetItem.labelArea.width width = targetItem.labelArea.width
height = Meui.Units.fontMetrics.height + Meui.Units.largeSpacing * 2 height = FishUI.Units.fontMetrics.height + FishUI.Units.largeSpacing * 2
x = control.mapFromItem(targetItem.labelArea, 0, 0).x x = control.mapFromItem(targetItem.labelArea, 0, 0).x
y = pos.y + (targetItem.height - height) / 2 y = pos.y + (targetItem.height - height) / 2
text = targetItem.labelArea.text text = targetItem.labelArea.text

View file

@ -3,7 +3,7 @@ import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import Cutefish.FileManager 1.0 import Cutefish.FileManager 1.0
import MeuiKit 1.0 as Meui import FishUI 1.0 as FishUI
import "./Dialogs" import "./Dialogs"
@ -24,10 +24,10 @@ Item {
Rectangle { Rectangle {
id: _background id: _background
anchors.fill: parent anchors.fill: parent
anchors.rightMargin: Meui.Theme.smallRadius anchors.rightMargin: FishUI.Theme.smallRadius
anchors.bottomMargin: Meui.Theme.smallRadius anchors.bottomMargin: FishUI.Theme.smallRadius
radius: Meui.Theme.smallRadius radius: FishUI.Theme.smallRadius
color: Meui.Theme.backgroundColor color: FishUI.Theme.backgroundColor
} }
Label { Label {
@ -60,9 +60,23 @@ Item {
_viewLoader.item.contentWidth, _viewLoader.item.contentHeight) _viewLoader.item.contentWidth, _viewLoader.item.contentHeight)
} }
FishUI.DesktopMenu {
id: folderMenu
MenuItem {
text: qsTr("Open")
onTriggered: dirModel.openSelected()
}
MenuItem {
text: qsTr("Properties")
onTriggered: dirModel.openPropertiesDialog()
}
}
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
anchors.bottomMargin: Meui.Theme.smallRadius anchors.bottomMargin: FishUI.Theme.smallRadius
spacing: 0 spacing: 0
Loader { Loader {
@ -103,10 +117,10 @@ Item {
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: Meui.Units.largeSpacing anchors.leftMargin: FishUI.Units.largeSpacing
anchors.rightMargin: Meui.Units.largeSpacing anchors.rightMargin: FishUI.Units.largeSpacing
anchors.bottomMargin: 1 anchors.bottomMargin: 1
spacing: Meui.Units.largeSpacing spacing: FishUI.Units.largeSpacing
Label { Label {
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
@ -144,10 +158,10 @@ Item {
model: dirModel model: dirModel
delegate: FolderGridItem {} delegate: FolderGridItem {}
leftMargin: Meui.Units.largeSpacing leftMargin: FishUI.Units.largeSpacing
rightMargin: Meui.Units.largeSpacing rightMargin: FishUI.Units.largeSpacing
topMargin: Meui.Units.smallSpacing topMargin: FishUI.Units.smallSpacing
bottomMargin: Meui.Units.smallSpacing bottomMargin: FishUI.Units.smallSpacing
onIconSizeChanged: { onIconSizeChanged: {
// Save // Save
@ -167,10 +181,10 @@ Item {
id: _folderListView id: _folderListView
model: dirModel model: dirModel
topMargin: Meui.Units.largeSpacing topMargin: FishUI.Units.largeSpacing
leftMargin: Meui.Units.largeSpacing leftMargin: FishUI.Units.largeSpacing
rightMargin: Meui.Units.largeSpacing + Meui.Theme.smallRadius rightMargin: FishUI.Units.largeSpacing + FishUI.Theme.smallRadius
spacing: Meui.Units.largeSpacing spacing: FishUI.Units.largeSpacing
onCountChanged: { onCountChanged: {
_fileTips.visible = count === 0 _fileTips.visible = count === 0
@ -189,7 +203,7 @@ Item {
width: 0 width: 0
height: 0 height: 0
z: 99999 z: 99999
color: Meui.Theme.highlightColor color: FishUI.Theme.highlightColor
function close() { function close() {
opacityAnimation.restart() opacityAnimation.restart()

View file

@ -3,7 +3,7 @@ import QtQuick.Controls 2.12
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import Cutefish.FileManager 1.0 import Cutefish.FileManager 1.0
import MeuiKit 1.0 as Meui import FishUI 1.0 as FishUI
Item { Item {
id: control id: control
@ -23,7 +23,7 @@ Item {
leftMargin: 3 leftMargin: 3
rightMargin: 3 rightMargin: 3
spacing: Meui.Units.smallSpacing spacing: FishUI.Units.smallSpacing
onCountChanged: { onCountChanged: {
_pathView.currentIndex = _pathView.count - 1 _pathView.currentIndex = _pathView.count - 1
@ -32,8 +32,8 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Meui.Theme.backgroundColor color: FishUI.Theme.backgroundColor
radius: Meui.Theme.smallRadius radius: FishUI.Theme.smallRadius
z: -1 z: -1
} }
@ -47,7 +47,7 @@ Item {
delegate: MouseArea { delegate: MouseArea {
id: _item id: _item
height: ListView.view.height height: ListView.view.height
width: _name.width + Meui.Units.largeSpacing width: _name.width + FishUI.Units.largeSpacing
z: -1 z: -1
property bool selected: index === _pathView.count - 1 property bool selected: index === _pathView.count - 1
@ -58,15 +58,15 @@ Item {
anchors.fill: parent anchors.fill: parent
anchors.topMargin: 2 anchors.topMargin: 2
anchors.bottomMargin: 2 anchors.bottomMargin: 2
color: Meui.Theme.highlightColor color: FishUI.Theme.highlightColor
radius: Meui.Theme.smallRadius radius: FishUI.Theme.smallRadius
visible: selected visible: selected
} }
Label { Label {
id: _name id: _name
text: model.name text: model.name
color: selected ? Meui.Theme.highlightedTextColor : Meui.Theme.textColor color: selected ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor
anchors.centerIn: parent anchors.centerIn: parent
} }
} }
@ -80,13 +80,13 @@ Item {
inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoAutoUppercase inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoAutoUppercase
text: control.url text: control.url
color: Meui.Theme.darkMode ? "white" : "black" color: FishUI.Theme.darkMode ? "white" : "black"
background: Rectangle { background: Rectangle {
radius: Meui.Theme.smallRadius radius: FishUI.Theme.smallRadius
color: Meui.Theme.darkMode ? Qt.darker(Meui.Theme.backgroundColor, 1.1) : "white" color: FishUI.Theme.darkMode ? Qt.darker(FishUI.Theme.backgroundColor, 1.1) : "white"
border.width: Meui.Units.extendBorderWidth border.width: FishUI.Units.extendBorderWidth
border.color: Meui.Theme.highlightColor border.color: FishUI.Theme.highlightColor
} }
onAccepted: { onAccepted: {

View file

@ -3,7 +3,7 @@ import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import MeuiKit 1.0 as Meui import FishUI 1.0 as FishUI
import Cutefish.FileManager 1.0 import Cutefish.FileManager 1.0
ListView { ListView {
@ -18,13 +18,13 @@ ListView {
model: placesModel model: placesModel
clip: true clip: true
leftMargin: Meui.Units.smallSpacing leftMargin: FishUI.Units.smallSpacing
rightMargin: Meui.Units.smallSpacing rightMargin: FishUI.Units.smallSpacing
bottomMargin: Meui.Units.smallSpacing bottomMargin: FishUI.Units.smallSpacing
spacing: Meui.Units.smallSpacing spacing: FishUI.Units.smallSpacing
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
bottomPadding: Meui.Units.smallSpacing bottomPadding: FishUI.Units.smallSpacing
} }
highlightFollowsCurrentItem: true highlightFollowsCurrentItem: true
@ -32,8 +32,8 @@ ListView {
highlightResizeDuration : 0 highlightResizeDuration : 0
highlight: Rectangle { highlight: Rectangle {
radius: Meui.Theme.smallRadius radius: FishUI.Theme.smallRadius
color: Meui.Theme.highlightColor color: FishUI.Theme.highlightColor
} }
delegate: Item { delegate: Item {
@ -42,8 +42,8 @@ ListView {
height: 40 height: 40
property bool checked: sideBar.currentIndex === index property bool checked: sideBar.currentIndex === index
property color hoveredColor: Meui.Theme.darkMode ? Qt.lighter(Meui.Theme.backgroundColor, 1.1) property color hoveredColor: FishUI.Theme.darkMode ? Qt.lighter(FishUI.Theme.backgroundColor, 1.1)
: Qt.darker(Meui.Theme.backgroundColor, 1.1) : Qt.darker(FishUI.Theme.backgroundColor, 1.1)
MouseArea { MouseArea {
id: _mouseArea id: _mouseArea
anchors.fill: parent anchors.fill: parent
@ -60,15 +60,15 @@ ListView {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
radius: Meui.Theme.smallRadius radius: FishUI.Theme.smallRadius
color: _mouseArea.containsMouse && !checked ? _item.hoveredColor : "transparent" color: _mouseArea.containsMouse && !checked ? _item.hoveredColor : "transparent"
} }
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: Meui.Units.smallSpacing anchors.leftMargin: FishUI.Units.smallSpacing
anchors.rightMargin: Meui.Units.smallSpacing anchors.rightMargin: FishUI.Units.smallSpacing
spacing: Meui.Units.smallSpacing spacing: FishUI.Units.smallSpacing
Image { Image {
height: _item.height * 0.55 height: _item.height * 0.55
@ -81,14 +81,14 @@ ListView {
anchors.fill: parent anchors.fill: parent
source: parent source: parent
color: _label.color color: _label.color
visible: Meui.Theme.darkMode && model.iconPath || checked visible: FishUI.Theme.darkMode && model.iconPath || checked
} }
} }
Label { Label {
id: _label id: _label
text: model.name text: model.name
color: checked ? Meui.Theme.highlightedTextColor : Meui.Theme.textColor color: checked ? FishUI.Theme.highlightedTextColor : FishUI.Theme.textColor
elide: Text.ElideRight elide: Text.ElideRight
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter

View file

@ -2,11 +2,11 @@ import QtQuick 2.12
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import QtQuick.Window 2.12 import QtQuick.Window 2.12
import MeuiKit 1.0 as Meui import FishUI 1.0 as FishUI
import "./Controls" import "./Controls"
Meui.Window { FishUI.Window {
id: root id: root
width: settings.width width: settings.width
height: settings.height height: settings.height
@ -15,8 +15,8 @@ Meui.Window {
visible: true visible: true
title: qsTr("File Manager") title: qsTr("File Manager")
headerBarHeight: 35 + Meui.Units.largeSpacing headerBarHeight: 35 + FishUI.Units.largeSpacing
backgroundColor: Meui.Theme.secondBackgroundColor backgroundColor: FishUI.Theme.secondBackgroundColor
property QtObject settings: GlobalSettings { } property QtObject settings: GlobalSettings { }
@ -31,17 +31,17 @@ Meui.Window {
headerBar: Item { headerBar: Item {
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: Meui.Units.smallSpacing anchors.leftMargin: FishUI.Units.smallSpacing
anchors.rightMargin: Meui.Units.smallSpacing anchors.rightMargin: FishUI.Units.smallSpacing
anchors.topMargin: Meui.Units.smallSpacing anchors.topMargin: FishUI.Units.smallSpacing
anchors.bottomMargin: Meui.Units.smallSpacing anchors.bottomMargin: FishUI.Units.smallSpacing
spacing: Meui.Units.smallSpacing spacing: FishUI.Units.smallSpacing
IconButton { IconButton {
Layout.fillHeight: true Layout.fillHeight: true
implicitWidth: height implicitWidth: height
source: Meui.Theme.darkMode ? "qrc:/images/dark/go-previous.svg" source: FishUI.Theme.darkMode ? "qrc:/images/dark/go-previous.svg"
: "qrc:/images/light/go-previous.svg" : "qrc:/images/light/go-previous.svg"
onClicked: _folderPage.goBack() onClicked: _folderPage.goBack()
} }
@ -49,7 +49,7 @@ Meui.Window {
IconButton { IconButton {
Layout.fillHeight: true Layout.fillHeight: true
implicitWidth: height implicitWidth: height
source: Meui.Theme.darkMode ? "qrc:/images/dark/go-next.svg" source: FishUI.Theme.darkMode ? "qrc:/images/dark/go-next.svg"
: "qrc:/images/light/go-next.svg" : "qrc:/images/light/go-next.svg"
onClicked: _folderPage.goForward() onClicked: _folderPage.goForward()
} }
@ -66,8 +66,8 @@ Meui.Window {
Layout.fillHeight: true Layout.fillHeight: true
implicitWidth: height implicitWidth: height
property var gridSource: Meui.Theme.darkMode ? "qrc:/images/dark/grid.svg" : "qrc:/images/light/grid.svg" property var gridSource: FishUI.Theme.darkMode ? "qrc:/images/dark/grid.svg" : "qrc:/images/light/grid.svg"
property var listSource: Meui.Theme.darkMode ? "qrc:/images/dark/list.svg" : "qrc:/images/light/list.svg" property var listSource: FishUI.Theme.darkMode ? "qrc:/images/dark/list.svg" : "qrc:/images/light/list.svg"
source: settings.viewMethod === 0 ? listSource : gridSource source: settings.viewMethod === 0 ? listSource : gridSource
@ -86,7 +86,7 @@ Meui.Window {
SideBar { SideBar {
id: _sideBar id: _sideBar
Layout.fillHeight: true Layout.fillHeight: true
width: 200 + Meui.Units.largeSpacing width: 200 + FishUI.Units.largeSpacing
onClicked: _folderPage.openUrl(path) onClicked: _folderPage.openUrl(path)
} }