Refactorings...
This commit is contained in:
parent
a0dc1e1d66
commit
86c22db046
@ -1,5 +1,19 @@
|
|||||||
#include "core/feeddownloader.h"
|
#include "core/feeddownloader.h"
|
||||||
|
|
||||||
|
#include "core/feedsmodelfeed.h"
|
||||||
|
|
||||||
|
#include <QThread>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
FeedDownloader::FeedDownloader(QObject *parent) : QObject(parent) {
|
FeedDownloader::FeedDownloader(QObject *parent) : QObject(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FeedDownloader::~FeedDownloader() {
|
||||||
|
qDebug("Destroying FeedDownloader instance.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void FeedDownloader::updateFeeds(const QList<FeedsModelFeed *> &feeds) {
|
||||||
|
qDebug().nospace() << "Creating main application form in thread: \'" <<
|
||||||
|
QThread::currentThreadId() << "\'.";
|
||||||
|
}
|
||||||
|
@ -4,16 +4,34 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
|
||||||
|
class FeedsModelFeed;
|
||||||
|
|
||||||
|
// This class offers means to "update" feeds
|
||||||
|
// and "special" categories.
|
||||||
|
// NOTE: This class is used withing separate thread.
|
||||||
class FeedDownloader : public QObject {
|
class FeedDownloader : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// Constructors and destructors.
|
||||||
explicit FeedDownloader(QObject *parent = 0);
|
explicit FeedDownloader(QObject *parent = 0);
|
||||||
|
virtual ~FeedDownloader();
|
||||||
|
|
||||||
signals:
|
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:
|
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<FeedsModelFeed*> &feeds);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FEEDDOWNLOADER_H
|
#endif // FEEDDOWNLOADER_H
|
||||||
|
@ -17,6 +17,8 @@ FeedsModel::FeedsModel(QObject *parent) : QAbstractItemModel(parent) {
|
|||||||
setObjectName("FeedsModel");
|
setObjectName("FeedsModel");
|
||||||
|
|
||||||
m_rootItem = new FeedsModelRootItem();
|
m_rootItem = new FeedsModelRootItem();
|
||||||
|
m_rootItem->setTitle(tr("root"));
|
||||||
|
|
||||||
m_countsIcon = IconThemeFactory::getInstance()->fromTheme("mail-mark-unread");
|
m_countsIcon = IconThemeFactory::getInstance()->fromTheme("mail-mark-unread");
|
||||||
|
|
||||||
m_headerData << tr("Title");
|
m_headerData << tr("Title");
|
||||||
|
@ -46,6 +46,8 @@ class FeedsModel : public QAbstractItemModel {
|
|||||||
QList<FeedsModelFeed*> feedsForIndex(const QModelIndex &index);
|
QList<FeedsModelFeed*> feedsForIndex(const QModelIndex &index);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
// Signals that properties (probably counts)
|
||||||
|
// of ALL items have changed.
|
||||||
void reloadWholeLayout();
|
void reloadWholeLayout();
|
||||||
|
|
||||||
// Signals that SOME data of this model need
|
// Signals that SOME data of this model need
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
|
|
||||||
FeedsModelRootItem::FeedsModelRootItem(FeedsModelRootItem *parent_item)
|
FeedsModelRootItem::FeedsModelRootItem(FeedsModelRootItem *parent_item)
|
||||||
: m_kind(FeedsModelRootItem::RootItem), m_parentItem(parent_item) {
|
: m_kind(FeedsModelRootItem::RootItem),
|
||||||
|
m_parentItem(parent_item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedsModelRootItem::~FeedsModelRootItem() {
|
FeedsModelRootItem::~FeedsModelRootItem() {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "core/messagesproxymodel.h"
|
#include "core/messagesproxymodel.h"
|
||||||
|
#include "core/feeddownloader.h"
|
||||||
#include "gui/webbrowser.h"
|
#include "gui/webbrowser.h"
|
||||||
#include "gui/formmain.h"
|
#include "gui/formmain.h"
|
||||||
#include "gui/iconthemefactory.h"
|
#include "gui/iconthemefactory.h"
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
class WebBrowser;
|
class WebBrowser;
|
||||||
class FeedsView;
|
class FeedsView;
|
||||||
class MessagesView;
|
class MessagesView;
|
||||||
|
class FeedDownloader;
|
||||||
class QToolBar;
|
class QToolBar;
|
||||||
class QSplitter;
|
class QSplitter;
|
||||||
|
|
||||||
@ -46,6 +47,8 @@ class FeedMessageViewer : public TabContent {
|
|||||||
MessagesView *m_messagesView;
|
MessagesView *m_messagesView;
|
||||||
FeedsView *m_feedsView;
|
FeedsView *m_feedsView;
|
||||||
WebBrowser *m_messagesBrowser;
|
WebBrowser *m_messagesBrowser;
|
||||||
|
|
||||||
|
FeedDownloader *m_feedDownloader;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FEEDMESSAGEVIEWER_H
|
#endif // FEEDMESSAGEVIEWER_H
|
||||||
|
@ -16,7 +16,9 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <QThread>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
// TODO: Check if extra UNIX signalling is needed.
|
// TODO: Check if extra UNIX signalling is needed.
|
||||||
@ -77,6 +79,9 @@ int main(int argc, char *argv[]) {
|
|||||||
QtSingleApplication::setOrganizationDomain(APP_URL);
|
QtSingleApplication::setOrganizationDomain(APP_URL);
|
||||||
QtSingleApplication::setWindowIcon(QIcon(APP_ICON_PATH));
|
QtSingleApplication::setWindowIcon(QIcon(APP_ICON_PATH));
|
||||||
|
|
||||||
|
qDebug().nospace() << "Creating main application form in thread: \'" <<
|
||||||
|
QThread::currentThreadId() << "\'.";
|
||||||
|
|
||||||
// Instantiate main application window.
|
// Instantiate main application window.
|
||||||
FormMain window;
|
FormMain window;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user