2006-03-05 17:24:44 +00:00
|
|
|
/**
|
|
|
|
* \file QDialogView.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Angus Leeming
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "QDialogView.h"
|
|
|
|
#include "Qt2BC.h"
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
|
|
#include "controllers/ButtonController.h"
|
|
|
|
|
2006-10-09 10:35:14 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2006-10-09 10:35:14 +00:00
|
|
|
QDialogView::QDialogView(Dialog & parent, docstring const & t)
|
2006-03-05 17:24:44 +00:00
|
|
|
: Dialog::View(parent,t), updating_(false)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
Qt2BC & QDialogView::bcview()
|
|
|
|
{
|
|
|
|
return static_cast<Qt2BC &>(dialog().bc().view());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool QDialogView::isVisible() const
|
|
|
|
{
|
|
|
|
return form() && form()->isVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool QDialogView::readOnly() const
|
|
|
|
{
|
|
|
|
return kernel().isBufferReadonly();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDialogView::show()
|
|
|
|
{
|
|
|
|
if (!form()) {
|
|
|
|
build();
|
|
|
|
}
|
|
|
|
|
2007-04-03 21:47:00 +00:00
|
|
|
QSize const sizeHint = form()->sizeHint();
|
2007-04-03 20:45:46 +00:00
|
|
|
if (sizeHint.height() >= 0 && sizeHint.width() >= 0)
|
|
|
|
form()->setMinimumSize(sizeHint);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
update(); // make sure its up-to-date
|
|
|
|
if (dialog().controller().exitEarly())
|
|
|
|
return;
|
|
|
|
|
2006-08-17 08:53:10 +00:00
|
|
|
form()->setWindowTitle(toqstr("LyX: " + getTitle()));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
if (form()->isVisible()) {
|
|
|
|
form()->raise();
|
2007-01-28 20:10:47 +00:00
|
|
|
form()->activateWindow();
|
2007-02-13 18:20:07 +00:00
|
|
|
form()->setFocus();
|
2006-03-05 17:24:44 +00:00
|
|
|
} else {
|
|
|
|
form()->show();
|
2007-02-13 18:20:07 +00:00
|
|
|
form()->setFocus();
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDialogView::hide()
|
|
|
|
{
|
|
|
|
if (form() && form()->isVisible())
|
|
|
|
form()->hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool QDialogView::isValid()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDialogView::changed()
|
|
|
|
{
|
|
|
|
if (updating_)
|
|
|
|
return;
|
|
|
|
bc().valid(isValid());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDialogView::slotWMHide()
|
|
|
|
{
|
|
|
|
dialog().CancelButton();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDialogView::slotApply()
|
|
|
|
{
|
|
|
|
dialog().ApplyButton();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDialogView::slotOK()
|
|
|
|
{
|
|
|
|
dialog().OKButton();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDialogView::slotClose()
|
|
|
|
{
|
|
|
|
dialog().CancelButton();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QDialogView::slotRestore()
|
|
|
|
{
|
|
|
|
dialog().RestoreButton();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2006-05-18 08:51:12 +00:00
|
|
|
|
|
|
|
#include "QDialogView_moc.cpp"
|