Library system base
This commit is contained in:
parent
0d71e53ec6
commit
e6db4cd395
6 changed files with 379 additions and 673 deletions
|
@ -7,46 +7,208 @@ import "./" as Presenter
|
|||
|
||||
Item {
|
||||
id: root
|
||||
Presenter.PanelItem {
|
||||
anchors.fill: parent
|
||||
|
||||
/* ColumnLayout { */
|
||||
/* anchors.fill: parent */
|
||||
/* spacing: 0 */
|
||||
/* Rectangle { */
|
||||
/* id: songLibraryPanel */
|
||||
/* Layout.preferredHeight: 40 */
|
||||
/* Layout.fillWidth: true */
|
||||
/* color: Kirigami.Theme.backgroundColor */
|
||||
|
||||
/* Controls.Label { */
|
||||
/* anchors.centerIn: parent */
|
||||
/* text: "Songs" */
|
||||
/* } */
|
||||
|
||||
/* MouseArea { */
|
||||
/* anchors.fill: parent */
|
||||
/* onClicked: { */
|
||||
/* if (songLibraryList.state == "selected") */
|
||||
/* songLibraryList.state = "deselected" */
|
||||
/* else */
|
||||
/* songLibraryList.state = "selected" */
|
||||
/* } */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* ListView { */
|
||||
/* Layout.fillHeight: true */
|
||||
/* Layout.fillWidth: true */
|
||||
/* id: songLibraryList */
|
||||
/* model: _songListModel */
|
||||
/* delegate: itemDelegate */
|
||||
|
||||
/* Component.onCompleted: songLibraryList.state = selected */
|
||||
|
||||
/* states: [ */
|
||||
/* State { */
|
||||
/* name: "deselected" */
|
||||
/* PropertyChanges { target: songLibraryList */
|
||||
/* height: 0 */
|
||||
/* Layout.fillHeight: false */
|
||||
/* visible: false */
|
||||
/* } */
|
||||
/* }, */
|
||||
/* State { */
|
||||
/* name: "selected" */
|
||||
/* PropertyChanges { target: songLibraryList } */
|
||||
/* } */
|
||||
/* ] */
|
||||
|
||||
/* transitions: Transition { */
|
||||
/* from: "selected" */
|
||||
/* to: "deselected" */
|
||||
/* NumberAnimation { */
|
||||
/* target: songLibraryList */
|
||||
/* properties: "height" */
|
||||
/* easing.type: Easing.OutCubic */
|
||||
/* duration: 300 */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* Component { */
|
||||
/* id: itemDelegate */
|
||||
/* Kirigami.BasicListItem { */
|
||||
/* width: ListView.view.width */
|
||||
/* height:40 */
|
||||
/* label: title */
|
||||
/* subtitle: author */
|
||||
/* hoverEnabled: true */
|
||||
/* onClicked: { */
|
||||
/* ListView.view.currentIndex = index */
|
||||
/* songTitle = title */
|
||||
/* songLyrics = lyrics */
|
||||
/* songAuthor = author */
|
||||
/* showPassiveNotification(songLyrics, 3000) */
|
||||
/* } */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* Kirigami.WheelHandler { */
|
||||
/* id: wheelHandler */
|
||||
/* target: songLibraryList */
|
||||
/* filterMouseEvents: true */
|
||||
/* keyNavigationEnabled: true */
|
||||
/* } */
|
||||
|
||||
/* Controls.ScrollBar.vertical: Controls.ScrollBar { */
|
||||
/* anchors.right: songLibraryList.right */
|
||||
/* anchors.leftMargin: 10 */
|
||||
/* active: hovered || pressed */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* Rectangle { */
|
||||
/* id: videoLibraryPanel */
|
||||
/* Layout.preferredHeight: 40 */
|
||||
/* Layout.fillWidth: true */
|
||||
/* color: Kirigami.Theme.backgroundColor */
|
||||
/* opacity: 1.0 */
|
||||
|
||||
/* Controls.Label { */
|
||||
/* anchors.centerIn: parent */
|
||||
/* text: "Videos" */
|
||||
/* } */
|
||||
|
||||
/* MouseArea { */
|
||||
/* anchors.fill: parent */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* ListView { */
|
||||
/* id: videoLibraryList */
|
||||
/* Layout.fillHeight: true */
|
||||
/* Layout.fillWidth: true */
|
||||
|
||||
/* } */
|
||||
/* Rectangle { */
|
||||
/* id: imageLibraryPanel */
|
||||
/* Layout.preferredHeight: 40 */
|
||||
/* Layout.fillWidth: true */
|
||||
/* color: Kirigami.Theme.backgroundColor */
|
||||
|
||||
/* Controls.Label { */
|
||||
/* anchors.centerIn: parent */
|
||||
/* text: "Images" */
|
||||
/* } */
|
||||
|
||||
/* MouseArea { */
|
||||
/* anchors.fill: parent */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* ListView { */
|
||||
/* id: imageLibraryList */
|
||||
/* Layout.fillHeight: true */
|
||||
/* Layout.fillWidth: true */
|
||||
|
||||
/* } */
|
||||
/* Rectangle { */
|
||||
/* id: presentationLibraryPanel */
|
||||
/* Layout.preferredHeight: 40 */
|
||||
/* Layout.fillWidth: true */
|
||||
/* color: Kirigami.Theme.backgroundColor */
|
||||
|
||||
/* Controls.Label { */
|
||||
/* anchors.centerIn: parent */
|
||||
/* text: "Presentations" */
|
||||
/* } */
|
||||
|
||||
/* MouseArea { */
|
||||
/* anchors.fill: parent */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* ListView { */
|
||||
/* id: presentationLibraryList */
|
||||
/* Layout.fillHeight: true */
|
||||
/* Layout.fillWidth: true */
|
||||
|
||||
/* } */
|
||||
/* Rectangle { */
|
||||
/* id: slideLibraryPanel */
|
||||
/* Layout.preferredHeight: 40 */
|
||||
/* Layout.fillWidth: true */
|
||||
/* color: Kirigami.Theme.backgroundColor */
|
||||
|
||||
/* Controls.Label { */
|
||||
/* anchors.centerIn: parent */
|
||||
/* text: "Slides" */
|
||||
/* } */
|
||||
|
||||
/* MouseArea { */
|
||||
/* anchors.fill: parent */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* ListView { */
|
||||
/* id: slideLibraryList */
|
||||
/* Layout.fillHeight: true */
|
||||
/* Layout.fillWidth: true */
|
||||
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
Presenter.LibraryItem {
|
||||
id: songLibrary
|
||||
title: "Songs"
|
||||
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
id: libraryListView
|
||||
model: _songListModel
|
||||
delegate: itemDelegate
|
||||
|
||||
Component {
|
||||
id: itemDelegate
|
||||
Kirigami.BasicListItem {
|
||||
width: ListView.view.width
|
||||
height:40
|
||||
label: title
|
||||
subtitle: author
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
ListView.view.currentIndex = index
|
||||
songTitle = title
|
||||
songLyrics = lyrics
|
||||
songAuthor = author
|
||||
showPassiveNotification(songLyrics, 3000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.WheelHandler {
|
||||
id: wheelHandler
|
||||
target: libraryListView
|
||||
filterMouseEvents: true
|
||||
keyNavigationEnabled: true
|
||||
}
|
||||
|
||||
Controls.ScrollBar.vertical: Controls.ScrollBar {
|
||||
anchors.right: libraryListView.right
|
||||
anchors.leftMargin: 10
|
||||
active: hovered || pressed
|
||||
}
|
||||
}
|
||||
model: _songListModel
|
||||
open: true
|
||||
/* type: "song" */
|
||||
/* Layout.fillHeight: true */
|
||||
Layout.fillWidth: true
|
||||
/* Layout.preferredHeight: parent.height */
|
||||
}
|
||||
|
||||
Presenter.LibraryItem {
|
||||
id: ssongLibrary
|
||||
title: "Songs"
|
||||
model: _songListModel
|
||||
open: false
|
||||
/* type: "song" */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
99
src/qml/presenter/LibraryItem.qml
Normal file
99
src/qml/presenter/LibraryItem.qml
Normal file
|
@ -0,0 +1,99 @@
|
|||
|
||||
import QtQuick 2.13
|
||||
import QtQuick.Dialogs 1.0
|
||||
import QtQuick.Controls 2.0 as Controls
|
||||
import QtQuick.Layouts 1.2
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
import "./" as Presenter
|
||||
|
||||
Column {
|
||||
id: root
|
||||
|
||||
property string title: ""
|
||||
required property var model
|
||||
property bool open
|
||||
|
||||
Rectangle {
|
||||
id: panel
|
||||
implicitHeight: 40
|
||||
implicitWidth: parent.width
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
|
||||
Controls.Label {
|
||||
id: titleLabel
|
||||
anchors.centerIn: parent
|
||||
text: title
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
text: "^"
|
||||
font.pointSize: 24
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 15
|
||||
anchors.baseline: open ? titleLabel.bottom : parent.bottom
|
||||
rotation: open ? 180 : 0
|
||||
|
||||
Behavior on rotation {
|
||||
NumberAnimation { easing.type: Easing.OutCubic; duration: 300 }
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: open = !open
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: libraryList
|
||||
|
||||
model: _songListModel
|
||||
delegate: libraryDelegate
|
||||
clip: true
|
||||
implicitWidth: parent.width
|
||||
height: {
|
||||
if (open)
|
||||
parent.height - panel.height
|
||||
else
|
||||
0
|
||||
}
|
||||
y: panel.height
|
||||
|
||||
Behavior on height {
|
||||
NumberAnimation { easing.type: Easing.OutCubic; duration: 300 }
|
||||
}
|
||||
|
||||
Kirigami.WheelHandler {
|
||||
id: wheelHandler
|
||||
target: libraryList
|
||||
filterMouseEvents: true
|
||||
keyNavigationEnabled: true
|
||||
}
|
||||
|
||||
Controls.ScrollBar.vertical: Controls.ScrollBar {
|
||||
anchors.right: libraryList.right
|
||||
anchors.leftMargin: 10
|
||||
active: hovered || pressed
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Component {
|
||||
id: libraryDelegate
|
||||
Kirigami.BasicListItem {
|
||||
width: ListView.view.width
|
||||
height:40
|
||||
label: title
|
||||
subtitle: author
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
ListView.view.currentIndex = index
|
||||
songTitle = title
|
||||
songLyrics = lyrics
|
||||
songAuthor = author
|
||||
showPassiveNotification(songLyrics, 3000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -4,20 +4,20 @@ import QtQuick.Layouts 1.2
|
|||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
Item {
|
||||
id: root
|
||||
default property var contentItem: null
|
||||
property string title: "panel"
|
||||
id: root
|
||||
property bool current: false
|
||||
Layout.fillWidth: true
|
||||
height: 30
|
||||
Layout.fillHeight: current
|
||||
property bool current: false
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
Rectangle {
|
||||
id: bar
|
||||
Layout.fillWidth: true
|
||||
height: 30
|
||||
height: 40
|
||||
color: root.current ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
|
||||
Controls.Label {
|
||||
anchors.fill: parent
|
||||
|
@ -37,6 +37,9 @@ Item {
|
|||
verticalAlignment: Text.AlignVCenter
|
||||
text: "^"
|
||||
rotation: root.current ? "180" : 0
|
||||
Behavior on rotation {
|
||||
PropertyAnimation { duration: 100 }
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<file>qml/presenter/Library.qml</file>
|
||||
<file>qml/presenter/LibraryModel.qml</file>
|
||||
<file>qml/presenter/LibraryDelegate.qml</file>
|
||||
<file>qml/presenter/LibraryItem.qml</file>
|
||||
<file>qml/presenter/Header.qml</file>
|
||||
<file>qml/presenter/Actions.qml</file>
|
||||
<file>qml/presenter/PanelItem.qml</file>
|
||||
|
|
|
@ -4,6 +4,17 @@ SongListModel::SongListModel(QObject *parent)
|
|||
: QAbstractListModel(parent)
|
||||
{
|
||||
m_data
|
||||
<< Data("10,000 Reasons", "10,000 reasons for my heart to sing", "Matt Redman", "13470183", "")
|
||||
<< Data("Marvelous Light", "Into marvelous light I'm running", "Chris Tomlin", "13470183", "")
|
||||
<< Data("10,000 Reasons", "10,000 reasons for my heart to sing", "Matt Redman", "13470183", "")
|
||||
<< Data("Marvelous Light", "Into marvelous light I'm running", "Chris Tomlin", "13470183", "")
|
||||
<< Data("10,000 Reasons", "10,000 reasons for my heart to sing", "Matt Redman", "13470183", "")
|
||||
<< Data("Marvelous Light", "Into marvelous light I'm running", "Chris Tomlin", "13470183", "")
|
||||
<< Data("10,000 Reasons", "10,000 reasons for my heart to sing", "Matt Redman", "13470183", "")
|
||||
<< Data("Marvelous Light", "Into marvelous light I'm running", "Chris Tomlin", "13470183", "")
|
||||
<< Data("Marvelous Light", "Into marvelous light I'm running", "Chris Tomlin", "13470183", "")
|
||||
<< Data("10,000 Reasons", "10,000 reasons for my heart to sing", "Matt Redman", "13470183", "")
|
||||
<< Data("Marvelous Light", "Into marvelous light I'm running", "Chris Tomlin", "13470183", "")
|
||||
<< Data("10,000 Reasons", "10,000 reasons for my heart to sing", "Matt Redman", "13470183", "")
|
||||
<< Data("Marvelous Light", "Into marvelous light I'm running", "Chris Tomlin", "13470183", "");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue