]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QChanges.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / QChanges.C
1 /**
2  * \file QChanges.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 "QChanges.h"
14 #include "QChangesDialog.h"
15 #include "Qt2BC.h"
16 #include "qt_helpers.h"
17
18 #include "support/lstrings.h"
19
20 #include "controllers/ControlChanges.h"
21
22 #include <QPushButton>
23 #include <QTextBrowser>
24
25 using lyx::support::bformat;
26
27 using std::string;
28
29 namespace lyx {
30 namespace frontend {
31
32 typedef QController<ControlChanges, QView<QChangesDialog> > base_class;
33
34
35 QChanges::QChanges(Dialog & parent)
36         : base_class(parent, lyx::to_utf8(_("Merge Changes")))
37 {
38 }
39
40
41 void QChanges::build_dialog()
42 {
43         dialog_.reset(new QChangesDialog(this));
44
45         bcview().setCancel(dialog_->closePB);
46         bcview().addReadOnly(dialog_->acceptPB);
47         bcview().addReadOnly(dialog_->rejectPB);
48 }
49
50
51 void QChanges::update_contents()
52 {
53         next();
54 }
55
56
57 void QChanges::next()
58 {
59         controller().find();
60
61         docstring text;
62         docstring author = lyx::from_utf8(controller().getChangeAuthor());
63         docstring date = lyx::from_utf8(controller().getChangeDate());
64
65         if (!author.empty())
66                 text += bformat(_("Change by %1$s\n\n"), author);
67         if (!date.empty())
68                 text += bformat(_("Change made at %1$s\n"), date);
69
70         dialog_->changeTB->setPlainText(toqstr(text));
71 }
72
73
74 void QChanges::accept()
75 {
76         controller().accept();
77 }
78
79
80 void QChanges::reject()
81 {
82         controller().reject();
83 }
84
85 } // namespace frontend
86 } // namespace lyx