Add grid scrolling to ProviderBrowse view
This commit is contained in:
@@ -27,9 +27,9 @@ Rectangle {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
}
|
}
|
||||||
CoverGrid {
|
CoverGrid {
|
||||||
id: coverGrid
|
|
||||||
height: parent.height - 80
|
height: parent.height - 80
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
id: coverGrid
|
||||||
provider: root.provider
|
provider: root.provider
|
||||||
shows: root.provider.showsAlphabetic
|
shows: root.provider.showsAlphabetic
|
||||||
selected: currentView == 0
|
selected: currentView == 0
|
||||||
@@ -62,9 +62,20 @@ Rectangle {
|
|||||||
coverGrid.xIndex++;
|
coverGrid.xIndex++;
|
||||||
}
|
}
|
||||||
} else if (event.key == Qt.Key_Down) {
|
} else if (event.key == Qt.Key_Down) {
|
||||||
coverGrid.yIndex++;
|
var max = Math.floor(coverGrid.shows.length / coverGrid.numColumns);
|
||||||
|
if (coverGrid.yIndex < max) {
|
||||||
|
coverGrid.yIndex++;
|
||||||
|
if (coverGrid.scrollIndex < coverGrid.yIndex - 1.5) {
|
||||||
|
coverGrid.scrollIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (event.key == Qt.Key_Up) {
|
} else if (event.key == Qt.Key_Up) {
|
||||||
coverGrid.yIndex--;
|
if (coverGrid.yIndex > 0) {
|
||||||
|
coverGrid.yIndex--;
|
||||||
|
if (coverGrid.scrollIndex > coverGrid.yIndex + 0.5) {
|
||||||
|
coverGrid.scrollIndex--;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (currentView == 1) { // alphabet
|
} else if (currentView == 1) { // alphabet
|
||||||
if (event.key == Qt.Key_Left) {
|
if (event.key == Qt.Key_Left) {
|
||||||
|
|||||||
@@ -5,23 +5,33 @@ import QtQuick.Controls 2.15
|
|||||||
|
|
||||||
import Ikinuki.Client 1.0
|
import Ikinuki.Client 1.0
|
||||||
|
|
||||||
Grid {
|
ScrollView {
|
||||||
id: root
|
id: root
|
||||||
clip: true
|
|
||||||
property bool selected
|
property bool selected
|
||||||
property int yIndex: 0
|
property int yIndex: 0
|
||||||
property int xIndex: 0
|
property int xIndex: 0
|
||||||
|
property int scrollIndex: 0
|
||||||
property int numColumns: 6
|
property int numColumns: 6
|
||||||
property var provider
|
property var provider
|
||||||
property var shows: []
|
property var shows
|
||||||
columns: numColumns
|
contentHeight: Math.floor(shows.length / numColumns) * 400
|
||||||
topPadding: 20
|
ScrollBar.vertical.position: scrollIndex / Math.floor(shows.length / numColumns)
|
||||||
Repeater {
|
Behavior on ScrollBar.vertical.position {
|
||||||
id: repeater
|
NumberAnimation {
|
||||||
model: shows
|
duration: 200
|
||||||
BrowseShow {
|
easing.type: Easing.Linear
|
||||||
show: provider.getShow(modelData)
|
}
|
||||||
elemSelected: selected && (index == (yIndex * numColumns + xIndex))
|
}
|
||||||
|
Grid {
|
||||||
|
columns: numColumns
|
||||||
|
topPadding: 20
|
||||||
|
Repeater {
|
||||||
|
id: repeater
|
||||||
|
model: shows
|
||||||
|
BrowseShow {
|
||||||
|
show: provider.getShow(modelData)
|
||||||
|
elemSelected: selected && (index == (yIndex * numColumns + xIndex))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user