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"
|
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-04-25 10:25:37 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2007-08-31 05:53:55 +00:00
|
|
|
// GuiChangesDialog
|
2007-04-25 10:25:37 +00:00
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
GuiChangesDialog::GuiChangesDialog(GuiChanges * form)
|
2007-04-25 10:25:37 +00:00
|
|
|
: form_(form)
|
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
|
|
|
|
connect(nextPB, SIGNAL(clicked()), this, SLOT(nextPressed()));
|
|
|
|
connect(rejectPB, SIGNAL(clicked()), this, SLOT(rejectPressed()));
|
|
|
|
connect(acceptPB, SIGNAL(clicked()), this, SLOT(acceptPressed()));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiChangesDialog::nextPressed()
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
|
|
|
form_->next();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiChangesDialog::acceptPressed()
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
|
|
|
form_->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiChangesDialog::rejectPressed()
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
|
|
|
form_->reject();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiChangesDialog::closeEvent(QCloseEvent *e)
|
2007-04-25 10:25:37 +00:00
|
|
|
{
|
|
|
|
form_->slotWMHide();
|
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2007-08-31 05:53:55 +00:00
|
|
|
// GuiChanges
|
2007-04-25 10:25:37 +00:00
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
GuiChanges::GuiChanges(GuiDialog & parent)
|
2007-08-31 22:16:11 +00:00
|
|
|
: GuiView<GuiChangesDialog>(parent, _("Merge Changes"))
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiChanges::build_dialog()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-08-31 05:53:55 +00:00
|
|
|
dialog_.reset(new GuiChangesDialog(this));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
bc().setCancel(dialog_->closePB);
|
|
|
|
bc().addReadOnly(dialog_->acceptPB);
|
|
|
|
bc().addReadOnly(dialog_->rejectPB);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiChanges::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
|
|
|
|
2006-05-04 07:31:46 +00:00
|
|
|
dialog_->changeTB->setPlainText(toqstr(text));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiChanges::next()
|
2007-02-01 20:48:43 +00:00
|
|
|
{
|
|
|
|
controller().next();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiChanges::accept()
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
controller().accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
void GuiChanges::reject()
|
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"
|