15#ifndef QGSNEWSFEEDPARSER_H
16#define QGSNEWSFEEDPARSER_H
28using namespace Qt::StringLiterals;
128 void setEnabled(
bool enabled )
SIP_SKIP;
140 QList< QgsNewsFeedParser::Entry > entries()
const;
149 Q_INVOKABLE
void dismissEntry(
int key );
155 Q_INVOKABLE
void dismissAll();
160 QString authcfg()
const;
165 static QString keyForFeed(
const QString &baseUrl );
230 void onFetch(
const QString &content );
236 qint64 mFetchStartTime = 0;
239 QList< Entry > mEntries;
240 bool mBlockSignals =
false;
242 bool mEnabled =
true;
243 bool mIsFetching =
false;
245 void readStoredEntries();
246 Entry readEntryFromSettings(
int key );
247 void storeEntryInSettings(
const Entry &entry );
248 void fetchImageForEntry(
const Entry &entry );
HTTP network content fetcher.
Represents a single entry from a news feed.
QString content
HTML content of news entry.
QDateTime published
Entry publication date.
bool sticky
true if entry is "sticky" and should always be shown at the top
QUrl link
Optional URL link for entry.
QString imageUrl
Optional URL for image associated with entry.
QPixmap image
Optional image data.
QDateTime expiry
Optional auto-expiry time for entry.
int key
Unique entry identifier.
QString title
Entry title.
void entryDismissed(const QgsNewsFeedParser::Entry &entry)
Emitted whenever an entry is dismissed (as a result of a call to dismissEntry()).
static QgsSettingsTreeNamedListNode * sTreeNewsFeedEntries
void enabledChanged()
Emitted when the enabled/disabled state of the feed URL associated to the news parser changes.
static QgsSettingsTreeNamedListNode * sTreeNewsFeed
static const QgsSettingsEntryString * settingsFeedEntryTitle
static const QgsSettingsEntryBool * settingsFeedDisabled
static const QgsSettingsEntryString * settingsFeedEntryLink
static const QgsSettingsEntryVariant * settingsFeedEntryPublished
void fetched(const QList< QgsNewsFeedParser::Entry > &entries)
Emitted when entries have been fetched from the feed.
void isFetchingChanged()
Emitted when the news parser's fetching state changes.
friend class TestQgsNewsFeedParser
static const QgsSettingsEntryString * settingsFeedEntryImageUrl
static const QgsSettingsEntryDouble * settingsFeedLatitude
QString authcfg() const
Returns the authentication configuration for the parser.
static const QgsSettingsEntryInteger64 * settingsFeedLastFetchTime
QgsNewsFeedParser(const QUrl &feedUrl, const QString &authcfg=QString(), QObject *parent=nullptr)
Constructor for QgsNewsFeedParser, parsing the specified feedUrl.
static const QgsSettingsEntryBool * settingsFeedEntrySticky
static const QgsSettingsEntryDouble * settingsFeedLongitude
static const QgsSettingsEntryString * settingsFeedLanguage
bool enabled() const
Returns true if the feed URL associated with the news parser is enabled.
static const QgsSettingsEntryString * settingsFeedEntryContent
void entryUpdated(const QgsNewsFeedParser::Entry &entry)
Emitted whenever an existing entry is available from the feed (as a result of a call to fetch()).
static const QgsSettingsEntryVariant * settingsFeedEntryExpiry
void entryAdded(const QgsNewsFeedParser::Entry &entry)
Emitted whenever a new entry is available from the feed (as a result of a call to fetch()).
bool isFetching() const
Returns true if the news parser is fetching items.
void imageFetched(int key, const QPixmap &pixmap)
Emitted when the image attached to the entry with the specified key has been fetched and is now avail...
QList< QgsNewsFeedParser::Entry > entries() const
Returns a list of existing entries in the feed.
void setEnabled(bool enabled)
Sets whether the feed URL associated with the news parser is enabled.
A boolean settings entry.
A 64 bits integer (long long) settings entry.
A variant settings entry.
A named list tree node for the settings tree to help organizing and introspecting the tree.
static QgsSettingsTreeNode * sTreeApp