Valentina did not read/write the layout dialog settings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-09-13 13:07:12 +03:00
parent ec82936f86
commit 59389aa049
2 changed files with 12 additions and 12 deletions

View File

@ -58,15 +58,16 @@ const DialogLayoutSettings::FormatsVector DialogLayoutSettings::pageFormatNames=
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent, bool disableSetting) DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent, bool disableSettings)
: QDialog(parent), disableSettings(disableSettings), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm), oldLayoutUnit(Unit::Mm), : QDialog(parent), disableSettings(disableSettings), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm),
generator(generator) oldLayoutUnit(Unit::Mm), generator(generator)
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
//moved from ReadSettings - well...it seems it can be done once only (i.e. constructor) because Init funcs dont even cleanse lists before adding //moved from ReadSettings - well...it seems it can be done once only (i.e. constructor) because Init funcs dont
//even cleanse lists before adding
InitPaperUnits(); InitPaperUnits();
InitLayoutUnits(); InitLayoutUnits();
InitTemplates(); InitTemplates();
@ -74,7 +75,7 @@ DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget
MinimumLayoutSize(); MinimumLayoutSize();
//in export console mode going to use defaults //in export console mode going to use defaults
if (!disableSettings) if (disableSettings == false)
{ {
ReadSettings(); ReadSettings();
} }
@ -140,8 +141,7 @@ void DialogLayoutSettings::SetPaperWidth(int value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
unsigned int DialogLayoutSettings::GetShift() const unsigned int DialogLayoutSettings::GetShift() const
{ {
return static_cast<quint32>(qFloor(UnitConvertor(ui->doubleSpinBoxShift->value(), return static_cast<quint32>(qFloor(UnitConvertor(ui->doubleSpinBoxShift->value(), oldLayoutUnit, Unit::Px)));
oldLayoutUnit, Unit::Px)));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -153,8 +153,7 @@ void DialogLayoutSettings::SetShift(unsigned int value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
unsigned int DialogLayoutSettings::GetLayoutWidth() const unsigned int DialogLayoutSettings::GetLayoutWidth() const
{ {
return static_cast<quint32>(qFloor(UnitConvertor(ui->doubleSpinBoxLayoutWidth->value(), return static_cast<quint32>(qFloor(UnitConvertor(ui->doubleSpinBoxLayoutWidth->value(), oldLayoutUnit, Unit::Px)));
oldLayoutUnit, Unit::Px)));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -420,7 +419,7 @@ void DialogLayoutSettings::DialogAccepted()
generator->SetUnitePages(IsUnitePages()); generator->SetUnitePages(IsUnitePages());
//don't want to break visual settings when cmd used //don't want to break visual settings when cmd used
if (!disableSettings) if (disableSettings == false)
{ {
WriteSettings(); WriteSettings();
} }

View File

@ -47,8 +47,9 @@ class DialogLayoutSettings : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
enum class PaperSizeTemplate : char { A0 = 0, A1, A2, A3, A4, Letter, Legal, Roll24in, Roll30in, Roll36in, Roll42in, Roll44in}; enum class PaperSizeTemplate : char { A0 = 0, A1, A2, A3, A4, Letter, Legal, Roll24in, Roll30in, Roll36in, Roll42in,
DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent = 0, bool disableSetting = false); Roll44in};
DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent = nullptr, bool disableSettings = false);
~DialogLayoutSettings(); ~DialogLayoutSettings();
int GetPaperHeight() const; int GetPaperHeight() const;