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:

Inheritance graph
[legend]
Collaboration diagram for ConfigWidgetProxy:

Collaboration graph
[legend]
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, QString const &icon="kdevelop")
 Tell the proxy you want a page in the Global Settings.
void createProjectConfigPage (QString const &title, unsigned int pagenumber, QString const &icon="kdevelop")
 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,
QPair< QString, 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, QPair<QString,QString> > ConfigWidgetProxy::TitleMap [private]
 

Definition at line 108 of file configwidgetproxy.h.


Constructor & Destructor Documentation

ConfigWidgetProxy::ConfigWidgetProxy KDevCore core  ) 
 

Definition at line 35 of file configwidgetproxy.cpp.

References slotConfigWidget(), and slotProjectConfigWidget().

ConfigWidgetProxy::~ConfigWidgetProxy  )  [virtual]
 

Definition at line 41 of file configwidgetproxy.cpp.


Member Function Documentation

void ConfigWidgetProxy::createGlobalConfigPage QString const &  title,
unsigned int  pagenumber,
QString const &  icon = "kdevelop"
 

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 44 of file configwidgetproxy.cpp.

References _globalTitleMap.

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

void ConfigWidgetProxy::createProjectConfigPage QString const &  title,
unsigned int  pagenumber,
QString const &  icon = "kdevelop"
 

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 49 of file configwidgetproxy.cpp.

References _projectTitleMap.

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

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 54 of file configwidgetproxy.cpp.

References _globalTitleMap, and _projectTitleMap.

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

Definition at line 91 of file configwidgetproxy.cpp.

References _pageMap, and insertConfigWidget().

Referenced by slotConfigWidget(), and slotProjectConfigWidget().

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

Definition at line 60 of file configwidgetproxy.cpp.

References _globalTitleMap, _pageMap, KDialogBase::addVBoxPage(), slotAboutToShowPage(), and slotConfigWidgetDestroyed().

Referenced by ConfigWidgetProxy().

void ConfigWidgetProxy::slotConfigWidgetDestroyed  )  [private, slot]
 

Definition at line 86 of file configwidgetproxy.cpp.

References _pageMap.

Referenced by slotConfigWidget(), and slotProjectConfigWidget().

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

Definition at line 73 of file configwidgetproxy.cpp.

References _pageMap, _projectTitleMap, KDialogBase::addVBoxPage(), slotAboutToShowPage(), and slotConfigWidgetDestroyed().

Referenced by ConfigWidgetProxy().


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.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:38:39 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003