2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-04-26 03:53:02 +00:00
|
|
|
* \file QChanges.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>
|
|
|
|
|
|
|
|
#include "QChanges.h"
|
|
|
|
#include "Qt2BC.h"
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
|
|
|
#include "controllers/ControlChanges.h"
|
|
|
|
|
2006-05-04 07:31:46 +00:00
|
|
|
#include <QPushButton>
|
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
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// QChangesDialog
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
QChangesDialog::QChangesDialog(QChanges * form)
|
|
|
|
: 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()));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QChangesDialog::nextPressed()
|
|
|
|
{
|
|
|
|
form_->next();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QChangesDialog::acceptPressed()
|
|
|
|
{
|
|
|
|
form_->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QChangesDialog::rejectPressed()
|
|
|
|
{
|
|
|
|
form_->reject();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QChangesDialog::closeEvent(QCloseEvent *e)
|
|
|
|
{
|
|
|
|
form_->slotWMHide();
|
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// QChanges
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
typedef QController<ControlChanges, QView<QChangesDialog> > ChangesBase;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
QChanges::QChanges(Dialog & parent)
|
2007-04-25 10:25:37 +00:00
|
|
|
: ChangesBase(parent, _("Merge Changes"))
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QChanges::build_dialog()
|
|
|
|
{
|
|
|
|
dialog_.reset(new QChangesDialog(this));
|
|
|
|
|
|
|
|
bcview().setCancel(dialog_->closePB);
|
|
|
|
bcview().addReadOnly(dialog_->acceptPB);
|
|
|
|
bcview().addReadOnly(dialog_->rejectPB);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QChanges::update_contents()
|
|
|
|
{
|
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-02-01 20:48:43 +00:00
|
|
|
void QChanges::next()
|
|
|
|
{
|
|
|
|
controller().next();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
void QChanges::accept()
|
|
|
|
{
|
|
|
|
controller().accept();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QChanges::reject()
|
|
|
|
{
|
|
|
|
controller().reject();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-04-25 10:25:37 +00:00
|
|
|
|
|
|
|
#include "QChanges_moc.cpp"
|