1 #include "branchpropwindow.h"
3 #include <QColorDialog>
8 extern Settings settings;
10 BranchPropertyWindow::BranchPropertyWindow (QWidget *parent):QDialog(parent)
17 ui.tabWidget->setEnabled(false);
19 penColor=QColor (Qt::black);
20 brushColor=QColor (Qt::black);
23 ui.framePenColorButton->setPixmap (pix);
24 ui.frameBrushColorButton->setPixmap (pix);
27 BranchPropertyWindow::~BranchPropertyWindow ()
29 settings.setValue( "/branchpropertywindow/geometry/size", size() );
30 settings.setValue( "/branchpropertywindow/geometry/pos", pos() );
31 //settings.setValue( "/branchpropertywindow/showWithMain",showWithMain()); //FIXME add this!
34 void BranchPropertyWindow::setBranch (BranchObj *bo)
40 ui.tabWidget->setEnabled (true);
43 FrameObj::FrameType t=branch->getFrameType();
44 if (t==FrameObj::NoFrame)
46 ui.frameTypeCombo->setCurrentIndex (0);
49 ui.colorGroupBox->setEnabled (false);
50 ui.framePaddingSpinBox->setEnabled (false);
51 ui.frameWidthSpinBox->setEnabled (false);
54 penColor=bo->getFramePenColor();
55 brushColor=bo->getFrameBrushColor();
58 ui.frameBrushColorButton->setPixmap (pix);
59 pix.fill (brushColor);
60 ui.frameBrushColorButton->setPixmap (pix);
61 ui.colorGroupBox->setEnabled (true);
62 ui.framePaddingSpinBox->setEnabled (true);
63 ui.framePaddingSpinBox->setValue (bo->getFramePadding());
64 ui.frameWidthSpinBox->setEnabled (true);
65 ui.frameWidthSpinBox->setValue (bo->getFrameBorderWidth());
69 case FrameObj::Rectangle:
70 ui.frameTypeCombo->setCurrentIndex (1);
72 case FrameObj::Ellipse:
73 ui.frameTypeCombo->setCurrentIndex (2);
81 if (branch->getHideLinkUnselected())
82 ui.hideLinkIfUnselected->setCheckState (Qt::Checked);
84 ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked);
87 if (branch->getIncludeImagesVer())
88 ui.incImgVer->setCheckState (Qt::Checked);
90 ui.incImgVer->setCheckState (Qt::Unchecked);
91 if (branch->getIncludeImagesHor())
92 ui.incImgHor->setCheckState (Qt::Checked);
94 ui.incImgHor->setCheckState (Qt::Unchecked);
96 // Finally activate signals
100 ui.tabWidget->setEnabled (false);
104 void BranchPropertyWindow::setMapEditor (MapEditor *me)
108 setBranch (mapEditor->getSelectedBranch() );
110 ui.tabWidget->setEnabled (false);
114 void BranchPropertyWindow::frameTypeChanged (int i)
119 case 0: mapEditor->setFrameType (FrameObj::NoFrame); break;
120 case 1: mapEditor->setFrameType (FrameObj::Rectangle); break;
121 case 2: mapEditor->setFrameType (FrameObj::Ellipse); break;
125 void BranchPropertyWindow::framePenColorClicked()
129 QColor col = QColorDialog::getColor( penColor, this );
133 mapEditor->setFramePenColor (penColor);
138 void BranchPropertyWindow::frameBrushColorClicked()
142 QColor col = QColorDialog::getColor( brushColor, this );
146 mapEditor->setFrameBrushColor (brushColor);
151 void BranchPropertyWindow::framePaddingChanged(int i)
153 if (mapEditor) mapEditor->setFramePadding (i);
156 void BranchPropertyWindow::frameBorderWidthChanged(int i)
158 if (mapEditor) mapEditor->setFrameBorderWidth(i);
161 void BranchPropertyWindow::linkHideUnselectedChanged (int i)
164 mapEditor->setHideLinkUnselected(i);
167 void BranchPropertyWindow::incImgVerChanged (int i)
169 if (mapEditor) mapEditor->setIncludeImagesVer (i);
172 void BranchPropertyWindow::incImgHorChanged (int i)
174 if (mapEditor) mapEditor->setIncludeImagesHor (i);
177 void BranchPropertyWindow::connectSignals()
181 ui.framePenColorButton, SIGNAL (clicked()),
182 this, SLOT (framePenColorClicked()));
184 ui.framePaddingSpinBox, SIGNAL (valueChanged( int)),
185 this, SLOT (framePaddingChanged (int)));
187 ui.frameWidthSpinBox, SIGNAL (valueChanged( int)),
188 this, SLOT (frameBorderWidthChanged (int)));
190 ui.frameBrushColorButton, SIGNAL (clicked()),
191 this, SLOT (frameBrushColorClicked()));
193 ui.frameTypeCombo, SIGNAL (currentIndexChanged( int)),
194 this, SLOT (frameTypeChanged (int)));
199 ui.hideLinkIfUnselected, SIGNAL (stateChanged( int)),
200 this, SLOT (linkHideUnselectedChanged (int)));
204 ui.incImgVer, SIGNAL (stateChanged( int)),
205 this, SLOT (incImgVerChanged (int)));
207 ui.incImgHor, SIGNAL (stateChanged( int)),
208 this, SLOT (incImgHorChanged (int)));
212 void BranchPropertyWindow::disconnectSignals()
215 disconnect ( ui.frameTypeCombo, 0,0,0);
216 disconnect ( ui.framePenColorButton, 0,0,0);
217 disconnect ( ui.framePaddingSpinBox, 0,0,0);
218 disconnect ( ui.frameWidthSpinBox, 0,0,0);
219 disconnect ( ui.frameBrushColorButton, 0,0,0);
222 disconnect ( ui.hideLinkIfUnselected, 0,0,0);
225 disconnect ( ui.incImgVer, 0,0,0);
226 disconnect ( ui.incImgHor, 0,0,0);