Commit d7a5bede authored by Adam Treat's avatar Adam Treat

* add some documentation to the new config framework

* remove dumb setting in the global config file
parent 71c48d1a
[General Options]
Builder=KDevMakeBuilder
Display Document Categories=false
Importer=KDevGenericImporter
PrimaryLanguage=C++
Project Management=KDevProjectManager
......@@ -25,8 +25,6 @@ Boston, MA 02110-1301, USA.
#include "kdevapi.h"
#include "kdevcore.h"
KDevConfig *KDevConfig ::s_instance = 0;
KDevConfig::KDevConfig( QObject *parent )
: QObject( parent )
{}
......@@ -34,14 +32,20 @@ KDevConfig::KDevConfig( QObject *parent )
KDevConfig::~KDevConfig()
{}
KDevConfig *KDevConfig::getInstance()
KConfig *KDevConfig::standard()
{
return sharedStandard().data();
}
KConfig *KDevConfig::localProject()
{
if ( !s_instance )
s_instance = new KDevConfig;
return s_instance;
return sharedLocalProject().data();
}
//FIXME patch KInstance or KConfig/KConfigBackEnd to return the configFileName();
KConfig *KDevConfig::globalProject()
{
return sharedGlobalProject().data();
}
KSharedConfig::Ptr KDevConfig::sharedStandard()
{
......@@ -109,21 +113,6 @@ KSharedConfig::Ptr KDevConfig::sharedGlobalProject()
return config;
}
KConfig *KDevConfig::globalProject()
{
return sharedGlobalProject().data();
}
KConfig *KDevConfig::localProject()
{
return sharedLocalProject().data();
}
KConfig *KDevConfig::standard()
{
return sharedStandard().data();
}
#include "kdevconfig.moc"
// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on
......@@ -25,6 +25,12 @@ Boston, MA 02110-1301, USA.
#include "kdevexport.h"
/**
The interface to KDevelop's config objects.
Developers using the KDevelop API should use these config objects instead of
the standard KGlobal::config object. Again, DO NOT USE KGlobal::config() as
it can cause unexpected syncing issues.
*/
class KDEVINTERFACES_EXPORT KDevConfig: public QObject
{
Q_OBJECT
......@@ -32,24 +38,59 @@ public:
KDevConfig( QObject *parent = 0 );
virtual ~KDevConfig();
static KSharedConfig::Ptr sharedGlobalProject();
static KSharedConfig::Ptr sharedLocalProject();
static KSharedConfig::Ptr sharedStandard();
static KConfig *globalProject();
/**
* @return A pointer to the standard config object. This object will point
* to different config files depending on whether a project is opened.
* If a project IS NOT opened then the config object will consist of the
* settings found in $KDEINSTALL/config/kdeveloprc and $USER/.kde/config/kdeveloprc.
*
* THE MOST SPECIFIC FILE WILL BE $USER/.kde/config/kdeveloprc.
* If a project IS opened then it will additionally consist of the settings
* found in the global project file and the local project file. THE MOST
* SPECIFIC FILE WILL BE THE GLOBAL PROJECT FILE.
*/
static KConfig *standard();
/**
* @return A pointer to the local project config object. This object will point
* to different config files depending on whether a project is opened.
* If a project IS NOT opened then the config object will consist of the
* settings found in $KDEINSTALL/config/kdeveloprc and $USER/.kde/config/kdeveloprc.
*
* THE MOST SPECIFIC FILE WILL BE $USER/.kde/config/kdeveloprc.
* If a project IS opened then it will additionally consist of the settings
* found in the global project file and the local project file. THE MOST
* SPECIFIC FILE WILL BE THE LOCAL PROJECT FILE.
*/
static KConfig *localProject();
static KConfig *standard();
/**
* @return A pointer to the global project config object. This object will point
* to different config files depending on whether a project is opened.
* If a project IS NOT opened then the config object will consist of the
* settings found in $KDEINSTALL/config/kdeveloprc and $USER/.kde/config/kdeveloprc.
*
* THE MOST SPECIFIC FILE WILL BE $USER/.kde/config/kdeveloprc.
* If a project IS opened then it will additionally consist of the settings
* found in the global project file and the local project file. THE MOST
* SPECIFIC FILE WILL BE THE LOCAL GLOBAL PROJECT FILE.
*
* This function should be RARELY used as it is operationally the same as standard()
*/
static KConfig *globalProject();
private:
static KDevConfig *getInstance();
static KDevConfig *s_instance;
// KSharedConfig::Ptr m_global;
// KSharedConfig::Ptr m_local;
// KSharedConfig::Ptr m_standard;
/**
* @return A shared pointer to the standard config object.
*/
static KSharedConfig::Ptr sharedStandard();
/**
* @return A shared pointer to the local project config object.
*/
static KSharedConfig::Ptr sharedLocalProject();
/**
* @return A shared pointer to the global project config object.
*/
static KSharedConfig::Ptr sharedGlobalProject();
};
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment