editxlinkdialog.cpp
author insilmaril
Wed, 02 May 2007 15:31:17 +0000
changeset 480 4e2c9394c7da
parent 382 8b0ab4c0f767
child 599 e1d06cd563da
permissions -rw-r--r--
Mainly documentation fixes
     1 #include "editxlinkdialog.h"
     2 
     3 #include <QColorDialog>
     4 
     5 EditXLinkDialog::EditXLinkDialog (QWidget *parent):QDialog (parent)
     6 {
     7 	ui.setupUi (this);
     8 
     9 	delink=false;
    10 	xlo=false;
    11 	selection=NULL;
    12 
    13 	connect ( ui.widthBox, SIGNAL (valueChanged( int)), this, SLOT (widthChanged (int)));
    14 	connect ( ui.colorButton, SIGNAL (clicked( )), this, SLOT (colorButtonPressed()));
    15 	connect ( ui.setColorHeadingButton, SIGNAL (clicked( )), this, SLOT (setColorHeadingButtonPressed()));
    16 	connect ( ui.deleteButton, SIGNAL (clicked( )), this, SLOT (deleteButtonPressed()));
    17 }
    18 
    19 void EditXLinkDialog::deleteButtonPressed()
    20 {
    21 	delink=true;
    22 	accept();
    23 }
    24 
    25 bool EditXLinkDialog::deleteXLink()
    26 {
    27 	return delink;
    28 }	
    29 
    30 
    31 void EditXLinkDialog::widthChanged( int  w)
    32 {
    33 	xlo->setWidth(w);
    34 }
    35 
    36 void EditXLinkDialog::setXLink( XLinkObj * xo)
    37 {
    38 	xlo=xo;
    39 	ui.colorButton->setPaletteBackgroundColor (xlo->getColor() );
    40 	ui.widthBox->setValue(xlo->getWidth());
    41 }
    42 
    43 void EditXLinkDialog::setSelection(LinkableMapObj *s)
    44 {
    45 	selection=s;
    46 }
    47 
    48 void EditXLinkDialog::colorButtonPressed()
    49 {
    50 	if (xlo)
    51 	{	
    52 		QColor col = QColorDialog::getColor(xlo->getColor(), this );
    53 		if ( !col.isValid() ) return;
    54 		xlo->setColor( col );
    55 		ui.colorButton->setPaletteBackgroundColor (col);
    56 	}
    57 }
    58 
    59 void EditXLinkDialog::setColorHeadingButtonPressed()
    60 {
    61 	if (xlo)
    62 	{	
    63 		if (selection && 
    64 			(typeid(*selection) == typeid(BranchObj)) || 
    65 			(typeid(*selection) == typeid(MapCenterObj))  )
    66 		{
    67 			QColor col=((BranchObj*)(selection))->getColor();
    68 			xlo->setColor(col);
    69 			ui.colorButton->setPaletteBackgroundColor (col);
    70 		}
    71 	}
    72 }
    73 
    74 bool EditXLinkDialog::useSettingsGlobal ()
    75 {
    76 	return ui.useSettings->isChecked();
    77 }