Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 4027 → Rev 4028

/branches/Version13x/Scribus/scribus/multiprogressdialogbase.ui
0,0 → 1,100
<!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>
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: Scribus/scribus/multiprogressdialog.h
===================================================================
--- Scribus/scribus/multiprogressdialog.h (nonexistent)
+++ Scribus/scribus/multiprogressdialog.h (revision 4028)
@@ -0,0 +1,62 @@
+/***************************************************************************
+* 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 MULTIPROGRESSDIALOG_H
+#define MULTIPROGRESSDIALOG_H
+
+#include "multiprogressdialogbase.h"
+
+#include <qprogressbar.h>
+#include <qpushbutton.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qstringlist.h>
+#include <qstring.h>
+#include <qdialog.h>
+#include <qmap.h>
+
+class MultiProgressDialog : public MultiProgressDialogBase
+{
+ Q_OBJECT
+
+ public:
+ MultiProgressDialog(QWidget* parent=0, const char*name=0, bool modal=false, WFlags f=0);
+ MultiProgressDialog(const QString& titleText, const QString & cancelButtonText, QWidget* parent=0, const char*name=0, bool modal=true, WFlags f=0);
+ ~MultiProgressDialog();
+
+ void removeExtraProgressBars();
+ bool addExtraProgressBars(const QStringList &barsList, const QStringList &barsTexts);
+ bool setLabel(const QString &barName, const QString & newLabel);
+ bool setTotalSteps(const QString &barName, int totalSteps);
+ bool setProgress(const QString &barName, int progress);
+ bool setProgress(const QString &barName, int progress, int totalSteps);
+ bool setOverallTotalSteps(int totalSteps);
+ bool setOverallProgress(int progress);
+ bool setOverallProgress(int progress, int totalSteps);
+ bool setupBar(const QString &barName, const QString &barText, int progress, int totalSteps);
+ void setCancelButtonText(const QString & cancelButtonText);
+
+ protected:
+ QStringList progressBarTitles;
+ QMap<QString, QProgressBar*> progressBars;
+ QMap<QString, QLabel*> progressLabels;
+};
+
+#endif
/Scribus/scribus/multiprogressdialog.h
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: Scribus/scribus/docsections.h
===================================================================
--- Scribus/scribus/docsections.h (revision 4027)
+++ Scribus/scribus/docsections.h (revision 4028)
@@ -1,3 +1,23 @@
+/***************************************************************************
+* 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
/branches/Version13x/Scribus/scribus/Makefile.am
120,6 → 120,8
mpalette.cpp \
mspinbox.cpp \
multiline.cpp \
multiprogressdialogbase.ui \
multiprogressdialog.cpp \
muster.cpp \
navigator.cpp \
newfile.cpp \
335,6 → 337,7
$(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/pdflib.cpp
36,12 → 36,14
#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"
59,10 → 61,10
#include <tiffio.h>
#endif
 
 
PDFlib::PDFlib(ScribusDoc *docu)
{
doc = docu;
abortExport=false;
OwnerKey = QByteArray(32);
UserKey = QByteArray(32);
FileID = QByteArray(16);
112,13 → 114,30
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 progresscount=0;
int pc_exportpages=0;
int pc_exportmasterpages=0;
if (usingGUI) progressDialog->show();
if (PDF_Begin_Doc(fn, &doc->PDF_Options, PrefsManager::instance()->appPrefs.AvailFonts, doc->UsedFonts, ScMW->bookmarkPalette->BView))
{
QMap<int, int> pageNsMpa;
126,37 → 145,69
{
pageNsMpa.insert(doc->MasterNames[doc->Pages->at(pageNs[a]-1)->MPageNam], 0);
}
dia2->reset();
dia2->setTotalSteps(pageNsMpa.count()+pageNs.size());
dia2->setProgress(0);
for (uint ap = 0; ap < doc->MasterPages.count(); ++ap)
//dia2->reset();
//dia2->setTotalSteps(pageNsMpa.count()+pageNs.size());
//dia2->setProgress(0);
if (usingGUI)
{
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));
progresscount++;
++pc_exportmasterpages;
}
}
dia2->setProgress(progresscount);
//dia2->setProgress(pc_exportmasterpages+pc_exportpages);
if (usingGUI)
{
progressDialog->setProgress("EMP", pc_exportmasterpages);
progressDialog->setOverallProgress(pc_exportmasterpages+pc_exportpages);
}
}
for (uint a = 0; a < pageNs.size(); ++a)
for (uint a = 0; a < pageNs.size() && !abortExport; ++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();
progresscount++;
dia2->setProgress(progresscount);
pc_exportpages++;
//dia2->setProgress(pc_exportmasterpages+pc_exportpages);
if (usingGUI)
{
progressDialog->setProgress("EP", pc_exportpages);
progressDialog->setOverallProgress(pc_exportmasterpages+pc_exportpages);
}
}
if (doc->PDF_Options.Version == PDFOptions::PDFVersion_X3)
PDF_End_Doc(ScMW->PrinterProfiles[doc->PDF_Options.PrintProf], nam, Components);
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();
}
else
PDF_End_Doc();
ret = true;
dia2->reset();
closeAndCleanup();
//dia2->reset();
}
return ret;
}
5060,7 → 5111,17
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();
5070,5 → 5131,10
Shadings.clear();
Transpar.clear();
ICCProfiles.clear();
 
}
 
void PDFlib::cancelRequested()
{
abortExport=true;
}
/branches/Version13x/Scribus/scribus/docsections.cpp
1,3 → 1,23
/***************************************************************************
* 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/multiprogressdialog.cpp
0,0 → 1,146
/***************************************************************************
* 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);
}
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: Scribus/scribus/pdflib.h
===================================================================
--- Scribus/scribus/pdflib.h (revision 4027)
+++ Scribus/scribus/pdflib.h (revision 4028)
@@ -33,6 +33,7 @@
class Page;
class PDFOptions;
class PrefsContext;
+class MultiProgressDialog;
#include "scribusstructs.h"
@@ -54,6 +55,7 @@
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;
@@ -207,6 +209,12 @@
int spotCount;
QTextStream t;
QMap<QString, QString> StdFonts;
+ MultiProgressDialog* progressDialog;
+ bool usingGUI;
+ bool abortExport;
+
+protected slots:
+ void cancelRequested();
};
#endif