Download src/Gui/PreferencePages/DlgSettingsPDF.cpp from AbdulElahGwaith/FreeCAD: direct link, hf CLI and curl.
- Browser
- Download file 3.2 kB
-
https://huggingface.co/AbdulElahGwaith/FreeCAD/resolve/main/src/Gui/PreferencePages/DlgSettingsPDF.cpp
- Command line
-
hf download hf://AbdulElahGwaith/FreeCAD/src/Gui/PreferencePages/DlgSettingsPDF.cpp
-
curl -L -o DlgSettingsPDF.cpp https://huggingface.co/AbdulElahGwaith/FreeCAD/resolve/main/src/Gui/PreferencePages/DlgSettingsPDF.cpp
3.2 kB
| using namespace Gui::Dialog; | |
| /* TRANSLATOR Gui::Dialog::DlgSettingsPDF */ | |
| DlgSettingsPDF::DlgSettingsPDF(QWidget* parent) | |
| : PreferencePage(parent) | |
| , ui(new Ui_DlgSettingsPDF) | |
| { | |
| ui->setupUi(this); | |
| ui->warningLabel->setWordWrap(true); | |
| connect( | |
| ui->comboBox, | |
| QOverload<int>::of(&QComboBox::currentIndexChanged), | |
| this, | |
| &DlgSettingsPDF::onComboBoxIndexChanged | |
| ); | |
| } | |
| DlgSettingsPDF::~DlgSettingsPDF() = default; | |
| void DlgSettingsPDF::saveSettings() | |
| { | |
| ui->comboBox->onSave(); | |
| } | |
| void DlgSettingsPDF::loadSettings() | |
| { | |
| ui->comboBox->onRestore(); | |
| int currentIndex = ui->comboBox->currentIndex(); | |
| if (currentIndex == 3) { | |
| Base::Console().warning( | |
| "When using another copy of FreeCAD you had set the PDF version to X4, but this build " | |
| "of FreeCAD does not support it. Using 1.4 instead.\n" | |
| ); | |
| currentIndex = 0; | |
| ui->comboBox->setCurrentIndex(0); | |
| } | |
| ui->comboBox->removeItem(3); // PdfVersion_X4 | |
| onComboBoxIndexChanged(currentIndex); | |
| } | |
| QPagedPaintDevice::PdfVersion DlgSettingsPDF::evaluatePDFVersion() | |
| { | |
| auto hGrp = App::GetApplication() | |
| .GetUserParameter() | |
| .GetGroup("BaseApp") | |
| ->GetGroup("Preferences") | |
| ->GetGroup("Mod"); | |
| const int ver = hGrp->GetInt("PDFVersion"); | |
| switch (ver) { | |
| case 1: | |
| return QPagedPaintDevice::PdfVersion_A1b; | |
| case 2: | |
| return QPagedPaintDevice::PdfVersion_1_6; | |
| case 3: | |
| return QPagedPaintDevice::PdfVersion_X4; | |
| default: | |
| return QPagedPaintDevice::PdfVersion_1_4; | |
| } | |
| } | |
| void DlgSettingsPDF::onComboBoxIndexChanged(int index) | |
| { | |
| switch (index) { | |
| case 1: | |
| ui->warningLabel->setText( | |
| tr("This archival PDF format does not support transparency or layers. All content " | |
| "must be self-contained and static.") | |
| ); | |
| break; | |
| case 2: | |
| ui->warningLabel->setText( | |
| tr("While this version supports more modern features, older PDF readers may not " | |
| "fully handle it.") | |
| ); | |
| break; | |
| case 3: | |
| ui->warningLabel->setText( | |
| tr("This PDF format is intended for professional printing and requires all fonts " | |
| "to be embedded; some interactive features may not be supported.") | |
| ); | |
| break; | |
| default: | |
| ui->warningLabel->setText( | |
| tr("This PDF version has limited support for modern features like embedded " | |
| "multimedia and advanced transparency effects.") | |
| ); | |
| break; | |
| } | |
| } | |
| void DlgSettingsPDF::changeEvent(QEvent* e) | |
| { | |
| if (e->type() == QEvent::LanguageChange) { | |
| ui->retranslateUi(this); | |
| } | |
| QWidget::changeEvent(e); | |
| } | |