Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

ShowModesDlg Class Reference

Used in view modes edit dialog. Main window and handles the parsing of the trapperconf.xml file. More...

#include <showmodesdlg.h>

Collaboration diagram for ShowModesDlg:

Collaboration graph
[legend]
List of all members.

Public Slots

void clicked (QListViewItem *item)
void add ()
void remove ()
void edit ()
void up ()
void down ()
void contextMenu (QListViewItem *, const QPoint &, int)
void accept ()

Public Member Functions

 ShowModesDlg (QWidget *parent, const char *name)
 ~ShowModesDlg ()

Protected Member Functions

void editAddLayerCommon (int height, QString allowOverlapStr, LayerItem *item)

Protected Attributes

QPopupMenu * modeMenu
QPopupMenu * layerMenu
QPopupMenu * featureMenu
QPopupMenu * rootMenu
QWidget * page
UI_AddRemoveWidget * uiWidget
ModeItem * modeItemClicked
LayerItem * layerItemClicked
FeatureItem * featureItemClicked
RootItem * rootItem

Detailed Description

Used in view modes edit dialog. Main window and handles the parsing of the trapperconf.xml file.

Definition at line 26 of file showmodesdlg.h.


Constructor & Destructor Documentation

ShowModesDlg::ShowModesDlg (  QWidget *  parent,
const char *  name
) 
 

Definition at line 431 of file showmodesdlg.cpp.

References accept(), add(), clicked(), contextMenu(), down(), edit(), TrapperConf::instance(), RootItem::parseDom(), remove(), rootItem, rootMenu, uiWidget, up(), and TrapperConf::viewModeConf().

00432         : QDialog( parent, name, TRUE /* modal */ )
00433 {
00434     uiWidget = new UI_AddRemoveWidget( this );
00435     setCaption("Edit show modes");
00436     QBoxLayout * l = new QVBoxLayout( this );
00437     l->addWidget( uiWidget );
00438     TrapperConf * conf = TrapperConf::instance();
00439     QDomElement confElem = conf->viewModeConf();
00440 
00441 
00442     rootItem = new RootItem( uiWidget->listView, this );
00443     uiWidget->listView->setSorting( -1 );
00444     rootItem->parseDom( confElem );
00445 
00446 
00447     connect( uiWidget->buttonAdd, SIGNAL( clicked() ), this, SLOT( add
00448                  () ) );
00449     connect( uiWidget->buttonUp, SIGNAL( clicked() ), this, SLOT( up() ) );
00450     connect( uiWidget->buttonDown, SIGNAL( clicked() ), this, SLOT( down() ) );
00451     connect( uiWidget->buttonEdit, SIGNAL( clicked() ), this, SLOT( edit() ) );
00452     connect( uiWidget->buttonRemove, SIGNAL( clicked() ), this, SLOT( remove
00453                  () ) );
00454     connect( uiWidget->listView, SIGNAL( contextMenuRequested( QListViewItem *, const QPoint& , int ) ),
00455              this, SLOT( contextMenu( QListViewItem *, const QPoint &, int ) ) );
00456     rootMenu = new QPopupMenu(  uiWidget->listView );
00457     rootMenu->insertItem( "add view mode", this, SLOT(add
00458                           () ));
00459     //modeMenu = new QPopupMenu(  uiWidget->listView );
00460     /*
00461     modeMenu->insertItem( "add layer", this , SLOT(addLayer()) );
00462     modeMenu->insertItem( "edit this view mode", this , SLOT(editMode()) );    
00463     modeMenu->insertItem( "remove this view mode", this , SLOT(removeMode()) );
00464     layerMenu = new QPopupMenu(  uiWidget->listView );
00465     layerMenu->insertItem( "add feature", this , SLOT(addFeature()) );
00466     layerMenu->insertItem( "remove this layer", this , SLOT(removeLayer()) );    
00467     layerMenu->insertItem( "edit this layer", this , SLOT(editLayer()) );      
00468     featureMenu = new QPopupMenu( uiWidget->listView );
00469     featureMenu->insertItem("remove this feature", this, SLOT(removeFeature()));
00470     */
00471     uiWidget->listView->setRootIsDecorated( true );
00472     for ( int i = 0; i < 4; ++i )
00473     {
00474         uiWidget->listView->setColumnWidthMode( i, QListView::Maximum );
00475     }
00476 
00477     connect( uiWidget->buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
00478     connect( uiWidget->buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
00479     connect ( uiWidget->listView, SIGNAL(doubleClicked( QListViewItem * )), this,
00480               SLOT( clicked( QListViewItem * )));
00481 
00482 }

ShowModesDlg::~ShowModesDlg (   )  [inline]
 

Definition at line 31 of file showmodesdlg.h.

00031 {};


Member Function Documentation

void ShowModesDlg::accept (   )  [slot]
 

Definition at line 493 of file showmodesdlg.cpp.

References Item::createDom(), TrapperConf::instance(), rootItem, TrapperConf::save(), and TrapperConf::viewModeConf().

Referenced by ShowModesDlg().

00494 {
00495     TrapperConf * conf = TrapperConf::instance();
00496     QDomElement confElem = conf->viewModeConf();
00497 
00498     QDomNode n = confElem.firstChild();
00499     while ( !n.isNull() )
00500     {
00501           QDomNode removeNode = n;
00502           n = n.nextSibling();
00503         confElem.removeChild( removeNode  );
00504 
00505         //QDomNode child = rootItem->removeChild ( n );
00506 
00507   
00508     }
00509     rootItem->createDom( confElem );
00510 
00511     conf->save();
00512 
00513     // maybe use this
00514     QDialog::accept();
00515 }

void ShowModesDlg::add (   )  [slot]
 

Definition at line 354 of file showmodesdlg.cpp.

References Item::add().

Referenced by ShowModesDlg().

00355 {
00356     QListViewItem * current = uiWidget->listView->currentItem() ;
00357     Item * item = dynamic_cast< Item * > ( current );
00358     if ( item )
00359     {
00360         item->add
00361         ();
00362     }
00363 }

void ShowModesDlg::clicked (  QListViewItem *  item  )  [slot]
 

Definition at line 483 of file showmodesdlg.cpp.

References Item::edit().

Referenced by ShowModesDlg().

00484 {
00485     Item * item = dynamic_cast< Item * >( listViewItem );
00486     if( item )
00487     {
00488         item->edit();
00489         return;
00490     }
00491 }

void ShowModesDlg::contextMenu (  QListViewItem *  ,
const QPoint &  ,
int 
)  [slot]
 

Definition at line 421 of file showmodesdlg.cpp.

References Item::popup().

Referenced by ShowModesDlg().

00422 {
00423     Item * item = dynamic_cast< Item * >( listViewItem );
00424     if( item )
00425     {
00426         item->popup( p );
00427         return;
00428     }
00429 }

void ShowModesDlg::down (   )  [slot]
 

Definition at line 405 of file showmodesdlg.cpp.

References uiWidget.

Referenced by ShowModesDlg().

00406 {
00407     QListViewItem * current = uiWidget->listView->currentItem() ;
00408     if ( current )
00409     {
00410         QListViewItem * item = current->itemBelow();
00411         if ( item && current->parent() == item->parent() )
00412         {
00413 
00414 
00415             current->moveItem( item );
00416 
00417         }
00418     }
00419 }

void ShowModesDlg::edit (   )  [slot]
 

Definition at line 380 of file showmodesdlg.cpp.

References Item::edit(), and uiWidget.

Referenced by ShowModesDlg().

00381 {
00382     QListViewItem * current = uiWidget->listView->currentItem() ;
00383     Item * item = dynamic_cast< Item * > ( current );
00384     if ( item )
00385     {
00386         item->edit();
00387     }
00388 }

void ShowModesDlg::editAddLayerCommon (  int  height,
QString  allowOverlapStr,
LayerItem *  item
)  [protected]
 

void ShowModesDlg::remove (   )  [slot]
 

Definition at line 366 of file showmodesdlg.cpp.

References Item::deletable().

Referenced by ShowModesDlg().

00367 {
00368     QListViewItem * current = uiWidget->listView->currentItem() ;
00369     Item * item = dynamic_cast< Item * > ( current );
00370     if ( item )
00371     {
00372         if ( item->deletable() )
00373         {
00374             delete item;
00375             item = NULL;
00376         }
00377     }
00378 }

void ShowModesDlg::up (   )  [slot]
 

Definition at line 390 of file showmodesdlg.cpp.

References uiWidget.

Referenced by ShowModesDlg().

00391 {
00392     QListViewItem * current = uiWidget->listView->currentItem() ;
00393     if ( current )
00394     {
00395         QListViewItem * item = current->itemAbove();
00396         //   if ( itemAbove1  ) {
00397         //   QListViewItem * itemAbove2 = itemAbove1->itemAbove();
00398         if ( item && current->parent() == item->parent() )
00399         {
00400             item->moveItem( current );
00401         }
00402     }
00403 }


Member Data Documentation

FeatureItem* ShowModesDlg::featureItemClicked [protected]
 

Definition at line 55 of file showmodesdlg.h.

QPopupMenu* ShowModesDlg::featureMenu [protected]
 

Definition at line 49 of file showmodesdlg.h.

LayerItem* ShowModesDlg::layerItemClicked [protected]
 

Definition at line 54 of file showmodesdlg.h.

QPopupMenu* ShowModesDlg::layerMenu [protected]
 

Definition at line 48 of file showmodesdlg.h.

ModeItem* ShowModesDlg::modeItemClicked [protected]
 

Definition at line 53 of file showmodesdlg.h.

QPopupMenu* ShowModesDlg::modeMenu [protected]
 

Definition at line 47 of file showmodesdlg.h.

QWidget* ShowModesDlg::page [protected]
 

Definition at line 51 of file showmodesdlg.h.

RootItem* ShowModesDlg::rootItem [protected]
 

Definition at line 56 of file showmodesdlg.h.

Referenced by accept(), and ShowModesDlg().

QPopupMenu* ShowModesDlg::rootMenu [protected]
 

Definition at line 50 of file showmodesdlg.h.

Referenced by ShowModesDlg().

UI_AddRemoveWidget* ShowModesDlg::uiWidget [protected]
 

Definition at line 52 of file showmodesdlg.h.

Referenced by down(), edit(), ShowModesDlg(), and up().


The documentation for this class was generated from the following files:
Generated on Fri Mar 17 17:45:01 2006 for trapper by  doxygen 1.4.4