]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QNote.C
Martin's changes to the Note inset.
[lyx.git] / src / frontends / qt2 / QNote.C
1 /**
2  * \file QNote.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Juergen Spitzmueller
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13 #include "ControlNote.h"
14 #include "qt_helpers.h"
15 #include "insets/insetnote.h"
16
17 #include <qradiobutton.h>
18 #include <qpushbutton.h>
19
20 #include "QNoteDialog.h"
21 #include "QNote.h"
22 #include "Qt2BC.h"
23
24
25 typedef QController<ControlNote, QView<QNoteDialog> > base_class;
26
27
28 QNote::QNote(Dialog & parent)
29         : base_class(parent, _("LyX: Note Settings"))
30 {}
31
32
33 void QNote::build_dialog()
34 {
35         dialog_.reset(new QNoteDialog(this));
36
37         bcview().setOK(dialog_->okPB);
38         bcview().setCancel(dialog_->closePB);
39 }
40
41
42 void QNote::update_contents()
43 {
44         QRadioButton * rb = 0;
45         string type(controller().params().type);
46
47         if (type == "Note")
48                 rb = dialog_->noteRB;
49         else if (type == "Comment")
50                 rb = dialog_->commentRB;
51         else if (type == "Greyedout")
52                 rb = dialog_->greyedoutRB;
53
54         rb->setChecked(true);
55 }
56
57
58 void QNote::apply()
59 {
60         string type;
61
62         if (dialog_->greyedoutRB->isChecked())
63                 type = "Greyedout";
64         else if (dialog_->commentRB->isChecked())
65                 type = "Comment";
66         else
67                 type = "Note";
68
69         controller().params().type = type;
70 }
71