• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop Shell Profiles Library
 

KDevelop Shell Profiles Library

Public Types | Public Member Functions | Protected Member Functions | List of all members
ProfileEngine Class Reference

#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:

KDevelop
- IDE
- CompiledLanguageIDE
- AdaIDE
- CandCppIDE
- CIDE
- CppIDE
- KDECppIDE
- FortranIDE
...
- DatabaseIDE
- ScriptingLanguageIDE
..
- KDevAssistant

To manage a tree of profiles, use ProfileEngine::walkProfiles methods.

Definition at line 88 of file profileengine.h.

Member Enumeration Documentation

◆ OfferType

enum ProfileEngine::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
profileNameA name of the profile.
urlThe 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
offerTypeA type of plugin offers to list.
profile1A name of the first profile.
profile2A name of the second profile.
unloadWill be filled with a list of plugins to unload.
loadWill 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()

void ProfileEngine::getProfileWithListing ( ProfileListing &  listing,
Profile **  profile,
const TQString &  profileName 
)
protected

Gets a complete listing of available profiles and looks for a profile.

Parameters
listingProfiles listing will be saved here.
profileWill be a pointer to a profile with the name profileName or 0 if no profile with that name is found.
profileNameThe 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
profileNameA name of a profile to find resources in.
nameFilterName 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
profileNameA name of a profile to find resources in.
nameFilterName filter for files.
See also
TQDir::setNameFilter documentation for name filters syntax.

Definition at line 196 of file profileengine.cpp.

◆ rootProfile()

Profile* ProfileEngine::rootProfile ( ) const
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]

template<class Operation >
void ProfileEngine::walkProfiles ( Operation &  op,
Profile *  root 
)
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:

class ProfileListing{
public:
void operator() (Profile *profile)
{
profiles[profile->name()] = profile;
}
TQMap<TQString, Profile*> profiles;
};

Use case for such operation - building a list of all profiles:

ProfileEngine engine;
ProfileListing listing;
engine.walkProfiles<ProfileListing>(listing, engine.rootProfile());
Note
ProfileListing and ProfileListingEx operations are already defined in profileengine.h header file.
Parameters
opAn operation to apply.
rootA profile to start walking from. Complete subtree of the root is traversed.

Definition at line 178 of file profileengine.h.

◆ walkProfiles() [2/2]

template<class Operation , class Result >
void ProfileEngine::walkProfiles ( Operation &  op,
Result *  result,
Profile *  root 
)
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:

class ProfileListBuilding {
public:
ProfileItem * operator() (ProfileItem *parent, Profile *profile)
{
parent->setOpen(true);
return new ProfileItem(parent, profile);
}
};
class ProfileItem: public TDEListViewItem {
public:
ProfileItem(TDEListView *parent, Profile *profile)
:TDEListViewItem(parent), m_profile(profile)
{
setText(0, profile->genericName());
setText(1, profile->description());
}
ProfileItem(TDEListViewItem *parent, Profile *profile)
: TDEListViewItem(parent), m_profile(profile)
{
setText(0, profile->genericName());
setText(1, profile->description());
}
Profile *profile() const { return m_profile; }
private:
Profile *m_profile;
};

Use case for such operation - building a listview:

ProfileEngine engine;
ProfileItem *item = new ProfileItem(profilesList, engine.rootProfile());
ProfileListBuilding op;
engine.walkProfiles<ProfileListBuilding, ProfileItem>(op, item, engine.rootProfile());
Parameters
opAn operation to apply.
resultA result of the operation as it would have been applied to the root.
rootA 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:
  • profileengine.h
  • profileengine.cpp

KDevelop Shell Profiles Library

Skip menu "KDevelop Shell Profiles Library"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

KDevelop Shell Profiles Library

Skip menu "KDevelop Shell Profiles Library"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for KDevelop Shell Profiles Library by doxygen 1.8.13
This website is maintained by Timothy Pearson.