]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiChanges.cpp
some remnaming
[lyx.git] / src / frontends / qt4 / GuiChanges.cpp
1 /**
2  * \file GuiChanges.cpp
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 "GuiChanges.h"
15 #include "ControlChanges.h"
16
17 #include "qt_helpers.h"
18
19 #include "support/lstrings.h"
20
21 #include <QCloseEvent>
22 #include <QTextBrowser>
23
24 using lyx::support::bformat;
25
26
27 namespace lyx {
28 namespace frontend {
29
30 GuiChangesDialog::GuiChangesDialog(LyXView & lv)
31         : GuiDialog(lv, "changes")
32 {
33         setupUi(this);
34         setController(new ControlChanges(*this));
35         setViewTitle(_("Merge Changes"));
36
37         connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
38         connect(nextPB, SIGNAL(clicked()), this, SLOT(nextPressed()));
39         connect(rejectPB, SIGNAL(clicked()), this, SLOT(rejectPressed()));
40         connect(acceptPB, SIGNAL(clicked()), this, SLOT(acceptPressed()));
41
42         bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
43         bc().setCancel(closePB);
44         bc().addReadOnly(acceptPB);
45         bc().addReadOnly(rejectPB);
46 }
47
48
49 ControlChanges & GuiChangesDialog::controller()
50 {
51         return static_cast<ControlChanges &>(GuiDialog::controller());
52 }
53
54
55 void GuiChangesDialog::closeEvent(QCloseEvent *e)
56 {
57         slotClose();
58         e->accept();
59 }
60
61
62 void GuiChangesDialog::updateContents()
63 {
64         docstring text;
65         docstring author = controller().getChangeAuthor();
66         docstring date = controller().getChangeDate();
67
68         if (!author.empty())
69                 text += bformat(_("Change by %1$s\n\n"), author);
70         if (!date.empty())
71                 text += bformat(_("Change made at %1$s\n"), date);
72
73         changeTB->setPlainText(toqstr(text));
74 }
75
76
77 void GuiChangesDialog::nextPressed()
78 {
79         controller().next();
80 }
81
82
83 void GuiChangesDialog::acceptPressed()
84 {
85         controller().accept();
86 }
87
88
89 void GuiChangesDialog::rejectPressed()
90 {
91         controller().reject();
92 }
93
94 } // namespace frontend
95 } // namespace lyx
96
97 #include "GuiChanges_moc.cpp"