mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
Exporter: add PDF-Like option for custom export
This commit is contained in:
parent
68dc2425a9
commit
55b835a97c
@ -515,6 +515,8 @@ void VExportDialog::initUIFields(MarkdownConverterType p_renderer)
|
||||
|
||||
m_customAllInOneCB->setChecked(s_opt.m_customOpt.m_allInOne);
|
||||
|
||||
m_customPdfLikeCB->setChecked(s_opt.m_customOpt.m_pdfLike);
|
||||
|
||||
m_customFolderSepEdit->setText(s_opt.m_customOpt.m_folderSep);
|
||||
}
|
||||
|
||||
@ -593,6 +595,7 @@ void VExportDialog::startExport()
|
||||
g_config->getCssStyleUrl(renderStyle),
|
||||
g_config->getCodeBlockCssStyleUrl(renderCodeBlockStyle),
|
||||
m_customAllInOneCB->isChecked(),
|
||||
m_customPdfLikeCB->isChecked(),
|
||||
m_customFolderSepEdit->text(),
|
||||
m_customTargetFileNameEdit->text()));
|
||||
|
||||
@ -1365,6 +1368,10 @@ QWidget *VExportDialog::setupCustomAdvancedSettings()
|
||||
m_customTargetFileNameEdit->setEnabled(checked);
|
||||
});
|
||||
|
||||
// Enable PDF-like.
|
||||
m_customPdfLikeCB = new QCheckBox(tr("PDF-Like"), this);
|
||||
m_customPdfLikeCB->setToolTip(tr("Treat the exported file as PDF, such as wrapping line"));
|
||||
|
||||
// Input directory separator.
|
||||
m_customFolderSepEdit = new VLineEdit(this);
|
||||
m_customFolderSepEdit->setPlaceholderText(tr("Separator to concatenate input files directories"));
|
||||
@ -1396,6 +1403,7 @@ QWidget *VExportDialog::setupCustomAdvancedSettings()
|
||||
advLayout->addWidget(m_customSuffixEdit, 0, 4, 1, 2);
|
||||
|
||||
advLayout->addWidget(m_customAllInOneCB, 1, 1, 1, 2);
|
||||
advLayout->addWidget(m_customPdfLikeCB, 1, 4, 1, 2);
|
||||
|
||||
advLayout->addWidget(new QLabel(tr("Output file name:")), 2, 0);
|
||||
advLayout->addWidget(m_customTargetFileNameEdit, 2, 1, 1, 2);
|
||||
|
@ -141,6 +141,7 @@ struct ExportCustomOption
|
||||
ExportCustomOption()
|
||||
: m_srcFormat(SourceFormat::Markdown),
|
||||
m_allInOne(false),
|
||||
m_pdfLike(false),
|
||||
m_folderSep(DEFAULT_SEP)
|
||||
{
|
||||
}
|
||||
@ -148,6 +149,7 @@ struct ExportCustomOption
|
||||
ExportCustomOption(const QStringList &p_config)
|
||||
: m_srcFormat(SourceFormat::Markdown),
|
||||
m_allInOne(false),
|
||||
m_pdfLike(false),
|
||||
m_folderSep(DEFAULT_SEP)
|
||||
{
|
||||
if (p_config.size() < 3) {
|
||||
@ -169,6 +171,7 @@ struct ExportCustomOption
|
||||
const QString &p_cssUrl,
|
||||
const QString &p_codeBlockCssUrl,
|
||||
bool p_allInOne,
|
||||
bool p_pdfLike,
|
||||
const QString &p_folderSep,
|
||||
const QString &p_targetFileName)
|
||||
: m_srcFormat(p_srcFormat),
|
||||
@ -176,6 +179,7 @@ struct ExportCustomOption
|
||||
m_cssUrl(p_cssUrl),
|
||||
m_codeBlockCssUrl(p_codeBlockCssUrl),
|
||||
m_allInOne(p_allInOne),
|
||||
m_pdfLike(p_pdfLike),
|
||||
m_folderSep(p_folderSep),
|
||||
m_targetFileName(p_targetFileName)
|
||||
{
|
||||
@ -203,6 +207,7 @@ struct ExportCustomOption
|
||||
QString m_codeBlockCssUrl;
|
||||
|
||||
bool m_allInOne;
|
||||
bool m_pdfLike;
|
||||
|
||||
QString m_folderSep;
|
||||
QString m_targetFileName;
|
||||
@ -455,6 +460,8 @@ private:
|
||||
|
||||
QCheckBox *m_customAllInOneCB;
|
||||
|
||||
QCheckBox *m_customPdfLikeCB;
|
||||
|
||||
QPlainTextEdit *m_customCmdEdit;
|
||||
|
||||
VLineEdit *m_customFolderSepEdit;
|
||||
|
@ -41,7 +41,8 @@ void VExporter::prepareExport(const ExportOption &p_opt)
|
||||
{
|
||||
bool isPdf = p_opt.m_format == ExportFormat::PDF
|
||||
|| p_opt.m_format == ExportFormat::OnePDF
|
||||
|| p_opt.m_format == ExportFormat::Custom;
|
||||
|| (p_opt.m_format == ExportFormat::Custom
|
||||
&& p_opt.m_customOpt.m_pdfLike);
|
||||
bool extraToc = isPdf
|
||||
&& !p_opt.m_pdfOpt.m_wkhtmltopdf
|
||||
&& p_opt.m_pdfOpt.m_enableTableOfContents;
|
||||
|
Loading…
x
Reference in New Issue
Block a user