Save, work on filters.
This commit is contained in:
parent
f304d0a910
commit
f211810af4
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "core/feeddownloader.h"
|
#include "core/feeddownloader.h"
|
||||||
|
|
||||||
|
#include "core/messagefilter.h"
|
||||||
#include "definitions/definitions.h"
|
#include "definitions/definitions.h"
|
||||||
#include "services/abstract/cacheforserviceroot.h"
|
#include "services/abstract/cacheforserviceroot.h"
|
||||||
#include "services/abstract/feed.h"
|
#include "services/abstract/feed.h"
|
||||||
@ -45,7 +46,7 @@ void FeedDownloader::updateAvailableFeeds() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedDownloader::updateFeeds(const QList<Feed*>& feeds) {
|
void FeedDownloader::updateFeeds(const QList<Feed*>& feeds, const QList<MessageFilter*>& msg_filters) {
|
||||||
QMutexLocker locker(m_mutex);
|
QMutexLocker locker(m_mutex);
|
||||||
|
|
||||||
if (feeds.isEmpty()) {
|
if (feeds.isEmpty()) {
|
||||||
|
@ -10,9 +10,7 @@
|
|||||||
#include "core/message.h"
|
#include "core/message.h"
|
||||||
|
|
||||||
class Feed;
|
class Feed;
|
||||||
|
class MessageFilter;
|
||||||
class QThreadPool;
|
|
||||||
|
|
||||||
class QMutex;
|
class QMutex;
|
||||||
|
|
||||||
// Represents results of batch feed updates.
|
// Represents results of batch feed updates.
|
||||||
@ -43,7 +41,7 @@ class FeedDownloader : public QObject {
|
|||||||
bool isUpdateRunning() const;
|
bool isUpdateRunning() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateFeeds(const QList<Feed*>& feeds);
|
void updateFeeds(const QList<Feed*>& feeds, const QList<MessageFilter*>& msg_filters);
|
||||||
void stopRunningUpdate();
|
void stopRunningUpdate();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -58,7 +56,6 @@ class FeedDownloader : public QObject {
|
|||||||
|
|
||||||
QList<Feed*> m_feeds;
|
QList<Feed*> m_feeds;
|
||||||
QMutex* m_mutex;
|
QMutex* m_mutex;
|
||||||
QThreadPool* m_threadPool;
|
|
||||||
FeedDownloadResults m_results;
|
FeedDownloadResults m_results;
|
||||||
int m_feedsUpdated;
|
int m_feedsUpdated;
|
||||||
int m_feedsOriginalCount;
|
int m_feedsOriginalCount;
|
||||||
|
9
src/librssguard/core/messagefilter.cpp
Executable file
9
src/librssguard/core/messagefilter.cpp
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
// For license of this file, see <project-root-folder>/LICENSE.md.
|
||||||
|
|
||||||
|
#include "core/messagefilter.h"
|
||||||
|
|
||||||
|
MessageFilter::MessageFilter(QObject* parent) : QObject(parent) {}
|
||||||
|
|
||||||
|
FilteringAction MessageFilter::filterMessage() {
|
||||||
|
return FilteringAction::Accept;
|
||||||
|
}
|
25
src/librssguard/core/messagefilter.h
Executable file
25
src/librssguard/core/messagefilter.h
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
// For license of this file, see <project-root-folder>/LICENSE.md.
|
||||||
|
|
||||||
|
#ifndef MESSAGEFILTER_H
|
||||||
|
#define MESSAGEFILTER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
#include "core/message.h"
|
||||||
|
|
||||||
|
// Class which represents one message filter.
|
||||||
|
class MessageFilter : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MessageFilter(QObject* parent = nullptr);
|
||||||
|
|
||||||
|
FilteringAction filterMessage();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_id;
|
||||||
|
QString m_name;
|
||||||
|
QString m_script;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MESSAGEFILTER_H
|
@ -33,6 +33,7 @@ HEADERS += core/feeddownloader.h \
|
|||||||
core/feedsmodel.h \
|
core/feedsmodel.h \
|
||||||
core/feedsproxymodel.h \
|
core/feedsproxymodel.h \
|
||||||
core/message.h \
|
core/message.h \
|
||||||
|
core/messagefilter.h \
|
||||||
core/messagesmodel.h \
|
core/messagesmodel.h \
|
||||||
core/messagesmodelcache.h \
|
core/messagesmodelcache.h \
|
||||||
core/messagesmodelsqllayer.h \
|
core/messagesmodelsqllayer.h \
|
||||||
@ -176,6 +177,7 @@ SOURCES += core/feeddownloader.cpp \
|
|||||||
core/feedsmodel.cpp \
|
core/feedsmodel.cpp \
|
||||||
core/feedsproxymodel.cpp \
|
core/feedsproxymodel.cpp \
|
||||||
core/message.cpp \
|
core/message.cpp \
|
||||||
|
core/messagefilter.cpp \
|
||||||
core/messagesmodel.cpp \
|
core/messagesmodel.cpp \
|
||||||
core/messagesmodelcache.cpp \
|
core/messagesmodelcache.cpp \
|
||||||
core/messagesmodelsqllayer.cpp \
|
core/messagesmodelsqllayer.cpp \
|
||||||
|
@ -516,6 +516,7 @@ QString DatabaseFactory::obtainBeginTransactionSql() const {
|
|||||||
|
|
||||||
void DatabaseFactory::sqliteSaveMemoryDatabase() {
|
void DatabaseFactory::sqliteSaveMemoryDatabase() {
|
||||||
qDebug("Saving in-memory working database back to persistent file-based storage.");
|
qDebug("Saving in-memory working database back to persistent file-based storage.");
|
||||||
|
|
||||||
QSqlDatabase database = sqliteConnection(objectName(), DesiredType::StrictlyInMemory);
|
QSqlDatabase database = sqliteConnection(objectName(), DesiredType::StrictlyInMemory);
|
||||||
QSqlDatabase file_database = sqliteConnection(objectName(), DesiredType::StrictlyFileBased);
|
QSqlDatabase file_database = sqliteConnection(objectName(), DesiredType::StrictlyFileBased);
|
||||||
QSqlQuery copy_contents(database);
|
QSqlQuery copy_contents(database);
|
||||||
|
@ -44,6 +44,7 @@ FeedReader::FeedReader(QObject* parent)
|
|||||||
FeedReader::~FeedReader() {
|
FeedReader::~FeedReader() {
|
||||||
qDebug("Destroying FeedReader instance.");
|
qDebug("Destroying FeedReader instance.");
|
||||||
qDeleteAll(m_feedServices);
|
qDeleteAll(m_feedServices);
|
||||||
|
qDeleteAll(m_messageFilters);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ServiceEntryPoint*> FeedReader::feedServices() {
|
QList<ServiceEntryPoint*> FeedReader::feedServices() {
|
||||||
@ -74,6 +75,7 @@ void FeedReader::updateFeeds(const QList<Feed*>& feeds) {
|
|||||||
m_feedDownloader = new FeedDownloader();
|
m_feedDownloader = new FeedDownloader();
|
||||||
|
|
||||||
// Downloader setup.
|
// Downloader setup.
|
||||||
|
qRegisterMetaType<QList<MessageFilter*>>("QList<MessageFilter*>");
|
||||||
qRegisterMetaType<QList<Feed*>>("QList<Feed*>");
|
qRegisterMetaType<QList<Feed*>>("QList<Feed*>");
|
||||||
|
|
||||||
m_feedDownloader->moveToThread(m_feedDownloaderThread);
|
m_feedDownloader->moveToThread(m_feedDownloaderThread);
|
||||||
@ -89,7 +91,9 @@ void FeedReader::updateFeeds(const QList<Feed*>& feeds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QMetaObject::invokeMethod(m_feedDownloader, "updateFeeds",
|
QMetaObject::invokeMethod(m_feedDownloader, "updateFeeds",
|
||||||
Qt::ConnectionType::QueuedConnection, Q_ARG(QList<Feed*>, feeds));
|
Qt::ConnectionType::QueuedConnection,
|
||||||
|
Q_ARG(QList<Feed*>, feeds),
|
||||||
|
Q_ARG(QList<MessageFilter*>, m_messageFilters));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedReader::updateAutoUpdateStatus() {
|
void FeedReader::updateAutoUpdateStatus() {
|
||||||
|
@ -6,22 +6,17 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "core/feeddownloader.h"
|
#include "core/feeddownloader.h"
|
||||||
|
#include "core/messagefilter.h"
|
||||||
#include "services/abstract/feed.h"
|
#include "services/abstract/feed.h"
|
||||||
|
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
|
|
||||||
class FeedsModel;
|
class FeedsModel;
|
||||||
|
|
||||||
class MessagesModel;
|
class MessagesModel;
|
||||||
|
|
||||||
class MessagesProxyModel;
|
class MessagesProxyModel;
|
||||||
|
|
||||||
class FeedsProxyModel;
|
class FeedsProxyModel;
|
||||||
|
|
||||||
class ServiceEntryPoint;
|
class ServiceEntryPoint;
|
||||||
|
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|
||||||
class QThread;
|
class QThread;
|
||||||
|
|
||||||
class RSSGUARD_DLLSPEC FeedReader : public QObject {
|
class RSSGUARD_DLLSPEC FeedReader : public QObject {
|
||||||
@ -73,6 +68,7 @@ class RSSGUARD_DLLSPEC FeedReader : public QObject {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QList<ServiceEntryPoint*> m_feedServices;
|
QList<ServiceEntryPoint*> m_feedServices;
|
||||||
|
QList<MessageFilter*> m_messageFilters;
|
||||||
FeedsModel* m_feedsModel;
|
FeedsModel* m_feedsModel;
|
||||||
FeedsProxyModel* m_feedsProxyModel;
|
FeedsProxyModel* m_feedsProxyModel;
|
||||||
MessagesModel* m_messagesModel;
|
MessagesModel* m_messagesModel;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user