1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/editxlinkdialog.cpp Tue Sep 04 13:53:33 2007 +0000
1.3 @@ -0,0 +1,77 @@
1.4 +#include "editxlinkdialog.h"
1.5 +
1.6 +#include <QColorDialog>
1.7 +
1.8 +EditXLinkDialog::EditXLinkDialog (QWidget *parent):QDialog (parent)
1.9 +{
1.10 + ui.setupUi (this);
1.11 +
1.12 + delink=false;
1.13 + xlo=false;
1.14 + selection=NULL;
1.15 +
1.16 + connect ( ui.widthBox, SIGNAL (valueChanged( int)), this, SLOT (widthChanged (int)));
1.17 + connect ( ui.colorButton, SIGNAL (clicked( )), this, SLOT (colorButtonPressed()));
1.18 + connect ( ui.setColorHeadingButton, SIGNAL (clicked( )), this, SLOT (setColorHeadingButtonPressed()));
1.19 + connect ( ui.deleteButton, SIGNAL (clicked( )), this, SLOT (deleteButtonPressed()));
1.20 +}
1.21 +
1.22 +void EditXLinkDialog::deleteButtonPressed()
1.23 +{
1.24 + delink=true;
1.25 + accept();
1.26 +}
1.27 +
1.28 +bool EditXLinkDialog::deleteXLink()
1.29 +{
1.30 + return delink;
1.31 +}
1.32 +
1.33 +
1.34 +void EditXLinkDialog::widthChanged( int w)
1.35 +{
1.36 + xlo->setWidth(w);
1.37 +}
1.38 +
1.39 +void EditXLinkDialog::setXLink( XLinkObj * xo)
1.40 +{
1.41 + xlo=xo;
1.42 + ui.colorButton->setPaletteBackgroundColor (xlo->getColor() );
1.43 + ui.widthBox->setValue(xlo->getWidth());
1.44 +}
1.45 +
1.46 +void EditXLinkDialog::setSelection(LinkableMapObj *s)
1.47 +{
1.48 + selection=s;
1.49 +}
1.50 +
1.51 +void EditXLinkDialog::colorButtonPressed()
1.52 +{
1.53 + if (xlo)
1.54 + {
1.55 + QColor col = QColorDialog::getColor(xlo->getColor(), this );
1.56 + if ( !col.isValid() ) return;
1.57 + xlo->setColor( col );
1.58 + ui.colorButton->setPaletteBackgroundColor (col);
1.59 + }
1.60 +}
1.61 +
1.62 +void EditXLinkDialog::setColorHeadingButtonPressed()
1.63 +{
1.64 + if (xlo)
1.65 + {
1.66 + if (selection &&
1.67 + (typeid(*selection) == typeid(BranchObj)) ||
1.68 + (typeid(*selection) == typeid(MapCenterObj)) )
1.69 + {
1.70 + QColor col=((BranchObj*)(selection))->getColor();
1.71 + xlo->setColor(col);
1.72 + ui.colorButton->setPaletteBackgroundColor (col);
1.73 + }
1.74 + }
1.75 +}
1.76 +
1.77 +bool EditXLinkDialog::useSettingsGlobal ()
1.78 +{
1.79 + return ui.useSettings->isChecked();
1.80 +}