]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QParagraphDialog.C
enable Font cache only for MacOSX and inline width() for other platform.
[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>
18 #include <QPushButton>
19 #include <QValidator>
20 #include <QWhatsThis>
21 #include <QCloseEvent>
22
23 #include "qt_helpers.h"
24
25 namespace lyx {
26 namespace frontend {
27
28 QParagraphDialog::QParagraphDialog(QParagraph * form)
29         : form_(form)
30 {
31         setupUi(this);
32
33         connect(okPB, SIGNAL(clicked()),
34                 form_, SLOT(slotOK()));
35         connect(applyPB, SIGNAL(clicked()),
36                 form_, SLOT(slotApply()));
37         connect(closePB, SIGNAL(clicked()),
38                 form_, SLOT(slotClose()));
39         connect(align, SIGNAL( activated(int) ), 
40                 this, SLOT( change_adaptor() ) );
41         connect(linespacing, SIGNAL( activated(int) ), 
42                 this, SLOT( change_adaptor() ) );
43         connect(linespacing, SIGNAL( activated(int) ), 
44                 this, SLOT( enableLinespacingValue(int) ) );
45         connect(linespacingValue, SIGNAL( textChanged(const QString&) ), 
46                 this, SLOT( change_adaptor() ) );
47         connect(indentCB, SIGNAL( toggled(bool) ), 
48                 this, SLOT( change_adaptor() ) );
49         connect(labelWidth, SIGNAL( textChanged(const QString&) ), 
50                 this, SLOT( change_adaptor() ) );
51
52         linespacingValue->setValidator(new QDoubleValidator(linespacingValue));
53
54         labelWidth->setWhatsThis( qt_(
55                 "As described in the User Guide, the length of"
56                 " this text will determine how wide the label part"
57                 " of each item is in environments like List and"
58                 " Description.\n"
59                 "\n"
60                 " Normally you won't need to set this,"
61                 " since the largest label width of all the"
62                 " items is used. But if you need to, you can"
63                 " change it here."
64         ));
65 }
66
67
68 void QParagraphDialog::closeEvent(QCloseEvent * e)
69 {
70         form_->slotWMHide();
71         e->accept();
72 }
73
74
75 void QParagraphDialog::change_adaptor()
76 {
77         form_->changed();
78 }
79
80
81 void QParagraphDialog::enableLinespacingValue(int)
82 {
83         bool const enable = linespacing->currentIndex() == 4;
84         linespacingValue->setEnabled(enable);
85 }
86
87 } // namespace frontend
88 } // namespace lyx
89
90 #include "QParagraphDialog_moc.cpp"