qBittorrent
Private::CustomProfile Class Referencefinal

Custom tree: creates directories under the specified root directory. More...

#include <profile_p.h>

Inheritance diagram for Private::CustomProfile:
Collaboration diagram for Private::CustomProfile:

Public Member Functions

 CustomProfile (const QString &rootPath, const QString &configurationName)
 
QString rootPath () const override
 
QString basePath () const override
 The base path against to which portable (relative) paths are resolved. More...
 
QString cacheLocation () const override
 
QString configLocation () const override
 
QString dataLocation () const override
 
QString downloadLocation () const override
 
SettingsPtr applicationSettings (const QString &name) const override
 
- Public Member Functions inherited from Private::Profile
virtual ~Profile ()=default
 
QString configurationName () const
 
QString profileName () const
 QCoreApplication::applicationName() with optional configuration name appended. More...
 

Private Attributes

const QDir m_rootDir
 
const QDir m_baseDir
 
const QString m_cacheLocation
 
const QString m_configLocation
 
const QString m_dataLocation
 
const QString m_downloadLocation
 

Additional Inherited Members

- Protected Member Functions inherited from Private::Profile
 Profile (const QString &configurationName)
 
QString configurationSuffix () const
 

Detailed Description

Custom tree: creates directories under the specified root directory.

Definition at line 99 of file profile_p.h.

Constructor & Destructor Documentation

◆ CustomProfile()

Private::CustomProfile::CustomProfile ( const QString &  rootPath,
const QString &  configurationName 
)

Definition at line 127 of file profile_p.cpp.

129  , m_rootDir {rootPath}
130  , m_baseDir {m_rootDir.absoluteFilePath(profileName())}
131  , m_cacheLocation {m_baseDir.absoluteFilePath(QLatin1String("cache"))}
132  , m_configLocation {m_baseDir.absoluteFilePath(QLatin1String("config"))}
133  , m_dataLocation {m_baseDir.absoluteFilePath(QLatin1String("data"))}
134  , m_downloadLocation {m_baseDir.absoluteFilePath(QLatin1String("downloads"))}
135 {
136 }
const QString m_downloadLocation
Definition: profile_p.h:118
const QDir m_baseDir
Definition: profile_p.h:114
const QString m_configLocation
Definition: profile_p.h:116
QString rootPath() const override
Definition: profile_p.cpp:138
const QDir m_rootDir
Definition: profile_p.h:113
const QString m_dataLocation
Definition: profile_p.h:117
const QString m_cacheLocation
Definition: profile_p.h:115
QString profileName() const
QCoreApplication::applicationName() with optional configuration name appended.
Definition: profile_p.cpp:49
QString configurationName() const
Definition: profile_p.cpp:39

Member Function Documentation

◆ applicationSettings()

SettingsPtr Private::CustomProfile::applicationSettings ( const QString &  name) const
overridevirtual

Implements Private::Profile.

Definition at line 168 of file profile_p.cpp.

169 {
170  // here we force QSettings::IniFormat format always because we need it to be portable across platforms
171 #if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
172  const char CONF_FILE_EXTENSION[] = ".ini";
173 #else
174  const char CONF_FILE_EXTENSION[] = ".conf";
175 #endif
176  const QString settingsFileName {QDir(configLocation()).absoluteFilePath(name + QLatin1String(CONF_FILE_EXTENSION))};
177  return SettingsPtr(new QSettings(settingsFileName, QSettings::IniFormat));
178 }
QString configLocation() const override
Definition: profile_p.cpp:153
std::unique_ptr< QSettings > SettingsPtr
Definition: profile.h:44

◆ basePath()

QString Private::CustomProfile::basePath ( ) const
overridevirtual

The base path against to which portable (relative) paths are resolved.

Implements Private::Profile.

Definition at line 143 of file profile_p.cpp.

144 {
145  return m_baseDir.absolutePath();
146 }

◆ cacheLocation()

QString Private::CustomProfile::cacheLocation ( ) const
overridevirtual

Implements Private::Profile.

Definition at line 148 of file profile_p.cpp.

149 {
150  return m_cacheLocation;
151 }

◆ configLocation()

QString Private::CustomProfile::configLocation ( ) const
overridevirtual

Implements Private::Profile.

Definition at line 153 of file profile_p.cpp.

154 {
155  return m_configLocation;
156 }

◆ dataLocation()

QString Private::CustomProfile::dataLocation ( ) const
overridevirtual

Implements Private::Profile.

Definition at line 158 of file profile_p.cpp.

159 {
160  return m_dataLocation;
161 }

◆ downloadLocation()

QString Private::CustomProfile::downloadLocation ( ) const
overridevirtual

Implements Private::Profile.

Definition at line 163 of file profile_p.cpp.

164 {
165  return m_downloadLocation;
166 }

◆ rootPath()

QString Private::CustomProfile::rootPath ( ) const
overridevirtual

Implements Private::Profile.

Definition at line 138 of file profile_p.cpp.

139 {
140  return m_rootDir.absolutePath();
141 }

Member Data Documentation

◆ m_baseDir

const QDir Private::CustomProfile::m_baseDir
private

Definition at line 114 of file profile_p.h.

◆ m_cacheLocation

const QString Private::CustomProfile::m_cacheLocation
private

Definition at line 115 of file profile_p.h.

◆ m_configLocation

const QString Private::CustomProfile::m_configLocation
private

Definition at line 116 of file profile_p.h.

◆ m_dataLocation

const QString Private::CustomProfile::m_dataLocation
private

Definition at line 117 of file profile_p.h.

◆ m_downloadLocation

const QString Private::CustomProfile::m_downloadLocation
private

Definition at line 118 of file profile_p.h.

◆ m_rootDir

const QDir Private::CustomProfile::m_rootDir
private

Definition at line 113 of file profile_p.h.


The documentation for this class was generated from the following files: