configwidgetproxy.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <qstring.h>
00023 #include <qvbox.h>
00024
00025 #include <kdebug.h>
00026 #include <kdialogbase.h>
00027 #include <kiconloader.h>
00028
00029 #include <kdevcore.h>
00030
00031
00032 #include "configwidgetproxy.h"
00033
00034
00035 ConfigWidgetProxy::ConfigWidgetProxy( KDevCore * core )
00036 {
00037 connect( core, SIGNAL(configWidget(KDialogBase*)), this, SLOT(slotConfigWidget( KDialogBase*)) );
00038 connect( core, SIGNAL(projectConfigWidget(KDialogBase*)), this, SLOT(slotProjectConfigWidget( KDialogBase*)) );
00039 }
00040
00041 ConfigWidgetProxy::~ConfigWidgetProxy()
00042 {}
00043
00044 void ConfigWidgetProxy::createGlobalConfigPage( QString const & title, unsigned int pagenumber, QString const & icon )
00045 {
00046 _globalTitleMap.insert( pagenumber, qMakePair( title, icon ) );
00047 }
00048
00049 void ConfigWidgetProxy::createProjectConfigPage( QString const & title, unsigned int pagenumber, QString const & icon )
00050 {
00051 _projectTitleMap.insert( pagenumber, qMakePair( title, icon ) );
00052 }
00053
00054 void ConfigWidgetProxy::removeConfigPage( int pagenumber )
00055 {
00056 _globalTitleMap.remove( pagenumber );
00057 _projectTitleMap.remove( pagenumber );
00058 }
00059
00060 void ConfigWidgetProxy::slotConfigWidget( KDialogBase * dlg )
00061 {
00062 TitleMap::Iterator it = _globalTitleMap.begin();
00063 while ( it != _globalTitleMap.end() )
00064 {
00065 _pageMap.insert( dlg->addVBoxPage( it.data().first, it.data().first, BarIcon( it.data().second, KIcon::SizeMedium ) ), it.key() );
00066 ++it;
00067 }
00068
00069 connect( dlg, SIGNAL(aboutToShowPage(QWidget*)), this, SLOT( slotAboutToShowPage(QWidget*)) );
00070 connect( dlg, SIGNAL(destroyed()), this, SLOT(slotConfigWidgetDestroyed()) );
00071 }
00072
00073 void ConfigWidgetProxy::slotProjectConfigWidget( KDialogBase * dlg )
00074 {
00075 TitleMap::Iterator it = _projectTitleMap.begin();
00076 while ( it != _projectTitleMap.end() )
00077 {
00078 _pageMap.insert( dlg->addVBoxPage( it.data().first, it.data().first, BarIcon( it.data().second, KIcon::SizeMedium ) ), it.key() );
00079 ++it;
00080 }
00081
00082 connect( dlg, SIGNAL(aboutToShowPage(QWidget*)), this, SLOT( slotAboutToShowPage(QWidget*)) );
00083 connect( dlg, SIGNAL(destroyed()), this, SLOT(slotConfigWidgetDestroyed()) );
00084 }
00085
00086 void ConfigWidgetProxy::slotConfigWidgetDestroyed( )
00087 {
00088 _pageMap.clear();
00089 }
00090
00091 void ConfigWidgetProxy::slotAboutToShowPage( QWidget * page )
00092 {
00093 if ( !page ) return;
00094
00095 PageMap::Iterator it = _pageMap.find( page );
00096 if ( it != _pageMap.end() )
00097 {
00098 emit insertConfigWidget( static_cast<KDialogBase*>(const_cast<QObject*>(sender())), page, it.data() );
00099 _pageMap.remove( it );
00100 }
00101 }
00102
00103 #include "configwidgetproxy.moc"
00104
00105
This file is part of the documentation for KDevelop Version 3.1.2.