2001-02-14 19:43:56 +00:00
|
|
|
/**
|
2001-08-19 13:25:15 +00:00
|
|
|
* \file QPrintDialog.C
|
2001-02-14 19:43:56 +00:00
|
|
|
* Copyright 2001 LyX Team
|
|
|
|
* see the file COPYING
|
|
|
|
*
|
|
|
|
* \author John Levon, moz@compsoc.man.ac.uk
|
|
|
|
* \author Edwin Leuven, leuven@fee.uva.nl
|
|
|
|
*/
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
#include <qfiledialog.h>
|
|
|
|
#include <qcheckbox.h>
|
|
|
|
#include <qlabel.h>
|
|
|
|
#include <qlineedit.h>
|
|
|
|
#include <qpushbutton.h>
|
|
|
|
#include <qradiobutton.h>
|
|
|
|
#include <qspinbox.h>
|
2001-02-14 19:43:56 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
#include "QPrintDialog.h"
|
|
|
|
#include "QPrint.h"
|
2001-02-14 19:43:56 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "support/filetools.h"
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
|
|
|
#include <gettext.h>
|
|
|
|
|
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
QPrintDialog::QPrintDialog(QPrint * f)
|
|
|
|
: QPrintDialogBase(0, 0, false, 0),
|
2001-08-19 13:25:15 +00:00
|
|
|
form_(f)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
connect(printPB, SIGNAL(clicked()),
|
|
|
|
form_, SLOT(slotOK()));
|
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
form_, SLOT(slotClose()));
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrintDialog::change_adaptor()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
form_->changed();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrintDialog::browseClicked()
|
|
|
|
{
|
2002-03-21 21:21:28 +00:00
|
|
|
QString file = QFileDialog::getOpenFileName(QString::null,
|
2001-08-29 21:11:30 +00:00
|
|
|
_("PostScript files (*.ps)"), this, 0, _("Select a file to print to"));
|
|
|
|
if (!file.isNull()) {
|
|
|
|
fileED->setText(file);
|
|
|
|
form_->changed();
|
2001-06-05 17:05:51 +00:00
|
|
|
}
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrintDialog::fileChanged()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
if (!fileED->text().isEmpty())
|
|
|
|
fileRB->setChecked(true);
|
|
|
|
form_->changed();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrintDialog::copiesChanged(int i)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
collateCB->setEnabled(i != 1);
|
|
|
|
form_->changed();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrintDialog::printerChanged()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
printerRB->setChecked(true);
|
|
|
|
form_->changed();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
void QPrintDialog::pagerangeChanged()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-08-29 21:11:30 +00:00
|
|
|
int from = strToUnsignedInt(fromED->text().latin1());
|
|
|
|
int to = strToUnsignedInt(toED->text().latin1());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
if (!toED->text().isEmpty() && from > to)
|
|
|
|
fromED->setText(toED->text());
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-29 21:11:30 +00:00
|
|
|
form_->changed();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|