Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Debugged/Revised export

Changed position of export paths to the new group "/Export".
Revised usage of resolution: Both resolution and image size are stored
in the config file. Standard is the usage of the resolution, but special
image sizes are still possible.
Added/Corrected saving border sizes and the black/white setting.
  • Loading branch information...
commit 39cad0f56ae847cce1246453837787ae587b3725 1 parent 3bef63b
RoboMod RoboMod authored
6 librecad/src/main/qc_applicationwindow.cpp
View
@@ -3025,7 +3025,7 @@ void QC_ApplicationWindow::slotFileExport() {
if (w!=NULL) {
// read default settings:
- RS_SETTINGS->beginGroup("/Paths");
+ RS_SETTINGS->beginGroup("/Export");
QString defDir = RS_SETTINGS->readEntry("/ExportImage", RS_SYSTEM->getHomeDir());
QString defFilter = RS_SETTINGS->readEntry("/ExportImageFilter",
QString("%1 (%2)(*.%2)").arg(QG_DialogFactory::extToFormat("png")).arg("png"));
@@ -3078,7 +3078,7 @@ void QC_ApplicationWindow::slotFileExport() {
// store new default settings:
if (!cancel) {
- RS_SETTINGS->beginGroup("/Paths");
+ RS_SETTINGS->beginGroup("/Export");
RS_SETTINGS->writeEntry("/ExportImage", QFileInfo(fn).absolutePath());
RS_SETTINGS->writeEntry("/ExportImageFilter",
fileDlg.selectedFilter());
@@ -3120,7 +3120,7 @@ void QC_ApplicationWindow::slotFileExport() {
/**
- * Exports the drawing as a bitmap.
+ * Exports the drawing as a bitmap or another picture format.
*
* @param name File name.
* @param format File format (e.g. "png")
76 librecad/src/ui/forms/qg_dlgimageoptions.cpp
View
@@ -63,37 +63,65 @@ void QG_ImageOptionsDialog::languageChange()
void QG_ImageOptionsDialog::init() {
graphicSize = RS_Vector(0.0,0.0);
- updateEnabled = true;
+ updateEnabled = false;
+ useResolution = true;
- RS_SETTINGS->beginGroup("/ExportImage");
- leWidth->setText(RS_SETTINGS->readEntry("/Width", "640"));
- leHeight->setText(RS_SETTINGS->readEntry("/Height", "480"));
+ RS_SETTINGS->beginGroup("/Export");
+ if (RS_SETTINGS->readEntry("/UseResolution", "1")=="1") {
+ cbResolution->setCurrentIndex(cbResolution->findText(QString("%1").arg(RS_SETTINGS->readEntry("/Resolution","1"))));
+ }
+ else {
+ leWidth->setText(RS_SETTINGS->readEntry("/Width", "640"));
+ leHeight->setText(RS_SETTINGS->readEntry("/Height", "480"));
+ }
if (RS_SETTINGS->readEntry("/BlackBackground", "0")=="1") {
rbBlack->setChecked(true);
+ rbWhite->setChecked(false);
}
- if (RS_SETTINGS->readEntry("/Blackwhite", "0")=="1") {
+ else {
+ rbBlack->setChecked(false);
+ rbWhite->setChecked(true);
+ }
+ if (RS_SETTINGS->readEntry("/BlackWhite", "1")=="1") {
rbBlackWhite->setChecked(true);
+ rbColoured->setChecked(false);
+ }
+ else {
+ rbBlackWhite->setChecked(false);
+ rbColoured->setChecked(true);
}
leLeftRight->setText(RS_SETTINGS->readEntry("/BorderLeftRight", "5"));
leTopBottom->setText(RS_SETTINGS->readEntry("/BorderTopBottom", "5"));
- if (RS_SETTINGS->readEntry("/BorderSameSize", "0")=="1") {
+ if (RS_SETTINGS->readEntry("/BorderSameSize", "1")=="1") {
cbSameBorders->setChecked(true);
sameBordersChanged();
}
RS_SETTINGS->endGroup();
+
+ updateEnabled = true;
}
void QG_ImageOptionsDialog::setGraphicSize(const RS_Vector& s) {
graphicSize = s;
- sizeChanged();
+ if(!useResolution){
+ sizeChanged();
+ }
+ else {
+ resolutionChanged();
+ }
}
void QG_ImageOptionsDialog::ok() {
- RS_SETTINGS->beginGroup("/ExportImage");
+ RS_SETTINGS->beginGroup("/Export");
+ RS_SETTINGS->writeEntry("/UseResolution", (int)useResolution);
+ RS_SETTINGS->writeEntry("/Resolution", cbResolution->currentText());
RS_SETTINGS->writeEntry("/Width", leWidth->text());
RS_SETTINGS->writeEntry("/Height", leHeight->text());
+ RS_SETTINGS->writeEntry("/BorderLeftRight", leLeftRight->text());
+ RS_SETTINGS->writeEntry("/BorderTopBottom", leTopBottom->text());
+ RS_SETTINGS->writeEntry("/BorderSameSize", (int)cbSameBorders->isChecked());
RS_SETTINGS->writeEntry("/BlackBackground", (int)rbBlack->isChecked());
- RS_SETTINGS->writeEntry("/Blackwhite", (int)rbBlackWhite->isChecked());
+ RS_SETTINGS->writeEntry("/BlackWhite", (int)rbBlackWhite->isChecked());
RS_SETTINGS->endGroup();
accept();
@@ -117,25 +145,27 @@ void QG_ImageOptionsDialog::borderChanged() {
void QG_ImageOptionsDialog::sizeChanged() {
if (updateEnabled) {
- updateEnabled = false;
- cbResolution->setItemText(cbResolution->currentIndex(), "auto");
- updateEnabled = true;
+ updateEnabled = false;
+ useResolution = false;
+ cbResolution->setCurrentIndex(cbResolution->findText("auto"));
+ updateEnabled = true;
}
}
void QG_ImageOptionsDialog::resolutionChanged() {
if (updateEnabled) {
- updateEnabled = false;
- bool ok = false;
- double res = RS_Math::eval(cbResolution->currentText(), &ok);
- if (!ok) {
- res = 1.0;
- }
- int w = RS_Math::round(res * graphicSize.x);
- int h = RS_Math::round(res * graphicSize.y);
- leWidth->setText(QString("%1").arg(w));
- leHeight->setText(QString("%1").arg(h));
- updateEnabled = true;
+ updateEnabled = false;
+ bool ok = false;
+ double res = RS_Math::eval(cbResolution->currentText(), &ok);
+ if (!ok) {
+ res = 1.0;
+ }
+ int w = RS_Math::round(res * graphicSize.x);
+ int h = RS_Math::round(res * graphicSize.y);
+ useResolution = true;
+ leWidth->setText(QString("%1").arg(w));
+ leHeight->setText(QString("%1").arg(h));
+ updateEnabled = true;
}
}
1  librecad/src/ui/forms/qg_dlgimageoptions.h
View
@@ -56,6 +56,7 @@ protected slots:
private:
RS_Vector graphicSize;
bool updateEnabled;
+ bool useResolution;
void init();
118 librecad/src/ui/forms/qg_dlgimageoptions.ui
View
@@ -23,57 +23,7 @@
<string>Bitmap Size</string>
</property>
<layout class="QGridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="lWidth">
- <property name="text">
- <string>Width:</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="lHeight">
- <property name="text">
- <string>Height:</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="2">
- <spacer name="vspacer2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>31</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="leHeight">
- <property name="text">
- <string>480</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="leWidth">
- <property name="text">
- <string>640</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
+ <item row="2" column="1">
<widget class="QLabel" name="lResolution">
<property name="text">
<string>Resolution:</string>
@@ -83,7 +33,7 @@
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="2" column="2">
<widget class="QComboBox" name="cbResolution">
<property name="editable">
<bool>true</bool>
@@ -175,6 +125,69 @@
</item>
</widget>
</item>
+ <item row="7" column="0" colspan="3">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLabel" name="lWidth">
+ <property name="text">
+ <string>Width:</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QLabel" name="lHeight">
+ <property name="text">
+ <string>Height:</string>
+ </property>
+ <property name="wordWrap">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="2">
+ <widget class="QLineEdit" name="leHeight">
+ <property name="text">
+ <string>480</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2">
+ <widget class="QLineEdit" name="leWidth">
+ <property name="text">
+ <string>640</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="3">
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
</item>
@@ -357,7 +370,6 @@
<tabstops>
<tabstop>leWidth</tabstop>
<tabstop>leHeight</tabstop>
- <tabstop>cbResolution</tabstop>
<tabstop>rbWhite</tabstop>
</tabstops>
<resources/>
Please sign in to comment.
Something went wrong with that request. Please try again.