LimeReport/limereport/lrreporttranslation.h

82 lines
2.2 KiB
C
Raw Normal View History

#ifndef REPORTTRANSLATION_H
#define REPORTTRANSLATION_H
#include <QString>
#include <QList>
#include <QLocale>
#include <QMetaType>
#include "lrpagedesignintf.h"
class ATranslationProperty{
public:
ATranslationProperty(){}
ATranslationProperty(const ACollectionProperty& ){}
virtual ~ATranslationProperty(){}
};
Q_DECLARE_METATYPE(ATranslationProperty)
const int TRANSLATION_TYPE_ID = qMetaTypeId<ATranslationProperty>();
namespace LimeReport{
struct PropertyTranslation{
QString propertyName;
QString value;
2017-08-05 01:38:19 +03:00
QString sourceValue;
bool checked;
bool sourceHasBeenChanged;
};
struct ItemTranslation{
QString itemName;
2017-08-05 01:38:19 +03:00
PropertyTranslation* findProperty(const QString& propertyName);
~ItemTranslation();
QList<PropertyTranslation*> propertyesTranslation;
};
struct PageTranslation{
QString pageName;
2017-08-05 01:38:19 +03:00
~PageTranslation();
QHash<QString,ItemTranslation*> itemsTranslation;
};
class ReportTranslation{
public:
ReportTranslation(QLocale::Language language) :m_language(language){}
ReportTranslation(QLocale::Language language, QList<PageDesignIntf*> pages);
ReportTranslation(const ReportTranslation& reportTranslation);
~ReportTranslation();
QLocale::Language language() const;
QList<PageTranslation*> pagesTranslation() const;
PageTranslation* createEmptyPageTranslation();
2017-08-05 01:38:19 +03:00
void updatePageTranslation(PageDesignIntf* page);
PageTranslation* findPageTranslation(const QString& page_name);
void createItemTranslation(BaseDesignIntf* item, PageTranslation* pageTranslation);
private:
PageTranslation* createPageTranslation(PageDesignIntf* page);
private:
QLocale::Language m_language;
QList<PageTranslation*> m_pagesTranslation;
};
typedef QMap<QLocale::Language, ReportTranslation*> Translations;
class ITranslationContainer{
public:
2017-08-16 01:18:56 +03:00
virtual ~ITranslationContainer(){}
virtual Translations* translations() = 0;
2017-08-05 01:38:19 +03:00
virtual void updateTranslations() = 0;
2017-08-16 01:18:56 +03:00
virtual bool addTranslationLanguage(QLocale::Language language) = 0;
virtual bool removeTranslationLanguage(QLocale::Language language) = 0;
virtual QList<QLocale::Language> aviableLanguages() = 0;
};
} // namespace LimeReport
//Q_DECLARE_METATYPE(ReportTranslation)
#endif // REPORTTRANSLATION_H