]> git.lyx.org Git - features.git/blob - src/frontends/qt2/QChanges.C
update ignore, and make sure to dist the lyx2lyx_version.py.in template file
[features.git] / src / frontends / qt2 / 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.h>
23 #include <qtextview.h>
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, _("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         string text;
54         string author(controller().getChangeAuthor());
55         string date(controller().getChangeDate());
56
57         if (!author.empty())
58                 text += bformat(_("Change by %1$s\n\n"), author);
59         if (!date.empty())
60                 text += bformat(_("Change made at %1$s\n"), date);
61
62         dialog_->changeTV->setText(toqstr(text));
63 }
64
65
66 void QChanges::next()
67 {
68         controller().find();
69         update_contents();
70 }
71
72
73 void QChanges::accept()
74 {
75         controller().accept();
76 }
77
78
79 void QChanges::reject()
80 {
81         controller().reject();
82 }
83
84 } // namespace frontend
85 } // namespace lyx