Refactoring.

Fix code style.
This commit is contained in:
Roman Telezhynskyi 2023-05-18 10:27:40 +03:00
parent baba595be3
commit 1a0ca6c782

View File

@ -29,36 +29,39 @@
#ifndef VTEXTMANAGER_H
#define VTEXTMANAGER_H
#include <QCoreApplication>
#include <QDate>
#include <QFont>
#include <QList>
#include <QString>
#include <QStringList>
#include <QVector>
#include <Qt>
#include <QtGlobal>
#include <QCoreApplication>
#include <QVector>
#include "../vmisc/defglobal.h"
class VPieceLabelData;
class VAbstractPattern;
class VContainer;
#define MIN_FONT_SIZE 5
#define MAX_FONT_SIZE 128
#define MIN_FONT_SIZE 5
#define MAX_FONT_SIZE 128
/**
* @brief The TextLine struct holds the information about one text line
*/
struct TextLine
{
QString m_qsText{};
int m_iFontSize{MIN_FONT_SIZE}; // 0 means default
bool m_bold{false};
bool m_italic{false};
QString m_qsText{};
int m_iFontSize{MIN_FONT_SIZE}; // 0 means default
bool m_bold{false};
bool m_italic{false};
Qt::Alignment m_eAlign{Qt::AlignCenter};
friend auto operator<<(QDataStream& dataStream, const TextLine& data) -> QDataStream&;
friend auto operator>>(QDataStream& dataStream, TextLine& data) -> QDataStream&;
friend auto operator<<(QDataStream &dataStream, const TextLine &data) -> QDataStream &;
friend auto operator>>(QDataStream &dataStream, TextLine &data) -> QDataStream &;
private:
static const quint32 streamHeader;
static const quint16 classVersion;
@ -71,6 +74,7 @@ private:
class VTextManager
{
Q_DECLARE_TR_FUNCTIONS(VTextManager) // NOLINT
public:
VTextManager() = default;
virtual ~VTextManager() = default;
@ -85,26 +89,26 @@ public:
virtual auto GetSpacing() const -> int;
void SetFont(const QFont& font);
auto GetFont() const -> const QFont&;
void SetFont(const QFont &font);
auto GetFont() const -> const QFont &;
void SetFontSize(int iFS);
void FitFontSize(qreal fW, qreal fH);
auto GetAllSourceLines() const -> QVector<TextLine>;
void SetAllSourceLines(const QVector<TextLine> &lines);
auto GetSourceLinesCount() const -> vsizetype;
auto GetSourceLine(vsizetype i) const -> const TextLine&;
auto GetSourceLine(vsizetype i) const -> const TextLine &;
auto MaxLineWidth(int width) const -> int;
void Update(const QString& qsName, const VPieceLabelData& data, const VContainer *pattern);
void Update(VAbstractPattern* pDoc, const VContainer *pattern);
void Update(const QString &qsName, const VPieceLabelData &data, const VContainer *pattern);
void Update(VAbstractPattern *pDoc, const VContainer *pattern);
friend auto operator<<(QDataStream& dataStream, const VTextManager& data) -> QDataStream&;
friend auto operator>>(QDataStream& dataStream, VTextManager& data) -> QDataStream&;
friend auto operator<<(QDataStream &dataStream, const VTextManager &data) -> QDataStream &;
friend auto operator>>(QDataStream &dataStream, VTextManager &data) -> QDataStream &;
private:
QFont m_font{};
QFont m_font{};
QVector<TextLine> m_liLines{};
static const quint32 streamHeader;