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