Merge branch 'master' of bitbucket.org:skunkos/rssguard

This commit is contained in:
Martin Rotter 2015-03-22 15:47:03 +01:00
commit 506d92d841
13 changed files with 126 additions and 108 deletions

View File

@ -71,8 +71,8 @@ project(rssguard)
set(APP_NAME "RSS Guard") set(APP_NAME "RSS Guard")
set(APP_LOW_NAME "rssguard") set(APP_LOW_NAME "rssguard")
set(APP_VERSION "2.2.0") set(APP_VERSION "2.3.0")
set(FILE_VERSION "2,2,0,0") set(FILE_VERSION "2,3,0,0")
set(APP_AUTHOR "Martin Rotter") set(APP_AUTHOR "Martin Rotter")
set(APP_URL "http://bitbucket.org/skunkos/rssguard") set(APP_URL "http://bitbucket.org/skunkos/rssguard")
set(APP_URL_ISSUES "http://bitbucket.org/skunkos/rssguard/issues") set(APP_URL_ISSUES "http://bitbucket.org/skunkos/rssguard/issues")

View File

@ -33,6 +33,9 @@ Downloads
--------- ---------
### Windows ### Windows
* [all downloads](https://bitbucket.org/skunkos/rssguard/downloads). * [all downloads](https://bitbucket.org/skunkos/rssguard/downloads).
* alternative downloads
[![Alternative RSS Guard downloads.](http://www.instalki.pl/img/buttons/en/download_dark.png)](http://www.instalki.pl/programy/download/Windows/czytniki_RSS/RSS_Guard.html)
### Linux ### Linux
* [stable releases](http://software.opensuse.org/download.html?project=home%3Askunkos&package=rssguard), * [stable releases](http://software.opensuse.org/download.html?project=home%3Askunkos&package=rssguard),
* [development releases](http://software.opensuse.org/download.html?project=home%3Askunkos&package=rssguard-git) (compiled from the master branch of RSS Guard Git repository), * [development releases](http://software.opensuse.org/download.html?project=home%3Askunkos&package=rssguard-git) (compiled from the master branch of RSS Guard Git repository),
@ -40,6 +43,7 @@ Downloads
![RSS Guard is 100% clean.](http://www.softpedia.com/_img/softpedia_100_free.png) ![RSS Guard is 100% clean.](http://www.softpedia.com/_img/softpedia_100_free.png)
- - - - - -
Features Features
-------- --------
RSS Guard is simple (yet powerful) feed reader. It is able to fetch the most known feed formats, including RSS/RDF and ATOM. RSS Guard is developed on top of the [Qt library](http://qt-project.org/) and it supports these operating systems: RSS Guard is simple (yet powerful) feed reader. It is able to fetch the most known feed formats, including RSS/RDF and ATOM. RSS Guard is developed on top of the [Qt library](http://qt-project.org/) and it supports these operating systems:
@ -58,6 +62,7 @@ RSS Guard is written in C++. It is pretty fast even with tons of messages loaded
* support for all feed formats, * support for all feed formats,
* simplicity, * simplicity,
* import/export of feeds to/from OPML 2.0, * import/export of feeds to/from OPML 2.0,
* downloader with own tab and support for up to 6 parallel downloads,
* message filter with regular expressions, * message filter with regular expressions,
* feed metadata fetching including icons, * feed metadata fetching including icons,
* enhanced feed auto-updating with separate time intervals, * enhanced feed auto-updating with separate time intervals,

View File

@ -108,6 +108,9 @@
#define APP_CFG_PATH "data/config" #define APP_CFG_PATH "data/config"
#define APP_CFG_FILE "config.ini" #define APP_CFG_FILE "config.ini"
#define APP_LOG_PATH "data/log"
#define APP_LOG_FILE "log.txt"
#if defined(Q_OS_OSX) #if defined(Q_OS_OSX)
#define APP_PREFIX "@CMAKE_INSTALL_PREFIX@/@APP_LOW_NAME@.app/Contents/Resources" #define APP_PREFIX "@CMAKE_INSTALL_PREFIX@/@APP_LOW_NAME@.app/Contents/Resources"
#else #else

View File

@ -104,7 +104,7 @@ FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout)
APP_NAME)); APP_NAME));
// Load additional paths information. // Load additional paths information.
if (qApp->settings()->type() == Settings::Portable) { if (qApp->settings()->type() == SettingsType::Portable) {
m_ui->m_txtPathsSettingsType->setText(tr("FULLY portable")); m_ui->m_txtPathsSettingsType->setText(tr("FULLY portable"));
m_ui->m_txtPathsDatabaseRoot->setText(QDir::toNativeSeparators(qApp->applicationDirPath() + QDir::separator() + QString(APP_DB_SQLITE_PATH))); m_ui->m_txtPathsDatabaseRoot->setText(QDir::toNativeSeparators(qApp->applicationDirPath() + QDir::separator() + QString(APP_DB_SQLITE_PATH)));
} }

1
src/gui/systemtrayicon.h Normal file → Executable file
View File

@ -22,7 +22,6 @@
#include "definitions/definitions.h" #include "definitions/definitions.h"
#include <QPointer>
#include <QPixmap> #include <QPixmap>
#include <QMenu> #include <QMenu>

View File

@ -115,7 +115,7 @@ void DatabaseFactory::finishRestoration() {
} }
void DatabaseFactory::sqliteAssemblyDatabaseFilePath() { void DatabaseFactory::sqliteAssemblyDatabaseFilePath() {
if (qApp->settings()->type() == Settings::Portable) { if (qApp->settings()->type() == SettingsType::Portable) {
m_sqliteDatabaseFilePath = qApp->applicationDirPath() + QDir::separator() + QString(APP_DB_SQLITE_PATH); m_sqliteDatabaseFilePath = qApp->applicationDirPath() + QDir::separator() + QString(APP_DB_SQLITE_PATH);
} }
else { else {

View File

@ -24,49 +24,50 @@
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#ifndef QT_NO_DEBUG_OUTPUT
#if QT_VERSION >= 0x050000
#define DEBUG_OUTPUT_WORKER(type_string, file, line, message) \
fprintf(stderr, "[%s] %s (%s:%d): %s\n", \
APP_LOW_NAME, \
type_string, \
file, \
line, \
qPrintable(message));
#else
#define DEBUG_OUTPUT_WORKER(type_string, message) \
fprintf(stderr, "[%s] %s: %s\n", \
APP_LOW_NAME, \
type_string, \
message);
#endif
#endif
Debugging::Debugging() {
}
#if QT_VERSION >= 0x050000 void Debugging::performLog(const char *message, QtMsgType type, const char *file, const char *function, int line) {
void Debugging::debugHandler(QtMsgType type, const char *type_string = typeToString(type);
const QMessageLogContext &placement,
const QString &message) {
#ifndef QT_NO_DEBUG_OUTPUT
const char *file = qPrintable(QString(placement.file).section(QDir::separator(),
-1));
// Write to console.
if (file == 0 || function == 0 || line < 0) {
fprintf(stderr, "[%s] %s: %s\n", APP_LOW_NAME, type_string, message);
}
else {
fprintf(stderr, "[%s] %s\n Type: %s\n File: %s (line %d)\n Function: %s\n\n",
APP_LOW_NAME, message, type_string, file, line, function);
}
// TODO: Write to file here.
if (type == QtFatalMsg) {
qApp->exit(EXIT_FAILURE);
}
}
const char *Debugging::typeToString(QtMsgType type) {
switch (type) { switch (type) {
case QtDebugMsg: case QtDebugMsg:
DEBUG_OUTPUT_WORKER("INFO", file, placement.line, message); return "DEBUG";
break;
case QtWarningMsg: case QtWarningMsg:
DEBUG_OUTPUT_WORKER("WARNING", file, placement.line, message); return "WARNING";
break;
case QtCriticalMsg: case QtCriticalMsg:
DEBUG_OUTPUT_WORKER("CRITICAL", file, placement.line, message); return "CRITICAL";
break;
case QtFatalMsg: case QtFatalMsg:
DEBUG_OUTPUT_WORKER("FATAL", file, placement.line, message);
qApp->exit(EXIT_FAILURE);
default: default:
break; return "FATAL (terminating application)";
} }
}
#if QT_VERSION >= 0x050000
void Debugging::debugHandler(QtMsgType type, const QMessageLogContext &placement, const QString &message) {
#ifndef QT_NO_DEBUG_OUTPUT
performLog(qPrintable(message), type, placement.file, placement.function, placement.line);
#else #else
Q_UNUSED(type) Q_UNUSED(type)
Q_UNUSED(placement) Q_UNUSED(placement)
@ -75,29 +76,11 @@ void Debugging::debugHandler(QtMsgType type,
} }
#else #else
void Debugging::debugHandler(QtMsgType type, const char *message) { void Debugging::debugHandler(QtMsgType type, const char *message) {
#ifndef QT_NO_DEBUG_OUTPUT #ifndef QT_NO_DEBUG_OUTPUT
switch (type) { performLog(message, type);
case QtDebugMsg:
DEBUG_OUTPUT_WORKER("INFO", message);
break;
case QtWarningMsg:
DEBUG_OUTPUT_WORKER("WARNING", message);
break;
case QtCriticalMsg:
DEBUG_OUTPUT_WORKER("CRITICAL", message);
break;
case QtFatalMsg:
DEBUG_OUTPUT_WORKER("FATAL", message);
qApp->exit(EXIT_FAILURE);
default:
break;
}
#else #else
Q_UNUSED(type) Q_UNUSED(type)
Q_UNUSED(message) Q_UNUSED(message)
#endif #endif
} }
#endif #endif
Debugging::Debugging() {
}

10
src/miscellaneous/debugging.h Normal file → Executable file
View File

@ -26,14 +26,14 @@ class Debugging {
// Specifies format of output console messages. // Specifies format of output console messages.
// NOTE: QT_NO_DEBUG_OUTPUT - disables debug outputs completely!!! // NOTE: QT_NO_DEBUG_OUTPUT - disables debug outputs completely!!!
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
static void debugHandler(QtMsgType type, static void debugHandler(QtMsgType type, const QMessageLogContext &placement, const QString &message);
const QMessageLogContext &placement,
const QString &message);
#else #else
static void debugHandler(QtMsgType type, static void debugHandler(QtMsgType type, const char *message);
const char *message);
#endif #endif
static void performLog(const char *message, QtMsgType type, const char *file = 0, const char *function = 0, int line = -1);
static const char *typeToString(QtMsgType type);
private: private:
// Constructor. // Constructor.
explicit Debugging(); explicit Debugging();

View File

@ -79,9 +79,6 @@ class IconFactory : public QObject {
// Sets icon theme with given name as the active one and loads it. // Sets icon theme with given name as the active one and loads it.
void setCurrentIconTheme(const QString &theme_name); void setCurrentIconTheme(const QString &theme_name);
// Singleton getter.
static IconFactory *instance();
private: private:
QHash<QString, QIcon> m_cachedIcons; QHash<QString, QIcon> m_cachedIcons;
QString m_currentIconTheme; QString m_currentIconTheme;

View File

@ -238,8 +238,7 @@ DVALUE(bool) Browser::QueueTabsDef = true;
// Categories. // Categories.
DKEY Categories::ID = "categories_expand_states"; DKEY Categories::ID = "categories_expand_states";
Settings::Settings(const QString &file_name, Format format, Settings::Settings(const QString &file_name, Format format, const SettingsType &status, QObject *parent)
const Type &status, QObject *parent)
: QSettings(file_name, format, parent), m_initializationStatus(status) { : QSettings(file_name, format, parent), m_initializationStatus(status) {
} }
@ -248,6 +247,10 @@ Settings::~Settings() {
qDebug("Deleting Settings instance."); qDebug("Deleting Settings instance.");
} }
QString Settings::pathName() const {
return QFileInfo(fileName()).absolutePath();
}
QSettings::Status Settings::checkSettings() { QSettings::Status Settings::checkSettings() {
qDebug("Syncing settings."); qDebug("Syncing settings.");
@ -281,14 +284,40 @@ void Settings::finishRestoration(const QString &desired_settings_file_path) {
Settings *Settings::setupSettings(QObject *parent) { Settings *Settings::setupSettings(QObject *parent) {
Settings *new_settings; Settings *new_settings;
// If settings file exists in executable file working directory // If settings file exists (and is writable) in executable file working directory
// (in subdirectory APP_CFG_PATH), then use it (portable settings). // (in subdirectory APP_CFG_PATH), then use it (portable settings).
// Otherwise use settings file stored in home path. // Otherwise use settings file stored in home path.
QString relative_path = QDir::separator() + QString(APP_CFG_PATH) + QDir::separator() + QString(APP_CFG_FILE); SettingsProperties properties = determineProperties();
finishRestoration(properties.m_absoluteSettingsFileName);
// Portable settings are available, use them.
new_settings = new Settings(properties.m_absoluteSettingsFileName, QSettings::IniFormat, properties.m_type, parent);
// Construct icon cache in the same path.
QString web_path = properties.m_baseDirectory + QDir::separator() + QString(APP_DB_WEB_PATH);
QDir(web_path).mkpath(web_path);
QWebSettings::setIconDatabasePath(web_path);
// Check if portable settings are available.
if (properties.m_type == SettingsType::Portable) {
qDebug("Initializing settings in '%s' (portable way).", qPrintable(QDir::toNativeSeparators(properties.m_absoluteSettingsFileName)));
}
else {
qDebug("Initializing settings in '%s' (non-portable way).", qPrintable(QDir::toNativeSeparators(properties.m_absoluteSettingsFileName)));
}
return new_settings;
}
SettingsProperties Settings::determineProperties() {
SettingsProperties properties;
properties.m_settingsSuffix = QDir::separator() + QString(APP_CFG_PATH) + QDir::separator() + QString(APP_CFG_FILE);
QString app_path = qApp->applicationDirPath(); QString app_path = qApp->applicationDirPath();
QString app_path_file = app_path + relative_path;
QString home_path = qApp->homeFolderPath() + QDir::separator() + QString(APP_LOW_H_NAME); QString home_path = qApp->homeFolderPath() + QDir::separator() + QString(APP_LOW_H_NAME);
QString home_path_file = home_path + relative_path; QString home_path_file = home_path + properties.m_settingsSuffix;
bool portable_settings_available = QFileInfo(app_path).isWritable(); bool portable_settings_available = QFileInfo(app_path).isWritable();
bool non_portable_settings_exist = QFile::exists(home_path_file); bool non_portable_settings_exist = QFile::exists(home_path_file);
@ -297,34 +326,16 @@ Settings *Settings::setupSettings(QObject *parent) {
// settings was not initialized before. // settings was not initialized before.
bool will_we_use_portable_settings = portable_settings_available && !non_portable_settings_exist; bool will_we_use_portable_settings = portable_settings_available && !non_portable_settings_exist;
// Check if portable settings are available.
if (will_we_use_portable_settings) { if (will_we_use_portable_settings) {
finishRestoration(app_path_file); properties.m_type = SettingsType::Portable;
properties.m_baseDirectory = app_path;
// Portable settings are available, use them.
new_settings = new Settings(app_path_file, QSettings::IniFormat, Settings::Portable, parent);
// Construct icon cache in the same path.
QString web_path = app_path + QDir::separator() + QString(APP_DB_WEB_PATH);
QDir(web_path).mkpath(web_path);
QWebSettings::setIconDatabasePath(web_path);
qDebug("Initializing settings in '%s' (portable way).", qPrintable(QDir::toNativeSeparators(app_path_file)));
} }
else { else {
finishRestoration(home_path_file); properties.m_type = SettingsType::NonPortable;
properties.m_baseDirectory = home_path;
// Portable settings are NOT available, store them in
// user's home directory.
new_settings = new Settings(home_path_file, QSettings::IniFormat, Settings::NonPortable, parent);
// Construct icon cache in the same path.
QString web_path = home_path + QDir::separator() + QString(APP_DB_WEB_PATH);
QDir(web_path).mkpath(web_path);
QWebSettings::setIconDatabasePath(web_path);
qDebug("Initializing settings in '%s' (non-portable way).", qPrintable(QDir::toNativeSeparators(home_path_file)));
} }
return new_settings; properties.m_absoluteSettingsFileName = properties.m_baseDirectory + properties.m_settingsSuffix;
return properties;
} }

View File

@ -22,7 +22,8 @@
#include "definitions/definitions.h" #include "definitions/definitions.h"
#include <QPointer> #include "miscellaneous/settingsproperties.h"
#include <QNetworkProxy> #include <QNetworkProxy>
#define KEY extern const char* #define KEY extern const char*
@ -267,17 +268,11 @@ class Settings : public QSettings {
Q_OBJECT Q_OBJECT
public: public:
// Describes possible types of loaded settings.
enum Type {
Portable,
NonPortable
};
// Destructor. // Destructor.
virtual ~Settings(); virtual ~Settings();
// Type of used settings. // Type of used settings.
inline Type type() const { inline SettingsType type() const {
return m_initializationStatus; return m_initializationStatus;
} }
@ -302,6 +297,9 @@ class Settings : public QSettings {
QSettings::remove(QString("%1/%2").arg(section, key)); QSettings::remove(QString("%1/%2").arg(section, key));
} }
// Returns the path which contains the settings.
QString pathName() const;
// Synchronizes settings. // Synchronizes settings.
QSettings::Status checkSettings(); QSettings::Status checkSettings();
@ -311,11 +309,13 @@ class Settings : public QSettings {
// Creates settings file in correct location. // Creates settings file in correct location.
static Settings *setupSettings(QObject *parent); static Settings *setupSettings(QObject *parent);
static SettingsProperties determineProperties();
private: private:
// Constructor. // Constructor.
explicit Settings(const QString &file_name, Format format, const Type &type, QObject *parent = 0); explicit Settings(const QString &file_name, Format format, const SettingsType &type, QObject *parent = 0);
Type m_initializationStatus; SettingsType m_initializationStatus;
}; };
#endif // SETTINGS_H #endif // SETTINGS_H

View File

@ -0,0 +1,21 @@
#ifndef SETTINGSPROPERTIES_H
#define SETTINGSPROPERTIES_H
#include <QString>
// Describes possible types of loaded settings.
enum SettingsType {
Portable,
NonPortable
};
// Describes characteristics of settings.
struct SettingsProperties {
SettingsType m_type;
QString m_baseDirectory;
QString m_settingsSuffix;
QString m_absoluteSettingsFileName;
};
#endif // SETTINGSPROPERTIES_H

1
src/miscellaneous/systemfactory.h Normal file → Executable file
View File

@ -20,7 +20,6 @@
#include <QObject> #include <QObject>
#include <QPointer>
#include <QMetaType> #include <QMetaType>
#include <QHash> #include <QHash>
#include <QPair> #include <QPair>