2017-08-10 13:47:56 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file dialogeditlabel.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 11 8, 2017
|
|
|
|
**
|
|
|
|
** @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) 2013-2017 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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
2017-08-09 16:33:20 +02:00
|
|
|
#ifndef DIALOGEDITLABEL_H
|
|
|
|
#define DIALOGEDITLABEL_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2017-08-12 10:40:58 +02:00
|
|
|
#include <QMap>
|
2017-08-09 16:33:20 +02:00
|
|
|
|
2017-08-09 18:32:14 +02:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class DialogEditLabel;
|
2017-08-09 16:33:20 +02:00
|
|
|
}
|
|
|
|
|
2017-08-10 16:14:39 +02:00
|
|
|
class VLabelTemplateLine;
|
2017-08-12 10:40:58 +02:00
|
|
|
class QMenu;
|
2017-08-14 14:11:14 +02:00
|
|
|
class VAbstractPattern;
|
2017-08-17 18:18:03 +02:00
|
|
|
class VPiece;
|
2017-08-10 16:14:39 +02:00
|
|
|
|
2017-08-09 16:33:20 +02:00
|
|
|
class DialogEditLabel : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-08-14 14:11:14 +02:00
|
|
|
explicit DialogEditLabel(VAbstractPattern *doc, QWidget *parent = nullptr);
|
2017-08-09 18:32:14 +02:00
|
|
|
virtual ~DialogEditLabel();
|
2017-08-09 16:33:20 +02:00
|
|
|
|
2017-08-14 18:34:33 +02:00
|
|
|
QVector<VLabelTemplateLine> GetTemplate() const;
|
2017-08-14 19:00:19 +02:00
|
|
|
void SetTemplate(const QVector<VLabelTemplateLine> &lines);
|
2017-08-14 18:34:33 +02:00
|
|
|
|
2017-08-17 18:18:03 +02:00
|
|
|
void SetPiece(const VPiece &piece);
|
|
|
|
|
2017-08-10 13:47:56 +02:00
|
|
|
private slots:
|
|
|
|
void ShowLineDetails();
|
|
|
|
void AddLine();
|
|
|
|
void RemoveLine();
|
|
|
|
void SaveLineText(const QString &text);
|
|
|
|
void SaveFontStyle(bool checked);
|
|
|
|
void SaveTextFormating(bool checked);
|
|
|
|
void NewTemplate();
|
|
|
|
void ExportTemplate();
|
|
|
|
void ImportTemplate();
|
2017-08-12 10:40:58 +02:00
|
|
|
void InsertPlaceholder();
|
2017-08-12 12:19:13 +02:00
|
|
|
void TabChanged(int index);
|
2017-08-15 17:10:15 +02:00
|
|
|
void SaveAdditionalFontSize(int i);
|
2017-08-10 13:47:56 +02:00
|
|
|
|
2017-08-09 16:33:20 +02:00
|
|
|
private:
|
2017-08-09 18:32:14 +02:00
|
|
|
Q_DISABLE_COPY(DialogEditLabel)
|
2017-08-09 16:33:20 +02:00
|
|
|
Ui::DialogEditLabel *ui;
|
2017-08-12 10:40:58 +02:00
|
|
|
QMenu *m_placeholdersMenu;
|
2017-08-14 14:11:14 +02:00
|
|
|
VAbstractPattern *m_doc;
|
2017-08-12 10:40:58 +02:00
|
|
|
|
|
|
|
QMap<QString, QPair<QString, QString>> m_placeholders;
|
2017-08-10 13:47:56 +02:00
|
|
|
|
|
|
|
void SetupControls();
|
2017-08-12 10:40:58 +02:00
|
|
|
void InitPlaceholdersMenu();
|
|
|
|
void InitPlaceholders();
|
2017-08-10 16:14:39 +02:00
|
|
|
|
2017-08-12 12:19:13 +02:00
|
|
|
QString ReplacePlaceholders(QString line) const;
|
|
|
|
|
|
|
|
void InitPreviewLines(const QVector<VLabelTemplateLine> &lines);
|
2017-08-09 16:33:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DIALOGEDITLABEL_H
|