Refactoring.
This commit is contained in:
		
							parent
							
								
									0210d7bd31
								
							
						
					
					
						commit
						5842657cb9
					
				
					 32 changed files with 130 additions and 65 deletions
				
			
		| 
						 | 
					@ -1,8 +1,25 @@
 | 
				
			||||||
 | 
					// This file is part of RSS Guard.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Copyright (C) 2011-2014 by Martin Rotter <rotter.martinos@gmail.com>
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// RSS Guard is free software: you can redistribute it and/or modify
 | 
				
			||||||
 | 
					// it under the terms of the GNU General Public License as published by
 | 
				
			||||||
 | 
					// the Free Software Foundation, either version 3 of the License, or
 | 
				
			||||||
 | 
					// (at your option) any later version.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// RSS Guard is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					// but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					// GNU General Public License for more details.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "application.h"
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Application::Application(int &argc, char **argv)
 | 
					Application::Application(const QString &id, int &argc, char **argv)
 | 
				
			||||||
  : QtSingleApplication(argc, argv) {
 | 
					  : QtSingleApplication(id, argc, argv) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Application::~Application() {
 | 
					Application::~Application() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,30 @@
 | 
				
			||||||
 | 
					// This file is part of RSS Guard.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Copyright (C) 2011-2014 by Martin Rotter <rotter.martinos@gmail.com>
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// RSS Guard is free software: you can redistribute it and/or modify
 | 
				
			||||||
 | 
					// it under the terms of the GNU General Public License as published by
 | 
				
			||||||
 | 
					// the Free Software Foundation, either version 3 of the License, or
 | 
				
			||||||
 | 
					// (at your option) any later version.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// RSS Guard is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					// but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					// GNU General Public License for more details.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef APPLICATION_H
 | 
					#ifndef APPLICATION_H
 | 
				
			||||||
#define APPLICATION_H
 | 
					#define APPLICATION_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "qtsingleapplication/qtsingleapplication.h"
 | 
					#include "qtsingleapplication/qtsingleapplication.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(qApp)
 | 
				
			||||||
 | 
					#undef qApp
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#define qApp (Application::instance())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO: presunout nektery veci sem, settings atp
 | 
					// TODO: presunout nektery veci sem, settings atp
 | 
				
			||||||
class Application : public QtSingleApplication {
 | 
					class Application : public QtSingleApplication {
 | 
				
			||||||
| 
						 | 
					@ -10,7 +32,7 @@ class Application : public QtSingleApplication {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public:
 | 
					  public:
 | 
				
			||||||
    // Constructors and destructors.
 | 
					    // Constructors and destructors.
 | 
				
			||||||
    explicit Application(int &argc, char **argv);
 | 
					    explicit Application(const QString &id, int &argc, char **argv);
 | 
				
			||||||
    virtual ~Application();
 | 
					    virtual ~Application();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Returns pointer to "GOD" application singleton.
 | 
					    // Returns pointer to "GOD" application singleton.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QThread>
 | 
					#include <QThread>
 | 
				
			||||||
#include <QDebug>
 | 
					#include <QDebug>
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FeedDownloader::FeedDownloader(QObject *parent) : QObject(parent) {
 | 
					FeedDownloader::FeedDownloader(QObject *parent) : QObject(parent) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,7 @@
 | 
				
			||||||
#include "core/feedsmodelrootitem.h"
 | 
					#include "core/feedsmodelrootitem.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QSqlRecord>
 | 
					#include <QSqlRecord>
 | 
				
			||||||
#include <QApplication>
 | 
					#include <QCoreApplication>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FeedsModelFeed;
 | 
					class FeedsModelFeed;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,12 +25,11 @@
 | 
				
			||||||
#include <QSqlRecord>
 | 
					#include <QSqlRecord>
 | 
				
			||||||
#include <QPair>
 | 
					#include <QPair>
 | 
				
			||||||
#include <QNetworkReply>
 | 
					#include <QNetworkReply>
 | 
				
			||||||
#include <QApplication>
 | 
					#include <QCoreApplication>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Message;
 | 
					class Message;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
// Represents BASE class for feeds contained in FeedsModel.
 | 
					// Represents BASE class for feeds contained in FeedsModel.
 | 
				
			||||||
// NOTE: This class should be derived to create PARTICULAR feed types.
 | 
					// NOTE: This class should be derived to create PARTICULAR feed types.
 | 
				
			||||||
class FeedsModelFeed : public FeedsModelRootItem {
 | 
					class FeedsModelFeed : public FeedsModelRootItem {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "core/feedsmodelrootitem.h"
 | 
					#include "core/feedsmodelrootitem.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "qtsingleapplication/qtsingleapplication.h"
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QVariant>
 | 
					#include <QVariant>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,7 +35,7 @@ FeedsModelRootItem::~FeedsModelRootItem() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void FeedsModelRootItem::setupFonts() {
 | 
					void FeedsModelRootItem::setupFonts() {
 | 
				
			||||||
  m_normalFont = QtSingleApplication::font("FeedsView");
 | 
					  m_normalFont = Application::font("FeedsView");
 | 
				
			||||||
  m_boldFont = m_normalFont;
 | 
					  m_boldFont = m_normalFont;
 | 
				
			||||||
  m_boldFont.setBold(true);
 | 
					  m_boldFont.setBold(true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,7 @@
 | 
				
			||||||
#include "miscellaneous/textfactory.h"
 | 
					#include "miscellaneous/textfactory.h"
 | 
				
			||||||
#include "miscellaneous/databasefactory.h"
 | 
					#include "miscellaneous/databasefactory.h"
 | 
				
			||||||
#include "miscellaneous/iconfactory.h"
 | 
					#include "miscellaneous/iconfactory.h"
 | 
				
			||||||
#include "qtsingleapplication/qtsingleapplication.h"
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QSqlRecord>
 | 
					#include <QSqlRecord>
 | 
				
			||||||
#include <QSqlError>
 | 
					#include <QSqlError>
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,7 @@ void MessagesModel::fetchAll() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MessagesModel::setupFonts() {
 | 
					void MessagesModel::setupFonts() {
 | 
				
			||||||
  m_normalFont = QtSingleApplication::font("MessagesView");
 | 
					  m_normalFont = Application::font("MessagesView");
 | 
				
			||||||
  m_boldFont = m_normalFont;
 | 
					  m_boldFont = m_normalFont;
 | 
				
			||||||
  m_boldFont.setBold(true);
 | 
					  m_boldFont.setBold(true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,7 @@
 | 
				
			||||||
#include "gui/statusbar.h"
 | 
					#include "gui/statusbar.h"
 | 
				
			||||||
#include "gui/feedmessageviewer.h"
 | 
					#include "gui/feedmessageviewer.h"
 | 
				
			||||||
#include "gui/formupdate.h"
 | 
					#include "gui/formupdate.h"
 | 
				
			||||||
#include "qtsingleapplication/qtsingleapplication.h"
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QCloseEvent>
 | 
					#include <QCloseEvent>
 | 
				
			||||||
#include <QSessionManager>
 | 
					#include <QSessionManager>
 | 
				
			||||||
| 
						 | 
					@ -219,7 +219,7 @@ void FormMain::display() {
 | 
				
			||||||
  raise();
 | 
					  raise();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Raise alert event. Check the documentation for more info on this.
 | 
					  // Raise alert event. Check the documentation for more info on this.
 | 
				
			||||||
  QtSingleApplication::alert(this);
 | 
					  Application::alert(this);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void FormMain::onCommitData(QSessionManager &manager) {
 | 
					void FormMain::onCommitData(QSessionManager &manager) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,8 +38,8 @@
 | 
				
			||||||
#include "gui/messagebox.h"
 | 
					#include "gui/messagebox.h"
 | 
				
			||||||
#include "gui/basetoolbar.h"
 | 
					#include "gui/basetoolbar.h"
 | 
				
			||||||
#include "gui/messagestoolbar.h"
 | 
					#include "gui/messagestoolbar.h"
 | 
				
			||||||
#include "qtsingleapplication/qtsingleapplication.h"
 | 
					 | 
				
			||||||
#include "dynamic-shortcuts/dynamicshortcuts.h"
 | 
					#include "dynamic-shortcuts/dynamicshortcuts.h"
 | 
				
			||||||
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QProcess>
 | 
					#include <QProcess>
 | 
				
			||||||
#include <QNetworkProxy>
 | 
					#include <QNetworkProxy>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,13 +17,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "gui/locationlineedit.h"
 | 
					#include "gui/locationlineedit.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "definitions/definitions.h"
 | 
					#include <QMouseEvent>
 | 
				
			||||||
#include "miscellaneous/settings.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <QPaintEvent>
 | 
					 | 
				
			||||||
#include <QStyleOptionFrameV2>
 | 
					 | 
				
			||||||
#include <QPainter>
 | 
					 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LocationLineEdit::LocationLineEdit(QWidget *parent)
 | 
					LocationLineEdit::LocationLineEdit(QWidget *parent)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,13 +18,14 @@
 | 
				
			||||||
#include "gui/messagebox.h"
 | 
					#include "gui/messagebox.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "miscellaneous/iconfactory.h"
 | 
					#include "miscellaneous/iconfactory.h"
 | 
				
			||||||
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QDialogButtonBox>
 | 
					 | 
				
			||||||
#include <QtGlobal>
 | 
					#include <QtGlobal>
 | 
				
			||||||
 | 
					#include <QDialogButtonBox>
 | 
				
			||||||
#include <QPushButton>
 | 
					#include <QPushButton>
 | 
				
			||||||
#include <QDialogButtonBox>
 | 
					#include <QDialogButtonBox>
 | 
				
			||||||
#include <QStyle>
 | 
					#include <QStyle>
 | 
				
			||||||
#include <QApplication>
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MessageBox::MessageBox(QWidget *parent) : QMessageBox(parent) {
 | 
					MessageBox::MessageBox(QWidget *parent) : QMessageBox(parent) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,7 @@
 | 
				
			||||||
#include "miscellaneous/settings.h"
 | 
					#include "miscellaneous/settings.h"
 | 
				
			||||||
#include "gui/formmain.h"
 | 
					#include "gui/formmain.h"
 | 
				
			||||||
#include "gui/formsettings.h"
 | 
					#include "gui/formsettings.h"
 | 
				
			||||||
#include "qtsingleapplication/qtsingleapplication.h"
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QPainter>
 | 
					#include <QPainter>
 | 
				
			||||||
#include <QTimer>
 | 
					#include <QTimer>
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@ TrayIconMenu::~TrayIconMenu() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool TrayIconMenu::event(QEvent *event) {
 | 
					bool TrayIconMenu::event(QEvent *event) {
 | 
				
			||||||
  if (QtSingleApplication::activeModalWidget() != NULL &&
 | 
					  if (Application::activeModalWidget() != NULL &&
 | 
				
			||||||
      event->type() == QEvent::Show) {
 | 
					      event->type() == QEvent::Show) {
 | 
				
			||||||
    QTimer::singleShot(0, this, SLOT(hide()));
 | 
					    QTimer::singleShot(0, this, SLOT(hide()));
 | 
				
			||||||
    SystemTrayIcon::instance()->showMessage(APP_LONG_NAME,
 | 
					    SystemTrayIcon::instance()->showMessage(APP_LONG_NAME,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,8 +26,8 @@
 | 
				
			||||||
#include "gui/formmain.h"
 | 
					#include "gui/formmain.h"
 | 
				
			||||||
#include "gui/feedmessageviewer.h"
 | 
					#include "gui/feedmessageviewer.h"
 | 
				
			||||||
#include "gui/plaintoolbutton.h"
 | 
					#include "gui/plaintoolbutton.h"
 | 
				
			||||||
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
#include <QMenu>
 | 
					#include <QMenu>
 | 
				
			||||||
#include <QToolButton>
 | 
					#include <QToolButton>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										18
									
								
								src/main.cpp
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								src/main.cpp
									
										
									
									
									
								
							| 
						 | 
					@ -27,7 +27,7 @@
 | 
				
			||||||
#include "gui/systemtrayicon.h"
 | 
					#include "gui/systemtrayicon.h"
 | 
				
			||||||
#include "gui/feedmessageviewer.h"
 | 
					#include "gui/feedmessageviewer.h"
 | 
				
			||||||
#include "gui/feedsview.h"
 | 
					#include "gui/feedsview.h"
 | 
				
			||||||
#include "qtsingleapplication/qtsingleapplication.h"
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Needed for setting ini file format on Mac OS.
 | 
					// Needed for setting ini file format on Mac OS.
 | 
				
			||||||
#ifdef Q_OS_MAC
 | 
					#ifdef Q_OS_MAC
 | 
				
			||||||
| 
						 | 
					@ -66,8 +66,8 @@ int main(int argc, char *argv[]) {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Instantiate base application object.
 | 
					  // Instantiate base application object.
 | 
				
			||||||
  QtSingleApplication application(APP_LOW_NAME, argc, argv);
 | 
					  Application application(APP_LOW_NAME, argc, argv);
 | 
				
			||||||
  qDebug("Instantiated QtSingleApplication class.");
 | 
					  qDebug("Instantiated Application class.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Check if another instance is running.
 | 
					  // Check if another instance is running.
 | 
				
			||||||
  if (application.sendMessage(APP_IS_RUNNING)) {
 | 
					  if (application.sendMessage(APP_IS_RUNNING)) {
 | 
				
			||||||
| 
						 | 
					@ -85,11 +85,11 @@ int main(int argc, char *argv[]) {
 | 
				
			||||||
  Localization::instance()->load();
 | 
					  Localization::instance()->load();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // These settings needs to be set before any QSettings object.
 | 
					  // These settings needs to be set before any QSettings object.
 | 
				
			||||||
  QtSingleApplication::setApplicationName(APP_NAME);
 | 
					  Application::setApplicationName(APP_NAME);
 | 
				
			||||||
  QtSingleApplication::setApplicationVersion(APP_VERSION);
 | 
					  Application::setApplicationVersion(APP_VERSION);
 | 
				
			||||||
  QtSingleApplication::setOrganizationName(APP_AUTHOR);
 | 
					  Application::setOrganizationName(APP_AUTHOR);
 | 
				
			||||||
  QtSingleApplication::setOrganizationDomain(APP_URL);
 | 
					  Application::setOrganizationDomain(APP_URL);
 | 
				
			||||||
  QtSingleApplication::setWindowIcon(QIcon(APP_ICON_PATH));
 | 
					  Application::setWindowIcon(QIcon(APP_ICON_PATH));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  qDebug().nospace() << "Creating main application form in thread: \'" <<
 | 
					  qDebug().nospace() << "Creating main application form in thread: \'" <<
 | 
				
			||||||
                        QThread::currentThreadId() << "\'.";
 | 
					                        QThread::currentThreadId() << "\'.";
 | 
				
			||||||
| 
						 | 
					@ -126,5 +126,5 @@ int main(int argc, char *argv[]) {
 | 
				
			||||||
                   &main_window, SLOT(processExecutionMessage(QString)));
 | 
					                   &main_window, SLOT(processExecutionMessage(QString)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Enter global event loop.
 | 
					  // Enter global event loop.
 | 
				
			||||||
  return QtSingleApplication::exec();
 | 
					  return Application::exec();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,8 +19,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "definitions/definitions.h"
 | 
					#include "definitions/definitions.h"
 | 
				
			||||||
#include "miscellaneous/settings.h"
 | 
					#include "miscellaneous/settings.h"
 | 
				
			||||||
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
#include <QDir>
 | 
					#include <QDir>
 | 
				
			||||||
#include <QSqlQuery>
 | 
					#include <QSqlQuery>
 | 
				
			||||||
#include <QSqlError>
 | 
					#include <QSqlError>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,8 +18,8 @@
 | 
				
			||||||
#include "miscellaneous/debugging.h"
 | 
					#include "miscellaneous/debugging.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "definitions/definitions.h"
 | 
					#include "definitions/definitions.h"
 | 
				
			||||||
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
#include <QDir>
 | 
					#include <QDir>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <cstdio>
 | 
					#include <cstdio>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,15 +18,17 @@
 | 
				
			||||||
#ifndef ICONFACTORY_H
 | 
					#ifndef ICONFACTORY_H
 | 
				
			||||||
#define ICONFACTORY_H
 | 
					#define ICONFACTORY_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QObject>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "definitions/definitions.h"
 | 
				
			||||||
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QString>
 | 
					#include <QString>
 | 
				
			||||||
#include <QIcon>
 | 
					#include <QIcon>
 | 
				
			||||||
#include <QPointer>
 | 
					#include <QPointer>
 | 
				
			||||||
#include <QHash>
 | 
					#include <QHash>
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
#include <QDir>
 | 
					#include <QDir>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "definitions/definitions.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class IconFactory : public QObject {
 | 
					class IconFactory : public QObject {
 | 
				
			||||||
  public:
 | 
					  public:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,10 +19,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "definitions/definitions.h"
 | 
					#include "definitions/definitions.h"
 | 
				
			||||||
#include "miscellaneous/settings.h"
 | 
					#include "miscellaneous/settings.h"
 | 
				
			||||||
#include "qtsingleapplication/qtsingleapplication.h"
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QPointer>
 | 
					#include <QPointer>
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
#include <QTranslator>
 | 
					#include <QTranslator>
 | 
				
			||||||
#include <QDir>
 | 
					#include <QDir>
 | 
				
			||||||
#include <QFileInfoList>
 | 
					#include <QFileInfoList>
 | 
				
			||||||
| 
						 | 
					@ -61,7 +60,7 @@ void Localization::load() {
 | 
				
			||||||
  if (app_translator->load(QString("rssguard-%1.qm").arg(desired_localization),
 | 
					  if (app_translator->load(QString("rssguard-%1.qm").arg(desired_localization),
 | 
				
			||||||
                           APP_LANG_PATH,
 | 
					                           APP_LANG_PATH,
 | 
				
			||||||
                           "-")) {
 | 
					                           "-")) {
 | 
				
			||||||
    QApplication::installTranslator(app_translator);
 | 
					    Application::installTranslator(app_translator);
 | 
				
			||||||
    qDebug("Application localization '%s' loaded successfully.",
 | 
					    qDebug("Application localization '%s' loaded successfully.",
 | 
				
			||||||
           qPrintable(desired_localization));
 | 
					           qPrintable(desired_localization));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -74,7 +73,7 @@ void Localization::load() {
 | 
				
			||||||
  if (qt_translator->load(QString("qt-%1.qm").arg(desired_localization),
 | 
					  if (qt_translator->load(QString("qt-%1.qm").arg(desired_localization),
 | 
				
			||||||
                          APP_LANG_PATH,
 | 
					                          APP_LANG_PATH,
 | 
				
			||||||
                          "-")) {
 | 
					                          "-")) {
 | 
				
			||||||
    QApplication::installTranslator(qt_translator);
 | 
					    Application::installTranslator(qt_translator);
 | 
				
			||||||
    qDebug("Qt localization '%s' loaded successfully.",
 | 
					    qDebug("Qt localization '%s' loaded successfully.",
 | 
				
			||||||
           qPrintable(desired_localization));
 | 
					           qPrintable(desired_localization));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,8 +18,8 @@
 | 
				
			||||||
#include "miscellaneous/settings.h"
 | 
					#include "miscellaneous/settings.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "definitions/definitions.h"
 | 
					#include "definitions/definitions.h"
 | 
				
			||||||
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
#include <QDebug>
 | 
					#include <QDebug>
 | 
				
			||||||
#include <QDir>
 | 
					#include <QDir>
 | 
				
			||||||
#include <QPointer>
 | 
					#include <QPointer>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,7 @@
 | 
				
			||||||
#define SETTINGS_H
 | 
					#define SETTINGS_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QSettings>
 | 
					#include <QSettings>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QPointer>
 | 
					#include <QPointer>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,8 +19,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "definitions/definitions.h"
 | 
					#include "definitions/definitions.h"
 | 
				
			||||||
#include "miscellaneous/settings.h"
 | 
					#include "miscellaneous/settings.h"
 | 
				
			||||||
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
#include <QDir>
 | 
					#include <QDir>
 | 
				
			||||||
#include <QStyleFactory>
 | 
					#include <QStyleFactory>
 | 
				
			||||||
#include <QDomDocument>
 | 
					#include <QDomDocument>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,7 @@
 | 
				
			||||||
#define SKINFACTORY_H
 | 
					#define SKINFACTORY_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QObject>
 | 
					#include <QObject>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QPointer>
 | 
					#include <QPointer>
 | 
				
			||||||
#include <QStringList>
 | 
					#include <QStringList>
 | 
				
			||||||
#include <QMetaType>
 | 
					#include <QMetaType>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,16 +19,14 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "definitions/definitions.h"
 | 
					#include "definitions/definitions.h"
 | 
				
			||||||
#include "network-web/networkfactory.h"
 | 
					#include "network-web/networkfactory.h"
 | 
				
			||||||
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(Q_OS_WIN)
 | 
					#if defined(Q_OS_WIN)
 | 
				
			||||||
#include "qtsingleapplication/qtsingleapplication.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <QSettings>
 | 
					#include <QSettings>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QString>
 | 
					#include <QString>
 | 
				
			||||||
#include <QFile>
 | 
					#include <QFile>
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
#include <QDomDocument>
 | 
					#include <QDomDocument>
 | 
				
			||||||
#include <QDomElement>
 | 
					#include <QDomElement>
 | 
				
			||||||
#include <QDomAttr>
 | 
					#include <QDomAttr>
 | 
				
			||||||
| 
						 | 
					@ -55,7 +53,7 @@ SystemFactory::AutoStartStatus SystemFactory::getAutoStartStatus() {
 | 
				
			||||||
  bool autostart_enabled = registry_key.value(APP_LOW_NAME,
 | 
					  bool autostart_enabled = registry_key.value(APP_LOW_NAME,
 | 
				
			||||||
                                              "").toString().replace('\\',
 | 
					                                              "").toString().replace('\\',
 | 
				
			||||||
                                                                     '/') ==
 | 
					                                                                     '/') ==
 | 
				
			||||||
                           QtSingleApplication::applicationFilePath();
 | 
					                           Application::applicationFilePath();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (autostart_enabled) {
 | 
					  if (autostart_enabled) {
 | 
				
			||||||
    return SystemFactory::Enabled;
 | 
					    return SystemFactory::Enabled;
 | 
				
			||||||
| 
						 | 
					@ -138,8 +136,8 @@ bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) {
 | 
				
			||||||
  switch (new_status) {
 | 
					  switch (new_status) {
 | 
				
			||||||
    case SystemFactory::Enabled:
 | 
					    case SystemFactory::Enabled:
 | 
				
			||||||
      registry_key.setValue(APP_LOW_NAME,
 | 
					      registry_key.setValue(APP_LOW_NAME,
 | 
				
			||||||
                            QtSingleApplication::applicationFilePath().replace('/',
 | 
					                            Application::applicationFilePath().replace('/',
 | 
				
			||||||
                                                                               '\\'));
 | 
					                                                                       '\\'));
 | 
				
			||||||
      return true;
 | 
					      return true;
 | 
				
			||||||
    case SystemFactory::Disabled:
 | 
					    case SystemFactory::Disabled:
 | 
				
			||||||
      registry_key.remove(APP_LOW_NAME);
 | 
					      registry_key.remove(APP_LOW_NAME);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,7 @@
 | 
				
			||||||
#define SYSTEMFACTORY_H
 | 
					#define SYSTEMFACTORY_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QObject>
 | 
					#include <QObject>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QPointer>
 | 
					#include <QPointer>
 | 
				
			||||||
#include <QMutex>
 | 
					#include <QMutex>
 | 
				
			||||||
#include <QMetaType>
 | 
					#include <QMetaType>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,7 @@
 | 
				
			||||||
#define NETWORKFACTORY_H
 | 
					#define NETWORKFACTORY_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QNetworkReply>
 | 
					#include <QNetworkReply>
 | 
				
			||||||
#include <QApplication>
 | 
					#include <QCoreApplication>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class NetworkFactory {
 | 
					class NetworkFactory {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QNetworkReply>
 | 
					#include <QNetworkReply>
 | 
				
			||||||
#include <QAuthenticator>
 | 
					#include <QAuthenticator>
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SilentNetworkAccessManager::SilentNetworkAccessManager(QObject *parent)
 | 
					SilentNetworkAccessManager::SilentNetworkAccessManager(QObject *parent)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,8 +17,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "network-web/webbrowsernetworkaccessmanager.h"
 | 
					#include "network-web/webbrowsernetworkaccessmanager.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QNetworkReply>
 | 
					#include <QNetworkReply>
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QPointer<WebBrowserNetworkAccessManager> WebBrowserNetworkAccessManager::s_instance;
 | 
					QPointer<WebBrowserNetworkAccessManager> WebBrowserNetworkAccessManager::s_instance;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "definitions/definitions.h"
 | 
					#include "definitions/definitions.h"
 | 
				
			||||||
#include "miscellaneous/settings.h"
 | 
					#include "miscellaneous/settings.h"
 | 
				
			||||||
 | 
					#include "application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
#include <QRegExp>
 | 
					#include <QRegExp>
 | 
				
			||||||
#include <QWebSettings>
 | 
					#include <QWebSettings>
 | 
				
			||||||
#include <QProcess>
 | 
					#include <QProcess>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,7 +54,7 @@ void WebView::onLoadFinished(bool ok) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void WebView::copySelectedText() {
 | 
					void WebView::copySelectedText() {
 | 
				
			||||||
  QApplication::clipboard()->setText(selectedText());
 | 
					  Application::clipboard()->setText(selectedText());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void WebView::openLinkInNewTab() {
 | 
					void WebView::openLinkInNewTab() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,25 @@
 | 
				
			||||||
 | 
					// This file is part of RSS Guard.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Copyright (C) 2011-2014 by Martin Rotter <rotter.martinos@gmail.com>
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// RSS Guard is free software: you can redistribute it and/or modify
 | 
				
			||||||
 | 
					// it under the terms of the GNU General Public License as published by
 | 
				
			||||||
 | 
					// the Free Software Foundation, either version 3 of the License, or
 | 
				
			||||||
 | 
					// (at your option) any later version.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// RSS Guard is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					// but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					// GNU General Public License for more details.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "updater/formupdater.h"
 | 
					#include "updater/formupdater.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "definitions/definitions.h"
 | 
					#include "definitions/definitions.h"
 | 
				
			||||||
#include "qtsingleapplication/qtsingleapplication.h"
 | 
					#include "qtsingleapplication/qtsingleapplication.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QApplication>
 | 
					 | 
				
			||||||
#include <QDesktopWidget>
 | 
					#include <QDesktopWidget>
 | 
				
			||||||
#include <QIcon>
 | 
					#include <QIcon>
 | 
				
			||||||
#include <QDir>
 | 
					#include <QDir>
 | 
				
			||||||
| 
						 | 
					@ -60,7 +76,7 @@ void FormUpdater::startUpgrade() {
 | 
				
			||||||
  printHeading("Welcome to RSS Guard updater");
 | 
					  printHeading("Welcome to RSS Guard updater");
 | 
				
			||||||
  printText("Analyzing updater arguments.");
 | 
					  printText("Analyzing updater arguments.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (QApplication::arguments().size() != 5) {
 | 
					  if (QtSingleApplication::arguments().size() != 5) {
 | 
				
			||||||
    printText("Insufficient arguments passed. Update process cannot proceed.");
 | 
					    printText("Insufficient arguments passed. Update process cannot proceed.");
 | 
				
			||||||
    printText("\nPress any key to exit updater...");
 | 
					    printText("\nPress any key to exit updater...");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -87,7 +103,7 @@ void FormUpdater::startUpgrade() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void FormUpdater::saveArguments() {
 | 
					void FormUpdater::saveArguments() {
 | 
				
			||||||
  // Obtain parameters.
 | 
					  // Obtain parameters.
 | 
				
			||||||
  QStringList arguments = QApplication::arguments();
 | 
					  QStringList arguments = QtSingleApplication::arguments();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  m_parsedArguments["updater_path"] = QDir::toNativeSeparators(qApp->applicationFilePath());
 | 
					  m_parsedArguments["updater_path"] = QDir::toNativeSeparators(qApp->applicationFilePath());
 | 
				
			||||||
  m_parsedArguments["current_version"] = arguments.at(1);
 | 
					  m_parsedArguments["current_version"] = arguments.at(1);
 | 
				
			||||||
| 
						 | 
					@ -210,7 +226,7 @@ bool FormUpdater::doPreparationCleanup() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    printText(QString("Check for running instances of RSS Guard, attempt %1.").arg(i));
 | 
					    printText(QString("Check for running instances of RSS Guard, attempt %1.").arg(i));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (static_cast<QtSingleApplication*>(qApp)->sendMessage(APP_QUIT_INSTANCE)) {
 | 
					    if (static_cast<QtSingleApplication*>(QCoreApplication::instance())->sendMessage(APP_QUIT_INSTANCE)) {
 | 
				
			||||||
      printText("The main application is running. Quitting it.");
 | 
					      printText("The main application is running. Quitting it.");
 | 
				
			||||||
      printText("Waiting for 6000 ms for main application to finish.");
 | 
					      printText("Waiting for 6000 ms for main application to finish.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,20 @@
 | 
				
			||||||
 | 
					// This file is part of RSS Guard.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Copyright (C) 2011-2014 by Martin Rotter <rotter.martinos@gmail.com>
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// RSS Guard is free software: you can redistribute it and/or modify
 | 
				
			||||||
 | 
					// it under the terms of the GNU General Public License as published by
 | 
				
			||||||
 | 
					// the Free Software Foundation, either version 3 of the License, or
 | 
				
			||||||
 | 
					// (at your option) any later version.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// RSS Guard is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					// but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					// GNU General Public License for more details.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef FORMUPDATER_H
 | 
					#ifndef FORMUPDATER_H
 | 
				
			||||||
#define FORMUPDATER_H
 | 
					#define FORMUPDATER_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,6 +78,7 @@ class FormUpdater : public QMainWindow {
 | 
				
			||||||
    void consumeDebugMessage(QtMsgType type, const QString &message);
 | 
					    void consumeDebugMessage(QtMsgType type, const QString &message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  signals:
 | 
					  signals:
 | 
				
			||||||
 | 
					    // Emitted if new debug messaages is produced and should be printed.
 | 
				
			||||||
    void debugMessageProduced(QtMsgType type, QString message);
 | 
					    void debugMessageProduced(QtMsgType type, QString message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected:
 | 
					  protected:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,9 +26,6 @@
 | 
				
			||||||
#include <QFileInfo>
 | 
					#include <QFileInfo>
 | 
				
			||||||
#include <QDir>
 | 
					#include <QDir>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <iostream>
 | 
					 | 
				
			||||||
#include <limits>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Main entry point to "rssguard_updater.exe".
 | 
					// Main entry point to "rssguard_updater.exe".
 | 
				
			||||||
// It expects 4 ARGUMENTS:
 | 
					// It expects 4 ARGUMENTS:
 | 
				
			||||||
| 
						 | 
					@ -40,7 +37,7 @@
 | 
				
			||||||
int main(int argc, char *argv[]) {
 | 
					int main(int argc, char *argv[]) {
 | 
				
			||||||
  // Instantiate base application object.
 | 
					  // Instantiate base application object.
 | 
				
			||||||
  QtSingleApplication application(APP_LOW_NAME, argc, argv);
 | 
					  QtSingleApplication application(APP_LOW_NAME, argc, argv);
 | 
				
			||||||
  application.setQuitOnLastWindowClosed(true);
 | 
					  QtSingleApplication::setQuitOnLastWindowClosed(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  FormUpdater main_form;
 | 
					  FormUpdater main_form;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue