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)
|
FormMain::FormMain(QWidget* parent, Qt::WindowFlags f)
|
||||||
: QMainWindow(parent, f), m_ui(new Ui::FormMain), m_trayMenu(nullptr), m_statusBar(nullptr) {
|
: QMainWindow(parent, f), m_ui(new Ui::FormMain), m_trayMenu(nullptr), m_statusBar(nullptr) {
|
||||||
qDebugNN << LOGSEC_GUI
|
qDebugNN << LOGSEC_GUI << "Creating main application form in thread:" << QUOTE_W_SPACE_DOT(getThreadID());
|
||||||
<< "Creating main application form in thread:" << QUOTE_W_SPACE_DOT(getThreadID());
|
|
||||||
// setAttribute(Qt::WA_WindowPropagation, true);
|
// setAttribute(Qt::WA_WindowPropagation, true);
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
qApp->setMainForm(this);
|
qApp->setMainForm(this);
|
||||||
@ -190,6 +189,7 @@ QList<QAction*> FormMain::allActions() const {
|
|||||||
actions << m_ui->m_actionPlaySelectedArticlesInMediaPlayer;
|
actions << m_ui->m_actionPlaySelectedArticlesInMediaPlayer;
|
||||||
actions << m_ui->m_actionOpenSelectedMessagesInternallyNoTab;
|
actions << m_ui->m_actionOpenSelectedMessagesInternallyNoTab;
|
||||||
actions << m_ui->m_actionAlternateColorsInLists;
|
actions << m_ui->m_actionAlternateColorsInLists;
|
||||||
|
actions << m_ui->m_actionPauseFeedFetching;
|
||||||
actions << m_ui->m_actionMessagePreviewEnabled;
|
actions << m_ui->m_actionMessagePreviewEnabled;
|
||||||
actions << m_ui->m_actionMarkAllItemsRead;
|
actions << m_ui->m_actionMarkAllItemsRead;
|
||||||
actions << m_ui->m_actionMarkSelectedItemsAsRead;
|
actions << m_ui->m_actionMarkSelectedItemsAsRead;
|
||||||
@ -598,6 +598,8 @@ void FormMain::setupIcons() {
|
|||||||
// Feeds/messages.
|
// Feeds/messages.
|
||||||
m_ui->m_menuAddItem->setIcon(icon_theme_factory->fromTheme(QSL("list-add")));
|
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_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_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_actionUpdateSelectedItems->setIcon(icon_theme_factory->fromTheme(QSL("download"), QSL("browser-download")));
|
||||||
m_ui->m_actionUpdateSelectedItemsWithCustomTimers->setIcon(icon_theme_factory->fromTheme(QSL("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());
|
->setChecked(settings->value(GROUP(GUI), SETTING(GUI::MessageViewerToolbarsVisible)).toBool());
|
||||||
m_ui->m_actionSwitchStatusBar->setChecked(settings->value(GROUP(GUI), SETTING(GUI::StatusBarVisible)).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
|
m_ui->m_actionSortFeedsAlphabetically
|
||||||
->setChecked(settings->value(GROUP(Feeds), SETTING(Feeds::SortAlphabetically)).toBool());
|
->setChecked(settings->value(GROUP(Feeds), SETTING(Feeds::SortAlphabetically)).toBool());
|
||||||
m_ui->m_actionShowOnlyUnreadItems
|
m_ui->m_actionShowOnlyUnreadItems
|
||||||
@ -721,6 +723,8 @@ void FormMain::loadSize() {
|
|||||||
->setChecked(settings->value(GROUP(Feeds), SETTING(Feeds::AutoExpandOnSelection)).toBool());
|
->setChecked(settings->value(GROUP(Feeds), SETTING(Feeds::AutoExpandOnSelection)).toBool());
|
||||||
m_ui->m_actionAlternateColorsInLists
|
m_ui->m_actionAlternateColorsInLists
|
||||||
->setChecked(settings->value(GROUP(GUI), SETTING(GUI::AlternateRowColorsInLists)).toBool());
|
->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() {
|
void FormMain::saveSize() {
|
||||||
@ -1027,6 +1031,7 @@ void FormMain::createConnections() {
|
|||||||
&QAction::toggled,
|
&QAction::toggled,
|
||||||
tabWidget()->feedMessageViewer(),
|
tabWidget()->feedMessageViewer(),
|
||||||
&FeedMessageViewer::alternateRowColorsInLists);
|
&FeedMessageViewer::alternateRowColorsInLists);
|
||||||
|
connect(m_ui->m_actionPauseFeedFetching, &QAction::toggled, qApp->feedReader(), &FeedReader::pauseUnpaseFeedFetching);
|
||||||
connect(m_ui->m_actionRestoreSelectedMessages,
|
connect(m_ui->m_actionRestoreSelectedMessages,
|
||||||
&QAction::triggered,
|
&QAction::triggered,
|
||||||
tabWidget()->feedMessageViewer()->messagesView(),
|
tabWidget()->feedMessageViewer()->messagesView(),
|
||||||
|
@ -123,6 +123,7 @@
|
|||||||
<addaction name="m_actionUpdateSelectedItems"/>
|
<addaction name="m_actionUpdateSelectedItems"/>
|
||||||
<addaction name="m_actionUpdateSelectedItemsWithCustomTimers"/>
|
<addaction name="m_actionUpdateSelectedItemsWithCustomTimers"/>
|
||||||
<addaction name="m_actionStopRunningItemsUpdate"/>
|
<addaction name="m_actionStopRunningItemsUpdate"/>
|
||||||
|
<addaction name="m_actionPauseFeedFetching"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="m_menuAddItem"/>
|
<addaction name="m_menuAddItem"/>
|
||||||
<addaction name="m_actionEditSelectedItem"/>
|
<addaction name="m_actionEditSelectedItem"/>
|
||||||
@ -233,7 +234,7 @@
|
|||||||
<string notr="true">Ctrl+Q</string>
|
<string notr="true">Ctrl+Q</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="menuRole">
|
<property name="menuRole">
|
||||||
<enum>QAction::QuitRole</enum>
|
<enum>QAction::MenuRole::QuitRole</enum>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="m_actionSettings">
|
<action name="m_actionSettings">
|
||||||
@ -258,7 +259,7 @@
|
|||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="menuRole">
|
<property name="menuRole">
|
||||||
<enum>QAction::AboutRole</enum>
|
<enum>QAction::MenuRole::AboutRole</enum>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="m_actionFullscreen">
|
<action name="m_actionFullscreen">
|
||||||
@ -951,6 +952,14 @@
|
|||||||
<string>Play in &media player</string>
|
<string>Play in &media player</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="m_actionPauseFeedFetching">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Pause automatic feed fetching</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
FeedReader::FeedReader(QObject* parent)
|
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_feedsModel = new FeedsModel(this);
|
||||||
m_feedsProxyModel = new FeedsProxyModel(m_feedsModel, this);
|
m_feedsProxyModel = new FeedsProxyModel(m_feedsModel, this);
|
||||||
m_messagesModel = new MessagesModel(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 {
|
bool FeedReader::isFeedUpdateRunning() const {
|
||||||
return m_feedDownloader != nullptr && m_feedDownloader->isUpdateRunning();
|
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
|
// Skip this round of auto-updating, but only if user disabled it when main window is active
|
||||||
// and there are no caches to synchronize.
|
// 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 "
|
qDebugNN << LOGSEC_CORE << "Delaying scheduled feed auto-download for some time since window "
|
||||||
<< "is focused and updates while focused are disabled by the "
|
<< "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.
|
// Cannot update, quit.
|
||||||
return;
|
return;
|
||||||
@ -319,7 +333,6 @@ void FeedReader::executeNextAutoUpdate() {
|
|||||||
if (!qApp->feedUpdateLock()->tryLock()) {
|
if (!qApp->feedUpdateLock()->tryLock()) {
|
||||||
qDebugNN << LOGSEC_CORE << "Delaying scheduled feed auto-downloads and message state synchronization for "
|
qDebugNN << LOGSEC_CORE << "Delaying scheduled feed auto-downloads and message state synchronization for "
|
||||||
<< "some time due to another running update.";
|
<< "some time due to another running update.";
|
||||||
|
|
||||||
// Cannot update, quit.
|
// Cannot update, quit.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -333,9 +346,9 @@ void FeedReader::executeNextAutoUpdate() {
|
|||||||
synchronizeMessageData(caches);
|
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 "
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@ class RSSGUARD_DLLSPEC FeedReader : public QObject {
|
|||||||
FeedsProxyModel* feedsProxyModel() const;
|
FeedsProxyModel* feedsProxyModel() const;
|
||||||
MessagesProxyModel* messagesProxyModel() const;
|
MessagesProxyModel* messagesProxyModel() const;
|
||||||
|
|
||||||
|
void warnAboutPausedFetching() const;
|
||||||
|
|
||||||
// Update feeds in extra thread.
|
// Update feeds in extra thread.
|
||||||
void updateFeeds(const QList<Feed*>& feeds, bool update_switched_off_too = false);
|
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 updateAllFeeds();
|
||||||
void updateManuallyIntervaledFeeds();
|
void updateManuallyIntervaledFeeds();
|
||||||
void stopRunningFeedUpdate();
|
void stopRunningFeedUpdate();
|
||||||
|
void pauseUnpaseFeedFetching(bool pause);
|
||||||
void quit();
|
void quit();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@ -97,6 +100,7 @@ class RSSGUARD_DLLSPEC FeedReader : public QObject {
|
|||||||
QDateTime m_lastAutoUpdate;
|
QDateTime m_lastAutoUpdate;
|
||||||
QThread* m_feedDownloaderThread;
|
QThread* m_feedDownloaderThread;
|
||||||
FeedDownloader* m_feedDownloader;
|
FeedDownloader* m_feedDownloader;
|
||||||
|
bool m_feedFetchingPaused;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FEEDREADER_H
|
#endif // FEEDREADER_H
|
||||||
|
@ -98,6 +98,9 @@ DVALUE(char*) Feeds::CountFormatDef = "(%unread)";
|
|||||||
DKEY Feeds::EnableTooltipsFeedsMessages = "show_tooltips";
|
DKEY Feeds::EnableTooltipsFeedsMessages = "show_tooltips";
|
||||||
DVALUE(bool) Feeds::EnableTooltipsFeedsMessagesDef = true;
|
DVALUE(bool) Feeds::EnableTooltipsFeedsMessagesDef = true;
|
||||||
|
|
||||||
|
DKEY Feeds::PauseFeedFetching = "pause_feed_fetching";
|
||||||
|
DVALUE(bool) Feeds::PauseFeedFetchingDef = false;
|
||||||
|
|
||||||
DKEY Feeds::AutoUpdateInterval = "auto_update_interval";
|
DKEY Feeds::AutoUpdateInterval = "auto_update_interval";
|
||||||
DVALUE(int) Feeds::AutoUpdateIntervalDef = DEFAULT_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";
|
DKEY GUI::FeedsToolbarActions = "feeds_toolbar";
|
||||||
DVALUE(char*)
|
DVALUE(char*)
|
||||||
GUI::FeedsToolbarActionsDef =
|
GUI::FeedsToolbarActionsDef = "m_actionUpdateAllItems,m_actionStopRunningItemsUpdate,m_actionPauseFeedFetching,m_"
|
||||||
"m_actionUpdateAllItems,m_actionStopRunningItemsUpdate,m_actionMarkAllItemsRead,spacer,search";
|
"actionMarkAllItemsRead,spacer,search";
|
||||||
|
|
||||||
DKEY GUI::StatusbarActions = "status_bar";
|
DKEY GUI::StatusbarActions = "status_bar";
|
||||||
DVALUE(char*)
|
DVALUE(char*)
|
||||||
|
@ -94,6 +94,9 @@ namespace Feeds {
|
|||||||
KEY EnableTooltipsFeedsMessages;
|
KEY EnableTooltipsFeedsMessages;
|
||||||
VALUE(bool) EnableTooltipsFeedsMessagesDef;
|
VALUE(bool) EnableTooltipsFeedsMessagesDef;
|
||||||
|
|
||||||
|
KEY PauseFeedFetching;
|
||||||
|
VALUE(bool) PauseFeedFetchingDef;
|
||||||
|
|
||||||
KEY AutoUpdateInterval;
|
KEY AutoUpdateInterval;
|
||||||
VALUE(int) AutoUpdateIntervalDef;
|
VALUE(int) AutoUpdateIntervalDef;
|
||||||
|
|
||||||
|
@ -127,6 +127,7 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
qApp->loadDynamicShortcuts();
|
qApp->loadDynamicShortcuts();
|
||||||
qApp->hideOrShowMainForm();
|
qApp->hideOrShowMainForm();
|
||||||
|
qApp->feedReader()->warnAboutPausedFetching();
|
||||||
qApp->feedReader()->loadSavedMessageFilters();
|
qApp->feedReader()->loadSavedMessageFilters();
|
||||||
qApp->feedReader()->feedsModel()->loadActivatedServiceAccounts();
|
qApp->feedReader()->feedsModel()->loadActivatedServiceAccounts();
|
||||||
qApp->showTrayIcon();
|
qApp->showTrayIcon();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user