some files for reddit

This commit is contained in:
Martin Rotter 2021-11-16 07:18:27 +01:00
parent 453363c4b8
commit 5bb5048dd2
7 changed files with 84 additions and 2 deletions

View File

@ -26,7 +26,7 @@
<url type="donation">https://github.com/sponsors/martinrotter</url>
<content_rating type="oars-1.1" />
<releases>
<release version="4.0.4" date="2021-11-15"/>
<release version="4.0.4" date="2021-11-16"/>
</releases>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute>

View File

@ -195,9 +195,11 @@ HEADERS += core/feeddownloader.h \
services/reddit/definitions.h \
services/reddit/gui/formeditredditaccount.h \
services/reddit/gui/redditaccountdetails.h \
services/reddit/redditcategory.h \
services/reddit/redditentrypoint.h \
services/reddit/redditnetworkfactory.h \
services/reddit/redditserviceroot.h \
services/reddit/redditsubscription.h \
services/standard/atomparser.h \
services/standard/definitions.h \
services/standard/feedparser.h \
@ -376,9 +378,11 @@ SOURCES += core/feeddownloader.cpp \
services/owncloud/owncloudserviceroot.cpp \
services/reddit/gui/formeditredditaccount.cpp \
services/reddit/gui/redditaccountdetails.cpp \
services/reddit/redditcategory.cpp \
services/reddit/redditentrypoint.cpp \
services/reddit/redditnetworkfactory.cpp \
services/reddit/redditserviceroot.cpp \
services/reddit/redditsubscription.cpp \
services/standard/atomparser.cpp \
services/standard/feedparser.cpp \
services/standard/gui/formeditstandardaccount.cpp \

View File

@ -0,0 +1,20 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#include "services/reddit/redditcategory.h"
RedditCategory::RedditCategory(Type type, RootItem* parent_item)
: Category(parent_item), m_type(type) {
updateTitle();
}
RedditCategory::Type RedditCategory::type() const {
return m_type;
}
void RedditCategory::updateTitle() {
switch (m_type) {
case Type::Subscriptions:
setTitle(tr("Subscriptions"));
break;
}
}

View File

@ -0,0 +1,27 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#ifndef REDDITCATEGORY_H
#define REDDITCATEGORY_H
#include "services/abstract/category.h"
class RedditCategory : public Category {
Q_OBJECT
public:
enum class Type {
Subscriptions = 1
};
explicit RedditCategory(Type type = Type::Subscriptions, RootItem* parent_item = nullptr);
Type type() const;
private:
void updateTitle();
private:
Type m_type;
};
#endif // REDDITCATEGORY_H

View File

@ -11,6 +11,7 @@
#include "services/abstract/recyclebin.h"
#include "services/reddit/definitions.h"
#include "services/reddit/gui/formeditredditaccount.h"
#include "services/reddit/redditcategory.h"
#include "services/reddit/redditentrypoint.h"
#include "services/reddit/redditnetworkfactory.h"
@ -93,7 +94,7 @@ bool RedditServiceRoot::supportsCategoryAdding() const {
void RedditServiceRoot::start(bool freshly_activated) {
if (!freshly_activated) {
DatabaseQueries::loadFromDatabase<Category, Feed>(this);
DatabaseQueries::loadFromDatabase<RedditCategory, Feed>(this);
loadCacheFromFile();
}

View File

@ -0,0 +1,11 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#include "services/reddit/redditsubscription.h"
#include "services/reddit/redditserviceroot.h"
RedditSubscription::RedditSubscription(RootItem* parent) : Feed(parent) {}
RedditServiceRoot* RedditSubscription::serviceRoot() const {
return qobject_cast<RedditServiceRoot*>(getParentServiceRoot());
}

View File

@ -0,0 +1,19 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#ifndef REDDITSUBSCRIPTION_H
#define REDDITSUBSCRIPTION_H
#include "services/abstract/feed.h"
class RedditServiceRoot;
class RedditSubscription : public Feed {
Q_OBJECT
public:
explicit RedditSubscription(RootItem* parent = nullptr);
RedditServiceRoot* serviceRoot() const;
};
#endif // REDDITSUBSCRIPTION_H