0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 00:33:02 +03:00

Translation has been fixed

This commit is contained in:
Arin Alexander 2018-09-01 12:36:25 +03:00
parent a56cfdc4d7
commit 7566cfd886
6 changed files with 30 additions and 11 deletions

View File

@ -908,6 +908,7 @@ bool ReportEnginePrivate::isNeedToSave()
QString ReportEnginePrivate::renderToString() QString ReportEnginePrivate::renderToString()
{ {
LimeReport::ReportRender render; LimeReport::ReportRender render;
updateTranslations();
dataManager()->connectAllDatabases(); dataManager()->connectAllDatabases();
dataManager()->setDesignTime(false); dataManager()->setDesignTime(false);
if (m_pages.count()){ if (m_pages.count()){
@ -1120,6 +1121,7 @@ ReportPages ReportEnginePrivate::renderToPages()
{ {
if (m_reportRendering) return ReportPages(); if (m_reportRendering) return ReportPages();
m_reportRender = ReportRender::Ptr(new ReportRender); m_reportRender = ReportRender::Ptr(new ReportRender);
updateTranslations();
dataManager()->clearErrors(); dataManager()->clearErrors();
dataManager()->connectAllDatabases(); dataManager()->connectAllDatabases();
@ -1160,7 +1162,6 @@ ReportPages ReportEnginePrivate::renderToPages()
} }
} }
for (int i=0; i<m_renderingPages.count(); ++i){ for (int i=0; i<m_renderingPages.count(); ++i){
PageItemDesignIntf* page = m_renderingPages.at(i); PageItemDesignIntf* page = m_renderingPages.at(i);
if (page->isTOC()){ if (page->isTOC()){

View File

@ -82,8 +82,14 @@ void ReportTranslation::updatePageTranslation(PageDesignIntf* page)
if (itemTranslation){ if (itemTranslation){
foreach(QString propertyName, stringsForTranslation.keys()){ foreach(QString propertyName, stringsForTranslation.keys()){
PropertyTranslation* propertyTranslation = itemTranslation->findProperty(propertyName); PropertyTranslation* propertyTranslation = itemTranslation->findProperty(propertyName);
if (propertyTranslation->checked)
propertyTranslation->sourceHasBeenChanged = propertyTranslation->sourceValue != stringsForTranslation.value(propertyName);
if (propertyTranslation->sourceHasBeenChanged)
propertyTranslation->checked = false;
propertyTranslation->sourceValue = stringsForTranslation.value(propertyName); propertyTranslation->sourceValue = stringsForTranslation.value(propertyName);
propertyTranslation->sourceHasBeenChanged = propertyTranslation->value != propertyTranslation->sourceValue;
if ( language() == QLocale::AnyLanguage )
propertyTranslation->value = propertyTranslation->sourceValue;
} }
} else { } else {
createItemTranslation(item, pageTranslation); createItemTranslation(item, pageTranslation);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 B

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -19,7 +19,7 @@ TranslationEditor::TranslationEditor(QWidget *parent) :
ui->splitter_2->setStretchFactor(1,2); ui->splitter_2->setStretchFactor(1,2);
ui->splitter->setStretchFactor(0,2); ui->splitter->setStretchFactor(0,2);
QTableWidgetItem* item = new QTableWidgetItem(); QTableWidgetItem* item = new QTableWidgetItem();
item->setIcon(QIcon(":/translationeditor/images/checked.png")); item->setIcon(QIcon(":/translationeditor/checked"));
ui->tbStrings->setColumnCount(4); ui->tbStrings->setColumnCount(4);
ui->tbStrings->setColumnWidth(0,30); ui->tbStrings->setColumnWidth(0,30);
ui->tbStrings->setColumnWidth(1,100); ui->tbStrings->setColumnWidth(1,100);
@ -132,8 +132,14 @@ void TranslationEditor::activatePage(PageTranslation* pageTranslation)
ui->tbStrings->setRowCount(rowIndex+1); ui->tbStrings->setRowCount(rowIndex+1);
foreach(PropertyTranslation* propertyTranslation, itemTranslation->propertyesTranslation){ foreach(PropertyTranslation* propertyTranslation, itemTranslation->propertyesTranslation){
QTableWidgetItem* checkItem = new QTableWidgetItem(); QTableWidgetItem* checkItem = new QTableWidgetItem();
if (propertyTranslation->checked)
checkItem->setIcon(QIcon(":/translationeditor/images/checked.png")); if (propertyTranslation->sourceHasBeenChanged){
checkItem->setIcon(QIcon(":/translationeditor/question"));
}
if (propertyTranslation->checked){
checkItem->setIcon(QIcon(":/translationeditor/checked"));
}
ui->tbStrings->setItem(rowIndex,0,checkItem); ui->tbStrings->setItem(rowIndex,0,checkItem);
ui->tbStrings->setItem(rowIndex,1,new QTableWidgetItem(itemTranslation->itemName)); ui->tbStrings->setItem(rowIndex,1,new QTableWidgetItem(itemTranslation->itemName));
ui->tbStrings->setItem(rowIndex,2,new QTableWidgetItem(propertyTranslation->propertyName)); ui->tbStrings->setItem(rowIndex,2,new QTableWidgetItem(propertyTranslation->propertyName));
@ -179,7 +185,7 @@ void TranslationEditor::on_cbChecked_toggled(bool checked)
{ {
if (m_currentPropertyTranslation){ if (m_currentPropertyTranslation){
m_currentPropertyTranslation->checked = checked; m_currentPropertyTranslation->checked = checked;
ui->tbStrings->item(ui->tbStrings->currentRow(),0)->setIcon(checked ? QIcon(":/translationeditor/images/checked.png"):QIcon()); ui->tbStrings->item(ui->tbStrings->currentRow(),0)->setIcon(checked ? QIcon(":/translationeditor/checked"):QIcon());
} }
} }

View File

@ -1,8 +1,9 @@
<RCC> <RCC>
<qresource prefix="/translationeditor"> <qresource prefix="/translationeditor">
<file>images/add.png</file> <file alias="add">images/add.png</file>
<file>images/remove.png</file> <file alias="remove">images/remove.png</file>
<file>images/checked.png</file> <file>images/checked.png</file>
<file>images/question.png</file> <file alias="question">images/question.png</file>
<file alias="checked">images/green_check.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -62,7 +62,7 @@
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="translationeditor.qrc"> <iconset resource="translationeditor.qrc">
<normaloff>:/translationeditor/images/add.png</normaloff>:/translationeditor/images/add.png</iconset> <normaloff>:/translationeditor/add</normaloff>:/translationeditor/add</iconset>
</property> </property>
<property name="autoRaise"> <property name="autoRaise">
<bool>true</bool> <bool>true</bool>
@ -76,7 +76,7 @@
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="translationeditor.qrc"> <iconset resource="translationeditor.qrc">
<normaloff>:/translationeditor/images/remove.png</normaloff>:/translationeditor/images/remove.png</iconset> <normaloff>:/translationeditor/remove</normaloff>:/translationeditor/remove</iconset>
</property> </property>
<property name="autoRaise"> <property name="autoRaise">
<bool>true</bool> <bool>true</bool>
@ -158,6 +158,10 @@
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="icon">
<iconset resource="translationeditor.qrc">
<normaloff>:/translationeditor/checked</normaloff>:/translationeditor/checked</iconset>
</property>
</column> </column>
<column> <column>
<property name="text"> <property name="text">
@ -215,6 +219,7 @@
</widget> </widget>
<resources> <resources>
<include location="translationeditor.qrc"/> <include location="translationeditor.qrc"/>
<include location="translationeditor.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>