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