Work on refactoring.

This commit is contained in:
Martin Rotter 2014-08-19 17:21:32 +02:00
parent 048d2ae063
commit 4dd45c3f75
18 changed files with 2429 additions and 270 deletions

View File

@ -481,6 +481,7 @@ set(APP_TRANSLATIONS
localization/rssguard-de_DE.ts
localization/rssguard-en_GB.ts
localization/rssguard-fr_FR.ts
localization/rssguard-it_IT.ts
localization/rssguard-nl_NL.ts
localization/qt-cs_CZ.ts
localization/qt-de_DE.ts
@ -493,6 +494,7 @@ set(APP_TRANSLATIONS_WO_QT
localization/rssguard-de_DE.ts
localization/rssguard-en_GB.ts
localization/rssguard-fr_FR.ts
localization/rssguard-it_IT.ts
localization/rssguard-nl_NL.ts
)

View File

@ -192,9 +192,6 @@ Status auto-aktualizace: %5</translation>
</message>
<message>
<source>Cannot edit item</source>
<extracomment>Warning messagebox title when selected item cannot be edited.
----------
Warning messagebox title when selected item cannot be edited.</extracomment>
<translation>Nelze upravit položku</translation>
</message>
<message>
@ -225,15 +222,6 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<source>You cannot update selected items because another feed update is ongoing.</source>
<translation>Právě nyní nemůžete aktualizovat vybrané položky, protože nejspíše probíhá jiná aktualizace.</translation>
</message>
<message>
<source>Scheduled update started</source>
<translation>Naplánovaná aktualizace kanálu odstartována</translation>
</message>
<message>
<source>%1 is performing scheduled update of some feeds.</source>
<extracomment>RSS Guard is performing updates right now.</extracomment>
<translation>%1 právě aktualizuje kanály.</translation>
</message>
</context>
<context>
<name>FormAbout</name>
@ -419,6 +407,13 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<translation>Použít výchozí ikonu</translation>
</message>
</context>
<context>
<name>FormExport</name>
<message>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormFeedDetails</name>
<message>
@ -1009,6 +1004,22 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<source>&amp;Feed/message list headers</source>
<translation>&amp;Hlavičky seznamů zpráv/kanálů</translation>
</message>
<message>
<source>&amp;Import feeds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Imports feeds you want from selected file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Export feeds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Imports feeds you want to selected file.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormSettings</name>
@ -1127,10 +1138,6 @@ Language column of language list.</extracomment>
<source>Http</source>
<translation></translation>
</message>
<message>
<source>Do you want to restart now?</source>
<translation>Chcete restartovat nyní?</translation>
</message>
<message>
<source> (not supported on this platform)</source>
<translation> (na této platformě nepodporováno)</translation>
@ -1213,22 +1220,10 @@ Language column of language list.</extracomment>
<source>Hide tab bar if just one tab is visible</source>
<translation>Skrýt přepínač tabů, je-li viditelný pouze jeden tab</translation>
</message>
<message>
<source>Some critical settings were changed and will be applied after the application gets restarted.</source>
<translation>Některá kritická nastavení se změnila a pro jejich aplikování je třeba restartovat aplikaci.</translation>
</message>
<message>
<source>Critical settings were changed</source>
<translation>Kritická nastavení změněna</translation>
</message>
<message>
<source>Problem with application restart</source>
<translation>Problém s restartováním aplikace</translation>
</message>
<message>
<source>Application couldn&apos;t be restarted. Please, restart it manually for changes to take effect.</source>
<translation>Aplikaci se nepodařilo restartovat. Prosím, restartuje ji manuálně.</translation>
</message>
<message>
<source>Feeds &amp; messages</source>
<translation>Kanály &amp; zprávy</translation>
@ -1582,6 +1577,12 @@ Autoři této aplikace nenesou žádnou odpovědnost za ztrátu Vašich dat.</tr
<source>Select toolbar to edit</source>
<translation>Zvolte lištu, kterou chcete upravit</translation>
</message>
<message>
<source>Some critical settings were changed and will be applied after the application gets restarted.
You have to restart manually.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormUpdate</name>
@ -2038,10 +2039,6 @@ Přejít na web aplikace a stáhnout jej ručně.</translation>
</context>
<context>
<name>ToolBarEditor</name>
<message>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Activated actions</source>
<translation>Aktivované akce</translation>

View File

@ -182,9 +182,6 @@ Auto-update status: %5</source>
</message>
<message>
<source>Cannot edit item</source>
<extracomment>Warning messagebox title when selected item cannot be edited.
----------
Warning messagebox title when selected item cannot be edited.</extracomment>
<translation>Kann das Item nicht editieren</translation>
</message>
<message>
@ -215,15 +212,6 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<source>You cannot update selected items because another feed update is ongoing.</source>
<translation>Sie können die selektierten Items nicht updaten weil ein anderer Feed-Update läuft.</translation>
</message>
<message>
<source>Scheduled update started</source>
<translation>Geplanter Update gestartet</translation>
</message>
<message>
<source>%1 is performing scheduled update of some feeds.</source>
<extracomment>RSS Guard is performing updates right now.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormAbout</name>
@ -409,6 +397,13 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<translation type="unfinished">Standard-Icon verwenden</translation>
</message>
</context>
<context>
<name>FormExport</name>
<message>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormFeedDetails</name>
<message>
@ -999,6 +994,22 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<source>&amp;Feed/message list headers</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Import feeds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Imports feeds you want from selected file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Export feeds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Imports feeds you want to selected file.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormSettings</name>
@ -1117,10 +1128,6 @@ Language column of language list.</extracomment>
<source>Http</source>
<translation>Http</translation>
</message>
<message>
<source>Do you want to restart now?</source>
<translation>Wollen Sie jetzt neu starten?</translation>
</message>
<message>
<source> (not supported on this platform)</source>
<translation>(nicht verfügbar auf dieser Plattform)</translation>
@ -1203,22 +1210,10 @@ Language column of language list.</extracomment>
<source>Hide tab bar if just one tab is visible</source>
<translation>Verstecke die Reiterleiste falls nur ein Reiter sichtbar ist</translation>
</message>
<message>
<source>Some critical settings were changed and will be applied after the application gets restarted.</source>
<translation>Ein paar kritische Einstellungen wurden geändert und werden nach dem Programmneustart angewendet.</translation>
</message>
<message>
<source>Critical settings were changed</source>
<translation>Kritische Einstellungen wurden geändert</translation>
</message>
<message>
<source>Problem with application restart</source>
<translation>Problem mit Programmneustart</translation>
</message>
<message>
<source>Application couldn&apos;t be restarted. Please, restart it manually for changes to take effect.</source>
<translation>Die Applikation konnte nicht neu gestartet werden. Bitte starten Sie sie neu damit die Änderungen angewendet werden können.</translation>
</message>
<message>
<source>Feeds &amp; messages</source>
<translation>Feeds &amp; Nachrichten</translation>
@ -1556,6 +1551,12 @@ Authors of this application are NOT responsible for lost data.</source>
<source>Select toolbar to edit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Some critical settings were changed and will be applied after the application gets restarted.
You have to restart manually.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormUpdate</name>
@ -2014,10 +2015,6 @@ Go to application website to obtain it manually.</source>
</context>
<context>
<name>ToolBarEditor</name>
<message>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Activated actions</source>
<translation type="unfinished"></translation>

View File

@ -182,9 +182,6 @@ Auto-update status: %5</source>
</message>
<message>
<source>Cannot edit item</source>
<extracomment>Warning messagebox title when selected item cannot be edited.
----------
Warning messagebox title when selected item cannot be edited.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
@ -215,15 +212,6 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<source>You cannot update selected items because another feed update is ongoing.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Scheduled update started</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 is performing scheduled update of some feeds.</source>
<extracomment>RSS Guard is performing updates right now.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormAbout</name>
@ -409,6 +397,13 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormExport</name>
<message>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormFeedDetails</name>
<message>
@ -999,6 +994,22 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<source>&amp;Feed/message list headers</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Import feeds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Imports feeds you want from selected file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Export feeds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Imports feeds you want to selected file.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormSettings</name>
@ -1117,10 +1128,6 @@ Language column of language list.</extracomment>
<source>Http</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to restart now?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> (not supported on this platform)</source>
<translation type="unfinished"></translation>
@ -1203,22 +1210,10 @@ Language column of language list.</extracomment>
<source>Hide tab bar if just one tab is visible</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Some critical settings were changed and will be applied after the application gets restarted.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Critical settings were changed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Problem with application restart</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Application couldn&apos;t be restarted. Please, restart it manually for changes to take effect.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Feeds &amp; messages</source>
<translation type="unfinished"></translation>
@ -1554,6 +1549,12 @@ Authors of this application are NOT responsible for lost data.</source>
<source>Select toolbar to edit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Some critical settings were changed and will be applied after the application gets restarted.
You have to restart manually.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormUpdate</name>
@ -2009,10 +2010,6 @@ Go to application website to obtain it manually.</source>
</context>
<context>
<name>ToolBarEditor</name>
<message>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Activated actions</source>
<translation type="unfinished"></translation>

View File

@ -188,9 +188,6 @@ Statut de la mise à jour automatique : %5</translation>
</message>
<message>
<source>Cannot edit item</source>
<extracomment>Warning messagebox title when selected item cannot be edited.
----------
Warning messagebox title when selected item cannot be edited.</extracomment>
<translation>Impossible d&apos;éditer l&apos;article</translation>
</message>
<message>
@ -221,15 +218,6 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<source>You cannot update selected items because another feed update is ongoing.</source>
<translation>Vous ne pouvez pas mettre à jour les articles sélectionnés car une autre mise à jour est en cours sur les flux.</translation>
</message>
<message>
<source>Scheduled update started</source>
<translation>La mise à jour programmée a commencée</translation>
</message>
<message>
<source>%1 is performing scheduled update of some feeds.</source>
<extracomment>RSS Guard is performing updates right now.</extracomment>
<translation>%1 effectue la mise à jour programmée de certains flux.</translation>
</message>
</context>
<context>
<name>FormAbout</name>
@ -415,6 +403,13 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<translation type="unfinished">Utiliser les icônes par défaut</translation>
</message>
</context>
<context>
<name>FormExport</name>
<message>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormFeedDetails</name>
<message>
@ -1005,6 +1000,22 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<source>&amp;Feed/message list headers</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Import feeds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Imports feeds you want from selected file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Export feeds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Imports feeds you want to selected file.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormSettings</name>
@ -1123,10 +1134,6 @@ Language column of language list.</extracomment>
<source>Http</source>
<translation>Http</translation>
</message>
<message>
<source>Do you want to restart now?</source>
<translation>Voulez vous redémarrer maintenant ?</translation>
</message>
<message>
<source> (not supported on this platform)</source>
<translation>(non supporté sur cette plate-forme)</translation>
@ -1209,22 +1216,10 @@ Language column of language list.</extracomment>
<source>Hide tab bar if just one tab is visible</source>
<translation>Masquer la barre des onglets si un seul est visible</translation>
</message>
<message>
<source>Some critical settings were changed and will be applied after the application gets restarted.</source>
<translation>Certains paramètres critiques ont changés et ils seront appliqués après le redémarrage de l&apos;application.</translation>
</message>
<message>
<source>Critical settings were changed</source>
<translation>Les paramètres important ont changé</translation>
</message>
<message>
<source>Problem with application restart</source>
<translation>Problème avec le redémarrage de l&apos;application</translation>
</message>
<message>
<source>Application couldn&apos;t be restarted. Please, restart it manually for changes to take effect.</source>
<translation>L&apos;application ne peut être redémarrée. Redémarrer la manuellement pour que les changements prennent effet, s&apos;il vous plait.</translation>
</message>
<message>
<source>Feeds &amp; messages</source>
<translation>Flux &amp; messages</translation>
@ -1578,6 +1573,12 @@ Les auteurs de cette application NE sont PAS responsable de la perte de données
<source>Select toolbar to edit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Some critical settings were changed and will be applied after the application gets restarted.
You have to restart manually.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormUpdate</name>
@ -2037,10 +2038,6 @@ Aller sur le site de l&apos;application pour les obtenir manuellement.</translat
</context>
<context>
<name>ToolBarEditor</name>
<message>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Activated actions</source>
<translation type="unfinished"></translation>

File diff suppressed because it is too large Load Diff

View File

@ -189,9 +189,6 @@ Status automatisch bijwerken: %5</translation>
</message>
<message>
<source>Cannot edit item</source>
<extracomment>Warning messagebox title when selected item cannot be edited.
----------
Warning messagebox title when selected item cannot be edited.</extracomment>
<translation>Kan item niet bewerken</translation>
</message>
<message>
@ -222,15 +219,6 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<source>You cannot update selected items because another feed update is ongoing.</source>
<translation>Je kan gekozen items niet bijwerken omdat feeds aan het updaten zijn.</translation>
</message>
<message>
<source>Scheduled update started</source>
<translation>Geplande update begint</translation>
</message>
<message>
<source>%1 is performing scheduled update of some feeds.</source>
<extracomment>RSS Guard is performing updates right now.</extracomment>
<translation>%1 is geplande updates van sommige feeds aan het uitvoeren.</translation>
</message>
</context>
<context>
<name>FormAbout</name>
@ -416,6 +404,13 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<translation>Gebruik standaard pictogram</translation>
</message>
</context>
<context>
<name>FormExport</name>
<message>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormFeedDetails</name>
<message>
@ -1006,6 +1001,22 @@ Warning messagebox title when selected item cannot be edited.</extracomment>
<source>&amp;Feed/message list headers</source>
<translation>&amp;Feed/bericht kopteksten</translation>
</message>
<message>
<source>&amp;Import feeds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Imports feeds you want from selected file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Export feeds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Imports feeds you want to selected file.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormSettings</name>
@ -1124,10 +1135,6 @@ Language column of language list.</extracomment>
<source>Http</source>
<translation>Http</translation>
</message>
<message>
<source>Do you want to restart now?</source>
<translation>Wil je nu herstarten?</translation>
</message>
<message>
<source> (not supported on this platform)</source>
<translation> (Platform wordt niet ondersteunt)</translation>
@ -1210,22 +1217,10 @@ Language column of language list.</extracomment>
<source>Hide tab bar if just one tab is visible</source>
<translation>Verberg tabblad als alleen een tabblad zichtbaar is</translation>
</message>
<message>
<source>Some critical settings were changed and will be applied after the application gets restarted.</source>
<translation>Sommige kritieke instellingen zijn veranderd en worden van kracht als het programma wordt herstart.</translation>
</message>
<message>
<source>Critical settings were changed</source>
<translation>Kritieke instellingen zijn veranderd</translation>
</message>
<message>
<source>Problem with application restart</source>
<translation>Probleem met programma herstart</translation>
</message>
<message>
<source>Application couldn&apos;t be restarted. Please, restart it manually for changes to take effect.</source>
<translation>Programma kan niet worden herstart. Herstart het handmatig zodat de veranderingen worden doorgevoerd.</translation>
</message>
<message>
<source>Feeds &amp; messages</source>
<translation>Feeds &amp; berichten</translation>
@ -1580,6 +1575,12 @@ Auteurs van Rssguard zijn NIET verantwoordelijk voor verlies van gegevens.</tran
<source>Select toolbar to edit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Some critical settings were changed and will be applied after the application gets restarted.
You have to restart manually.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FormUpdate</name>
@ -2039,10 +2040,6 @@ Ga naar RRSguard website en download het handmatig.</translation>
</context>
<context>
<name>ToolBarEditor</name>
<message>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Activated actions</source>
<translation type="unfinished"></translation>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -25,7 +25,7 @@
Application::Application(const QString &id, int &argc, char **argv)
: QtSingleApplication(id, argc, argv), m_closeLock(NULL), m_mainForm(NULL), m_trayIcon(NULL), m_settings(NULL) {
: QtSingleApplication(id, argc, argv), m_closeLock(NULL), m_mainForm(NULL), m_trayIcon(NULL), m_settings(NULL), m_system(NULL) {
}
Application::~Application() {
@ -49,11 +49,13 @@ void Application::showTrayIcon() {
if (m_mainForm != NULL) {
m_mainForm->tabWidget()->feedMessageViewer()->feedsView()->notifyWithCounts();
}
qDebug("Showing tray icon.");
}
void Application::deleteTrayIcon() {
if (m_trayIcon != NULL) {
qDebug("Disabling tray icon and raising main application window.");
qDebug("Disabling tray icon, deleting it and raising main application window.");
m_mainForm->display();
delete m_trayIcon;
@ -66,13 +68,12 @@ void Application::deleteTrayIcon() {
void Application::showGuiMessage(const QString& title, const QString& message,
QSystemTrayIcon::MessageIcon message_type,
QWidget* parent, int duration) {
QWidget *parent, int duration) {
if (SystemTrayIcon::isSystemTrayActivated()) {
trayIcon()->showMessage(title, message, message_type, duration);
}
else {
// TODO: Tray icon or OSD is not available, display simple text box.
MessageBox::show(parent, (QMessageBox::Icon) message_type,
title, message);
MessageBox::show(parent, (QMessageBox::Icon) message_type, title, message);
}
}

View File

@ -22,6 +22,7 @@
#include "definitions/definitions.h"
#include "miscellaneous/settings.h"
#include "miscellaneous/systemfactory.h"
#include "gui/systemtrayicon.h"
#include <QMutex>
@ -45,6 +46,14 @@ class Application : public QtSingleApplication {
explicit Application(const QString &id, int &argc, char **argv);
virtual ~Application();
inline SystemFactory *system() {
if (m_system == NULL) {
m_system = new SystemFactory(this);
}
return m_system;
}
inline Settings *settings() {
if (m_settings == NULL) {
m_settings = Settings::setupSettings(this);
@ -73,15 +82,14 @@ class Application : public QtSingleApplication {
// Access to application tray icon. Always use this in cooperation with
// SystemTrayIcon::isSystemTrayActivated().
SystemTrayIcon *trayIcon();
void showTrayIcon();
void deleteTrayIcon();
// Displays given simple message in tray icon bubble or OSD
// or in message box if tray icon is disabled.
void showGuiMessage(const QString &title, const QString &message,
QSystemTrayIcon::MessageIcon message_type,
QWidget *parent = NULL,
int duration = TRAY_ICON_BUBBLE_TIMEOUT);
void showGuiMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon message_type,
QWidget *parent = NULL, int duration = TRAY_ICON_BUBBLE_TIMEOUT);
// Returns pointer to "GOD" application singleton.
inline static Application *instance() {
@ -105,6 +113,7 @@ class Application : public QtSingleApplication {
FormMain *m_mainForm;
SystemTrayIcon *m_trayIcon;
Settings *m_settings;
SystemFactory *m_system;
};
#endif // APPLICATION_H

View File

@ -31,8 +31,7 @@ FeedDownloader::~FeedDownloader() {
}
void FeedDownloader::updateFeeds(const QList<FeedsModelFeed*> &feeds) {
qDebug().nospace() << "Performing feed updates in thread: \'" <<
QThread::currentThreadId() << "\'.";
qDebug().nospace() << "Performing feed updates in thread: \'" << QThread::currentThreadId() << "\'.";
// Job starts now.
emit started();
@ -40,14 +39,12 @@ void FeedDownloader::updateFeeds(const QList<FeedsModelFeed*> &feeds) {
for (int i = 0, total = feeds.size(); i < total; i++) {
feeds.at(i)->update();
qDebug("Made progress in feed updates: %d/%d (id of feed is %d).",
i + 1, total, feeds.at(i)->id());
qDebug("Made progress in feed updates: %d/%d (id of feed is %d).", i + 1, total, feeds.at(i)->id());
emit progress(feeds.at(i), i + 1, total);
}
qDebug().nospace() << "Finished feed updates in thread: \'" <<
QThread::currentThreadId() << "\'.";
qDebug().nospace() << "Finished feed updates in thread: \'" << QThread::currentThreadId() << "\'.";
// Update of feeds has finished.
// NOTE: This means that now "update lock" can be unlocked

View File

@ -43,10 +43,8 @@ class FeedsModel : public QAbstractItemModel {
explicit FeedsModel(QObject *parent = 0);
virtual ~FeedsModel();
// Returns list of all indexes available
// in the model.
// NOTE: Overriden because original method
// is protected.
// Returns list of all indexes available in the model.
// NOTE: Overriden because original method is protected.
QModelIndexList persistentIndexList() const;
// Model implementation.
@ -61,7 +59,7 @@ class FeedsModel : public QAbstractItemModel {
int columnCount(const QModelIndex &parent) const;
int rowCount(const QModelIndex &parent) const;
// Returns couns of ALL/UNREAD (non-deleted) messages for the model.
// Returns counts of ALL/UNREAD (non-deleted) messages for the model.
inline int countOfAllMessages() const {
return m_rootItem->countOfAllMessages();
}
@ -74,20 +72,16 @@ class FeedsModel : public QAbstractItemModel {
bool removeItem(const QModelIndex &index);
// Standard category manipulators.
bool addCategory(FeedsModelCategory *category,
FeedsModelRootItem *parent);
bool editCategory(FeedsModelCategory *original_category,
FeedsModelCategory *new_category);
bool addCategory(FeedsModelCategory *category, FeedsModelRootItem *parent);
bool editCategory(FeedsModelCategory *original_category, FeedsModelCategory *new_category);
// Standard feed manipulators.
bool addFeed(FeedsModelFeed *feed,
FeedsModelRootItem *parent);
bool addFeed(FeedsModelFeed *feed, FeedsModelRootItem *parent);
// New feed is just temporary feed, it is not added to the model.
// It is used to fetch its data to the original feed
// and the original feed is moved if needed.
bool editFeed(FeedsModelFeed *original_feed,
FeedsModelFeed *new_feed);
bool editFeed(FeedsModelFeed *original_feed, FeedsModelFeed *new_feed);
// Returns the list of updates which should be updated
// according to auto-update schedule.

View File

@ -277,40 +277,16 @@ void FormSettings::loadWebBrowserColor(const QColor &color) {
void FormSettings::promptForRestart() {
if (m_changedDataTexts.count() > 0) {
QStringList changed_data_texts = m_changedDataTexts;
QStringList changed_settings_description = m_changedDataTexts.replaceInStrings(QRegExp("^"), QString::fromUtf8(""));
changed_data_texts.replaceInStrings(QRegExp("^"),
QString::fromUtf8(""));
int question_result = MessageBox::show(this,
QMessageBox::Question,
tr("Critical settings were changed"),
tr("Some critical settings were changed and will be applied after the application gets restarted."),
tr("Do you want to restart now?"),
tr("List of changes:\n%1.").arg(changed_data_texts.join(",\n")),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes);
if (question_result == QMessageBox::Yes) {
if (!QProcess::startDetached(qApp->applicationFilePath())) {
if (SystemTrayIcon::isSystemTrayActivated()) {
qApp->trayIcon()->showMessage(tr("Problem with application restart"),
tr("Application couldn't be restarted. "
"Please, restart it manually for changes to take effect."),
QSystemTrayIcon::Warning);
}
else {
MessageBox::show(this,
QMessageBox::Warning,
tr("Problem with application restart"),
tr("Application couldn't be restarted. "
"Please, restart it manually for changes to take effect."));
}
}
else {
qApp->quit();
}
}
MessageBox::show(this,
QMessageBox::Question,
tr("Critical settings were changed"),
tr("Some critical settings were changed and will be applied after the application gets restarted. "
"\n\nYou have to restart manually."),
QString(),
tr("List of changes:\n%1.").arg(changed_settings_description .join(",\n")),
QMessageBox::Ok, QMessageBox::Ok);
}
}
@ -647,7 +623,7 @@ void FormSettings::loadGeneral() {
m_ui->m_checkAutostart->setText(m_ui->m_checkAutostart->text().arg(APP_NAME));
// Load auto-start status.
SystemFactory::AutoStartStatus autostart_status = SystemFactory::instance()->getAutoStartStatus();
SystemFactory::AutoStartStatus autostart_status = qApp->system()->getAutoStartStatus();
switch (autostart_status) {
case SystemFactory::Enabled:
m_ui->m_checkAutostart->setChecked(true);
@ -667,10 +643,10 @@ void FormSettings::saveGeneral() {
// If auto-start feature is available and user wants
// to turn it on, then turn it on.
if (m_ui->m_checkAutostart->isChecked()) {
SystemFactory::instance()->setAutoStartStatus(SystemFactory::Enabled);
qApp->system()->setAutoStartStatus(SystemFactory::Enabled);
}
else {
SystemFactory::instance()->setAutoStartStatus(SystemFactory::Disabled);
qApp->system()->setAutoStartStatus(SystemFactory::Disabled);
}
}

View File

@ -69,7 +69,7 @@ bool FormUpdate::isSelfUpdateSupported() const {
}
void FormUpdate::checkForUpdates() {
QPair<UpdateInfo, QNetworkReply::NetworkError> update = SystemFactory::instance()->checkForUpdates();
QPair<UpdateInfo, QNetworkReply::NetworkError> update = qApp->system()->checkForUpdates();
m_updateInfo = update.first;

View File

@ -32,8 +32,6 @@
#include <QDomAttr>
QPointer<SystemFactory> SystemFactory::s_instance;
SystemFactory::SystemFactory(QObject *parent) : QObject(parent) {
}
@ -41,7 +39,6 @@ SystemFactory::~SystemFactory() {
qDebug("Destroying SystemFactory instance.");
}
SystemFactory::AutoStartStatus SystemFactory::getAutoStartStatus() {
// User registry way to auto-start the application on Windows.
#if defined(Q_OS_WIN)
@ -109,16 +106,6 @@ QString SystemFactory::getAutostartDesktopFileLocation() {
}
#endif
SystemFactory *SystemFactory::instance() {
if (s_instance.isNull()) {
s_instance = new SystemFactory(qApp);
}
return s_instance;
}
bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) {
SystemFactory::AutoStartStatus current_status = SystemFactory::getAutoStartStatus();
@ -165,9 +152,7 @@ QPair<UpdateInfo, QNetworkReply::NetworkError> SystemFactory::checkForUpdates()
QPair<UpdateInfo, QNetworkReply::NetworkError> result;
QByteArray releases_xml;
result.second = NetworkFactory::downloadFeedFile(RELEASES_LIST,
5000,
releases_xml);
result.second = NetworkFactory::downloadFeedFile(RELEASES_LIST, DOWNLOAD_TIMEOUT, releases_xml);
if (result.second == QNetworkReply::NoError) {
result.first = parseUpdatesFile(releases_xml);

View File

@ -43,8 +43,7 @@ class UpdateInfo {
Evolution
};
explicit UpdateInfo() {
m_availableVersion = m_changes = "";
explicit UpdateInfo() : m_availableVersion(QString()), m_changes(QString()) {
}
QString m_availableVersion;
@ -58,17 +57,7 @@ Q_DECLARE_METATYPE(UpdateInfo)
class SystemFactory : public QObject {
Q_OBJECT
private:
// Constructors and destructors.
explicit SystemFactory(QObject *parent = 0);
// Performs parsing of downloaded file with list of updates.
UpdateInfo parseUpdatesFile(const QByteArray &updates_file);
public:
// Constructors and destructors.
virtual ~SystemFactory();
// Specifies possible states of auto-start functionality.
enum AutoStartStatus {
Enabled,
@ -76,6 +65,12 @@ class SystemFactory : public QObject {
Unavailable
};
// Constructors and destructors.
explicit SystemFactory(QObject *parent = 0);
// Constructors and destructors.
virtual ~SystemFactory();
// Returns current status of auto-start function.
SystemFactory::AutoStartStatus getAutoStartStatus();
@ -93,11 +88,9 @@ class SystemFactory : public QObject {
// Tries to download list with new updates.
QPair<UpdateInfo, QNetworkReply::NetworkError> checkForUpdates();
// Singleton getter.
static SystemFactory *instance();
private:
static QPointer<SystemFactory> s_instance;
// Performs parsing of downloaded file with list of updates.
UpdateInfo parseUpdatesFile(const QByteArray &updates_file);
};
#endif // SYSTEMFACTORY_H

View File

@ -28,25 +28,23 @@ TextFactory::TextFactory() {
}
QDateTime TextFactory::parseDateTime(const QString &date_time) {
QString date = date_time.simplified();
QStringList date_patterns;
QStringList timezone_offset_patterns;
QString input_date = date_time.simplified();
QDateTime dt;
QTime time_zone_offset;
QLocale locale(QLocale::C);
bool positive_time_zone_offset = false;
date_patterns << "yyyy-MM-ddTHH:mm:ss" << "MMM dd yyyy hh:mm:ss" <<
"MMM d yyyy hh:mm:ss" << "ddd, dd MMM yyyy HH:mm:ss" <<
"dd MMM yyyy" << "yyyy-MM-dd HH:mm:ss.z" << "yyyy-MM-dd" <<
"yyyy" << "yyyy-MM" << "yyyy-MM-dd" << "yyyy-MM-ddThh:mm" <<
"yyyy-MM-ddThh:mm:ss";
QStringList date_patterns; date_patterns << "yyyy-MM-ddTHH:mm:ss" << "MMM dd yyyy hh:mm:ss" <<
"MMM d yyyy hh:mm:ss" << "ddd, dd MMM yyyy HH:mm:ss" <<
"dd MMM yyyy" << "yyyy-MM-dd HH:mm:ss.z" << "yyyy-MM-dd" <<
"yyyy" << "yyyy-MM" << "yyyy-MM-dd" << "yyyy-MM-ddThh:mm" <<
"yyyy-MM-ddThh:mm:ss";
timezone_offset_patterns << "+hh:mm" << "-hh:mm" << "+hhmm" << "-hhmm" << "+hh" << "-hh";
QStringList timezone_offset_patterns; timezone_offset_patterns << "+hh:mm" << "-hh:mm" << "+hhmm" << "-hhmm" << "+hh" << "-hh";
if (date.size() >= TIMEZONE_OFFSET_LIMIT) {
if (input_date.size() >= TIMEZONE_OFFSET_LIMIT) {
foreach (const QString &pattern, timezone_offset_patterns) {
time_zone_offset = QTime::fromString(date.right(pattern.size()), pattern);
time_zone_offset = QTime::fromString(input_date.right(pattern.size()), pattern);
if (time_zone_offset.isValid()) {
positive_time_zone_offset = pattern.at(0) == '+';
@ -57,7 +55,7 @@ QDateTime TextFactory::parseDateTime(const QString &date_time) {
// Iterate over patterns and check if input date/time matches the pattern.
foreach (const QString &pattern, date_patterns) {
dt = locale.toDateTime(date.left(pattern.size()), pattern);
dt = locale.toDateTime(input_date.left(pattern.size()), pattern);
if (dt.isValid()) {
// Make sure that this date/time is considered UTC.

View File

@ -21,7 +21,6 @@
#include "definitions/definitions.h"
#include <QDateTime>
#include <QMap>
class TextFactory {
@ -30,6 +29,7 @@ class TextFactory {
explicit TextFactory();
public:
// Returns true if lhs is smaller than rhs if case-insensitive string comparison is used.
static inline bool isCaseInsensitiveLessThan(const QString &lhs, const QString &rhs) {
return lhs.toLower() < rhs.toLower();
}