25 ? i18nc(
"Export storyboard dialog caption",
"Export Storyboard as PDF")
26 : i18nc(
"Export storyboard dialog caption",
"Export Storyboard as SVG"));
43 m_page->pageOrientationComboBox->setCurrentIndex(cfg.
readEntry<
int>(
"storyboard/pageOrientation", 0));
44 m_page->rowsSpinBox->setValue(cfg.
readEntry<
int>(
"storyboard/rows", 3));
45 m_page->columnsSpinBox->setValue(cfg.
readEntry<
int>(
"storyboard/columns", 3));
46 m_page->fontSizeSpinBox->setValue(cfg.
readEntry<
int>(
"storyboard/fontSize", 15));
47 m_page->svgTemplatePathFileRequester->setFileName(cfg.
readEntry<QString>(
"storyboard/svgLayoutFileName",
""));
48 m_page->exportPathFileRequester->setFileName(cfg.
readEntry<QString>(
"storyboard/exportFilePath"));
49 m_page->gridRowsSpinBox->setValue(cfg.
readEntry<
int>(
"storyboard/rows", 3));
50 m_page->gridColumnsSpinBox->setValue(cfg.
readEntry<
int>(
"storyboard/columns", 3));
54 mimeTypes <<
"application/pdf";
55 m_page->exportPathFileRequester->setMimeTypeFilters(mimeTypes);
63 mimeTypes <<
"image/svg+xml";
64 m_page->svgTemplatePathFileRequester->setMimeTypeFilters(mimeTypes);
79 const int layoutIndex =
m_page->boardLayoutComboBox->currentIndex();
84 return qMax(
m_page->gridRowsSpinBox->value(), 1);
87 return qMax(
m_page->rowsSpinBox->value(), 1);
93 const int layoutIndex =
m_page->boardLayoutComboBox->currentIndex();
98 return qMax(
m_page->gridColumnsSpinBox->value(), 1);
101 return qMax(
m_page->columnsSpinBox->value(), 1);
107 int index =
m_page->pageSizeComboBox->currentIndex();
110 return QPageSize(QPageSize::PageSizeId::A0);
112 return QPageSize(QPageSize::PageSizeId::A1);
114 return QPageSize(QPageSize::PageSizeId::A2);
116 return QPageSize(QPageSize::PageSizeId::A3);
118 return QPageSize(QPageSize::PageSizeId::A4);
120 return QPageSize(QPageSize::PageSizeId::A5);
123 return QPageSize(QPageSize::PageSizeId::Letter);
129 return (QPageLayout::Orientation)
m_page->pageOrientationComboBox->currentIndex();
134 const int layoutIndex =
m_page->boardLayoutComboBox->currentIndex();
140 return m_page->svgTemplatePathFileRequester->fileName();
145 return m_page->exportPathFileRequester->fileName();
160 return m_page->fontSizeSpinBox->value();
166 m_page->fontSizeSpinBox->setMaximum(50);
168 const QSize pointSize = pPageSize.sizePoints();
169 const QSize orientedPointSize = pOrientation == QPageLayout::Landscape ? QSize(pointSize.height(), pointSize.width()) : pointSize;
170 const QSize sizeInPointsPerBoard = QSize(orientedPointSize.width() /
columns(), orientedPointSize.height() /
rows());
172 const int commentCount =
m_model ? qMax(
m_model->totalCommentCount(), 1) : 1;
173 const bool stacked = sizeInPointsPerBoard.width() < sizeInPointsPerBoard.height();
174 const QSize sizeInPointsPerComment = stacked ? QSize(sizeInPointsPerBoard.width(), sizeInPointsPerBoard.height() / commentCount)
175 : QSize(sizeInPointsPerBoard.width() / commentCount, sizeInPointsPerBoard.height());
176 const QSize usableMaximumFontSize = sizeInPointsPerComment / 12;
177 m_page->fontSizeSpinBox->setMaximum(qMin(usableMaximumFontSize.width(), usableMaximumFontSize.height()));
183 if (
m_page->exportPathFileRequester->fileName().isEmpty()) {
185 QMessageBox::warning(
this, i18nc(
"@title:window",
"Krita"), i18n(
"Please enter a file name to export to."));
188 QMessageBox::warning(
this, i18nc(
"@title:window",
"Krita"), i18n(
"Please enter a directory to export to."));
195 QDir dir(
m_page->exportPathFileRequester->fileName());
197 QMessageBox::warning(
this, i18nc(
"@title:window",
"Krita"), i18n(
"Please enter an existing directory."));
201 QFileInfo info(
"[0-9]*.svg");
202 QStringList filesList = dir.entryList({ info.fileName() });
204 if (!filesList.isEmpty()) {
205 QMessageBox::StandardButton result =
206 QMessageBox::warning(0,
207 i18n(
"Existing files with similar naming scheme"),
208 i18n(
"Files with the same naming "
209 "scheme exist in the destination "
210 "directory. They might be "
211 "deleted, continue?\n\n"
214 dir.absolutePath(), filesList.at(0) +
"..."),
215 QMessageBox::Yes | QMessageBox::No,
217 if (result == QMessageBox::No) {
224 QMessageBox::warning(
this, i18nc(
"@title:window",
"Krita"), i18n(
"Please choose svg file to specify the layout for exporting."));
227 QFileInfo fi(
m_page->svgTemplatePathFileRequester->fileName());
229 QMessageBox::warning(
this, i18nc(
"@title:window",
"Krita"), i18n(
"The SVG file to specify layout doesn't exist. Please choose an existing SVG file."));
234 cfg.
writeEntry(
"storyboard/layoutType",
m_page->boardLayoutComboBox->currentIndex());
235 cfg.
writeEntry(
"storyboard/pageOrientation",
m_page->pageOrientationComboBox->currentIndex());
243 cfg.
writeEntry(
"storyboard/svgLayoutFileName",
m_page->svgTemplatePathFileRequester->fileName());
244 cfg.
writeEntry(
"storyboard/exportFilePath",
m_page->exportPathFileRequester->fileName());
252 m_page->rowsLabel->hide();
253 m_page->rowsSpinBox->hide();
254 m_page->columnsLabel->hide();
255 m_page->columnsSpinBox->hide();
256 m_page->gridLabel->hide();
257 m_page->gridRowsSpinBox->hide();
258 m_page->gridColumnsSpinBox->hide();
259 m_page->rowsColumnsXLabel->hide();
260 m_page->svgTemplatePathLabel->hide();
261 m_page->svgTemplatePathFileRequester->hide();
265 m_page->columnsLabel->show();
266 m_page->columnsSpinBox->show();
269 m_page->rowsLabel->show();
270 m_page->rowsSpinBox->show();
273 m_page->gridLabel->show();
274 m_page->gridRowsSpinBox->show();
275 m_page->rowsColumnsXLabel->show();
276 m_page->gridColumnsSpinBox->show();
279 m_page->svgTemplatePathLabel->show();
280 m_page->svgTemplatePathFileRequester->show();
ExportLayout exportLayout() const
DlgExportStoryboard(ExportFormat format, QSharedPointer< StoryboardModel > model)
QSharedPointer< StoryboardModel > m_model
QPageLayout::Orientation pageOrientation() const
QString layoutSvgFile() const
void setUsableMaximums(QPageSize pPageSize, QPageLayout::Orientation pOrientation, ExportLayout pLayout)
bool layoutSpecifiedBySvgFile() const
WdgExportStoryboard * m_page
~DlgExportStoryboard() override
QString saveFileName() const
QPageSize pageSize() const
void slotLayoutChanged(int state)
void slotPageSettingsChanged(int)
ExportFormat format() const
void writeEntry(const QString &name, const T &value)
T readEntry(const QString &name, const T &defaultValue=T())
A dialog base class with standard buttons and predefined layouts.
void setMainWidget(QWidget *widget)
void setButtonText(ButtonCode id, const QString &text)
virtual void setCaption(const QString &caption)
void setButtons(ButtonCodes buttonMask)
void setDefaultButton(ButtonCode id)
@ Apply
Show Apply button.
@ Cancel
Show Cancel-button. (this button reject()s the dialog; result set to QDialog::Rejected)