r15130 by cbradney - #6584: Add PDF viewer executable to external tool preferences, allow PDF opening after export with this viewer
scribus-commit
scribus-commit at lists.scribus.net
Fri May 28 19:11:04 CEST 2010
Revision: 15130
Author: cbradney
Date: 2010-05-28T17:03:16.960171Z
Commit message: #6584: Add PDF viewer executable to external tool preferences, allow PDF opening after export with this viewer
Changeset:
M /trunk/Scribus/scribus/pdfoptions.h
M /trunk/Scribus/scribus/prefsmanager.cpp
M /trunk/Scribus/scribus/scribus.cpp
M /trunk/Scribus/scribus/prefsstructs.h
M /trunk/Scribus/scribus/ui/pdfopts.cpp
M /trunk/Scribus/scribus/ui/prefs_externaltools.cpp
M /trunk/Scribus/scribus/ui/pdfopts.h
M /trunk/Scribus/scribus/ui/prefs_externaltools.h
M /trunk/Scribus/scribus/ui/prefs_externaltoolsbase.ui
Diffs:
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp (revision 15129)
+++ scribus/prefsmanager.cpp (revision 15130)
@@ -1579,26 +1579,27 @@
dc8Pr.setAttribute("InkCoverage", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_InkCoverage));
dc8Pr.setAttribute("InkThreshold", appPrefs.printPreviewPrefs.PrPr_InkThreshold);
elem.appendChild(dc8Pr);
- QDomElement dc8Ex = docu.createElement("ExternalTools");
- dc8Ex.setAttribute("ImageEditor", imageEditorExecutable());
- dc8Ex.setAttribute("Ghostscript", ghostscriptExecutable());
- dc8Ex.setAttribute("WebBrowser", extBrowserExecutable());
- dc8Ex.setAttribute("GhostscriptAntiAliasGraphics", static_cast<int>(appPrefs.extToolPrefs.gs_AntiAliasGraphics));
- dc8Ex.setAttribute("GhostscriptAntiAliasText", static_cast<int>(appPrefs.extToolPrefs.gs_AntiAliasText));
- dc8Ex.setAttribute("Resolution", appPrefs.extToolPrefs.gs_Resolution);
- dc8Ex.setAttribute("Uniconvertor", uniconvExecutable());
- dc8Ex.setAttribute("LatexEditor", latexEditorExecutable());
- dc8Ex.setAttribute("LatexResolution", latexResolution());
- dc8Ex.setAttribute("LatexForceDpi", static_cast<int>(appPrefs.extToolPrefs.latexForceDpi));
- dc8Ex.setAttribute("LatexStartWithEmptyFrames", static_cast<int>(appPrefs.extToolPrefs.latexStartWithEmptyFrames));
+ QDomElement dcExternalTools = docu.createElement("ExternalTools");
+ dcExternalTools.setAttribute("ImageEditor", imageEditorExecutable());
+ dcExternalTools.setAttribute("Ghostscript", ghostscriptExecutable());
+ dcExternalTools.setAttribute("WebBrowser", extBrowserExecutable());
+ dcExternalTools.setAttribute("GhostscriptAntiAliasGraphics", static_cast<int>(appPrefs.extToolPrefs.gs_AntiAliasGraphics));
+ dcExternalTools.setAttribute("GhostscriptAntiAliasText", static_cast<int>(appPrefs.extToolPrefs.gs_AntiAliasText));
+ dcExternalTools.setAttribute("Resolution", appPrefs.extToolPrefs.gs_Resolution);
+ dcExternalTools.setAttribute("Uniconvertor", uniconvExecutable());
+ dcExternalTools.setAttribute("PDFViewer", appPrefs.extToolPrefs.pdfViewerExecutable);
+ dcExternalTools.setAttribute("LatexEditor", latexEditorExecutable());
+ dcExternalTools.setAttribute("LatexResolution", latexResolution());
+ dcExternalTools.setAttribute("LatexForceDpi", static_cast<int>(appPrefs.extToolPrefs.latexForceDpi));
+ dcExternalTools.setAttribute("LatexStartWithEmptyFrames", static_cast<int>(appPrefs.extToolPrefs.latexStartWithEmptyFrames));
QStringList configs = latexConfigs();
foreach (QString config, configs) {
QDomElement domConfig = docu.createElement("LatexConfig");
domConfig.setAttribute("file", config);
domConfig.setAttribute("command", appPrefs.extToolPrefs.latexCommands[config]);
- dc8Ex.appendChild(domConfig);
+ dcExternalTools.appendChild(domConfig);
}
- elem.appendChild(dc8Ex);
+ elem.appendChild(dcExternalTools);
QDomElement rde=docu.createElement("Hyphenator");
rde.setAttribute("Language", appPrefs.hyphPrefs.Language);
rde.setAttribute("WordLength", appPrefs.hyphPrefs.MinWordLen);
@@ -2272,6 +2273,7 @@
setExtBrowserExecutable(dc.attribute("WebBrowser", ""));
setUniconvExecutable(dc.attribute("Uniconvertor", "uniconv"));
setLatexEditorExecutable(dc.attribute("LatexEditor", ""));
+ appPrefs.extToolPrefs.pdfViewerExecutable=dc.attribute("PDFViewer", "");
QStringList configs;
QDomNodeList configNodes = dc.elementsByTagName("LatexConfig");
QString latexBase = LatexConfigParser::configBase();
Index: scribus/prefsstructs.h
===================================================================
--- scribus/prefsstructs.h (revision 15129)
+++ scribus/prefsstructs.h (revision 15130)
@@ -324,6 +324,7 @@
int latexResolution; //! LaTeX export resolution
bool latexForceDpi;
bool latexStartWithEmptyFrames;
+ QString pdfViewerExecutable; //! Viewer for PDF files
};
struct MiscellaneousPrefs
Index: scribus/pdfoptions.h
===================================================================
--- scribus/pdfoptions.h (revision 15129)
+++ scribus/pdfoptions.h (revision 15130)
@@ -125,6 +125,7 @@
bool UseLPI;
bool UseSpotColors;
bool doMultiFile;
+ bool openAfterExport;
QMap<QString,LPIData> LPISettings;
QString SolidProf;
int SComp;
Index: scribus/ui/prefs_externaltoolsbase.ui
===================================================================
--- scribus/ui/prefs_externaltoolsbase.ui (revision 15129)
+++ scribus/ui/prefs_externaltoolsbase.ui (revision 15130)
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>770</width>
- <height>933</height>
+ <width>773</width>
+ <height>726</height>
</rect>
</property>
<property name="windowTitle">
@@ -45,8 +45,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>727</width>
- <height>877</height>
+ <width>730</width>
+ <height>992</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -365,6 +365,66 @@
</spacer>
</item>
<item>
+ <widget class="QLabel" name="label_8">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>PDF Viewer</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line_6">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="pdfViewerLabel">
+ <property name="text">
+ <string>Name of &Executable:</string>
+ </property>
+ <property name="buddy">
+ <cstring>pdfViewerLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="pdfViewerLineEdit"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pdfViewerChangeButton">
+ <property name="text">
+ <string>&Change...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_6">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
<widget class="QLabel" name="label_7">
<property name="font">
<font>
Index: scribus/ui/prefs_externaltools.cpp
===================================================================
--- scribus/ui/prefs_externaltools.cpp (revision 15129)
+++ scribus/ui/prefs_externaltools.cpp (revision 15130)
@@ -26,6 +26,7 @@
connect(webBrowserChangeButton, SIGNAL(clicked()), this, SLOT(changeWebBrowser()));
connect(rescanButton, SIGNAL(clicked()), this, SLOT(rescanForTools()));
connect(uniconvertorChangeButton, SIGNAL(clicked()), this, SLOT(changeUniconvertor()));
+ connect(pdfViewerChangeButton, SIGNAL(clicked()), this, SLOT(changePDFViewer()));
connect(latexConfigUpButton, SIGNAL(clicked()), this, SLOT(upButtonPressed()));
connect(latexConfigDownButton, SIGNAL(clicked()), this, SLOT(downButtonPressed()));
connect(latexConfigAddButton, SIGNAL(clicked()), this, SLOT(addConfig()));
@@ -62,6 +63,7 @@
foreach (QString config, configs)
insertConfigItem(config);
latexConfigsListWidget->setCurrentRow(0);
+ pdfViewerLineEdit->setText(QDir::convertSeparators(prefsData->extToolPrefs.pdfViewerExecutable));
}
void Prefs_ExternalTools::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
@@ -84,6 +86,7 @@
prefsData->extToolPrefs.latexCommands=commands;
prefsData->extToolPrefs.latexEditorExecutable=QDir::fromNativeSeparators(latexEditorLineEdit->text());
prefsData->extToolPrefs.uniconvExecutable=QDir::fromNativeSeparators(uniconvertorLineEdit->text());
+ prefsData->extToolPrefs.pdfViewerExecutable=QDir::fromNativeSeparators(pdfViewerLineEdit->text());
}
void Prefs_ExternalTools::changePostScriptTool()
@@ -110,6 +113,14 @@
webBrowserLineEdit->setText( QDir::convertSeparators(s) );
}
+void Prefs_ExternalTools::changePDFViewer()
+{
+ QFileInfo fi(pdfViewerLineEdit->text());
+ QString s = QFileDialog::getOpenFileName(this, tr("Locate your PDF viewer"), fi.path());
+ if (!s.isEmpty())
+ pdfViewerLineEdit->setText( QDir::convertSeparators(s) );
+}
+
void Prefs_ExternalTools::changeUniconvertor()
{
QFileInfo fi(uniconvertorLineEdit->text());
Index: scribus/ui/prefs_externaltools.h
===================================================================
--- scribus/ui/prefs_externaltools.h (revision 15129)
+++ scribus/ui/prefs_externaltools.h (revision 15130)
@@ -36,6 +36,7 @@
void changePostScriptTool();
void changeImageTool();
void changeWebBrowser();
+ void changePDFViewer();
void changeUniconvertor();
void changeLatexEditor();
void rescanForTools();
Index: scribus/ui/pdfopts.cpp
===================================================================
--- scribus/ui/pdfopts.cpp (revision 15129)
+++ scribus/ui/pdfopts.cpp (revision 15130)
@@ -98,7 +98,11 @@
multiFile = new QCheckBox( tr( "Output one file for eac&h page" ), Name );
multiFile->setChecked(Opts.doMultiFile);
NameLayout->addWidget( multiFile, 1, 0 );
+ openAfterExportCheckBox = new QCheckBox( tr( "Open PDF after Export" ), Name );
+ openAfterExportCheckBox->setChecked(Opts.openAfterExport);
+ NameLayout->addWidget( openAfterExportCheckBox, 2, 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 );
@@ -227,6 +231,7 @@
{
Opts.fileName = QDir::fromNativeSeparators(fileNameLineEdit->text());
Opts.doMultiFile = multiFile->isChecked();
+ Opts.openAfterExport = openAfterExportCheckBox->isChecked();
Opts.Thumbnails = Options->CheckBox1->isChecked();
Opts.Compress = Options->Compression->isChecked();
Opts.CompressMethod = (PDFOptions::PDFCompression) Options->CMethod->currentIndex();
Index: scribus/ui/pdfopts.h
===================================================================
--- scribus/ui/pdfopts.h (revision 15129)
+++ scribus/ui/pdfopts.h (revision 15130)
@@ -69,6 +69,7 @@
QHBoxLayout* Layout7;
QGroupBox* Name;
QCheckBox* multiFile;
+ QCheckBox* openAfterExportCheckBox;
QToolButton* FileC;
QPushButton* OK;
QPushButton* Cancel;
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 15129)
+++ scribus/scribus.cpp (revision 15130)
@@ -32,6 +32,7 @@
#include <QDropEvent>
#include <QEvent>
#include <QEventLoop>
+#include <QFileDialog>
#include <QFrame>
#include <QIcon>
#include <QInputDialog>
@@ -8121,6 +8122,24 @@
if (doc->pdfOptions().useDocBleeds)
doc->pdfOptions().bleeds = optBleeds;
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+ if (errorMsg.isEmpty() && doc->pdfOptions().openAfterExport && !doc->pdfOptions().doMultiFile)
+ {
+ QString pdfViewer(PrefsManager::instance()->appPrefs.extToolPrefs.pdfViewerExecutable);
+ QFileInfo fi(pdfViewer);
+ if (pdfViewer.isEmpty())
+ {
+ pdfViewer = QFileDialog::getOpenFileName(this, tr("Locate your PDF viewer"), QString::null, QString::null);
+ if (!QFileInfo(pdfViewer).exists())
+ pdfViewer="";
+ PrefsManager::instance()->appPrefs.extToolPrefs.pdfViewerExecutable=pdfViewer;
+ }
+ if (!pdfViewer.isEmpty())
+ {
+ QStringList args;
+ args << doc->pdfOptions().fileName;
+ int ret=System(pdfViewer, args);
+ }
+ }
}
}
More information about the scribus-commit
mailing list