]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QERT.C
namespace grfx -> lyx::graphics
[lyx.git] / src / frontends / qt2 / QERT.C
1 /**
2  * \file QERT.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  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13
14 #include "ControlERT.h"
15 #include "qt_helpers.h"
16
17 #include <qradiobutton.h>
18 #include <qpushbutton.h>
19
20 #include "QERTDialog.h"
21 #include "QERT.h"
22 #include "Qt2BC.h"
23
24 typedef QController<ControlERT, QView<QERTDialog> > base_class;
25
26
27 QERT::QERT(Dialog & parent)
28         : base_class(parent, _("LyX: TeX Code Settings"))
29 {
30 }
31
32
33 void QERT::build_dialog()
34 {
35         dialog_.reset(new QERTDialog(this));
36
37         bcview().setOK(dialog_->okPB);
38         bcview().setCancel(dialog_->closePB);
39 }
40
41
42 void QERT::apply()
43 {
44         if (dialog_->openRB->isChecked())
45                 controller().setStatus(InsetERT::Open);
46         else if (dialog_->inlineRB->isChecked())
47                 controller().setStatus(InsetERT::Inlined);
48         else
49                 controller().setStatus(InsetERT::Collapsed);
50 }
51
52
53 void QERT::update_contents()
54 {
55         QRadioButton * rb = 0;
56
57         switch (controller().status()) {
58                 case InsetERT::Open: rb = dialog_->openRB; break;
59                 case InsetERT::Inlined: rb = dialog_->inlineRB; break;
60                 case InsetERT::Collapsed: rb = dialog_->collapsedRB; break;
61         }
62
63         rb->setChecked(true);
64 }