mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-02 18:36:49 +01:00
fixed #970
This commit is contained in:
parent
3f41aeba06
commit
c0e8f919bc
File diff suppressed because it is too large
Load Diff
@ -53,8 +53,7 @@
|
||||
|
||||
FormMain::FormMain(QWidget* parent, Qt::WindowFlags f)
|
||||
: QMainWindow(parent, f), m_ui(new Ui::FormMain), m_trayMenu(nullptr), m_statusBar(nullptr) {
|
||||
qDebugNN << LOGSEC_GUI
|
||||
<< "Creating main application form in thread:" << QUOTE_W_SPACE_DOT(getThreadID());
|
||||
qDebugNN << LOGSEC_GUI << "Creating main application form in thread:" << QUOTE_W_SPACE_DOT(getThreadID());
|
||||
// setAttribute(Qt::WA_WindowPropagation, true);
|
||||
m_ui->setupUi(this);
|
||||
qApp->setMainForm(this);
|
||||
@ -190,6 +189,7 @@ QList<QAction*> FormMain::allActions() const {
|
||||
actions << m_ui->m_actionPlaySelectedArticlesInMediaPlayer;
|
||||
actions << m_ui->m_actionOpenSelectedMessagesInternallyNoTab;
|
||||
actions << m_ui->m_actionAlternateColorsInLists;
|
||||
actions << m_ui->m_actionPauseFeedFetching;
|
||||
actions << m_ui->m_actionMessagePreviewEnabled;
|
||||
actions << m_ui->m_actionMarkAllItemsRead;
|
||||
actions << m_ui->m_actionMarkSelectedItemsAsRead;
|
||||
@ -598,6 +598,8 @@ void FormMain::setupIcons() {
|
||||
// Feeds/messages.
|
||||
m_ui->m_menuAddItem->setIcon(icon_theme_factory->fromTheme(QSL("list-add")));
|
||||
m_ui->m_actionStopRunningItemsUpdate->setIcon(icon_theme_factory->fromTheme(QSL("process-stop")));
|
||||
m_ui->m_actionPauseFeedFetching->setIcon(icon_theme_factory->fromTheme(QSL("media-playback-pause"),
|
||||
QSL("player_pause")));
|
||||
m_ui->m_actionUpdateAllItems->setIcon(icon_theme_factory->fromTheme(QSL("download"), QSL("browser-download")));
|
||||
m_ui->m_actionUpdateSelectedItems->setIcon(icon_theme_factory->fromTheme(QSL("download"), QSL("browser-download")));
|
||||
m_ui->m_actionUpdateSelectedItemsWithCustomTimers->setIcon(icon_theme_factory->fromTheme(QSL("download"),
|
||||
@ -711,7 +713,7 @@ void FormMain::loadSize() {
|
||||
->setChecked(settings->value(GROUP(GUI), SETTING(GUI::MessageViewerToolbarsVisible)).toBool());
|
||||
m_ui->m_actionSwitchStatusBar->setChecked(settings->value(GROUP(GUI), SETTING(GUI::StatusBarVisible)).toBool());
|
||||
|
||||
// Other startup GUI-related settings.
|
||||
// Other startup GUI-related or misc settings.
|
||||
m_ui->m_actionSortFeedsAlphabetically
|
||||
->setChecked(settings->value(GROUP(Feeds), SETTING(Feeds::SortAlphabetically)).toBool());
|
||||
m_ui->m_actionShowOnlyUnreadItems
|
||||
@ -721,6 +723,8 @@ void FormMain::loadSize() {
|
||||
->setChecked(settings->value(GROUP(Feeds), SETTING(Feeds::AutoExpandOnSelection)).toBool());
|
||||
m_ui->m_actionAlternateColorsInLists
|
||||
->setChecked(settings->value(GROUP(GUI), SETTING(GUI::AlternateRowColorsInLists)).toBool());
|
||||
m_ui->m_actionPauseFeedFetching
|
||||
->setChecked(settings->value(GROUP(Feeds), SETTING(Feeds::PauseFeedFetching)).toBool());
|
||||
}
|
||||
|
||||
void FormMain::saveSize() {
|
||||
@ -1027,6 +1031,7 @@ void FormMain::createConnections() {
|
||||
&QAction::toggled,
|
||||
tabWidget()->feedMessageViewer(),
|
||||
&FeedMessageViewer::alternateRowColorsInLists);
|
||||
connect(m_ui->m_actionPauseFeedFetching, &QAction::toggled, qApp->feedReader(), &FeedReader::pauseUnpaseFeedFetching);
|
||||
connect(m_ui->m_actionRestoreSelectedMessages,
|
||||
&QAction::triggered,
|
||||
tabWidget()->feedMessageViewer()->messagesView(),
|
||||
|
@ -123,6 +123,7 @@
|
||||
<addaction name="m_actionUpdateSelectedItems"/>
|
||||
<addaction name="m_actionUpdateSelectedItemsWithCustomTimers"/>
|
||||
<addaction name="m_actionStopRunningItemsUpdate"/>
|
||||
<addaction name="m_actionPauseFeedFetching"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="m_menuAddItem"/>
|
||||
<addaction name="m_actionEditSelectedItem"/>
|
||||
@ -233,7 +234,7 @@
|
||||
<string notr="true">Ctrl+Q</string>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::QuitRole</enum>
|
||||
<enum>QAction::MenuRole::QuitRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionSettings">
|
||||
@ -258,7 +259,7 @@
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::AboutRole</enum>
|
||||
<enum>QAction::MenuRole::AboutRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionFullscreen">
|
||||
@ -951,6 +952,14 @@
|
||||
<string>Play in &media player</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="m_actionPauseFeedFetching">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Pause automatic feed fetching</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <QTimer>
|
||||
|
||||
FeedReader::FeedReader(QObject* parent)
|
||||
: QObject(parent), m_autoUpdateTimer(new QTimer(this)), m_feedDownloader(nullptr) {
|
||||
: QObject(parent), m_autoUpdateTimer(new QTimer(this)), m_feedDownloader(nullptr), m_feedFetchingPaused(false) {
|
||||
m_feedsModel = new FeedsModel(this);
|
||||
m_feedsProxyModel = new FeedsProxyModel(m_feedsModel, this);
|
||||
m_messagesModel = new MessagesModel(this);
|
||||
@ -268,6 +268,20 @@ void FeedReader::stopRunningFeedUpdate() {
|
||||
}
|
||||
}
|
||||
|
||||
void FeedReader::pauseUnpaseFeedFetching(bool pause) {
|
||||
m_feedFetchingPaused = pause;
|
||||
qApp->settings()->setValue(GROUP(Feeds), Feeds::PauseFeedFetching, pause);
|
||||
}
|
||||
|
||||
void FeedReader::warnAboutPausedFetching() const {
|
||||
if (m_feedFetchingPaused) {
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent,
|
||||
GuiMessage(tr("Feed fetching is paused"),
|
||||
tr("Automatic feed fetching based on time interval is currently paused."),
|
||||
QSystemTrayIcon::MessageIcon::Warning));
|
||||
}
|
||||
}
|
||||
|
||||
bool FeedReader::isFeedUpdateRunning() const {
|
||||
return m_feedDownloader != nullptr && m_feedDownloader->isUpdateRunning();
|
||||
}
|
||||
@ -307,10 +321,10 @@ void FeedReader::executeNextAutoUpdate() {
|
||||
|
||||
// Skip this round of auto-updating, but only if user disabled it when main window is active
|
||||
// and there are no caches to synchronize.
|
||||
if (disable_update_with_window && full_caches.empty()) {
|
||||
if ((m_feedFetchingPaused || disable_update_with_window) && full_caches.empty()) {
|
||||
qDebugNN << LOGSEC_CORE << "Delaying scheduled feed auto-download for some time since window "
|
||||
<< "is focused and updates while focused are disabled by the "
|
||||
<< "user and all account caches are empty.";
|
||||
<< "user (or paused) and all account caches are empty.";
|
||||
|
||||
// Cannot update, quit.
|
||||
return;
|
||||
@ -319,7 +333,6 @@ void FeedReader::executeNextAutoUpdate() {
|
||||
if (!qApp->feedUpdateLock()->tryLock()) {
|
||||
qDebugNN << LOGSEC_CORE << "Delaying scheduled feed auto-downloads and message state synchronization for "
|
||||
<< "some time due to another running update.";
|
||||
|
||||
// Cannot update, quit.
|
||||
return;
|
||||
}
|
||||
@ -333,9 +346,9 @@ void FeedReader::executeNextAutoUpdate() {
|
||||
synchronizeMessageData(caches);
|
||||
}
|
||||
|
||||
if (disable_update_with_window) {
|
||||
if (m_feedFetchingPaused || disable_update_with_window) {
|
||||
qDebugNN << LOGSEC_CORE << "Delaying scheduled feed auto-download for some time since window "
|
||||
<< "is focused. Article cache was synchronised nonetheless.";
|
||||
<< "is focused or feed fetching is paused. Article cache was synchronised nonetheless.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,8 @@ class RSSGUARD_DLLSPEC FeedReader : public QObject {
|
||||
FeedsProxyModel* feedsProxyModel() const;
|
||||
MessagesProxyModel* messagesProxyModel() const;
|
||||
|
||||
void warnAboutPausedFetching() const;
|
||||
|
||||
// Update feeds in extra thread.
|
||||
void updateFeeds(const QList<Feed*>& feeds, bool update_switched_off_too = false);
|
||||
|
||||
@ -66,6 +68,7 @@ class RSSGUARD_DLLSPEC FeedReader : public QObject {
|
||||
void updateAllFeeds();
|
||||
void updateManuallyIntervaledFeeds();
|
||||
void stopRunningFeedUpdate();
|
||||
void pauseUnpaseFeedFetching(bool pause);
|
||||
void quit();
|
||||
|
||||
private slots:
|
||||
@ -97,6 +100,7 @@ class RSSGUARD_DLLSPEC FeedReader : public QObject {
|
||||
QDateTime m_lastAutoUpdate;
|
||||
QThread* m_feedDownloaderThread;
|
||||
FeedDownloader* m_feedDownloader;
|
||||
bool m_feedFetchingPaused;
|
||||
};
|
||||
|
||||
#endif // FEEDREADER_H
|
||||
|
@ -98,6 +98,9 @@ DVALUE(char*) Feeds::CountFormatDef = "(%unread)";
|
||||
DKEY Feeds::EnableTooltipsFeedsMessages = "show_tooltips";
|
||||
DVALUE(bool) Feeds::EnableTooltipsFeedsMessagesDef = true;
|
||||
|
||||
DKEY Feeds::PauseFeedFetching = "pause_feed_fetching";
|
||||
DVALUE(bool) Feeds::PauseFeedFetchingDef = false;
|
||||
|
||||
DKEY Feeds::AutoUpdateInterval = "auto_update_interval";
|
||||
DVALUE(int) Feeds::AutoUpdateIntervalDef = DEFAULT_AUTO_UPDATE_INTERVAL;
|
||||
|
||||
@ -290,8 +293,8 @@ DVALUE(int) GUI::HeightRowFeedsDef = -1;
|
||||
|
||||
DKEY GUI::FeedsToolbarActions = "feeds_toolbar";
|
||||
DVALUE(char*)
|
||||
GUI::FeedsToolbarActionsDef =
|
||||
"m_actionUpdateAllItems,m_actionStopRunningItemsUpdate,m_actionMarkAllItemsRead,spacer,search";
|
||||
GUI::FeedsToolbarActionsDef = "m_actionUpdateAllItems,m_actionStopRunningItemsUpdate,m_actionPauseFeedFetching,m_"
|
||||
"actionMarkAllItemsRead,spacer,search";
|
||||
|
||||
DKEY GUI::StatusbarActions = "status_bar";
|
||||
DVALUE(char*)
|
||||
|
@ -94,6 +94,9 @@ namespace Feeds {
|
||||
KEY EnableTooltipsFeedsMessages;
|
||||
VALUE(bool) EnableTooltipsFeedsMessagesDef;
|
||||
|
||||
KEY PauseFeedFetching;
|
||||
VALUE(bool) PauseFeedFetchingDef;
|
||||
|
||||
KEY AutoUpdateInterval;
|
||||
VALUE(int) AutoUpdateIntervalDef;
|
||||
|
||||
|
@ -127,6 +127,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
qApp->loadDynamicShortcuts();
|
||||
qApp->hideOrShowMainForm();
|
||||
qApp->feedReader()->warnAboutPausedFetching();
|
||||
qApp->feedReader()->loadSavedMessageFilters();
|
||||
qApp->feedReader()->feedsModel()->loadActivatedServiceAccounts();
|
||||
qApp->showTrayIcon();
|
||||
|
Loading…
x
Reference in New Issue
Block a user