]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QChanges.C
* redo some frame decoration icons and also make them consistent in size
[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  * \author Michael Gerz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "QChanges.h"
15 #include "QChangesDialog.h"
16 #include "Qt2BC.h"
17 #include "qt_helpers.h"
18
19 #include "support/lstrings.h"
20
21 #include "controllers/ControlChanges.h"
22
23 #include <QPushButton>
24 #include <QTextBrowser>
25
26 using lyx::support::bformat;
27
28 namespace lyx {
29 namespace frontend {
30
31 typedef QController<ControlChanges, QView<QChangesDialog> > changes_base_class;
32
33
34 QChanges::QChanges(Dialog & parent)
35         : changes_base_class(parent, _("Merge Changes"))
36 {
37 }
38
39
40 void QChanges::build_dialog()
41 {
42         dialog_.reset(new QChangesDialog(this));
43
44         bcview().setCancel(dialog_->closePB);
45         bcview().addReadOnly(dialog_->acceptPB);
46         bcview().addReadOnly(dialog_->rejectPB);
47 }
48
49
50 void QChanges::update_contents()
51 {
52         docstring text;
53         docstring author = controller().getChangeAuthor();
54         docstring date = controller().getChangeDate();
55
56         if (!author.empty())
57                 text += bformat(_("Change by %1$s\n\n"), author);
58         if (!date.empty())
59                 text += bformat(_("Change made at %1$s\n"), date);
60
61         dialog_->changeTB->setPlainText(toqstr(text));
62 }
63
64
65 void QChanges::next()
66 {
67         controller().next();
68 }
69
70
71 void QChanges::accept()
72 {
73         controller().accept();
74 }
75
76
77 void QChanges::reject()
78 {
79         controller().reject();
80 }
81
82 } // namespace frontend
83 } // namespace lyx