1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2024-11-22 09:15:18 +00:00

Implement playlist model and UI

This commit is contained in:
Chris Josten 2021-08-21 22:01:13 +02:00
parent e04ec364c1
commit f09593c245
13 changed files with 309 additions and 36 deletions

View file

@ -36,6 +36,7 @@
#include "viewmodel/loader.h" #include "viewmodel/loader.h"
#include "viewmodel/modelstatus.h" #include "viewmodel/modelstatus.h"
#include "viewmodel/playbackmanager.h" #include "viewmodel/playbackmanager.h"
#include "viewmodel/playlist.h"
#include "viewmodel/userdata.h" #include "viewmodel/userdata.h"
#include "viewmodel/usermodel.h" #include "viewmodel/usermodel.h"
#include "viewmodel/user.h" #include "viewmodel/user.h"

View file

@ -52,6 +52,11 @@ public:
/// Returns the current item in the queue /// Returns the current item in the queue
QSharedPointer<Item> currentItem(); QSharedPointer<Item> currentItem();
QSharedPointer<Item> nextItem(); QSharedPointer<Item> nextItem();
/**
* @return the current index of the playing item if it is in the list. If playing from the queue,
* returns -1.
*/
int currentItemIndexInList() const;
/** /**
* @brief Determine the previous item to be played. * @brief Determine the previous item to be played.
@ -63,13 +68,26 @@ public:
*/ */
void next(); void next();
// int queueSize() { return m_queue.size(); }; int queueSize() { return m_queue.size(); };
int listSize() const { return m_list.size(); }; int listSize() const { return m_list.size(); };
int totalSize() const { return m_queue.size() + m_list.size(); } int totalSize() const { return m_queue.size() + m_list.size(); }
QSharedPointer<const Item> listAt(int index) const;
/** /**
* @brief Removes all the items from the playlist * @brief Returns the item at the given index of the currently selected playlist, excluding the queue.
* @param index
* @return The given item.
*/
QSharedPointer<const Item> listAt(int index) const;
/**
* @brief Returns the item at the given index of the currently queue, excluding the playlist.
* @param index
* @return The given item.
*/
QSharedPointer<const Item> queueAt(int index) const;
/**
* @brief Removes all the items from the playlist, but not from the queue.
*/ */
void clearList(); void clearList();
@ -83,11 +101,26 @@ public:
* @param index The index to start from. * @param index The index to start from.
*/ */
void play(int index = 0); void play(int index = 0);
/**
* @brief playingFromQueue
* @return True if the currently played item comes from the queue.
*/
bool playingFromQueue() const;
signals: signals:
void beforeListCleared();
void listCleared(); void listCleared();
void itemsAddedToQueue(int index, int count); void beforeItemsAddedToQueue(int index, int count);
void itemsAddedToList(int index, int count); void beforeItemsAddedToList(int index, int count);
void itemsAddedToQueue();
void itemsAddedToList();
void beforeItemsRemovedFromQueue(int index, int count);
void beforeItemsRemovedFromList(int index, int count);
void itemsRemovedFromQueue();
void itemsRemovedFromList();
void listReshuffled(); void listReshuffled();
void currentItemChanged();
private: private:
void reshuffle(); void reshuffle();

View file

@ -103,6 +103,7 @@ public:
virtual int currentItem() const override; virtual int currentItem() const override;
virtual int nextItem() const override; virtual int nextItem() const override;
virtual int itemAt(int index) const override;
virtual void previous() override; virtual void previous() override;
virtual void next() override; virtual void next() override;
@ -122,6 +123,7 @@ public:
ListShuffleBase(const Playlist *parent); ListShuffleBase(const Playlist *parent);
virtual int currentItem() const override; virtual int currentItem() const override;
virtual int nextItem() const override; virtual int nextItem() const override;
virtual int itemAt(int index) const override;
protected: protected:
QVector<int> m_map; QVector<int> m_map;
}; };

View file

@ -41,6 +41,7 @@
#include "../model/playlist.h" #include "../model/playlist.h"
#include "../support/jsonconv.h" #include "../support/jsonconv.h"
#include "../viewmodel/item.h" #include "../viewmodel/item.h"
#include "../viewmodel/playlist.h"
#include "../apiclient.h" #include "../apiclient.h"
#include "itemmodel.h" #include "itemmodel.h"
@ -83,8 +84,8 @@ public:
// Current Item and queue informatoion // Current Item and queue informatoion
Q_PROPERTY(QObject *item READ item NOTIFY itemChanged) Q_PROPERTY(QObject *item READ item NOTIFY itemChanged)
// Q_PROPERTY(QAbstractItemModel *queue READ queue NOTIFY queueChanged)
Q_PROPERTY(int queueIndex READ queueIndex NOTIFY queueIndexChanged) Q_PROPERTY(int queueIndex READ queueIndex NOTIFY queueIndexChanged)
Q_PROPERTY(Jellyfin::ViewModel::Playlist *queue READ queue NOTIFY queueChanged)
// Current media player related property getters // Current media player related property getters
Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged) Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
@ -105,7 +106,7 @@ public:
QObject *mediaObject() const { return m_mediaPlayer; } QObject *mediaObject() const { return m_mediaPlayer; }
qint64 position() const { return m_mediaPlayer->position(); } qint64 position() const { return m_mediaPlayer->position(); }
qint64 duration() const { return m_mediaPlayer->duration(); } qint64 duration() const { return m_mediaPlayer->duration(); }
//ItemModel *queue() const { return m_queue; } ViewModel::Playlist *queue() const { return m_displayQueue; }
int queueIndex() const { return m_queueIndex; } int queueIndex() const { return m_queueIndex; }
// Current media player related property getters // Current media player related property getters
@ -129,7 +130,7 @@ signals:
void mediaObjectChanged(QObject *newMediaObject); void mediaObjectChanged(QObject *newMediaObject);
void positionChanged(qint64 newPosition); void positionChanged(qint64 newPosition);
void durationChanged(qint64 newDuration); void durationChanged(qint64 newDuration);
//void queueChanged(ItemModel *newQue); void queueChanged(QAbstractItemModel *newQueue);
void queueIndexChanged(int newIndex); void queueIndexChanged(int newIndex);
void playbackStateChanged(QMediaPlayer::State newState); void playbackStateChanged(QMediaPlayer::State newState);
void mediaStatusChanged(QMediaPlayer::MediaStatus newMediaStatus); void mediaStatusChanged(QMediaPlayer::MediaStatus newMediaStatus);
@ -198,6 +199,8 @@ private:
QSharedPointer<Model::Item> m_nextItem; QSharedPointer<Model::Item> m_nextItem;
/// The currently played item that will be shown in the GUI /// The currently played item that will be shown in the GUI
ViewModel::Item *m_displayItem = new ViewModel::Item(this); ViewModel::Item *m_displayItem = new ViewModel::Item(this);
/// The currently played queue that will be shown in the GUI
ViewModel::Playlist *m_displayQueue = nullptr;
// Properties for making the streaming request. // Properties for making the streaming request.
QString m_streamUrl; QString m_streamUrl;

View file

@ -21,36 +21,81 @@
#include <optional> #include <optional>
#include <QAtomicInteger> #include <QAbstractListModel>
#include <QMutex> #include <QByteArray>
#include <QMutexLocker> #include <QHash>
#include <QObject> #include <QObject>
#include <QQueue> #include <QSharedPointer>
#include <QWaitCondition> #include <QVariant>
#include <QtMultimedia/QMediaPlaylist>
#include "../apiclient.h" #include "../apiclient.h"
#include "../model/playlist.h"
#include "itemmodel.h" #include "itemmodel.h"
namespace Jellyfin { namespace Jellyfin {
namespace ViewModel { namespace ViewModel {
/** /**
* @brief Playlist/queue that can be exposed to the UI. It also containts the playlist-related logic, * @brief Indicator in which part of the playing queue a given item is positioned.
* which is mostly relevant
*/ */
/*class Playlist : public ItemModel { class NowPlayingSection {
Q_GADGET
public:
enum Value {
Queue,
NowPlaying,
};
Q_ENUM(Value);
};
/**
* @brief Playlist/queue that can be exposed to QML.
*/
class Playlist : public QAbstractListModel {
Q_OBJECT Q_OBJECT
friend class ItemUrlFetcherThread; friend class ItemUrlFetcherThread;
public: public:
explicit Playlist(ApiClient *apiClient, QObject *parent = nullptr); enum RoleNames {
// Item properties
name = Qt::UserRole + 1,
artists,
runTimeTicks,
// Non-item properties
playing,
section,
};
explicit Playlist(Model::Playlist *data, QObject *parent = nullptr);
QVariant data(const QModelIndex &parent, int role = Qt::DisplayRole) const override;
int rowCount(const QModelIndex &parent) const override;
QHash<int, QByteArray> roleNames() const override;
private slots: private slots:
void onItemsAdded(const QModelIndex &parent, int startIndex, int endIndex); void onBeforePlaylistCleared();
void onItemsMoved(const QModelIndex &parent, int startIndex, int endIndex, const QModelIndex &destination, int destinationRow); void onPlaylistCleared();
void onItemsRemoved(const QModelIndex &parent, int startIndex, int endIndex); void onBeforeItemsAddedToList(int startIndex, int amount);
void onItemsReset(); void onBeforeItemsAddedToQueue(int startIndex, int amount);
};*/ void onItemsAddedToList();
void onItemsAddedToQueue();
void onBeforeItemsRemovedFromList(int startIndex, int amount);
void onBeforeItemsRemovedFromQueue(int startIndex, int amount);
void onItemsRemovedFromList();
void onItemsRemovedFromQueue();
void onReshuffled();
void onPlayingItemChanged();
private:
Model::Playlist *m_data;
// The index of the last played item.
int m_lastPlayedRow = -1;
/**
* @param index The index, from 0..rowCount();
* @return True if the item at the current index is being played, false otherwise.
*/
bool isPlaying(int index) const;
};

View file

@ -34,6 +34,7 @@ void registerTypes(const char *uri) {
qmlRegisterUncreatableType<BaseModelLoader>(uri, 1, 0, "BaseModelLoader", "Please use one of its subclasses"); qmlRegisterUncreatableType<BaseModelLoader>(uri, 1, 0, "BaseModelLoader", "Please use one of its subclasses");
qmlRegisterType<ViewModel::ItemModel>(uri, 1, 0, "ItemModel"); qmlRegisterType<ViewModel::ItemModel>(uri, 1, 0, "ItemModel");
qmlRegisterType<ViewModel::UserModel>(uri, 1, 0, "UserModel"); qmlRegisterType<ViewModel::UserModel>(uri, 1, 0, "UserModel");
qmlRegisterUncreatableType<ViewModel::Playlist>(uri, 1, 0, "Playlist", "Available via PlaybackManager");
// Loaders // Loaders
qmlRegisterUncreatableType<ViewModel::LoaderBase>(uri, 1, 0, "LoaderBase", "Use one of its subclasses"); qmlRegisterUncreatableType<ViewModel::LoaderBase>(uri, 1, 0, "LoaderBase", "Use one of its subclasses");
@ -52,6 +53,7 @@ void registerTypes(const char *uri) {
qmlRegisterUncreatableType<Jellyfin::ViewModel::ModelStatusClass>(uri, 1, 0, "ModelStatus", "Is an enum"); qmlRegisterUncreatableType<Jellyfin::ViewModel::ModelStatusClass>(uri, 1, 0, "ModelStatus", "Is an enum");
qmlRegisterUncreatableType<Jellyfin::DTO::PlayMethodClass>(uri, 1, 0, "PlayMethod", "Is an enum"); qmlRegisterUncreatableType<Jellyfin::DTO::PlayMethodClass>(uri, 1, 0, "PlayMethod", "Is an enum");
qmlRegisterUncreatableType<Jellyfin::DTO::ItemFieldsClass>(uri, 1, 0, "ItemFields", "Is an enum"); qmlRegisterUncreatableType<Jellyfin::DTO::ItemFieldsClass>(uri, 1, 0, "ItemFields", "Is an enum");
qmlRegisterUncreatableType<Jellyfin::ViewModel::NowPlayingSection>(uri, 1, 0, "NowPlayingSection", "Is an enum");
qRegisterMetaType<Jellyfin::DTO::PlayMethodClass::Value>(); qRegisterMetaType<Jellyfin::DTO::PlayMethodClass::Value>();
} }

View file

@ -28,6 +28,7 @@ Playlist::Playlist(QObject *parent)
m_shuffler(new NoShuffle(this)){} m_shuffler(new NoShuffle(this)){}
void Playlist::clearList() { void Playlist::clearList() {
emit beforeListCleared();
m_currentItem.clear(); m_currentItem.clear();
m_nextItem.clear(); m_nextItem.clear();
m_list.clear(); m_list.clear();
@ -50,13 +51,16 @@ void Playlist::previous() {
} }
m_nextItemFromQueue = !m_queue.isEmpty(); m_nextItemFromQueue = !m_queue.isEmpty();
m_currentItemFromQueue = false; m_currentItemFromQueue = false;
emit currentItemChanged();
} }
void Playlist::next() { void Playlist::next() {
// Determine the new current item // Determine the new current item
if (!m_queue.isEmpty()) { if (!m_queue.isEmpty()) {
m_currentItem = m_queue.first(); m_currentItem = m_queue.first();
emit beforeItemsRemovedFromQueue(0, 1);
m_queue.removeFirst(); m_queue.removeFirst();
emit itemsRemovedFromQueue();
m_currentItemFromQueue = true; m_currentItemFromQueue = true;
} else if (!m_list.isEmpty()) { } else if (!m_list.isEmpty()) {
// The queue is empty // The queue is empty
@ -89,16 +93,33 @@ void Playlist::next() {
} else { } else {
m_nextItem.clear(); m_nextItem.clear();
} }
emit currentItemChanged();
} }
QSharedPointer<const Item> Playlist::listAt(int index) const { QSharedPointer<const Item> Playlist::listAt(int index) const {
if (m_shuffler->canShuffleInAdvance()) {
return m_list.at(m_shuffler->itemAt(index));
} else {
return m_list.at(index); return m_list.at(index);
}
}
QSharedPointer<const Item> Playlist::queueAt(int index) const {
return m_queue.at(index);
} }
QSharedPointer<Item> Playlist::currentItem() { QSharedPointer<Item> Playlist::currentItem() {
return m_currentItem; return m_currentItem;
} }
int Playlist::currentItemIndexInList() const {
if (m_currentItemFromQueue) {
return -1;
} else {
return m_shuffler->currentItem();
}
}
QSharedPointer<Item> Playlist::nextItem() { QSharedPointer<Item> Playlist::nextItem() {
return m_nextItem; return m_nextItem;
} }
@ -107,10 +128,11 @@ void Playlist::appendToList(ViewModel::ItemModel &model) {
int start = m_list.size(); int start = m_list.size();
int count = model.size(); int count = model.size();
m_list.reserve(count); m_list.reserve(count);
emit beforeItemsAddedToList(start, count);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
m_list.append(QSharedPointer<Model::Item>(model.at(i))); m_list.append(QSharedPointer<Model::Item>(model.at(i)));
} }
emit itemsAddedToList(start, count); emit itemsAddedToList();
reshuffle(); reshuffle();
} }
@ -130,6 +152,7 @@ void Playlist::reshuffle() {
} }
} }
emit listReshuffled(); emit listReshuffled();
emit currentItemChanged();
} }
void Playlist::play(int index) { void Playlist::play(int index) {
@ -142,6 +165,11 @@ void Playlist::play(int index) {
m_nextItem.clear(); m_nextItem.clear();
} }
} }
emit currentItemChanged();
}
bool Playlist::playingFromQueue() const {
return m_currentItemFromQueue;
} }
} // NS Model } // NS Model

View file

@ -63,6 +63,10 @@ int NoShuffle::previousIndex() const {
} }
} }
int NoShuffle::itemAt(int index) const {
return index;
}
int NoShuffle::nextIndex() const { int NoShuffle::nextIndex() const {
if (m_repeatAll) { if (m_repeatAll) {
return (m_index + 1) % m_playlist->listSize(); return (m_index + 1) % m_playlist->listSize();
@ -91,6 +95,10 @@ int ListShuffleBase::nextItem() const {
return m_map[nextIndex()]; return m_map[nextIndex()];
} }
int ListShuffleBase::itemAt(int index) const {
return m_map[index];
}
// SimpleListShuffle // SimpleListShuffle
SimpleListShuffle::SimpleListShuffle(const Playlist *parent) SimpleListShuffle::SimpleListShuffle(const Playlist *parent)
: ListShuffleBase(parent) {} : ListShuffleBase(parent) {}

View file

@ -40,6 +40,8 @@ PlaybackManager::PlaybackManager(QObject *parent)
m_mediaPlayer(new QMediaPlayer(this)), m_mediaPlayer(new QMediaPlayer(this)),
m_urlFetcherThread(new ItemUrlFetcherThread(this)), m_urlFetcherThread(new ItemUrlFetcherThread(this)),
m_queue(new Model::Playlist(this)) { m_queue(new Model::Playlist(this)) {
m_displayQueue = new ViewModel::Playlist(m_queue, this);
// Set up connections. // Set up connections.
m_updateTimer.setInterval(10000); // 10 seconds m_updateTimer.setInterval(10000); // 10 seconds
m_updateTimer.setSingleShot(false); m_updateTimer.setSingleShot(false);

View file

@ -21,15 +21,141 @@
namespace Jellyfin { namespace Jellyfin {
namespace ViewModel { namespace ViewModel {
/*Playlist::Playlist(ApiClient *apiClient, QObject *parent) Playlist::Playlist(Model::Playlist *data, QObject *parent)
: ItemModel(parent) { : QAbstractListModel(parent),
m_data(data) {
connect(this, &QAbstractListModel::rowsInserted, this, &Playlist::onItemsAdded); connect(data, &Model::Playlist::beforeListCleared, this, &Playlist::onBeforePlaylistCleared);
connect(this, &QAbstractListModel::rowsRemoved, this, &Playlist::onItemsRemoved); connect(data, &Model::Playlist::listCleared, this, &Playlist::onPlaylistCleared);
connect(this, &QAbstractListModel::rowsMoved, this, &Playlist::onItemsMoved); connect(data, &Model::Playlist::beforeItemsAddedToList, this, &Playlist::onBeforeItemsAddedToList);
connect(this, &QAbstractListModel::modelReset, this, &Playlist::onItemsReset); connect(data, &Model::Playlist::beforeItemsAddedToQueue, this, &Playlist::onBeforeItemsAddedToQueue);
connect(data, &Model::Playlist::itemsAddedToList, this, &Playlist::onItemsAddedToList);
connect(data, &Model::Playlist::itemsAddedToQueue, this, &Playlist::onItemsAddedToQueue);
connect(data, &Model::Playlist::beforeItemsRemovedFromList, this, &Playlist::onBeforeItemsRemovedFromList);
connect(data, &Model::Playlist::beforeItemsRemovedFromQueue, this, &Playlist::onBeforeItemsRemovedFromQueue);
connect(data, &Model::Playlist::itemsRemovedFromList, this, &Playlist::onItemsRemovedFromList);
connect(data, &Model::Playlist::itemsRemovedFromQueue, this, &Playlist::onItemsRemovedFromQueue);
connect(data, &Model::Playlist::listReshuffled, this, &Playlist::onReshuffled);
connect(data, &Model::Playlist::currentItemChanged, this, &Playlist::onPlayingItemChanged);
}
int Playlist::rowCount(const QModelIndex &parent) const {
if (!parent.isValid()) return m_data->totalSize();
return 0;
}
QHash<int, QByteArray> Playlist::roleNames() const {
return {
{RoleNames::name, "name"},
{RoleNames::artists, "artists"},
{RoleNames::runTimeTicks, "runTimeTicks"},
{RoleNames::section, "section"},
{RoleNames::playing, "playing"},
};
};
QVariant Playlist::data(const QModelIndex &index, int role) const {
if (!index.isValid()) return QVariant();
if (index.row() >= m_data->totalSize()) return QVariant();
bool inQueue = index.row() < m_data->queueSize();
// Handle the special "section" role
if (role == RoleNames::section) {
if (inQueue) {
return QVariant(NowPlayingSection::Queue);
} else {
return QVariant(NowPlayingSection::NowPlaying);
}
} else if (role == RoleNames::playing) {
return isPlaying(index.row());
}
// Handle the other roles
QSharedPointer<const Model::Item> rowData;
if (inQueue) {
rowData = m_data->queueAt(index.row());
} else {
rowData = m_data->listAt((index.row() - m_data->queueSize()));
}
switch(role) {
case RoleNames::name:
return QVariant(rowData->name());
case RoleNames::artists:
return QVariant(rowData->artists());
case RoleNames::runTimeTicks:
return QVariant(rowData->runTimeTicks().value_or(-1));
default:
return QVariant();
}
return QVariant();
}
void Playlist::onBeforePlaylistCleared() {
onBeforeItemsRemovedFromList(0, m_data->listSize());
}
void Playlist::onPlaylistCleared() {
onItemsRemovedFromList();
}
void Playlist::onBeforeItemsAddedToList(int startIndex, int count) {
int start = startIndex + m_data->queueSize();
this->beginInsertRows(QModelIndex(), start, start + count - 1);
}
void Playlist::onItemsAddedToList() {
this->endInsertRows();
}
void Playlist::onBeforeItemsAddedToQueue(int startIndex, int count) {
this->beginInsertRows(QModelIndex(), startIndex, startIndex + count - 1);
}
void Playlist::onItemsAddedToQueue() {
this->endInsertRows();
}
void Playlist::onBeforeItemsRemovedFromList(int startIndex, int count) {
int start = startIndex + m_data->queueSize();
this->beginRemoveRows(QModelIndex(), start, start + count - 1);
}
void Playlist::onItemsRemovedFromList() {
this->endInsertRows();
}
void Playlist::onBeforeItemsRemovedFromQueue(int startIndex, int count) {
this->beginRemoveRows(QModelIndex(), startIndex, startIndex + count - 1);
}
void Playlist::onItemsRemovedFromQueue() {
this->endRemoveRows();
}
void Playlist::onReshuffled() {
this->beginResetModel();
this->endResetModel();
}
void Playlist::onPlayingItemChanged() {
if (m_lastPlayedRow >= 0 ) {
this->dataChanged(index(m_lastPlayedRow), index(m_lastPlayedRow), {RoleNames::playing});
}
int newIndex = 0;
if (!m_data->playingFromQueue()) {
newIndex = m_data->queueSize() + m_data->currentItemIndexInList();
}
m_lastPlayedRow = newIndex;
emit this->dataChanged(index(newIndex), index(newIndex), {RoleNames::playing});
}
bool Playlist::isPlaying(int index) const {
return (m_data->playingFromQueue() && index == 0)
|| (m_data->currentItemIndexInList() == index - m_data->queueSize());
}
}*/
} // NS ViewModel } // NS ViewModel
} // NS Jellyfin } // NS Jellyfin

View file

@ -1,16 +1,34 @@
import QtQuick 2.6 import QtQuick 2.6
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import nl.netsoj.chris.Jellyfin 1.0 import nl.netsoj.chris.Jellyfin 1.0 as J
import "music" import "music"
SilicaListView { SilicaListView {
header: SectionHeader { text: qsTr("Play queue") } //header: PageHeader { title: qsTr("Play queue") }
section.property: "section"
section.delegate: SectionHeader {
text: {
switch(section) {
case J.NowPlayingSection.Queue:
//: Now playing page queue section header
return qsTr("Queue")
case J.NowPlayingSection.NowPlaying:
//: Now playing page playlist section header
return qsTr("Playlist")
default:
return qsTr("Unknown section")
}
}
}
delegate: SongDelegate { delegate: SongDelegate {
artists: model.artists artists: model.artists
name: model.name name: model.name
width: parent.width width: parent.width
indexNumber: ListView.index indexNumber: index + 1
duration: model.runTimeTicks
playing: model.playing
} }
clip: true
} }

View file

@ -27,6 +27,7 @@ ListItem {
property real duration property real duration
property string name property string name
property int indexNumber property int indexNumber
property bool playing
contentHeight: songName.height + songArtists.height + 2 * Theme.paddingMedium contentHeight: songName.height + songArtists.height + 2 * Theme.paddingMedium
width: parent.width width: parent.width
@ -49,6 +50,7 @@ ListItem {
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
font.pixelSize: Theme.fontSizeExtraLarge font.pixelSize: Theme.fontSizeExtraLarge
width: indexMetrics.width width: indexMetrics.width
highlighted: playing
} }
Label { Label {
@ -64,6 +66,7 @@ ListItem {
text: name text: name
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
truncationMode: TruncationMode.Fade truncationMode: TruncationMode.Fade
highlighted: down || playing
} }
Label { Label {
id: songArtists id: songArtists
@ -78,6 +81,7 @@ ListItem {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
truncationMode: TruncationMode.Fade truncationMode: TruncationMode.Fade
color: highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor color: highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
highlighted: down || playing
} }
Label { Label {
@ -91,5 +95,6 @@ ListItem {
text: Utils.ticksToText(songDelegateRoot.duration) text: Utils.ticksToText(songDelegateRoot.duration)
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor color: highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
highlighted: down || playing
} }
} }

View file

@ -50,7 +50,7 @@ ApplicationWindow {
ApiClient { ApiClient {
id: _apiClient id: _apiClient
objectName: "Test" objectName: "Test"
supportedCommands: [J.GeneralCommandType.Play, J.GeneralCommandType.DisplayContent, J.GeneralCommandType.DisplayMessage] supportedCommands: [GeneralCommandType.Play, GeneralCommandType.DisplayContent, GeneralCommandType.DisplayMessage]
} }
initialPage: Component { initialPage: Component {