mirror of
				https://github.com/fralx/LimeReport.git
				synced 2025-11-03 22:51:26 +03:00 
			
		
		
		
	Band names translation has been added
# Conflicts: # limereport/lrbanddesignintf.h
This commit is contained in:
		@@ -160,6 +160,16 @@ BandDesignIntf::~BandDesignIntf()
 | 
				
			|||||||
    delete m_bandNameLabel;
 | 
					    delete m_bandNameLabel;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int extractItemIndex(const BaseDesignIntf* item){
 | 
				
			||||||
 | 
					    QString objectName = extractClassName(item->metaObject()->className());
 | 
				
			||||||
 | 
					    QString value = item->objectName().right(item->objectName().size() - objectName.size());
 | 
				
			||||||
 | 
					    return value.toInt();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QString BandDesignIntf::translateBandName(const BaseDesignIntf* item) const{
 | 
				
			||||||
 | 
					    return tr(extractClassName(item->metaObject()->className()).toLatin1())+QString::number(extractItemIndex(item));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 | 
					void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -171,8 +181,7 @@ void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (itemMode() & DesignMode){
 | 
					    if (itemMode() & DesignMode){
 | 
				
			||||||
        painter->save();
 | 
					        painter->save();
 | 
				
			||||||
        QString bandText = objectName();
 | 
					        QString bandText = bandTitle();
 | 
				
			||||||
        if (parentBand()) bandText+=tr(" connected to ")+parentBand()->objectName();
 | 
					 | 
				
			||||||
        QFont font("Arial", 7 * Const::fontFACTOR, -1, true);
 | 
					        QFont font("Arial", 7 * Const::fontFACTOR, -1, true);
 | 
				
			||||||
        QFontMetrics fontMetrics(font);
 | 
					        QFontMetrics fontMetrics(font);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -203,6 +212,23 @@ void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
 | 
				
			|||||||
    BaseDesignIntf::paint(painter,option,widget);
 | 
					    BaseDesignIntf::paint(painter,option,widget);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void BandDesignIntf::translateBandsName()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    tr("DataBand");
 | 
				
			||||||
 | 
					    tr("DataHeaderBand");
 | 
				
			||||||
 | 
					    tr("DataFooterBand");
 | 
				
			||||||
 | 
					    tr("ReportHeader");
 | 
				
			||||||
 | 
					    tr("ReportFooter");
 | 
				
			||||||
 | 
					    tr("PageHeader");
 | 
				
			||||||
 | 
					    tr("PageFooter");
 | 
				
			||||||
 | 
					    tr("SubDetailBand");
 | 
				
			||||||
 | 
					    tr("SubDetailHeaderBand");
 | 
				
			||||||
 | 
					    tr("SubDetailFooterBand");
 | 
				
			||||||
 | 
					    tr("GroupBandHeader");
 | 
				
			||||||
 | 
					    tr("GroupBandFooter");
 | 
				
			||||||
 | 
					    tr("TearOffBand");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BandDesignIntf::BandsType  BandDesignIntf::bandType() const
 | 
					BandDesignIntf::BandsType  BandDesignIntf::bandType() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_bandType;
 | 
					    return m_bandType;
 | 
				
			||||||
@@ -210,8 +236,8 @@ BandDesignIntf::BandsType  BandDesignIntf::bandType() const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
QString  BandDesignIntf::bandTitle() const
 | 
					QString  BandDesignIntf::bandTitle() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    QString result = objectName();
 | 
					    QString result = translateBandName(this);
 | 
				
			||||||
    if (parentBand()) result +=tr(" connected to ")+parentBand()->objectName();
 | 
					    if (parentBand()) result +=tr(" connected to ") + translateBandName(parentBand());
 | 
				
			||||||
    return result;
 | 
					    return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -121,6 +121,7 @@ public:
 | 
				
			|||||||
    ~BandDesignIntf();
 | 
					    ~BandDesignIntf();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
 | 
					    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
 | 
				
			||||||
 | 
					    void translateBandsName();
 | 
				
			||||||
    virtual BandsType bandType() const;
 | 
					    virtual BandsType bandType() const;
 | 
				
			||||||
    virtual QString bandTitle() const;
 | 
					    virtual QString bandTitle() const;
 | 
				
			||||||
    virtual QIcon bandIcon() const;
 | 
					    virtual QIcon bandIcon() const;
 | 
				
			||||||
@@ -245,7 +246,7 @@ protected:
 | 
				
			|||||||
    void moveItemsDown(qreal startPos, qreal offset);
 | 
					    void moveItemsDown(qreal startPos, qreal offset);
 | 
				
			||||||
    void preparePopUpMenu(QMenu &menu);
 | 
					    void preparePopUpMenu(QMenu &menu);
 | 
				
			||||||
    void processPopUpAction(QAction *action);
 | 
					    void processPopUpAction(QAction *action);
 | 
				
			||||||
 | 
					    QString translateBandName(const BaseDesignIntf *item) const;
 | 
				
			||||||
private slots:
 | 
					private slots:
 | 
				
			||||||
    void childBandDeleted(QObject* band);
 | 
					    void childBandDeleted(QObject* band);
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1182,8 +1182,10 @@ void ReportDesignWindow::slotBandAdded(PageDesignIntf *, BandDesignIntf * band)
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
        case BandDesignIntf::ReportFooter:
 | 
					        case BandDesignIntf::ReportFooter:
 | 
				
			||||||
            m_newReportFooter->setDisabled(true);
 | 
					            m_newReportFooter->setDisabled(true);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
        case BandDesignIntf::TearOffBand:
 | 
					        case BandDesignIntf::TearOffBand:
 | 
				
			||||||
            m_newTearOffBand->setDisabled(true);
 | 
					            m_newTearOffBand->setDisabled(true);
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
        default:
 | 
					        default:
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -262,6 +262,74 @@ p, li { white-space: pre-wrap; }
 | 
				
			|||||||
        <source>Splittable</source>
 | 
					        <source>Splittable</source>
 | 
				
			||||||
        <translation>Разбивать содержимое на части</translation>
 | 
					        <translation>Разбивать содержимое на части</translation>
 | 
				
			||||||
    </message>
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>DataBand</source>
 | 
				
			||||||
 | 
					        <translation>Данные</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>ReportHeader</source>
 | 
				
			||||||
 | 
					        <translation>Заголовок отчета</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>ReportFooter</source>
 | 
				
			||||||
 | 
					        <translation>Завершение отчета</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>PageHeader</source>
 | 
				
			||||||
 | 
					        <translation>Верхний колонтитул</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>PageFooter</source>
 | 
				
			||||||
 | 
					        <translation>Нижний колонтитул</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>Subdetail</source>
 | 
				
			||||||
 | 
					        <translation type="obsolete">Подчиненный</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>DataHeaderBand</source>
 | 
				
			||||||
 | 
					        <translation>Заголовок данных</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>DataFooterBand</source>
 | 
				
			||||||
 | 
					        <translation>Завершение данных</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>SubdetailBand</source>
 | 
				
			||||||
 | 
					        <translation type="vanished">Подчиненные данные</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>SubdetailHeaderBand</source>
 | 
				
			||||||
 | 
					        <translation type="vanished">Заголовок подчиненных данных</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>SubdetailFooterBand</source>
 | 
				
			||||||
 | 
					        <translation type="vanished">Завершение подчиненных данных</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>GroupBandHeader</source>
 | 
				
			||||||
 | 
					        <translation>Заголовок группы</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>GroupBandFooter</source>
 | 
				
			||||||
 | 
					        <translation>Завершение группы</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>TearOffBand</source>
 | 
				
			||||||
 | 
					        <translation>Полоса для отрывания</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>SubDetailBand</source>
 | 
				
			||||||
 | 
					        <translation>Подчиненные данные</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>SubDetailHeaderBand</source>
 | 
				
			||||||
 | 
					        <translation>Заголовок подчиненных данных</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
 | 
					    <message>
 | 
				
			||||||
 | 
					        <source>SubDetailFooterBand</source>
 | 
				
			||||||
 | 
					        <translation>Завершение подчиненных данных</translation>
 | 
				
			||||||
 | 
					    </message>
 | 
				
			||||||
</context>
 | 
					</context>
 | 
				
			||||||
<context>
 | 
					<context>
 | 
				
			||||||
    <name>LimeReport::BaseDesignIntf</name>
 | 
					    <name>LimeReport::BaseDesignIntf</name>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user