First draft of the issue #313. Layout pieces too close to right edge.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-11-09 13:33:36 +02:00
parent f632ef6480
commit 4411cccd9c
17 changed files with 1270 additions and 236 deletions

View File

@ -38,6 +38,7 @@
# include <QtMath> # include <QtMath>
#endif #endif
#include <QMessageBox>
#include <QPushButton> #include <QPushButton>
//must be the same order as PaperSizeTemplate constants //must be the same order as PaperSizeTemplate constants
@ -98,6 +99,13 @@ DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget
connect(ui->doubleSpinBoxPaperHeight, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), connect(ui->doubleSpinBoxPaperHeight, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogLayoutSettings::FindTemplate); this, &DialogLayoutSettings::FindTemplate);
connect(ui->doubleSpinBoxPaperWidth, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogLayoutSettings::CorrectMaxFileds);
connect(ui->doubleSpinBoxPaperHeight, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogLayoutSettings::CorrectMaxFileds);
connect(ui->checkBoxIgnoreFileds, &QCheckBox::stateChanged, this, &DialogLayoutSettings::IgnoreAllFields);
connect(ui->toolButtonPortrate, &QToolButton::toggled, this, &DialogLayoutSettings::Swap); connect(ui->toolButtonPortrate, &QToolButton::toggled, this, &DialogLayoutSettings::Swap);
connect(ui->toolButtonLandscape, &QToolButton::toggled, this, &DialogLayoutSettings::Swap); connect(ui->toolButtonLandscape, &QToolButton::toggled, this, &DialogLayoutSettings::Swap);
connect(ui->comboBoxLayoutUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(ui->comboBoxLayoutUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
@ -125,6 +133,7 @@ qreal DialogLayoutSettings::GetPaperHeight() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetPaperHeight(qreal value) void DialogLayoutSettings::SetPaperHeight(qreal value)
{ {
ui->doubleSpinBoxPaperHeight->setMaximum(FromPixel(QIMAGE_MAX, PaperUnit()));
ui->doubleSpinBoxPaperHeight->setValue(UnitConvertor(value, Unit::Px, PaperUnit())); ui->doubleSpinBoxPaperHeight->setValue(UnitConvertor(value, Unit::Px, PaperUnit()));
} }
@ -137,6 +146,7 @@ qreal DialogLayoutSettings::GetPaperWidth() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetPaperWidth(qreal value) void DialogLayoutSettings::SetPaperWidth(qreal value)
{ {
ui->doubleSpinBoxPaperWidth->setMaximum(FromPixel(QIMAGE_MAX, PaperUnit()));
ui->doubleSpinBoxPaperWidth->setValue(UnitConvertor(value, Unit::Px, PaperUnit())); ui->doubleSpinBoxPaperWidth->setValue(UnitConvertor(value, Unit::Px, PaperUnit()));
} }
@ -164,6 +174,26 @@ void DialogLayoutSettings::SetLayoutWidth(qreal value)
ui->doubleSpinBoxLayoutWidth->setValue(UnitConvertor(value, Unit::Px, LayoutUnit())); ui->doubleSpinBoxLayoutWidth->setValue(UnitConvertor(value, Unit::Px, LayoutUnit()));
} }
//---------------------------------------------------------------------------------------------------------------------
QMarginsF DialogLayoutSettings::GetFields() const
{
QMarginsF fields;
fields.setLeft(UnitConvertor(ui->doubleSpinBoxLeftField->value(), oldLayoutUnit, Unit::Px));
fields.setRight(UnitConvertor(ui->doubleSpinBoxRightField->value(), oldLayoutUnit, Unit::Px));
fields.setTop(UnitConvertor(ui->doubleSpinBoxTopField->value(), oldLayoutUnit, Unit::Px));
fields.setBottom(UnitConvertor(ui->doubleSpinBoxBottomField->value(), oldLayoutUnit, Unit::Px));
return fields;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetFields(const QMarginsF &value)
{
ui->doubleSpinBoxLeftField->setValue(UnitConvertor(value.left(), Unit::Px, LayoutUnit()));
ui->doubleSpinBoxRightField->setValue(UnitConvertor(value.right(), Unit::Px, LayoutUnit()));
ui->doubleSpinBoxTopField->setValue(UnitConvertor(value.top(), Unit::Px, LayoutUnit()));
ui->doubleSpinBoxBottomField->setValue(UnitConvertor(value.bottom(), Unit::Px, LayoutUnit()));
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
Cases DialogLayoutSettings::GetGroup() const Cases DialogLayoutSettings::GetGroup() const
{ {
@ -271,6 +301,18 @@ void DialogLayoutSettings::SetUnitePages(bool save)
ui->checkBoxUnitePages->setChecked(save); ui->checkBoxUnitePages->setChecked(save);
} }
//---------------------------------------------------------------------------------------------------------------------
bool DialogLayoutSettings::IsIgnoreAllFields() const
{
return ui->checkBoxIgnoreFileds->isChecked();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetIgnoreAllFields(bool value)
{
ui->checkBoxIgnoreFileds->setChecked(value);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::TemplateSelected() void DialogLayoutSettings::TemplateSelected()
{ {
@ -317,6 +359,11 @@ void DialogLayoutSettings::ConvertPaperSize()
const qreal width = ui->doubleSpinBoxPaperWidth->value(); const qreal width = ui->doubleSpinBoxPaperWidth->value();
const qreal height = ui->doubleSpinBoxPaperHeight->value(); const qreal height = ui->doubleSpinBoxPaperHeight->value();
const qreal left = ui->doubleSpinBoxLeftField->value();
const qreal right = ui->doubleSpinBoxRightField->value();
const qreal top = ui->doubleSpinBoxTopField->value();
const qreal bottom = ui->doubleSpinBoxBottomField->value();
ui->doubleSpinBoxPaperWidth->blockSignals(true); ui->doubleSpinBoxPaperWidth->blockSignals(true);
ui->doubleSpinBoxPaperHeight->blockSignals(true); ui->doubleSpinBoxPaperHeight->blockSignals(true);
ui->doubleSpinBoxPaperWidth->setMaximum(FromPixel(QIMAGE_MAX, paperUnit)); ui->doubleSpinBoxPaperWidth->setMaximum(FromPixel(QIMAGE_MAX, paperUnit));
@ -327,12 +374,22 @@ void DialogLayoutSettings::ConvertPaperSize()
const qreal newWidth = UnitConvertor(width, oldPaperUnit, paperUnit); const qreal newWidth = UnitConvertor(width, oldPaperUnit, paperUnit);
const qreal newHeight = UnitConvertor(height, oldPaperUnit, paperUnit); const qreal newHeight = UnitConvertor(height, oldPaperUnit, paperUnit);
const qreal newLeft = UnitConvertor(left, oldPaperUnit, paperUnit);
const qreal newRight = UnitConvertor(right, oldPaperUnit, paperUnit);
const qreal newTop = UnitConvertor(top, oldPaperUnit, paperUnit);
const qreal newBottom = UnitConvertor(bottom, oldPaperUnit, paperUnit);
oldPaperUnit = paperUnit; oldPaperUnit = paperUnit;
CorrectPaperDecimals(); CorrectPaperDecimals();
MinimumPaperSize(); MinimumPaperSize();
ui->doubleSpinBoxPaperWidth->setValue(newWidth); ui->doubleSpinBoxPaperWidth->setValue(newWidth);
ui->doubleSpinBoxPaperHeight->setValue(newHeight); ui->doubleSpinBoxPaperHeight->setValue(newHeight);
ui->doubleSpinBoxLeftField->setValue(newLeft);
ui->doubleSpinBoxRightField->setValue(newRight);
ui->doubleSpinBoxTopField->setValue(newTop);
ui->doubleSpinBoxBottomField->setValue(newBottom);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -433,8 +490,6 @@ void DialogLayoutSettings::PaperSizeChanged()
ui->toolButtonLandscape->setChecked(true); ui->toolButtonLandscape->setChecked(true);
ui->toolButtonLandscape->blockSignals(false); ui->toolButtonLandscape->blockSignals(false);
} }
Label();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -464,8 +519,6 @@ void DialogLayoutSettings::Swap(bool checked)
ui->doubleSpinBoxPaperHeight->blockSignals(true); ui->doubleSpinBoxPaperHeight->blockSignals(true);
ui->doubleSpinBoxPaperHeight->setValue(width); ui->doubleSpinBoxPaperHeight->setValue(width);
ui->doubleSpinBoxPaperHeight->blockSignals(false); ui->doubleSpinBoxPaperHeight->blockSignals(false);
Label();
} }
} }
@ -484,6 +537,48 @@ void DialogLayoutSettings::DialogAccepted()
generator->SetSaveLength(IsSaveLength()); generator->SetSaveLength(IsSaveLength());
generator->SetUnitePages(IsUnitePages()); generator->SetUnitePages(IsUnitePages());
if (IsIgnoreAllFields())
{
generator->SetFields(QMarginsF());
}
else
{
const QMarginsF minFields = RoundMargins(VSettings::GetDefFields());
const QMarginsF fields = RoundMargins(GetFields());
if (fields.left() < minFields.left() || fields.right() < minFields.right() ||
fields.top() < minFields.top() || fields.bottom() < minFields.bottom())
{
QMessageBox::StandardButton answer;
answer = QMessageBox::question(this, tr("Wrong fields."),
tr("Fields go beyond printing. \n\nApply settings anyway?"),
QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
if (answer == QMessageBox::No)
{
if (fields.left() < minFields.left())
{
ui->doubleSpinBoxLeftField->setValue(UnitConvertor(minFields.left(), Unit::Px, LayoutUnit()));
}
if (fields.right() < minFields.right())
{
ui->doubleSpinBoxRightField->setValue(UnitConvertor(minFields.right(), Unit::Px, LayoutUnit()));
}
if (fields.top() < minFields.top())
{
ui->doubleSpinBoxTopField->setValue(UnitConvertor(minFields.top(), Unit::Px, LayoutUnit()));
}
if (fields.bottom() < minFields.bottom())
{
ui->doubleSpinBoxBottomField->setValue(UnitConvertor(minFields.bottom(), Unit::Px, LayoutUnit()));
}
}
}
generator->SetFields(GetFields());
}
//don't want to break visual settings when cmd used //don't want to break visual settings when cmd used
if (disableSettings == false) if (disableSettings == false)
{ {
@ -505,6 +600,36 @@ void DialogLayoutSettings::RestoreDefaults()
SetGroup(VSettings::GetDefLayoutGroup()); SetGroup(VSettings::GetDefLayoutGroup());
SetRotate(VSettings::GetDefLayoutRotate()); SetRotate(VSettings::GetDefLayoutRotate());
SetIncrease(VSettings::GetDefLayoutRotationIncrease()); SetIncrease(VSettings::GetDefLayoutRotationIncrease());
SetFields(VSettings::GetDefFields());
SetIgnoreAllFields(VSettings::GetDefIgnoreAllFields());
CorrectMaxFileds();
IgnoreAllFields(ui->checkBoxIgnoreFileds->isChecked());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::CorrectMaxFileds()
{
const qreal width = ui->doubleSpinBoxPaperWidth->value();
const qreal height = ui->doubleSpinBoxPaperHeight->value();
// 80%/2 of paper size for each field
const qreal widthField = (width*80.0/100.0)/2.0;
const qreal heightField = (height*80.0/100.0)/2.0;
ui->doubleSpinBoxLeftField->setMaximum(widthField);
ui->doubleSpinBoxRightField->setMaximum(widthField);
ui->doubleSpinBoxTopField->setMaximum(heightField);
ui->doubleSpinBoxBottomField->setMaximum(heightField);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::IgnoreAllFields(int state)
{
ui->doubleSpinBoxLeftField->setDisabled(state);
ui->doubleSpinBoxRightField->setDisabled(state);
ui->doubleSpinBoxTopField->setDisabled(state);
ui->doubleSpinBoxBottomField->setDisabled(state);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -711,6 +836,17 @@ QSizeF DialogLayoutSettings::RoundTemplateSize(qreal width, qreal height) const
return QSizeF(width, height); return QSizeF(width, height);
} }
//---------------------------------------------------------------------------------------------------------------------
QMarginsF DialogLayoutSettings::RoundMargins(const QMarginsF &margins) const
{
QMarginsF newMargins;
newMargins.setLeft(qRound(margins.left() * 100.0) / 100.0);
newMargins.setRight(qRound(margins.right() * 100.0) / 100.0);
newMargins.setTop(qRound(margins.top() * 100.0) / 100.0);
newMargins.setBottom(qRound(margins.bottom() * 100.0) / 100.0);
return newMargins;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
Unit DialogLayoutSettings::PaperUnit() const Unit DialogLayoutSettings::PaperUnit() const
{ {
@ -740,16 +876,23 @@ void DialogLayoutSettings::CorrectPaperDecimals()
{ {
case Unit::Cm: case Unit::Cm:
case Unit::Mm: case Unit::Mm:
case Unit::Px:
ui->doubleSpinBoxPaperWidth->setDecimals(2); ui->doubleSpinBoxPaperWidth->setDecimals(2);
ui->doubleSpinBoxPaperHeight->setDecimals(2); ui->doubleSpinBoxPaperHeight->setDecimals(2);
ui->doubleSpinBoxLeftField->setDecimals(4);
ui->doubleSpinBoxRightField->setDecimals(4);
ui->doubleSpinBoxTopField->setDecimals(4);
ui->doubleSpinBoxBottomField->setDecimals(4);
break; break;
case Unit::Inch: case Unit::Inch:
ui->doubleSpinBoxPaperWidth->setDecimals(5); ui->doubleSpinBoxPaperWidth->setDecimals(5);
ui->doubleSpinBoxPaperHeight->setDecimals(5); ui->doubleSpinBoxPaperHeight->setDecimals(5);
break;
case Unit::Px: ui->doubleSpinBoxLeftField->setDecimals(5);
ui->doubleSpinBoxPaperWidth->setDecimals(2); ui->doubleSpinBoxRightField->setDecimals(5);
ui->doubleSpinBoxPaperHeight->setDecimals(2); ui->doubleSpinBoxTopField->setDecimals(5);
ui->doubleSpinBoxBottomField->setDecimals(5);
break; break;
default: default:
break; break;
@ -763,6 +906,7 @@ void DialogLayoutSettings::CorrectLayoutDecimals()
{ {
case Unit::Cm: case Unit::Cm:
case Unit::Mm: case Unit::Mm:
case Unit::Px:
ui->doubleSpinBoxLayoutWidth->setDecimals(2); ui->doubleSpinBoxLayoutWidth->setDecimals(2);
ui->doubleSpinBoxShift->setDecimals(2); ui->doubleSpinBoxShift->setDecimals(2);
break; break;
@ -770,24 +914,11 @@ void DialogLayoutSettings::CorrectLayoutDecimals()
ui->doubleSpinBoxLayoutWidth->setDecimals(5); ui->doubleSpinBoxLayoutWidth->setDecimals(5);
ui->doubleSpinBoxShift->setDecimals(5); ui->doubleSpinBoxShift->setDecimals(5);
break; break;
case Unit::Px:
ui->doubleSpinBoxLayoutWidth->setDecimals(2);
ui->doubleSpinBoxShift->setDecimals(2);
break;
default: default:
break; break;
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::Label()
{
const int width = qFloor(UnitConvertor(ui->doubleSpinBoxPaperWidth->value(), PaperUnit(), Unit::Px));
const int height = qFloor(UnitConvertor(ui->doubleSpinBoxPaperHeight->value(), PaperUnit(), Unit::Px));
QString text = QString("%1 x %2 px, \n%3 ppi").arg(width).arg(height).arg(PrintDPI);
ui->labelSizeDescription->setText(text);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::MinimumPaperSize() void DialogLayoutSettings::MinimumPaperSize()
{ {
@ -819,8 +950,13 @@ void DialogLayoutSettings::ReadSettings()
SetAutoCrop(settings->GetLayoutAutoCrop()); SetAutoCrop(settings->GetLayoutAutoCrop());
SetSaveLength(settings->GetLayoutSaveLength()); SetSaveLength(settings->GetLayoutSaveLength());
SetUnitePages(settings->GetLayoutUnitePages()); SetUnitePages(settings->GetLayoutUnitePages());
SetFields(settings->GetFields());
SetIgnoreAllFields(settings->GetIgnoreAllFields());
FindTemplate(); FindTemplate();
CorrectMaxFileds();
IgnoreAllFields(ui->checkBoxIgnoreFileds->isChecked());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -837,6 +973,8 @@ void DialogLayoutSettings::WriteSettings() const
settings->SetLayoutAutoCrop(GetAutoCrop()); settings->SetLayoutAutoCrop(GetAutoCrop());
settings->SetLayoutSaveLength(IsSaveLength()); settings->SetLayoutSaveLength(IsSaveLength());
settings->SetLayoutUnitePages(IsUnitePages()); settings->SetLayoutUnitePages(IsUnitePages());
settings->SetFields(GetFields());
settings->SetIgnoreAllFields(IsIgnoreAllFields());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -35,6 +35,7 @@
#include "../vlayout/vbank.h" #include "../vlayout/vbank.h"
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
#include "../vlayout/vlayoutgenerator.h" #include "../vlayout/vlayoutgenerator.h"
#include "../vmisc/vmargins.h"
namespace Ui namespace Ui
{ {
@ -75,6 +76,9 @@ public:
qreal GetLayoutWidth() const; qreal GetLayoutWidth() const;
void SetLayoutWidth(qreal value); void SetLayoutWidth(qreal value);
QMarginsF GetFields() const;
void SetFields(const QMarginsF &value);
Cases GetGroup() const; Cases GetGroup() const;
void SetGroup(const Cases &value); void SetGroup(const Cases &value);
@ -93,6 +97,9 @@ public:
bool IsUnitePages() const; bool IsUnitePages() const;
void SetUnitePages(bool save); void SetUnitePages(bool save);
bool IsIgnoreAllFields() const;
void SetIgnoreAllFields(bool value);
//support functions for the command line parser which uses invisible dialog to properly build layout generator //support functions for the command line parser which uses invisible dialog to properly build layout generator
bool SelectTemplate(const PaperSizeTemplate& id); bool SelectTemplate(const PaperSizeTemplate& id);
static QString MakeHelpTemplateList(); static QString MakeHelpTemplateList();
@ -114,7 +121,9 @@ public slots:
void DialogAccepted(); void DialogAccepted();
void RestoreDefaults(); void RestoreDefaults();
private slots:
void CorrectMaxFileds();
void IgnoreAllFields(int state);
private: private:
Q_DISABLE_COPY(DialogLayoutSettings) Q_DISABLE_COPY(DialogLayoutSettings)
typedef QStringList FormatsVector; typedef QStringList FormatsVector;
@ -135,13 +144,13 @@ private:
QSizeF Template(); QSizeF Template();
QSizeF TemplateSize(const PaperSizeTemplate &tmpl) const; QSizeF TemplateSize(const PaperSizeTemplate &tmpl) const;
QSizeF RoundTemplateSize(qreal width, qreal height) const; QSizeF RoundTemplateSize(qreal width, qreal height) const;
QMarginsF RoundMargins(const QMarginsF &margins) const;
Unit PaperUnit() const; Unit PaperUnit() const;
Unit LayoutUnit() const; Unit LayoutUnit() const;
void CorrectPaperDecimals(); void CorrectPaperDecimals();
void CorrectLayoutDecimals(); void CorrectLayoutDecimals();
void Label();
void MinimumPaperSize(); void MinimumPaperSize();
void MinimumLayoutSize(); void MinimumLayoutSize();

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>661</width> <width>661</width>
<height>345</height> <height>453</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -23,12 +23,12 @@
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
<widget class="QGroupBox" name="groupBoxPaperSize"> <widget class="QGroupBox" name="groupBoxPaperFormat">
<property name="autoFillBackground"> <property name="autoFillBackground">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="title"> <property name="title">
<string>Paper size</string> <string>Paper format</string>
</property> </property>
<property name="flat"> <property name="flat">
<bool>false</bool> <bool>false</bool>
@ -72,22 +72,6 @@
</item> </item>
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<widget class="QComboBox" name="comboBoxPaperSizeUnit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>124</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="labelWidth"> <widget class="QLabel" name="labelWidth">
<property name="sizePolicy"> <property name="sizePolicy">
@ -146,14 +130,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="2" column="0">
<widget class="QLabel" name="labelSizeDescription">
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QToolButton" name="toolButtonPortrate"> <widget class="QToolButton" name="toolButtonPortrate">
@ -203,27 +180,163 @@
</item> </item>
</layout> </layout>
</item> </item>
</layout> <item row="2" column="1">
</item> <widget class="QComboBox" name="comboBoxPaperSizeUnit">
<item> <property name="sizePolicy">
<widget class="QCheckBox" name="checkBoxAutoCrop"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<property name="text"> <horstretch>0</horstretch>
<string>Auto crop unused length</string> <verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>124</width>
<height>0</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="checkBoxUnitePages"> <widget class="QGroupBox" name="groupBoxPaperFileds">
<property name="title">
<string>Fields</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelLeftField">
<property name="text"> <property name="text">
<string>Unite pages (if possible)</string> <string>Left:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxLeftField"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelRightField">
<property name="text">
<string>Right:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxRightField"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelTopField">
<property name="text">
<string>Top:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxTopField"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelBottomField">
<property name="text">
<string>Bottom:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxBottomField"/>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxIgnoreFileds">
<property name="text">
<string>Ignore fileds</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
</layout>
</item>
<item> <item>
<widget class="Line" name="line_2"> <widget class="QGroupBox" name="groupBoxCreationOptions">
<property name="title">
<string>Creation options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxLayoutWidth">
<property name="minimumSize">
<size>
<width>94</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>99999.990000000005239</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelLayoutWidth">
<property name="text">
<string>Gap width:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelShiftLength">
<property name="text">
<string>Shift length:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxShift">
<property name="minimumSize">
<size>
<width>94</width>
<height>0</height>
</size>
</property>
<property name="maximum">
<double>99999.990000000005239</double>
</property>
<property name="value">
<double>10.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="comboBoxLayoutUnit"/>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string notr="true">×2</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSaveLength">
<property name="text">
<string>Save length of the sheet</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -378,86 +491,8 @@
</layout> </layout>
</widget> </widget>
</item> </item>
</layout>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBoxCreationOptions"> <widget class="Line" name="line_2">
<property name="title">
<string>Creation options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxLayoutWidth">
<property name="minimumSize">
<size>
<width>94</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>99999.990000000005239</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelLayoutWidth">
<property name="text">
<string>Gap width:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelShiftLength">
<property name="text">
<string>Shift length:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxShift">
<property name="minimumSize">
<size>
<width>94</width>
<height>0</height>
</size>
</property>
<property name="maximum">
<double>99999.990000000005239</double>
</property>
<property name="value">
<double>10.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="comboBoxLayoutUnit"/>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string notr="true">×2</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxSaveLength">
<property name="text">
<string>Save length of the sheet</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -512,6 +547,27 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxAutoCrop">
<property name="text">
<string>Auto crop unused length</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUnitePages">
<property name="text">
<string>Unite pages (if possible)</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -567,7 +623,7 @@
</connection> </connection>
</connections> </connections>
<buttongroups> <buttongroups>
<buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroupPrinciple"/> <buttongroup name="buttonGroupPrinciple"/>
<buttongroup name="buttonGroup"/>
</buttongroups> </buttongroups>
</ui> </ui>

View File

@ -62,7 +62,7 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP())), doc(nullptr), papers(QList<QGraphicsItem *>()), pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP())), doc(nullptr), papers(QList<QGraphicsItem *>()),
shadows(QList<QGraphicsItem *>()), scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()), shadows(QList<QGraphicsItem *>()), scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()),
undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), curFile(QString()), undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), curFile(QString()),
isLayoutStale(true), isTiled(false) isLayoutStale(true), margins(), isTiled(false)
{ {
InitTempLayoutScene(); InitTempLayoutScene();
} }
@ -132,6 +132,7 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator)
CreateShadows(); CreateShadows();
CreateScenes(); CreateScenes();
PrepareSceneList(); PrepareSceneList();
margins = lGenerator.GetFields();
isLayoutStale = false; isLayoutStale = false;
break; break;
case LayoutErrors::ProcessStoped: case LayoutErrors::ProcessStoped:
@ -356,7 +357,7 @@ void MainWindowsNoGUI::PrintPages(QPrinter *printer)
{ {
index = lastPage - j; index = lastPage - j;
} }
painter.drawImage(QPointF(), poster.at(index)); painter.drawImage(QPointF(margins.left(), margins.top()), poster.at(index));
} }
} }
@ -789,28 +790,18 @@ void MainWindowsNoGUI::PrintPreview()
return; return;
} }
} }
QPrinterInfo def = QPrinterInfo::defaultPrinter();
//if there is no default printer set the print preview won't show QSharedPointer<QPrinter> printer = DefaultPrinter();
if(def.isNull() || def.printerName().isEmpty()) if (printer.isNull())
{
if(QPrinterInfo::availablePrinters().isEmpty())
{ {
qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")), qCritical("%s\n\n%s", qUtf8Printable(tr("Print error")),
qUtf8Printable(tr("Cannot proceed because there are no available printers in your system."))); qUtf8Printable(tr("Cannot proceed because there are no available printers in your system.")));
return; return;
} }
else
{
def = QPrinterInfo::availablePrinters().first();
}
}
QPrinter printer(def, QPrinter::ScreenResolution); SetPrinterSettings(printer.data());
printer.setResolution(static_cast<int>(PrintDPI));
SetPrinterSettings(&printer);
// display print preview dialog // display print preview dialog
QPrintPreviewDialog preview(&printer); QPrintPreviewDialog preview(printer.data());
connect(&preview, &QPrintPreviewDialog::paintRequested, this, &MainWindowsNoGUI::PrintPages); connect(&preview, &QPrintPreviewDialog::paintRequested, this, &MainWindowsNoGUI::PrintPages);
preview.exec(); preview.exec();
} }
@ -867,6 +858,14 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer)
FromPixel(paper->rect().height(), Unit::Mm)), QPrinter::Millimeter ); FromPixel(paper->rect().height(), Unit::Mm)), QPrinter::Millimeter );
} }
{
const qreal left = FromPixel(margins.left(), Unit::Mm);
const qreal top = FromPixel(margins.top(), Unit::Mm);
const qreal right = FromPixel(margins.right(), Unit::Mm);
const qreal bottom = FromPixel(margins.bottom(), Unit::Mm);
printer->setPageMargins(left, top, right, bottom, QPrinter::Millimeter);
}
printer->setOutputFileName(QDir::homePath() + QDir::separator() + FileName() + QLatin1Literal(".pdf")); printer->setOutputFileName(QDir::homePath() + QDir::separator() + FileName() + QLatin1Literal(".pdf"));
printer->setDocName(FileName()); printer->setDocName(FileName());

View File

@ -87,6 +87,7 @@ protected:
QString curFile; QString curFile;
bool isLayoutStale; bool isLayoutStale;
QMarginsF margins;
void PrepareDetailsForLayout(const QHash<quint32, VDetail> *details); void PrepareDetailsForLayout(const QHash<quint32, VDetail> *details);
void ExportLayout(const DialogSaveLayout &dialog); void ExportLayout(const DialogSaveLayout &dialog);

View File

@ -38,7 +38,7 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutGenerator::VLayoutGenerator(QObject *parent) VLayoutGenerator::VLayoutGenerator(QObject *parent)
:QObject(parent), papers(QVector<VLayoutPaper>()), bank(new VBank()), paperHeight(0), paperWidth(0), :QObject(parent), papers(QVector<VLayoutPaper>()), bank(new VBank()), paperHeight(0), paperWidth(0), margins(),
stopGeneration(false), state(LayoutErrors::NoError), shift(0), rotate(true), rotationIncrease(180), stopGeneration(false), state(LayoutErrors::NoError), shift(0), rotate(true), rotationIncrease(180),
autoCrop(false), saveLength(false), unitePages(false) autoCrop(false), saveLength(false), unitePages(false)
{} {}
@ -99,7 +99,7 @@ void VLayoutGenerator::Generate()
break; break;
} }
VLayoutPaper paper(paperHeight, paperWidth); VLayoutPaper paper(PageHeight(), PageWidth());
paper.SetShift(shift); paper.SetShift(shift);
paper.SetLayoutWidth(bank->GetLayoutWidth()); paper.SetLayoutWidth(bank->GetLayoutWidth());
paper.SetPaperIndex(static_cast<quint32>(papers.count())); paper.SetPaperIndex(static_cast<quint32>(papers.count()));
@ -189,6 +189,18 @@ void VLayoutGenerator::Abort()
#endif #endif
} }
//---------------------------------------------------------------------------------------------------------------------
int VLayoutGenerator::PageHeight() const
{
return paperHeight - static_cast<int>(margins.top() + margins.bottom());
}
//---------------------------------------------------------------------------------------------------------------------
int VLayoutGenerator::PageWidth() const
{
return paperWidth - static_cast<int>(margins.left() + margins.right());
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VLayoutGenerator::IsUnitePages() const bool VLayoutGenerator::IsUnitePages() const
{ {
@ -267,6 +279,18 @@ void VLayoutGenerator::SetPaperWidth(int value)
paperWidth = value; paperWidth = value;
} }
//---------------------------------------------------------------------------------------------------------------------
QMarginsF VLayoutGenerator::GetFields() const
{
return margins;
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutGenerator::SetFields(const QMarginsF &value)
{
margins = value;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 VLayoutGenerator::GetShift() const quint32 VLayoutGenerator::GetShift() const
{ {

View File

@ -34,6 +34,7 @@
#include "vlayoutdef.h" #include "vlayoutdef.h"
#include "vbank.h" #include "vbank.h"
#include "../vmisc/vmargins.h"
#include <memory> #include <memory>
class VLayoutPaper; class VLayoutPaper;
@ -58,6 +59,9 @@ public:
int GetPaperWidth() const; int GetPaperWidth() const;
void SetPaperWidth(int value); void SetPaperWidth(int value);
QMarginsF GetFields() const;
void SetFields(const QMarginsF &value);
quint32 GetShift() const; quint32 GetShift() const;
void SetShift(quint32 shift); void SetShift(quint32 shift);
@ -98,6 +102,7 @@ private:
VBank *bank; VBank *bank;
int paperHeight; int paperHeight;
int paperWidth; int paperWidth;
QMarginsF margins;
volatile bool stopGeneration; volatile bool stopGeneration;
LayoutErrors state; LayoutErrors state;
quint32 shift; quint32 shift;
@ -106,6 +111,9 @@ private:
bool autoCrop; bool autoCrop;
bool saveLength; bool saveLength;
bool unitePages; bool unitePages;
int PageHeight() const;
int PageWidth() const;
}; };
typedef std::shared_ptr<VLayoutGenerator> VLayoutGeneratorPtr; typedef std::shared_ptr<VLayoutGenerator> VLayoutGeneratorPtr;

View File

@ -244,10 +244,10 @@ QImage VPoster::Borders(int rows, int colomns, int i, int j, QImage &image, int
QRect VPoster::PageRect() const QRect VPoster::PageRect() const
{ {
// Because the Point unit is defined to be 1/72th of an inch // Because the Point unit is defined to be 1/72th of an inch
// we can't use method pageRect(QPrinter::Point). Our dpi different can be different. // we can't use method pageRect(QPrinter::Point). Our dpi value can be different.
// We convert value yourself to pixels. // We convert value yourself to pixels.
const QRectF rect = printer->pageRect(QPrinter::Millimeter); const QRectF rect = printer->pageRect(QPrinter::Millimeter);
QRect pageRect(qFloor(ToPixel(rect.x())), qFloor(ToPixel(rect.y())), qFloor(ToPixel(rect.width())), const QRect pageRect(qFloor(ToPixel(rect.x())), qFloor(ToPixel(rect.y())), qFloor(ToPixel(rect.width())),
qFloor(ToPixel(rect.height()))); qFloor(ToPixel(rect.height())));
return pageRect; return pageRect;
} }

View File

@ -0,0 +1,374 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qmarginsf.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
#include <QDataStream>
#include <QDebug>
/*!
\class QMarginsF
\inmodule QtCore
\ingroup painting
\since 5.3
\brief The QMarginsF class defines the four margins of a rectangle.
QMarginsF defines a set of four margins; left, top, right and bottom,
that describe the size of the borders surrounding a rectangle.
The isNull() function returns \c true only if all margins are set to zero.
QMarginsF objects can be streamed as well as compared.
*/
/*****************************************************************************
QMarginsF member functions
*****************************************************************************/
/*!
\fn QMarginsF::QMarginsF()
Constructs a margins object with all margins set to 0.
\sa isNull()
*/
/*!
\fn QMarginsF::QMarginsF(qreal left, qreal top, qreal right, qreal bottom)
Constructs margins with the given \a left, \a top, \a right, \a bottom
\sa setLeft(), setRight(), setTop(), setBottom()
*/
/*!
\fn QMarginsF::QMarginsF(const QMargins &margins)
Constructs margins copied from the given \a margins
*/
/*!
\fn bool QMarginsF::isNull() const
Returns \c true if all margins are 0; otherwise returns
false.
*/
/*!
\fn qreal QMarginsF::left() const
Returns the left margin.
\sa setLeft()
*/
/*!
\fn qreal QMarginsF::top() const
Returns the top margin.
\sa setTop()
*/
/*!
\fn qreal QMarginsF::right() const
Returns the right margin.
*/
/*!
\fn qreal QMarginsF::bottom() const
Returns the bottom margin.
*/
/*!
\fn void QMarginsF::setLeft(qreal left)
Sets the left margin to \a left.
*/
/*!
\fn void QMarginsF::setTop(qreal Top)
Sets the Top margin to \a Top.
*/
/*!
\fn void QMarginsF::setRight(qreal right)
Sets the right margin to \a right.
*/
/*!
\fn void QMarginsF::setBottom(qreal bottom)
Sets the bottom margin to \a bottom.
*/
/*!
\fn bool operator==(const QMarginsF &lhs, const QMarginsF &rhs)
\relates QMarginsF
Returns \c true if \a lhs and \a rhs are equal; otherwise returns \c false.
*/
/*!
\fn bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs)
\relates QMarginsF
Returns \c true if \a lhs and \a rhs are different; otherwise returns \c false.
*/
/*!
\fn const QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs)
\relates QMarginsF
Returns a QMarginsF object that is the sum of the given margins, \a lhs
and \a rhs; each component is added separately.
\sa QMarginsF::operator+=(), QMarginsF::operator-=()
*/
/*!
\fn const QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs)
\relates QMarginsF
Returns a QMarginsF object that is formed by subtracting \a rhs from
\a lhs; each component is subtracted separately.
\sa QMarginsF::operator+=(), QMarginsF::operator-=()
*/
/*!
\fn const QMarginsF operator+(const QMarginsF &lhs, qreal rhs)
\relates QMarginsF
Returns a QMarginsF object that is formed by adding \a rhs to
\a lhs.
\sa QMarginsF::operator+=(), QMarginsF::operator-=()
*/
/*!
\fn const QMarginsF operator+(qreal lhs, const QMarginsF &rhs)
\relates QMarginsF
Returns a QMarginsF object that is formed by adding \a lhs to
\a rhs.
\sa QMarginsF::operator+=(), QMarginsF::operator-=()
*/
/*!
\fn const QMarginsF operator-(const QMarginsF &lhs, qreal rhs)
\relates QMarginsF
Returns a QMarginsF object that is formed by subtracting \a rhs from
\a lhs.
\sa QMarginsF::operator+=(), QMarginsF::operator-=()
*/
/*!
\fn const QMarginsF operator*(const QMarginsF &lhs, qreal rhs)
\relates QMarginsF
\overload
Returns a QMarginsF object that is formed by multiplying each component
of the given \a lhs margins by \a rhs factor.
\sa QMarginsF::operator*=(), QMarginsF::operator/=()
*/
/*!
\fn const QMarginsF operator*(qreal lhs, const QMarginsF &rhs)
\relates QMarginsF
\overload
Returns a QMarginsF object that is formed by multiplying each component
of the given \a lhs margins by \a rhs factor.
\sa QMarginsF::operator*=(), QMarginsF::operator/=()
*/
/*!
\fn const QMarginsF operator/(const QMarginsF &lhs, qreal rhs)
\relates QMarginsF
\overload
Returns a QMarginsF object that is formed by dividing the components of
the given \a lhs margins by the given \a rhs divisor.
\sa QMarginsF::operator*=(), QMarginsF::operator/=()
*/
/*!
\fn QMarginsF operator+(const QMarginsF &margins)
\relates QMarginsF
Returns a QMargin object that is formed from all components of \a margins.
*/
/*!
\fn QMarginsF operator-(const QMarginsF &margins)
\relates QMarginsF
Returns a QMargin object that is formed by negating all components of \a margins.
*/
/*!
\fn QMarginsF &QMarginsF::operator+=(const QMarginsF &margins)
Add each component of \a margins to the respective component of this object
and returns a reference to it.
\sa operator-=()
*/
/*!
\fn QMarginsF &QMarginsF::operator-=(const QMarginsF &margins)
Subtract each component of \a margins from the respective component of this object
and returns a reference to it.
\sa operator+=()
*/
/*!
\fn QMarginsF &QMarginsF::operator+=(qreal addend)
\overload
Adds the \a addend to each component of this object
and returns a reference to it.
\sa operator-=()
*/
/*!
\fn QMarginsF &QMarginsF::operator-=(qreal subtrahend)
\overload
Subtracts the \a subtrahend from each component of this object
and returns a reference to it.
\sa operator+=()
*/
/*!
\fn QMarginsF &QMarginsF::operator*=(qreal factor)
Multiplies each component of this object by \a factor
and returns a reference to it.
\sa operator/=()
*/
/*!
\fn QMarginsF &QMarginsF::operator/=(qreal divisor)
Divides each component of this object by \a divisor
and returns a reference to it.
\sa operator*=()
*/
/*!
\fn QMargins QMarginsF::toMargins() const
Returns an integer based copy of this margins object.
Note that the components in the returned margins will be rounded to
the nearest integer.
\sa QMarginsF()
*/
/*****************************************************************************
QMarginsF stream functions
*****************************************************************************/
#ifndef QT_NO_DATASTREAM
/*!
\fn QDataStream &operator<<(QDataStream &stream, const QMarginsF &m)
\relates QMarginsF
Writes margin \a m to the given \a stream and returns a
reference to the stream.
\sa {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &s, const QMarginsF &m)
{
s << double(m.left()) << double(m.top()) << double(m.right()) << double(m.bottom());
return s;
}
/*!
\fn QDataStream &operator>>(QDataStream &stream, QMarginsF &m)
\relates QMarginsF
Reads a margin from the given \a stream into margin \a m
and returns a reference to the stream.
\sa {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &s, QMarginsF &m)
{
double left, top, right, bottom;
s >> left;
s >> top;
s >> right;
s >> bottom;
m = QMarginsF(qreal(left), qreal(top), qreal(right), qreal(bottom));
return s;
}
#endif // QT_NO_DATASTREAM
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QMarginsF &m)
{
QDebugStateSaver saver(dbg);
dbg.nospace();
dbg << "QMarginsF" << '(';
dbg << m.left() << ", " << m.top() << ", " << m.right() << ", " << m.bottom();
dbg << ')';
return dbg;
}
#endif
#endif // QT_VERSION < QT_VERSION_CHECK(5, 3, 0)

View File

@ -0,0 +1,251 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QMARGINSF_H
#define QMARGINSF_H
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
#include <QMargins>
/*****************************************************************************
QMarginsF class
*****************************************************************************/
class QMarginsF
{
public:
Q_DECL_CONSTEXPR QMarginsF() Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR QMarginsF(qreal left, qreal top, qreal right, qreal bottom) Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR QMarginsF(const QMargins &margins) Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR bool isNull() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR qreal left() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR qreal top() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR qreal right() const Q_DECL_NOTHROW;
Q_DECL_CONSTEXPR qreal bottom() const Q_DECL_NOTHROW;
void setLeft(qreal left) Q_DECL_NOTHROW;
void setTop(qreal top) Q_DECL_NOTHROW;
void setRight(qreal right) Q_DECL_NOTHROW;
void setBottom(qreal bottom) Q_DECL_NOTHROW;
QMarginsF &operator+=(const QMarginsF &margins) Q_DECL_NOTHROW;
QMarginsF &operator-=(const QMarginsF &margins) Q_DECL_NOTHROW;
QMarginsF &operator+=(qreal addend) Q_DECL_NOTHROW;
QMarginsF &operator-=(qreal subtrahend) Q_DECL_NOTHROW;
QMarginsF &operator*=(qreal factor) Q_DECL_NOTHROW;
QMarginsF &operator/=(qreal divisor);
Q_DECL_CONSTEXPR inline QMargins toMargins() const Q_DECL_NOTHROW;
private:
qreal m_left;
qreal m_top;
qreal m_right;
qreal m_bottom;
};
Q_DECLARE_TYPEINFO(QMarginsF, Q_MOVABLE_TYPE);
/*****************************************************************************
QMarginsF stream functions
*****************************************************************************/
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QMarginsF &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QMarginsF &);
#endif
/*****************************************************************************
QMarginsF inline functions
*****************************************************************************/
Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF() Q_DECL_NOTHROW
: m_left(0), m_top(0), m_right(0), m_bottom(0) {}
Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF(qreal aleft, qreal atop, qreal aright, qreal abottom) Q_DECL_NOTHROW
: m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {}
Q_DECL_CONSTEXPR inline QMarginsF::QMarginsF(const QMargins &margins) Q_DECL_NOTHROW
: m_left(margins.left()), m_top(margins.top()), m_right(margins.right()), m_bottom(margins.bottom()) {}
Q_DECL_CONSTEXPR inline bool QMarginsF::isNull() const Q_DECL_NOTHROW
{ return qFuzzyIsNull(m_left) && qFuzzyIsNull(m_top) && qFuzzyIsNull(m_right) && qFuzzyIsNull(m_bottom); }
Q_DECL_CONSTEXPR inline qreal QMarginsF::left() const Q_DECL_NOTHROW
{ return m_left; }
Q_DECL_CONSTEXPR inline qreal QMarginsF::top() const Q_DECL_NOTHROW
{ return m_top; }
Q_DECL_CONSTEXPR inline qreal QMarginsF::right() const Q_DECL_NOTHROW
{ return m_right; }
Q_DECL_CONSTEXPR inline qreal QMarginsF::bottom() const Q_DECL_NOTHROW
{ return m_bottom; }
inline void QMarginsF::setLeft(qreal aleft) Q_DECL_NOTHROW
{ m_left = aleft; }
inline void QMarginsF::setTop(qreal atop) Q_DECL_NOTHROW
{ m_top = atop; }
inline void QMarginsF::setRight(qreal aright) Q_DECL_NOTHROW
{ m_right = aright; }
inline void QMarginsF::setBottom(qreal abottom) Q_DECL_NOTHROW
{ m_bottom = abottom; }
Q_DECL_CONSTEXPR inline bool operator==(const QMarginsF &lhs, const QMarginsF &rhs) Q_DECL_NOTHROW
{
return qFuzzyCompare(lhs.left(), rhs.left())
&& qFuzzyCompare(lhs.top(), rhs.top())
&& qFuzzyCompare(lhs.right(), rhs.right())
&& qFuzzyCompare(lhs.bottom(), rhs.bottom());
}
Q_DECL_CONSTEXPR inline bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs) Q_DECL_NOTHROW
{
return !operator==(lhs, rhs);
}
Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs) Q_DECL_NOTHROW
{
return QMarginsF(lhs.left() + rhs.left(), lhs.top() + rhs.top(),
lhs.right() + rhs.right(), lhs.bottom() + rhs.bottom());
}
Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs) Q_DECL_NOTHROW
{
return QMarginsF(lhs.left() - rhs.left(), lhs.top() - rhs.top(),
lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom());
}
Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &lhs, qreal rhs) Q_DECL_NOTHROW
{
return QMarginsF(lhs.left() + rhs, lhs.top() + rhs,
lhs.right() + rhs, lhs.bottom() + rhs);
}
Q_DECL_CONSTEXPR inline QMarginsF operator+(qreal lhs, const QMarginsF &rhs) Q_DECL_NOTHROW
{
return QMarginsF(rhs.left() + lhs, rhs.top() + lhs,
rhs.right() + lhs, rhs.bottom() + lhs);
}
Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &lhs, qreal rhs) Q_DECL_NOTHROW
{
return QMarginsF(lhs.left() - rhs, lhs.top() - rhs,
lhs.right() - rhs, lhs.bottom() - rhs);
}
Q_DECL_CONSTEXPR inline QMarginsF operator*(const QMarginsF &lhs, qreal rhs) Q_DECL_NOTHROW
{
return QMarginsF(lhs.left() * rhs, lhs.top() * rhs,
lhs.right() * rhs, lhs.bottom() * rhs);
}
Q_DECL_CONSTEXPR inline QMarginsF operator*(qreal lhs, const QMarginsF &rhs) Q_DECL_NOTHROW
{
return QMarginsF(rhs.left() * lhs, rhs.top() * lhs,
rhs.right() * lhs, rhs.bottom() * lhs);
}
Q_DECL_CONSTEXPR inline QMarginsF operator/(const QMarginsF &lhs, qreal divisor)
{
return QMarginsF(lhs.left() / divisor, lhs.top() / divisor,
lhs.right() / divisor, lhs.bottom() / divisor);
}
inline QMarginsF &QMarginsF::operator+=(const QMarginsF &margins) Q_DECL_NOTHROW
{
return *this = *this + margins;
}
inline QMarginsF &QMarginsF::operator-=(const QMarginsF &margins) Q_DECL_NOTHROW
{
return *this = *this - margins;
}
inline QMarginsF &QMarginsF::operator+=(qreal addend) Q_DECL_NOTHROW
{
m_left += addend;
m_top += addend;
m_right += addend;
m_bottom += addend;
return *this;
}
inline QMarginsF &QMarginsF::operator-=(qreal subtrahend) Q_DECL_NOTHROW
{
m_left -= subtrahend;
m_top -= subtrahend;
m_right -= subtrahend;
m_bottom -= subtrahend;
return *this;
}
inline QMarginsF &QMarginsF::operator*=(qreal factor) Q_DECL_NOTHROW
{
return *this = *this * factor;
}
inline QMarginsF &QMarginsF::operator/=(qreal divisor)
{
return *this = *this / divisor;
}
Q_DECL_CONSTEXPR inline QMarginsF operator+(const QMarginsF &margins) Q_DECL_NOTHROW
{
return margins;
}
Q_DECL_CONSTEXPR inline QMarginsF operator-(const QMarginsF &margins) Q_DECL_NOTHROW
{
return QMarginsF(-margins.left(), -margins.top(), -margins.right(), -margins.bottom());
}
Q_DECL_CONSTEXPR inline QMargins QMarginsF::toMargins() const Q_DECL_NOTHROW
{
return QMargins(qRound(m_left), qRound(m_top), qRound(m_right), qRound(m_bottom));
}
#ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDebug operator<<(QDebug, const QMarginsF &);
#endif
#endif // QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
#endif // QMARGINSF_H

View File

@ -32,6 +32,7 @@
#include <QComboBox> #include <QComboBox>
#include <QDir> #include <QDir>
#include <QPrinterInfo>
// Keep synchronize all names with initialization in VTranslateVars class!!!!! // Keep synchronize all names with initialization in VTranslateVars class!!!!!
//measurements //measurements
@ -1719,3 +1720,26 @@ QString AbsoluteMPath(const QString &patternPath, const QString &relativeMPath)
return QString();// should never reach return QString();// should never reach
} }
//---------------------------------------------------------------------------------------------------------------------
QSharedPointer<QPrinter> DefaultPrinter()
{
QPrinterInfo def = QPrinterInfo::defaultPrinter();
//if there is no default printer set the print preview won't show
if(def.isNull() || def.printerName().isEmpty())
{
if(QPrinterInfo::availablePrinters().isEmpty())
{
return QSharedPointer<QPrinter>();
}
else
{
def = QPrinterInfo::availablePrinters().first();
}
}
QSharedPointer<QPrinter> printer = QSharedPointer<QPrinter>(new QPrinter(def, QPrinter::ScreenResolution));
printer->setResolution(static_cast<int>(PrintDPI));
return printer;
}

View File

@ -43,6 +43,7 @@
#endif /* Q_CC_MSVC */ #endif /* Q_CC_MSVC */
class QComboBox; class QComboBox;
class QPrinter;
#define SceneSize 50000 #define SceneSize 50000
#define DefPointRadius 1.5//mm #define DefPointRadius 1.5//mm
@ -591,4 +592,6 @@ QString StrippedName(const QString &fullFileName);
QString RelativeMPath(const QString &patternPath, const QString &absoluteMPath); QString RelativeMPath(const QString &patternPath, const QString &absoluteMPath);
QString AbsoluteMPath(const QString &patternPath, const QString &relativeMPath); QString AbsoluteMPath(const QString &patternPath, const QString &relativeMPath);
QSharedPointer<QPrinter> DefaultPrinter();
#endif // DEF_H #endif // DEF_H

43
src/libs/vmisc/vmargins.h Normal file
View File

@ -0,0 +1,43 @@
/************************************************************************
**
** @file vmargins.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 7 11, 2015
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef VMARGINS_H
#define VMARGINS_H
#include <QtGlobal>
#include <QMetaType>
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
# include "backport/qmarginsf.h"
#else
# include <QMargins>
#endif
Q_DECLARE_METATYPE(QMarginsF)
#endif // VMARGINS_H

View File

@ -10,7 +10,8 @@ SOURCES += \
$$PWD/vabstractapplication.cpp \ $$PWD/vabstractapplication.cpp \
$$PWD/projectversion.cpp \ $$PWD/projectversion.cpp \
$$PWD/vcommonsettings.cpp \ $$PWD/vcommonsettings.cpp \
$$PWD/vtapesettings.cpp $$PWD/vtapesettings.cpp \
$$PWD/backport/qmarginsf.cpp
win32-msvc*:SOURCES += $$PWD/stable.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp
@ -29,4 +30,6 @@ HEADERS += \
$$PWD/vtapesettings.h \ $$PWD/vtapesettings.h \
$$PWD/debugbreak.h \ $$PWD/debugbreak.h \
$$PWD/vlockguard.h \ $$PWD/vlockguard.h \
$$PWD/vsysexits.h $$PWD/vsysexits.h \
$$PWD/backport/qmarginsf.h \
$$PWD/vmargins.h

View File

@ -7,7 +7,7 @@
# File with common stuff for whole project # File with common stuff for whole project
include(../../../common.pri) include(../../../common.pri)
QT += widgets QT += widgets printsupport
# Name of library # Name of library
TARGET = vmisc TARGET = vmisc

View File

@ -32,6 +32,8 @@
#include <QDebug> #include <QDebug>
#include <QLocale> #include <QLocale>
#include <QApplication> #include <QApplication>
#include <QPrinter>
#include <QSharedPointer>
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
@ -69,12 +71,16 @@ const QString VSettings::SettingLayoutRotationIncrease = QStringLitera
const QString VSettings::SettingLayoutAutoCrop = QStringLiteral("layout/autoCrop"); const QString VSettings::SettingLayoutAutoCrop = QStringLiteral("layout/autoCrop");
const QString VSettings::SettingLayoutSaveLength = QStringLiteral("layout/saveLength"); const QString VSettings::SettingLayoutSaveLength = QStringLiteral("layout/saveLength");
const QString VSettings::SettingLayoutUnitePages = QStringLiteral("layout/unitePages"); const QString VSettings::SettingLayoutUnitePages = QStringLiteral("layout/unitePages");
const QString VSettings::SettingFields = QStringLiteral("layout/fields");
const QString VSettings::SettingIgnoreFields = QStringLiteral("layout/ignoreFields");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSettings::VSettings(Format format, Scope scope, const QString &organization, const QString &application, VSettings::VSettings(Format format, Scope scope, const QString &organization, const QString &application,
QObject *parent) QObject *parent)
:VCommonSettings(format, scope, organization, application, parent) :VCommonSettings(format, scope, organization, application, parent)
{} {
qRegisterMetaTypeStreamOperators<QMarginsF>("QMarginsF");
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetLabelLanguage() const QString VSettings::GetLabelLanguage() const
@ -350,6 +356,49 @@ void VSettings::SetLayoutWidth(qreal value)
setValue(SettingLayoutWidth, value); setValue(SettingLayoutWidth, value);
} }
//---------------------------------------------------------------------------------------------------------------------
QMarginsF VSettings::GetFields() const
{
const QMarginsF def = GetDefFields();
const QVariant val = value(SettingFields, QVariant::fromValue(def));
if (val.canConvert<QMarginsF>())
{
return val.value<QMarginsF>();
}
return def;
}
//---------------------------------------------------------------------------------------------------------------------
QMarginsF VSettings::GetDefFields()
{
QSharedPointer<QPrinter> printer = DefaultPrinter();
if (printer.isNull())
{
return QMarginsF();
}
qreal left = 0;
qreal top = 0;
qreal right = 0;
qreal bottom = 0;
printer->getPageMargins(&left, &top, &right, &bottom, QPrinter::Millimeter);
// We can't use Unit::Px because our dpi in most cases is different
QMarginsF def;
def.setLeft(UnitConvertor(left, Unit::Mm, Unit::Px));
def.setRight(UnitConvertor(right, Unit::Mm, Unit::Px));
def.setTop(UnitConvertor(top, Unit::Mm, Unit::Px));
def.setBottom(UnitConvertor(bottom, Unit::Mm, Unit::Px));
return def;
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetFields(const QMarginsF &value)
{
QVariant val = QVariant::fromValue(value);
QString str = val.toString();
setValue(SettingFields, val);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
Cases VSettings::GetLayoutGroup() const Cases VSettings::GetLayoutGroup() const
{ {
@ -441,7 +490,13 @@ void VSettings::SetLayoutRotationIncrease(int value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutAutoCrop() const bool VSettings::GetLayoutAutoCrop() const
{ {
return value(SettingLayoutAutoCrop, false).toBool(); return value(SettingLayoutAutoCrop, GetDefLayoutAutoCrop()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetDefLayoutAutoCrop()
{
return false;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -453,7 +508,13 @@ void VSettings::SetLayoutAutoCrop(bool value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutSaveLength() const bool VSettings::GetLayoutSaveLength() const
{ {
return value(SettingLayoutSaveLength, false).toBool(); return value(SettingLayoutSaveLength, GetDefLayoutSaveLength()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetDefLayoutSaveLength()
{
return false;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -465,7 +526,13 @@ void VSettings::SetLayoutSaveLength(bool value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutUnitePages() const bool VSettings::GetLayoutUnitePages() const
{ {
return value(SettingLayoutUnitePages, false).toBool(); return value(SettingLayoutUnitePages, GetDefLayoutUnitePages()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetDefLayoutUnitePages()
{
return false;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -474,6 +541,24 @@ void VSettings::SetLayoutUnitePages(bool value)
setValue(SettingLayoutUnitePages, value); setValue(SettingLayoutUnitePages, value);
} }
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetIgnoreAllFields() const
{
return value(SettingIgnoreFields, GetDefIgnoreAllFields()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetDefIgnoreAllFields()
{
return false;
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetIgnoreAllFields(bool value)
{
setValue(SettingIgnoreFields, value);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VSettings::StandardTablesPath() const QString VSettings::StandardTablesPath() const
{ {

View File

@ -32,6 +32,8 @@
#include "vcommonsettings.h" #include "vcommonsettings.h"
#include "../vlayout/vbank.h" #include "../vlayout/vbank.h"
#include "../vmisc/vmargins.h"
class VSettings : public VCommonSettings class VSettings : public VCommonSettings
{ {
Q_OBJECT Q_OBJECT
@ -83,6 +85,7 @@ public:
QString GetUserPassword() const; QString GetUserPassword() const;
void SetUserPassword(const QString &value); void SetUserPassword(const QString &value);
// Layout settings
qreal GetLayoutPaperHeight() const; qreal GetLayoutPaperHeight() const;
void SetLayoutPaperHeight(qreal value); void SetLayoutPaperHeight(qreal value);
@ -97,6 +100,10 @@ public:
static qreal GetDefLayoutWidth(); static qreal GetDefLayoutWidth();
void SetLayoutWidth(qreal value); void SetLayoutWidth(qreal value);
QMarginsF GetFields() const;
static QMarginsF GetDefFields();
void SetFields(const QMarginsF &value);
Cases GetLayoutGroup() const; Cases GetLayoutGroup() const;
static Cases GetDefLayoutGroup(); static Cases GetDefLayoutGroup();
void SetLayoutGroup(const Cases &value); void SetLayoutGroup(const Cases &value);
@ -110,14 +117,21 @@ public:
void SetLayoutRotationIncrease(int value); void SetLayoutRotationIncrease(int value);
bool GetLayoutAutoCrop() const; bool GetLayoutAutoCrop() const;
static bool GetDefLayoutAutoCrop();
void SetLayoutAutoCrop(bool value); void SetLayoutAutoCrop(bool value);
bool GetLayoutSaveLength() const; bool GetLayoutSaveLength() const;
static bool GetDefLayoutSaveLength();
void SetLayoutSaveLength(bool value); void SetLayoutSaveLength(bool value);
bool GetLayoutUnitePages() const; bool GetLayoutUnitePages() const;
static bool GetDefLayoutUnitePages();
void SetLayoutUnitePages(bool value); void SetLayoutUnitePages(bool value);
bool GetIgnoreAllFields() const;
static bool GetDefIgnoreAllFields();
void SetIgnoreAllFields(bool value);
private: private:
Q_DISABLE_COPY(VSettings) Q_DISABLE_COPY(VSettings)
static const QString SettingConfigurationLabelLanguage; static const QString SettingConfigurationLabelLanguage;
@ -148,6 +162,8 @@ private:
static const QString SettingLayoutAutoCrop; static const QString SettingLayoutAutoCrop;
static const QString SettingLayoutSaveLength; static const QString SettingLayoutSaveLength;
static const QString SettingLayoutUnitePages; static const QString SettingLayoutUnitePages;
static const QString SettingFields;
static const QString SettingIgnoreFields;
}; };
#endif // VSETTINGS_H #endif // VSETTINGS_H