qBittorrent
|
#include <rss_session.h>
Public Slots | |
void | refresh () |
Signals | |
void | processingStateChanged (bool enabled) |
void | maxArticlesPerFeedChanged (int n) |
void | itemAdded (Item *item) |
void | itemPathChanged (Item *item) |
void | itemAboutToBeRemoved (Item *item) |
void | feedIconLoaded (Feed *feed) |
void | feedStateChanged (Feed *feed) |
Public Member Functions | |
bool | isProcessingEnabled () const |
void | setProcessingEnabled (bool enabled) |
QThread * | workingThread () const |
AsyncFileStorage * | confFileStorage () const |
AsyncFileStorage * | dataFileStorage () const |
int | maxArticlesPerFeed () const |
void | setMaxArticlesPerFeed (int n) |
int | refreshInterval () const |
void | setRefreshInterval (int refreshInterval) |
nonstd::expected< void, QString > | addFolder (const QString &path) |
nonstd::expected< void, QString > | addFeed (const QString &url, const QString &path) |
nonstd::expected< void, QString > | moveItem (const QString &itemPath, const QString &destPath) |
nonstd::expected< void, QString > | moveItem (Item *item, const QString &destPath) |
nonstd::expected< void, QString > | removeItem (const QString &itemPath) |
QList< Item * > | items () const |
Item * | itemByPath (const QString &path) const |
QList< Feed * > | feeds () const |
Feed * | feedByURL (const QString &url) const |
Folder * | rootFolder () const |
Static Public Member Functions | |
static Session * | instance () |
Private Slots | |
void | handleItemAboutToBeDestroyed (Item *item) |
void | handleFeedTitleChanged (Feed *feed) |
Private Member Functions | |
Session () | |
~Session () override | |
QUuid | generateUID () const |
void | load () |
void | loadFolder (const QJsonObject &jsonObj, Folder *folder) |
void | loadLegacy () |
void | store () |
nonstd::expected< Folder *, QString > | prepareItemDest (const QString &path) |
Folder * | addSubfolder (const QString &name, Folder *parentFolder) |
Feed * | addFeedToFolder (const QUuid &uid, const QString &url, const QString &name, Folder *parentFolder) |
void | addItem (Item *item, Folder *destFolder) |
Private Attributes | |
CachedSettingValue< bool > | m_storeProcessingEnabled |
CachedSettingValue< int > | m_storeRefreshInterval |
CachedSettingValue< int > | m_storeMaxArticlesPerFeed |
QThread * | m_workingThread |
AsyncFileStorage * | m_confFileStorage |
AsyncFileStorage * | m_dataFileStorage |
QTimer | m_refreshTimer |
QHash< QString, Item * > | m_itemsByPath |
QHash< QUuid, Feed * > | m_feedsByUID |
QHash< QString, Feed * > | m_feedsByURL |
Static Private Attributes | |
static QPointer< Session > | m_instance = nullptr |
Friends | |
class | ::Application |
Definition at line 90 of file rss_session.h.
|
private |
Definition at line 60 of file rss_session.cpp.
References Logger::addMessage(), ConfFolderName(), Config, Data, DataFolderName(), Utils::Fs::expandPathAbs(), AsyncFileStorage::failed(), Utils::Fs::fileName(), Logger::instance(), SettingsStorage::instance(), isProcessingEnabled(), load(), m_confFileStorage, m_dataFileStorage, m_instance, m_itemsByPath, m_refreshTimer, m_workingThread, MsecsPerMin, refresh(), refreshInterval(), specialFolderLocation(), and Log::WARNING.
|
overrideprivate |
nonstd::expected< void, QString > Session::addFeed | ( | const QString & | url, |
const QString & | path | ||
) |
Definition at line 153 of file rss_session.cpp.
References addItem(), feedByURL(), generateUID(), isProcessingEnabled(), m_feedsByURL, prepareItemDest(), RSS::Feed::refresh(), and store().
Referenced by RSSController::addFeedAction(), loadLegacy(), and RSSWidget::on_newFeedButton_clicked().
|
private |
Definition at line 401 of file rss_session.cpp.
References addItem(), RSS::Item::joinPath(), and RSS::Item::path().
Referenced by loadFolder().
nonstd::expected< void, QString > Session::addFolder | ( | const QString & | path | ) |
Definition at line 141 of file rss_session.cpp.
References addItem(), prepareItemDest(), and store().
Referenced by RSSController::addFolderAction(), RSSWidget::askNewFolder(), and loadLegacy().
Definition at line 408 of file rss_session.cpp.
References RSS::Item::aboutToBeDestroyed(), RSS::Folder::addItem(), feedIconLoaded(), feedStateChanged(), handleFeedTitleChanged(), handleItemAboutToBeDestroyed(), RSS::Feed::iconLoaded(), itemAdded(), itemPathChanged(), m_feedsByUID, m_feedsByURL, m_itemsByPath, RSS::Item::path(), RSS::Item::pathChanged(), RSS::Feed::stateChanged(), and RSS::Feed::titleChanged().
Referenced by addFeed(), addFeedToFolder(), addFolder(), and addSubfolder().
Definition at line 394 of file rss_session.cpp.
References addItem(), RSS::Item::joinPath(), and RSS::Item::path().
Referenced by loadFolder().
AsyncFileStorage * Session::confFileStorage | ( | ) | const |
Definition at line 450 of file rss_session.cpp.
References m_confFileStorage.
AsyncFileStorage * Session::dataFileStorage | ( | ) | const |
Definition at line 455 of file rss_session.cpp.
References m_dataFileStorage.
Referenced by RSS::Feed::cleanup(), RSS::Feed::Feed(), RSS::Feed::load(), and RSS::Feed::store().
Feed * Session::feedByURL | ( | const QString & | url | ) | const |
Definition at line 470 of file rss_session.cpp.
References m_feedsByURL.
Referenced by addFeed(), RSSController::matchingArticlesAction(), and AutomatedRssDownloader::updateMatchingArticles().
|
signal |
Referenced by addItem(), and FeedListWidget::FeedListWidget().
QList< Feed * > Session::feeds | ( | ) | const |
Definition at line 465 of file rss_session.cpp.
References m_feedsByURL.
|
signal |
Referenced by addItem(), and FeedListWidget::FeedListWidget().
|
private |
Definition at line 513 of file rss_session.cpp.
References m_feedsByUID.
Referenced by addFeed(), and loadFolder().
|
privateslot |
Definition at line 505 of file rss_session.cpp.
References RSS::Item::joinPath(), moveItem(), RSS::Item::name(), RSS::Item::parentPath(), RSS::Item::path(), RSS::Feed::title(), and RSS::Feed::url().
Referenced by addItem().
|
privateslot |
Definition at line 494 of file rss_session.cpp.
References m_feedsByUID, m_feedsByURL, m_itemsByPath, and RSS::Item::path().
Referenced by addItem().
|
static |
Definition at line 136 of file rss_session.cpp.
References m_instance.
Referenced by RSSController::addFeedAction(), RSSController::addFolderAction(), RSSWidget::askNewFolder(), Application::cleanup(), RSSWidget::deleteSelectedItems(), MainWindow::displayRSSTab(), FeedListWidget::dropEvent(), FeedListWidget::FeedListWidget(), FeedListWidget::handleItemAdded(), FeedListWidget::handleItemPathChanged(), FeedListWidget::handleItemUnreadCountChanged(), RSS::AutoDownloader::handleTorrentDownloadFinished(), RSSWidget::handleUnreadCountChanged(), RSSController::itemsAction(), AutomatedRssDownloader::loadFeedList(), OptionsDialog::loadOptions(), RSSController::markAsReadAction(), RSSController::matchingArticlesAction(), RSSController::moveItemAction(), RSSWidget::on_newFeedButton_clicked(), AppController::preferencesAction(), RSS::AutoDownloader::processJob(), RSSWidget::refreshAllFeeds(), RSSController::refreshItemAction(), RSSController::removeItemAction(), RSSWidget::renameSelectedRSSItem(), RSS::AutoDownloader::resetProcessingQueue(), RSSWidget::RSSWidget(), OptionsDialog::saveOptions(), AppController::setPreferencesAction(), RSS::AutoDownloader::setProcessingEnabled(), RSS::AutoDownloader::startProcessing(), AutomatedRssDownloader::updateMatchingArticles(), and RSSWidget::updateRefreshInterval().
bool Session::isProcessingEnabled | ( | ) | const |
Definition at line 426 of file rss_session.cpp.
References m_storeProcessingEnabled.
Referenced by addFeed(), RSS::Feed::Feed(), OptionsDialog::loadOptions(), AppController::preferencesAction(), and Session().
|
signal |
Referenced by FeedListWidget::FeedListWidget(), and removeItem().
|
signal |
Referenced by addItem(), and FeedListWidget::FeedListWidget().
Item * Session::itemByPath | ( | const QString & | path | ) | const |
Definition at line 229 of file rss_session.cpp.
References m_itemsByPath.
Referenced by RSSWidget::askNewFolder(), FeedListWidget::handleItemPathChanged(), RSSController::markAsReadAction(), RSSWidget::on_newFeedButton_clicked(), and RSSController::refreshItemAction().
|
signal |
Referenced by addItem(), and FeedListWidget::FeedListWidget().
QList< Item * > Session::items | ( | ) | const |
Definition at line 224 of file rss_session.cpp.
References m_itemsByPath.
|
private |
Definition at line 234 of file rss_session.cpp.
References Logger::addMessage(), FeedsFileName(), Logger::instance(), loadFolder(), loadLegacy(), m_confFileStorage, rootFolder(), AsyncFileStorage::storageDir(), and Log::WARNING.
Referenced by Session().
|
private |
Definition at line 272 of file rss_session.cpp.
References addFeedToFolder(), addSubfolder(), asConst(), generateUID(), LogMsg(), m_feedsByUID, RSS::Item::path(), store(), anonymous_namespace{session.cpp}::toString(), and Log::WARNING.
Referenced by load().
|
private |
Definition at line 342 of file rss_session.cpp.
References addFeed(), addFolder(), Logger::addMessage(), asConst(), RSS::Item::expandPath(), Logger::instance(), SettingsStorage::instance(), RSS::Item::joinPath(), SettingsStorage::loadValue(), RSS::Item::parentPath(), RSS::Item::PathSeparator, RSS::Item::relativeName(), store(), and Log::WARNING.
Referenced by load().
int Session::maxArticlesPerFeed | ( | ) | const |
Definition at line 522 of file rss_session.cpp.
References m_storeMaxArticlesPerFeed.
Referenced by RSS::Feed::addArticle(), OptionsDialog::loadOptions(), AppController::preferencesAction(), and RSS::Feed::updateArticles().
|
signal |
Referenced by RSS::Feed::Feed(), and setMaxArticlesPerFeed().
nonstd::expected< void, QString > Session::moveItem | ( | const QString & | itemPath, |
const QString & | destPath | ||
) |
Definition at line 171 of file rss_session.cpp.
References m_itemsByPath.
Referenced by FeedListWidget::dropEvent(), handleFeedTitleChanged(), RSSController::moveItemAction(), and RSSWidget::renameSelectedRSSItem().
nonstd::expected< void, QString > Session::moveItem | ( | Item * | item, |
const QString & | destPath | ||
) |
Definition at line 183 of file rss_session.cpp.
References m_itemsByPath, RSS::Item::parentPath(), RSS::Item::path(), prepareItemDest(), RSS::Folder::removeItem(), rootFolder(), RSS::Item::setPath(), and store().
|
private |
Definition at line 378 of file rss_session.cpp.
References RSS::Item::isValidPath(), m_itemsByPath, and RSS::Item::parentPath().
Referenced by addFeed(), addFolder(), and moveItem().
|
signal |
Referenced by RSS::Feed::Feed(), RSS::Feed::handleSessionProcessingEnabledChanged(), RSSWidget::RSSWidget(), and setProcessingEnabled().
|
slot |
Definition at line 536 of file rss_session.cpp.
References RSS::Folder::refresh(), and rootFolder().
Referenced by RSSWidget::refreshAllFeeds(), Session(), and setProcessingEnabled().
int Session::refreshInterval | ( | ) | const |
Definition at line 475 of file rss_session.cpp.
References m_storeRefreshInterval.
Referenced by OptionsDialog::loadOptions(), AppController::preferencesAction(), Session(), setProcessingEnabled(), and setRefreshInterval().
nonstd::expected< void, QString > Session::removeItem | ( | const QString & | itemPath | ) |
Definition at line 205 of file rss_session.cpp.
References itemAboutToBeRemoved(), m_itemsByPath, RSS::Item::parentPath(), RSS::Folder::removeItem(), and store().
Referenced by RSSWidget::deleteSelectedItems(), and RSSController::removeItemAction().
Folder * Session::rootFolder | ( | ) | const |
Definition at line 460 of file rss_session.cpp.
References m_itemsByPath.
Referenced by RSSWidget::askNewFolder(), FeedListWidget::dropEvent(), FeedListWidget::FeedListWidget(), RSSController::itemsAction(), load(), moveItem(), RSSWidget::on_newFeedButton_clicked(), refresh(), and store().
void Session::setMaxArticlesPerFeed | ( | int | n | ) |
Definition at line 527 of file rss_session.cpp.
References m_storeMaxArticlesPerFeed, and maxArticlesPerFeedChanged().
Referenced by OptionsDialog::saveOptions(), and AppController::setPreferencesAction().
void Session::setProcessingEnabled | ( | bool | enabled | ) |
Definition at line 431 of file rss_session.cpp.
References m_refreshTimer, m_storeProcessingEnabled, MsecsPerMin, processingStateChanged(), refresh(), and refreshInterval().
Referenced by OptionsDialog::saveOptions(), and AppController::setPreferencesAction().
void Session::setRefreshInterval | ( | int | refreshInterval | ) |
Definition at line 480 of file rss_session.cpp.
References m_refreshTimer, m_storeRefreshInterval, MsecsPerMin, and refreshInterval().
Referenced by OptionsDialog::saveOptions(), AppController::setPreferencesAction(), and RSSWidget::updateRefreshInterval().
|
private |
Definition at line 373 of file rss_session.cpp.
References FeedsFileName(), m_confFileStorage, rootFolder(), AsyncFileStorage::store(), and anonymous_namespace{rss_autodownloadrule.cpp}::toJsonValue().
Referenced by addFeed(), addFolder(), loadFolder(), loadLegacy(), moveItem(), and removeItem().
QThread * Session::workingThread | ( | ) | const |
Definition at line 489 of file rss_session.cpp.
References m_workingThread.
Referenced by RSS::Feed::Feed().
|
friend |
Definition at line 95 of file rss_session.h.
|
private |
Definition at line 162 of file rss_session.h.
Referenced by confFileStorage(), load(), Session(), and store().
|
private |
Definition at line 163 of file rss_session.h.
Referenced by dataFileStorage(), and Session().
|
private |
Definition at line 166 of file rss_session.h.
Referenced by addItem(), generateUID(), handleItemAboutToBeDestroyed(), and loadFolder().
|
private |
Definition at line 167 of file rss_session.h.
Referenced by addFeed(), addItem(), feedByURL(), feeds(), and handleItemAboutToBeDestroyed().
|
staticprivate |
Definition at line 156 of file rss_session.h.
Referenced by instance(), and Session().
|
private |
Definition at line 165 of file rss_session.h.
Referenced by addItem(), handleItemAboutToBeDestroyed(), itemByPath(), items(), moveItem(), prepareItemDest(), removeItem(), rootFolder(), Session(), and ~Session().
|
private |
Definition at line 164 of file rss_session.h.
Referenced by Session(), setProcessingEnabled(), and setRefreshInterval().
|
private |
Definition at line 160 of file rss_session.h.
Referenced by maxArticlesPerFeed(), and setMaxArticlesPerFeed().
|
private |
Definition at line 158 of file rss_session.h.
Referenced by isProcessingEnabled(), and setProcessingEnabled().
|
private |
Definition at line 159 of file rss_session.h.
Referenced by refreshInterval(), and setRefreshInterval().
|
private |
Definition at line 161 of file rss_session.h.
Referenced by Session(), workingThread(), and ~Session().