2017-07-29 00:54:43 +03:00
|
|
|
#ifndef REPORTTRANSLATION_H
|
|
|
|
#define REPORTTRANSLATION_H
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
#include "lrpagedesignintf.h"
|
|
|
|
|
2017-07-29 00:54:43 +03:00
|
|
|
#include <QList>
|
|
|
|
#include <QLocale>
|
|
|
|
#include <QMetaType>
|
2024-09-04 17:31:16 +03:00
|
|
|
#include <QString>
|
2017-07-29 00:54:43 +03:00
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
class ATranslationProperty {
|
2017-07-29 00:54:43 +03:00
|
|
|
public:
|
2024-09-04 17:31:16 +03:00
|
|
|
ATranslationProperty() { }
|
|
|
|
ATranslationProperty(const ACollectionProperty&) { }
|
|
|
|
virtual ~ATranslationProperty() { }
|
2017-07-29 00:54:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(ATranslationProperty)
|
|
|
|
const int TRANSLATION_TYPE_ID = qMetaTypeId<ATranslationProperty>();
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
namespace LimeReport {
|
2017-07-29 00:54:43 +03:00
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
struct PropertyTranslation {
|
2017-07-29 00:54:43 +03:00
|
|
|
QString propertyName;
|
|
|
|
QString value;
|
2017-08-05 01:38:19 +03:00
|
|
|
QString sourceValue;
|
2024-09-04 17:31:16 +03:00
|
|
|
bool checked;
|
|
|
|
bool sourceHasBeenChanged;
|
2017-07-29 00:54:43 +03:00
|
|
|
};
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
struct ItemTranslation {
|
2017-07-29 00:54:43 +03:00
|
|
|
QString itemName;
|
2019-07-24 03:13:23 +03:00
|
|
|
bool checked;
|
2017-08-05 01:38:19 +03:00
|
|
|
PropertyTranslation* findProperty(const QString& propertyName);
|
|
|
|
~ItemTranslation();
|
|
|
|
QList<PropertyTranslation*> propertyesTranslation;
|
2017-07-29 00:54:43 +03:00
|
|
|
};
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
struct PageTranslation {
|
2017-07-29 00:54:43 +03:00
|
|
|
QString pageName;
|
2019-07-24 03:13:23 +03:00
|
|
|
bool checked;
|
2017-08-05 01:38:19 +03:00
|
|
|
~PageTranslation();
|
2019-07-24 03:13:23 +03:00
|
|
|
void renameItem(const QString& oldName, const QString& newName);
|
|
|
|
QHash<QString, ItemTranslation*> itemsTranslation;
|
2017-07-29 00:54:43 +03:00
|
|
|
};
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
class ReportTranslation {
|
2017-07-29 00:54:43 +03:00
|
|
|
public:
|
2024-09-04 17:31:16 +03:00
|
|
|
ReportTranslation(QLocale::Language language): m_language(language) { }
|
2017-07-29 00:54:43 +03:00
|
|
|
ReportTranslation(QLocale::Language language, QList<PageDesignIntf*> pages);
|
|
|
|
ReportTranslation(const ReportTranslation& reportTranslation);
|
|
|
|
~ReportTranslation();
|
|
|
|
QLocale::Language language() const;
|
2024-09-04 17:31:16 +03:00
|
|
|
QList<PageTranslation*>& pagesTranslation();
|
2017-07-29 00:54:43 +03:00
|
|
|
PageTranslation* createEmptyPageTranslation();
|
2017-08-05 01:38:19 +03:00
|
|
|
void updatePageTranslation(PageDesignIntf* page);
|
2019-07-24 03:13:23 +03:00
|
|
|
PageTranslation* findPageTranslation(const QString& pageName);
|
|
|
|
void renamePage(const QString& oldName, const QString& newName);
|
|
|
|
void invalidatePages();
|
|
|
|
void clearInvalidPages();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2017-07-29 00:54:43 +03:00
|
|
|
private:
|
2019-07-24 03:13:23 +03:00
|
|
|
void createItemTranslation(BaseDesignIntf* item, PageTranslation* pageTranslation);
|
2017-07-29 00:54:43 +03:00
|
|
|
PageTranslation* createPageTranslation(PageDesignIntf* page);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2017-07-29 00:54:43 +03:00
|
|
|
private:
|
|
|
|
QLocale::Language m_language;
|
2021-12-16 00:13:39 +03:00
|
|
|
QLocale::Script m_script;
|
2017-07-29 00:54:43 +03:00
|
|
|
QList<PageTranslation*> m_pagesTranslation;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef QMap<QLocale::Language, ReportTranslation*> Translations;
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
class ITranslationContainer {
|
2017-07-29 00:54:43 +03:00
|
|
|
public:
|
2024-09-04 17:31:16 +03:00
|
|
|
virtual ~ITranslationContainer() { }
|
2017-07-29 00:54:43 +03:00
|
|
|
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;
|
2017-07-29 00:54:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace LimeReport
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
// Q_DECLARE_METATYPE(ReportTranslation)
|
2017-07-29 00:54:43 +03:00
|
|
|
|
|
|
|
#endif // REPORTTRANSLATION_H
|