switching to a reusable LibraryItem component for easier refactoring
This commit is contained in:
parent
1b080e9822
commit
2e6e1407dc
4 changed files with 131 additions and 1204 deletions
File diff suppressed because it is too large
Load diff
|
@ -8,7 +8,7 @@ import org.kde.kirigami 2.13 as Kirigami
|
||||||
import "./" as Presenter
|
import "./" as Presenter
|
||||||
import org.presenter 1.0
|
import org.presenter 1.0
|
||||||
|
|
||||||
Item {
|
ColumnLayout {
|
||||||
id: root
|
id: root
|
||||||
property var proxyModel
|
property var proxyModel
|
||||||
property var innerModel
|
property var innerModel
|
||||||
|
@ -16,9 +16,36 @@ Item {
|
||||||
property string headerLabel
|
property string headerLabel
|
||||||
property string itemLabel
|
property string itemLabel
|
||||||
property string itemSubtitle
|
property string itemSubtitle
|
||||||
|
property string itemIcon
|
||||||
property var newItemFuntion
|
property var newItemFuntion
|
||||||
property var deleteItemFuntion
|
property var deleteItemFuntion
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "deselected"
|
||||||
|
when: (selectedLibrary !== libraryType)
|
||||||
|
PropertyChanges {
|
||||||
|
target: root
|
||||||
|
Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "selected"
|
||||||
|
when: (selectedLibrary == libraryType)
|
||||||
|
PropertyChanges { target: root }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: Transition {
|
||||||
|
to: "*"
|
||||||
|
NumberAnimation {
|
||||||
|
target: root
|
||||||
|
properties: "preferredHeight"
|
||||||
|
easing.type: Easing.OutCubic
|
||||||
|
duration: 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: libraryPanel
|
id: libraryPanel
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: 40
|
||||||
|
@ -34,7 +61,7 @@ Item {
|
||||||
anchors.leftMargin: 15
|
anchors.leftMargin: 15
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
elide: Text.ElideLeft
|
elide: Text.ElideLeft
|
||||||
text: label
|
text: headerLabel
|
||||||
}
|
}
|
||||||
|
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
|
@ -79,6 +106,7 @@ Item {
|
||||||
z: 2
|
z: 2
|
||||||
Layout.preferredHeight: 40
|
Layout.preferredHeight: 40
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
/* width: parent.width */
|
/* width: parent.width */
|
||||||
color: Kirigami.Theme.backgroundColor
|
color: Kirigami.Theme.backgroundColor
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
@ -134,12 +162,13 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
Layout.preferredHeight: parent.height - 240
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
id: libraryList
|
id: libraryList
|
||||||
model: proxyModel
|
model: proxyModel
|
||||||
ItemselectionModel {
|
clip: true
|
||||||
|
ItemSelectionModel {
|
||||||
id: selectionModel
|
id: selectionModel
|
||||||
model: proxyModel
|
model: proxyModel
|
||||||
onSelectionChanged: {
|
onSelectionChanged: {
|
||||||
|
@ -182,18 +211,26 @@ Item {
|
||||||
Item{
|
Item{
|
||||||
implicitWidth: ListView.view.width
|
implicitWidth: ListView.view.width
|
||||||
height: selectedLibrary == libraryType ? 50 : 0
|
height: selectedLibrary == libraryType ? 50 : 0
|
||||||
Kirigami.BasiclistItem {
|
Kirigami.BasicListItem {
|
||||||
id: listItem
|
id: listItem
|
||||||
|
|
||||||
property bool rightMenu: false
|
property bool rightMenu: false
|
||||||
property bool selected: selectionModel.isSelected(proxyModel.idx(index))
|
property bool selected: selectionModel.isSelected(proxyModel.idx(index))
|
||||||
|
property bool fileValidation: fileHelper.validate(filePath)
|
||||||
|
|
||||||
implicitWidth: libraryList.width
|
implicitWidth: libraryList.width
|
||||||
height: selectedLibrary == libraryType ? 50 : 0
|
height: selectedLibrary == libraryType ? 50 : 0
|
||||||
clip: true
|
clip: true
|
||||||
label: itemLabel
|
label: title
|
||||||
subtitle: itemSubtitle
|
subtitle: {
|
||||||
icon: "folder-music-symbolic"
|
if (selectedLibrary == "song")
|
||||||
|
author
|
||||||
|
else if (fileValidation)
|
||||||
|
filePath;
|
||||||
|
else
|
||||||
|
"file is missing"
|
||||||
|
}
|
||||||
|
icon: itemIcon
|
||||||
iconSize: Kirigami.Units.gridUnit
|
iconSize: Kirigami.Units.gridUnit
|
||||||
supportsMouseEvents: false
|
supportsMouseEvents: false
|
||||||
backgroundColor: Kirigami.Theme.backgroundColor;
|
backgroundColor: Kirigami.Theme.backgroundColor;
|
||||||
|
@ -204,7 +241,16 @@ Item {
|
||||||
value: Kirigami.Theme.highlightColor
|
value: Kirigami.Theme.highlightColor
|
||||||
}
|
}
|
||||||
|
|
||||||
textColor: Kirigami.Theme.textColor;
|
textColor: {
|
||||||
|
if (selectedLibrary == "song")
|
||||||
|
Kirigami.Theme.textColor;
|
||||||
|
else if (fileValidation) {
|
||||||
|
Kirigami.Theme.textColor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
"red"
|
||||||
|
}
|
||||||
|
|
||||||
Binding on textColor {
|
Binding on textColor {
|
||||||
when: dragHandler.containsMouse ||
|
when: dragHandler.containsMouse ||
|
||||||
(selectionModel.hasSelection &&
|
(selectionModel.hasSelection &&
|
||||||
|
|
|
@ -242,7 +242,8 @@ Item {
|
||||||
}
|
}
|
||||||
rightClickMenu.popup(mouse);
|
rightClickMenu.popup(mouse);
|
||||||
}
|
}
|
||||||
else if ((mouse.button === Qt.LeftButton) && (mouse.modifiers === Qt.ShiftModifier)) {
|
else if ((mouse.button === Qt.LeftButton) &&
|
||||||
|
(mouse.modifiers === Qt.ShiftModifier)) {
|
||||||
selectItems(index);
|
selectItems(index);
|
||||||
} else {
|
} else {
|
||||||
serviceItemList.currentIndex = index;
|
serviceItemList.currentIndex = index;
|
||||||
|
@ -546,15 +547,17 @@ Item {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 'song': {
|
case 'song': {
|
||||||
const newtext = songProxyModel.getLyricList(itemID);
|
const lyrics = songProxyModel.getLyricList(itemID);
|
||||||
const song = songProxyModel.getSong(itemID);
|
const song = songProxyModel.getSong(itemID);
|
||||||
|
/* showPassiveNotification(song.title); */
|
||||||
console.log("adding: " + song.title +
|
console.log("adding: " + song.title +
|
||||||
" of type " + type +
|
" of type " + type +
|
||||||
" with " + newtext.length + " slides");
|
" with " + lyrics.length + " slides");
|
||||||
ServiceItemModel.insertItem(index, song.title,
|
ServiceItemModel.insertItem(index, song.title,
|
||||||
type, song.background,
|
type, song.background,
|
||||||
song.backgroundType, newtext,
|
song.backgroundType, lyrics,
|
||||||
song.audio, song.font, song.fontSize, newtext.length);
|
song.audio, song.font, song.fontSize,
|
||||||
|
lyrics.length);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 'presentation': {
|
case 'presentation': {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<file>qml/presenter/ServiceList.qml</file>
|
<file>qml/presenter/ServiceList.qml</file>
|
||||||
<file>qml/presenter/MainWindow.qml</file>
|
<file>qml/presenter/MainWindow.qml</file>
|
||||||
<file>qml/presenter/Library.qml</file>
|
<file>qml/presenter/Library.qml</file>
|
||||||
|
<file>qml/presenter/LibraryItem.qml</file>
|
||||||
<file>qml/presenter/Header.qml</file>
|
<file>qml/presenter/Header.qml</file>
|
||||||
<file>qml/presenter/Actions.qml</file>
|
<file>qml/presenter/Actions.qml</file>
|
||||||
<file>qml/presenter/PanelItem.qml</file>
|
<file>qml/presenter/PanelItem.qml</file>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue