mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-02 02:16:53 +01:00
Settings type fix.
This commit is contained in:
parent
820b1b9a52
commit
7747dc49a3
@ -105,7 +105,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() == SettingsType::Portable) {
|
if (qApp->settings()->type() == SettingsProperties::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)));
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ void DatabaseFactory::finishRestoration() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseFactory::sqliteAssemblyDatabaseFilePath() {
|
void DatabaseFactory::sqliteAssemblyDatabaseFilePath() {
|
||||||
if (qApp->settings()->type() == SettingsType::Portable) {
|
if (qApp->settings()->type() == SettingsProperties::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 {
|
||||||
|
@ -238,7 +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, const SettingsType &status, QObject *parent)
|
Settings::Settings(const QString &file_name, Format format, const SettingsProperties::SettingsType &status, QObject *parent)
|
||||||
: QSettings(file_name, format, parent), m_initializationStatus(status) {
|
: QSettings(file_name, format, parent), m_initializationStatus(status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ Settings *Settings::setupSettings(QObject *parent) {
|
|||||||
QWebSettings::setIconDatabasePath(web_path);
|
QWebSettings::setIconDatabasePath(web_path);
|
||||||
|
|
||||||
// Check if portable settings are available.
|
// Check if portable settings are available.
|
||||||
if (properties.m_type == SettingsType::Portable) {
|
if (properties.m_type == SettingsProperties::Portable) {
|
||||||
qDebug("Initializing settings in '%s' (portable way).", qPrintable(QDir::toNativeSeparators(properties.m_absoluteSettingsFileName)));
|
qDebug("Initializing settings in '%s' (portable way).", qPrintable(QDir::toNativeSeparators(properties.m_absoluteSettingsFileName)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -325,11 +325,11 @@ SettingsProperties Settings::determineProperties() {
|
|||||||
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;
|
||||||
|
|
||||||
if (will_we_use_portable_settings) {
|
if (will_we_use_portable_settings) {
|
||||||
properties.m_type = SettingsType::Portable;
|
properties.m_type = SettingsProperties::Portable;
|
||||||
properties.m_baseDirectory = app_path;
|
properties.m_baseDirectory = app_path;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
properties.m_type = SettingsType::NonPortable;
|
properties.m_type = SettingsProperties::NonPortable;
|
||||||
properties.m_baseDirectory = home_path;
|
properties.m_baseDirectory = home_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ class Settings : public QSettings {
|
|||||||
virtual ~Settings();
|
virtual ~Settings();
|
||||||
|
|
||||||
// Type of used settings.
|
// Type of used settings.
|
||||||
inline SettingsType type() const {
|
inline SettingsProperties::SettingsType type() const {
|
||||||
return m_initializationStatus;
|
return m_initializationStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,9 +313,9 @@ class Settings : public QSettings {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Constructor.
|
// Constructor.
|
||||||
explicit Settings(const QString &file_name, Format format, const SettingsType &type, QObject *parent = 0);
|
explicit Settings(const QString &file_name, Format format, const SettingsProperties::SettingsType &type, QObject *parent = 0);
|
||||||
|
|
||||||
SettingsType m_initializationStatus;
|
SettingsProperties::SettingsType m_initializationStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGS_H
|
#endif // SETTINGS_H
|
||||||
|
@ -5,13 +5,14 @@
|
|||||||
|
|
||||||
|
|
||||||
// Describes possible types of loaded settings.
|
// Describes possible types of loaded settings.
|
||||||
enum SettingsType {
|
|
||||||
Portable,
|
|
||||||
NonPortable
|
|
||||||
};
|
|
||||||
|
|
||||||
// Describes characteristics of settings.
|
// Describes characteristics of settings.
|
||||||
struct SettingsProperties {
|
struct SettingsProperties {
|
||||||
|
enum SettingsType {
|
||||||
|
Portable,
|
||||||
|
NonPortable
|
||||||
|
};
|
||||||
|
|
||||||
SettingsType m_type;
|
SettingsType m_type;
|
||||||
QString m_baseDirectory;
|
QString m_baseDirectory;
|
||||||
QString m_settingsSuffix;
|
QString m_settingsSuffix;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user