Refactoring.

This commit is contained in:
Martin Rotter 2016-08-15 10:49:09 +02:00
parent 7a42e2d7a1
commit 15fed666d9
7 changed files with 48 additions and 8 deletions

View File

@ -1,3 +1,9 @@
3.3.4
—————
Changed:
▪ Big application core refactoring. Many functions rewritten, some bad code removed.
3.3.3
—————

View File

@ -323,6 +323,21 @@ void FormMain::updateAccountsMenu() {
m_ui->m_menuAccounts->addAction(m_ui->m_actionServiceDelete);
}
void FormMain::onFeedUpdatesStarted() {
m_ui->m_actionStopRunningItemsUpdate->setEnabled(false);
statusBar()->showProgressFeeds(0, tr("Feed update started"));
}
void FormMain::onFeedUpdatesProgress(const Feed *feed, int current, int total) {
statusBar()->showProgressFeeds((current * 100.0) / total,
//: Text display in status bar when particular feed is updated.
tr("Updated feed '%1'").arg(feed->title()));
}
void FormMain::onFeedUpdatesFinished(FeedDownloadResults results) {
statusBar()->clearProgressFeeds();
}
void FormMain::switchVisibility(bool force_hide) {
if (force_hide || isVisible()) {
if (SystemTrayIcon::isSystemTrayActivated()) {

View File

@ -78,6 +78,10 @@ class FormMain : public QMainWindow {
void updateRecycleBinMenu();
void updateAccountsMenu();
void onFeedUpdatesStarted();
void onFeedUpdatesProgress(const Feed *feed, int current, int total);
void onFeedUpdatesFinished(FeedDownloadResults results);
// Displays various dialogs.
void backupDatabaseSettings();
void restoreDatabaseSettings();

View File

@ -438,10 +438,3 @@ void FeedMessageViewer::refreshVisualProperties() {
void FeedMessageViewer::onFeedsUpdateFinished() {
m_messagesView->reloadSelections(false);
}
void FeedMessageViewer::onFeedsUpdateStarted() {
// Check only "Stop running update" button.
const bool is_update_running = qApp->feedReader()->isFeedUpdateRunning();
qApp->mainForm()->m_ui->m_actionStopRunningItemsUpdate->setEnabled(is_update_running);
}

View File

@ -75,7 +75,6 @@ class FeedMessageViewer : public TabContent {
private slots:
// Called when feed update finishes.
void onFeedsUpdateFinished();
void onFeedsUpdateStarted();
// Switches visibility of feed list and related
// toolbar.

View File

@ -341,3 +341,21 @@ void Application::downloadRequested(QWebEngineDownloadItem *download_item) {
download_item->cancel();
download_item->deleteLater();
}
void Application::onFeedUpdatesStarted() {
}
void Application::onFeedUpdatesProgress(const Feed *feed, int current, int total) {
Q_UNUSED(feed)
Q_UNUSED(current)
Q_UNUSED(total)
}
void Application::onFeedUpdatesFinished(FeedDownloadResults results) {
qApp->feedUpdateLock()->unlock();
if (!results.updatedFeeds().isEmpty()) {
// Now, inform about results via GUI message/notification.
qApp->showGuiMessage(tr("New messages downloaded"), results.overview(10), QSystemTrayIcon::NoIcon, 0, false);
}
}

View File

@ -30,6 +30,7 @@
#include "gui/systemtrayicon.h"
#include "network-web/downloadmanager.h"
#include "services/abstract/serviceentrypoint.h"
#include "core/feeddownloader.h"
#include <QList>
@ -131,6 +132,10 @@ class Application : public QtSingleApplication {
void onAboutToQuit();
void downloadRequested(QWebEngineDownloadItem*download_item);
void onFeedUpdatesStarted();
void onFeedUpdatesProgress(const Feed *feed, int current, int total);
void onFeedUpdatesFinished(FeedDownloadResults results);
private:
void eliminateFirstRun();
void eliminateFirstRun(const QString &version);