2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiChanges.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
2007-02-01 20:48:43 +00:00
|
|
|
* \author Michael Gerz
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiChanges.h"
|
2007-09-05 20:33:29 +00:00
|
|
|
#include "ControlChanges.h"
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
2007-04-25 10:25:37 +00:00
|
|
|
#include <QCloseEvent>
|
2006-05-04 07:31:46 +00:00
|
|
|
#include <QTextBrowser>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
using lyx::support::bformat;
|
|
|
|
|
2007-04-25 10:25:37 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
GuiChangesDialog::GuiChangesDialog(LyXView & lv)
|
|
|
|
: GuiDialog(lv, "changes")
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
2007-09-05 20:33:29 +00:00
|
|
|
setController(new ControlChanges(*this));
|
|
|
|
setViewTitle(_("Merge Changes"));
|
|
|
|
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
2007-04-25 10:25:37 +00:00
|
|
|
connect(nextPB, SIGNAL(clicked()), this, SLOT(nextPressed()));
|
|
|
|
connect(rejectPB, SIGNAL(clicked()), this, SLOT(rejectPressed()));
|
|
|
|
connect(acceptPB, SIGNAL(clicked()), this, SLOT(acceptPressed()));
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
|
|
|
|
bc().setCancel(closePB);
|
|
|
|
bc().addReadOnly(acceptPB);
|
|
|
|
bc().addReadOnly(rejectPB);
|
2007-04-25 10:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
ControlChanges & GuiChangesDialog::controller() const
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
return static_cast<ControlChanges &>(Dialog::controller());
|
2007-04-25 10:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiChangesDialog::closeEvent(QCloseEvent *e)
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
slotWMHide();
|
2007-04-25 10:25:37 +00:00
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
void GuiChangesDialog::update_contents()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2006-09-11 08:54:10 +00:00
|
|
|
docstring text;
|
2006-10-08 10:32:33 +00:00
|
|
|
docstring author = controller().getChangeAuthor();
|
|
|
|
docstring date = controller().getChangeDate();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
if (!author.empty())
|
2006-09-11 08:54:10 +00:00
|
|
|
text += bformat(_("Change by %1$s\n\n"), author);
|
2006-03-05 17:24:44 +00:00
|
|
|
if (!date.empty())
|
2006-09-11 08:54:10 +00:00
|
|
|
text += bformat(_("Change made at %1$s\n"), date);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
changeTB->setPlainText(toqstr(text));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
void GuiChangesDialog::nextPressed()
|
2007-02-01 20:48:43 +00:00
|
|
|
{
|
|
|
|
controller().next();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
void GuiChangesDialog::acceptPressed()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
controller().accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
void GuiChangesDialog::rejectPressed()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
controller().reject();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-25 10:25:37 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiChanges_moc.cpp"
|