]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiNote.cpp
'using namespace std' instead of 'using std::xxx'
[lyx.git] / src / frontends / qt4 / GuiNote.cpp
1 /**
2  * \file GuiNote.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  * \author Jürgen Spitzmüller
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "GuiNote.h"
15 #include "FuncRequest.h"
16 #include "support/gettext.h"
17
18 #include "insets/InsetNote.h"
19
20 #include <QCloseEvent>
21
22 using namespace std;
23
24 namespace lyx {
25 namespace frontend {
26
27 GuiNote::GuiNote(GuiView & lv)
28         : GuiDialog(lv, "note")
29 {
30         setupUi(this);
31         setViewTitle(_("Note Settings"));
32
33         connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
34         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
35
36         connect(noteRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
37         connect(greyedoutRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
38         connect(commentRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
39
40         bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
41         bc().setOK(okPB);
42         bc().setCancel(closePB);
43 }
44
45
46 void GuiNote::closeEvent(QCloseEvent * e)
47 {
48         slotClose();
49         e->accept();
50 }
51
52
53 void GuiNote::change_adaptor()
54 {
55         changed();
56 }
57
58
59 void GuiNote::updateContents()
60 {
61         switch (params_.type) {
62         case InsetNoteParams::Note:
63                 noteRB->setChecked(true);
64                 break;
65         case InsetNoteParams::Comment:
66                 commentRB->setChecked(true);
67                 break;
68         case InsetNoteParams::Greyedout:
69                 greyedoutRB->setChecked(true);
70                 break;
71         }
72 }
73
74
75 void GuiNote::applyView()
76 {
77         if (greyedoutRB->isChecked())
78                 params_.type = InsetNoteParams::Greyedout;
79         else if (commentRB->isChecked())
80                 params_.type = InsetNoteParams::Comment;
81         else
82                 params_.type = InsetNoteParams::Note;
83 }
84
85
86 bool GuiNote::initialiseParams(string const & data)
87 {
88         InsetNoteMailer::string2params(data, params_);
89         return true;
90 }
91
92
93 void GuiNote::clearParams()
94 {
95         params_ = InsetNoteParams();
96 }
97
98
99 void GuiNote::dispatchParams()
100 {
101         dispatch(FuncRequest(getLfun(), InsetNoteMailer::params2string(params_)));
102 }
103
104
105 Dialog * createGuiNote(GuiView & lv) { return new GuiNote(lv); }
106
107
108 } // namespace frontend
109 } // namespace lyx
110
111 #include "GuiNote_moc.cpp"