Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 4028 → Rev 4027

/branches/Version13x/Scribus/scribus/multiprogressdialog.h
File deleted
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/multiprogressdialog.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/multiprogressdialog.cpp (revision 4028)
+++ branches/Version13x/Scribus/scribus/multiprogressdialog.cpp (nonexistent)
@@ -1,146 +0,0 @@
-/***************************************************************************
-* Copyright (C) 2005 by Craig Bradney *
-* cbradney@zip.com.au *
-* *
-* This program is free software; you can redistribute it and/or modify *
-* it under the terms of the GNU General Public License as published by *
-* the Free Software Foundation; either version 2 of the License, or *
-* (at your option) any later version. *
-* *
-* This program is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU General Public License for more details. *
-* *
-* You should have received a copy of the GNU General Public License *
-* along with this program; if not, write to the *
-* Free Software Foundation, Inc., *
-* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
-***************************************************************************/
-
-#include "multiprogressdialog.h"
-#include "multiprogressdialog.moc"
-
-MultiProgressDialog::MultiProgressDialog(QWidget* parent, const char*name, bool modal, WFlags f)
-: MultiProgressDialogBase(parent, name, modal, f)
-{
- //progressBars=new QDict<QProgressBar>();
- //progressLabels=new QDict<QLabel>();
- //progressBars.setAutoDelete(true);
- //progressLabels.setAutoDelete(true);
-}
-
-MultiProgressDialog::MultiProgressDialog(const QString& titleText, const QString & cancelButtonText, QWidget* parent, const char*name, bool modal, WFlags f)
-: MultiProgressDialogBase(parent, name, modal, f)
-{
- setCaption(titleText);
- buttonCancel->setText(cancelButtonText);
-}
-
-MultiProgressDialog::~MultiProgressDialog()
-{
- //delete progressBars;
- //delete progressLabels;
-}
-
-void MultiProgressDialog::removeExtraProgressBars()
-{
- progressBars.clear();
- progressLabels.clear();
-}
-
-bool MultiProgressDialog::addExtraProgressBars(const QStringList &barsList, const QStringList &barsTexts)
-{
- uint barCount=barsList.count();
- if (barCount==0)
- return false;
- int gridLayoutRow=gridLayout->numRows();
- for (uint i=0; i<barCount; ++i)
- {
- QString barName(barsList[i]);
- if(progressBarTitles.contains(barName))
- continue;
- progressBarTitles.append(barName);
- progressBars.insert(barName, new QProgressBar(this, barName));
- progressLabels.insert(barName, new QLabel(barsTexts[i], this, barName));
- gridLayout->addWidget(progressLabels[barName], gridLayoutRow, 0);
- gridLayout->addWidget(progressBars[barName], gridLayoutRow, 1);
- ++gridLayoutRow;
- }
- return true;
-}
-
-bool MultiProgressDialog::setLabel(const QString &barName, const QString & newLabel)
-{
- if (progressLabels.contains(barName))
- {
- progressLabels[barName]->setText(newLabel);
- return true;
- }
- return false;
-}
-
-bool MultiProgressDialog::setTotalSteps(const QString &barName, int totalSteps)
-{
- if (progressBars.contains(barName))
- {
- progressBars[barName]->setTotalSteps(totalSteps);
- return true;
- }
- return false;
-}
-
-bool MultiProgressDialog::setProgress(const QString &barName, int progress)
-{
- if (progressBars.contains(barName))
- {
- progressBars[barName]->setProgress(progress);
- return true;
- }
- return false;
-}
-
-bool MultiProgressDialog::setProgress(const QString &barName, int progress, int totalSteps)
-{
- if (progressBars.contains(barName))
- {
- progressBars[barName]->setProgress(progress, totalSteps);
- return true;
- }
- return false;
-}
-
-bool MultiProgressDialog::setupBar(const QString &barName, const QString & barText, int progress, int totalSteps)
-{
- if (progressLabels.contains(barName))
- progressLabels[barName]->setText(barText);
- else
- return false;
- if (progressBars.contains(barName))
- {
- progressBars[barName]->setProgress(progress, totalSteps);
- return true;
- }
- return false;
-}
-
-
-void MultiProgressDialog::setCancelButtonText(const QString & cancelButtonText)
-{
- buttonCancel->setText(cancelButtonText);
-}
-
-bool MultiProgressDialog::setOverallTotalSteps(int totalSteps)
-{
- overallProgressBar->setTotalSteps(totalSteps);
-}
-
-bool MultiProgressDialog::setOverallProgress(int progress)
-{
- overallProgressBar->setProgress(progress);
-}
-
-bool MultiProgressDialog::setOverallProgress(int progress, int totalSteps)
-{
- overallProgressBar->setProgress(progress, totalSteps);
-}
/branches/Version13x/Scribus/scribus/multiprogressdialog.cpp
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/multiprogressdialogbase.ui
===================================================================
--- branches/Version13x/Scribus/scribus/multiprogressdialogbase.ui (revision 4028)
+++ branches/Version13x/Scribus/scribus/multiprogressdialogbase.ui (nonexistent)
@@ -1,100 +0,0 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>MultiProgressDialogBase</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>MultiProgressDialogBase</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>230</width>
- <height>83</height>
- </rect>
- </property>
- <property name="caption">
- <string>Progress</string>
- </property>
- <property name="sizeGripEnabled">
- <bool>false</bool>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>gridLayout</cstring>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QProgressBar" row="0" column="1">
- <property name="name">
- <cstring>overallProgressBar</cstring>
- </property>
- </widget>
- <widget class="QLabel" row="0" column="0">
- <property name="name">
- <cstring>overallProgressLabel</cstring>
- </property>
- <property name="text">
- <string>Overall Progress:</string>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>cancelHBox</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <spacer>
- <property name="name">
- <cstring>cancelSpacer</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton">
- <property name="name">
- <cstring>buttonCancel</cstring>
- </property>
- <property name="text">
- <string>&amp;Cancel</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- </widget>
- </hbox>
- </widget>
- </vbox>
-</widget>
-<connections>
- <connection>
- <sender>buttonCancel</sender>
- <signal>clicked()</signal>
- <receiver>MultiProgressDialogBase</receiver>
- <slot>reject()</slot>
- </connection>
-</connections>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
/branches/Version13x/Scribus/scribus/multiprogressdialogbase.ui
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/pdflib.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/pdflib.cpp (revision 4028)
+++ branches/Version13x/Scribus/scribus/pdflib.cpp (revision 4027)
@@ -36,14 +36,12 @@
#endif
#include "rc4.h"
-#include "commonstrings.h"
#include "page.h"
#include "pageitem.h"
#include "bookmwin.h"
#include "scribus.h"
-#include "scribusapp.h"
#include "scribusdoc.h"
-#include "multiprogressdialog.h"
+
#include "bookpalette.h"
#include "scfontmetrics.h"
#include "util.h"
@@ -61,10 +59,10 @@
#include <tiffio.h>
#endif
+
PDFlib::PDFlib(ScribusDoc *docu)
{
doc = docu;
- abortExport=false;
OwnerKey = QByteArray(32);
UserKey = QByteArray(32);
FileID = QByteArray(16);
@@ -114,30 +112,13 @@
0x64, 0x53, 0x69, 0x7a};
for (int a = 0; a < 32; ++a)
KeyGen[a] = kg_array[a];
- usingGUI=ScQApp->usingGUI();
- if (usingGUI)
- {
- progressDialog=new MultiProgressDialog(tr("Saving PDF"), CommonStrings::tr_Cancel, ScMW, "pdfexportprogress");
- if (progressDialog==0)
- usingGUI=false;
- else
- {
- QStringList barNames, barTexts;
- barNames << "EMP" << "EP";
- barTexts << QT_TR_NOOP("Exporting Master Pages:") << QT_TR_NOOP("Exporting Pages:");
- progressDialog->addExtraProgressBars(barNames, barTexts);
- connect(progressDialog->buttonCancel, SIGNAL(clicked()), this, SLOT(cancelRequested()));
- }
- }
}
-bool PDFlib::doExport(const QString& fn, const QString& nam, int Components, std::vector<int> &pageNs, QMap<int,QPixmap> thumbs, QProgressBar */*dia2*/)
+bool PDFlib::doExport(const QString& fn, const QString& nam, int Components, std::vector<int> &pageNs, QMap<int,QPixmap> thumbs, QProgressBar *dia2)
{
QPixmap pm;
bool ret = false;
- int pc_exportpages=0;
- int pc_exportmasterpages=0;
- if (usingGUI) progressDialog->show();
+ int progresscount=0;
if (PDF_Begin_Doc(fn, &doc->PDF_Options, PrefsManager::instance()->appPrefs.AvailFonts, doc->UsedFonts, ScMW->bookmarkPalette->BView))
{
QMap<int, int> pageNsMpa;
@@ -145,69 +126,37 @@
{
pageNsMpa.insert(doc->MasterNames[doc->Pages->at(pageNs[a]-1)->MPageNam], 0);
}
- //dia2->reset();
- //dia2->setTotalSteps(pageNsMpa.count()+pageNs.size());
- //dia2->setProgress(0);
- if (usingGUI)
+ dia2->reset();
+ dia2->setTotalSteps(pageNsMpa.count()+pageNs.size());
+ dia2->setProgress(0);
+ for (uint ap = 0; ap < doc->MasterPages.count(); ++ap)
{
- progressDialog->setOverallTotalSteps(pageNsMpa.count()+pageNs.size());
- progressDialog->setTotalSteps("EMP", pageNsMpa.count());
- progressDialog->setTotalSteps("EP", pageNs.size());
- progressDialog->setOverallProgress(0);
- progressDialog->setProgress("EMP", 0);
- progressDialog->setProgress("EP", 0);
- }
- for (uint ap = 0; ap < doc->MasterPages.count() && !abortExport; ++ap)
- {
if (doc->MasterItems.count() != 0)
{
if (pageNsMpa.contains(ap))
{
- ScQApp->processEvents();
PDF_TemplatePage(doc->MasterPages.at(ap));
- ++pc_exportmasterpages;
+ progresscount++;
}
}
- //dia2->setProgress(pc_exportmasterpages+pc_exportpages);
-
- if (usingGUI)
- {
- progressDialog->setProgress("EMP", pc_exportmasterpages);
- progressDialog->setOverallProgress(pc_exportmasterpages+pc_exportpages);
- }
+ dia2->setProgress(progresscount);
}
- for (uint a = 0; a < pageNs.size() && !abortExport; ++a)
+ for (uint a = 0; a < pageNs.size(); ++a)
{
if (doc->PDF_Options.Thumbnails)
pm = thumbs[pageNs[a]];
- ScQApp->processEvents();
- if (abortExport) break;
PDF_Begin_Page(doc->Pages->at(pageNs[a]-1), pm);
- ScQApp->processEvents();
- if (abortExport) break;
PDF_ProcessPage(doc->Pages->at(pageNs[a]-1), pageNs[a]-1);
- ScQApp->processEvents();
- if (abortExport) break;
PDF_End_Page();
- pc_exportpages++;
- //dia2->setProgress(pc_exportmasterpages+pc_exportpages);
- if (usingGUI)
- {
- progressDialog->setProgress("EP", pc_exportpages);
- progressDialog->setOverallProgress(pc_exportmasterpages+pc_exportpages);
- }
+ progresscount++;
+ dia2->setProgress(progresscount);
}
- ret = true;//Even when aborting we return true. Dont want that "couldnt write msg"
- if (!abortExport)
- {
- if (doc->PDF_Options.Version == PDFOptions::PDFVersion_X3)
- PDF_End_Doc(ScMW->PrinterProfiles[doc->PDF_Options.PrintProf], nam, Components);
- else
- PDF_End_Doc();
- }
+ if (doc->PDF_Options.Version == PDFOptions::PDFVersion_X3)
+ PDF_End_Doc(ScMW->PrinterProfiles[doc->PDF_Options.PrintProf], nam, Components);
else
- closeAndCleanup();
- //dia2->reset();
+ PDF_End_Doc();
+ ret = true;
+ dia2->reset();
}
return ret;
}
@@ -5111,17 +5060,7 @@
PutDoc("/Encrypt "+IToStr(Encrypt)+" 0 R\n");
PutDoc(">>\nstartxref\n");
PutDoc(IToStr(StX)+"\n%%EOF\n");
- closeAndCleanup();
-}
-
-void PDFlib::closeAndCleanup()
-{
Spool.close();
- if (abortExport)
- {
- if (Spool.exists())
- Spool.remove();
- }
Seite.XObjects.clear();
Seite.ImgObjects.clear();
Seite.FObjects.clear();
@@ -5131,10 +5070,5 @@
Shadings.clear();
Transpar.clear();
ICCProfiles.clear();
-
}
-void PDFlib::cancelRequested()
-{
- abortExport=true;
-}
/branches/Version13x/Scribus/scribus/pdflib.h
33,7 → 33,6
class Page;
class PDFOptions;
class PrefsContext;
class MultiProgressDialog;
 
#include "scribusstructs.h"
 
55,7 → 54,6
void PDF_TemplatePage(Page* pag, bool clip = false);
void PDF_ProcessPage(Page* pag, uint PNr, bool clip = false);
void PDF_End_Doc(const QString& PrintPr = "", const QString& Name = "", int Components = 0);
void closeAndCleanup();
struct GlNamInd
{
uint Code;
209,12 → 207,6
int spotCount;
QTextStream t;
QMap<QString, QString> StdFonts;
MultiProgressDialog* progressDialog;
bool usingGUI;
bool abortExport;
protected slots:
void cancelRequested();
};
 
#endif
/branches/Version13x/Scribus/scribus/docsections.cpp
1,23 → 1,3
/***************************************************************************
* Copyright (C) 2005 by Craig Bradney *
* cbradney@zip.com.au *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
 
#include "docsections.h"
#include "docsections.moc"
 
/branches/Version13x/Scribus/scribus/Makefile.am
120,8 → 120,6
mpalette.cpp \
mspinbox.cpp \
multiline.cpp \
multiprogressdialogbase.ui \
multiprogressdialog.cpp \
muster.cpp \
navigator.cpp \
newfile.cpp \
337,7 → 335,6
$(INSTALL_DATA) $(srcdir)/mpalette.h $(prefix)/include/scribus/mpalette.h
$(INSTALL_DATA) $(srcdir)/mspinbox.h $(prefix)/include/scribus/mspinbox.h
$(INSTALL_DATA) $(srcdir)/multiline.h $(prefix)/include/scribus/multiline.h
$(INSTALL_DATA) $(srcdir)/multiprogressdialog.h $(prefix)/include/scribus/multiprogressdialog.h
$(INSTALL_DATA) $(srcdir)/muster.h $(prefix)/include/scribus/muster.h
$(INSTALL_DATA) $(srcdir)/navigator.h $(prefix)/include/scribus/navigator.h
$(INSTALL_DATA) $(srcdir)/newfile.h $(prefix)/include/scribus/newfile.h
/branches/Version13x/Scribus/scribus/docsections.h
1,23 → 1,3
/***************************************************************************
* Copyright (C) 2005 by Craig Bradney *
* cbradney@zip.com.au *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
 
#ifndef DOCSECTIONS_H
#define DOCSECTIONS_H