Пример #1
0
ExportForm::ExportForm(QWidget* parent, ScribusDoc* doc, int size, int quality, QString type)
	: QDialog(parent, 0), m_doc(doc), m_PageCount(doc->DocPages.count())
{
	setupUi(this);
	setModal(true);
	prefs = PrefsManager::instance()->prefsFile->getPluginContext("pixmapexport");

	QDirModel * dirModel = new QDirModel(this);
	dirModel->setFilter(QDir::AllDirs);
	outputDirectory->setCompleter(new QCompleter(dirModel, this));
	
	outputDirectory->setText( QDir::convertSeparators(prefs->get("wdir", QDir::currentPath())) );
	QList<QByteArray> imgs = QImageWriter::supportedImageFormats();
	for (int a = 0; a < imgs.count(); a++)
	{
		bitmapType->addItem(imgs[a]);
	}
	setCurrentComboItem(bitmapType, type.toLower());
	qualityBox->setValue(quality);
	qualityBox->setWrapping(true);
	
	DPIBox->setValue(size);
	enlargementBox->setValue(size);
	onePageRadio->setChecked( true );
 	pageNrButton->setIcon(loadIcon("ellipsis.png"));
	rangeVal->setEnabled(false);
	pageNrButton->setEnabled(false);

	languageChange();
	readConfig();
	computeSize();
	
	connect(outputDirectoryButton, SIGNAL(clicked()), this, SLOT(OutputDirectoryButton_pressed()));
	connect(intervalPagesRadio, SIGNAL(clicked()), this, SLOT(IntervalPagesRadio_stateChanged()));
	connect(allPagesRadio, SIGNAL(clicked()), this, SLOT(AllPagesRadio_stateChanged()));
	connect(onePageRadio, SIGNAL(clicked()), this, SLOT(OnePageRadio_stateChanged()));
	connect(enlargementBox, SIGNAL(valueChanged(int)), this, SLOT(computeSize()));
	connect(DPIBox, SIGNAL(valueChanged(int)), this, SLOT(computeSize()));
	connect(pageNrButton, SIGNAL(clicked()), this, SLOT(createPageNumberRange()));
}
Пример #2
0
PrintDialog::PrintDialog( QWidget* parent, ScribusDoc* doc, const PrintOptions& printOptions, bool gcr, QStringList spots)
		: QDialog( parent )
{
	setupUi(this);
	setModal(true);
	cdia = 0;
	m_doc = doc;
	unit = doc->unitIndex();
	unitRatio = unitGetRatioFromIndex(doc->unitIndex());
	prefs = PrefsManager::instance()->prefsFile->getContext("print_options");
	DevMode = printOptions.devMode;
	PrinterOpts = "";
	setWindowIcon(QIcon(loadIcon("AppIcon.png")));
 	pageNrButton->setIcon(QIcon(loadIcon("ellipsis.png")));
	printEngines->addItem( CommonStrings::trPostScript1 );
	printEngines->addItem( CommonStrings::trPostScript2 );
	printEngines->addItem( CommonStrings::trPostScript3 );
	markLength->setNewUnit(unit);
	markLength->setMinimum(1*unitRatio);
	markLength->setMaximum(3000*unitRatio);
	markOffset->setNewUnit(unit);
	markOffset->setMinimum(0);
	markOffset->setMaximum(3000*unitRatio);
	BleedBottom->setNewUnit(unit);
	BleedBottom->setMinimum(0);
	BleedBottom->setMaximum(3000*unitRatio);
	BleedLeft->setNewUnit(unit);
	BleedLeft->setMinimum(0);
	BleedLeft->setMaximum(3000*unitRatio);
	BleedRight->setNewUnit(unit);
	BleedRight->setMinimum(0);
	BleedRight->setMaximum(3000*unitRatio);
	BleedTop->setNewUnit(unit);
	BleedTop->setMinimum(0);
	BleedTop->setMaximum(3000*unitRatio);
	previewButton->setEnabled(!previewDinUse);
	// Fill printer list
	QString Pcap;
	QString printerName;
	QStringList printerNames = PrinterUtil::getPrinterNames();
	int numPrinters = printerNames.count();
	for( int i = 0; i < numPrinters; i++)
	{
		printerName = printerNames[i];
		PrintDest->addItem(printerName);
		if( printerName == printOptions.printer )
		{
			PrintDest->setCurrentIndex(PrintDest->count()-1);
			prefs->set("CurrentPrn", PrintDest->currentText());
		}
	}

	PrintDest->addItem( tr("File"));

	// Fill Separation list
	QString sep[] =
	    {
	        tr("All"), tr("Cyan"), tr("Magenta"), tr("Yellow"),
	        tr("Black")
	    };
	size_t sepArray = sizeof(sep) / sizeof(*sep);
	for (uint prop = 0; prop < sepArray; ++prop)
		SepArt->addItem(sep[prop]);
	SepArt->addItems(spots);

	if (m_doc->pagePositioning() != 0)
	{
		BleedTxt3->setText( tr( "Inside:" ) );
		BleedTxt4->setText( tr( "Outside:" ) );
	}

	QString prnDevice = printOptions.printer;
	if (prnDevice.isEmpty())
		prnDevice = PrintDest->currentText();
	if ((prnDevice == tr("File")) || (PrintDest->count() == 1))
	{
		PrintDest->setCurrentIndex(PrintDest->count()-1);
		prefs->set("CurrentPrn", PrintDest->currentText());
		DateiT->setEnabled(true);
		LineEdit1->setEnabled(true);
		if (!printOptions.filename.isEmpty())
			LineEdit1->setText(QDir::toNativeSeparators(printOptions.filename));
		ToolButton1->setEnabled(true);
	}

	setMaximumSize(sizeHint());
	PrintDest->setFocus();
	// signals and slots connections
	connect( OKButton, SIGNAL( clicked() ), this, SLOT( okButtonClicked() ) );
	connect( OKButton_2, SIGNAL( clicked() ), this, SLOT( reject() ) );
	connect( PrintDest, SIGNAL(activated(const QString&)), this, SLOT(SelPrinter(const QString&)));
	connect( printEngines, SIGNAL(activated(const QString&)), this, SLOT(SelEngine(const QString&)));
	connect( RadioButton1, SIGNAL(toggled(bool)), this, SLOT(SelRange(bool)));
	connect( CurrentPage, SIGNAL(toggled(bool)), this, SLOT(SelRange(bool)));
	connect( pageNrButton, SIGNAL(clicked()), this, SLOT(createPageNumberRange()));
	connect( PrintSep, SIGNAL(activated(int)), this, SLOT(SelMode(int)));
	connect( ToolButton1, SIGNAL(clicked()), this, SLOT(SelFile()));
	connect( OtherCom, SIGNAL(clicked()), this, SLOT(SelComm()));
	connect( previewButton, SIGNAL(clicked()), this, SLOT(previewButtonClicked()));
	connect( docBleeds, SIGNAL(clicked()), this, SLOT(doDocBleeds()));
	connect( OptButton, SIGNAL( clicked() ), this, SLOT( SetOptions() ) );

	setStoredValues(printOptions.filename, gcr);
#if defined(_WIN32)
	if (!outputToFile())
		PrinterUtil::initDeviceSettings( PrintDest->currentText(), DevMode );
#endif

	printEngineMap = PrinterUtil::getPrintEngineSupport(PrintDest->currentText(), outputToFile());
	refreshPrintEngineBox();

	bool ps1Supported = printEngineMap.contains(CommonStrings::trPostScript1);
	bool ps2Supported = printEngineMap.contains(CommonStrings::trPostScript2);
	bool ps3Supported = printEngineMap.contains(CommonStrings::trPostScript3);
	bool psSupported  = (ps1Supported || ps2Supported || ps3Supported);
	printEngines->setEnabled(psSupported || outputToFile());
	UseICC->setEnabled(m_doc->HasCMS && psSupported);
}