]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QCharacterDialog.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / QCharacterDialog.C
1 /**
2  * \file QCharacterDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "QCharacterDialog.h"
14
15 #include <qcheckbox.h>
16 #include <qpushbutton.h>
17 //Added by qt3to4:
18 #include <QCloseEvent>
19
20 namespace lyx {
21 namespace frontend {
22
23 QCharacterDialog::QCharacterDialog(QCharacter * form)
24         : form_(form)
25 {
26         setupUi(this);
27         connect(okPB, SIGNAL(clicked()),
28                 form_, SLOT(slotOK()));
29         connect(applyPB, SIGNAL(clicked()),
30                 form_, SLOT(slotApply()));
31         connect(closePB, SIGNAL(clicked()),
32                 form_, SLOT(slotClose()));
33
34     connect( miscCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
35     connect( sizeCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
36     connect( familyCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
37     connect( seriesCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
38     connect( shapeCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
39     connect( colorCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
40     connect( langCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
41     connect( toggleallCB, SIGNAL( toggled(bool) ), this, SLOT( change_adaptor() ) );
42 }
43
44
45 void QCharacterDialog::change_adaptor()
46 {
47         form_->changed();
48
49         if (!autoapplyCB->isChecked())
50                 return;
51
52         // to be really good here, we should set the combos to the values of
53         // the current text, and make it appear as "no change" if the values
54         // stay the same between applys. Might be difficult though wrt to a
55         // moved cursor - jbl
56         form_->slotApply();
57         familyCO->setCurrentIndex(0);
58         seriesCO->setCurrentIndex(0);
59         sizeCO->setCurrentIndex(0);
60         shapeCO->setCurrentIndex(0);
61         miscCO->setCurrentIndex(0);
62         langCO->setCurrentIndex(0);
63         colorCO->setCurrentIndex(0);
64 }
65
66
67 void QCharacterDialog::closeEvent(QCloseEvent * e)
68 {
69         form_->slotWMHide();
70         e->accept();
71 }
72
73 } // namespace frontend
74 } // namespace lyx
75
76 #include "QCharacterDialog_moc.cpp"