2015-01-14 15:14:51 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file dialoglayoutsettings.cpp
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 13 1, 2015
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2015-01-14 15:14:51 +01:00
|
|
|
** <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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "dialoglayoutsettings.h"
|
|
|
|
#include "ui_dialoglayoutsettings.h"
|
2015-06-19 13:21:46 +02:00
|
|
|
#include "../core/vapplication.h"
|
2015-01-14 15:14:51 +01:00
|
|
|
#include "../../libs/ifc/xml/vdomdocument.h"
|
2015-06-15 15:24:57 +02:00
|
|
|
#include "../../libs/vmisc/vsettings.h"
|
2015-08-25 19:53:03 +02:00
|
|
|
#include <vector>
|
2015-01-14 15:14:51 +01:00
|
|
|
|
2015-04-01 20:21:24 +02:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
2015-06-15 14:02:42 +02:00
|
|
|
# include "../../libs/vmisc/vmath.h"
|
2015-04-01 20:21:24 +02:00
|
|
|
#else
|
|
|
|
# include <QtMath>
|
|
|
|
#endif
|
|
|
|
|
2015-05-31 12:00:16 +02:00
|
|
|
#include <QPushButton>
|
|
|
|
|
2015-08-25 19:53:03 +02:00
|
|
|
//must be the same order as PaperSizeTemplate constants
|
|
|
|
const DialogLayoutSettings::FormatsVector DialogLayoutSettings::pageFormatNames={
|
|
|
|
"A0",
|
|
|
|
"A1",
|
|
|
|
"A2",
|
|
|
|
"A3",
|
|
|
|
"A4",
|
|
|
|
tr("Letter"),
|
|
|
|
tr("Legal"),
|
|
|
|
tr("Roll 24in"),
|
|
|
|
tr("Roll 30in"),
|
|
|
|
tr("Roll 36in"),
|
|
|
|
tr("Roll 42in"),
|
|
|
|
tr("Roll 44in"),
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-09-13 12:07:12 +02:00
|
|
|
DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent, bool disableSettings)
|
|
|
|
: QDialog(parent), disableSettings(disableSettings), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm),
|
|
|
|
oldLayoutUnit(Unit::Mm), generator(generator)
|
2015-01-14 15:14:51 +01:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2015-02-10 20:27:11 +01:00
|
|
|
|
2015-07-24 14:06:53 +02:00
|
|
|
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
2015-02-10 20:27:11 +01:00
|
|
|
|
2015-09-13 12:07:12 +02:00
|
|
|
//moved from ReadSettings - well...it seems it can be done once only (i.e. constructor) because Init funcs dont
|
|
|
|
//even cleanse lists before adding
|
2015-08-25 19:53:03 +02:00
|
|
|
InitPaperUnits();
|
|
|
|
InitLayoutUnits();
|
|
|
|
InitTemplates();
|
|
|
|
MinimumPaperSize();
|
|
|
|
MinimumLayoutSize();
|
|
|
|
|
|
|
|
//in export console mode going to use defaults
|
2015-09-13 12:07:12 +02:00
|
|
|
if (disableSettings == false)
|
2015-08-25 19:53:03 +02:00
|
|
|
{
|
|
|
|
ReadSettings();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RestoreDefaults();
|
|
|
|
}
|
|
|
|
|
2015-01-14 15:14:51 +01:00
|
|
|
|
|
|
|
connect(ui->comboBoxTemplates, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
this, &DialogLayoutSettings::TemplateSelected);
|
|
|
|
connect(ui->comboBoxPaperSizeUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
this, &DialogLayoutSettings::ConvertPaperSize);
|
|
|
|
connect(ui->doubleSpinBoxPaperWidth, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
|
|
|
this, &DialogLayoutSettings::PaperSizeChanged);
|
|
|
|
connect(ui->doubleSpinBoxPaperHeight, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
|
|
|
this, &DialogLayoutSettings::PaperSizeChanged);
|
|
|
|
connect(ui->toolButtonPortrate, &QToolButton::toggled, this, &DialogLayoutSettings::Swap);
|
|
|
|
connect(ui->toolButtonLandscape, &QToolButton::toggled, this, &DialogLayoutSettings::Swap);
|
|
|
|
connect(ui->comboBoxLayoutUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
this, &DialogLayoutSettings::ConvertLayoutSize);
|
2015-05-02 18:21:47 +02:00
|
|
|
|
|
|
|
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
|
|
|
connect(bOk, &QPushButton::clicked, this, &DialogLayoutSettings::DialogAccepted);
|
2015-05-08 16:24:20 +02:00
|
|
|
|
|
|
|
QPushButton *bRestoreDefaults = ui->buttonBox->button(QDialogButtonBox::RestoreDefaults);
|
|
|
|
connect(bRestoreDefaults, &QPushButton::clicked, this, &DialogLayoutSettings::RestoreDefaults);
|
2015-06-25 09:05:19 +02:00
|
|
|
|
|
|
|
setMaximumSize(size());
|
|
|
|
setMinimumSize(size());
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
DialogLayoutSettings::~DialogLayoutSettings()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
int DialogLayoutSettings::GetPaperHeight() const
|
|
|
|
{
|
2015-06-12 10:55:44 +02:00
|
|
|
return qFloor(UnitConvertor(ui->doubleSpinBoxPaperHeight->value(), oldPaperUnit, Unit::Px));
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::SetPaperHeight(int value)
|
|
|
|
{
|
2015-06-12 10:55:44 +02:00
|
|
|
ui->doubleSpinBoxPaperHeight->setValue(UnitConvertor(value, Unit::Px, PaperUnit()));
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
int DialogLayoutSettings::GetPaperWidth() const
|
|
|
|
{
|
2015-06-12 10:55:44 +02:00
|
|
|
return qFloor(UnitConvertor(ui->doubleSpinBoxPaperWidth->value(), oldPaperUnit, Unit::Px));
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::SetPaperWidth(int value)
|
|
|
|
{
|
2015-06-12 10:55:44 +02:00
|
|
|
ui->doubleSpinBoxPaperWidth->setValue(UnitConvertor(value, Unit::Px, PaperUnit()));
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
unsigned int DialogLayoutSettings::GetShift() const
|
|
|
|
{
|
2015-09-13 12:07:12 +02:00
|
|
|
return static_cast<quint32>(qFloor(UnitConvertor(ui->doubleSpinBoxShift->value(), oldLayoutUnit, Unit::Px)));
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::SetShift(unsigned int value)
|
|
|
|
{
|
2015-06-12 10:55:44 +02:00
|
|
|
ui->doubleSpinBoxShift->setValue(UnitConvertor(value, Unit::Px, LayoutUnit()));
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
unsigned int DialogLayoutSettings::GetLayoutWidth() const
|
|
|
|
{
|
2015-09-13 12:07:12 +02:00
|
|
|
return static_cast<quint32>(qFloor(UnitConvertor(ui->doubleSpinBoxLayoutWidth->value(), oldLayoutUnit, Unit::Px)));
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::SetLayoutWidth(unsigned int value)
|
|
|
|
{
|
2015-06-12 10:55:44 +02:00
|
|
|
ui->doubleSpinBoxLayoutWidth->setValue(UnitConvertor(value, Unit::Px, LayoutUnit()));
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
Cases DialogLayoutSettings::GetGroup() const
|
|
|
|
{
|
|
|
|
if (ui->radioButtonThreeGroups->isChecked())
|
|
|
|
{
|
|
|
|
return Cases::CaseThreeGroup;
|
|
|
|
}
|
|
|
|
else if (ui->radioButtonTwoGroups->isChecked())
|
|
|
|
{
|
|
|
|
return Cases::CaseTwoGroup;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return Cases::CaseDesc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-04-15 14:44:57 +02:00
|
|
|
// cppcheck-suppress unusedFunction
|
2015-01-14 15:14:51 +01:00
|
|
|
void DialogLayoutSettings::SetGroup(const Cases &value)
|
|
|
|
{
|
|
|
|
switch (value)
|
|
|
|
{
|
|
|
|
case Cases::CaseThreeGroup:
|
|
|
|
ui->radioButtonThreeGroups->setChecked(true);
|
|
|
|
break;
|
|
|
|
case Cases::CaseTwoGroup:
|
|
|
|
ui->radioButtonTwoGroups->setChecked(true);
|
|
|
|
break;
|
|
|
|
case Cases::CaseDesc:
|
|
|
|
ui->radioButtonDescendingArea->setChecked(true);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ui->radioButtonDescendingArea->setChecked(true);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-22 15:11:50 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool DialogLayoutSettings::GetRotate() const
|
|
|
|
{
|
|
|
|
return ui->groupBoxRotate->isChecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::SetRotate(bool state)
|
|
|
|
{
|
|
|
|
ui->groupBoxRotate->setChecked(state);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
int DialogLayoutSettings::GetIncrease() const
|
|
|
|
{
|
|
|
|
return ui->comboBoxIncrease->currentText().toInt();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-04-15 14:44:57 +02:00
|
|
|
// cppcheck-suppress unusedFunction
|
2015-08-25 19:53:03 +02:00
|
|
|
bool DialogLayoutSettings::SetIncrease(int increase)
|
2015-01-22 15:11:50 +01:00
|
|
|
{
|
|
|
|
int index = ui->comboBoxIncrease->findText(QString::number(increase));
|
2015-08-25 19:53:03 +02:00
|
|
|
bool failed = (index == -1);
|
|
|
|
if (failed)
|
2015-01-22 15:11:50 +01:00
|
|
|
{
|
2015-05-08 16:24:20 +02:00
|
|
|
index = 21;//180 degree
|
2015-01-22 15:11:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ui->comboBoxIncrease->setCurrentIndex(index);
|
2015-08-25 19:53:03 +02:00
|
|
|
return failed;
|
2015-01-22 15:11:50 +01:00
|
|
|
}
|
|
|
|
|
2015-05-02 18:21:47 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool DialogLayoutSettings::GetAutoCrop() const
|
|
|
|
{
|
|
|
|
return ui->checkBoxAutoCrop->isChecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::SetAutoCrop(bool autoCrop)
|
|
|
|
{
|
|
|
|
ui->checkBoxAutoCrop->setChecked(autoCrop);
|
|
|
|
}
|
|
|
|
|
2015-05-08 12:10:56 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool DialogLayoutSettings::IsSaveLength() const
|
|
|
|
{
|
|
|
|
return ui->checkBoxSaveLength->isChecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::SetSaveLength(bool save)
|
|
|
|
{
|
|
|
|
ui->checkBoxSaveLength->setChecked(save);
|
|
|
|
}
|
|
|
|
|
2015-05-18 13:26:37 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool DialogLayoutSettings::IsUnitePages() const
|
|
|
|
{
|
|
|
|
return ui->checkBoxUnitePages->isChecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::SetUnitePages(bool save)
|
|
|
|
{
|
|
|
|
ui->checkBoxUnitePages->setChecked(save);
|
|
|
|
}
|
2015-08-25 21:27:21 +02:00
|
|
|
|
2015-01-14 15:14:51 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::TemplateSelected()
|
|
|
|
{
|
|
|
|
const QSizeF size = Template();
|
2015-05-06 14:03:45 +02:00
|
|
|
|
2015-05-08 16:24:20 +02:00
|
|
|
SheetSize(size);
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::ConvertPaperSize()
|
|
|
|
{
|
|
|
|
const Unit paperUnit = PaperUnit();
|
|
|
|
const qreal width = ui->doubleSpinBoxPaperWidth->value();
|
|
|
|
const qreal height = ui->doubleSpinBoxPaperHeight->value();
|
2015-05-06 14:03:45 +02:00
|
|
|
|
2015-06-11 19:36:17 +02:00
|
|
|
ui->doubleSpinBoxPaperWidth->setMaximum(FromPixel(QIMAGE_MAX, paperUnit));
|
|
|
|
ui->doubleSpinBoxPaperHeight->setMaximum(FromPixel(QIMAGE_MAX, paperUnit));
|
2015-05-06 14:03:45 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
ui->doubleSpinBoxPaperWidth->setValue(UnitConvertor(width, oldPaperUnit, paperUnit));
|
|
|
|
ui->doubleSpinBoxPaperHeight->setValue(UnitConvertor(height, oldPaperUnit, paperUnit));
|
2015-01-14 15:14:51 +01:00
|
|
|
oldPaperUnit = paperUnit;
|
2015-01-15 18:31:42 +01:00
|
|
|
CorrectPaperDecimals();
|
|
|
|
MinimumPaperSize();
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
2015-08-25 19:53:03 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool DialogLayoutSettings::SelectPaperUnit(const QString& units)
|
|
|
|
{
|
|
|
|
qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(units);
|
|
|
|
if (indexUnit != -1)
|
|
|
|
{
|
|
|
|
ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit);
|
|
|
|
}
|
|
|
|
return indexUnit != -1;
|
|
|
|
}
|
2015-08-25 21:27:21 +02:00
|
|
|
|
2015-08-25 19:53:03 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
bool DialogLayoutSettings::SelectLayoutUnit(const QString &units)
|
|
|
|
{
|
|
|
|
qint32 indexUnit = ui->comboBoxLayoutUnit->findData(units);
|
|
|
|
if (indexUnit != -1)
|
|
|
|
{
|
|
|
|
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
|
|
|
}
|
|
|
|
return indexUnit != -1;
|
|
|
|
}
|
2015-08-25 21:27:21 +02:00
|
|
|
|
2015-08-25 19:53:03 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
int DialogLayoutSettings::LayoutToPixels(qreal value) const
|
|
|
|
{
|
|
|
|
return static_cast<quint32>(qFloor(UnitConvertor(value, LayoutUnit(), Unit::Px)));
|
|
|
|
}
|
2015-08-25 21:27:21 +02:00
|
|
|
|
2015-08-25 19:53:03 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
int DialogLayoutSettings::PageToPixels(qreal value) const
|
|
|
|
{
|
|
|
|
return static_cast<quint32>(qFloor(UnitConvertor(value, PaperUnit(), Unit::Px)));
|
|
|
|
}
|
2015-08-25 21:27:21 +02:00
|
|
|
|
2015-08-25 19:53:03 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QString DialogLayoutSettings::MakeGroupsHelp()
|
|
|
|
{
|
|
|
|
//that is REALLY dummy ... can't figure fast how to automate generation... :/
|
|
|
|
return tr("\n\tThree groups: big, middle, small = 0\n\tTwo groups: big, small = 1\n\tDescending area = 2\n");
|
|
|
|
}
|
|
|
|
|
2015-01-14 15:14:51 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::ConvertLayoutSize()
|
|
|
|
{
|
|
|
|
const Unit unit = LayoutUnit();
|
|
|
|
const qreal layoutWidth = ui->doubleSpinBoxLayoutWidth->value();
|
|
|
|
const qreal shift = ui->doubleSpinBoxShift->value();
|
2015-05-06 14:03:45 +02:00
|
|
|
|
2015-06-11 19:36:17 +02:00
|
|
|
ui->doubleSpinBoxLayoutWidth->setMaximum(FromPixel(QIMAGE_MAX, unit));
|
|
|
|
ui->doubleSpinBoxShift->setMaximum(FromPixel(QIMAGE_MAX, unit));
|
2015-05-06 14:03:45 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
ui->doubleSpinBoxLayoutWidth->setValue(UnitConvertor(layoutWidth, oldLayoutUnit, unit));
|
|
|
|
ui->doubleSpinBoxShift->setValue(UnitConvertor(shift, oldLayoutUnit, unit));
|
2015-01-14 15:14:51 +01:00
|
|
|
oldLayoutUnit = unit;
|
2015-01-15 18:31:42 +01:00
|
|
|
CorrectLayoutDecimals();
|
|
|
|
MinimumLayoutSize();
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::PaperSizeChanged()
|
|
|
|
{
|
|
|
|
if (ui->doubleSpinBoxPaperHeight->value() > ui->doubleSpinBoxPaperWidth->value())
|
|
|
|
{
|
|
|
|
ui->toolButtonPortrate->blockSignals(true);
|
|
|
|
ui->toolButtonPortrate->setChecked(true);
|
|
|
|
ui->toolButtonPortrate->blockSignals(false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->toolButtonLandscape->blockSignals(true);
|
|
|
|
ui->toolButtonLandscape->setChecked(true);
|
|
|
|
ui->toolButtonLandscape->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
Label();
|
|
|
|
}
|
2015-08-25 19:53:03 +02:00
|
|
|
|
2015-08-25 21:27:21 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-08-25 19:53:03 +02:00
|
|
|
bool DialogLayoutSettings::SelectTemplate(const PaperSizeTemplate& id)
|
|
|
|
{
|
|
|
|
int index = ui->comboBoxTemplates->findData(static_cast<VIndexType>(id));
|
|
|
|
if (index > -1)
|
|
|
|
{
|
|
|
|
ui->comboBoxTemplates->setCurrentIndex(index);
|
|
|
|
}
|
2015-01-14 15:14:51 +01:00
|
|
|
|
2015-08-25 19:53:03 +02:00
|
|
|
return (index > -1);
|
|
|
|
}
|
|
|
|
|
2015-08-25 21:27:21 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-01-14 15:14:51 +01:00
|
|
|
void DialogLayoutSettings::Swap(bool checked)
|
|
|
|
{
|
|
|
|
if (checked)
|
|
|
|
{
|
|
|
|
const qreal width = ui->doubleSpinBoxPaperWidth->value();
|
|
|
|
const qreal height = ui->doubleSpinBoxPaperHeight->value();
|
|
|
|
|
|
|
|
ui->doubleSpinBoxPaperWidth->blockSignals(true);
|
|
|
|
ui->doubleSpinBoxPaperWidth->setValue(height);
|
|
|
|
ui->doubleSpinBoxPaperWidth->blockSignals(false);
|
|
|
|
|
|
|
|
ui->doubleSpinBoxPaperHeight->blockSignals(true);
|
|
|
|
ui->doubleSpinBoxPaperHeight->setValue(width);
|
|
|
|
ui->doubleSpinBoxPaperHeight->blockSignals(false);
|
|
|
|
|
|
|
|
Label();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-02 18:21:47 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::DialogAccepted()
|
|
|
|
{
|
|
|
|
SCASSERT(generator != nullptr)
|
|
|
|
generator->SetLayoutWidth(GetLayoutWidth());
|
|
|
|
generator->SetCaseType(GetGroup());
|
|
|
|
generator->SetPaperHeight(GetPaperHeight());
|
|
|
|
generator->SetPaperWidth(GetPaperWidth());
|
|
|
|
generator->SetShift(GetShift());
|
|
|
|
generator->SetRotate(GetRotate());
|
|
|
|
generator->SetRotationIncrease(GetIncrease());
|
|
|
|
generator->SetAutoCrop(GetAutoCrop());
|
2015-05-08 12:10:56 +02:00
|
|
|
generator->SetSaveLength(IsSaveLength());
|
2015-05-18 13:26:37 +02:00
|
|
|
generator->SetUnitePages(IsUnitePages());
|
2015-05-02 18:21:47 +02:00
|
|
|
|
2015-08-25 19:53:03 +02:00
|
|
|
//don't want to break visual settings when cmd used
|
2015-09-13 12:07:12 +02:00
|
|
|
if (disableSettings == false)
|
2015-08-25 19:53:03 +02:00
|
|
|
{
|
|
|
|
WriteSettings();
|
|
|
|
}
|
2015-05-02 18:21:47 +02:00
|
|
|
accepted();
|
|
|
|
}
|
|
|
|
|
2015-05-08 16:24:20 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::RestoreDefaults()
|
|
|
|
{
|
|
|
|
ui->comboBoxTemplates->setCurrentIndex(0);//A0
|
|
|
|
|
|
|
|
SetLayoutWidth(VSettings::GetDefLayoutWidth());
|
|
|
|
SetShift(VSettings::GetDefLayoutShift());
|
|
|
|
SetGroup(VSettings::GetDefLayoutGroup());
|
|
|
|
SetRotate(VSettings::GetDefLayoutRotate());
|
|
|
|
SetIncrease(VSettings::GetDefLayoutRotationIncrease());
|
|
|
|
}
|
|
|
|
|
2015-01-14 15:14:51 +01:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::InitPaperUnits()
|
|
|
|
{
|
|
|
|
ui->comboBoxPaperSizeUnit->addItem(tr("Millimiters"), QVariant(VDomDocument::UnitsToStr(Unit::Mm)));
|
|
|
|
ui->comboBoxPaperSizeUnit->addItem(tr("Centimeters"), QVariant(VDomDocument::UnitsToStr(Unit::Cm)));
|
|
|
|
ui->comboBoxPaperSizeUnit->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch)));
|
|
|
|
ui->comboBoxPaperSizeUnit->addItem(tr("Pixels"), QVariant(VDomDocument::UnitsToStr(Unit::Px)));
|
|
|
|
|
|
|
|
// set default unit
|
2015-07-24 14:06:53 +02:00
|
|
|
oldPaperUnit = VDomDocument::StrToUnits(qApp->ValentinaSettings()->GetUnit());
|
|
|
|
const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(qApp->ValentinaSettings()->GetUnit());
|
2015-01-14 15:14:51 +01:00
|
|
|
if (indexUnit != -1)
|
|
|
|
{
|
|
|
|
ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::InitLayoutUnits()
|
|
|
|
{
|
|
|
|
ui->comboBoxLayoutUnit->addItem(tr("Centimeters"), QVariant(VDomDocument::UnitsToStr(Unit::Cm)));
|
|
|
|
ui->comboBoxLayoutUnit->addItem(tr("Millimiters"), QVariant(VDomDocument::UnitsToStr(Unit::Mm)));
|
|
|
|
ui->comboBoxLayoutUnit->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch)));
|
|
|
|
|
|
|
|
// set default unit
|
2015-07-24 14:06:53 +02:00
|
|
|
oldLayoutUnit = VDomDocument::StrToUnits(qApp->ValentinaSettings()->GetUnit());
|
|
|
|
const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(qApp->ValentinaSettings()->GetUnit());
|
2015-01-14 15:14:51 +01:00
|
|
|
if (indexUnit != -1)
|
|
|
|
{
|
|
|
|
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::InitTemplates()
|
|
|
|
{
|
2015-05-02 18:21:47 +02:00
|
|
|
const QIcon icoPaper("://icon/16x16/template.png");
|
|
|
|
const QIcon icoRoll("://icon/16x16/roll.png");
|
2015-06-11 19:36:17 +02:00
|
|
|
const QString pdi = QString("(%1ppi)").arg(PrintDPI);
|
2015-01-14 15:14:51 +01:00
|
|
|
|
2015-08-25 19:53:03 +02:00
|
|
|
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);
|
|
|
|
foreach(const auto& v, pageFormatNames)
|
|
|
|
{
|
|
|
|
ui->comboBoxTemplates->addItem(icoPaper, v+" "+pdi, QVariant(cntr++));
|
|
|
|
}
|
2015-05-08 16:24:20 +02:00
|
|
|
ui->comboBoxTemplates->setCurrentIndex(-1);
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
2015-08-25 19:53:03 +02:00
|
|
|
|
2015-08-25 21:27:21 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-08-25 19:53:03 +02:00
|
|
|
QString DialogLayoutSettings::MakeHelpTemplateList()
|
|
|
|
{
|
|
|
|
QString out = "\n";
|
|
|
|
|
|
|
|
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);
|
|
|
|
foreach(const auto& v, pageFormatNames)
|
|
|
|
{
|
|
|
|
out += "\t"+v+" = "+ QString::number(cntr++)+"\n";
|
|
|
|
}
|
|
|
|
return out;
|
|
|
|
}
|
2015-01-14 15:14:51 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
QSizeF DialogLayoutSettings::Template()
|
|
|
|
{
|
2015-04-02 11:51:27 +02:00
|
|
|
PaperSizeTemplate temp;
|
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
|
|
|
temp = static_cast<PaperSizeTemplate>(ui->comboBoxTemplates->itemData(ui->comboBoxTemplates->currentIndex())
|
|
|
|
.toInt());
|
|
|
|
#else
|
|
|
|
temp = static_cast<PaperSizeTemplate>(ui->comboBoxTemplates->currentData().toInt());
|
|
|
|
#endif
|
2015-01-14 15:14:51 +01:00
|
|
|
const Unit paperUnit = PaperUnit();
|
|
|
|
|
|
|
|
qreal width = 0;
|
|
|
|
qreal height = 0;
|
|
|
|
|
2015-03-02 18:11:43 +01:00
|
|
|
switch (temp)
|
2015-01-14 15:14:51 +01:00
|
|
|
{
|
|
|
|
case PaperSizeTemplate::A0:
|
2015-05-18 13:26:37 +02:00
|
|
|
SetAdditionalOptions(false);
|
2015-05-08 12:10:56 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
width = UnitConvertor(841, Unit::Mm, paperUnit);
|
|
|
|
height = UnitConvertor(1189, Unit::Mm, paperUnit);
|
2015-01-14 15:14:51 +01:00
|
|
|
return QSizeF(width, height);
|
|
|
|
case PaperSizeTemplate::A1:
|
2015-05-18 13:26:37 +02:00
|
|
|
SetAdditionalOptions(false);
|
2015-05-08 12:10:56 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
width = UnitConvertor(594, Unit::Mm, paperUnit);
|
|
|
|
height = UnitConvertor(841, Unit::Mm, paperUnit);
|
2015-01-14 15:14:51 +01:00
|
|
|
return QSizeF(width, height);
|
|
|
|
case PaperSizeTemplate::A2:
|
2015-05-18 13:26:37 +02:00
|
|
|
SetAdditionalOptions(false);
|
2015-05-08 12:10:56 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
width = UnitConvertor(420, Unit::Mm, paperUnit);
|
|
|
|
height = UnitConvertor(594, Unit::Mm, paperUnit);
|
2015-01-14 15:14:51 +01:00
|
|
|
return QSizeF(width, height);
|
|
|
|
case PaperSizeTemplate::A3:
|
2015-05-18 13:26:37 +02:00
|
|
|
SetAdditionalOptions(false);
|
2015-05-08 12:10:56 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
width = UnitConvertor(297, Unit::Mm, paperUnit);
|
|
|
|
height = UnitConvertor(420, Unit::Mm, paperUnit);
|
2015-01-14 15:14:51 +01:00
|
|
|
return QSizeF(width, height);
|
|
|
|
case PaperSizeTemplate::A4:
|
2015-05-18 13:26:37 +02:00
|
|
|
SetAdditionalOptions(false);
|
2015-05-08 12:10:56 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
width = UnitConvertor(210, Unit::Mm, paperUnit);
|
|
|
|
height = UnitConvertor(297, Unit::Mm, paperUnit);
|
2015-01-14 15:14:51 +01:00
|
|
|
return QSizeF(width, height);
|
2015-04-28 14:40:57 +02:00
|
|
|
case PaperSizeTemplate::Letter:
|
2015-05-18 13:26:37 +02:00
|
|
|
SetAdditionalOptions(false);
|
2015-05-08 12:10:56 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
width = UnitConvertor(8.5, Unit::Inch, paperUnit);
|
|
|
|
height = UnitConvertor(11, Unit::Inch, paperUnit);
|
2015-04-28 14:40:57 +02:00
|
|
|
return QSizeF(width, height);
|
|
|
|
case PaperSizeTemplate::Legal:
|
2015-05-18 13:26:37 +02:00
|
|
|
SetAdditionalOptions(true);
|
2015-05-08 12:10:56 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
width = UnitConvertor(11, Unit::Inch, paperUnit);
|
|
|
|
height = UnitConvertor(17, Unit::Inch, paperUnit);
|
2015-04-28 14:40:57 +02:00
|
|
|
return QSizeF(width, height);
|
2015-05-02 18:21:47 +02:00
|
|
|
case PaperSizeTemplate::Roll24in:
|
2015-05-18 13:26:37 +02:00
|
|
|
SetAdditionalOptions(true);
|
2015-05-08 12:10:56 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
width = UnitConvertor(24, Unit::Inch, paperUnit);
|
|
|
|
height = UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
|
2015-05-02 18:21:47 +02:00
|
|
|
return QSizeF(width, height);
|
|
|
|
case PaperSizeTemplate::Roll30in:
|
2015-05-18 13:26:37 +02:00
|
|
|
SetAdditionalOptions(true);
|
2015-05-08 12:10:56 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
width = UnitConvertor(30, Unit::Inch, paperUnit);
|
|
|
|
height = UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
|
2015-05-02 18:21:47 +02:00
|
|
|
return QSizeF(width, height);
|
|
|
|
case PaperSizeTemplate::Roll36in:
|
2015-05-18 13:26:37 +02:00
|
|
|
SetAdditionalOptions(true);
|
2015-05-08 12:10:56 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
width = UnitConvertor(36, Unit::Inch, paperUnit);
|
|
|
|
height = UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
|
2015-05-02 18:21:47 +02:00
|
|
|
return QSizeF(width, height);
|
|
|
|
case PaperSizeTemplate::Roll42in:
|
2015-05-18 13:26:37 +02:00
|
|
|
SetAdditionalOptions(true);
|
2015-05-08 12:10:56 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
width = UnitConvertor(42, Unit::Inch, paperUnit);
|
|
|
|
height = UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
|
2015-05-02 18:21:47 +02:00
|
|
|
return QSizeF(width, height);
|
|
|
|
case PaperSizeTemplate::Roll44in:
|
2015-05-18 13:26:37 +02:00
|
|
|
SetAdditionalOptions(true);
|
2015-05-08 12:10:56 +02:00
|
|
|
|
2015-06-12 10:55:44 +02:00
|
|
|
width = UnitConvertor(44, Unit::Inch, paperUnit);
|
|
|
|
height = UnitConvertor(QIMAGE_MAX, Unit::Px, paperUnit);
|
2015-05-02 18:21:47 +02:00
|
|
|
return QSizeF(width, height);
|
2015-01-14 15:14:51 +01:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return QSizeF();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
Unit DialogLayoutSettings::PaperUnit() const
|
|
|
|
{
|
2015-04-02 11:51:27 +02:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
|
|
|
return VDomDocument::StrToUnits(ui->comboBoxPaperSizeUnit->itemData(ui->comboBoxPaperSizeUnit->currentIndex())
|
|
|
|
.toString());
|
|
|
|
#else
|
2015-01-14 15:14:51 +01:00
|
|
|
return VDomDocument::StrToUnits(ui->comboBoxPaperSizeUnit->currentData().toString());
|
2015-04-02 11:51:27 +02:00
|
|
|
#endif
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
Unit DialogLayoutSettings::LayoutUnit() const
|
|
|
|
{
|
2015-04-02 11:51:27 +02:00
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
|
|
|
return VDomDocument::StrToUnits(ui->comboBoxLayoutUnit->itemData(ui->comboBoxLayoutUnit->currentIndex())
|
|
|
|
.toString());
|
|
|
|
#else
|
2015-01-14 15:14:51 +01:00
|
|
|
return VDomDocument::StrToUnits(ui->comboBoxLayoutUnit->currentData().toString());
|
2015-04-02 11:51:27 +02:00
|
|
|
#endif
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-01-15 18:31:42 +01:00
|
|
|
void DialogLayoutSettings::CorrectPaperDecimals()
|
2015-01-14 15:14:51 +01:00
|
|
|
{
|
2015-03-02 18:11:43 +01:00
|
|
|
switch (oldPaperUnit)
|
2015-01-14 15:14:51 +01:00
|
|
|
{
|
2015-01-15 18:31:42 +01:00
|
|
|
case Unit::Cm:
|
|
|
|
case Unit::Mm:
|
|
|
|
ui->doubleSpinBoxPaperWidth->setDecimals(2);
|
|
|
|
ui->doubleSpinBoxPaperHeight->setDecimals(2);
|
|
|
|
break;
|
|
|
|
case Unit::Inch:
|
|
|
|
ui->doubleSpinBoxPaperWidth->setDecimals(5);
|
|
|
|
ui->doubleSpinBoxPaperHeight->setDecimals(5);
|
|
|
|
break;
|
|
|
|
case Unit::Px:
|
|
|
|
ui->doubleSpinBoxPaperWidth->setDecimals(0);
|
|
|
|
ui->doubleSpinBoxPaperHeight->setDecimals(0);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
2015-01-15 18:31:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::CorrectLayoutDecimals()
|
|
|
|
{
|
2015-03-02 18:11:43 +01:00
|
|
|
switch (oldLayoutUnit)
|
2015-01-14 15:14:51 +01:00
|
|
|
{
|
2015-01-15 18:31:42 +01:00
|
|
|
case Unit::Cm:
|
|
|
|
case Unit::Mm:
|
|
|
|
ui->doubleSpinBoxLayoutWidth->setDecimals(2);
|
|
|
|
ui->doubleSpinBoxShift->setDecimals(2);
|
|
|
|
break;
|
|
|
|
case Unit::Inch:
|
|
|
|
ui->doubleSpinBoxLayoutWidth->setDecimals(5);
|
|
|
|
ui->doubleSpinBoxShift->setDecimals(5);
|
|
|
|
break;
|
|
|
|
case Unit::Px:
|
|
|
|
ui->doubleSpinBoxLayoutWidth->setDecimals(0);
|
|
|
|
ui->doubleSpinBoxShift->setDecimals(0);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2015-01-14 15:14:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::Label()
|
|
|
|
{
|
2015-06-12 10:55:44 +02:00
|
|
|
const int width = qFloor(UnitConvertor(ui->doubleSpinBoxPaperWidth->value(), PaperUnit(), Unit::Px));
|
|
|
|
const int height = qFloor(UnitConvertor(ui->doubleSpinBoxPaperHeight->value(), PaperUnit(), Unit::Px));
|
2015-06-11 19:36:17 +02:00
|
|
|
QString text = QString("%1 x %2 px, \n%3 ppi").arg(width).arg(height).arg(PrintDPI);
|
2015-01-14 15:14:51 +01:00
|
|
|
ui->labelSizeDescription->setText(text);
|
|
|
|
}
|
2015-01-15 18:31:42 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::MinimumPaperSize()
|
|
|
|
{
|
2015-06-12 10:55:44 +02:00
|
|
|
const qreal value = UnitConvertor(1, Unit::Px, oldPaperUnit);
|
2015-01-15 18:31:42 +01:00
|
|
|
ui->doubleSpinBoxPaperWidth->setMinimum(value);
|
|
|
|
ui->doubleSpinBoxPaperHeight->setMinimum(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::MinimumLayoutSize()
|
|
|
|
{
|
2015-06-12 10:55:44 +02:00
|
|
|
const qreal value = UnitConvertor(1, Unit::Px, oldLayoutUnit);
|
2015-01-15 18:31:42 +01:00
|
|
|
ui->doubleSpinBoxLayoutWidth->setMinimum(value);
|
|
|
|
}
|
2015-05-08 16:24:20 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::ReadSettings()
|
|
|
|
{
|
2015-08-27 18:03:43 +02:00
|
|
|
|
|
|
|
SetLayoutWidth(qApp->ValentinaSettings()->GetLayoutWidth());
|
|
|
|
SetShift(qApp->ValentinaSettings()->GetLayoutShift());
|
2015-05-08 16:24:20 +02:00
|
|
|
|
2015-07-24 14:06:53 +02:00
|
|
|
const qreal width = UnitConvertor(qApp->ValentinaSettings()->GetLayoutPaperWidth(), Unit::Px, LayoutUnit());
|
|
|
|
const qreal height = UnitConvertor(qApp->ValentinaSettings()->GetLayoutPaperHeight(), Unit::Px, LayoutUnit());
|
2015-05-08 16:24:20 +02:00
|
|
|
SheetSize(QSizeF(width, height));
|
2015-07-24 14:06:53 +02:00
|
|
|
SetGroup(qApp->ValentinaSettings()->GetLayoutGroup());
|
|
|
|
SetRotate(qApp->ValentinaSettings()->GetLayoutRotate());
|
|
|
|
SetIncrease(qApp->ValentinaSettings()->GetLayoutRotationIncrease());
|
|
|
|
SetAutoCrop(qApp->ValentinaSettings()->GetLayoutAutoCrop());
|
|
|
|
SetSaveLength(qApp->ValentinaSettings()->GetLayoutSaveLength());
|
|
|
|
SetUnitePages(qApp->ValentinaSettings()->GetLayoutUnitePages());
|
2015-05-08 16:24:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::WriteSettings() const
|
|
|
|
{
|
2015-07-24 14:06:53 +02:00
|
|
|
qApp->ValentinaSettings()->SetLayoutWidth(GetLayoutWidth());
|
|
|
|
qApp->ValentinaSettings()->SetLayoutGroup(GetGroup());
|
|
|
|
qApp->ValentinaSettings()->SetLayoutPaperHeight(GetPaperHeight());
|
|
|
|
qApp->ValentinaSettings()->SetLayoutPaperWidth(GetPaperWidth());
|
|
|
|
qApp->ValentinaSettings()->SetLayoutShift(GetShift());
|
|
|
|
qApp->ValentinaSettings()->SetLayoutRotate(GetRotate());
|
|
|
|
qApp->ValentinaSettings()->SetLayoutRotationIncrease(GetIncrease());
|
|
|
|
qApp->ValentinaSettings()->SetLayoutAutoCrop(GetAutoCrop());
|
|
|
|
qApp->ValentinaSettings()->SetLayoutSaveLength(IsSaveLength());
|
|
|
|
qApp->ValentinaSettings()->SetLayoutUnitePages(IsUnitePages());
|
2015-05-08 16:24:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::SheetSize(const QSizeF &size)
|
|
|
|
{
|
|
|
|
oldPaperUnit = PaperUnit();
|
2015-06-11 19:36:17 +02:00
|
|
|
ui->doubleSpinBoxPaperWidth->setMaximum(FromPixel(QIMAGE_MAX, oldPaperUnit));
|
|
|
|
ui->doubleSpinBoxPaperHeight->setMaximum(FromPixel(QIMAGE_MAX, oldPaperUnit));
|
2015-05-08 16:24:20 +02:00
|
|
|
|
|
|
|
ui->doubleSpinBoxPaperWidth->setValue(size.width());
|
|
|
|
ui->doubleSpinBoxPaperHeight->setValue(size.height());
|
|
|
|
|
|
|
|
CorrectPaperDecimals();
|
|
|
|
PaperSizeChanged();
|
|
|
|
}
|
2015-05-18 13:26:37 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void DialogLayoutSettings::SetAdditionalOptions(bool value)
|
|
|
|
{
|
|
|
|
SetAutoCrop(value);
|
|
|
|
SetSaveLength(value);
|
|
|
|
SetUnitePages(value);
|
|
|
|
}
|