Settings type fix.
This commit is contained in:
		
							parent
							
								
									820b1b9a52
								
							
						
					
					
						commit
						7747dc49a3
					
				
					 5 changed files with 14 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -105,7 +105,7 @@ FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout)
 | 
			
		|||
                                                                                 APP_NAME));
 | 
			
		||||
 | 
			
		||||
  // 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_txtPathsDatabaseRoot->setText(QDir::toNativeSeparators(qApp->applicationDirPath() + QDir::separator() + QString(APP_DB_SQLITE_PATH)));
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -114,7 +114,7 @@ void DatabaseFactory::finishRestoration() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
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);
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -238,7 +238,7 @@ DVALUE(bool) Browser::QueueTabsDef  = true;
 | 
			
		|||
// Categories.
 | 
			
		||||
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) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -298,7 +298,7 @@ Settings *Settings::setupSettings(QObject *parent) {
 | 
			
		|||
  QWebSettings::setIconDatabasePath(web_path);
 | 
			
		||||
 | 
			
		||||
  // 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)));
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
| 
						 | 
				
			
			@ -325,11 +325,11 @@ SettingsProperties Settings::determineProperties() {
 | 
			
		|||
  bool will_we_use_portable_settings = portable_settings_available && !non_portable_settings_exist;
 | 
			
		||||
 | 
			
		||||
  if (will_we_use_portable_settings) {
 | 
			
		||||
    properties.m_type = SettingsType::Portable;
 | 
			
		||||
    properties.m_type = SettingsProperties::Portable;
 | 
			
		||||
    properties.m_baseDirectory = app_path;
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
    properties.m_type = SettingsType::NonPortable;
 | 
			
		||||
    properties.m_type = SettingsProperties::NonPortable;
 | 
			
		||||
    properties.m_baseDirectory = home_path;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -272,7 +272,7 @@ class Settings : public QSettings {
 | 
			
		|||
    virtual ~Settings();
 | 
			
		||||
 | 
			
		||||
    // Type of used settings.
 | 
			
		||||
    inline SettingsType type() const {
 | 
			
		||||
    inline SettingsProperties::SettingsType type() const {
 | 
			
		||||
      return m_initializationStatus;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -313,9 +313,9 @@ class Settings : public QSettings {
 | 
			
		|||
 | 
			
		||||
  private:
 | 
			
		||||
    // 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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,13 +5,14 @@
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
// Describes possible types of loaded settings.
 | 
			
		||||
enum SettingsType {
 | 
			
		||||
  Portable,
 | 
			
		||||
  NonPortable
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Describes characteristics of settings.
 | 
			
		||||
struct SettingsProperties {
 | 
			
		||||
    enum SettingsType {
 | 
			
		||||
      Portable,
 | 
			
		||||
      NonPortable
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    SettingsType m_type;
 | 
			
		||||
    QString m_baseDirectory;
 | 
			
		||||
    QString m_settingsSuffix;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue