Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 548 → Rev 549

/trunk/Scribus/scribus/plugins/pixmapexport/dialog.cpp
29,8 → 29,8
: QDialog(parent, "ExportForm", true, 0)
{
prefs = prefsFile->getPluginContext("pixmapexport");
ExportFormLayout = new QVBoxLayout( this, 10, 5, "ExportFormLayout");
layout1 = new QHBoxLayout( 0, 0, 5, "layout1");
ExportFormLayout = new QVBoxLayout( this, 10, 5, "ExportFormLayout");
layout1 = new QHBoxLayout( 0, 0, 5, "layout1");
TextLabel1 = new QLabel( this, "TextLabel1" );
layout1->addWidget( TextLabel1 );
OutputDirectory = new QLineEdit( this, "OutputDirectory" );
41,7 → 41,7
layout1->addWidget( OutputDirectoryButton );
ExportFormLayout->addLayout( layout1 );
 
layout3 = new QHBoxLayout( 0, 0, 5, "layout3");
layout3 = new QHBoxLayout( 0, 0, 5, "layout3");
groupBox1 = new QGroupBox( this, "groupBox1" );
groupBox1->setColumnLayout(0, Qt::Vertical );
groupBox1->layout()->setSpacing( 5 );
54,6 → 54,8
groupBox1Layout->addWidget( textLabel1, 1, 0 );
textLabel3 = new QLabel( groupBox1, "textLabel3" );
groupBox1Layout->addWidget( textLabel3, 2, 0 );
textLabel4 = new QLabel( groupBox1, "textLabel4" );
groupBox1Layout->addWidget( textLabel4, 3, 0 );
BitmapType = new QComboBox( FALSE, groupBox1, "BitmapType" );
BitmapType->clear();
BitmapType->insertStrList(QImageIO::outputFormats());
65,11 → 67,16
QualityBox->setMinValue( 1 );
QualityBox->setValue(quality);
groupBox1Layout->addWidget( QualityBox, 1, 1 );
SizeBox = new QSpinBox( groupBox1, "SizeBox" );
SizeBox->setMaxValue( 2400 );
SizeBox->setMinValue( 1 );
SizeBox->setValue(size);
groupBox1Layout->addWidget( SizeBox, 2, 1 );
DPIBox = new QSpinBox( groupBox1, "DPIBox" );
DPIBox->setMaxValue( 2400 );
DPIBox->setMinValue( 1 );
DPIBox->setValue(size);
groupBox1Layout->addWidget( DPIBox, 2, 1 );
EnlargementBox = new QSpinBox( groupBox1, "EnlargementBox" );
EnlargementBox->setMaxValue( 2400 );
EnlargementBox->setMinValue( 1 );
EnlargementBox->setValue(size);
groupBox1Layout->addWidget( EnlargementBox, 3, 1 );
layout3->addWidget( groupBox1 );
 
ButtonGroup1 = new QButtonGroup( this, "ButtonGroup1" );
83,7 → 90,7
ButtonGroup1Layout->addWidget( OnePageRadio );
AllPagesRadio = new QRadioButton( ButtonGroup1, "AllPagesRadio" );
ButtonGroup1Layout->addWidget( AllPagesRadio );
layout2 = new QHBoxLayout( 0, 0, 5, "layout2");
layout2 = new QHBoxLayout( 0, 0, 5, "layout2");
IntervalPagesRadio = new QRadioButton( ButtonGroup1, "IntervalPagesRadio" );
layout2->addWidget( IntervalPagesRadio );
RangeVal = new QLineEdit( ButtonGroup1, "RangeVal" );
93,7 → 100,7
layout3->addWidget( ButtonGroup1 );
ExportFormLayout->addLayout( layout3 );
 
layout4 = new QHBoxLayout( 0, 0, 5, "layout4");
layout4 = new QHBoxLayout( 0, 0, 5, "layout4");
QSpacerItem* spacer = new QSpacerItem( 111, 21, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout4->addItem( spacer );
OkButton = new QPushButton( this, "OkButton" );
109,7 → 116,8
TextLabel1->setBuddy( OutputDirectory );
TextLabel2->setBuddy( BitmapType );
textLabel1->setBuddy( QualityBox );
textLabel3->setBuddy( SizeBox );
textLabel3->setBuddy( DPIBox );
textLabel4->setBuddy( EnlargementBox );
connect(OutputDirectoryButton, SIGNAL(clicked()), this, SLOT(OutputDirectoryButton_pressed()));
connect(OkButton, SIGNAL(clicked()), this, SLOT(OkButton_pressed()));
connect(CancelButton, SIGNAL(clicked()), this, SLOT(reject()));
172,8 → 180,10
TextLabel2->setText( tr( "Image &Type:" ) );
textLabel1->setText( tr( "&Quality:" ) );
textLabel3->setText( tr( "&Resolution:" ) );
textLabel4->setText( tr( "&Size:" ) );
QualityBox->setSuffix( tr( " %" ) );
SizeBox->setSuffix( tr( " dpi" ) );
DPIBox->setSuffix( tr( " dpi" ) );
EnlargementBox->setSuffix( tr( " %" ) );
ButtonGroup1->setTitle( tr( "Range" ) );
OnePageRadio->setText( tr( "&Current page" ) );
AllPagesRadio->setText( tr( "&All pages" ) );
185,7 → 195,8
QToolTip::add( RangeVal, tr( "Insert a comma separated list of tokens where\na token can be * for all the pages, 1-5 for\na range of pages or a single page number." ) );
QToolTip::add( AllPagesRadio, tr( "Export all pages" ) );
QToolTip::add( OnePageRadio, tr( "Export only the current page" ) );
QToolTip::add( SizeBox, tr( "Resolution of the Images\nUse 72 dpi for Images intended for the Screen" ) );
QToolTip::add( DPIBox, tr( "Resolution of the Images\nUse 72 dpi for Images intended for the Screen" ) );
QToolTip::add( EnlargementBox, tr( "Size of the images. 100% for no changes, 200% for two times larger etc." ));
QToolTip::add( QualityBox, tr( "The quality of your images - 100% is the best, 1% the lowest quality" ) );
QToolTip::add( BitmapType, tr( "Available export formats" ) );
QToolTip::add( OutputDirectory, tr( "The output directory - the place to store your images.\nName of the export file will be 'documentname-pagenumber.filetype'" ) );
195,7 → 206,8
 
void ExportForm::readConfig()
{
SizeBox->setValue(prefs->getUInt("SizeBox", 72));
DPIBox->setValue(prefs->getUInt("DPIBox", 72));
EnlargementBox->setValue(prefs->getUInt("EnlargementBox", 100));
QualityBox->setValue(prefs->getUInt("QualityBox", 100));
ButtonGroup1->setButton(prefs->getUInt("ButtonGroup1", 0));
if (prefs->getInt("ButtonGroup1")==2)
208,7 → 220,8
 
void ExportForm::writeConfig()
{
prefs->set("SizeBox", SizeBox->value());
prefs->set("DPIBox", DPIBox->value());
prefs->set("EnlargementBox", EnlargementBox->value());
prefs->set("QualityBox", QualityBox->value());
prefs->set("ButtonGroup1", ButtonGroup1->id(ButtonGroup1->selected()));
prefs->set("BitmapType",BitmapType->currentItem());
/trunk/Scribus/scribus/plugins/pixmapexport/export.cpp
33,7 → 33,8
{
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
std::vector<int> pageNs;
ex->pageSize = dia->SizeBox->value();
ex->pageSize = dia->DPIBox->value();
ex->enlargement = dia->EnlargementBox->value();
ex->quality = dia->QualityBox->value();
ex->exportDir = dia->OutputDirectory->text();
ex->bitmapType = dia->bitmapType;
71,6 → 72,7
carrier = plug;
pageSize = 72;
quality = 100;
enlargement = 100;
exportDir = QDir::currentDirPath();
bitmapType = QString("PNG");
overwrite = FALSE;
89,6 → 91,7
{
}
 
#include <iostream.h>
bool ExportBitmap::exportPage(uint pageNr, bool single = TRUE)
{
uint over = 0;
97,7 → 100,7
if (!carrier->view->Pages.at(pageNr))
return FALSE;
 
QPixmap pixmap = carrier->view->PageToPixmap(pageNr, qRound(carrier->doc->PageH * (pageSize / 72.0)));
QPixmap pixmap = carrier->view->PageToPixmap(pageNr, qRound(carrier->doc->PageH * enlargement / 100));
QImage im = pixmap.convertToImage();
int dpi = qRound(100.0 / 2.54 * pageSize);
im.setDotsPerMeterY(dpi);
105,9 → 108,9
if (QFile::exists(fileName) && !overwrite)
{
QApplication::restoreOverrideCursor();
/* Changed the following Code from the original QMessageBox::question to QMessageBox::warning
to keep the Code compatible to Qt-3.1.x
f.s 12.05.2004 */
/* Changed the following Code from the original QMessageBox::question to
* QMessageBox::warning to keep the Code compatible to Qt-3.1.x
* f.s 12.05.2004 */
over = QMessageBox::warning(carrier,
QObject::tr("File exists. Overwrite?"),
fileName +"\n"+ QObject::tr("exists already. Overwrite?"),
/trunk/Scribus/scribus/plugins/pixmapexport/dialog.h
34,9 → 34,11
QLabel* TextLabel2;
QLabel* textLabel1;
QLabel* textLabel3;
QLabel* textLabel4;
QComboBox* BitmapType;
QSpinBox* QualityBox;
QSpinBox* SizeBox;
QSpinBox* DPIBox;
QSpinBox* EnlargementBox;
QButtonGroup* ButtonGroup1;
QRadioButton* OnePageRadio;
QRadioButton* AllPagesRadio;
/trunk/Scribus/scribus/plugins/pixmapexport/export.h
35,8 → 35,10
 
/*! Type of the exported image */
QString bitmapType;
/*! Height of the page - exported image */
/*! DPI of the image */
int pageSize;
/*! Enlargement of the exported image... 2x 3x etc. */
int enlargement;
/*! Quality of the image <0; 100> */
int quality;
/*! A place for stored images */