Skip to content

Commit

Permalink
Add pixel ratio setting to PDF, PNG, JPG and BMP exports #304
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorsandy committed Jul 6, 2019
1 parent 0a3d6d6 commit 9b9da3a
Show file tree
Hide file tree
Showing 16 changed files with 436 additions and 156 deletions.
2 changes: 1 addition & 1 deletion builds/linux/obs/alldeps/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Last Update: March 23, 2019
# Copyright (c) 2017 - 2019 by Trevor SANDY
pkgname=lpub3d
pkgver=2.3.13.1384
pkgver=2.3.13.1385
pkgrel=1
pkgdesc="An LDraw Building Instruction Editor"
url="https://github.com/trevorsandy/lpub3d.git"
Expand Down
6 changes: 3 additions & 3 deletions builds/linux/obs/alldeps/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lpub3d (2.3.13.1384) debian; urgency=medium
lpub3d (2.3.13.1385) debian; urgency=medium

* LPub3D version 2.3.13.1.1384_20190706 for Linux
* LPub3D version 2.3.13.1.1385_20190706 for Linux

-- Trevor SANDY <trevor.sandy@gmail.com> Sat, 06 Jul 2019 16:55:28 +0200
-- Trevor SANDY <trevor.sandy@gmail.com> Sat, 06 Jul 2019 16:57:15 +0200
2 changes: 1 addition & 1 deletion builds/linux/obs/alldeps/debian/lpub3d.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Format: 1.0
Source: lpub3d
Binary: lpub3d
Architecture: any
Version: 2.3.13.1384
Version: 2.3.13.1385
Maintainer: Trevor SANDY <trevor.sandy@gmail.com>
Homepage: https://trevorsandy.github.io/lpub3d/
Standards-Version: 3.9.7
Expand Down
4 changes: 2 additions & 2 deletions builds/linux/obs/alldeps/lpub3d.spec
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ BuildRequires: fdupes
Summary: An LDraw Building Instruction Editor
Name: lpub3d
Icon: lpub3d.xpm
Version: 2.3.13.1384
Version: 2.3.13.1385
Release: <B_CNT>%{?dist}
URL: https://trevorsandy.github.io/lpub3d
Vendor: Trevor SANDY
Expand Down Expand Up @@ -717,5 +717,5 @@ update-mime-database /usr/share/mime >/dev/null || true
update-desktop-database || true
%endif

* Sat Jul 06 2019 - trevor.dot.sandy.at.gmail.dot.com 2.3.13.1384
* Sat Jul 06 2019 - trevor.dot.sandy.at.gmail.dot.com 2.3.13.1385
- LPub3D Linux package (rpm) release
Binary file modified builds/utilities/ci/secure/.secrets.tar.enc
Binary file not shown.
2 changes: 1 addition & 1 deletion builds/utilities/version.info
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2 3 13 1 1384 76fdbe1
2 3 13 1 1385 0a3d6d6
30 changes: 16 additions & 14 deletions mainApp/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,22 @@ Application* Application::m_instance = nullptr;
Application::Application(int &argc, char **argv)
: m_application(argc, argv)
{

#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
#endif
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
//QCoreApplication::setAttribute(Qt::AA_Use96Dpi);

QCoreApplication::setOrganizationName(VER_COMPANYNAME_STR);
QCoreApplication::setApplicationVersion(VER_PRODUCTVERSION_STR);

//qDebug() << "QStyleFactory valid styles:" << QStyleFactory::keys();
#ifdef Q_OS_MAC
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
QCoreApplication::setStyle(QStyleFactory::create("macintosh"));
#endif

m_instance = this;
m_console_mode = false;
m_print_output = false;
Expand All @@ -120,22 +136,8 @@ Application::Application(int &argc, char **argv)
m_allocated_console = false;
#endif

#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
m_application.setAttribute(Qt::AA_UseDesktopOpenGL);
#endif
m_application.setAttribute(Qt::AA_Use96Dpi);

QCoreApplication::setOrganizationName(VER_COMPANYNAME_STR);
QCoreApplication::setApplicationVersion(VER_PRODUCTVERSION_STR);

connect(this, SIGNAL(splashMsgSig(QString)), this, SLOT(splashMsg(QString)));

//qDebug() << "QStyleFactory valid styles:" << QStyleFactory::keys();
#ifdef Q_OS_MAC
m_application.setAttribute(Qt::AA_DontShowIconsInMenus);
m_application.setStyle(QStyleFactory::create("macintosh"));
#endif

}

Application* Application::instance()
Expand Down
38 changes: 37 additions & 1 deletion mainApp/dialogexportpages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ DialogExportPages::DialogExportPages(QWidget *parent) :
if ((! preview) &&
(gui->exportMode == EXPORT_POVRAY ||
gui->exportMode == EXPORT_STL ||
gui->exportMode == EXPORT_3DS_MAX)){
gui->exportMode == EXPORT_3DS_MAX)){
flag = gui->exportMode == EXPORT_POVRAY ? NativePOVIni :
gui->exportMode == EXPORT_STL ? NativeSTLIni : Native3DSIni;
// flag = gui->exportMode == EXPORT_POVRAY ? NativePOVIni : NativeSTLIni;
Expand All @@ -51,6 +51,9 @@ DialogExportPages::DialogExportPages(QWidget *parent) :
ui->checkBoxIgnoreMixedPageSizes->setChecked(Preferences::ignoreMixedPageSizesMsg);
}

ui->spinPixelRatio->setValue(gui->exportPixelRatio);
ui->spinPixelRatio->setToolTip(QString("Change the export DPI pixel ratio."));

ui->radioButtonAllPages->setChecked(true);
ui->checkBoxResetCache->setChecked(false);

Expand Down Expand Up @@ -139,6 +142,24 @@ DialogExportPages::DialogExportPages(QWidget *parent) :
ui->groupBoxMixedPageSizes->hide();
break;
}

switch(gui->exportMode) {
case EXPORT_PDF:
case EXPORT_PNG:
case EXPORT_JPG:
case EXPORT_BMP:
getPixelRatioMsg(gui->exportPixelRatio);
ui->labelPixelRatio->show();
ui->labelPixelRatioFactor->show();
ui->spinPixelRatio->show();
break;
default:
ui->labelPixelRatio->hide();
ui->labelPixelRatioFactor->hide();
ui->spinPixelRatio->hide();
break;
}

setMinimumSize(40,20);
adjustSize();
}
Expand All @@ -148,6 +169,12 @@ DialogExportPages::~DialogExportPages()
delete ui;
}

void DialogExportPages::getPixelRatioMsg(double value)
{
ui->labelPixelRatioFactor->setText(QString("Export DPI %1px")
.arg(value*int(resolution())));
}

QString const DialogExportPages::pageRangeText(){
return ui->lineEditPageRange->text();
}
Expand Down Expand Up @@ -176,6 +203,10 @@ bool DialogExportPages::doNotShowPageProcessDlg(){
return ui->doNotShowPageProcessDlgChk->isChecked();
}

qreal DialogExportPages::exportPixelRatio(){
return ui->spinPixelRatio->value();
}

int DialogExportPages::pageDisplayPause(){
return ui->pageDisplayPauseSpin->value();
}
Expand Down Expand Up @@ -215,3 +246,8 @@ void DialogExportPages::on_pushButtonExportPreferences_clicked()
ldvWidget = new LDVWidget(this,IniFlag(flag),true);
ldvWidget->showLDVPreferences();
}

void DialogExportPages::on_spinPixelRatio_valueChanged(double value)
{
getPixelRatioMsg(value);
}
5 changes: 4 additions & 1 deletion mainApp/dialogexportpages.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DialogExportPages : public QDialog
Q_OBJECT

public:
explicit DialogExportPages(QWidget *parent = 0);
explicit DialogExportPages(QWidget *parent = nullptr);
~DialogExportPages();

bool allPages();
Expand All @@ -36,13 +36,16 @@ class DialogExportPages : public QDialog
bool ignoreMixedPageSizesMsg();
bool doNotShowPageProcessDlg();
int pageDisplayPause();
qreal exportPixelRatio();
QString const pageRangeText();
void getPixelRatioMsg(double value);

private slots:
void on_lineEditPageRange_textChanged(const QString &arg1);
void on_lineEditPageRange_selectionChanged();
void on_pushButtonExportSettings_clicked();
void on_pushButtonExportPreferences_clicked();
void on_spinPixelRatio_valueChanged(double arg1);

private:
Ui::DialogExportPages *ui;
Expand Down
69 changes: 48 additions & 21 deletions mainApp/dialogexportpages.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>339</width>
<height>417</height>
<height>436</height>
</rect>
</property>
<property name="minimumSize">
Expand All @@ -34,19 +34,16 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="radioButtonAllPages">
<item row="1" column="0">
<widget class="QRadioButton" name="radioButtonCurrentPage">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>All Pages</string>
<string>Current Page</string>
</property>
</widget>
</item>
Expand All @@ -69,45 +66,48 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="radioButtonCurrentPage">
<item row="0" column="0">
<widget class="QRadioButton" name="radioButtonAllPages">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Current Page</string>
<string>All Pages</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="labelCurrentPage">
<item row="2" column="0">
<widget class="QRadioButton" name="radioButtonPageRange">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="text">
<string/>
<string>Page Range</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="radioButtonPageRange">
<item row="1" column="1">
<widget class="QLabel" name="labelCurrentPage">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="text">
<string>Page Range</string>
<string/>
</property>
</widget>
</item>
Expand All @@ -124,6 +124,33 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelPixelRatio">
<property name="text">
<string>Pixel Ratio</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="labelPixelRatioFactor">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="spinPixelRatio">
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.100000000000000</double>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down
2 changes: 1 addition & 1 deletion mainApp/docs/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LPub3D 2.3.13.1.1384 (06 07 2019 16:55:28)
LPub3D 2.3.13.1.1385 (06 07 2019 16:57:15)

Features, enhancements, fixes and changes
------------
Expand Down
3 changes: 2 additions & 1 deletion mainApp/docs/RELEASE_NOTES.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<table class="tg">
<tr>
<th class="tg-0pky">
<h4><a id="LPub3D_0"></a>LPub3D 2.3.13.1.1384 (06 07 2019 16:55:28)</h4>
<h4><a id="LPub3D_0"></a>LPub3D 2.3.13.1.1385 (06 07 2019 16:57:15)</h4>
<hr>
<p>
LPub3D version 2.3.13 adds some updates and a top priority fix for #280 Add substitute<br>
Expand All @@ -21,6 +21,7 @@ <h4><a id="LPub3D_0"></a>LPub3D 2.3.13.1.1384 (06 07 2019 16:55:28)</h4>
<h4><a id="Features_enhancements_fixes_and_changes_7"></a>Features, enhancements, fixes and changes</h4>
</th>
</tr>
<tr><td class="tg-buh4"><a href="https://github.com/trevorsandy/lpub3d/issues/304">Enhancement - Add pixel ratio setting to PDF, PNG, JPG and BMP exports #304</td></tr>
<tr><td class="tg-0lax"><a href="https://github.com/trevorsandy/lpub3d/issues/297">Enhancement - Expanded submodel instance consolidation #297</td></tr>
<tr><td class="tg-buh4"><a href="https://github.com/trevorsandy/lpub3d/issues/282">Enhancement - Bricklink XML config ignored, some tags missing #282</td></tr>
<tr><td class="tg-0lax"><a href="https://github.com/trevorsandy/lpub3d/issues/293">Change - BOM annotation rectangle size setting seems to have no effect #293</td></tr>
Expand Down
1 change: 1 addition & 0 deletions mainApp/lpub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2513,6 +2513,7 @@ Gui::Gui()
processOption = EXPORT_ALL_PAGES;
exportMode = EXPORT_PDF;
pageRangeText = "1";
exportPixelRatio = 1.0;
resetCache = false;
m_previewDialog = false;
m_partListCSIFile = false;
Expand Down
1 change: 1 addition & 0 deletions mainApp/lpub.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ class Gui : public QMainWindow
int exportMode; // export Mode
int processOption; // export Option
int pageDirection; // continuous page processing direction
qreal exportPixelRatio; // export resolution pixel density
QString pageRangeText; // page range parameters
bool submodelIconsLoaded; // load submodel images
bool resetCache; // reset model, fade and highlight parts
Expand Down
2 changes: 1 addition & 1 deletion mainApp/org.trevorsandy.lpub3d.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<binary>lpub3d23</binary>
​</provides>
<releases>
<release version="2.3.13.1384" date="2019-07-06">
<release version="2.3.13.1385" date="2019-07-06">
<description>
<p>LPub3D Linux AppImage package</p>
</description>
Expand Down

0 comments on commit 9b9da3a

Please sign in to comment.