namecreater/NameCreater/INameCreater.h

40 lines
961 B
C++

#pragma once
#include <QObject>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsRectItem>
#define BG_WIDTH 3508
#define BG_HEIGHT 2481
struct NameInfo_t {
QString name1;
QString name2;
QString bg_path;
bool is_number_bg;
int bg_type;
};
enum Name_Type_e {
Name_zh = 0,
Name_eng,
Name_zh_eng
};
class INameCreater : public QObject {
public:
INameCreater();
~INameCreater();
protected:
void saveToImage(const QString& filename, QGraphicsScene* scene);
QList<NameInfo_t> getNameByFile(Name_Type_e type, const QString& filename);
QList<NameInfo_t> getNameByFileContent(Name_Type_e type, const QByteArray& conetent);
virtual void generaImageFromCSV(Name_Type_e type, const QString& filename, const QByteArray& filecontent, const QFont& font, const QColor& font_color);
private:
int getFontSizebyStr(const QFont& font, int max_font_size, int max_label_width, const QString& str);
};