Update based on review by Tobias Fella

This commit is contained in:
Bart De Vries 2021-05-01 21:00:12 +02:00
parent 4aa2f14eb7
commit d1618943f5
22 changed files with 67 additions and 81 deletions

View File

@ -336,11 +336,11 @@ bool AudioManager::canGoNext() const
{ {
// TODO: extend with streaming capability // TODO: extend with streaming capability
if (d->m_entry) { if (d->m_entry) {
int index = DataManager::instance().getQueue().indexOf(d->m_entry->id()); int index = DataManager::instance().queue().indexOf(d->m_entry->id());
if (index >= 0) { if (index >= 0) {
// check if there is a next track // check if there is a next track
if (index < DataManager::instance().getQueue().count()-1) { if (index < DataManager::instance().queue().count()-1) {
Entry* next_entry = DataManager::instance().getEntry(DataManager::instance().getQueue()[index+1]); Entry* next_entry = DataManager::instance().getEntry(DataManager::instance().queue()[index+1]);
if (next_entry->enclosure()) { if (next_entry->enclosure()) {
//qDebug() << "Enclosure status" << next_entry->enclosure()->path() << next_entry->enclosure()->status(); //qDebug() << "Enclosure status" << next_entry->enclosure()->path() << next_entry->enclosure()->status();
if (next_entry->enclosure()->status() == Enclosure::Downloaded) { if (next_entry->enclosure()->status() == Enclosure::Downloaded) {
@ -357,9 +357,9 @@ void AudioManager::next()
{ {
if (canGoNext()) { if (canGoNext()) {
QMediaPlayer::State previousTrackState = playbackState(); QMediaPlayer::State previousTrackState = playbackState();
int index = DataManager::instance().getQueue().indexOf(d->m_entry->id()); int index = DataManager::instance().queue().indexOf(d->m_entry->id());
//qDebug() << "Skipping to" << DataManager::instance().getQueue()[index+1]; //qDebug() << "Skipping to" << DataManager::instance().queue()[index+1];
setEntry(DataManager::instance().getEntry(DataManager::instance().getQueue()[index+1])); setEntry(DataManager::instance().getEntry(DataManager::instance().queue()[index+1]));
if (previousTrackState == QMediaPlayer::PlayingState) play(); if (previousTrackState == QMediaPlayer::PlayingState) play();
} else { } else {
//qDebug() << "Next track cannot be played, changing entry to nullptr"; //qDebug() << "Next track cannot be played, changing entry to nullptr";

View File

@ -37,15 +37,6 @@ class AudioManager : public QObject
WRITE setVolume WRITE setVolume
NOTIFY volumeChanged) NOTIFY volumeChanged)
/*
// The source should not be set directly, but rather through entry
// Hence this property is disabled so it cannot be used accidentally in qml
Q_PROPERTY(QUrl source
READ source
WRITE setSource
NOTIFY sourceChanged)
*/
Q_PROPERTY(QMediaPlayer::MediaStatus status Q_PROPERTY(QMediaPlayer::MediaStatus status
READ status READ status
NOTIFY statusChanged) NOTIFY statusChanged)

View File

@ -52,7 +52,7 @@ bool Database::migrateTo1()
TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Authors (feed TEXT, id TEXT, name TEXT, uri TEXT, email TEXT);"))); TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Authors (feed TEXT, id TEXT, name TEXT, uri TEXT, email TEXT);")));
TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Enclosures (feed TEXT, id TEXT, duration INTEGER, size INTEGER, title TEXT, type TEXT, url TEXT, playposition INTEGER, downloaded BOOL);"))); //, filename TEXT);"))); TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Enclosures (feed TEXT, id TEXT, duration INTEGER, size INTEGER, title TEXT, type TEXT, url TEXT, playposition INTEGER, downloaded BOOL);"))); //, filename TEXT);")));
TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Queue (listnr INTEGER, feed TEXT, id TEXT, playing BOOL);"))); TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Queue (listnr INTEGER, feed TEXT, id TEXT, playing BOOL);")));
TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Errors (url TEXT, id TEXT, code INTEGER, string TEXT, date INTEGER);"))); TRUE_OR_RETURN(execute(QStringLiteral("CREATE TABLE IF NOT EXISTS Errors (url TEXT, id TEXT, code INTEGER, message TEXT, date INTEGER);")));
TRUE_OR_RETURN(execute(QStringLiteral("PRAGMA user_version = 1;"))); TRUE_OR_RETURN(execute(QStringLiteral("PRAGMA user_version = 1;")));
return true; return true;
} }

View File

@ -62,7 +62,7 @@ DataManager::DataManager()
query.bindValue(QStringLiteral(":new"), true); query.bindValue(QStringLiteral(":new"), true);
Database::instance().execute(query); Database::instance().execute(query);
while (query.next()) { while (query.next()) {
QString const id = query.value(QStringLiteral("id")).toString(); QString id = query.value(QStringLiteral("id")).toString();
addToQueue(feedurl, id); addToQueue(feedurl, id);
if (SettingsManager::self()->autoDownload()) { if (SettingsManager::self()->autoDownload()) {
if (getEntry(id)->hasEnclosure()) { if (getEntry(id)->hasEnclosure()) {
@ -107,29 +107,29 @@ DataManager::DataManager()
//qDebug() << m_queuemap; //qDebug() << m_queuemap;
} }
Feed* DataManager::getFeed(int const index) const Feed* DataManager::getFeed(const int index) const
{ {
return getFeed(m_feedmap[index]); return getFeed(m_feedmap[index]);
} }
Feed* DataManager::getFeed(QString const feedurl) const Feed* DataManager::getFeed(const QString &feedurl) const
{ {
if (m_feeds[feedurl] == nullptr) if (m_feeds[feedurl] == nullptr)
loadFeed(feedurl); loadFeed(feedurl);
return m_feeds[feedurl]; return m_feeds[feedurl];
} }
Entry* DataManager::getEntry(int const feed_index, int const entry_index) const Entry* DataManager::getEntry(const int feed_index, const int entry_index) const
{ {
return getEntry(m_entrymap[m_feedmap[feed_index]][entry_index]); return getEntry(m_entrymap[m_feedmap[feed_index]][entry_index]);
} }
Entry* DataManager::getEntry(const Feed* feed, int const entry_index) const Entry* DataManager::getEntry(const Feed* feed, const int entry_index) const
{ {
return getEntry(m_entrymap[feed->url()][entry_index]); return getEntry(m_entrymap[feed->url()][entry_index]);
} }
Entry* DataManager::getEntry(QString id) const Entry* DataManager::getEntry(const QString &id) const
{ {
if (m_entries[id] == nullptr) if (m_entries[id] == nullptr)
loadEntry(id); loadEntry(id);
@ -232,7 +232,7 @@ void DataManager::removeFeed(Feed* feed)
removeFeed(m_feedmap.indexOf(feed->url())); removeFeed(m_feedmap.indexOf(feed->url()));
} }
void DataManager::removeFeed(const int &index) void DataManager::removeFeed(const int index)
{ {
// Get feed pointer // Get feed pointer
Feed* feed = getFeed(m_feedmap[index]); Feed* feed = getFeed(m_feedmap[index]);
@ -342,7 +342,7 @@ void DataManager::addFeeds(const QStringList &urls)
Fetcher::instance().fetch(urls); Fetcher::instance().fetch(urls);
} }
Entry* DataManager::getQueueEntry(int const &index) const Entry* DataManager::getQueueEntry(int index) const
{ {
return getEntry(m_queuemap[index]); return getEntry(m_queuemap[index]);
} }
@ -352,7 +352,7 @@ int DataManager::queueCount() const
return m_queuemap.count(); return m_queuemap.count();
} }
QStringList DataManager::getQueue() const QStringList DataManager::queue() const
{ {
return m_queuemap; return m_queuemap;
} }
@ -400,7 +400,7 @@ void DataManager::addToQueue(const QString &feedurl, const QString &id)
Q_EMIT queueEntryAdded(index, id); Q_EMIT queueEntryAdded(index, id);
} }
void DataManager::moveQueueItem(const int &from, const int &to) void DataManager::moveQueueItem(const int from, const int to)
{ {
// First move the items in the internal data structure // First move the items in the internal data structure
m_queuemap.move(from, to); m_queuemap.move(from, to);
@ -412,7 +412,7 @@ void DataManager::moveQueueItem(const int &from, const int &to)
Q_EMIT queueEntryMoved(from, to); Q_EMIT queueEntryMoved(from, to);
} }
void DataManager::removeQueueItem(const int &index) void DataManager::removeQueueItem(const int index)
{ {
//qDebug() << m_queuemap; //qDebug() << m_queuemap;
// Unset "new" state // Unset "new" state

View File

@ -21,12 +21,12 @@ public:
return _instance; return _instance;
} }
Feed* getFeed(int const index) const; Feed* getFeed(const int index) const;
Feed* getFeed(QString const feedurl) const; Feed* getFeed(const QString &feedurl) const;
Entry* getEntry(int const feed_index, int const entry_index) const; Entry* getEntry(const int feed_index, const int entry_index) const;
Entry* getEntry(const Feed* feed, int const entry_index) const; Entry* getEntry(const Feed* feed, const int entry_index) const;
Entry* getEntry(const EpisodeModel::Type type, const int entry_index) const; Entry* getEntry(const EpisodeModel::Type type, const int entry_index) const;
Q_INVOKABLE Entry* getEntry(const QString id) const; Q_INVOKABLE Entry* getEntry(const QString &id) const;
int feedCount() const; int feedCount() const;
int entryCount(const int feed_index) const; int entryCount(const int feed_index) const;
int entryCount(const Feed* feed) const; int entryCount(const Feed* feed) const;
@ -37,21 +37,21 @@ public:
void addFeed(const QString &url, const bool fetch); void addFeed(const QString &url, const bool fetch);
void addFeeds(const QStringList &urls); void addFeeds(const QStringList &urls);
Q_INVOKABLE void removeFeed(Feed* feed); Q_INVOKABLE void removeFeed(Feed* feed);
void removeFeed(const int &index); void removeFeed(const int index);
//Q_INVOKABLE void addEntry(const QString &url); // TODO: implement these methods //Q_INVOKABLE void addEntry(const QString &url); // TODO: implement these methods
//Q_INVOKABLE void removeEntry(const QString &url); //Q_INVOKABLE void removeEntry(const QString &url);
//Q_INVOKABLE void removeEntry(const Feed* feed, const int &index); //Q_INVOKABLE void removeEntry(const Feed* feed, const int &index);
Entry* getQueueEntry(int const &index) const; Entry* getQueueEntry(int index) const;
int queueCount() const; int queueCount() const;
QStringList getQueue() const; QStringList queue() const;
Q_INVOKABLE bool entryInQueue(const Entry* entry); Q_INVOKABLE bool entryInQueue(const Entry* entry);
Q_INVOKABLE bool entryInQueue(const QString &feedurl, const QString &id) const; Q_INVOKABLE bool entryInQueue(const QString &feedurl, const QString &id) const;
Q_INVOKABLE void addToQueue(const Entry* entry); Q_INVOKABLE void addToQueue(const Entry* entry);
Q_INVOKABLE void addToQueue(const QString &feedurl, const QString &id); Q_INVOKABLE void addToQueue(const QString &feedurl, const QString &id);
Q_INVOKABLE void moveQueueItem(const int &from, const int &to); Q_INVOKABLE void moveQueueItem(const int from, const int to);
Q_INVOKABLE void removeQueueItem(const int &index); Q_INVOKABLE void removeQueueItem(const int index);
Q_INVOKABLE void removeQueueItem(const QString id); Q_INVOKABLE void removeQueueItem(const QString id);
Q_INVOKABLE void removeQueueItem(Entry* entry); Q_INVOKABLE void removeQueueItem(Entry* entry);

View File

@ -15,7 +15,7 @@
#include "datamanager.h" #include "datamanager.h"
#include "fetcher.h" #include "fetcher.h"
Entry::Entry(Feed *feed, QString id) Entry::Entry(Feed *feed, const QString &id)
: QObject(nullptr) : QObject(nullptr)
, m_feed(feed) , m_feed(feed)
{ {
@ -127,7 +127,7 @@ QString Entry::baseUrl() const
return QUrl(m_link).adjusted(QUrl::RemovePath).toString(); return QUrl(m_link).adjusted(QUrl::RemovePath).toString();
} }
void Entry::setRead(const bool read) void Entry::setRead(bool read)
{ {
m_read = read; m_read = read;
Q_EMIT readChanged(m_read); Q_EMIT readChanged(m_read);
@ -142,7 +142,7 @@ void Entry::setRead(const bool read)
//TODO: can one of the two slots be removed?? //TODO: can one of the two slots be removed??
} }
void Entry::setNew(const bool state) void Entry::setNew(bool state)
{ {
m_new = state; m_new = state;
Q_EMIT newChanged(m_new); Q_EMIT newChanged(m_new);
@ -213,15 +213,16 @@ QString Entry::cachedImage() const
{ {
// First check for the feed image as fallback // First check for the feed image as fallback
QString image = m_image; QString image = m_image;
if (image.isEmpty()) if (image.isEmpty()) {
image = m_feed->image(); image = m_feed->image();
}
if (image.isEmpty()) { // this will only happen if the feed also doesn't have an image if (image.isEmpty()) { // this will only happen if the feed also doesn't have an image
return QStringLiteral("no-image"); return QStringLiteral("no-image");
} else { } else {
QString imagePath = Fetcher::instance().image(image); QString imagePath = Fetcher::instance().image(image);
if (imagePath.isEmpty()) { if (imagePath.isEmpty()) {
return imagePath; return QStringLiteral("fetching");
} else { } else {
return QStringLiteral("file://") + imagePath; return QStringLiteral("file://") + imagePath;
} }
@ -233,7 +234,7 @@ bool Entry::queueStatus() const
return DataManager::instance().entryInQueue(this); return DataManager::instance().entryInQueue(this);
} }
void Entry::setQueueStatus(const bool state) void Entry::setQueueStatus(bool state)
{ {
if (state != DataManager::instance().entryInQueue(this)) { if (state != DataManager::instance().entryInQueue(this)) {
if (state) if (state)

View File

@ -40,7 +40,7 @@ class Entry : public QObject
Q_PROPERTY(bool queueStatus READ queueStatus WRITE setQueueStatus NOTIFY queueStatusChanged) Q_PROPERTY(bool queueStatus READ queueStatus WRITE setQueueStatus NOTIFY queueStatusChanged)
public: public:
Entry(Feed *feed, QString id); Entry(Feed *feed, const QString &id);
~Entry(); ~Entry();
QString id() const; QString id() const;
@ -61,10 +61,10 @@ public:
QString baseUrl() const; QString baseUrl() const;
void setRead(const bool read); void setRead(bool read);
void setNew(const bool state); void setNew(bool state);
void setImage(const QString &url); void setImage(const QString &url);
void setQueueStatus(const bool status); void setQueueStatus(bool status);
Q_INVOKABLE QString adjustedContent(int width, int fontSize); Q_INVOKABLE QString adjustedContent(int width, int fontSize);

View File

@ -16,8 +16,6 @@ EpisodeModel::EpisodeModel()
// maybe even items have been removed. // maybe even items have been removed.
connect(&DataManager::instance(), &DataManager::feedEntriesUpdated, this, [this](const QString &url) { connect(&DataManager::instance(), &DataManager::feedEntriesUpdated, this, [this](const QString &url) {
Q_UNUSED(url) Q_UNUSED(url)
// we have to reset the entire model in case entries are removed or added
// because we have no way of knowing where those entries will be added/removed
beginResetModel(); beginResetModel();
endResetModel(); endResetModel();
}); });

View File

@ -18,24 +18,24 @@ class Error : public QObject
Q_PROPERTY(QString url MEMBER url CONSTANT) Q_PROPERTY(QString url MEMBER url CONSTANT)
Q_PROPERTY(QString id MEMBER id CONSTANT) Q_PROPERTY(QString id MEMBER id CONSTANT)
Q_PROPERTY(int code MEMBER code CONSTANT) Q_PROPERTY(int code MEMBER code CONSTANT)
Q_PROPERTY(QString string MEMBER string CONSTANT) Q_PROPERTY(QString message MEMBER message CONSTANT)
Q_PROPERTY(QDateTime date MEMBER date CONSTANT) Q_PROPERTY(QDateTime date MEMBER date CONSTANT)
Q_PROPERTY(QString title READ title CONSTANT) Q_PROPERTY(QString title READ title CONSTANT)
public: public:
Error(const QString url, const QString id, const int code, const QString string, const QDateTime date): QObject(nullptr) Error(const QString url, const QString id, const int code, const QString message, const QDateTime date): QObject(nullptr)
{ {
this->url = url; this->url = url;
this->id = id; this->id = id;
this->code = code; this->code = code;
this->string = string; this->message = message;
this->date = date; this->date = date;
}; };
QString url; QString url;
QString id; QString id;
int code; int code;
QString string; QString message;
QDateTime date; QDateTime date;
QString title() const QString title() const

View File

@ -25,15 +25,16 @@ ErrorLogModel::ErrorLogModel()
QString id = query.value(QStringLiteral("id")).toString(); QString id = query.value(QStringLiteral("id")).toString();
QString url = query.value(QStringLiteral("url")).toString(); QString url = query.value(QStringLiteral("url")).toString();
Error* error = new Error(url, id, query.value(QStringLiteral("code")).toInt(), query.value(QStringLiteral("string")).toString(), QDateTime::fromSecsSinceEpoch(query.value(QStringLiteral("date")).toInt())); Error* error = new Error(url, id, query.value(QStringLiteral("code")).toInt(), query.value(QStringLiteral("message")).toString(), QDateTime::fromSecsSinceEpoch(query.value(QStringLiteral("date")).toInt()));
m_errors += error; m_errors += error;
} }
} }
QVariant ErrorLogModel::data(const QModelIndex &index, int role) const QVariant ErrorLogModel::data(const QModelIndex &index, int role) const
{ {
if (role != 0) if (role != 0) {
return QVariant(); return QVariant();
}
return QVariant::fromValue(m_errors[index.row()]); return QVariant::fromValue(m_errors[index.row()]);
} }
@ -66,7 +67,7 @@ void ErrorLogModel::monitorErrorMessages(const QString &url, const QString& id,
query.bindValue(QStringLiteral(":url"), error->url); query.bindValue(QStringLiteral(":url"), error->url);
query.bindValue(QStringLiteral(":id"), error->id); query.bindValue(QStringLiteral(":id"), error->id);
query.bindValue(QStringLiteral(":code"), error->code); query.bindValue(QStringLiteral(":code"), error->code);
query.bindValue(QStringLiteral(":string"), error->string); query.bindValue(QStringLiteral(":message"), error->message);
query.bindValue(QStringLiteral(":date"), error->date.toSecsSinceEpoch()); query.bindValue(QStringLiteral(":date"), error->date.toSecsSinceEpoch());
Database::instance().execute(query); Database::instance().execute(query);
} }

View File

@ -31,7 +31,7 @@ public:
Q_INVOKABLE void clearAll(); Q_INVOKABLE void clearAll();
public Q_SLOTS: public:
void monitorErrorMessages(const QString &url, const QString &id, const int errorCode, const QString &errorString); void monitorErrorMessages(const QString &url, const QString &id, const int errorCode, const QString &errorString);
private: private:

View File

@ -13,7 +13,7 @@
#include "feed.h" #include "feed.h"
#include "fetcher.h" #include "fetcher.h"
Feed::Feed(QString const feedurl) Feed::Feed(const QString &feedurl)
: QObject(nullptr) : QObject(nullptr)
{ {
@ -153,7 +153,7 @@ QString Feed::cachedImage() const
} else { } else {
QString imagePath = Fetcher::instance().image(m_image); QString imagePath = Fetcher::instance().image(m_image);
if (imagePath.isEmpty()) { if (imagePath.isEmpty()) {
return imagePath; return QStringLiteral("fetching");
} else { } else {
return QStringLiteral("file://") + imagePath; return QStringLiteral("file://") + imagePath;
} }

View File

@ -39,7 +39,7 @@ class Feed : public QObject
Q_PROPERTY(EntriesModel *entries MEMBER m_entries CONSTANT) Q_PROPERTY(EntriesModel *entries MEMBER m_entries CONSTANT)
public: public:
Feed(QString const feedurl); Feed(const QString &feedurl);
~Feed(); ~Feed();

View File

@ -221,7 +221,7 @@ void Fetcher::processFeed(Syndication::FeedPtr feed, const QString &url)
Q_EMIT feedUpdateFinished(url); Q_EMIT feedUpdateFinished(url);
} }
bool Fetcher::processEntry(Syndication::ItemPtr entry, const QString &url, const bool &isNewFeed) bool Fetcher::processEntry(Syndication::ItemPtr entry, const QString &url, bool isNewFeed)
{ {
//qDebug() << "Processing" << entry->title(); //qDebug() << "Processing" << entry->title();

View File

@ -59,7 +59,7 @@ private:
void retrieveFeed(const QString &url); void retrieveFeed(const QString &url);
void processFeed(Syndication::FeedPtr feed, const QString &url); void processFeed(Syndication::FeedPtr feed, const QString &url);
bool processEntry(Syndication::ItemPtr entry, const QString &url, const bool &isNewFeed); // returns true if this is a new entry; false if it already existed bool processEntry(Syndication::ItemPtr entry, const QString &url, bool isNewFeed); // returns true if this is a new entry; false if it already existed
void processAuthor(const QString &url, const QString &entryId, const QString &authorName, const QString &authorUri, const QString &authorEmail); void processAuthor(const QString &url, const QString &entryId, const QString &authorName, const QString &authorUri, const QString &authorEmail);
void processEnclosure(Syndication::EnclosurePtr enclosure, Syndication::ItemPtr entry, const QString &feedUrl); void processEnclosure(Syndication::EnclosurePtr enclosure, Syndication::ItemPtr entry, const QString &feedUrl);

View File

@ -357,7 +357,7 @@ void MediaPlayer2Player::setEntry(Entry* entry)
if (m_audioPlayer) { if (m_audioPlayer) {
if (m_audioPlayer->entry()) { if (m_audioPlayer->entry()) {
if (m_audioPlayer->entry() == entry) { if (m_audioPlayer->entry() == entry) {
int queuenr = DataManager::instance().getQueue().indexOf(m_audioPlayer->entry()->id()); int queuenr = DataManager::instance().queue().indexOf(m_audioPlayer->entry()->id());
//qDebug() << "MPRIS2: Setting entry" << entry->title(); //qDebug() << "MPRIS2: Setting entry" << entry->title();
m_currentTrackId = QDBusObjectPath(QLatin1String("/org/kde/alligator/playlist/") + QString::number(queuenr)).path(); m_currentTrackId = QDBusObjectPath(QLatin1String("/org/kde/alligator/playlist/") + QString::number(queuenr)).path();

View File

@ -52,7 +52,7 @@ Kirigami.Page {
Controls.TabButton { Controls.TabButton {
width: parent.parent.width / parent.count width: parent.parent.width / parent.count
height: tabBarHeight height: tabBarHeight
text: i18n("Errors") text: i18n("Error Log")
} }
} }
} }
@ -73,7 +73,7 @@ Kirigami.Page {
} }
ErrorListPage { ErrorListPage {
title: i18n("Errors") title: i18n("Error Log")
} }
} }
} }

View File

@ -49,7 +49,6 @@ Kirigami.ScrollablePage {
iconName: "delete" iconName: "delete"
text: i18n("Remove feed") text: i18n("Remove feed")
onTriggered: { onTriggered: {
if(pageStack.depth > 1)
while(pageStack.depth > 1) while(pageStack.depth > 1)
pageStack.pop() pageStack.pop()
DataManager.removeFeed(feed) DataManager.removeFeed(feed)

View File

@ -41,7 +41,7 @@ Kirigami.ScrollablePage {
text: i18n(episodeType === EpisodeModel.All ? i18n("No episodes available") text: i18n(episodeType === EpisodeModel.All ? i18n("No episodes available")
: episodeType === EpisodeModel.New ? i18n("No new episodes") : episodeType === EpisodeModel.New ? i18n("No new episodes")
: episodeType === EpisodeModel.Unread ? i18n("No unread episodes") : episodeType === EpisodeModel.Unread ? i18n("No unplayed episodes")
: episodeType === EpisodeModel.Downloaded ? i18n("No downloaded episodes") : episodeType === EpisodeModel.Downloaded ? i18n("No downloaded episodes")
: episodeType === EpisodeModel.Downloading ? i18n("No downloads in progress") : episodeType === EpisodeModel.Downloading ? i18n("No downloads in progress")
: i18n("No episodes available")) : i18n("No episodes available"))
@ -61,8 +61,8 @@ Kirigami.ScrollablePage {
} }
ListView { ListView {
anchors.fill: parent
id: episodeList id: episodeList
anchors.fill: parent
visible: count !== 0 visible: count !== 0
model: episodeType === EpisodeModel.Downloading ? DownloadProgressModel model: episodeType === EpisodeModel.Downloading ? DownloadProgressModel
: episodeModel : episodeModel

View File

@ -33,10 +33,8 @@ Kirigami.ScrollablePage {
Kirigami.Icon { Kirigami.Icon {
source: "data-error" source: "data-error"
property int size: Kirigami.Units.iconSizes.medium property int size: Kirigami.Units.iconSizes.medium
Layout.minimumHeight: size Layout.preferredHeight: size
Layout.maximumHeight: size Layout.preferredWidth: size
Layout.minimumWidth: size
Layout.maximumWidth: size
} }
ColumnLayout { ColumnLayout {
spacing: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing
@ -57,7 +55,7 @@ Kirigami.ScrollablePage {
opacity: 1 opacity: 1
} }
Controls.Label { Controls.Label {
text: i18n("Error code: ") + error.code + " · " + error.string text: i18n("Error code: ") + error.code + " · " + error.message
Layout.fillWidth: true Layout.fillWidth: true
elide: Text.ElideRight elide: Text.ElideRight
font: Kirigami.Theme.smallFont font: Kirigami.Theme.smallFont

View File

@ -23,10 +23,9 @@ Item {
property bool isLoading: false property bool isLoading: false
Loader { Loader {
//active: !isLoading
id: imageLoader id: imageLoader
anchors.fill: parent anchors.fill: parent
sourceComponent: imageSource === "no-image" ? fallbackImg : (imageSource === "" ? loaderSymbol : realImg ) sourceComponent: imageSource === "no-image" ? fallbackImg : (imageSource === "fetching" ? loaderSymbol : realImg )
opacity: root.imageOpacity opacity: root.imageOpacity
layer.enabled: (root.absoluteRadius > 0 || root.fractionalRadius > 0) layer.enabled: (root.absoluteRadius > 0 || root.fractionalRadius > 0)
layer.effect: OpacityMask { layer.effect: OpacityMask {
@ -122,6 +121,5 @@ Item {
active: isLoading active: isLoading
sourceComponent: loaderSymbol sourceComponent: loaderSymbol
anchors.fill: parent anchors.fill: parent
//anchors.centerIn: parent
} }
} }

View File

@ -13,19 +13,19 @@
QueueModel::QueueModel(QObject *parent) QueueModel::QueueModel(QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
{ {
connect(&DataManager::instance(), &DataManager::queueEntryMoved, this, [this](const int &from, const int &to_orig) { connect(&DataManager::instance(), &DataManager::queueEntryMoved, this, [this](const int from, const int to_orig) {
int to = (from < to_orig) ? to_orig + 1 : to_orig; int to = (from < to_orig) ? to_orig + 1 : to_orig;
beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); beginMoveRows(QModelIndex(), from, from, QModelIndex(), to);
endMoveRows(); endMoveRows();
//qDebug() << "Moved entry" << from << "to" << to; //qDebug() << "Moved entry" << from << "to" << to;
}); });
connect(&DataManager::instance(), &DataManager::queueEntryAdded, this, [this](const int &pos, const QString &id) { connect(&DataManager::instance(), &DataManager::queueEntryAdded, this, [this](const int pos, const QString &id) {
Q_UNUSED(id) Q_UNUSED(id)
beginInsertRows(QModelIndex(), pos, pos); beginInsertRows(QModelIndex(), pos, pos);
endInsertRows(); endInsertRows();
//qDebug() << "Added entry at pos" << pos; //qDebug() << "Added entry at pos" << pos;
}); });
connect(&DataManager::instance(), &DataManager::queueEntryRemoved, this, [this](const int &pos, const QString &id) { connect(&DataManager::instance(), &DataManager::queueEntryRemoved, this, [this](const int pos, const QString &id) {
Q_UNUSED(id) Q_UNUSED(id)
beginRemoveRows(QModelIndex(), pos, pos); beginRemoveRows(QModelIndex(), pos, pos);
endRemoveRows(); endRemoveRows();