Commit 31d689c4 authored by Camilo higuita's avatar Camilo higuita

use mauikit gridview

parent 6737946e
......@@ -25,8 +25,6 @@ Maui.Page
floatingBar: true
footBarOverlap: true
onItemSizeChanged: refreshGrid()
Maui.Holder
{
id: holder
......@@ -110,6 +108,7 @@ Maui.Page
}
]
footBar.visible: !holder.visible
footBar.middleContent: [
Maui.ToolButton
{
......@@ -126,25 +125,17 @@ Maui.Page
}
]
GridView
Maui.GridView
{
id: grid
width: parent.width
height: parent.height
clip: true
cellWidth: itemSize + itemSpacing
cellHeight: itemSize + itemSpacing
focus: true
boundsBehavior: Flickable.StopAtBounds
flickableDirection: Flickable.AutoFlickDirection
snapMode: GridView.SnapToRow
// flow: GridView.FlowTopToBottom
// maximumFlickVelocity: albumSize*8
width: parent.width
adaptContent: true
itemSize: gridPage.itemSize
spacing: itemSpacing
cellWidth: itemSize
cellHeight: itemSize
model: ListModel {id: gridModel}
......@@ -159,12 +150,6 @@ Maui.Page
// radius: 4
// }
onWidthChanged:
{
refreshGrid()
// grid.cellHeight = size
}
delegate: PixPic
{
id: delegate
......@@ -224,8 +209,6 @@ Maui.Page
}
}
}
ScrollBar.vertical: ScrollBar{ visible: true}
}
function clear()
......@@ -241,23 +224,18 @@ Maui.Page
function zoomIn()
{
itemSize = itemSize + 20
refreshGrid()
}
function zoomOut()
{
itemSize = itemSize - 20
refreshGrid()
}
function refreshGrid()
{
var amount = parseInt(grid.width/(itemSize + itemSpacing),10)
var leftSpace = parseInt(grid.width-(amount*(itemSize + itemSpacing)), 10)
var size = parseInt((itemSize + itemSpacing)+(parseInt(leftSpace/amount, 10)), 10)
size = size > itemSize + itemSpacing ? size : itemSize + itemSpacing
grid.cellWidth = size
grid.adaptGrid()
}
}
import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import org.kde.mauikit 1.0 as Maui
GridView
Maui.GridView
{
id: albumsGridRoot
property int itemSize : iconSizes.huge
property int itemSpacing: itemSize * 0.5 + (isMobile ? space.big : space.large)
width: parent.width
height: parent.height
property string currentAlbum : ""
signal albumClicked(int index)
clip: true
width: parent.width
height: parent.height
adaptContent: true
cellWidth: itemSize + itemSpacing
cellHeight: itemSize + itemSpacing
itemSize : iconSizes.huge
spacing: itemSize * 0.5 + (isMobile ? space.big : space.large)
focus: true
boundsBehavior: Flickable.StopAtBounds
flickableDirection: Flickable.AutoFlickDirection
snapMode: GridView.SnapToRow
cellWidth: itemSize + spacing
cellHeight: itemSize +spacing
model: ListModel
{
id: gridModel
}
highlightMoveDuration: 0
delegate: AlbumDelegate
{
id: delegate
......@@ -51,18 +43,5 @@ GridView
albumClicked(index)
}
}
}
onWidthChanged:
{
var amount = parseInt(width/(itemSize + itemSpacing),10)
var leftSpace = parseInt(width-(amount*(itemSize + itemSpacing)), 10)
var size = parseInt((itemSize + itemSpacing)+(parseInt(leftSpace/amount, 10)), 10)
size = size > itemSize + itemSpacing ? size : itemSize + itemSpacing
cellWidth = size
}
ScrollBar.vertical: ScrollBar{ visible: true}
}
}
......@@ -23,6 +23,12 @@ Kirigami.PageRow
headBarVisible: false
footBar.middleContent: Maui.TextField
{
width: footBar.middleLayout.width * 0.7
placeholderText: qsTr("Filter folder...")
}
Maui.Holder
{
id: holder
......@@ -37,6 +43,7 @@ Kirigami.PageRow
Maui.GridBrowser
{
id: folderGrid
anchors.fill: parent
showEmblem: false
onItemClicked:
......
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