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