editxlinkdialog.cpp
author insilmaril
Fri, 19 Feb 2010 13:47:03 +0000
changeset 823 0bba81dde1bc
parent 790 133e2ed6b9c5
child 847 43268373032d
permissions -rw-r--r--
More fixes
     1 #include "editxlinkdialog.h"
     2 
     3 #include <typeinfo>
     4 #include <QColorDialog>
     5 
     6 #include "branchitem.h"
     7 
     8 EditXLinkDialog::EditXLinkDialog (QWidget *parent):QDialog (parent)
     9 {
    10 	ui.setupUi (this);
    11 
    12 	delink=false;
    13 	xli=NULL;
    14 	selbi=NULL;
    15 
    16 	connect ( ui.widthBox, SIGNAL (valueChanged( int)), this, SLOT (widthChanged (int)));
    17 	connect ( ui.colorButton, SIGNAL (clicked( )), this, SLOT (colorButtonPressed()));
    18 	connect ( ui.setColorHeadingButton, SIGNAL (clicked( )), this, SLOT (setColorHeadingButtonPressed()));
    19 	connect ( ui.deleteButton, SIGNAL (clicked( )), this, SLOT (deleteButtonPressed()));
    20 }
    21 
    22 void EditXLinkDialog::deleteButtonPressed()
    23 {
    24 	delink=true;
    25 	accept();
    26 }
    27 
    28 bool EditXLinkDialog::deleteXLink()
    29 {
    30 	return delink;
    31 }	
    32 
    33 
    34 void EditXLinkDialog::widthChanged( int  w)
    35 {
    36 	xli->setWidth(w);
    37 }
    38 
    39 void EditXLinkDialog::setXLink( XLinkItem * xi)
    40 {
    41 	xli=xi;
    42 	ui.colorButton->setPaletteBackgroundColor (xli->getColor() );
    43 	ui.widthBox->setValue(xli->getWidth());
    44 }
    45 
    46 void EditXLinkDialog::setSelection(BranchItem *bi)
    47 {
    48 	selbi=bi;
    49 }
    50 
    51 void EditXLinkDialog::colorButtonPressed()
    52 {
    53 	if (xli)
    54 	{	
    55 		QColor col = QColorDialog::getColor(xli->getColor(), this );
    56 		if ( !col.isValid() ) return;
    57 		xli->setColor( col );
    58 		ui.colorButton->setPaletteBackgroundColor (col);
    59 	}
    60 }
    61 
    62 void EditXLinkDialog::setColorHeadingButtonPressed()	
    63 {
    64 	if (xli)
    65 	{	
    66 		if (selbi)
    67 		{
    68 			QColor col=selbi->getHeadingColor();
    69 			xli->setColor(col);
    70 			ui.colorButton->setPaletteBackgroundColor (col);
    71 		}
    72 	}
    73 }
    74 
    75 bool EditXLinkDialog::useSettingsGlobal ()
    76 {
    77 	return ui.useSettings->isChecked();
    78 }