Commit 577efc97 authored by camilo higuita's avatar camilo higuita

move sidebar to maukit and use compact style

parent f5fc0c98
......@@ -21,12 +21,14 @@ Maui.ApplicationWindow
id: root
title: qsTr("Index")
property int sidebarWidth: Kirigami.Units.gridUnit * (isMobile ? 14 : 11)
property int sidebarWidth: placesSidebar.isCollapsed ? placesSidebar.iconSize * 2:
Kirigami.Units.gridUnit * (isMobile ? 14 : 11)
pageStack.defaultColumnWidth: sidebarWidth
pageStack.initialPage: [placesSidebar, browser]
pageStack.interactive: isMobile
pageStack.separatorVisible: pageStack.wideMode
highlightColor: "#8682dd"
headBar.middleContent: PathBar
{
......@@ -38,8 +40,10 @@ Maui.ApplicationWindow
PlacesSidebar
{
id: placesSidebar
anchors.fill: parent
onPlaceClicked: browser.openFolder(path)
width: isCollapsed ? iconSize*2 : parent.width
height: parent.height
}
Browser
......
......@@ -5,7 +5,6 @@
<file>widgets_templates/IndexList.qml</file>
<file>widgets_templates/IndexIconDelegate.qml</file>
<file>widgets_templates/IndexGrid.qml</file>
<file>widgets/sidebar/SidebarDelegate.qml</file>
<file>widgets/sidebar/PlacesSidebar.qml</file>
<file>widgets_templates/IndexDelegate.qml</file>
<file>widgets/views/Browser.qml</file>
......
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import org.kde.maui 1.0 as Maui
import "../../widgets_templates"
ColumnLayout
Maui.SideBar
{
property alias placesList : placesList
id: placesList
signal placeClicked (string path)
focus: true
clip: true
ListView
section.property : !placesList.isCollapsed ? "type" : ""
section.criteria: ViewSection.FullString
section.delegate: IndexDelegate
{
id: placesList
clip: true
Layout.fillHeight: true
Layout.fillWidth: true
keyNavigationEnabled: true
id: delegate
label: section
labelTxt.font.pointSize: fontSizes.big
focus: true
interactive: true
highlightFollowsCurrentItem: true
highlightMoveDuration: 0
snapMode: ListView.SnapToItem
isSection: true
boldLabel: true
height: headBar.height
section.property : "type"
section.criteria: ViewSection.FullString
section.delegate: IndexDelegate
Connections
{
id: delegate
label: section
labelTxt.font.pointSize: fontSizes.big
isSection: true
boldLabel: true
height: headBar.height
target: delegate
onClicked: placesList.isCollapsed = true
}
}
model: ListModel {}
delegate: SidebarDelegate
{
id: placeDelegate
Connections
{
target: placeDelegate
onClicked:
{
placesList.currentIndex = index
placeClicked(placesList.model.get(index).path)
onItemClicked:
{
placeClicked(item.path)
if(pageStack.currentIndex === 0 && !pageStack.wideMode)
pageStack.currentIndex = 1
}
}
}
if(pageStack.currentIndex === 0 && !pageStack.wideMode)
pageStack.currentIndex = 1
}
Component.onCompleted: populate()
......
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
import org.kde.kirigami 2.2 as Kirigami
import org.kde.maui 1.0 as Maui
ItemDelegate
{
property bool isCurrentListItem : ListView.isCurrentItem
property int sidebarIconSize : isMobile ? iconSizes.big : iconSizes.small
width: parent.width
height: sidebarIconSize + space.big
clip: true
property string labelColor: ListView.isCurrentItem ? highlightedTextColor : textColor
Rectangle
{
anchors.fill: parent
color: isCurrentListItem ? highlightColor : "transparent"
// index % 2 === 0 ? Qt.lighter(backgroundColor,1.2) :
// backgroundColor
}
RowLayout
{
anchors.fill: parent
Item
{
Layout.fillHeight: true
width: parent.height
Maui.ToolButton
{
anchors.centerIn: parent
iconName: model.icon? model.icon : ""
size: sidebarIconSize
isMask: !isMobile
iconColor: labelColor
}
}
Item
{
Layout.fillHeight: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Label
{
height: parent.height
width: parent.width
verticalAlignment: Qt.AlignVCenter
horizontalAlignment: Qt.AlignLeft
text: model.label
font.bold: false
elide: Text.ElideRight
font.pointSize: isMobile ? fontSizes.big : fontSizes.default
color: labelColor
}
}
}
}
......@@ -253,9 +253,9 @@ Maui.Page
for(var i in items)
viewLoader.item.model.append(items[i])
for(i=0; i < placesSidebar.placesList.count; i++)
if(currentPath === placesSidebar.placesList.model.get(i).path)
placesSidebar.placesList.currentIndex = i
for(i=0; i < placesSidebar.count; i++)
if(currentPath === placesSidebar.model.get(i).path)
placesSidebar.currentIndex = i
pathBar.append(currentPath)
inx.watchPath(currentPath)
......
......@@ -11,7 +11,7 @@ Drawer
edge: Qt.RightEdge
width: Kirigami.Units.gridUnit * 17
height: browserContainer.height
y: isMobile ?browser.headBar.height: browser.headBar.height + headBar.height
y: isMobile ? browser.headBar.height : headBar.height
// visible: opened ? pageStack.currentIndex = 1 && pageStack.wideMode : false
clip: true
property string currentUrl: ""
......
mauikit @ 5795b2eb
Subproject commit 54d0cc1a5102875b349e0ea74baa1b01b3ca8ec2
Subproject commit 5795b2eb0fab29bcd73a6797dcdfb0d74989273e
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment