]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QIndex.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / QIndex.C
1 /**
2  * \file QIndex.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 #include "debug.h"
14 #include "ControlCommand.h"
15 #include "qt_helpers.h"
16
17 #include "QIndexDialog.h"
18 #include "QIndex.h"
19 #include "Qt2BC.h"
20 #include "ButtonController.h"
21 #include <qlabel.h>
22 #include <qlineedit.h>
23 #include <qpushbutton.h>
24
25 using std::string;
26
27 namespace lyx {
28 namespace frontend {
29
30 typedef QController<ControlCommand, QView<QIndexDialog> > base_class;
31
32
33 QIndex::QIndex(Dialog & parent, string const & title, QString const & label)
34         : base_class(parent, title), label_(label)
35 {
36 }
37
38
39 void QIndex::build_dialog()
40 {
41         dialog_.reset(new QIndexDialog(this));
42
43         dialog_->keywordLA->setText(label_);
44
45         bcview().setOK(dialog_->okPB);
46         bcview().setCancel(dialog_->closePB);
47         bcview().addReadOnly(dialog_->keywordED);
48 }
49
50
51 void QIndex::update_contents()
52 {
53         string const contents = controller().params().getContents();
54         dialog_->keywordED->setText(toqstr(contents));
55
56         bc().valid(!contents.empty());
57 }
58
59
60 void QIndex::apply()
61 {
62         controller().params().setContents(fromqstr(dialog_->keywordED->text()));
63 }
64
65
66 bool QIndex::isValid()
67 {
68         return !dialog_->keywordED->text().isEmpty();
69 }
70
71 } // namespace frontend
72 } // namespace lyx