• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop Utility Library
 

KDevelop Utility Library

  • lib
  • util
configwidgetproxy.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2004 Jens Dagerbo <jens.dagerbo@swipnet.se>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20
21
22#include <tqstring.h>
23#include <tqvbox.h>
24
25#include <kdebug.h>
26#include <kdialogbase.h>
27#include <kiconloader.h>
28
29#include <kdevcore.h>
30
31
32#include "configwidgetproxy.h"
33
34
35ConfigWidgetProxy::ConfigWidgetProxy( KDevCore * core )
36{
37 connect( core, TQ_SIGNAL(configWidget(KDialogBase*)), this, TQ_SLOT(slotConfigWidget( KDialogBase*)) );
38 connect( core, TQ_SIGNAL(projectConfigWidget(KDialogBase*)), this, TQ_SLOT(slotProjectConfigWidget( KDialogBase*)) );
39}
40
41ConfigWidgetProxy::~ConfigWidgetProxy()
42{}
43
44void ConfigWidgetProxy::createGlobalConfigPage( TQString const & title, unsigned int pagenumber, TQString const & icon )
45{
46 _globalTitleMap.insert( pagenumber, qMakePair( title, icon ) );
47}
48
49void ConfigWidgetProxy::createProjectConfigPage( TQString const & title, unsigned int pagenumber, TQString const & icon )
50{
51 _projectTitleMap.insert( pagenumber, qMakePair( title, icon ) );
52}
53
54void ConfigWidgetProxy::removeConfigPage( int pagenumber )
55{
56 _globalTitleMap.remove( pagenumber );
57 _projectTitleMap.remove( pagenumber );
58}
59
60void ConfigWidgetProxy::slotConfigWidget( KDialogBase * dlg )
61{
62 TitleMap::Iterator it = _globalTitleMap.begin();
63 while ( it != _globalTitleMap.end() )
64 {
65 _pageMap.insert( dlg->addVBoxPage( it.data().first, it.data().first, BarIcon( it.data().second, TDEIcon::SizeMedium ) ), it.key() );
66 ++it;
67 }
68
69 connect( dlg, TQ_SIGNAL(aboutToShowPage(TQWidget*)), this, TQ_SLOT( slotAboutToShowPage(TQWidget*)) );
70 connect( dlg, TQ_SIGNAL(destroyed()), this, TQ_SLOT(slotConfigWidgetDestroyed()) );
71}
72
73void ConfigWidgetProxy::slotProjectConfigWidget( KDialogBase * dlg )
74{
75 TitleMap::Iterator it = _projectTitleMap.begin();
76 while ( it != _projectTitleMap.end() )
77 {
78 _pageMap.insert( dlg->addVBoxPage( it.data().first, it.data().first, BarIcon( it.data().second, TDEIcon::SizeMedium ) ), it.key() );
79 ++it;
80 }
81
82 connect( dlg, TQ_SIGNAL(aboutToShowPage(TQWidget*)), this, TQ_SLOT( slotAboutToShowPage(TQWidget*)) );
83 connect( dlg, TQ_SIGNAL(destroyed()), this, TQ_SLOT(slotConfigWidgetDestroyed()) );
84}
85
86void ConfigWidgetProxy::slotConfigWidgetDestroyed( )
87{
88 _pageMap.clear();
89}
90
91void ConfigWidgetProxy::slotAboutToShowPage( TQWidget * page )
92{
93 if ( !page ) return;
94
95 PageMap::Iterator it = _pageMap.find( page );
96 if ( it != _pageMap.end() )
97 {
98 emit insertConfigWidget( static_cast<KDialogBase*>(const_cast<TQObject*>(sender())), page, it.data() );
99 _pageMap.remove( it );
100 }
101}
102
103#include "configwidgetproxy.moc"
ConfigWidgetProxy::createGlobalConfigPage
void createGlobalConfigPage(TQString const &title, unsigned int pagenumber, TQString const &icon="tdevelop")
Tells the proxy you want a page in the Global Settings.
Definition configwidgetproxy.cpp:44
ConfigWidgetProxy::ConfigWidgetProxy
ConfigWidgetProxy(KDevCore *core)
Constructor.
Definition configwidgetproxy.cpp:35
ConfigWidgetProxy::removeConfigPage
void removeConfigPage(int pagenumber)
Removes a config page from the proxy.
Definition configwidgetproxy.cpp:54
ConfigWidgetProxy::createProjectConfigPage
void createProjectConfigPage(TQString const &title, unsigned int pagenumber, TQString const &icon="tdevelop")
Tells the proxy you want a page in the Project Settings.
Definition configwidgetproxy.cpp:49
ConfigWidgetProxy::insertConfigWidget
void insertConfigWidget(const KDialogBase *dlg, TQWidget *page, unsigned int pagenumber)
The proxy emits this signal to notify the client that a specific config page has been requested.
configwidgetproxy.h
Configuration widget proxy class.

KDevelop Utility Library

Skip menu "KDevelop Utility Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

KDevelop Utility Library

Skip menu "KDevelop Utility 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 Utility Library by doxygen 1.9.8
This website is maintained by Timothy Pearson.