QGIS API Documentation
4.3.0-Master (1c7cf7431bd)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgsuserprofilemanager.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsuserprofilemanager.h
3
--------------------------------------
4
Date : Jul-2017
5
Copyright : (C) 2017 by Nathan Woodrow
6
Email : woodrow.nathan at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
#ifndef QGSUSERPROFILEMANAGER_H
16
#define QGSUSERPROFILEMANAGER_H
17
18
#include <memory>
19
20
#include "
qgis.h
"
21
#include "qgis_core.h"
22
#include "
qgis_sip.h
"
23
#include "
qgserror.h
"
24
#include "
qgsuserprofile.h
"
25
26
#include <QFileSystemWatcher>
27
#include <QSettings>
28
29
class
QgsSettingsEntryBool
;
30
class
QgsSettingsEntryString
;
31
43
class
CORE_EXPORT
QgsUserProfileManager
:
public
QObject
44
{
45
Q_OBJECT
46
47
public
:
48
static
const
QgsSettingsEntryBool
*
settingsOverrideLocalProfile
SIP_SKIP
;
49
50
static
const
QgsSettingsEntryString
*
settingsDefaultProfile
SIP_SKIP
;
51
55
QgsUserProfileManager
(
const
QString &
rootLocation
= QString(), QObject *parent =
nullptr
);
56
62
static
QString
resolveProfilesFolder
(
const
QString &basePath = QString() );
63
75
std::unique_ptr< QgsUserProfile >
getProfile
(
const
QString &defaultProfile =
"default"
,
bool
createNew =
true
,
bool
initSettings =
true
);
76
82
void
setRootLocation
(
const
QString &rootProfileLocation );
83
88
QString
rootLocation
()
const
{
return
mRootProfilePath; }
89
100
void
setNewProfileNotificationEnabled(
bool
enabled );
101
109
bool
isNewProfileNotificationEnabled()
const
;
110
115
bool
rootLocationIsSet()
const
;
116
120
QStringList allProfiles()
const
;
121
126
bool
profileExists(
const
QString &name )
const
;
127
136
QString defaultProfileName()
const
;
137
143
void
setDefaultProfileName(
const
QString &name );
144
148
void
setDefaultFromActive();
149
154
QString lastProfileName()
const
;
155
160
void
updateLastProfileName()
SIP_SKIP
;
161
166
Qgis
::UserProfileSelectionPolicy userProfileSelectionPolicy() const;
167
173
void
setUserProfileSelectionPolicy(
Qgis
::UserProfileSelectionPolicy policy );
174
180
std::unique_ptr<
QgsUserProfile
> profileForName( const QString &name ) const;
181
187
QgsError
createUserProfile( const QString &name );
188
195
QgsError
deleteProfile( const QString &name );
196
201
QgsUserProfile
*userProfile();
202
210
void
setActiveUserProfile( const QString &profile );
211
216
void
loadUserProfile( const QString &name );
217
222
QSettings *settings();
223
224
signals:
225
235
void
profilesChanged
();
236
237
private:
238
bool
mWatchProfiles = false;
239
std::unique_ptr<QFileSystemWatcher> mWatcher;
240
241
QString mRootProfilePath;
242
243
std::unique_ptr<
QgsUserProfile
> mUserProfile;
244
245
QString settingsFile() const;
246
247
std::unique_ptr< QSettings > mSettings;
248
};
249
250
// clazy:excludeall=qstring-allocations
251
252
#endif
// QGSUSERPROFILEMANAGER_H
Qgis
Provides global constants and enumerations for use throughout the application.
Definition
qgis.h:62
QgsError
A container for error messages.
Definition
qgserror.h:83
QgsSettingsEntryBool
A boolean settings entry.
Definition
qgssettingsentryimpl.h:298
QgsSettingsEntryString
A string settings entry.
Definition
qgssettingsentryimpl.h:123
QgsUserProfileManager::getProfile
std::unique_ptr< QgsUserProfile > getProfile(const QString &defaultProfile="default", bool createNew=true, bool initSettings=true)
Returns the profile from the given root profile location.
Definition
qgsuserprofilemanager.cpp:53
QgsUserProfileManager::setRootLocation
void setRootLocation(const QString &rootProfileLocation)
Set the root profile location for the profile manager.
Definition
qgsuserprofilemanager.cpp:69
QgsUserProfileManager::settingsDefaultProfile
static const QgsSettingsEntryString * settingsDefaultProfile
Definition
qgsuserprofilemanager.h:50
QgsUserProfileManager::resolveProfilesFolder
static QString resolveProfilesFolder(const QString &basePath=QString())
Resolves the profiles folder for the given path.
Definition
qgsuserprofilemanager.cpp:48
QgsUserProfileManager::settingsOverrideLocalProfile
static const QgsSettingsEntryBool * settingsOverrideLocalProfile
Definition
qgsuserprofilemanager.h:48
QgsUserProfileManager::QgsUserProfileManager
QgsUserProfileManager(const QString &rootLocation=QString(), QObject *parent=nullptr)
User profile manager used to manage user profiles for the instance of QGIS.
Definition
qgsuserprofilemanager.cpp:42
QgsUserProfileManager::profilesChanged
void profilesChanged()
Emitted when the list of profiles is changed.
QgsUserProfileManager::rootLocation
QString rootLocation() const
Returns the path to the root profiles location.
Definition
qgsuserprofilemanager.h:88
QgsUserProfile
User profile contains information about the user profile folders on the machine.
Definition
qgsuserprofile.h:36
qgis.h
qgis_sip.h
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
qgserror.h
qgsuserprofile.h
Generated on
for QGIS API Documentation by
1.17.0