Commit 61bed8e4 authored by Camilo higuita's avatar Camilo higuita

grouping option and start moving from preview drawer to popup

parent c1124694
......@@ -14,5 +14,6 @@
<file>widgets/views/Previewer/DefaultPreview.qml</file>
<file>widgets_templates/ColorsBar.qml</file>
<file>widgets/views/Terminal.qml</file>
<file>widgets/views/Previewer.qml</file>
</qresource>
</RCC>
......@@ -9,9 +9,12 @@ import org.kde.kirigami 2.0 as Kirigami
import org.kde.mauikit 1.0 as Maui
import FMModel 1.0
import FMList 1.0
import FMH 1.0
Maui.Page
{
id: control
property string currentPath: inx.homePath()
property var copyPaths : []
property var cutPaths : []
......@@ -20,7 +23,7 @@ Maui.Page
property bool isCut : false
property bool selectionMode : false
property bool group: false
property bool detailsView: false
property bool terminalVisible : false
......@@ -47,27 +50,27 @@ Maui.Page
margins: 0
// Connections
// {
// target: inx
// onPathModified: browser.refresh()
// onItemReady: browser.append(item)
// }
// Connections
// {
// target: inx
// onPathModified: browser.refresh()
// onItemReady: browser.append(item)
// }
BrowserMenu
{
id: browserMenu
}
DetailsDrawer
Previewer
{
id: detailsDrawer
}
// ListModel
// {
// id: folderModel
// }
// ListModel
// {
// id: folderModel
// }
FMModel
{
......@@ -79,6 +82,7 @@ Maui.Page
{
id: modelList
path: currentPath
onSortByChanged: if(group) groupBy()
}
Component
......@@ -137,10 +141,10 @@ Maui.Page
onItemRightClicked: itemMenu.show([modelList.get(index).path])
onLeftEmblemClicked: browser.addToSelection(item, true)
onLeftEmblemClicked: browser.addToSelection(modelList.get(index), true)
onRightEmblemClicked: isAndroid ? Maui.Android.shareDialog([item.path]) :
shareDialog.show([item.path])
onRightEmblemClicked: isAndroid ? Maui.Android.shareDialog([modelList.get(index).path]) :
shareDialog.show([modelList.get(index).path])
onAreaClicked:
{
if(!isMobile && mouse.button === Qt.RightButton)
......@@ -243,39 +247,46 @@ Maui.Page
Maui.MenuItem
{
text: qsTr("Don't sort")
onTriggered: sortBy()
text: qsTr("Type")
onTriggered: modelList.sortBy = KEY.MIME
}
Maui.MenuItem
{
text: qsTr("Mimetype")
onTriggered: sortBy("mime")
text: qsTr("Date")
onTriggered: modelList.sortBy = KEY.DATE
}
Maui.MenuItem
{
text: qsTr("Date")
onTriggered: sortBy("date")
text: qsTr("Modified")
onTriggered: modelList.sortBy = KEY.MODIFIED
}
Maui.MenuItem
{
text: qsTr("Size")
onTriggered: sortBy("size")
onTriggered: modelList.sortBy = KEY.SIZE
}
Maui.MenuItem
{
text: qsTr("Name")
onTriggered: sortBy("label", ViewSection.FirstCharacter)
onTriggered: modelList.sortBy = KEY.LABEL
}
MenuSeparator {}
Maui.MenuItem
{
id: groupAction
text: qsTr("Group")
checkable: true
onTriggered:
{
group = checked
group ? groupBy() : undefined
}
}
}
}
......@@ -504,7 +515,7 @@ Maui.Page
setPath(path, pathType.directory)
/* Get directory configs */
/* Get directory configs */
var iconsize = inx.dirConf(path+"/.directory")["iconsize"] || iconSizes.large
thumbnailsSize = parseInt(iconsize)
......@@ -521,10 +532,10 @@ Maui.Page
placesSidebar.currentIndex = i
}
// function append(item)
// {
// folderModel.append(item)
// }
// function append(item)
// {
// folderModel.append(item)
// }
function goBack()
{
......@@ -677,40 +688,38 @@ Maui.Page
onThumbnailsSizeChanged:
{
inx.setDirConf(currentPath+"/.directory", "MAUIFM", "IconSize", thumbnailsSize)
grid.adaptGrid()
grid.adaptGrid()
}
function sortBy(prop, criteria)
function groupBy()
{
var prop = ""
var criteria = ViewSection.FullString
console.log("SORTING BY", prop, criteria)
if(detailsView)
switch(modelList.sortBy)
{
if(!prop)
{
grid.section.property = ""
return
}
grid.section.property = prop
grid.section.criteria = criteria ? criteria : ViewSection.FullString
case KEY.LABEL: prop = "label"
criteria = ViewSection.FirstCharacter
break;
case KEY.MIME: prop = "mime"
break;
case KEY.SIZE: prop = "size"
break;
case KEY.DATE: prop = "date"
break;
case KEY.MODIFIED: prop = "modified"
break;
}
sortModel(prop)
detailsView = true
}
if(!prop)
{
grid.section.property = ""
return
}
grid.section.property = prop
grid.section.criteria = criteria
function sortModel(prop)
{
var n;
var i;
for (n=0; n < folderModel.count; n++)
for (i=n+1; i < folderModel.count; i++)
{
if (modelList.get(n)[prop] > modelList.get(i)[prop])
{
folderModel.move(i, n, 1);
n=0;
}
}
}
}
......@@ -6,16 +6,61 @@ import org.kde.mauikit 1.0 as Maui
import "Previewer"
Maui.Drawer
Maui.Dialog
{
id: detailsDrawerRoot
edge: Qt.RightEdge
property string currentUrl: ""
property var iteminfo : ({})
property bool isDir : false
property string mimetype : ""
maxHeight: unit * 800
maxWidth: unit * 500
defaultButtons: false
footBar.leftContent: Maui.ToolButton
{
visible: !isDir
iconName: "document-share"
onClicked:
{
isAndroid ? Maui.Android.shareDialog(currentUrl) :
shareDialog.show(currentUrl)
close()
}
}
footBar.middleContent: [
Maui.ToolButton
{
iconName: "love"
},
Maui.ToolButton
{
iconName: "document-open"
onClicked:
{
// if(typeof(previewLoader.item.player) !== "undefined")
// previewLoader.item.player.stop()
browser.openFile(currentUrl)
}
}
]
footBar.rightContent: Maui.ToolButton
{
iconName: "archive-remove"
onClicked:
{
close()
browser.remove([currentUrl])
}
}
bg: browser
Component
{
......@@ -54,102 +99,40 @@ Maui.Drawer
}
}
ColumnLayout
{
anchors.fill: parent
spacing: 0
Item
{
Layout.fillHeight: true
Layout.fillWidth: true
height: parent.height
width: parent.width
id: previewContent
ScrollView
{
id: scrollView
anchors.fill:parent
contentWidth: previewLoader.width
contentHeight: previewLoader.height
clip: true
Loader
{
id: previewLoader
height : previewContent.height * 1.5
width: previewContent.width
}
}
}
Item
{
Layout.fillWidth: true
width: parent.width
height: previewToolbar.height
Maui.ToolBar
{
id: previewToolbar
position: ToolBar.Footer
height: implicitHeight
width: parent.width
background: Rectangle
{
implicitHeight: iconSize * 2
color: "transparent"
}
leftContent: Maui.ToolButton
{
visible: !isDir
iconName: "document-share"
onClicked:
{
isAndroid ? Maui.Android.shareDialog(currentUrl) :
shareDialog.show(currentUrl)
close()
}
}
middleContent: [
Maui.ToolButton
{
iconName: "love"
},
Maui.ToolButton
{
iconName: "document-open"
onClicked:
{
if(typeof(previewLoader.item.player) !== "undefined")
previewLoader.item.player.stop()
browser.openFile(currentUrl)
}
}
]
rightContent: Maui.ToolButton
{
iconName: "archive-remove"
onClicked:
{
close()
browser.remove([currentUrl])
}
}
}
}
}
// ScrollView
// {
// id: scrollView
// anchors.fill:parent
// contentWidth: previewLoader.width
// contentHeight: previewLoader.height
// clip: true
// Loader
// {
// id: previewLoader
// sourceComponent: switch(mimetype)
// {
// case "audio" :
// audioPreview
// break
// case "video" :
// videoPreview
// break
// case "text" :
// defaultPreview
// break
// case "image" :
// imagePreview
// break
// case "inode" :
// default:
// defaultPreview
// }
//// height : previewContent.height * 1.5
//// width: previewContent.width
// }
// }
onClosed:
{
......@@ -161,28 +144,9 @@ Maui.Drawer
{
currentUrl = path
iteminfo = inx.getFileInfo(path)
var mimetype = iteminfo.mime.slice(0, iteminfo.mime.indexOf("/"))
mimetype = iteminfo.mime.slice(0, iteminfo.mime.indexOf("/"))
isDir = false
console.log("MIME TYPE FOR PREVEIWER", mimetype)
switch(mimetype)
{
case "audio" :
previewLoader.sourceComponent = audioPreview
break
case "video" :
previewLoader.sourceComponent = videoPreview
break
case "text" : console.log("is text")
break
case "image" :
previewLoader.sourceComponent = imagePreview
break
case "inode" :
default:
isDir = true
previewLoader.sourceComponent = defaultPreview
}
open()
}
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.0 as Kirigami
import org.kde.mauikit 1.0 as Maui
import "Previewer"
Maui.Dialog
{
id: control
property string currentUrl: ""
property var iteminfo : ({})
property bool isDir : false
property string mimetype : ""
maxHeight: unit * 800
maxWidth: unit * 500
defaultButtons: false
parent: parent
footBar.leftContent: Maui.ToolButton
{
visible: !isDir
iconName: "document-share"
onClicked:
{
isAndroid ? Maui.Android.shareDialog(currentUrl) :
shareDialog.show(currentUrl)
close()
}
}
footBar.middleContent: [
Maui.ToolButton
{
iconName: "love"
},
Maui.ToolButton
{
iconName: "document-open"
onClicked:
{
if(typeof(previewLoader.item.player) !== "undefined")
previewLoader.item.player.stop()
browser.openFile(currentUrl)
}
}
]
footBar.rightContent: Maui.ToolButton
{
iconName: "archive-remove"
onClicked:
{
close()
browser.remove([currentUrl])
}
}
Component
{
id: imagePreview
ImagePreview
{
id: imagePreviewer
}
}
Component
{
id: defaultPreview
DefaultPreview
{
id: defaultPreviewer
}
}
Component
{
id: audioPreview
AudioPreview
{
id: audioPreviewer
}
}
Component
{
id: videoPreview
VideoPreview
{
id: videoPreviewer
}
}
ScrollView
{
id: scrollView
anchors.fill:parent
contentHeight: previewLoader.item.height
clip: true
Loader
{
id: previewLoader
height : control.height
width: control.width
sourceComponent: switch(mimetype)
{
case "audio" :
audioPreview
break
case "video" :
videoPreview
break
case "text" :
defaultPreview
break
case "image" :
imagePreview
break
case "inode" :
default:
defaultPreview
}
}
}
onClosed:
{
if(previewLoader.item.player)
previewLoader.item.player.stop()
}
function show(path)
{
control.currentUrl = path
control.iteminfo = inx.getFileInfo(path)
control.mimetype = iteminfo.mime.slice(0, iteminfo.mime.indexOf("/"))
control.isDir = mimetype === "inode"
console.log("MIME TYPE FOR PREVEIWER", mimetype)
open()
}
}
......@@ -2,11 +2,7 @@ import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
Item
{
height: layout.implicitHeight
ColumnLayout
ColumnLayout
{
id: layout
anchors.fill: parent
......@@ -14,7 +10,7 @@ Item
Item
{
Layout.fillWidth: true
height: parent.width *0.7
Layout.fillHeight: true
Layout.margins: contentMargins
Image
......@@ -32,18 +28,14 @@ Item
}
}
Item
{
Layout.fillWidth: true
height: rowHeight
width: parent.width* 0.8
Layout.margins: contentMargins
Label
{
Layout.fillWidth: true
Layout.preferredHeight: rowHeight
Layout.margins: contentMargins
text: iteminfo.name
width: parent.width
height: parent.height
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
elide: Qt.ElideRight
......@@ -53,86 +45,64 @@ Item
font.bold: true
}
}
Item
{
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignVCenter
Layout.margins: contentMargins
Column
{
spacing: space.small
width: parent.width
height: parent.height
Label
{
text: qsTr("Type: ")+ iteminfo.mime
elide: Qt.ElideRight
wrapMode: Text.Wrap
font.pointSize: fontSizes.default
}
Label
{
text: qsTr("Date: ")+ iteminfo.date
elide: Qt.ElideRight
wrapMode: Text.Wrap
font.pointSize: fontSizes.default
}
Label