Commit c354cea3 authored by Nate Graham's avatar Nate Graham 🔩
Browse files

Add Placeholder messages to main views when empty

parent 11004abe
......@@ -11,7 +11,7 @@ import QtQuick.Controls 2.2
import QtQml.Models 2.2
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kirigami 2.12 as Kirigami
import org.kde.elisa 1.0
FocusScope {
......@@ -25,6 +25,11 @@ FocusScope {
property url albumArtUrl: ''
property url fileUrl: ''
readonly property bool nothingPlaying: albumName.length === 0
&& artistName.length === 0
&& albumArtUrl.toString.length === 0
&& fileUrl.toString.length === 0
TrackContextMetaDataModel {
id: metaDataModel
......@@ -82,6 +87,8 @@ FocusScope {
id: albumArtBackground
anchors.fill: parent
visible: !topItem.nothingPlaying
source: albumArtUrl.toString() === '' ? Qt.resolvedUrl(elisaTheme.defaultAlbumImage) : albumArtUrl
sourceSize.width: topItem.width
......@@ -106,6 +113,8 @@ FocusScope {
anchors.fill: parent
clip: true
visible: !topItem.nothingPlaying
contentWidth: content.width
contentHeight: content.height
......@@ -206,10 +215,19 @@ FocusScope {
}
}
}
// "Nothing Playing" message
Kirigami.PlaceholderMessage {
anchors.centerIn: parent
width: parent.width - (Kirigami.Units.largeSpacing * 4)
visible: topItem.nothingPlaying
text: i18n("Nothing playing")
}
}
// Footer with file path label
HeaderFooterToolbar {
visible: !topItem.nothingPlaying
type: "footer"
contentLayoutSpacing: Kirigami.Units.largeSpacing
contentItems: [
......
......@@ -10,7 +10,7 @@ import QtQuick.Window 2.2
import QtQml.Models 2.1
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kirigami 2.12 as Kirigami
import org.kde.elisa 1.0
FocusScope {
......@@ -180,6 +180,13 @@ FocusScope {
anchors.fill: contentDirectoryView
}
Kirigami.PlaceholderMessage {
anchors.centerIn: parent
width: parent.width - (Kirigami.Units.largeSpacing * 4)
visible: contentDirectoryView.count === 0
text: i18nc("e.g. 'no artists found' or 'no albums found'", "No %1 found", mainTitle)
}
cellWidth: Math.floor(availableWidth / Math.max(Math.floor(availableWidth / elisaTheme.gridDelegateSize), 2))
cellHeight: elisaTheme.gridDelegateSize + Kirigami.Units.gridUnit * 2 + Kirigami.Units.largeSpacing
}
......
......@@ -10,7 +10,7 @@ import QtQuick.Window 2.2
import QtQml.Models 2.2
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.12 as Kirigami
import org.kde.elisa 1.0
FocusScope {
......@@ -153,6 +153,13 @@ FocusScope {
anchors.fill: contentDirectoryView
}
Kirigami.PlaceholderMessage {
anchors.centerIn: parent
width: parent.width - (Kirigami.Units.largeSpacing * 4)
visible: contentDirectoryView.count === 0
text: i18nc("e.g. 'no artists found' or 'no albums found'", "No %1 found", mainTitle)
}
onCountChanged: if (count === 0) {
currentIndex = -1;
}
......
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