2016-07-18 22:30:14 +02:00
|
|
|
#ifndef VTEXTMANAGER_H
|
|
|
|
#define VTEXTMANAGER_H
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QFont>
|
2016-07-21 21:46:49 +02:00
|
|
|
#include <QDate>
|
|
|
|
|
|
|
|
#include "../vpatterndb/vpatternpiecedata.h"
|
2016-07-18 22:30:14 +02:00
|
|
|
|
|
|
|
#define MIN_FONT_SIZE 12
|
|
|
|
#define MAX_FONT_SIZE 128
|
|
|
|
|
|
|
|
struct TextLine
|
|
|
|
{
|
|
|
|
QString m_qsText;
|
|
|
|
int m_iFontSize; // 0 means default
|
|
|
|
QFont::Weight m_eFontWeight;
|
|
|
|
QFont::Style m_eStyle;
|
|
|
|
Qt::Alignment m_eAlign;
|
|
|
|
int m_iHeight;
|
|
|
|
|
|
|
|
TextLine();
|
|
|
|
};
|
|
|
|
|
|
|
|
class VTextManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VTextManager();
|
|
|
|
~VTextManager();
|
|
|
|
|
|
|
|
int GetSpacing() const;
|
|
|
|
void SetFont(const QFont& font);
|
|
|
|
const QFont& GetFont() const;
|
|
|
|
void SetFontSize(int iFS);
|
|
|
|
void AddLine(const TextLine& tl);
|
|
|
|
void Clear();
|
|
|
|
int GetCount() const;
|
2016-07-19 02:26:50 +02:00
|
|
|
int GetSourceLineCount() const;
|
2016-07-18 22:30:14 +02:00
|
|
|
const TextLine& GetLine(int i) const;
|
|
|
|
bool IsBigEnough(qreal fW, qreal fH, int iFontSize);
|
2016-07-19 13:47:21 +02:00
|
|
|
void FitFontSize(qreal fW, qreal fH);
|
2016-07-21 21:46:49 +02:00
|
|
|
/** @brief Update(const QString& qsName, const VPatternPieceData& data)
|
|
|
|
* Updates the manager with detail name and detail data
|
|
|
|
*/
|
|
|
|
void Update(const QString& qsName, const VPatternPieceData& data);
|
|
|
|
/** @brief Updateconst QString& qsPattern, const QString& qsNumber, const QString& qsSize,
|
|
|
|
const QString& qsCompany, const QString& qsCustomer, const QDate& date)
|
|
|
|
Updates the manager with pattern data
|
|
|
|
*/
|
|
|
|
void Update(const QString& qsPattern, const QString& qsNumber, const QString& qsSize,
|
|
|
|
const QString& qsCompany, const QString& qsCustomer, const QDate& date);
|
2016-07-18 22:30:14 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
QStringList SplitString(const QString& qs, qreal fW, const QFontMetrics& fm);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QFont m_font;
|
|
|
|
QList<TextLine> m_liLines;
|
|
|
|
QList<TextLine> m_liOutput;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VTEXTMANAGER_H
|