kdevplatform/util
#include <environmentprofilelist.h>
Public Member Functions | |
EnvironmentProfileList (const EnvironmentProfileList &rhs) | |
EnvironmentProfileList (const KSharedConfigPtr &config) | |
EnvironmentProfileList (KConfig *config) | |
~EnvironmentProfileList () | |
QStringList | createEnvironment (const QString &profileName, const QStringList &defaultEnvironment) const |
QString | defaultProfileName () const |
EnvironmentProfileList & | operator= (const EnvironmentProfileList &rhs) |
QStringList | profileNames () const |
QMap< QString, QString > | variables (const QString &profileName) const |
Protected Member Functions | |
EnvironmentProfileList () | |
void | loadSettings (KConfig *config) |
void | removeProfile (const QString &profileName) |
void | saveSettings (KConfig *config) const |
void | setDefaultProfile (const QString &profileName) |
QMap< QString, QString > & | variables (const QString &profileName) |
Detailed Description
This class manages a list of environment profiles, each profile containing a number of environment variables and their values.
The class is constructed from a KConfig object for easy usage in the plugins.
The methods to change the environments is protected to disallow access to those methods from plugins, only the environment widget is allowed to change them.
Example Usage
Two entries are used by this class: "Default Environment Group" and "Environment Variables".
"Default Environment Variables" stores the default profile that should be used if the user didn't select a profile via a plugins configuration dialog.
"Environment Variables" entry stores the actual list of <profilenamevarname=varvalue>. The profilename can't contain '' or '='. For example, suppose that two configuration, say "release" and "debug" exist. Then the actual contents of .kdev4 project file will be
Definition at line 71 of file environmentprofilelist.h.
Constructor & Destructor Documentation
◆ EnvironmentProfileList() [1/4]
EnvironmentProfileList::EnvironmentProfileList | ( | const EnvironmentProfileList & | rhs | ) |
Definition at line 99 of file environmentprofilelist.cpp.
◆ EnvironmentProfileList() [2/4]
|
explicit |
Creates an a list of environment profiles from a KConfig object.
- Parameters
-
config the KConfig object to read the environment profiles from
Definition at line 112 of file environmentprofilelist.cpp.
◆ EnvironmentProfileList() [3/4]
|
explicit |
Definition at line 120 of file environmentprofilelist.cpp.
◆ ~EnvironmentProfileList()
|
default |
◆ EnvironmentProfileList() [4/4]
|
protected |
Definition at line 193 of file environmentprofilelist.cpp.
Member Function Documentation
◆ createEnvironment()
QStringList EnvironmentProfileList::createEnvironment | ( | const QString & | profileName, |
const QStringList & | defaultEnvironment | ||
) | const |
Creates a merged environment between the defaults specified by defaultEnvironment and those saved in profileName.
Definition at line 198 of file environmentprofilelist.cpp.
◆ defaultProfileName()
QString EnvironmentProfileList::defaultProfileName | ( | ) | const |
returns the name of the default profile The default profile should be used by plugins unless the user chooses a different profile
- Returns
- the name of the default profile, defaults to "default"
Definition at line 144 of file environmentprofilelist.cpp.
◆ loadSettings()
|
protected |
Definition at line 171 of file environmentprofilelist.cpp.
◆ operator=()
EnvironmentProfileList & EnvironmentProfileList::operator= | ( | const EnvironmentProfileList & | rhs | ) |
Definition at line 104 of file environmentprofilelist.cpp.
◆ profileNames()
QStringList EnvironmentProfileList::profileNames | ( | ) | const |
Fetch the list of names of known profiles from the list.
- Returns
- the list of profile names
Definition at line 179 of file environmentprofilelist.cpp.
◆ removeProfile()
|
protected |
Definition at line 186 of file environmentprofilelist.cpp.
◆ saveSettings()
|
protected |
Stores the environment profiles in this list to the given KConfig object.
- Parameters
-
config a KConfig object to which the environment settings should be stored
Definition at line 163 of file environmentprofilelist.cpp.
◆ setDefaultProfile()
|
protected |
Changes the default profile.
- Parameters
-
profileName the name of the new default profile, if a profile of this name doesn't exist the default profile is not changed
Definition at line 151 of file environmentprofilelist.cpp.
◆ variables() [1/2]
|
protected |
returns the variables that are set for a given profile.
This function provides write access to the environment, so new variables can be inserted, existing ones changed or deleted
If a non-existing profile is specified this returns a new empty map and that way this function can be used to add a new profile to the list of environment profiles
- Parameters
-
profileName the name of the profile for which the environment should be returned
- Returns
- a map containing the environment variables for this profile, or an empty map if the profile doesn't exist in this list
Definition at line 137 of file environmentprofilelist.cpp.
◆ variables() [2/2]
returns the variables that are set for a given profile.
This function provides read-only access to the environment
- Parameters
-
profileName the name of the profile for which the environment should be returned
- Returns
- a map containing the environment variables for this profile, or an empty map if the profile doesn't exist in this list
Definition at line 130 of file environmentprofilelist.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Jan 19 2021 23:37:29 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.