diff --git a/src/core/feeddownloader.cpp b/src/core/feeddownloader.cpp index 121119fe2..54a4460a0 100644 --- a/src/core/feeddownloader.cpp +++ b/src/core/feeddownloader.cpp @@ -1,5 +1,19 @@ #include "core/feeddownloader.h" +#include "core/feedsmodelfeed.h" + +#include +#include + FeedDownloader::FeedDownloader(QObject *parent) : QObject(parent) { } + +FeedDownloader::~FeedDownloader() { + qDebug("Destroying FeedDownloader instance."); +} + +void FeedDownloader::updateFeeds(const QList &feeds) { + qDebug().nospace() << "Creating main application form in thread: \'" << + QThread::currentThreadId() << "\'."; +} diff --git a/src/core/feeddownloader.h b/src/core/feeddownloader.h index 7466f6b29..be225198a 100644 --- a/src/core/feeddownloader.h +++ b/src/core/feeddownloader.h @@ -4,16 +4,34 @@ #include +class FeedsModelFeed; + +// This class offers means to "update" feeds +// and "special" categories. +// NOTE: This class is used withing separate thread. class FeedDownloader : public QObject { Q_OBJECT public: + // Constructors and destructors. explicit FeedDownloader(QObject *parent = 0); + virtual ~FeedDownloader(); signals: + // Emitted if all items from update queue are + // processed. + void finished(); + + // Emitted if any item is processed. + // "Current" counts + void progress(FeedsModelFeed *feed, int current, int total); public slots: - + // Performs update of all feeds from the "feeds" parameter. + // New messages are downloaded for each feed and they + // are stored persistently in the database. + // Appropriate signals are emitted. + void updateFeeds(const QList &feeds); }; #endif // FEEDDOWNLOADER_H diff --git a/src/core/feedsmodel.cpp b/src/core/feedsmodel.cpp index 3b207321b..53ad3961e 100644 --- a/src/core/feedsmodel.cpp +++ b/src/core/feedsmodel.cpp @@ -17,6 +17,8 @@ FeedsModel::FeedsModel(QObject *parent) : QAbstractItemModel(parent) { setObjectName("FeedsModel"); m_rootItem = new FeedsModelRootItem(); + m_rootItem->setTitle(tr("root")); + m_countsIcon = IconThemeFactory::getInstance()->fromTheme("mail-mark-unread"); m_headerData << tr("Title"); diff --git a/src/core/feedsmodel.h b/src/core/feedsmodel.h index 35d98a922..1e333ad38 100644 --- a/src/core/feedsmodel.h +++ b/src/core/feedsmodel.h @@ -46,6 +46,8 @@ class FeedsModel : public QAbstractItemModel { QList feedsForIndex(const QModelIndex &index); public slots: + // Signals that properties (probably counts) + // of ALL items have changed. void reloadWholeLayout(); // Signals that SOME data of this model need diff --git a/src/core/feedsmodelrootitem.cpp b/src/core/feedsmodelrootitem.cpp index 50a8fea65..eec840651 100755 --- a/src/core/feedsmodelrootitem.cpp +++ b/src/core/feedsmodelrootitem.cpp @@ -6,7 +6,8 @@ FeedsModelRootItem::FeedsModelRootItem(FeedsModelRootItem *parent_item) - : m_kind(FeedsModelRootItem::RootItem), m_parentItem(parent_item) { + : m_kind(FeedsModelRootItem::RootItem), + m_parentItem(parent_item) { } FeedsModelRootItem::~FeedsModelRootItem() { diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp index 9dfdef116..c754181d8 100644 --- a/src/gui/feedmessageviewer.cpp +++ b/src/gui/feedmessageviewer.cpp @@ -2,6 +2,7 @@ #include "core/settings.h" #include "core/messagesproxymodel.h" +#include "core/feeddownloader.h" #include "gui/webbrowser.h" #include "gui/formmain.h" #include "gui/iconthemefactory.h" diff --git a/src/gui/feedmessageviewer.h b/src/gui/feedmessageviewer.h index 53dcbcc70..4470d97d7 100644 --- a/src/gui/feedmessageviewer.h +++ b/src/gui/feedmessageviewer.h @@ -7,6 +7,7 @@ class WebBrowser; class FeedsView; class MessagesView; +class FeedDownloader; class QToolBar; class QSplitter; @@ -46,6 +47,8 @@ class FeedMessageViewer : public TabContent { MessagesView *m_messagesView; FeedsView *m_feedsView; WebBrowser *m_messagesBrowser; + + FeedDownloader *m_feedDownloader; }; #endif // FEEDMESSAGEVIEWER_H diff --git a/src/main.cpp b/src/main.cpp index de81168f4..789994609 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,7 +16,9 @@ #include #endif +#include #include +#include // TODO: Check if extra UNIX signalling is needed. @@ -77,6 +79,9 @@ int main(int argc, char *argv[]) { QtSingleApplication::setOrganizationDomain(APP_URL); QtSingleApplication::setWindowIcon(QIcon(APP_ICON_PATH)); + qDebug().nospace() << "Creating main application form in thread: \'" << + QThread::currentThreadId() << "\'."; + // Instantiate main application window. FormMain window;