Dialog layout settings.
--HG-- branch : feature
This commit is contained in:
parent
3ed87757c4
commit
a121845407
src
|
@ -292,22 +292,20 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
double VApplication::toPixel(double val, const Unit &unit) const
|
double VApplication::toPixel(double val, const Unit &unit) const
|
||||||
{
|
{
|
||||||
double result = 0;
|
|
||||||
switch (unit)
|
switch (unit)
|
||||||
{
|
{
|
||||||
case Unit::Mm:
|
case Unit::Mm:
|
||||||
result = (val / 25.4) * PrintDPI;
|
return (val / 25.4) * PrintDPI;
|
||||||
break;
|
|
||||||
case Unit::Cm:
|
case Unit::Cm:
|
||||||
result = ((val * 10.0) / 25.4) * PrintDPI;
|
return ((val * 10.0) / 25.4) * PrintDPI;
|
||||||
break;
|
|
||||||
case Unit::Inch:
|
case Unit::Inch:
|
||||||
result = val * PrintDPI;
|
return val * PrintDPI;
|
||||||
break;
|
case Unit::Px:
|
||||||
|
return val;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -319,22 +317,20 @@ double VApplication::toPixel(double val) const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
double VApplication::fromPixel(double pix, const Unit &unit) const
|
double VApplication::fromPixel(double pix, const Unit &unit) const
|
||||||
{
|
{
|
||||||
double result = 0;
|
|
||||||
switch (unit)
|
switch (unit)
|
||||||
{
|
{
|
||||||
case Unit::Mm:
|
case Unit::Mm:
|
||||||
result = (pix / PrintDPI) * 25.4;
|
return (pix / PrintDPI) * 25.4;
|
||||||
break;
|
|
||||||
case Unit::Cm:
|
case Unit::Cm:
|
||||||
result = ((pix / PrintDPI) * 25.4) / 10.0;
|
return ((pix / PrintDPI) * 25.4) / 10.0;
|
||||||
break;
|
|
||||||
case Unit::Inch:
|
case Unit::Inch:
|
||||||
result = pix / PrintDPI;
|
return pix / PrintDPI;
|
||||||
break;
|
case Unit::Px:
|
||||||
|
return pix;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
376
src/app/dialogs/app/dialoglayoutsettings.cpp
Normal file
376
src/app/dialogs/app/dialoglayoutsettings.cpp
Normal file
|
@ -0,0 +1,376 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @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.
|
||||||
|
** 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/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "dialoglayoutsettings.h"
|
||||||
|
#include "ui_dialoglayoutsettings.h"
|
||||||
|
#include "../../core/vapplication.h"
|
||||||
|
#include "../../libs/ifc/xml/vdomdocument.h"
|
||||||
|
#include "../../core/vsettings.h"
|
||||||
|
#include "../../xml/vabstractmeasurements.h"
|
||||||
|
|
||||||
|
#include <QtMath>
|
||||||
|
|
||||||
|
enum class PaperSizeTemplate : char { A0, A1, A2, A3, A4 };
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
DialogLayoutSettings::DialogLayoutSettings(QWidget *parent)
|
||||||
|
: QDialog(parent), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm), oldLayoutUnit(Unit::Mm)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
InitPaperUnits();
|
||||||
|
InitLayoutUnits();
|
||||||
|
InitTemplates();
|
||||||
|
|
||||||
|
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);
|
||||||
|
connect(ui->doubleSpinBoxLayoutWidth, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
|
||||||
|
this, &DialogLayoutSettings::LayoutWidthChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
DialogLayoutSettings::~DialogLayoutSettings()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
int DialogLayoutSettings::GetPaperHeight() const
|
||||||
|
{
|
||||||
|
return qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxPaperHeight->value(), oldPaperUnit, Unit::Px));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::SetPaperHeight(int value)
|
||||||
|
{
|
||||||
|
ui->doubleSpinBoxPaperHeight->setValue(VAbstractMeasurements::UnitConvertor(value, Unit::Px, PaperUnit()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
int DialogLayoutSettings::GetPaperWidth() const
|
||||||
|
{
|
||||||
|
return qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxPaperWidth->value(), oldPaperUnit, Unit::Px));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::SetPaperWidth(int value)
|
||||||
|
{
|
||||||
|
ui->doubleSpinBoxPaperWidth->setValue(VAbstractMeasurements::UnitConvertor(value, Unit::Px, PaperUnit()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
unsigned int DialogLayoutSettings::GetShift() const
|
||||||
|
{
|
||||||
|
return qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxShift->value(), oldLayoutUnit, Unit::Px));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::SetShift(unsigned int value)
|
||||||
|
{
|
||||||
|
ui->doubleSpinBoxShift->setValue(VAbstractMeasurements::UnitConvertor(value, Unit::Px, LayoutUnit()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
unsigned int DialogLayoutSettings::GetLayoutWidth() const
|
||||||
|
{
|
||||||
|
return qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxLayoutWidth->value(), oldLayoutUnit, Unit::Px));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::SetLayoutWidth(unsigned int value)
|
||||||
|
{
|
||||||
|
ui->doubleSpinBoxLayoutWidth->setValue(VAbstractMeasurements::UnitConvertor(value, Unit::Px, LayoutUnit()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Cases DialogLayoutSettings::GetGroup() const
|
||||||
|
{
|
||||||
|
if (ui->radioButtonThreeGroups->isChecked())
|
||||||
|
{
|
||||||
|
return Cases::CaseThreeGroup;
|
||||||
|
}
|
||||||
|
else if (ui->radioButtonTwoGroups->isChecked())
|
||||||
|
{
|
||||||
|
return Cases::CaseTwoGroup;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Cases::CaseDesc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::TemplateSelected()
|
||||||
|
{
|
||||||
|
const QSizeF size = Template();
|
||||||
|
ui->doubleSpinBoxPaperWidth->setValue(size.width());
|
||||||
|
ui->doubleSpinBoxPaperHeight->setValue(size.height());
|
||||||
|
oldPaperUnit = PaperUnit();
|
||||||
|
CorrectDecimals();
|
||||||
|
PaperSizeChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::ConvertPaperSize()
|
||||||
|
{
|
||||||
|
const Unit paperUnit = PaperUnit();
|
||||||
|
const qreal width = ui->doubleSpinBoxPaperWidth->value();
|
||||||
|
const qreal height = ui->doubleSpinBoxPaperHeight->value();
|
||||||
|
ui->doubleSpinBoxPaperWidth->setValue(VAbstractMeasurements::UnitConvertor(width, oldPaperUnit, paperUnit));
|
||||||
|
ui->doubleSpinBoxPaperHeight->setValue(VAbstractMeasurements::UnitConvertor(height, oldPaperUnit, paperUnit));
|
||||||
|
oldPaperUnit = paperUnit;
|
||||||
|
CorrectDecimals();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::ConvertLayoutSize()
|
||||||
|
{
|
||||||
|
const Unit unit = LayoutUnit();
|
||||||
|
const qreal layoutWidth = ui->doubleSpinBoxLayoutWidth->value();
|
||||||
|
const qreal shift = ui->doubleSpinBoxShift->value();
|
||||||
|
ui->doubleSpinBoxLayoutWidth->setValue(VAbstractMeasurements::UnitConvertor(layoutWidth, oldLayoutUnit, unit));
|
||||||
|
ui->doubleSpinBoxShift->setValue(VAbstractMeasurements::UnitConvertor(shift, oldLayoutUnit, unit));
|
||||||
|
oldLayoutUnit = unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::PaperSizeChanged()
|
||||||
|
{
|
||||||
|
QDoubleSpinBox *box = qobject_cast<QDoubleSpinBox*>(sender());
|
||||||
|
if (box != nullptr)
|
||||||
|
{
|
||||||
|
if (box->value() <= 0)
|
||||||
|
{
|
||||||
|
box->blockSignals(true);
|
||||||
|
box->setValue(1);
|
||||||
|
box->blockSignals(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::LayoutWidthChanged()
|
||||||
|
{
|
||||||
|
QDoubleSpinBox *box = qobject_cast<QDoubleSpinBox*>(sender());
|
||||||
|
if (box != nullptr)
|
||||||
|
{
|
||||||
|
if (box->value() <= 0)
|
||||||
|
{
|
||||||
|
box->blockSignals(true);
|
||||||
|
box->setValue(1);
|
||||||
|
box->blockSignals(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
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
|
||||||
|
oldPaperUnit = VDomDocument::StrToUnits(qApp->getSettings()->GetUnit());
|
||||||
|
const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(qApp->getSettings()->GetUnit());
|
||||||
|
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
|
||||||
|
oldLayoutUnit = VDomDocument::StrToUnits(qApp->getSettings()->GetUnit());
|
||||||
|
const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(qApp->getSettings()->GetUnit());
|
||||||
|
if (indexUnit != -1)
|
||||||
|
{
|
||||||
|
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::InitTemplates()
|
||||||
|
{
|
||||||
|
const QIcon ico("://icon/16x16/template.png");
|
||||||
|
const QString pdi = QString("(%1ppi)").arg(VApplication::PrintDPI);
|
||||||
|
|
||||||
|
ui->comboBoxTemplates->addItem(ico, "A0 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A0)));
|
||||||
|
ui->comboBoxTemplates->addItem(ico, "A1 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A1)));
|
||||||
|
ui->comboBoxTemplates->addItem(ico, "A2 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A2)));
|
||||||
|
ui->comboBoxTemplates->addItem(ico, "A3 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A3)));
|
||||||
|
ui->comboBoxTemplates->addItem(ico, "A4 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A4)));
|
||||||
|
|
||||||
|
TemplateSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QSizeF DialogLayoutSettings::Template()
|
||||||
|
{
|
||||||
|
const PaperSizeTemplate temp = static_cast<PaperSizeTemplate>(ui->comboBoxTemplates->currentData().toInt());
|
||||||
|
const Unit paperUnit = PaperUnit();
|
||||||
|
|
||||||
|
qreal width = 0;
|
||||||
|
qreal height = 0;
|
||||||
|
|
||||||
|
switch(temp)
|
||||||
|
{
|
||||||
|
case PaperSizeTemplate::A0:
|
||||||
|
width = VAbstractMeasurements::UnitConvertor(841, Unit::Mm, paperUnit);
|
||||||
|
height = VAbstractMeasurements::UnitConvertor(1189, Unit::Mm, paperUnit);
|
||||||
|
return QSizeF(width, height);
|
||||||
|
case PaperSizeTemplate::A1:
|
||||||
|
width = VAbstractMeasurements::UnitConvertor(594, Unit::Mm, paperUnit);
|
||||||
|
height = VAbstractMeasurements::UnitConvertor(841, Unit::Mm, paperUnit);
|
||||||
|
return QSizeF(width, height);
|
||||||
|
case PaperSizeTemplate::A2:
|
||||||
|
width = VAbstractMeasurements::UnitConvertor(420, Unit::Mm, paperUnit);
|
||||||
|
height = VAbstractMeasurements::UnitConvertor(594, Unit::Mm, paperUnit);
|
||||||
|
return QSizeF(width, height);
|
||||||
|
case PaperSizeTemplate::A3:
|
||||||
|
width = VAbstractMeasurements::UnitConvertor(297, Unit::Mm, paperUnit);
|
||||||
|
height = VAbstractMeasurements::UnitConvertor(420, Unit::Mm, paperUnit);
|
||||||
|
return QSizeF(width, height);
|
||||||
|
case PaperSizeTemplate::A4:
|
||||||
|
width = VAbstractMeasurements::UnitConvertor(210, Unit::Mm, paperUnit);
|
||||||
|
height = VAbstractMeasurements::UnitConvertor(297, Unit::Mm, paperUnit);
|
||||||
|
return QSizeF(width, height);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return QSizeF();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Unit DialogLayoutSettings::PaperUnit() const
|
||||||
|
{
|
||||||
|
return VDomDocument::StrToUnits(ui->comboBoxPaperSizeUnit->currentData().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Unit DialogLayoutSettings::LayoutUnit() const
|
||||||
|
{
|
||||||
|
return VDomDocument::StrToUnits(ui->comboBoxLayoutUnit->currentData().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::CorrectDecimals()
|
||||||
|
{
|
||||||
|
if (oldPaperUnit == Unit::Px)
|
||||||
|
{
|
||||||
|
ui->doubleSpinBoxPaperWidth->setDecimals(0);
|
||||||
|
ui->doubleSpinBoxPaperHeight->setDecimals(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->doubleSpinBoxPaperWidth->setDecimals(2);
|
||||||
|
ui->doubleSpinBoxPaperHeight->setDecimals(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::Label()
|
||||||
|
{
|
||||||
|
const int width = qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxPaperWidth->value(), PaperUnit(),
|
||||||
|
Unit::Px));
|
||||||
|
const int height = qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxPaperHeight->value(),
|
||||||
|
PaperUnit(), Unit::Px));
|
||||||
|
QString text = QString("%1 x %2 px, \n%3 ppi").arg(width).arg(height).arg(VApplication::PrintDPI);
|
||||||
|
ui->labelSizeDescription->setText(text);
|
||||||
|
}
|
90
src/app/dialogs/app/dialoglayoutsettings.h
Normal file
90
src/app/dialogs/app/dialoglayoutsettings.h
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file dialoglayoutsettings.h
|
||||||
|
** @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.
|
||||||
|
** 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 DIALOGLAYOUTSETTINGS_H
|
||||||
|
#define DIALOGLAYOUTSETTINGS_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "../../libs/vlayout/vbank.h"
|
||||||
|
#include "../../libs/ifc/ifcdef.h"
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class DialogLayoutSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DialogLayoutSettings : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit DialogLayoutSettings(QWidget *parent = 0);
|
||||||
|
~DialogLayoutSettings();
|
||||||
|
|
||||||
|
int GetPaperHeight() const;
|
||||||
|
void SetPaperHeight(int value);
|
||||||
|
|
||||||
|
int GetPaperWidth() const;
|
||||||
|
void SetPaperWidth(int value);
|
||||||
|
|
||||||
|
unsigned int GetShift() const;
|
||||||
|
void SetShift(unsigned int value);
|
||||||
|
|
||||||
|
unsigned int GetLayoutWidth() const;
|
||||||
|
void SetLayoutWidth(unsigned int value);
|
||||||
|
|
||||||
|
Cases GetGroup() const;
|
||||||
|
void SetGroup(const Cases &value);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void TemplateSelected();
|
||||||
|
void ConvertPaperSize();
|
||||||
|
void ConvertLayoutSize();
|
||||||
|
void PaperSizeChanged();
|
||||||
|
void LayoutWidthChanged();
|
||||||
|
void Swap(bool checked);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(DialogLayoutSettings)
|
||||||
|
Ui::DialogLayoutSettings *ui;
|
||||||
|
Unit oldPaperUnit;
|
||||||
|
Unit oldLayoutUnit;
|
||||||
|
|
||||||
|
void InitPaperUnits();
|
||||||
|
void InitLayoutUnits();
|
||||||
|
void InitTemplates();
|
||||||
|
QSizeF Template();
|
||||||
|
|
||||||
|
Unit PaperUnit() const;
|
||||||
|
Unit LayoutUnit() const;
|
||||||
|
|
||||||
|
void CorrectDecimals();
|
||||||
|
void Label();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DIALOGLAYOUTSETTINGS_H
|
343
src/app/dialogs/app/dialoglayoutsettings.ui
Normal file
343
src/app/dialogs/app/dialoglayoutsettings.ui
Normal file
|
@ -0,0 +1,343 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DialogLayoutSettings</class>
|
||||||
|
<widget class="QDialog" name="DialogLayoutSettings">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>659</width>
|
||||||
|
<height>273</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Creation a layout</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxPaperSize">
|
||||||
|
<property name="title">
|
||||||
|
<string>Paper size</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Templates:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBoxTemplates"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<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">
|
||||||
|
<widget class="QLabel" name="labelWidth">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Width:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelHeight">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Height:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxPaperHeight">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>94</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>99999.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxPaperWidth">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>94</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>99999.990000000005239</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QLabel" name="labelSizeDescription">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonPortrate">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/16x16/portrait.png</normaloff>:/icon/16x16/portrait.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonLandscape">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/16x16/landscape.png</normaloff>:/icon/16x16/landscape.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroup</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<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="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>Layout 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="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>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxCase">
|
||||||
|
<property name="title">
|
||||||
|
<string>Principle of choosing the next workpiece</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonThreeGroups">
|
||||||
|
<property name="text">
|
||||||
|
<string>Three groups: big, middle, small</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroupPrinciple</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonTwoGroups">
|
||||||
|
<property name="text">
|
||||||
|
<string>Two groups: big, small</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroupPrinciple</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioButtonDescendingArea">
|
||||||
|
<property name="text">
|
||||||
|
<string>Descending area</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">buttonGroupPrinciple</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../share/resources/icon.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>DialogLayoutSettings</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>DialogLayoutSettings</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
<buttongroups>
|
||||||
|
<buttongroup name="buttonGroupPrinciple"/>
|
||||||
|
<buttongroup name="buttonGroup"/>
|
||||||
|
</buttongroups>
|
||||||
|
</ui>
|
|
@ -41,7 +41,8 @@ HEADERS += \
|
||||||
$$PWD/app/configpages/communitypage.h \
|
$$PWD/app/configpages/communitypage.h \
|
||||||
$$PWD/app/configpages/pathpage.h \
|
$$PWD/app/configpages/pathpage.h \
|
||||||
$$PWD/app/dialogundo.h \
|
$$PWD/app/dialogundo.h \
|
||||||
$$PWD/tools/dialogcurveintersectaxis.h
|
$$PWD/tools/dialogcurveintersectaxis.h \
|
||||||
|
$$PWD/app/dialoglayoutsettings.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/tools/dialogtriangle.cpp \
|
$$PWD/tools/dialogtriangle.cpp \
|
||||||
|
@ -81,7 +82,8 @@ SOURCES += \
|
||||||
$$PWD/app/configpages/communitypage.cpp \
|
$$PWD/app/configpages/communitypage.cpp \
|
||||||
$$PWD/app/configpages/pathpage.cpp \
|
$$PWD/app/configpages/pathpage.cpp \
|
||||||
$$PWD/app/dialogundo.cpp \
|
$$PWD/app/dialogundo.cpp \
|
||||||
$$PWD/tools/dialogcurveintersectaxis.cpp
|
$$PWD/tools/dialogcurveintersectaxis.cpp \
|
||||||
|
$$PWD/app/dialoglayoutsettings.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/tools/dialogtriangle.ui \
|
$$PWD/tools/dialogtriangle.ui \
|
||||||
|
@ -115,4 +117,5 @@ FORMS += \
|
||||||
$$PWD/app/dialogaboutapp.ui \
|
$$PWD/app/dialogaboutapp.ui \
|
||||||
$$PWD/app/dialogpatternxmledit.ui \
|
$$PWD/app/dialogpatternxmledit.ui \
|
||||||
$$PWD/app/dialogundo.ui \
|
$$PWD/app/dialogundo.ui \
|
||||||
$$PWD/tools/dialogcurveintersectaxis.ui
|
$$PWD/tools/dialogcurveintersectaxis.ui \
|
||||||
|
$$PWD/app/dialoglayoutsettings.ui
|
||||||
|
|
|
@ -52,5 +52,8 @@
|
||||||
<file>icon/32x32/line_intersect_axis.png</file>
|
<file>icon/32x32/line_intersect_axis.png</file>
|
||||||
<file>icon/32x32/arc_intersect_axis.png</file>
|
<file>icon/32x32/arc_intersect_axis.png</file>
|
||||||
<file>icon/32x32/curve_intersect_axis.png</file>
|
<file>icon/32x32/curve_intersect_axis.png</file>
|
||||||
|
<file>icon/16x16/landscape.png</file>
|
||||||
|
<file>icon/16x16/portrait.png</file>
|
||||||
|
<file>icon/16x16/template.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/app/share/resources/icon/16x16/landscape.png
Normal file
BIN
src/app/share/resources/icon/16x16/landscape.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 398 B |
BIN
src/app/share/resources/icon/16x16/portrait.png
Normal file
BIN
src/app/share/resources/icon/16x16/portrait.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 536 B |
BIN
src/app/share/resources/icon/16x16/template.png
Normal file
BIN
src/app/share/resources/icon/16x16/template.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 497 B |
|
@ -34,6 +34,7 @@
|
||||||
#include "core/vapplication.h"
|
#include "core/vapplication.h"
|
||||||
#include <QtCore/qmath.h>
|
#include <QtCore/qmath.h>
|
||||||
#include "../../libs/vobj/vobjpaintdevice.h"
|
#include "../../libs/vobj/vobjpaintdevice.h"
|
||||||
|
#include "../dialogs/app/dialoglayoutsettings.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
# define PDFTOPS "pdftops.exe"
|
# define PDFTOPS "pdftops.exe"
|
||||||
|
@ -79,6 +80,7 @@ TableWindow::TableWindow(QWidget *parent)
|
||||||
connect(ui->actionAdd, &QAction::triggered, this, &TableWindow::AddLength);
|
connect(ui->actionAdd, &QAction::triggered, this, &TableWindow::AddLength);
|
||||||
connect(ui->actionRemove, &QAction::triggered, this, &TableWindow::RemoveLength);
|
connect(ui->actionRemove, &QAction::triggered, this, &TableWindow::RemoveLength);
|
||||||
connect(ui->view, &VTableGraphicsView::itemChect, this, &TableWindow::itemChect);
|
connect(ui->view, &VTableGraphicsView::itemChect, this, &TableWindow::itemChect);
|
||||||
|
connect(ui->actionLayout, &QAction::triggered, this, &TableWindow::Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -510,6 +512,13 @@ void TableWindow::RemoveLength()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TableWindow::Layout()
|
||||||
|
{
|
||||||
|
DialogLayoutSettings layout(this);
|
||||||
|
layout.exec();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief keyPressEvent handle key press events.
|
* @brief keyPressEvent handle key press events.
|
||||||
|
|
|
@ -74,6 +74,7 @@ public slots:
|
||||||
void AddLength();
|
void AddLength();
|
||||||
|
|
||||||
void RemoveLength();
|
void RemoveLength();
|
||||||
|
void Layout();
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief closed emit if window is closing.
|
* @brief closed emit if window is closing.
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
<addaction name="actionZoomIn"/>
|
<addaction name="actionZoomIn"/>
|
||||||
<addaction name="actionZoomOut"/>
|
<addaction name="actionZoomOut"/>
|
||||||
<addaction name="actionStop"/>
|
<addaction name="actionStop"/>
|
||||||
|
<addaction name="actionLayout"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
<action name="actionSave">
|
<action name="actionSave">
|
||||||
|
@ -200,6 +201,11 @@
|
||||||
<string>Zoom Out</string>
|
<string>Zoom Out</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionLayout">
|
||||||
|
<property name="text">
|
||||||
|
<string>Layout</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vabstractmeasurements.h"
|
#include "vabstractmeasurements.h"
|
||||||
|
#include "../core/vapplication.h"
|
||||||
|
|
||||||
const QString VAbstractMeasurements::TagUnit = QStringLiteral("unit");
|
const QString VAbstractMeasurements::TagUnit = QStringLiteral("unit");
|
||||||
const QString VAbstractMeasurements::AttrValue = QStringLiteral("value");
|
const QString VAbstractMeasurements::AttrValue = QStringLiteral("value");
|
||||||
|
@ -214,6 +215,8 @@ qreal VAbstractMeasurements::UnitConvertor(qreal value, const Unit &from, const
|
||||||
return value / 10.0;
|
return value / 10.0;
|
||||||
case Unit::Inch:
|
case Unit::Inch:
|
||||||
return value / 25.4;
|
return value / 25.4;
|
||||||
|
case Unit::Px:
|
||||||
|
return (value / 25.4) * VApplication::PrintDPI;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -227,6 +230,8 @@ qreal VAbstractMeasurements::UnitConvertor(qreal value, const Unit &from, const
|
||||||
return value;
|
return value;
|
||||||
case Unit::Inch:
|
case Unit::Inch:
|
||||||
return value / 2.54;
|
return value / 2.54;
|
||||||
|
case Unit::Px:
|
||||||
|
return ((value * 10.0) / 25.4) * VApplication::PrintDPI;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -240,6 +245,23 @@ qreal VAbstractMeasurements::UnitConvertor(qreal value, const Unit &from, const
|
||||||
return value * 2.54;
|
return value * 2.54;
|
||||||
case Unit::Inch:
|
case Unit::Inch:
|
||||||
return value;
|
return value;
|
||||||
|
case Unit::Px:
|
||||||
|
return value * VApplication::PrintDPI;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Unit::Px:
|
||||||
|
switch (to)
|
||||||
|
{
|
||||||
|
case Unit::Mm:
|
||||||
|
return (value / VApplication::PrintDPI) * 25.4;
|
||||||
|
case Unit::Cm:
|
||||||
|
return ((value / VApplication::PrintDPI) * 25.4) / 10.0;
|
||||||
|
case Unit::Inch:
|
||||||
|
return value / VApplication::PrintDPI;
|
||||||
|
case Unit::Px:
|
||||||
|
return value;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
|
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
|
||||||
#endif /*Q_OS_WIN32*/
|
#endif /*Q_OS_WIN32*/
|
||||||
|
|
||||||
enum class Unit : char { Mm, Cm, Inch };
|
enum class Unit : char { Mm, Cm, Inch, Px };
|
||||||
enum class MeasurementsType : char { Standard, Individual };
|
enum class MeasurementsType : char { Standard, Individual };
|
||||||
|
|
||||||
static const quint32 null_id = 0;
|
static const quint32 null_id = 0;
|
||||||
|
|
|
@ -96,6 +96,7 @@ const QString VDomDocument::AttrUnit = QStringLiteral("unit");
|
||||||
const QString VDomDocument::UnitMM = QStringLiteral("mm");
|
const QString VDomDocument::UnitMM = QStringLiteral("mm");
|
||||||
const QString VDomDocument::UnitCM = QStringLiteral("cm");
|
const QString VDomDocument::UnitCM = QStringLiteral("cm");
|
||||||
const QString VDomDocument::UnitINCH = QStringLiteral("inch");
|
const QString VDomDocument::UnitINCH = QStringLiteral("inch");
|
||||||
|
const QString VDomDocument::UnitPX = QStringLiteral("px");
|
||||||
const QString VDomDocument::TagVersion = QStringLiteral("version");
|
const QString VDomDocument::TagVersion = QStringLiteral("version");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -499,7 +500,7 @@ void VDomDocument::setXMLContent(const QString &fileName)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
Unit VDomDocument::StrToUnits(const QString &unit)
|
Unit VDomDocument::StrToUnits(const QString &unit)
|
||||||
{
|
{
|
||||||
QStringList units = QStringList() << UnitMM << UnitCM << UnitINCH;
|
QStringList units = QStringList() << UnitMM << UnitCM << UnitINCH << UnitPX;
|
||||||
Unit result = Unit::Cm;
|
Unit result = Unit::Cm;
|
||||||
switch (units.indexOf(unit))
|
switch (units.indexOf(unit))
|
||||||
{
|
{
|
||||||
|
@ -512,6 +513,9 @@ Unit VDomDocument::StrToUnits(const QString &unit)
|
||||||
case 2:// inch
|
case 2:// inch
|
||||||
result = Unit::Inch;
|
result = Unit::Inch;
|
||||||
break;
|
break;
|
||||||
|
case 3:// px
|
||||||
|
result = Unit::Px;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
result = Unit::Cm;
|
result = Unit::Cm;
|
||||||
break;
|
break;
|
||||||
|
@ -563,6 +567,16 @@ QString VDomDocument::UnitsToStr(const Unit &unit, const bool translate)
|
||||||
result = UnitINCH;
|
result = UnitINCH;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Unit::Px:
|
||||||
|
if (translate)
|
||||||
|
{
|
||||||
|
result = QObject::tr("px");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = UnitPX;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (translate)
|
if (translate)
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,6 +73,7 @@ public:
|
||||||
static const QString UnitMM;
|
static const QString UnitMM;
|
||||||
static const QString UnitCM;
|
static const QString UnitCM;
|
||||||
static const QString UnitINCH;
|
static const QString UnitINCH;
|
||||||
|
static const QString UnitPX;
|
||||||
static const QString TagVersion;
|
static const QString TagVersion;
|
||||||
/**
|
/**
|
||||||
* @param data container with variables
|
* @param data container with variables
|
||||||
|
|
|
@ -235,7 +235,7 @@ bool VLayoutPaper::AddToBlankSheet(const VLayoutDetail &detail)
|
||||||
workDetail.GetMatrix());
|
workDetail.GetMatrix());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++d->frame;
|
d->frame = d->frame + 2;
|
||||||
|
|
||||||
for (int angle = 0; angle < 360; ++angle)
|
for (int angle = 0; angle < 360; ++angle)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user