#include <profileengine.h>
Public Types | |
enum | OfferType { Global, Project, Core } |
Public Member Functions | |
TDETrader::OfferList | offers (const TQString &profileName, OfferType offerType) |
TDETrader::OfferList | allOffers (OfferType offerType) |
KURL::List | resources (const TQString &profileName, const TQString &nameFilter) |
KURL::List | resourcesRecursive (const TQString &profileName, const TQString &nameFilter) |
void | addResource (const TQString &profileName, const KURL &url) |
void | diffProfiles (OfferType offerType, const TQString &profile1, const TQString &profile2, TQStringList &unload, TDETrader::OfferList &load) |
Profile * | rootProfile () const |
Profile * | findProfile (const TQString &profileName) |
template<class Operation > | |
void | walkProfiles (Operation &op, Profile *root) |
template<class Operation , class Result > | |
void | walkProfiles (Operation &op, Result *result, Profile *root) |
Protected Member Functions | |
void | processDir (const TQString &dir, const TQString &currPath, TQMap< TQString, Profile *> &passedPaths, Profile *root) |
KURL::List | resources (Profile *profile, const TQString &nameFilter) |
void | getProfileWithListing (ProfileListing &listing, Profile **profile, const TQString &profileName) |
Detailed Description
Profile engine.
- Uses KDevelop profiles to form lists of plugin offers;
- Provides means of managing profiles;
- Provides means to access the resources provided by a profile.
KDevelop profiles form a tree with a root profile named "KDevelop". For example, such profiles tree can look as:
To manage a tree of profiles, use ProfileEngine::walkProfiles methods.
Definition at line 88 of file profileengine.h.
Member Enumeration Documentation
◆ OfferType
Type of the plugin offer.
Engine will usually find profiles and return offers of selected type.
- See also
- KDevPlugin class documentation for more information of plugin types.
Enumerator | |
---|---|
Global | Global plugins. |
Project | Project plugins. |
Core | Core plugins. |
Definition at line 96 of file profileengine.h.
Member Function Documentation
◆ addResource()
void ProfileEngine::addResource | ( | const TQString & | profileName, |
const KURL & | url | ||
) |
Adds a resource for the profile.
Resource will be copied to the user profile directory (like $HOME/.trinity/share/apps/tdevelop/profiles/...).
- Parameters
-
profileName A name of the profile. url The url to a file to copy as a profile resource.
Definition at line 254 of file profileengine.cpp.
◆ allOffers()
TDETrader::OfferList ProfileEngine::allOffers | ( | OfferType | offerType | ) |
- Returns
- The list of all plugin offers for given type.
Definition at line 150 of file profileengine.cpp.
◆ diffProfiles()
void ProfileEngine::diffProfiles | ( | OfferType | offerType, |
const TQString & | profile1, | ||
const TQString & | profile2, | ||
TQStringList & | unload, | ||
TDETrader::OfferList & | load | ||
) |
Gets the difference between profile1
and profile2
.
Difference is calculated as two lists of plugins to be unloaded and loaded in order to switch from profile1
to profile2
.
- Parameters
-
offerType A type of plugin offers to list. profile1 A name of the first profile. profile2 A name of the second profile. unload Will be filled with a list of plugins to unload. load Will be filled with a list of plugins to load.
- Note
- Resulting lists are not cleared. Pass only clean lists in the common case.
Definition at line 210 of file profileengine.cpp.
◆ findProfile()
Profile * ProfileEngine::findProfile | ( | const TQString & | profileName | ) |
Finds a profile with given name.
- Returns
- The profile found or 0 if it does not exist.
Definition at line 246 of file profileengine.cpp.
◆ getProfileWithListing()
|
protected |
Gets a complete listing of available profiles and looks for a profile.
- Parameters
-
listing Profiles listing will be saved here. profile Will be a pointer to a profile with the name profileName
or 0 if no profile with that name is found.profileName The name of a profile to find.
Definition at line 167 of file profileengine.cpp.
◆ offers()
TDETrader::OfferList ProfileEngine::offers | ( | const TQString & | profileName, |
OfferType | offerType | ||
) |
- Returns
- The list of plugin offers for given profile and type.
Definition at line 72 of file profileengine.cpp.
◆ resources()
KURL::List ProfileEngine::resources | ( | const TQString & | profileName, |
const TQString & | nameFilter | ||
) |
- Returns
- The list of URLs to the resources (files) with given
extension
.
- Parameters
-
profileName A name of a profile to find resources in. nameFilter Name filter for files.
- See also
- TQDir::setNameFilter documentation for name filters syntax.
Definition at line 179 of file profileengine.cpp.
◆ resourcesRecursive()
KURL::List ProfileEngine::resourcesRecursive | ( | const TQString & | profileName, |
const TQString & | nameFilter | ||
) |
- Returns
- The list of URLs to the resources (files) with given
extension
. This list is obtained by a recursive search that process given profile and all it's subprofiles.
- Parameters
-
profileName A name of a profile to find resources in. nameFilter Name filter for files.
- See also
- TQDir::setNameFilter documentation for name filters syntax.
Definition at line 196 of file profileengine.cpp.
◆ rootProfile()
|
inline |
- Returns
- The root profile. Root profile is always named "KDevelop" and it defines an empty list of plugins. Applications built on KDevelop platform will define nested profiles.
Definition at line 143 of file profileengine.h.
◆ walkProfiles() [1/2]
|
inline |
Walks profiles tree and applies operation op
to each profile found in the tree below root
(root
profile itself is not processed).
Operation is a class that have operator(Profile *). Example of operation class which is used to build a plain list of profiles:
Use case for such operation - building a list of all profiles:
- Note
- ProfileListing and ProfileListingEx operations are already defined in profileengine.h header file.
- Parameters
-
op An operation to apply. root A profile to start walking from. Complete subtree of the root
is traversed.
Definition at line 178 of file profileengine.h.
◆ walkProfiles() [2/2]
|
inline |
Walks profiles tree and applies operation op
to each profile found in the tree below root
(root
profile itself is not processed) but the operation in this case returns a result of type defined by "Result" template parameter.
When iterating the tree, the result of operation applied to the parent profile is passed as result
parameter to the recursive call for child profiles.
For example, this function can be used to build another hierarcy of profiles or other objects connected to profiles. Example of operation class which is used to build a listview with items where each item represents a profile:
Use case for such operation - building a listview:
- Parameters
-
op An operation to apply. result A result of the operation as it would have been applied to the root
.root A profile to start walking from. Complete subtree of the root
is traversed.
Definition at line 245 of file profileengine.h.
The documentation for this class was generated from the following files: