KDevelop API Documentation

ConfigWidgetProxy Class Reference

This class can be used to implement demand-loading of config pages. More...

#include <configwidgetproxy.h>

Inheritance diagram for ConfigWidgetProxy:

QObject List of all members.

Signals

void insertConfigWidget (const KDialogBase *dlg, QWidget *page, unsigned int pagenumber)
 The proxy emits this signal to notify the client that a specific config page has been requested.


Public Member Functions

 ConfigWidgetProxy (KDevCore *core)
virtual ~ConfigWidgetProxy ()
void createGlobalConfigPage (QString const &title, unsigned int pagenumber)
 Tell the proxy you want a page in the Global Settings.

void createProjectConfigPage (QString const &title, unsigned int pagenumber)
 Tell the proxy you want a page in the Project Settings.

void removeConfigPage (int pagenumber)
 Remove a config page from the proxy.


Private Types

typedef QMap< unsigned int,
QString
TitleMap
typedef QMap< QWidget *, int > PageMap

Private Slots

void slotConfigWidget (KDialogBase *)
void slotProjectConfigWidget (KDialogBase *)
void slotConfigWidgetDestroyed ()
void slotAboutToShowPage (QWidget *page)

Private Attributes

TitleMap _globalTitleMap
TitleMap _projectTitleMap
PageMap _pageMap

Detailed Description

This class can be used to implement demand-loading of config pages.

In order to avoid the potentially heavy and unneccessary creation of a config page that might not be needed, this class can be used to delay the config page creation until the user explicitly asks for it.

A typical case looks like this:

#define BOOKMARKSETTINGSPAGE 1

_configProxy = new ConfigWidgetProxy( core() );
_configProxy->createProjectConfigPage( i18n("Bookmarks"), BOOKMARKSETTINGSPAGE );
connect( _configProxy, SIGNAL(insertConfigWidget(const QObject*, QWidget*, unsigned int )), 
	this, SLOT(insertConfigWidget(const QObject*, QWidget*, unsigned int )) );

...
...

void BookmarksPart::insertConfigWidget( QObject const * dlg, QWidget * page, unsigned int pagenumber )
{
	if ( pagenumber == BOOKMARKSETTINGSPAGE )
	{
		BookmarkSettings * w = new BookmarkSettings( this, page );
		connect( dlg, SIGNAL(okClicked()), w, SLOT(slotAccept()) );
	}	
}

 

Note that this replaces the typical KDevPlugin configWidget() and projectConfigWidget() slots.

Definition at line 64 of file configwidgetproxy.h.


Member Typedef Documentation

typedef QMap<QWidget*, int> ConfigWidgetProxy::PageMap [private]
 

Definition at line 109 of file configwidgetproxy.h.

typedef QMap<unsigned int, QString> ConfigWidgetProxy::TitleMap [private]
 

Definition at line 108 of file configwidgetproxy.h.


Constructor & Destructor Documentation

ConfigWidgetProxy::ConfigWidgetProxy KDevCore core  ) 
 

Definition at line 34 of file configwidgetproxy.cpp.

References ConfigWidgetProxy(), endl(), k_funcinfo, kdDebug(), slotConfigWidget(), and slotProjectConfigWidget().

Referenced by ConfigWidgetProxy().

ConfigWidgetProxy::~ConfigWidgetProxy  )  [virtual]
 

Definition at line 42 of file configwidgetproxy.cpp.

References endl(), k_funcinfo, and kdDebug().


Member Function Documentation

void ConfigWidgetProxy::createGlobalConfigPage QString const &  title,
unsigned int  pagenumber
 

Tell the proxy you want a page in the Global Settings.

Parameters:
title The title of the config page, shown in the settings dialog
pagenumber A per-proxy unique identifier, used when responding to insertConfigWidget() signal

Definition at line 47 of file configwidgetproxy.cpp.

References _globalTitleMap, and createGlobalConfigPage().

Referenced by createGlobalConfigPage(), and DocTreeViewPart::DocTreeViewPart().

void ConfigWidgetProxy::createProjectConfigPage QString const &  title,
unsigned int  pagenumber
 

Tell the proxy you want a page in the Project Settings.

Parameters:
title The title of the config page, shown in the settings dialog
pagenumber A per-proxy unique identifier, used when responding to insertConfigWidget() signal

Definition at line 52 of file configwidgetproxy.cpp.

References _projectTitleMap, and createProjectConfigPage().

Referenced by createProjectConfigPage(), and DocTreeViewPart::DocTreeViewPart().

void ConfigWidgetProxy::insertConfigWidget const KDialogBase dlg,
QWidget page,
unsigned int  pagenumber
[signal]
 

The proxy emits this signal to notify the client that a specific config page has been requested.

Parameters:
dlg The settings dialog. The client should connect to its okClicked() signal
page The setting page. The client should use this as parent to the config widget
pagenumber The identifier set in createGlobalConfigPage() or createProjectConfigPage(). Identifies the requested config page.

Referenced by slotAboutToShowPage().

void ConfigWidgetProxy::removeConfigPage int  pagenumber  ) 
 

Remove a config page from the proxy.

Next time the settings dialog opens, this page will not be available.

Parameters:
pagenumber The identifier set in createGlobalConfigPage() or createProjectConfigPage().

Definition at line 57 of file configwidgetproxy.cpp.

References _globalTitleMap, _projectTitleMap, and removeConfigPage().

Referenced by removeConfigPage().

void ConfigWidgetProxy::slotAboutToShowPage QWidget page  )  [private, slot]
 

Definition at line 100 of file configwidgetproxy.cpp.

References _pageMap, endl(), insertConfigWidget(), k_funcinfo, kdDebug(), and slotAboutToShowPage().

Referenced by slotAboutToShowPage(), slotConfigWidget(), and slotProjectConfigWidget().

void ConfigWidgetProxy::slotConfigWidget KDialogBase  )  [private, slot]
 

Definition at line 63 of file configwidgetproxy.cpp.

References _globalTitleMap, _pageMap, KDialogBase::addVBoxPage(), endl(), k_funcinfo, kdDebug(), slotAboutToShowPage(), slotConfigWidget(), and slotConfigWidgetDestroyed().

Referenced by ConfigWidgetProxy(), and slotConfigWidget().

void ConfigWidgetProxy::slotConfigWidgetDestroyed  )  [private, slot]
 

Definition at line 93 of file configwidgetproxy.cpp.

References _pageMap, endl(), k_funcinfo, and kdDebug().

Referenced by slotConfigWidget(), and slotProjectConfigWidget().

void ConfigWidgetProxy::slotProjectConfigWidget KDialogBase  )  [private, slot]
 

Definition at line 78 of file configwidgetproxy.cpp.

References _pageMap, _projectTitleMap, KDialogBase::addVBoxPage(), endl(), k_funcinfo, kdDebug(), slotAboutToShowPage(), slotConfigWidgetDestroyed(), and slotProjectConfigWidget().

Referenced by ConfigWidgetProxy(), and slotProjectConfigWidget().


Member Data Documentation

TitleMap ConfigWidgetProxy::_globalTitleMap [private]
 

Definition at line 111 of file configwidgetproxy.h.

Referenced by createGlobalConfigPage(), removeConfigPage(), and slotConfigWidget().

PageMap ConfigWidgetProxy::_pageMap [private]
 

Definition at line 113 of file configwidgetproxy.h.

Referenced by slotAboutToShowPage(), slotConfigWidget(), slotConfigWidgetDestroyed(), and slotProjectConfigWidget().

TitleMap ConfigWidgetProxy::_projectTitleMap [private]
 

Definition at line 112 of file configwidgetproxy.h.

Referenced by createProjectConfigPage(), removeConfigPage(), and slotProjectConfigWidget().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:39:21 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003