Apply 50 suggestion(s) to 19 file(s)
This commit is contained in:
parent
5a9aa35748
commit
4aa2f14eb7
@ -19,7 +19,6 @@
|
||||
|
||||
DataManager::DataManager()
|
||||
{
|
||||
// connect signals to lambda slots
|
||||
connect(&Fetcher::instance(), &Fetcher::feedDetailsUpdated, this, [this](const QString &url, const QString &name, const QString &image, const QString &link, const QString &description, const QDateTime &lastUpdated) {
|
||||
//qDebug() << "Start updating feed details" << m_feeds;
|
||||
Feed* feed = getFeed(url);
|
||||
@ -72,7 +71,6 @@ DataManager::DataManager()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Q_EMIT feedEntriesUpdated(feedurl);
|
||||
@ -121,7 +119,6 @@ Feed* DataManager::getFeed(QString const feedurl) const
|
||||
return m_feeds[feedurl];
|
||||
}
|
||||
|
||||
|
||||
Entry* DataManager::getEntry(int const feed_index, int const entry_index) const
|
||||
{
|
||||
return getEntry(m_entrymap[m_feedmap[feed_index]][entry_index]);
|
||||
@ -143,7 +140,6 @@ Entry* DataManager::getEntry(const EpisodeModel::Type type, const int entry_inde
|
||||
{
|
||||
QSqlQuery entryQuery;
|
||||
if (type == EpisodeModel::All || type == EpisodeModel::New || type == EpisodeModel::Unread || type == EpisodeModel::Downloaded) {
|
||||
|
||||
if (type == EpisodeModel::New) {
|
||||
entryQuery.prepare(QStringLiteral("SELECT id FROM Entries WHERE new=:new ORDER BY updated DESC LIMIT 1 OFFSET :index;"));
|
||||
entryQuery.bindValue(QStringLiteral(":new"), true);
|
||||
@ -164,7 +160,6 @@ Entry* DataManager::getEntry(const EpisodeModel::Type type, const int entry_inde
|
||||
}
|
||||
QString id = entryQuery.value(QStringLiteral("id")).toString();
|
||||
return getEntry(id);
|
||||
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -473,7 +468,6 @@ void DataManager::setLastPlayingEntry(const QString& id)
|
||||
query.bindValue(QStringLiteral(":playing"), true);
|
||||
query.bindValue(QStringLiteral(":id"), id);
|
||||
Database::instance().execute(query);
|
||||
|
||||
}
|
||||
|
||||
void DataManager::importFeeds(const QString &path)
|
||||
@ -519,7 +513,6 @@ void DataManager::exportFeeds(const QString &path)
|
||||
xmlWriter.writeEndElement();
|
||||
xmlWriter.writeEndElement();
|
||||
xmlWriter.writeEndDocument();
|
||||
|
||||
}
|
||||
|
||||
void DataManager::loadFeed(const QString feedurl) const
|
||||
@ -537,7 +530,7 @@ void DataManager::loadEntry(const QString id) const
|
||||
if (i.value().contains(id))
|
||||
feed = getFeed(i.key());
|
||||
}
|
||||
if (feed == nullptr) {
|
||||
if (!feed) {
|
||||
qDebug() << "Failed to find feed belonging to entry" << id;
|
||||
return;
|
||||
}
|
||||
|
@ -189,15 +189,18 @@ Enclosure::Status Enclosure::status() const
|
||||
return m_status;
|
||||
}
|
||||
|
||||
qint64 Enclosure::playPosition() const{
|
||||
qint64 Enclosure::playPosition() const
|
||||
{
|
||||
return m_playposition;
|
||||
}
|
||||
|
||||
qint64 Enclosure::duration() const {
|
||||
qint64 Enclosure::duration() const
|
||||
{
|
||||
return m_duration;
|
||||
}
|
||||
|
||||
int Enclosure::size() const {
|
||||
int Enclosure::size() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
|
@ -53,5 +53,3 @@ bool EnclosureDownloadJob::doKill()
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
int rowCount(const QModelIndex &parent) const override;
|
||||
|
||||
Feed* feed() const;
|
||||
Feed *feed() const;
|
||||
|
||||
private:
|
||||
Feed *m_feed;
|
||||
|
@ -38,7 +38,8 @@ public:
|
||||
QString string;
|
||||
QDateTime date;
|
||||
|
||||
QString title () {
|
||||
QString title() const
|
||||
{
|
||||
QString title;
|
||||
if (!id.isEmpty()) {
|
||||
if (DataManager::instance().getEntry(id))
|
||||
|
@ -45,7 +45,7 @@ Feed::Feed(QString const feedurl)
|
||||
connect(&Fetcher::instance(), &Fetcher::startedFetchingFeed, this, [this](const QString &url) {
|
||||
if (url == m_url) {
|
||||
m_errorId = 0;
|
||||
m_errorString = QLatin1String("");
|
||||
m_errorString = QString();
|
||||
setRefreshing(true);
|
||||
}
|
||||
});
|
||||
|
@ -69,10 +69,9 @@ void Fetcher::fetchAll()
|
||||
urls += query.value(0).toString();;
|
||||
}
|
||||
|
||||
if (urls.count() > 0)
|
||||
if (urls.count() > 0) {
|
||||
fetch(urls);
|
||||
else
|
||||
return; // no feeds in database
|
||||
}
|
||||
}
|
||||
|
||||
void Fetcher::retrieveFeed(const QString &url)
|
||||
@ -88,7 +87,7 @@ void Fetcher::retrieveFeed(const QString &url)
|
||||
if(reply->error()) {
|
||||
qWarning() << "Error fetching feed";
|
||||
qWarning() << reply->errorString();
|
||||
Q_EMIT error(url, QStringLiteral(""), reply->error(), reply->errorString());
|
||||
Q_EMIT error(url, QString(), reply->error(), reply->errorString());
|
||||
} else {
|
||||
QByteArray data = reply->readAll();
|
||||
Syndication::DocumentSource *document = new Syndication::DocumentSource(data, url);
|
||||
@ -160,7 +159,7 @@ void Fetcher::processFeed(Syndication::FeedPtr feed, const QString &url)
|
||||
// First try the "itunes:owner" tag, if that doesn't succeed, then try the "itunes:author" tag
|
||||
if (otherItems.value(QStringLiteral("http://www.itunes.com/dtds/podcast-1.0.dtdowner")).hasChildNodes()) {
|
||||
QDomNodeList nodelist = otherItems.value(QStringLiteral("http://www.itunes.com/dtds/podcast-1.0.dtdowner")).childNodes();
|
||||
for (int i=0; i < nodelist.length(); i++) {
|
||||
for (int i = 0; i < nodelist.length(); i++) {
|
||||
if (nodelist.item(i).nodeName() == QStringLiteral("itunes:name")) {
|
||||
authorname = nodelist.item(i).toElement().text();
|
||||
} else if (nodelist.item(i).nodeName() == QStringLiteral("itunes:email")) {
|
||||
@ -171,7 +170,9 @@ void Fetcher::processFeed(Syndication::FeedPtr feed, const QString &url)
|
||||
authorname = otherItems.value(QStringLiteral("http://www.itunes.com/dtds/podcast-1.0.dtdauthor")).text();
|
||||
//qDebug() << "authorname" << authorname;
|
||||
}
|
||||
if (!authorname.isEmpty()) processAuthor(url, QLatin1String(""), authorname, QLatin1String(""), authoremail);
|
||||
if (!authorname.isEmpty()) {
|
||||
processAuthor(url, QLatin1String(""), authorname, QLatin1String(""), authoremail);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -244,8 +245,8 @@ bool Fetcher::processEntry(Syndication::ItemPtr entry, const QString &url, const
|
||||
query.bindValue(QStringLiteral(":updated"), static_cast<int>(entry->dateUpdated()));
|
||||
query.bindValue(QStringLiteral(":link"), entry->link());
|
||||
query.bindValue(QStringLiteral(":hasEnclosure"), entry->enclosures().length() == 0 ? 0 : 1);
|
||||
query.bindValue(QStringLiteral(":read"), isNewFeed); // if new feed, then mark all as read
|
||||
query.bindValue(QStringLiteral(":new"), !isNewFeed); // if new feed, then mark none as new
|
||||
query.bindValue(QStringLiteral(":read"), isNewFeed); // if new feed, then mark all as read
|
||||
query.bindValue(QStringLiteral(":new"), !isNewFeed); // if new feed, then mark none as new
|
||||
|
||||
if (!entry->content().isEmpty())
|
||||
query.bindValue(QStringLiteral(":content"), entry->content());
|
||||
|
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(i18n("RSS/Atom Feed Reader"));
|
||||
|
||||
KAboutData about(QStringLiteral("alligator"), i18n("Alligator"), QStringLiteral(ALLIGATOR_VERSION_STRING), i18n("Feed Reader"), KAboutLicense::GPL, i18n("© 2021 KDE Community"));
|
||||
KAboutData about(QStringLiteral("alligator"), i18n("Alligator"), QStringLiteral(ALLIGATOR_VERSION_STRING), i18n("Feed Reader"), KAboutLicense::GPL, i18n("© 2020-2021 KDE Community"));
|
||||
about.addAuthor(i18n("Tobias Fella"), QString(), QStringLiteral("fella@posteo.de"));
|
||||
about.addAuthor(i18n("Bart De Vries"), QString(), QStringLiteral("bart@mogwai.be"));
|
||||
KAboutData::setApplicationData(about);
|
||||
|
@ -14,9 +14,7 @@ import org.kde.kirigami 2.15 as Kirigami
|
||||
|
||||
import org.kde.alligator 1.0
|
||||
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
//anchors.fill: parent
|
||||
|
||||
property var episodeType: EpisodeModel.All
|
||||
|
||||
@ -48,6 +46,7 @@ Kirigami.ScrollablePage {
|
||||
: episodeType === EpisodeModel.Downloading ? i18n("No downloads in progress")
|
||||
: i18n("No episodes available"))
|
||||
}
|
||||
|
||||
Component {
|
||||
id: episodeListDelegate
|
||||
GenericEntryDelegate {
|
||||
|
@ -13,7 +13,6 @@ import org.kde.kirigami 2.15 as Kirigami
|
||||
|
||||
import org.kde.alligator 1.0
|
||||
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
|
||||
padding: 0
|
||||
|
@ -18,7 +18,6 @@ Kirigami.ScrollablePage {
|
||||
|
||||
property QtObject feed;
|
||||
|
||||
|
||||
title: i18nc("<Feed Name> - Details", "%1 - Details", feed.name)
|
||||
|
||||
header: GenericHeader {
|
||||
|
@ -138,11 +138,10 @@ Controls.ItemDelegate {
|
||||
Kirigami.BasicListItem {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
|
||||
iconSize: Kirigami.Units.gridUnit
|
||||
leftPadding: Kirigami.Units.smallSpacing
|
||||
rightPadding: 0
|
||||
onClicked: {
|
||||
if(pageStack.depth > 1 && feed.url === lastFeed)
|
||||
if(feed.url === lastFeed)
|
||||
while(pageStack.depth > 1)
|
||||
pageStack.pop()
|
||||
DataManager.removeFeed(feed)
|
||||
|
@ -88,7 +88,6 @@ Kirigami.ScrollablePage {
|
||||
fileMode: FileDialog.SaveFile
|
||||
}
|
||||
|
||||
|
||||
mainItem: GridView {
|
||||
id: feedList
|
||||
visible: count !== 0
|
||||
@ -105,7 +104,6 @@ Kirigami.ScrollablePage {
|
||||
id: feedsModel
|
||||
}
|
||||
|
||||
|
||||
Component {
|
||||
id: feedListDelegate
|
||||
FeedListDelegate {
|
||||
|
@ -71,7 +71,7 @@ Flickable {
|
||||
function resetToBoundsOnResize() {
|
||||
if (contentY > contentHeight / 4) {
|
||||
contentY = contentHeight / 2;
|
||||
} else {
|
||||
} else {
|
||||
contentY = 0;
|
||||
}
|
||||
}
|
||||
@ -94,7 +94,6 @@ Flickable {
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
|
@ -59,14 +59,14 @@ Kirigami.SwipeListItem {
|
||||
font.capitalization: Font.AllUppercase
|
||||
color: Kirigami.Theme.highlightColor
|
||||
visible: entry.new
|
||||
opacity: (entry.read) ? 0.4 : 0.7
|
||||
opacity: entry.read ? 0.4 : 0.7
|
||||
}
|
||||
Kirigami.Icon {
|
||||
Layout.maximumHeight: 0.8 * supertitle.implicitHeight
|
||||
Layout.maximumWidth: 0.8 * supertitle.implicitHeight
|
||||
source: "source-playlist"
|
||||
visible: !isQueue && entry.queueStatus
|
||||
opacity: (entry.read) ? 0.4 : 0.7
|
||||
opacity: entry.read ? 0.4 : 0.7
|
||||
}
|
||||
Controls.Label {
|
||||
id: supertitle
|
||||
@ -74,7 +74,7 @@ Kirigami.SwipeListItem {
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
font: Kirigami.Theme.smallFont
|
||||
opacity: (entry.read) ? 0.4 : 0.7
|
||||
opacity: entry.read ? 0.4 : 0.7
|
||||
}
|
||||
}
|
||||
Controls.Label {
|
||||
@ -82,10 +82,10 @@ Kirigami.SwipeListItem {
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
font.weight: Font.Normal
|
||||
opacity: (entry.read) ? 0.6 : 1
|
||||
opacity: entry.read ? 0.6 : 1
|
||||
}
|
||||
Loader {
|
||||
sourceComponent: entry.enclosure && entry.enclosure.status === Enclosure.Downloading ? downloadProgress : ( entry.enclosure && entry.enclosure.playPosition > 0 ?playProgress : subtitle)
|
||||
sourceComponent: entry.enclosure && entry.enclosure.status === Enclosure.Downloading ? downloadProgress : ( entry.enclosure && entry.enclosure.playPosition > 0 ? playProgress : subtitle)
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Component {
|
||||
|
@ -20,7 +20,7 @@ Item {
|
||||
property int buttonsize: Kirigami.Units.gridUnit * 2
|
||||
height: miniplayerheight + progressbarheight
|
||||
|
||||
visible: (audio.entry)
|
||||
visible: audio.entry
|
||||
|
||||
// Set background
|
||||
Rectangle {
|
||||
@ -53,7 +53,7 @@ Item {
|
||||
|
||||
Image {
|
||||
asynchronous: true
|
||||
source: audio.entry.image === "" ? "logo.png" : "file://"+Fetcher.image(audio.entry.image)
|
||||
source: audio.entry.image === "" ? "logo.png" : "file://" + Fetcher.image(audio.entry.image)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
Layout.fillHeight: true
|
||||
Layout.maximumWidth: height
|
||||
@ -115,4 +115,3 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,12 +50,12 @@ Kirigami.Page {
|
||||
Image {
|
||||
id: coverImage
|
||||
asynchronous: true
|
||||
source: audio.entry ? (audio.entry.image === "" ? "logo.png" : "file://"+Fetcher.image(audio.entry.image)) : ""
|
||||
source: audio.entry ? (audio.entry.image === "" ? "logo.png" : "file://" + Fetcher.image(audio.entry.image)) : ""
|
||||
fillMode: Image.PreserveAspectFit
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Math.max(0, parent.height - (height + imageLabels.height + 2*parent.textMargin))/2
|
||||
height: Math.min( Math.min(parent.height, Kirigami.Units.iconSizes.enormous * 3)-(imageLabels.height+2*parent.textMargin),
|
||||
height: Math.min(Math.min(parent.height, Kirigami.Units.iconSizes.enormous * 3) - (imageLabels.height + 2 * parent.textMargin),
|
||||
Math.min(parent.width, Kirigami.Units.iconSizes.enormous * 3))
|
||||
width: height
|
||||
layer.enabled: true
|
||||
@ -67,7 +67,7 @@ Kirigami.Page {
|
||||
anchors.centerIn: parent
|
||||
width: coverImage.adapt ? coverImage.width : Math.min(coverImage.width, coverImage.height)
|
||||
height: coverImage.adapt ? coverImage.height : width
|
||||
radius: Math.min(width, height)/20
|
||||
radius: Math.min(width, height) / 20
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -128,7 +128,7 @@ Kirigami.Page {
|
||||
Controls.PageIndicator {
|
||||
id: indicator
|
||||
|
||||
count:swipeView.count
|
||||
count: swipeView.count
|
||||
currentIndex: swipeView.currentIndex
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
spacing: Kirigami.Units.largeSpacing
|
||||
|
||||
Controls.BusyIndicator{
|
||||
Controls.BusyIndicator {
|
||||
id: indicator
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ Kirigami.ApplicationWindow {
|
||||
globalDrawer: Kirigami.GlobalDrawer {
|
||||
isMenu: false
|
||||
// make room at the bottom for miniplayer
|
||||
handle.anchors.bottomMargin: ( audio.entry ? ( footerLoader.item.contentY == 0 ? miniplayerSize : 0 ) : 0 ) + Kirigami.Units.smallSpacing + tabBarActive * tabBarHeight
|
||||
handleVisible: !audio.entry || footerLoader.item.contentY == 0
|
||||
handle.anchors.bottomMargin: (audio.entry ? (footerLoader.item.contentY == 0 ? miniplayerSize : 0) : 0) + Kirigami.Units.smallSpacing + tabBarActive * tabBarHeight
|
||||
handleVisible: !audio.entry || footerLoader.item.contentY === 0
|
||||
actions: [
|
||||
Kirigami.PagePoolAction {
|
||||
text: i18n("Queue")
|
||||
@ -101,7 +101,6 @@ Kirigami.ApplicationWindow {
|
||||
id: aboutPage
|
||||
|
||||
Kirigami.AboutPage {
|
||||
title: i18n("About")
|
||||
aboutData: _aboutData
|
||||
}
|
||||
}
|
||||
@ -137,9 +136,9 @@ Kirigami.ApplicationWindow {
|
||||
id: footerLoader
|
||||
|
||||
anchors.fill: parent
|
||||
active: (audio.entry) ? true : false
|
||||
active: audio.entry
|
||||
visible: active
|
||||
z: (!item || item.contentY == 0) ? -1 : 999
|
||||
z: (!item || item.contentY === 0) ? -1 : 999
|
||||
sourceComponent: FooterBar {
|
||||
contentHeight: root.height * 2
|
||||
focus: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user