]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiERT.cpp
rename a few view functions from foo() to fooView()
[lyx.git] / src / frontends / qt4 / GuiERT.cpp
1 /**
2  * \file GuiERT.cpp
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  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "GuiERT.h"
14 #include "gettext.h"
15
16 #include <QRadioButton>
17 #include <QPushButton>
18 #include <QCloseEvent>
19
20
21 namespace lyx {
22 namespace frontend {
23
24 /////////////////////////////////////////////////////////////////////
25 //
26 // GuiERTDialog
27 //
28 /////////////////////////////////////////////////////////////////////
29
30
31 GuiERTDialog::GuiERTDialog(GuiERT * form)
32         : form_(form)
33 {
34         setupUi(this);
35         connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
36         connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
37         connect(collapsedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
38         connect(openRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
39 }
40
41
42 void GuiERTDialog::closeEvent(QCloseEvent * e)
43 {
44         form_->slotWMHide();
45         e->accept();
46 }
47
48
49 void GuiERTDialog::change_adaptor()
50 {
51         form_->changed();
52 }
53
54
55 /////////////////////////////////////////////////////////////////////
56 //
57 // GuiERT
58 //
59 /////////////////////////////////////////////////////////////////////
60
61 GuiERT::GuiERT(GuiDialog & parent)
62         : GuiView<GuiERTDialog>(parent, _("TeX Code Settings"))
63 {
64 }
65
66
67 void GuiERT::build_dialog()
68 {
69         dialog_.reset(new GuiERTDialog(this));
70
71         bc().setOK(dialog_->okPB);
72         bc().setCancel(dialog_->closePB);
73 }
74
75
76 void GuiERT::applyView()
77 {
78         if (dialog_->openRB->isChecked())
79                 controller().setStatus(Inset::Open);
80         else
81                 controller().setStatus(Inset::Collapsed);
82 }
83
84
85 void GuiERT::update_contents()
86 {
87         QRadioButton * rb = 0;
88
89         switch (controller().status()) {
90                 case InsetERT::Open: rb = dialog_->openRB; break;
91                 case InsetERT::Collapsed: rb = dialog_->collapsedRB; break;
92         }
93
94         rb->setChecked(true);
95 }
96
97 } // namespace frontend
98 } // namespace lyx
99
100 #include "GuiERT_moc.cpp"