1 /*
2 PosteRazor - Make your own poster!
3 Copyright (C) 2005-2018 by Alessandro Portale
4 http://posterazor.sourceforge.net/
5
6 This file is part of PosteRazor
7
8 PosteRazor is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 PosteRazor is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with PosteRazor; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #include "wizard.h"
24
25 #include <QDialogButtonBox>
26 #include <QFileInfo>
27 #include <QMessageBox>
28 #include <QSignalMapper>
29 #include <QVBoxLayout>
30 #include <QtDebug>
31
Wizard(QWidget * parent)32 Wizard::Wizard(QWidget *parent)
33 : QWidget(parent)
34 {
35 setupUi(this);
36
37 m_imageInfoGroup->setVisible(false);
38 m_imageLoadButton->setIcon(QApplication::style()->standardPixmap(QStyle::SP_DirOpenIcon));
39 m_stepHelpButton->setMinimumSize(m_imageLoadButton->sizeHint());
40 m_savePosterButton->setIcon(QApplication::style()->standardPixmap(QStyle::SP_DialogSaveButton));
41
42 m_overlappingButtons = {
43 {Qt::AlignTop | Qt::AlignLeft, m_overlappingPositionTopLeftButton },
44 {Qt::AlignTop | Qt::AlignRight, m_overlappingPositionTopRightButton },
45 {Qt::AlignBottom | Qt::AlignLeft, m_overlappingPositionBottomLeftButton },
46 {Qt::AlignBottom | Qt::AlignRight, m_overlappingPositionBottomRightButton }
47 };
48
49 m_alignmentButtons = {
50 {Qt::AlignTop | Qt::AlignLeft, m_posterAlignmentTopLeftButton },
51 {Qt::AlignTop | Qt::AlignHCenter, m_posterAlignmentTopButton },
52 {Qt::AlignTop | Qt::AlignRight, m_posterAlignmentTopRightButton },
53 {Qt::AlignVCenter | Qt::AlignLeft, m_posterAlignmentLeftButton },
54 {Qt::AlignCenter, m_posterAlignmentCenterButton },
55 {Qt::AlignVCenter | Qt::AlignRight, m_posterAlignmentRightButton },
56 {Qt::AlignBottom | Qt::AlignLeft, m_posterAlignmentBottomLeftButton },
57 {Qt::AlignBottom | Qt::AlignHCenter, m_posterAlignmentBottomButton },
58 {Qt::AlignBottom | Qt::AlignRight, m_posterAlignmentBottomRightButton }
59 };
60
61 m_steps->setCurrentIndex(0);
62 createConnections();
63 populateUI();
64 updatePosterSizeGroupsState();
65 retranslateUi();
66
67 #ifdef Q_OS_WASM
68 m_launchPDFApplicationCheckBox->hide();
69 #endif // Q_OS_WASM
70 }
71
changeEvent(QEvent * event)72 void Wizard::changeEvent(QEvent *event)
73 {
74 if (event->type() == QEvent::LanguageChange)
75 retranslateUi();
76 QWidget::changeEvent(event);
77 }
78
retranslateUi()79 void Wizard::retranslateUi()
80 {
81 m_imageInfoGroup->setTitle( QCoreApplication::translate("Main window", "Image Informations"));
82 m_imageInformationColorTypeLabel->setText( QCoreApplication::translate("Main window", "Color type:"));
83 m_imageInformationResolutionLabel->setText( QCoreApplication::translate("Main window", "Resolution:"));
84 m_imageInformationSizeInPixelsLabel->setText( QCoreApplication::translate("Main window", "Size (in pixels):"));
85 m_inputImageGroup->setTitle( QCoreApplication::translate("Main window", "Input Image"));
86 m_launchPDFApplicationCheckBox->setText( QCoreApplication::translate("Main window", "Open PDF after saving"));
87 m_stepNextButton->setText( QCoreApplication::translate("Main window", "Next"));
88 m_overlappingHeightLabel->setText( QCoreApplication::translate("Main window", "Height:"));
89 m_overlappingPositionBottomLeftButton->setText( QCoreApplication::translate("Main window", "Bottom left"));
90 m_overlappingPositionBottomRightButton->setText(QCoreApplication::translate("Main window", "Bottom right"));
91 m_overlappingPositionGroup->setTitle( QCoreApplication::translate("Main window", "Overlapping position"));
92 m_overlappingPositionTopLeftButton->setText( QCoreApplication::translate("Main window", "Top left"));
93 m_overlappingPositionTopRightButton->setText( QCoreApplication::translate("Main window", "Top right"));
94 m_overlappingSizeGroup->setTitle( QCoreApplication::translate("Main window", "Overlapping size"));
95 m_overlappingWidthLabel->setText( QCoreApplication::translate("Main window", "Width:"));
96 m_paperBordersBottomLabel->setText( QCoreApplication::translate("Main window", "Bottom"));
97 m_paperBordersLeftLabel->setText( QCoreApplication::translate("Main window", "Left"));
98 m_paperBordersRightLabel->setText( QCoreApplication::translate("Main window", "Right"));
99 m_paperBordersTopLabel->setText( QCoreApplication::translate("Main window", "Top"));
100 m_paperCustomHeightLabel->setText( QCoreApplication::translate("Main window", "Height:"));
101 m_paperCustomWidthLabel->setText( QCoreApplication::translate("Main window", "Width:"));
102 m_paperFormatLabel->setText( QCoreApplication::translate("Main window", "Format:"));
103 m_paperFormatTypeTabs->setTabText(m_paperFormatTypeTabs->indexOf(m_paperFormatCustomTab),
104 QCoreApplication::translate("Main window", "Custom"));
105 m_paperFormatTypeTabs->setTabText(m_paperFormatTypeTabs->indexOf(m_paperFormatStandardTab),
106 QCoreApplication::translate("Main window", "Standard"));
107 m_paperOrientationLabel->setText( QCoreApplication::translate("Main window", "Orientation:"));
108 m_paperOrientationLandscapeRadioButton->setText(QCoreApplication::translate("Main window", "Landscape"));
109 m_paperOrientationPortraitRadioButton->setText( QCoreApplication::translate("Main window", "Portrait"));
110 m_paperSizeGroup->setTitle( QCoreApplication::translate("Main window", "Paper size"));
111 m_posterAbsoluteHeightLabel->setText( QCoreApplication::translate("Main window", "Height:"));
112 m_posterAbsoluteWidthLabel->setText( QCoreApplication::translate("Main window", "Width:"));
113 m_posterAlignmentGroup->setTitle( QCoreApplication::translate("Main window", "Image alignment"));
114 m_posterPagesHeightDimensionUnitLabel->setText( QCoreApplication::translate("Main window", "pages"));
115 m_posterPagesHeightLabel->setText( QCoreApplication::translate("Main window", "Height:"));
116 m_posterPagesWidthDimensionUnitLabel->setText( QCoreApplication::translate("Main window", "pages"));
117 m_posterPagesWidthLabel->setText( QCoreApplication::translate("Main window", "Width:"));
118 m_posterPercentualSizeLabel->setText( QCoreApplication::translate("Main window", "Size:"));
119 m_posterSizeAbsoluteRadioButton->setText( QCoreApplication::translate("Main window", "Absolute size:"));
120 m_posterSizeGroup->setTitle( QCoreApplication::translate("Main window", "Image size"));
121 m_posterSizeInPagesRadioButton->setText( QCoreApplication::translate("Main window", "Size in pages:"));
122 m_posterSizePercentualRadioButton->setText( QCoreApplication::translate("Main window", "Size in percent:"));
123 m_stepPrevButton->setText( QCoreApplication::translate("Main window", "Back"));
124 m_savePosterGroup->setTitle( QCoreApplication::translate("Main window", "Save the poster"));
125 retranslateUiWithDimensionUnit();
126 }
127
retranslateUiWithDimensionUnit()128 void Wizard::retranslateUiWithDimensionUnit()
129 {
130 const QString unitOfLength = QString::fromLatin1(" (%1)").arg(m_currentUnitOfLength);
131 m_imageInformationSizeLabel->setText( QCoreApplication::translate("Main window", "Size (in %1):").arg(m_currentUnitOfLength));
132 m_paperBordersGroup->setTitle( QCoreApplication::translate("Main window", "Borders") + unitOfLength);
133 }
134
setPaperFormat(const QString & format)135 void Wizard::setPaperFormat(const QString &format)
136 {
137 const int index = m_paperFormatComboBox->findData(format, Qt::DisplayRole);
138 m_paperFormatComboBox->setCurrentIndex(index);
139 }
140
setPaperOrientation(QPrinter::Orientation orientation)141 void Wizard::setPaperOrientation(QPrinter::Orientation orientation)
142 {
143 (
144 orientation == QPrinter::Landscape ? m_paperOrientationLandscapeRadioButton
145 : m_paperOrientationPortraitRadioButton
146 )->setChecked(true);
147 }
148
setPaperBorderTop(qreal border)149 void Wizard::setPaperBorderTop(qreal border)
150 {
151 m_paperBorderTopInput->setValue(border);
152 }
153
setPaperBorderRight(qreal border)154 void Wizard::setPaperBorderRight(qreal border)
155 {
156 m_paperBorderRightInput->setValue(border);
157 }
158
setPaperBorderBottom(qreal border)159 void Wizard::setPaperBorderBottom(qreal border)
160 {
161 m_paperBorderBottomInput->setValue(border);
162 }
163
setPaperBorderLeft(qreal border)164 void Wizard::setPaperBorderLeft(qreal border)
165 {
166 m_paperBorderLeftInput->setValue(border);
167 }
168
setCustomPaperSize(const QSizeF & size)169 void Wizard::setCustomPaperSize(const QSizeF &size)
170 {
171 m_paperCustomWidthSpinner->setValue(size.width());
172 m_paperCustomHeightSpinner->setValue(size.height());
173 }
174
setUseCustomPaperSize(bool useIt)175 void Wizard::setUseCustomPaperSize(bool useIt)
176 {
177 m_paperFormatTypeTabs->setCurrentWidget(useIt ? m_paperFormatCustomTab : m_paperFormatStandardTab);
178 }
179
setOverlappingWidth(qreal width)180 void Wizard::setOverlappingWidth(qreal width)
181 {
182 m_overlappingWidthInput->setValue(width);
183 }
184
setOverlappingHeight(qreal height)185 void Wizard::setOverlappingHeight(qreal height)
186 {
187 m_overlappingHeightInput->setValue(height);
188 }
189
setOverlappingPosition(Qt::Alignment position)190 void Wizard::setOverlappingPosition(Qt::Alignment position)
191 {
192 if (m_overlappingButtons.contains(position))
193 m_overlappingButtons.value(position)->setChecked(true);
194 }
195
setPosterWidthAbsolute(qreal width)196 void Wizard::setPosterWidthAbsolute(qreal width)
197 {
198 m_posterAbsoluteWidthInput->setValue(width);
199 }
200
setPosterHeightAbsolute(qreal height)201 void Wizard::setPosterHeightAbsolute(qreal height)
202 {
203 m_posterAbsoluteHeightInput->setValue(height);
204 }
205
setPosterWidthPages(qreal width)206 void Wizard::setPosterWidthPages(qreal width)
207 {
208 m_posterPagesWidthInput->setValue(width);
209 }
210
setPosterHeightPages(qreal height)211 void Wizard::setPosterHeightPages(qreal height)
212 {
213 m_posterPagesHeightInput->setValue(height);
214 }
215
setPosterSizePercentual(qreal percent)216 void Wizard::setPosterSizePercentual(qreal percent)
217 {
218 m_posterPercentualSizeInput->setValue(percent);
219 }
220
setPosterSizeMode(Types::PosterSizeModes mode)221 void Wizard::setPosterSizeMode(Types::PosterSizeModes mode)
222 {
223 (
224 mode == Types::PosterSizeModeAbsolute ? m_posterSizeAbsoluteRadioButton
225 : mode == Types::PosterSizeModePages ? m_posterSizeInPagesRadioButton
226 : m_posterSizePercentualRadioButton
227 )->setChecked(true);
228 updatePosterSizeGroupsState();
229 }
230
setPosterSizeModeAvailable(Types::PosterSizeModes mode,bool available)231 void Wizard::setPosterSizeModeAvailable(Types::PosterSizeModes mode, bool available)
232 {
233 QList<QWidget *> widgets;
234 switch (mode) {
235 case Types::PosterSizeModeAbsolute:
236 widgets << m_posterSizeAbsoluteRadioButton
237 << m_posterAbsoluteWidthInput << m_posterAbsoluteHeightInput
238 << m_posterAbsoluteWidthLabel << m_posterAbsoluteHeightLabel
239 << m_posterAbsoluteWidthDimensionUnitLabel << m_posterAbsoluteHeightDimensionUnitLabel;
240 break;
241 case Types::PosterSizeModePages:
242 widgets << m_posterSizeInPagesRadioButton
243 << m_posterPagesWidthInput << m_posterPagesHeightInput
244 << m_posterPagesWidthLabel << m_posterPagesHeightLabel
245 << m_posterPagesWidthDimensionUnitLabel << m_posterPagesHeightDimensionUnitLabel;
246 break;
247 case Types::PosterSizeModePercentual:
248 default:
249 widgets << m_posterSizePercentualRadioButton << m_posterPercentualSizeInput
250 << m_posterPercentualSizeLabel << m_posterPercentualSizeUnitLabel;
251 break;
252 }
253 foreach (QWidget *widget, widgets)
254 widget->setVisible(available);
255 }
256
setPosterAlignment(Qt::Alignment alignment)257 void Wizard::setPosterAlignment(Qt::Alignment alignment)
258 {
259 if (m_alignmentButtons.contains(alignment))
260 m_alignmentButtons.value(alignment)->setChecked(true);
261 }
262
setLaunchPDFApplication(bool launch)263 void Wizard::setLaunchPDFApplication(bool launch)
264 {
265 m_launchPDFApplicationCheckBox->setCheckState(launch ? Qt::Checked : Qt::Unchecked);
266 }
267
updatePreview()268 void Wizard::updatePreview()
269 {
270 m_paintCanvas->repaint();
271 }
272
showImageFileName(const QString & fileName)273 void Wizard::showImageFileName(const QString &fileName)
274 {
275 m_inputFileNameLabel->setText(QFileInfo(fileName).fileName());
276 }
277
updateImageInfoFields(const QSize & inputImageSizeInPixels,const QSizeF & imageSize,qreal verticalDpi,qreal horizontalDpi,Types::ColorTypes colorType,int bitsPerPixel)278 void Wizard::updateImageInfoFields(const QSize &inputImageSizeInPixels, const QSizeF &imageSize, qreal verticalDpi, qreal horizontalDpi, Types::ColorTypes colorType, int bitsPerPixel)
279 {
280 Q_UNUSED(horizontalDpi)
281
282 m_imageInformationSizeInPixelsValue->setText(QString::fromLatin1("%1 x %2").arg(inputImageSizeInPixels.width()).arg(inputImageSizeInPixels.height()));
283 m_imageInformationSizeValue->setText(QString::fromLatin1("%1 x %2").arg(imageSize.width(), 0, 'f', 2).arg(imageSize.height(), 0, 'f', 2));
284 m_imageInformationResolutionValue->setText(QString::fromLatin1("%1 dpi").arg(verticalDpi, 0, 'f', 1));
285 const QString colorTypeString = (
286 colorType == Types::ColorTypeMonochrome ? QCoreApplication::translate("Main window", "Monochrome")
287 : colorType == Types::ColorTypeGreyscale ? QCoreApplication::translate("Main window", "Gray scale")
288 : colorType == Types::ColorTypePalette ? QCoreApplication::translate("Main window", "Palette")
289 : colorType == Types::ColorTypeRGB ? QCoreApplication::translate("Main window", "RGB")
290 : colorType == Types::ColorTypeRGBA ? QCoreApplication::translate("Main window", "RGBA")
291 : /*colorType == ColorTypeCMYK?*/ QCoreApplication::translate("Main window", "CMYK")
292 ) + QString::fromLatin1(" %1bpp").arg(bitsPerPixel);
293 m_imageInformationColorTypeValue->setText(colorTypeString);
294 m_imageInfoGroup->setVisible(true);
295 emit imageLoaded();
296 }
297
setCurrentUnitOfLength(const QString & unit)298 void Wizard::setCurrentUnitOfLength(const QString &unit)
299 {
300 m_currentUnitOfLength = unit;
301 retranslateUiWithDimensionUnit();
302 m_posterAbsoluteWidthDimensionUnitLabel->setText(m_currentUnitOfLength);
303 m_posterAbsoluteHeightDimensionUnitLabel->setText(m_currentUnitOfLength);
304 m_overlappingWidthDimensionUnitLabel->setText(m_currentUnitOfLength);
305 m_overlappingHeightDimensionUnitLabel->setText(m_currentUnitOfLength);
306 m_paperCustomWidthDimensionUnitLabel->setText(m_currentUnitOfLength);
307 m_paperCustomHeightDimensionUnitLabel->setText(m_currentUnitOfLength);
308 }
309
setPrevButtonEnabled(bool enabled)310 void Wizard::setPrevButtonEnabled(bool enabled)
311 {
312 m_stepPrevButton->setEnabled(enabled);
313 }
314
setNextButtonEnabled(bool enabled)315 void Wizard::setNextButtonEnabled(bool enabled)
316 {
317 m_stepNextButton->setEnabled(enabled);
318 }
319
setPosterSavingEnabled(bool enabled)320 void Wizard::setPosterSavingEnabled(bool enabled)
321 {
322 m_savePosterButton->setEnabled(enabled);
323 }
324
setWizardStep(int step)325 void Wizard::setWizardStep(int step)
326 {
327 m_steps->setCurrentIndex(step);
328 }
329
setWizardStepDescription(const QString & number,const QString & description)330 void Wizard::setWizardStepDescription(const QString &number, const QString &description)
331 {
332 m_stepNumberLabel->setText(number);
333 m_stepDescriptionLabel->setText(description);
334 }
335
setPreviewState(const QString & state)336 void Wizard::setPreviewState(const QString &state)
337 {
338 QString actualState = state;
339 if (actualState == QLatin1String("poster")) {
340 actualState.append(QLatin1String(" overlapped"));
341 }
342 m_paintCanvas->setState(actualState);
343 }
344
showWizardStepHelp(const QString & title,const QString & text)345 void Wizard::showWizardStepHelp(const QString &title, const QString &text)
346 {
347 QMessageBox box(this);
348 box.setWindowTitle(title);
349 QString helpText = text;
350 #if defined(Q_WS_MAC)
351 // Hack. Since QMessageBoxPrivate sets the whole font to bold on Q_WS_MAC (no matter which style),
352 // we put emphasis on the key words by setting them to italic and into single quotes.
353 helpText.replace("<b>", "<i>'");
354 helpText.replace("</b>", "'</i>");
355 #endif
356 box.setText(helpText);
357 box.setTextFormat(Qt::RichText);
358 box.addButton(QMessageBox::Ok);
359 box.exec();
360 }
361
setPreviewImage(const QImage & image)362 void Wizard::setPreviewImage(const QImage &image)
363 {
364 m_paintCanvas->setImage(image);
365 }
366
handlePaperFormatTabChanged(int index)367 void Wizard::handlePaperFormatTabChanged(int index)
368 {
369 emit useCustomPaperSizeChanged(index == 1);
370 }
371
handlePaperOrientationPortraitSelected()372 void Wizard::handlePaperOrientationPortraitSelected()
373 {
374 emit paperOrientationChanged(QPrinter::Portrait);
375 }
376
handlePaperOrientationLandscapeSelected()377 void Wizard::handlePaperOrientationLandscapeSelected()
378 {
379 emit paperOrientationChanged(QPrinter::Landscape);
380 }
381
createConnections()382 void Wizard::createConnections()
383 {
384 connect(m_stepNextButton, SIGNAL(clicked()), SIGNAL(nextButtonPressed()));
385 connect(m_stepPrevButton, SIGNAL(clicked()), SIGNAL(prevButtonPressed()));
386 connect(m_stepHelpButton, SIGNAL(clicked()), SIGNAL(wizardStepHelpSignal()));
387 connect(m_paperFormatTypeTabs, SIGNAL(currentChanged(int)), SLOT(handlePaperFormatTabChanged(int)));
388 connect(m_paperFormatComboBox, SIGNAL(activated(const QString &)), SIGNAL(paperFormatChanged(const QString &)));
389 connect(m_paperOrientationPortraitRadioButton, SIGNAL(clicked()), SLOT(handlePaperOrientationPortraitSelected()));
390 connect(m_paperOrientationLandscapeRadioButton, SIGNAL(clicked()), SLOT(handlePaperOrientationLandscapeSelected()));
391 connect(m_paperCustomWidthSpinner, SIGNAL(valueEdited(qreal)), SIGNAL(paperCustomWidthChanged(qreal)));
392 connect(m_paperCustomHeightSpinner, SIGNAL(valueEdited(qreal)), SIGNAL(paperCustomHeightChanged(qreal)));
393 connect(m_paperBorderTopInput, SIGNAL(valueEdited(qreal)), SIGNAL(paperBorderTopChanged(qreal)));
394 connect(m_paperBorderRightInput, SIGNAL(valueEdited(qreal)), SIGNAL(paperBorderRightChanged(qreal)));
395 connect(m_paperBorderBottomInput, SIGNAL(valueEdited(qreal)), SIGNAL(paperBorderBottomChanged(qreal)));
396 connect(m_paperBorderLeftInput, SIGNAL(valueEdited(qreal)), SIGNAL(paperBorderLeftChanged(qreal)));
397 connect(m_imageLoadButton, SIGNAL(clicked()), SIGNAL(loadImageSignal()));
398 connect(m_posterSizeAbsoluteRadioButton, SIGNAL(clicked()), SLOT(updatePosterSizeGroupsState()));
399 connect(m_posterSizeInPagesRadioButton, SIGNAL(clicked()), SLOT(updatePosterSizeGroupsState()));
400 connect(m_posterSizePercentualRadioButton, SIGNAL(clicked()), SLOT(updatePosterSizeGroupsState()));
401 connect(m_overlappingWidthInput, SIGNAL(valueEdited(qreal)), SIGNAL(overlappingWidthChanged(qreal)));
402 connect(m_overlappingHeightInput, SIGNAL(valueEdited(qreal)), SIGNAL(overlappingHeightChanged(qreal)));
403 auto overlappingMapper = new QSignalMapper(this);
404 for (auto it = m_overlappingButtons.cbegin(), end = m_overlappingButtons.cend(); it != end; ++it) {
405 QAbstractButton *sender = it.value();
406 connect(sender, SIGNAL(clicked()), overlappingMapper, SLOT(map()));
407 overlappingMapper->setMapping(sender, it.key());
408 }
409 connect(overlappingMapper, SIGNAL(mapped(int)), SLOT(emitOverlappingPositionChange(int)));
410 connect(m_posterAbsoluteWidthInput, SIGNAL(valueEdited(qreal)), SIGNAL(posterWidthAbsoluteChanged(qreal)));
411 connect(m_posterAbsoluteHeightInput, SIGNAL(valueEdited(qreal)), SIGNAL(posterHeightAbsoluteChanged(qreal)));
412 connect(m_posterPagesWidthInput, SIGNAL(valueEdited(qreal)), SIGNAL(posterWidthPagesChanged(qreal)));
413 connect(m_posterPagesHeightInput, SIGNAL(valueEdited(qreal)), SIGNAL(posterHeightPagesChanged(qreal)));
414 connect(m_posterPercentualSizeInput, SIGNAL(valueEdited(qreal)), SIGNAL(posterSizePercentualChanged(qreal)));
415 auto alignmentMapper = new QSignalMapper(this);
416 for (auto it = m_alignmentButtons.cbegin(), end = m_alignmentButtons.cend(); it != end; ++it) {
417 QAbstractButton *sender = it.value();
418 connect(sender, SIGNAL(clicked()), alignmentMapper, SLOT(map()));
419 alignmentMapper->setMapping(sender, it.key());
420 }
421 connect(alignmentMapper, SIGNAL(mapped(int)), SLOT(emitPosterAlignmentChange(int)));
422 connect(m_savePosterButton, SIGNAL(clicked()), SIGNAL(savePosterSignal()));
423 connect(m_launchPDFApplicationCheckBox, SIGNAL(toggled(bool)), SIGNAL(launchPDFApplicationChanged(bool)));
424 connect(m_paintCanvas, SIGNAL(needsPaint(PaintCanvasInterface*, const QVariant&)), SIGNAL(needsPaint(PaintCanvasInterface*, const QVariant&)));
425 }
426
populateUI()427 void Wizard::populateUI()
428 {
429 QStringList formats = Types::paperFormats().keys();
430 formats.sort();
431 m_paperFormatComboBox->addItems(formats);
432 }
433
emitOverlappingPositionChange(int alignmentInt) const434 void Wizard::emitOverlappingPositionChange(int alignmentInt) const
435 {
436 emit overlappingPositionChanged((Qt::Alignment)alignmentInt);
437 }
438
emitPosterAlignmentChange(int alignmentInt) const439 void Wizard::emitPosterAlignmentChange(int alignmentInt) const
440 {
441 emit posterAlignmentChanged((Qt::Alignment)alignmentInt);
442 }
443
updatePosterSizeGroupsState()444 void Wizard::updatePosterSizeGroupsState()
445 {
446 const bool absolute = m_posterSizeAbsoluteRadioButton->isChecked();
447 m_posterAbsoluteWidthLabel->setEnabled(absolute);
448 m_posterAbsoluteWidthInput->setEnabled(absolute);
449 m_posterAbsoluteWidthDimensionUnitLabel->setEnabled(absolute);
450 m_posterAbsoluteHeightLabel->setEnabled(absolute);
451 m_posterAbsoluteHeightInput->setEnabled(absolute);
452 m_posterAbsoluteHeightDimensionUnitLabel->setEnabled(absolute);
453
454 const bool inPages = m_posterSizeInPagesRadioButton->isChecked();
455 m_posterPagesWidthLabel->setEnabled(inPages);
456 m_posterPagesWidthInput->setEnabled(inPages);
457 m_posterPagesWidthDimensionUnitLabel->setEnabled(inPages);
458 m_posterPagesHeightLabel->setEnabled(inPages);
459 m_posterPagesHeightInput->setEnabled(inPages);
460 m_posterPagesHeightDimensionUnitLabel->setEnabled(inPages);
461
462 const bool percentual = m_posterSizePercentualRadioButton->isChecked();
463 m_posterPercentualSizeLabel->setEnabled(percentual);
464 m_posterPercentualSizeInput->setEnabled(percentual);
465 m_posterPercentualSizeUnitLabel->setEnabled(percentual);
466 }
467