diff --git a/src/assets.qrc b/src/assets.qrc
index 2e6923c..f3e4ab2 100644
--- a/src/assets.qrc
+++ b/src/assets.qrc
@@ -1,21 +1,23 @@
assets/face-sleeping.png
assets/face-sleeping.svg
assets/maui-app.colors
assets/mauikit-logo.png
assets/ElectricPlug.png
assets/BugSearch.png
assets/MoonSki.png
assets/application-x-zerosize.svg
assets/animat-rocket-color.gif
assets/animat-diamond-color.gif
assets/animat-search-color.gif
assets/opendesktop.png
assets/folder-add.svg
assets/view-refresh.svg
assets/edit-find.svg
assets/dialog-information.svg
assets/cover.png
+ assets/arrow-down.svg
+ assets/dialog-close.svg
diff --git a/src/assets/arrow-down.svg b/src/assets/arrow-down.svg
new file mode 100644
index 0000000..5523456
--- /dev/null
+++ b/src/assets/arrow-down.svg
@@ -0,0 +1,114 @@
+
+
+
+
diff --git a/src/assets/dialog-close-bk.svg b/src/assets/dialog-close-bk.svg
new file mode 100644
index 0000000..209820f
--- /dev/null
+++ b/src/assets/dialog-close-bk.svg
@@ -0,0 +1,104 @@
+
+
+
+
diff --git a/src/assets/dialog-close.svg b/src/assets/dialog-close.svg
new file mode 100644
index 0000000..9719a27
--- /dev/null
+++ b/src/assets/dialog-close.svg
@@ -0,0 +1,109 @@
+
+
+
+
diff --git a/src/controls/Badge.qml b/src/controls/Badge.qml
index 0ae2b68..1c4d347 100644
--- a/src/controls/Badge.qml
+++ b/src/controls/Badge.qml
@@ -1,110 +1,110 @@
/*
* Copyright 2018 Camilo Higuita
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import org.kde.mauikit 1.0 as Maui
import org.kde.kirigami 2.7 as Kirigami
import "private"
Rectangle
{
id: control
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
property alias item : loader.item
- property bool hovered : false
+ property alias hovered : mouseArea.containsMouse
property int size: Maui.Style.iconSizes.small
property string iconName : ""
property string text : ""
signal clicked()
signal pressed()
signal hovered()
signal released()
z: parent.z+1
height: size + Maui.Style.space.small
width: Math.max(implicitWidth, height)
implicitWidth: (loader.sourceComponent == labelComponent ? Math.max(loader.item.implicitWidth + Maui.Style.space.small, control.height) : control.height)
radius: Math.min(width, height)
color: control.Kirigami.Theme.backgroundColor
border.color: Qt.tint(control.Kirigami.Theme.textColor, Qt.rgba(control.Kirigami.Theme.backgroundColor.r, control.Kirigami.Theme.backgroundColor.g, control.Kirigami.Theme.backgroundColor.b, 0.7))
clip: false
Loader
{
id: loader
anchors.fill: parent
sourceComponent: control.text.length && !control.iconName.length ? labelComponent : (!control.text.length && control.iconName.length ? iconComponent : undefined)
}
Component
{
id: labelComponent
Label
{
height: parent.height
width: parent.width
text: control.text
font.weight: Font.Bold
font.bold: true
font.pointSize: Maui.Style.fontSizes.default
- color: Kirigami.Theme.textColor
+ color: control.Kirigami.Theme.textColor
verticalAlignment: Qt.AlignVCenter
horizontalAlignment: Qt.AlignHCenter
}
}
Component
{
id: iconComponent
Kirigami.Icon
{
anchors.centerIn: parent
source: control.iconName
- color: Kirigami.Theme.textColor
+ color: control.Kirigami.Theme.textColor
width: control.size
height: width
+ isMask: color !== "transparent"
}
}
MouseArea
{
id: mouseArea
+ hoverEnabled: true
+
readonly property int targetMargin: Kirigami.Settings.isMobile ? Maui.Style.space.big : 0
height: parent.height + targetMargin
width: parent.width + targetMargin
anchors.centerIn: parent
onClicked: control.clicked()
onPressed: control.pressed()
onReleased: control.released()
- hoverEnabled: true
- onEntered: hovered = true
- onExited: hovered = false
}
}
diff --git a/src/controls/Dialog.qml b/src/controls/Dialog.qml
index 190e8ec..1e30a1c 100644
--- a/src/controls/Dialog.qml
+++ b/src/controls/Dialog.qml
@@ -1,183 +1,183 @@
/*
* Copyright 2018 Camilo Higuita
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.0
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import org.kde.mauikit 1.0 as Maui
import org.kde.kirigami 2.7 as Kirigami
Maui.Popup
{
id: control
property string message : ""
property string title: ""
property string acceptText: "Ok"
property string rejectText: "No"
property bool defaultButtons: true
property bool confirmationDialog: false
property bool entryField: false
default property alias content : page.contentData
property alias acceptButton : _acceptButton
property alias rejectButton : _rejectButton
property alias textEntry : _textEntry
property alias page : page
property alias footBar : page.footBar
property alias headBar: page.headBar
property alias closeButton: _closeButton
signal accepted()
signal rejected()
clip: false
maxWidth: Maui.Style.unit * 300
maxHeight: (_pageContent.implicitHeight * 1.2) + page.footBar.height + Maui.Style.space.huge + page.padding
widthHint: 0.9
heightHint: 0.9
Maui.Badge
{
id: _closeButton
- iconName: "window-close"
- Kirigami.Theme.backgroundColor: hovered ? Kirigami.Theme.negativeTextColor : Kirigami.Theme.complementaryBackgroundColor
- Kirigami.Theme.textColor: Kirigami.Theme.highlightedTextColor
+ iconName: "qrc://assets/dialog-close.svg"
+// Kirigami.Theme.backgroundColor: hovered ? Kirigami.Theme.negativeTextColor : Kirigami.Theme.backgroundColor
+// Kirigami.Theme.textColor: Kirigami.Theme.highlightedTextColor
anchors
{
verticalCenter: parent.top
horizontalCenter: parent.left
horizontalCenterOffset: control.width === control.parent.width ? _closeButton.width : 0
}
z: control.z+999
onClicked: close()
}
Maui.Page
{
id: page
anchors.fill: parent
anchors.margins: Maui.Style.unit
padding: Maui.Style.space.medium
footBar.visible: control.defaultButtons || footBar.count > 1
property QtObject _rejectButton : Button
{
id: _rejectButton
visible: defaultButtons
Kirigami.Theme.textColor: Kirigami.Theme.negativeTextColor
Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.negativeTextColor.r, Kirigami.Theme.negativeTextColor.g, Kirigami.Theme.negativeTextColor.b, 0.2)
text: rejectText
onClicked: rejected()
}
property QtObject _acceptButton: Button
{
id: _acceptButton
visible: defaultButtons
Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.positiveTextColor.r, Kirigami.Theme.positiveTextColor.g, Kirigami.Theme.positiveTextColor.b, 0.2)
Kirigami.Theme.textColor: Kirigami.Theme.positiveTextColor
text: acceptText
onClicked: accepted()
}
Component
{
id: _defaultButtonsComponent
Row
{
spacing: Maui.Style.space.big
children: [_rejectButton, _acceptButton]
}
}
footBar.rightContent: Loader
{
sourceComponent: control.defaultButtons ? _defaultButtonsComponent : undefined
}
ColumnLayout
{
id: _pageContent
anchors.fill: parent
spacing: Maui.Style.space.medium
Label
{
width: parent.width
height: visible ? implicitHeight : 0
visible: title.length > 0
Layout.fillWidth: visible
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
color: Kirigami.Theme.textColor
text: title
font.weight: Font.Thin
font.bold: true
font.pointSize:Maui.Style.fontSizes.huge
elide: Qt.ElideRight
wrapMode: Text.Wrap
}
Kirigami.ScrollablePage
{
visible: message.length > 0
Layout.fillHeight: visible
Layout.fillWidth: visible
Kirigami.Theme.backgroundColor: "transparent"
padding: 0
leftPadding: padding
rightPadding: padding
topPadding: padding
bottomPadding: padding
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Label
{
id: body
padding: 0
text: message
textFormat : TextEdit.AutoText
color: Kirigami.Theme.textColor
font.pointSize:Maui.Style.fontSizes.default
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
elide: Text.ElideLeft
}
}
Maui.TextField
{
id: _textEntry
focus: control.entryField
onAccepted: control.accepted()
Layout.fillWidth: entryField
height: entryField ? Maui.Style.iconSizes.big : 0
visible: entryField
}
}
}
}
diff --git a/src/controls/GridBrowserDelegate.qml b/src/controls/GridBrowserDelegate.qml
index bbdec51..28222b6 100644
--- a/src/controls/GridBrowserDelegate.qml
+++ b/src/controls/GridBrowserDelegate.qml
@@ -1,242 +1,238 @@
/*
* Copyright 2018 Camilo Higuita
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.7 as Kirigami
import org.kde.mauikit 1.0 as Maui
import QtGraphicalEffects 1.0
import "private"
Maui.ItemDelegate
{
id: control
property int folderSize : Maui.Style.iconSizes.big
property int emblemSize: Maui.Style.iconSizes.medium
property bool showLabel : true
property bool showEmblem : false
property bool showTooltip : false
property bool showThumbnails : false
property bool isSelected : false
property bool keepEmblemOverlay : false
property string rightEmblem
property string leftEmblem
property alias dropArea : _dropArea
isCurrentItem : GridView.isCurrentItem || isSelected
signal emblemClicked(int index)
signal rightEmblemClicked(int index)
signal leftEmblemClicked(int index)
signal contentDropped(var drop)
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: control.hovered && control.showTooltip
ToolTip.text: model.tooltip ? model.tooltip : model.path
background: null
DropArea
{
id: _dropArea
anchors.fill: parent
enabled: control.draggable
Rectangle
{
anchors.fill: parent
radius: Maui.Style.radiusV
color: control.Kirigami.Theme.highlightColor
visible: parent.containsDrag
}
onDropped:
{
control.contentDropped(drop)
}
}
Drag.active: mouseArea.drag.active && control.draggable
Drag.dragType: Drag.Automatic
Drag.supportedActions: Qt.CopyAction
Drag.mimeData:
{
"text/uri-list": model.path
}
Maui.Badge
{
id: _leftEmblemIcon
iconName: control.leftEmblem
visible: (control.hovered || control.keepEmblemOverlay || control.isSelected) && control.showEmblem && control.leftEmblem
z: mouseArea.z + 1
anchors.top: parent.top
anchors.left: parent.left
onClicked: leftEmblemClicked(index)
size: Maui.Style.iconSizes.small
}
Maui.Badge
{
id: _rightEmblemIcon
iconName: rightEmblem
visible: (control.hovered || control.keepEmblemOverlay) && control.showEmblem && control.rightEmblem
z: 999
size: Maui.Style.iconSizes.medium
anchors.top: parent.top
anchors.right: parent.right
onClicked: rightEmblemClicked(index)
}
Component
{
id: _imgComponent
Item
{
anchors.fill: parent
Image
{
id: img
anchors.centerIn: parent
source: model.thumbnail && model.thumbnail.length ? model.thumbnail : ""
height: Math.min (parent.height, img.implicitHeight)
width: Math.min(parent.width, img.implicitWidth)
sourceSize.width: width
sourceSize.height: height
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
fillMode: Image.PreserveAspectCrop
cache: false
asynchronous: true
smooth: !Kirigami.Settings.isMobile
layer.enabled: true
layer.effect: OpacityMask
{
maskSource: Item
{
width: img.width
height: img.height
Rectangle
{
anchors.centerIn: parent
width: img.width
height: img.height
radius: Maui.Style.radiusV
}
}
}
}
Loader
{
anchors.centerIn: parent
sourceComponent: img.status === Image.Ready ? null : _iconComponent
}
}
}
Component
{
id: _iconComponent
Item
{
anchors.fill: parent
Kirigami.Icon
{
anchors.centerIn: parent
source: model.icon
fallback: "qrc:/assets/application-x-zerosize.svg"
height: Math.min(control.folderSize, parent.width)
width: height
}
}
}
ColumnLayout
{
id: _layout
anchors.fill: parent
spacing: Maui.Style.space.tiny
opacity: (model.hidden == true || model.hidden == "true" )? 0.5 : 1
Loader
{
id: _loader
sourceComponent: model.mime ? (Maui.FM.checkFileType(Maui.FMList.IMAGE, model.mime) && control.showThumbnails && model.thumbnail && model.thumbnail.length? _imgComponent : _iconComponent) : _iconComponent
Layout.preferredHeight: Math.min(control.folderSize, width)
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
Layout.margins: Maui.Style.unit
}
Item
{
Layout.margins: Maui.Style.space.tiny
Layout.fillHeight: true
Layout.fillWidth: true
Label
{
id: label
text: model.label
width: parent.width
anchors.centerIn: parent
height: Math.min(implicitHeight + Maui.Style.space.medium, _layout.height - _loader.height)
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
elide: Qt.ElideRight
wrapMode: Text.Wrap
color: control.Kirigami.Theme.textColor
Rectangle
{
- anchors
- {
- fill: parent
- margins: 0
- }
-
+ anchors.fill: parent
+
Behavior on color
{
ColorAnimation
{
duration: Kirigami.Units.longDuration
}
}
color: control.isCurrentItem || control.hovered ? Qt.rgba(control.Kirigami.Theme.highlightColor.r, control.Kirigami.Theme.highlightColor.g, control.Kirigami.Theme.highlightColor.b, 0.2) : control.Kirigami.Theme.backgroundColor
radius: control.radius
border.color: control.isCurrentItem ? control.Kirigami.Theme.highlightColor : "transparent"
}
}
}
}
}
diff --git a/src/controls/SelectionBar.qml b/src/controls/SelectionBar.qml
index 122c38c..b05dce9 100644
--- a/src/controls/SelectionBar.qml
+++ b/src/controls/SelectionBar.qml
@@ -1,390 +1,390 @@
/*
* Copyright 2018 Camilo Higuita
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.7 as Kirigami
import org.kde.mauikit 1.0 as Maui
import "private"
Item
{
id: control
focus: true
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
- readonly property int barHeight : Maui.Style.iconSizes.large + (Maui.Style.space.large * 1.5)
+ readonly property int barHeight : Maui.Style.iconSizes.large + (Maui.Style.space.large * 1.8)
property var selectedPaths: []
property var selectedItems: []
property alias selectionList : selectionList
property alias anim : anim
property alias model : selectionList.model
property alias count : selectionList.count
property color animColor : "black"
property int position: Qt.Horizontal
property string iconName : "overflow-menu"
property bool iconVisible: true
/**
* if singleSelection is set to true then only a single item is selected
* at time, and replaced with a newe item appended
**/
property bool singleSelection: false
signal iconClicked()
signal cleared()
signal exitClicked()
signal itemClicked(int index)
signal itemPressAndHold(int index)
signal itemAdded(var item)
signal itemRemoved(var item)
signal pathAdded(string path)
signal pathRemoved(string path)
signal clicked(var mouse)
signal rightClicked(var mouse)
implicitHeight: if(position === Qt.Horizontal)
barHeight
else if(position === Qt.Vertical)
parent.height
else
undefined
implicitWidth: if(position === Qt.Horizontal)
parent.width
else if(position === Qt.Vertical)
barHeight
else
undefined
visible: control.count > 0
Rectangle
{
id: bg
anchors.fill: parent
color: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.6)
radius: Maui.Style.radiusV
opacity: 1
border.color: Kirigami.Theme.backgroundColor
MouseArea
{
anchors.fill: parent
acceptedButtons: Qt.RightButton | Qt.LeftButton
onClicked:
{
if(!Kirigami.Settings.isMobile && mouse.button === Qt.RightButton)
control.rightClicked(mouse)
else
control.clicked(mouse)
}
onPressAndHold :
{
if(Kirigami.Settings.isMobile)
control.rightClicked(mouse)
}
}
SequentialAnimation
{
id: anim
PropertyAnimation
{
target: bg
property: "opacity"
easing.type: Easing.InOutQuad
from: 0.5
to: 1
duration: 600
}
}
}
Maui.Badge
{
anchors.verticalCenter: parent.top
anchors.horizontalCenter: parent.left
- iconName: "window-close"
- Kirigami.Theme.backgroundColor: Kirigami.Theme.negativeTextColor
+ iconName: "qrc://assets/dialog-close.svg"
+ Kirigami.Theme.backgroundColor: Kirigami.Theme.negativeTextColor
Kirigami.Theme.textColor: Kirigami.Theme.highlightedTextColor
z: parent.z +1
onClicked:
{
clear()
exitClicked()
}
}
Maui.Badge
{
Kirigami.Theme.backgroundColor: Kirigami.Theme.highlightColor
text: selectionList.count
z: parent.z +1
anchors.verticalCenter: parent.top
anchors.horizontalCenter: parent.right
onClicked: clear()
}
GridLayout
{
anchors.fill: parent
anchors.margins: Maui.Style.space.small
rows: if(position === Qt.Horizontal)
1
else if(position === Qt.Vertical)
4
else
undefined
columns: if(position === Qt.Horizontal)
4
else if(position === Qt.Vertical)
1
else
undefined
Item
{
Layout.fillHeight: true
Layout.fillWidth: true
Layout.leftMargin: Maui.Style.space.small
Layout.column: if(position === Qt.Horizontal)
2
else if(position === Qt.Vertical)
1
else
undefined
Layout.row: if(position === Qt.Horizontal)
1
else if(position === Qt.Vertical)
2
else
undefined
ListView
{
id: selectionList
anchors.fill: parent
highlightFollowsCurrentItem: true
highlightMoveDuration: 0
keyNavigationEnabled: true
interactive: Kirigami.Settings.isMobile
boundsBehavior: !Kirigami.Settings.isMobile? Flickable.StopAtBounds : Flickable.OvershootBounds
orientation: if(position === Qt.Horizontal)
ListView.Horizontal
else if(position === Qt.Vertical)
ListView.Vertical
else
undefined
clip: true
focus: true
spacing: Maui.Style.space.small
ScrollBar.horizontal: ScrollBar
{
policy: Kirigami.Settings.isMobile? Qt.ScrollBarAlwaysOff : Qt.ScrollBarAsNeeded
y: -64
}
model: ListModel{}
delegate: Maui.GridBrowserDelegate
{
id: delegate
isCurrentItem: ListView.isCurrentItem
- height: selectionList.height
+ height: selectionList.height * 0.95
width: height + Maui.Style.space.big
folderSize: Maui.Style.iconSizes.big
showLabel: true
keepEmblemOverlay: true
leftEmblem: "list-remove"
showEmblem: !Kirigami.Settings.isMobile
showTooltip: true
showThumbnails: true
emblemSize: Maui.Style.iconSizes.small
Kirigami.Theme.backgroundColor: "transparent"
Kirigami.Theme.textColor: control.Kirigami.Theme.textColor
Connections
{
target: delegate
onLeftEmblemClicked: removeAtIndex(index)
onClicked: control.itemClicked(index)
onPressAndHold: control.itemPressAndHold(index)
}
}
}
}
Item
{
Layout.fillWidth: position === Qt.Vertical
Layout.fillHeight: position === Qt.Horizontal
Layout.preferredWidth: Maui.Style.iconSizes.medium
Layout.preferredHeight: Maui.Style.iconSizes.medium
Layout.column: if(position === Qt.Horizontal)
3
else if(position === Qt.Vertical)
1
else
undefined
Layout.row: if(position === Qt.Horizontal)
1
else if(position === Qt.Vertical)
3
else
undefined
Layout.margins: Maui.Style.space.medium
ToolButton
{
visible: iconVisible
anchors.centerIn: parent
icon.name: control.iconName
icon.color: control.Kirigami.Theme.textColor
onClicked: iconClicked()
}
}
}
onVisibleChanged:
{
if(position === Qt.Vertical) return
}
Keys.onEscapePressed:
{
control.exitClicked();
event.accepted = true
}
Keys.onBackPressed:
{
control.exitClicked();
event.accepted = true
}
function clear()
{
selectedPaths = []
selectedItems = []
selectionList.model.clear()
control.cleared()
}
function itemAt(index)
{
if(index < 0 || index > selectionList.count)
return
return selectionList.model.get(index)
}
function removeAtIndex(index)
{
if(index < 0)
return
const item = selectionList.model.get(index)
const path = item.path
if(contains(path))
{
selectedPaths.splice(index, 1)
selectedItems.splice(index, 1)
selectionList.model.remove(index)
control.itemRemoved(item)
control.pathRemoved(path)
}
}
function removeAtPath(path)
{
removeAtIndex(indexOf(path))
}
function indexOf(path)
{
return control.selectedPaths.indexOf(path)
}
function append(item)
{
const index = selectedPaths.indexOf(item.path)
if(index < 0)
{
if(control.singleSelection)
clear()
selectedItems.push(item)
selectedPaths.push(item.path)
selectionList.model.append(item)
selectionList.positionViewAtEnd()
selectionList.currentIndex = selectionList.count - 1
control.itemAdded(item)
control.pathAdded(item.path)
}else
{
selectionList.currentIndex = index
// notify(item.icon, qsTr("Item already selected!"), String("The item '%1' is already in the selection box").arg(item.label), null, 4000)
}
animate(Kirigami.Theme.backgroundColor)
}
function animate(color)
{
animColor = color
anim.running = true
}
function getSelectedPathsString()
{
return String(""+selectedPaths.join(","))
}
function contains(path)
{
return control.selectedPaths.includes(path)
}
}
diff --git a/src/controls/ToolActions.qml b/src/controls/ToolActions.qml
index 96f46d1..efe8184 100644
--- a/src/controls/ToolActions.qml
+++ b/src/controls/ToolActions.qml
@@ -1,191 +1,192 @@
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQml.Models 2.3
import QtQml 2.1
import org.kde.kirigami 2.7 as Kirigami
import org.kde.mauikit 1.0 as Maui
MouseArea
{
id: control
implicitWidth: _layout.implicitWidth + Maui.Style.space.medium
implicitHeight: parent.height
default property list actions
property bool autoExclusive: true
property int direction : Qt.Vertical
property Action currentAction : actions[0]
property bool expanded : false
Rectangle
{
anchors.fill: parent
color: control.expanded ? "#333" : "transparent"
opacity: 0.1
- radius: Math.min(Maui.Style.radiusV, )
+ radius: Math.min(Maui.Style.radiusV, height)
Behavior on color
{
ColorAnimation
{
duration: Kirigami.Units.longDuration
}
}
}
onClicked:
{
control.expanded = !control.expanded
}
Row
{
id: _layout
height: parent.height
spacing: 0
anchors.centerIn: parent
Item
{
visible: control.direction === Qt.Vertical || (control.direction === Qt.Horizontal && !control.expanded)
width: parent.height
height: width
Kirigami.Icon
{
source: control.currentAction.icon.name
width: Maui.Style.iconSizes.medium
height: width
anchors.centerIn: parent
}
}
// Label
// {
// visible: control.direction === Qt.Vertical || (control.direction === Qt.Horizontal && !control.expanded)
// text: control.currentAction.text
// height: parent.height
// }
Rectangle
{
color:/* control.expanded && control.direction === Qt.Horizontal? Kirigami.Theme.highlightColor :*/ "transparent"
height: parent.height
width: control.expanded && control.direction === Qt.Horizontal? height : Maui.Style.iconSizes.small
radius: Maui.Style.radiusV
Kirigami.Icon
{
- source: control.direction === Qt.Horizontal ? ( control.expanded ? "go-previous" : "go-next") : (control.direction === Qt.Vertical ? "arrow-down" : "")
+ source: control.direction === Qt.Horizontal ? ( control.expanded ? "go-previous" : "go-next") : (control.direction === Qt.Vertical ? "qrc://assets/arrow-down.svg" : "")
width: Maui.Style.iconSizes.small
height: width
anchors.centerIn: parent
+ isMask: true
}
}
Loader
{
id: _loader
height: parent.height
sourceComponent: control.direction === Qt.Horizontal ? _rowComponent : (control.direction === Qt.Vertical ? _menuComponent : null)
}
}
Component
{
id: _rowComponent
Row
{
id: _row
width: control.expanded ? implicitWidth : 0
spacing: Maui.Style.space.medium
clip: true
height: parent.height
Behavior on width
{
NumberAnimation
{
duration: Kirigami.Units.longDuration
easing.type: Easing.InOutQuad
}
}
Kirigami.Separator
{
width: 1
height: parent.height * 0.7
anchors.verticalCenter: parent.verticalCenter
}
Repeater
{
model: control.actions
ToolButton
{
action: modelData
autoExclusive: control.autoExclusive
anchors.verticalCenter: parent.verticalCenter
onClicked:
{
control.currentAction = action
control.expanded = false
}
}
}
}
}
Component
{
id: _menuComponent
Menu
{
id: _actionsMenu
Connections
{
target: control
onExpandedChanged:
{
if(control.expanded)
_actionsMenu.popup(0, parent.height)
else
_actionsMenu.close()
}
}
onClosed: control.expanded = false
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
Repeater
{
model: control.actions
MenuItem
{
action: modelData
autoExclusive: control.autoExclusive
Connections
{
target: modelData
onTriggered: control.currentAction = action
}
}
}
}
}
}
diff --git a/src/controls/private/BrowserView.qml b/src/controls/private/BrowserView.qml
index b9c9bac..3d7a898 100644
--- a/src/controls/private/BrowserView.qml
+++ b/src/controls/private/BrowserView.qml
@@ -1,639 +1,636 @@
import QtQuick 2.9
import QtQuick.Controls 2.9
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.7 as Kirigami
import org.kde.mauikit 1.0 as Maui
Maui.Page
{
id: control
property url path
property Maui.FMList currentFMList
property alias currentView : viewLoader.item
property int viewType
height: _browserList.height
width: _browserList.width
function setCurrentFMList()
{
control.currentFMList = currentView.currentFMList
currentView.forceActiveFocus()
}
Menu
{
id: _dropMenu
property string urls
property url target
enabled: Maui.FM.getFileInfo(target).isdir == "true"
MenuItem
{
text: qsTr("Copy here")
onTriggered:
{
const urls = _dropMenu.urls.split(",")
for(var i in urls)
Maui.FM.copy(urls[i], _dropMenu.target, false)
}
}
MenuItem
{
text: qsTr("Move here")
onTriggered:
{
const urls = _dropMenu.urls.split(",")
for(var i in urls)
Maui.FM.cut(urls[i], _dropMenu.target)
}
}
MenuItem
{
text: qsTr("Link here")
onTriggered:
{
const urls = _dropMenu.urls.split(",")
for(var i in urls)
Maui.FM.createSymlink(_dropMenu.source[i], urls.target)
}
}
}
Loader
{
id: viewLoader
anchors.fill: parent
focus: true
sourceComponent: switch(control.viewType)
{
case Maui.FMList.ICON_VIEW: return gridViewBrowser
case Maui.FMList.LIST_VIEW: return listViewBrowser
case Maui.FMList.MILLERS_VIEW: return millerViewBrowser
}
onLoaded: setCurrentFMList()
}
Maui.FMList
{
id: _commonFMList
path: control.path
onSortByChanged: if(group) groupBy()
}
Component
{
id: listViewBrowser
Maui.ListBrowser
{
id: _listViewBrowser
property alias currentFMList : _browserModel.list
topMargin: Maui.Style.contentMargins
showPreviewThumbnails: showThumbnails
keepEmblemOverlay: selectionMode
showDetailsInfo: true
supportsRefreshing: true
BrowserHolder
{
id: _holder
browser: currentFMList
}
holder.visible: _holder.visible
holder.emoji: _holder.emoji
holder.title: _holder.title
holder.body: _holder.body
holder.emojiSize: _holder.emojiSize
model: Maui.BaseModel
{
id: _browserModel
list: _commonFMList
}
section.delegate: Maui.LabelDelegate
{
id: delegate
width: parent.width
height: Maui.Style.toolBarHeightAlt
label: String(section).toUpperCase()
labelTxt.font.pointSize: Maui.Style.fontSizes.big
isSection: true
}
delegate: Maui.ListBrowserDelegate
{
id: delegate
width: _listViewBrowser.width
height: _listViewBrowser.itemSize + Maui.Style.space.big
leftPadding: Maui.Style.space.small
rightPadding: Maui.Style.space.small
padding: 0
showDetailsInfo: _listViewBrowser.showDetailsInfo
folderSize : _listViewBrowser.itemSize
showTooltip: true
showEmblem: _listViewBrowser.showEmblem
keepEmblemOverlay : _listViewBrowser.keepEmblemOverlay
showThumbnails: _listViewBrowser.showPreviewThumbnails
rightEmblem: _listViewBrowser.rightEmblem
isSelected: selectionBar ? selectionBar.contains(model.path) : false
leftEmblem: isSelected ? "list-remove" : "list-add"
draggable: true
Maui.Badge
{
iconName: "link"
anchors.left: parent.left
anchors.bottom: parent.bottom
visible: (model.issymlink == true) || (model.issymlink == "true")
}
Connections
{
target: selectionBar
onPathRemoved:
{
if(path === model.path)
delegate.isSelected = false
}
onPathAdded:
{
if(path === model.path)
delegate.isSelected = true
}
onCleared: delegate.isSelected = false
}
Connections
{
target: delegate
onClicked:
{
_listViewBrowser.currentIndex = index
_listViewBrowser.itemClicked(index)
}
onDoubleClicked:
{
_listViewBrowser.currentIndex = index
_listViewBrowser.itemDoubleClicked(index)
}
onPressAndHold:
{
_listViewBrowser.currentIndex = index
_listViewBrowser.itemRightClicked(index)
}
onRightClicked:
{
_listViewBrowser.currentIndex = index
_listViewBrowser.itemRightClicked(index)
}
onRightEmblemClicked:
{
_listViewBrowser.currentIndex = index
_listViewBrowser.rightEmblemClicked(index)
}
onLeftEmblemClicked:
{
_listViewBrowser.currentIndex = index
_listViewBrowser.leftEmblemClicked(index)
}
onContentDropped:
{
_dropMenu.urls = drop.urls.join(",")
_dropMenu.target = model.path
_dropMenu.popup()
}
}
}
}
}
Component
{
id: gridViewBrowser
Maui.GridBrowser
{
id: _gridViewBrowser
property alias currentFMList : _browserModel.list
itemSize : thumbnailsSize + Maui.Style.fontSizes.default
cellHeight: itemSize * 1.5
keepEmblemOverlay: selectionMode
showPreviewThumbnails: showThumbnails
- leftEmblem: isSelected ? "list-remove" : "list-add"
supportsRefreshing: true
BrowserHolder
{
id: _holder
browser: currentFMList
}
holder.visible: _holder.visible
holder.emoji: _holder.emoji
holder.title: _holder.title
holder.body: _holder.body
holder.emojiSize: _holder.emojiSize
model: Maui.BaseModel
{
id: _browserModel
list: _commonFMList
}
delegate: Maui.GridBrowserDelegate
{
id: delegate
folderSize: height * 0.5
height: _gridViewBrowser.cellHeight
width: _gridViewBrowser.cellWidth
padding: Maui.Style.space.tiny
showTooltip: true
showEmblem: _gridViewBrowser.showEmblem
keepEmblemOverlay: _gridViewBrowser.keepEmblemOverlay
showThumbnails: _gridViewBrowser.showPreviewThumbnails
rightEmblem: _gridViewBrowser.rightEmblem
isSelected: selectionBar ? selectionBar.contains(model.path) : false
leftEmblem: isSelected ? "list-remove" : "list-add"
draggable: true
Maui.Badge
{
iconName: "link"
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.bottomMargin: Maui.Style.space.big
visible: (model.issymlink == true) || (model.issymlink == "true")
}
Connections
{
target: selectionBar
onPathRemoved:
{
if(path === model.path)
delegate.isSelected = false
}
onPathAdded:
{
if(path === model.path)
delegate.isSelected = true
}
onCleared: delegate.isSelected = false
}
Connections
{
target: delegate
onClicked:
{
_gridViewBrowser.currentIndex = index
_gridViewBrowser.itemClicked(index)
}
onDoubleClicked:
{
_gridViewBrowser.currentIndex = index
_gridViewBrowser.itemDoubleClicked(index)
}
onPressAndHold:
{
_gridViewBrowser.currentIndex = index
_gridViewBrowser.itemRightClicked(index)
}
onRightClicked:
{
_gridViewBrowser.currentIndex = index
_gridViewBrowser.itemRightClicked(index)
}
onRightEmblemClicked:
{
_gridViewBrowser.currentIndex = index
_gridViewBrowser.rightEmblemClicked(index)
}
onLeftEmblemClicked:
{
_gridViewBrowser.currentIndex = index
_gridViewBrowser.leftEmblemClicked(index)
}
onContentDropped:
{
_dropMenu.urls = drop.urls.join(",")
_dropMenu.target = model.path
_dropMenu.popup()
}
}
}
}
}
Component
{
id: millerViewBrowser
Item
{
id: _millerControl
property Maui.FMList currentFMList
property int currentIndex
signal itemClicked(int index)
signal itemDoubleClicked(int index)
signal itemRightClicked(int index)
signal keyPress(var event)
signal rightEmblemClicked(int index)
signal leftEmblemClicked(int index)
signal areaClicked(var mouse)
signal areaRightClicked()
ListView
{
id: _millerColumns
anchors.fill: parent
boundsBehavior: !Kirigami.Settings.isMobile? Flickable.StopAtBounds : Flickable.OvershootBounds
keyNavigationEnabled: true
interactive: Kirigami.Settings.isMobile
orientation: ListView.Horizontal
snapMode: ListView.SnapToItem
ScrollBar.horizontal: ScrollBar
{
id: _scrollBar
snapMode: ScrollBar.SnapAlways
policy: ScrollBar.AlwaysOn
contentItem: Rectangle
{
implicitWidth: _scrollBar.interactive ? 13 : 4
implicitHeight: _scrollBar.interactive ? 13 : 4
color: "#333"
opacity: _scrollBar.pressed ? 0.7 :
_scrollBar.interactive && _scrollBar.hovered ? 0.5 : 0.2
radius: 0
}
background: Rectangle
{
implicitWidth: _scrollBar.interactive ? 16 : 4
implicitHeight: _scrollBar.interactive ? 16 : 4
color: "#0e000000"
opacity: 0.0
visible: _scrollBar.interactive
radius: 0
}
}
onCurrentItemChanged:
{
_millerControl.currentFMList = currentItem.currentFMList
control.setCurrentFMList()
currentItem.forceActiveFocus()
}
onCountChanged:
{
_millerColumns.currentIndex = _millerColumns.count-1
_millerColumns.positionViewAtEnd()
}
Maui.PathList
{
id: _millerList
path: control.path
onPathChanged:
{
_millerColumns.currentIndex = _millerColumns.count-1
_millerColumns.positionViewAtEnd()
}
}
model: Maui.BaseModel
{
id: _millerModel
list: _millerList
}
delegate: Item
{
property alias currentFMList : _millersFMList
property int _index : index
width: Math.min(Kirigami.Units.gridUnit * 22, control.width)
height: parent.height
focus: true
function forceActiveFocus()
{
_millerListView.forceActiveFocus()
}
Kirigami.Separator
{
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 1
z: 999
}
Maui.FMList
{
id: _millersFMList
path: model.path
}
Maui.ListBrowser
{
id: _millerListView
anchors.fill: parent
topMargin: Maui.Style.contentMargins
showPreviewThumbnails: showThumbnails
keepEmblemOverlay: selectionMode
- rightEmblem: Kirigami.Settings.isMobile ? "document-share" : ""
- leftEmblem: "emblem-select-add"
showDetailsInfo: true
onKeyPress: _millerControl.keyPress(event)
currentIndex : 0
onCurrentIndexChanged: _millerControl.currentIndex = currentIndex
BrowserHolder
{
id: _holder
browser: currentFMList
}
holder.visible: _holder.visible
holder.emoji: _holder.emoji
holder.title: _holder.title
holder.body: _holder.body
holder.emojiSize: _holder.emojiSize
section.delegate: Maui.LabelDelegate
{
id: delegate
width: parent.width
height: Maui.Style.toolBarHeightAlt
label: String(section).toUpperCase()
labelTxt.font.pointSize: Maui.Style.fontSizes.big
isSection: true
}
onAreaClicked:
{
_millerColumns.currentIndex = _index
_millerControl.areaClicked(mouse)
}
onAreaRightClicked:
{
_millerColumns.currentIndex = _index
_millerControl.areaRightClicked()
}
model: Maui.BaseModel
{
list: _millersFMList
}
delegate: Maui.ListBrowserDelegate
{
id: delegate
width: parent.width
height: _millerListView.itemSize + Maui.Style.space.big
leftPadding: Maui.Style.space.small
rightPadding: Maui.Style.space.small
padding: 0
showDetailsInfo: _millerListView.showDetailsInfo
folderSize : _millerListView.itemSize
showTooltip: true
showEmblem: _millerListView.showEmblem
keepEmblemOverlay : _millerListView.keepEmblemOverlay
showThumbnails: _millerListView.showPreviewThumbnails
rightEmblem: _millerListView.rightEmblem
isSelected: selectionBar ? selectionBar.contains(model.path) : false
- leftEmblem: isSelected ? "emblem-select-remove" : "emblem-select-add"
- draggable: true
+ leftEmblem: isSelected ? "list-remove" : "list-add"
+ draggable: true
Maui.Badge
{
iconName: "link"
anchors.left: parent.left
anchors.bottom: parent.bottom
visible: (model.issymlink == true) || (model.issymlink == "true")
}
Connections
{
target: selectionBar
onPathRemoved:
{
if(path === model.path)
delegate.isSelected = false
}
onPathAdded:
{
if(path === model.path)
delegate.isSelected = true
}
onCleared: delegate.isSelected = false
}
Connections
{
target: delegate
onClicked:
{
_millerColumns.currentIndex = _index
_millerListView.currentIndex = index
_millerControl.itemClicked(index)
}
onDoubleClicked:
{
_millerColumns.currentIndex = _index
_millerListView.currentIndex = index
_millerControl.itemDoubleClicked(index)
}
onPressAndHold:
{
_millerColumns.currentIndex = _index
_millerListView.currentIndex = index
_millerControl.itemRightClicked(index)
}
onRightClicked:
{
_millerColumns.currentIndex = _index
_millerListView.currentIndex = index
_millerControl.itemRightClicked(index)
}
onRightEmblemClicked:
{
_millerColumns.currentIndex = _index
_millerListView.currentIndex = index
_millerControl.rightEmblemClicked(index)
}
onLeftEmblemClicked:
{
_millerColumns.currentIndex = _index
_millerListView.currentIndex = index
_millerControl.leftEmblemClicked(index)
}
onContentDropped:
{
_dropMenu.urls = drop.urls.join(",")
_dropMenu.target = model.path
_dropMenu.popup()
}
}
}
}
}
}
}
}
}