]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QParagraphDialog.C
Added initial qt4 work by Abdelrazak Younes
[lyx.git] / src / frontends / qt4 / QParagraphDialog.C
1 /**
2  * \file QParagraphDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  * \author Edwin Leuven
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "QParagraphDialog.h"
15 #include "QParagraph.h"
16
17 #include <qlineedit.h>
18 #include <qpushbutton.h>
19 #include <qvalidator.h>
20 #include <q3whatsthis.h>
21
22 #include "qt_helpers.h"
23 //Added by qt3to4:
24 #include <QCloseEvent>
25
26 namespace lyx {
27 namespace frontend {
28
29 QParagraphDialog::QParagraphDialog(QParagraph * form)
30         : form_(form)
31 {
32         setupUi(this);
33
34         connect(okPB, SIGNAL(clicked()),
35                 form_, SLOT(slotOK()));
36         connect(applyPB, SIGNAL(clicked()),
37                 form_, SLOT(slotApply()));
38         connect(closePB, SIGNAL(clicked()),
39                 form_, SLOT(slotClose()));
40
41
42     connect( align, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
43     connect( linespacing, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
44     connect( linespacing, SIGNAL( activated(int) ), this, SLOT( enableLinespacingValue(int) ) );
45     connect( linespacingValue, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
46     connect( indentCB, SIGNAL( toggled(bool) ), this, SLOT( change_adaptor() ) );
47     connect( labelWidth, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
48
49         linespacingValue->setValidator(new QDoubleValidator(linespacingValue));
50
51         Q3WhatsThis::add(labelWidth, qt_(
52 "As described in the User Guide, the length of"
53 " this text will determine how wide the label part"
54 " of each item is in environments like List and"
55 " Description.\n"
56 "\n"
57 " Normally you won't need to set this,"
58 " since the largest label width of all the"
59 " items is used. But if you need to, you can"
60 " change it here."
61         ));
62 }
63
64
65 void QParagraphDialog::closeEvent(QCloseEvent * e)
66 {
67         form_->slotWMHide();
68         e->accept();
69 }
70
71
72 void QParagraphDialog::change_adaptor()
73 {
74         form_->changed();
75 }
76
77
78 void QParagraphDialog::enableLinespacingValue(int)
79 {
80         bool const enable = linespacing->currentItem() == 4;
81         linespacingValue->setEnabled(enable);
82 }
83
84 } // namespace frontend
85 } // namespace lyx