2015-01-14 15:14:51 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @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.
|
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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef DIALOGLAYOUTSETTINGS_H
|
|
|
|
#define DIALOGLAYOUTSETTINGS_H
|
|
|
|
|
2015-05-08 16:24:20 +02:00
|
|
|
#include <QCloseEvent>
|
2015-01-14 15:14:51 +01:00
|
|
|
#include <QDialog>
|
|
|
|
|
2015-10-08 20:11:50 +02:00
|
|
|
#include "../vlayout/vbank.h"
|
|
|
|
#include "../ifc/ifcdef.h"
|
2015-12-19 15:38:24 +01:00
|
|
|
|
|
|
|
#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
|
|
|
|
# include "../vmisc/backport/qmarginsf.h"
|
|
|
|
#else
|
|
|
|
# include <QMargins>
|
|
|
|
#endif
|
2015-01-14 15:14:51 +01:00
|
|
|
|
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class DialogLayoutSettings;
|
|
|
|
}
|
|
|
|
|
2015-05-02 18:21:47 +02:00
|
|
|
class VLayoutGenerator;
|
|
|
|
|
2015-01-14 15:14:51 +01:00
|
|
|
class DialogLayoutSettings : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-10-23 19:47:33 +02:00
|
|
|
enum class PaperSizeTemplate : char { A0 = 0,
|
|
|
|
A1,
|
|
|
|
A2,
|
|
|
|
A3,
|
|
|
|
A4,
|
|
|
|
Letter,
|
|
|
|
Legal,
|
|
|
|
Roll24in = 7, // Be carefull when change order roll type
|
|
|
|
Roll30in, // Used also for showing icon
|
|
|
|
Roll36in,
|
|
|
|
Roll42in,
|
2015-11-05 19:04:09 +01:00
|
|
|
Roll44in = 11,
|
|
|
|
Custom = 12};
|
2015-10-20 16:32:01 +02:00
|
|
|
explicit DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent = nullptr, bool disableSettings = false);
|
2017-02-18 10:22:59 +01:00
|
|
|
virtual ~DialogLayoutSettings();
|
2015-01-14 15:14:51 +01:00
|
|
|
|
2015-11-05 12:07:51 +01:00
|
|
|
qreal GetPaperHeight() const;
|
|
|
|
void SetPaperHeight(qreal value);
|
2015-01-14 15:14:51 +01:00
|
|
|
|
2015-11-05 12:07:51 +01:00
|
|
|
qreal GetPaperWidth() const;
|
|
|
|
void SetPaperWidth(qreal value);
|
2015-01-14 15:14:51 +01:00
|
|
|
|
2015-11-05 12:07:51 +01:00
|
|
|
qreal GetShift() const;
|
|
|
|
void SetShift(qreal value);
|
2015-01-14 15:14:51 +01:00
|
|
|
|
2015-11-05 12:07:51 +01:00
|
|
|
qreal GetLayoutWidth() const;
|
|
|
|
void SetLayoutWidth(qreal value);
|
2015-01-14 15:14:51 +01:00
|
|
|
|
2015-11-09 12:33:36 +01:00
|
|
|
QMarginsF GetFields() const;
|
|
|
|
void SetFields(const QMarginsF &value);
|
|
|
|
|
2015-01-14 15:14:51 +01:00
|
|
|
Cases GetGroup() const;
|
|
|
|
void SetGroup(const Cases &value);
|
|
|
|
|
2015-01-22 15:11:50 +01:00
|
|
|
bool GetRotate() const;
|
|
|
|
void SetRotate(bool state);
|
|
|
|
|
|
|
|
int GetIncrease() const;
|
2015-08-25 19:53:03 +02:00
|
|
|
bool SetIncrease(int increase);
|
2015-01-22 15:11:50 +01:00
|
|
|
|
2015-05-02 18:21:47 +02:00
|
|
|
bool GetAutoCrop() const;
|
2017-04-06 14:50:15 +02:00
|
|
|
void SetAutoCrop(bool autoCrop);
|
2015-05-02 18:21:47 +02:00
|
|
|
|
2015-05-08 12:10:56 +02:00
|
|
|
bool IsSaveLength() const;
|
|
|
|
void SetSaveLength(bool save);
|
|
|
|
|
2015-05-18 13:26:37 +02:00
|
|
|
bool IsUnitePages() const;
|
|
|
|
void SetUnitePages(bool save);
|
|
|
|
|
2016-02-23 13:13:10 +01:00
|
|
|
bool IsStripOptimization() const;
|
|
|
|
void SetStripOptimization(bool save);
|
|
|
|
|
|
|
|
quint8 GetMultiplier() const;
|
|
|
|
void SetMultiplier(const quint8 &value);
|
|
|
|
|
2015-11-09 12:33:36 +01:00
|
|
|
bool IsIgnoreAllFields() const;
|
|
|
|
void SetIgnoreAllFields(bool value);
|
|
|
|
|
2017-07-01 19:32:54 +02:00
|
|
|
bool IsTextAsPaths() const;
|
|
|
|
void SetTextAsPaths(bool value);
|
|
|
|
|
2016-08-22 18:43:22 +02:00
|
|
|
QString SelectedPrinter() const;
|
|
|
|
|
2015-08-25 19:53:03 +02:00
|
|
|
//support functions for the command line parser which uses invisible dialog to properly build layout generator
|
|
|
|
bool SelectTemplate(const PaperSizeTemplate& id);
|
|
|
|
static QString MakeHelpTemplateList();
|
|
|
|
bool SelectPaperUnit(const QString& units);
|
|
|
|
bool SelectLayoutUnit(const QString& units);
|
2015-11-05 12:07:51 +01:00
|
|
|
qreal LayoutToPixels(qreal value) const;
|
|
|
|
qreal PageToPixels(qreal value) const;
|
2015-08-25 19:53:03 +02:00
|
|
|
static QString MakeGroupsHelp();
|
2015-11-05 12:54:15 +01:00
|
|
|
protected:
|
|
|
|
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
2015-01-14 15:14:51 +01:00
|
|
|
public slots:
|
2016-07-18 17:09:15 +02:00
|
|
|
void DialogAccepted();
|
|
|
|
private slots:
|
2015-01-14 15:14:51 +01:00
|
|
|
void ConvertPaperSize();
|
|
|
|
void ConvertLayoutSize();
|
2015-01-15 18:31:42 +01:00
|
|
|
void TemplateSelected();
|
2015-11-05 19:04:09 +01:00
|
|
|
void FindTemplate();
|
2015-01-14 15:14:51 +01:00
|
|
|
void PaperSizeChanged();
|
|
|
|
void Swap(bool checked);
|
2015-05-08 16:24:20 +02:00
|
|
|
void RestoreDefaults();
|
2016-08-22 18:43:22 +02:00
|
|
|
void PrinterMargins();
|
2016-07-18 17:09:15 +02:00
|
|
|
|
2015-11-09 12:33:36 +01:00
|
|
|
void CorrectMaxFileds();
|
|
|
|
void IgnoreAllFields(int state);
|
2015-01-14 15:14:51 +01:00
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(DialogLayoutSettings)
|
2015-10-23 19:47:33 +02:00
|
|
|
typedef QStringList FormatsVector;
|
2015-08-25 19:53:03 +02:00
|
|
|
typedef int VIndexType;
|
|
|
|
const static FormatsVector pageFormatNames;
|
|
|
|
|
|
|
|
bool disableSettings;
|
|
|
|
|
2015-01-14 15:14:51 +01:00
|
|
|
Ui::DialogLayoutSettings *ui;
|
|
|
|
Unit oldPaperUnit;
|
|
|
|
Unit oldLayoutUnit;
|
2015-05-02 18:21:47 +02:00
|
|
|
VLayoutGenerator *generator;
|
2015-11-05 12:54:15 +01:00
|
|
|
bool isInitialized;
|
2015-01-14 15:14:51 +01:00
|
|
|
|
|
|
|
void InitPaperUnits();
|
|
|
|
void InitLayoutUnits();
|
|
|
|
void InitTemplates();
|
2016-08-22 18:43:22 +02:00
|
|
|
void InitPrinter();
|
2015-01-14 15:14:51 +01:00
|
|
|
QSizeF Template();
|
2015-11-05 19:04:09 +01:00
|
|
|
QSizeF TemplateSize(const PaperSizeTemplate &tmpl) const;
|
|
|
|
QSizeF RoundTemplateSize(qreal width, qreal height) const;
|
2016-10-06 18:13:06 +02:00
|
|
|
QMarginsF MinPrinterFields() const;
|
2016-09-30 18:33:10 +02:00
|
|
|
QMarginsF GetDefPrinterFields() const;
|
2015-01-14 15:14:51 +01:00
|
|
|
|
|
|
|
Unit PaperUnit() const;
|
|
|
|
Unit LayoutUnit() const;
|
|
|
|
|
2015-01-15 18:31:42 +01:00
|
|
|
void CorrectPaperDecimals();
|
|
|
|
void CorrectLayoutDecimals();
|
|
|
|
|
|
|
|
void MinimumPaperSize();
|
|
|
|
void MinimumLayoutSize();
|
2015-05-08 16:24:20 +02:00
|
|
|
|
|
|
|
void ReadSettings();
|
|
|
|
void WriteSettings() const;
|
|
|
|
|
|
|
|
void SheetSize(const QSizeF &size);
|
2015-05-18 13:26:37 +02:00
|
|
|
void SetAdditionalOptions(bool value);
|
2015-01-14 15:14:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DIALOGLAYOUTSETTINGS_H
|