PDFExportDialog::PDFExportDialog( QWidget* parent, const QString & docFileName, const QMap<QString, int > & DocFonts, ScribusView *currView, PDFOptions & pdfOptions, const ProfilesL & PDFXProfiles, const SCFonts &AllFonts, const ProfilesL & printerProfiles) : QDialog( parent ), m_doc(currView->Doc), m_opts(pdfOptions), m_unitRatio(currView->Doc->unitRatio()), m_cmsDescriptor(""), m_components(3), m_printerProfiles(printerProfiles) { setModal(true); setWindowTitle( tr( "Save as PDF" ) ); setWindowIcon(loadIcon("AppIcon.png")); PDFExportLayout = new QVBoxLayout( this ); PDFExportLayout->setSpacing( 5 ); PDFExportLayout->setMargin( 10 ); Name = new QGroupBox( this ); Name->setTitle( tr( "O&utput to File:" ) ); NameLayout = new QGridLayout( Name ); NameLayout->setSpacing( 5 ); NameLayout->setMargin( 10 ); NameLayout->setAlignment( Qt::AlignTop ); fileNameLineEdit = new QLineEdit( Name ); fileNameLineEdit->setMinimumSize( QSize( 268, 22 ) ); if (!m_opts.fileName.isEmpty()) fileNameLineEdit->setText( QDir::toNativeSeparators(m_opts.fileName) ); else { QFileInfo fi(docFileName); QString completeBaseName = fi.completeBaseName(); if (completeBaseName.endsWith(".sla", Qt::CaseInsensitive)) if (completeBaseName.length() > 4) completeBaseName.chop(4); if (completeBaseName.endsWith(".gz", Qt::CaseInsensitive)) if (completeBaseName.length() > 3) completeBaseName.chop(3); if (fi.exists()) { QString fileName(fi.path() + "/" + completeBaseName + ".pdf"); fileNameLineEdit->setText( QDir::toNativeSeparators(fileName) ); } else { PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs"); QString pdfdir = dirs->get("pdf", fi.path()); if (pdfdir.right(1) != "/") pdfdir += "/"; QString fileName(pdfdir + completeBaseName + ".pdf"); fileNameLineEdit->setText( QDir::toNativeSeparators(fileName) ); } } NameLayout->addWidget( fileNameLineEdit, 0, 0 ); changeButton = new QPushButton( Name ); changeButton->setText( tr( "Cha&nge..." ) ); changeButton->setMinimumSize( QSize( 88, 24 ) ); NameLayout->addWidget( changeButton, 0, 1 ); multiFile = new QCheckBox( tr( "Output one file for eac&h page" ), Name ); multiFile->setChecked(m_opts.doMultiFile); NameLayout->addWidget( multiFile, 1, 0 ); openAfterExportCheckBox = new QCheckBox( tr( "Open PDF after Export" ), Name ); openAfterExportCheckBox->setChecked(m_opts.openAfterExport); NameLayout->addWidget( openAfterExportCheckBox, 2, 0 ); PDFExportLayout->addWidget( Name ); Options = new TabPDFOptions( this, pdfOptions, AllFonts, PDFXProfiles, DocFonts, currView->Doc->unitIndex(), currView->Doc->pageHeight(), currView->Doc->pageWidth(), currView->Doc, true ); PDFExportLayout->addWidget( Options ); Layout7 = new QHBoxLayout; Layout7->setSpacing( 5 ); Layout7->setMargin( 0 ); QSpacerItem* spacer_2 = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout7->addItem( spacer_2 ); okButton = new QPushButton( tr( "&Save" ), this ); okButton->setAutoDefault( true ); okButton->setDefault( true ); Layout7->addWidget( okButton ); cancelButton = new QPushButton( CommonStrings::tr_Cancel, this ); Layout7->addWidget( cancelButton ); PDFExportLayout->addLayout( Layout7 ); if ((m_opts.Version == PDFOptions::PDFVersion_X3) && (Options->InfoString->text().isEmpty())) okButton->setEnabled(false); resize(sizeHint()); // setMaximumSize( sizeHint() ); //tooltips multiFile->setToolTip( "<qt>" + tr( "This enables exporting one individually named PDF file for each page in the document. Page numbers are added automatically. This is most useful for imposing PDF for commercial printing.") + "</qt>" ); openAfterExportCheckBox->setToolTip( "<qt>" + tr( "Open the exported PDF with the PDF viewer as set in External Tools preferences, when not exporting to a multi-file export destination.") + "</qt>" ); okButton->setToolTip( "<qt>" + tr( "The save button will be disabled if you are trying to export PDF/X and the info string is missing from the PDF/X tab.") + "</qt>" ); // signals and slots connections connect( changeButton, SIGNAL( clicked() ), this, SLOT( ChangeFile() ) ); connect( okButton, SIGNAL( clicked() ), this, SLOT( DoExport() ) ); connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( fileNameLineEdit, SIGNAL( editingFinished() ), this, SLOT( fileNameChanged() ) ); connect( Options, SIGNAL(noInfo()), this, SLOT(disableSave())); connect( Options, SIGNAL(hasInfo()), this, SLOT(enableSave())); }
PDFExportDialog::PDFExportDialog( QWidget* parent, const QString & docFileName, const QMap<QString, int > & DocFonts, ScribusView *currView, PDFOptions & pdfOptions, const QList<PDFPresentationData> & Eff, const ProfilesL & PDFXProfiles, const SCFonts &AllFonts, double unitRatio, const ProfilesL & printerProfiles) : QDialog( parent ), doc(currView->Doc), EffVal(Eff), Opts(pdfOptions), docUnitRatio(unitRatio), cmsDescriptorName(""), components(3), appPrinterProfiles(printerProfiles) { setModal(true); setWindowTitle( tr( "Save as PDF" ) ); setWindowIcon(loadIcon("AppIcon.png")); PDFExportLayout = new QVBoxLayout( this ); PDFExportLayout->setSpacing( 5 ); PDFExportLayout->setMargin( 10 ); Name = new QGroupBox( this ); Name->setTitle( tr( "O&utput to File:" ) ); NameLayout = new QGridLayout( Name ); NameLayout->setSpacing( 5 ); NameLayout->setMargin( 10 ); NameLayout->setAlignment( Qt::AlignTop ); fileNameLineEdit = new QLineEdit( Name ); fileNameLineEdit->setMinimumSize( QSize( 268, 22 ) ); if (!Opts.fileName.isEmpty()) fileNameLineEdit->setText( QDir::toNativeSeparators(Opts.fileName) ); else { QFileInfo fi(docFileName); if (fi.exists()) { QString fileName(fi.path()+"/"+fi.baseName()+".pdf"); fileNameLineEdit->setText( QDir::toNativeSeparators(fileName) ); } else { PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs"); QString pdfdir = dirs->get("pdf", fi.path()); if (pdfdir.right(1) != "/") pdfdir += "/"; QString fileName(pdfdir+fi.baseName()+".pdf"); fileNameLineEdit->setText( QDir::toNativeSeparators(fileName) ); } } NameLayout->addWidget( fileNameLineEdit, 0, 0 ); FileC = new QToolButton( Name ); FileC->setText( tr( "Cha&nge..." ) ); FileC->setMinimumSize( QSize( 88, 24 ) ); NameLayout->addWidget( FileC, 0, 1 ); multiFile = new QCheckBox( tr( "Output one file for eac&h page" ), Name ); multiFile->setChecked(Opts.doMultiFile); NameLayout->addWidget( multiFile, 1, 0 ); PDFExportLayout->addWidget( Name ); Options = new TabPDFOptions( this, pdfOptions, AllFonts, PDFXProfiles, DocFonts, Eff, currView->Doc->unitIndex(), currView->Doc->pageHeight, currView->Doc->pageWidth, currView->Doc, true ); PDFExportLayout->addWidget( Options ); Layout7 = new QHBoxLayout; Layout7->setSpacing( 5 ); Layout7->setMargin( 0 ); QSpacerItem* spacer_2 = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout7->addItem( spacer_2 ); OK = new QPushButton( tr( "&Save" ), this ); OK->setAutoDefault( true ); OK->setDefault( true ); Layout7->addWidget( OK ); Cancel = new QPushButton( CommonStrings::tr_Cancel, this ); Layout7->addWidget( Cancel ); PDFExportLayout->addLayout( Layout7 ); if ((Opts.Version == PDFOptions::PDFVersion_X3) && (Options->InfoString->text().isEmpty())) OK->setEnabled(false); resize(sizeHint()); // setMaximumSize( sizeHint() ); //tooltips multiFile->setToolTip( "<qt>" + tr( "This enables exporting one individually named PDF file for each page in the document. Page numbers are added automatically. This is most useful for imposing PDF for commercial printing.") + "</qt>" ); OK->setToolTip( "<qt>" + tr( "The save button will be disabled if you are trying to export PDF/X-3 and the info string is missing from the PDF/X-3 tab.") + "</qt>" ); // signals and slots connections connect( FileC, SIGNAL( clicked() ), this, SLOT( ChangeFile() ) ); connect( OK, SIGNAL( clicked() ), this, SLOT( DoExport() ) ); connect( Cancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( fileNameLineEdit, SIGNAL( editingFinished() ), this, SLOT( fileNameChanged() ) ); connect( Options, SIGNAL(noInfo()), this, SLOT(disableSave())); connect( Options, SIGNAL(hasInfo()), this, SLOT(enableSave())); }
//-------------------------------------------------------------- ofxCameraMove::~ofxCameraMove(){ disableSave(); }