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

use mauikit gridview

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