86 lines
2.4 KiB
QML
86 lines
2.4 KiB
QML
import QtQuick 2.12
|
|
import QtQuick.Layouts 1.12
|
|
import QtQuick.Controls 1.4
|
|
import QtQuick.Controls 2.15
|
|
|
|
import Ikinuki.Client 1.0
|
|
|
|
import "./ProviderBrowse"
|
|
|
|
Rectangle {
|
|
id: root
|
|
property var provider
|
|
property bool viewExit: false
|
|
property int currentView: 0
|
|
color: "#22282A"
|
|
Row {
|
|
anchors.fill: parent
|
|
Item {
|
|
height: parent.height
|
|
width: parent.width * 0.025
|
|
}
|
|
Column {
|
|
width: parent.width * 0.95
|
|
height: parent.height
|
|
Item {
|
|
height: 40
|
|
width: parent.width
|
|
}
|
|
CoverGrid {
|
|
id: coverGrid
|
|
height: parent.height - 80
|
|
width: parent.width
|
|
provider: root.provider
|
|
shows: root.provider.showsAlphabetic
|
|
selected: currentView == 0
|
|
}
|
|
Item {
|
|
height: 40
|
|
width: parent.width
|
|
}
|
|
}
|
|
AlphabetSelector {
|
|
id: alphabetSelector
|
|
height: parent.height
|
|
width: parent.width * 0.025
|
|
selected: currentView == 1
|
|
}
|
|
}
|
|
|
|
Keys.onPressed: (event)=> {
|
|
if (currentView == 0) { // grid
|
|
if (event.key == Qt.Key_Left) {
|
|
if (coverGrid.xIndex == 0) {
|
|
viewExit = true;
|
|
} else {
|
|
coverGrid.xIndex--;
|
|
}
|
|
} else if (event.key == Qt.Key_Right) {
|
|
if (coverGrid.xIndex == coverGrid.numColumns - 1) {
|
|
currentView = 1;
|
|
} else {
|
|
coverGrid.xIndex++;
|
|
}
|
|
} else if (event.key == Qt.Key_Down) {
|
|
coverGrid.yIndex++;
|
|
} else if (event.key == Qt.Key_Up) {
|
|
coverGrid.yIndex--;
|
|
}
|
|
} else if (currentView == 1) { // alphabet
|
|
if (event.key == Qt.Key_Left) {
|
|
currentView = 0;
|
|
} else if (event.key == Qt.Key_Up) {
|
|
if (alphabetSelector.yIndex > 0) {
|
|
alphabetSelector.yIndex--;
|
|
}
|
|
} else if (event.key == Qt.Key_Down) {
|
|
if (alphabetSelector.yIndex < alphabetSelector.letters.length - 1)
|
|
alphabetSelector.yIndex++;
|
|
}
|
|
} else {
|
|
return
|
|
}
|
|
event.accepted = true;
|
|
}
|
|
}
|