1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-23 02:42:39 +01:00
openrw/rwviewer/models/TextModel.hpp
2018-08-06 00:16:33 +02:00

36 lines
1.0 KiB
C++

#ifndef _TEXTMODEL_HPP_
#define _TEXTMODEL_HPP_
#include <string>
#include <map>
#include <vector>
#include <QAbstractTableModel>
#include <fonts/GameTexts.hpp>
struct TextMapType {
std::vector<std::string> languages;
std::vector<std::string> keys;
std::map<std::string, std::map<std::string, GameString>> map_lang_key_tran;
};
class TextModel : public QAbstractTableModel {
Q_OBJECT
public:
TextModel(QObject *parent = nullptr);
void setData(const TextMapType &textMap);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
const GameString &lookupIndex(const QModelIndex &index) const;
public slots:
void fontChanged(font_t font);
private:
font_t m_font = FONT_PAGER;
TextMapType m_textMap;
};
#endif