Finish 1.4.80

# Conflicts:
#	limereport/objectinspector/lrobjectitemmodel.cpp
#	translations/limereport_ru.ts
This commit is contained in:
Arin Alexander 2018-06-04 00:23:18 +03:00
commit 403fed6bcb
5 changed files with 44 additions and 8 deletions

View File

@ -105,7 +105,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 4
LIMEREPORT_VERSION_RELEASE = 78
LIMEREPORT_VERSION_RELEASE = 80
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"

View File

@ -61,7 +61,8 @@ namespace LimeReport{
TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
: ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false),
m_allowHTMLInFields(false), m_followTo(""), m_follower(0), m_textIndent(0), m_textLayoutDirection(Qt::LayoutDirectionAuto)
m_allowHTMLInFields(false), m_replaceCarriageReturns(false), m_followTo(""), m_follower(0), m_textIndent(0),
m_textLayoutDirection(Qt::LayoutDirectionAuto)
{
PageItemDesignIntf* pageItem = dynamic_cast<PageItemDesignIntf*>(parent);
BaseDesignIntf* parentItem = dynamic_cast<BaseDesignIntf*>(parent);
@ -308,8 +309,10 @@ void TextItem::setContent(const QString &value)
void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
{
if (isNeedExpandContent())
expandContent(dataManager, pass);
if (!isLoading() && (autoHeight() || autoWidth() || hasFollower()) )
initTextSizes();
@ -350,12 +353,12 @@ bool TextItem::isNeedExpandContent() const
return content().contains(rx) || isContentBackedUp();
}
QString TextItem::replaceBR(QString text)
QString TextItem::replaceBR(QString text) const
{
return text.replace("<br/>","\n");
}
QString TextItem::replaceReturns(QString text)
QString TextItem::replaceReturns(QString text) const
{
QString result = text.replace("\r\n","<br/>");
result = result.replace("\n","<br/>");
@ -484,7 +487,11 @@ TextItem::TextPtr TextItem::textDocument() const
TextPtr text(new QTextDocument);
if (allowHTML())
text->setHtml(m_strText);
if (isReplaceCarriageReturns()){
text->setHtml(replaceReturns(m_strText));
} else {
text->setHtml(m_strText);
}
else
text->setPlainText(m_strText);
@ -531,6 +538,21 @@ TextItem::TextPtr TextItem::textDocument() const
}
bool TextItem::isReplaceCarriageReturns() const
{
return m_replaceCarriageReturns;
}
void TextItem::setReplaceCarriageReturns(bool replaceCarriageReturns)
{
if (replaceCarriageReturns != m_replaceCarriageReturns){
m_replaceCarriageReturns = replaceCarriageReturns;
update();
notify("replaceCRwithBR",!replaceCarriageReturns, replaceCarriageReturns);
}
}
qreal TextItem::textIndent() const
{
return m_textIndent;

View File

@ -73,6 +73,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit {
Q_PROPERTY(Qt::LayoutDirection textLayoutDirection READ textLayoutDirection WRITE setTextLayoutDirection)
Q_PROPERTY(bool fillInSecondPass READ fillInSecondPass WRITE setFillInSecondPass)
Q_PROPERTY(bool watermark READ isWatermark WRITE setWatermark)
Q_PROPERTY(bool replaceCRwithBR READ isReplaceCarriageReturns WRITE setReplaceCarriageReturns)
public:
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
@ -168,11 +169,14 @@ public:
void setWatermark(bool watermark);
bool isReplaceCarriageReturns() const;
void setReplaceCarriageReturns(bool isReplaceCarriageReturns);
protected:
void updateLayout();
bool isNeedExpandContent() const;
QString replaceBR(QString text);
QString replaceReturns(QString text);
QString replaceBR(QString text) const;
QString replaceReturns(QString text) const;
int fakeMarginSize() const;
QString getTextPart(int height, int skipHeight);
void restoreLinksEvent();
@ -205,6 +209,7 @@ private:
int m_underlineLineSize;
bool m_allowHTML;
bool m_allowHTMLInFields;
bool m_replaceCarriageReturns;
QString m_format;
ValueType m_valueType;

View File

@ -151,6 +151,7 @@ void QObjectPropertyModel::translatePropertyName()
tr("keepTopSpace");
tr("printable");
tr("variable");
tr("replaceCRwithBR");
}
void QObjectPropertyModel::clearObjectsList()

View File

@ -1803,7 +1803,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<source>watermark</source>
<translation>водяной знак</translation>
<translation>Водяной знак</translation>
</message>
<message>
<source>keepTopSpace</source>
@ -1817,6 +1817,10 @@ p, li { white-space: pre-wrap; }
<source>variable</source>
<translation>Переменная</translation>
</message>
<message>
<source>replaceCRwithBR</source>
<translation>Заменять CR на BR</translation>
</message>
</context>
<context>
<name>LimeReport::RectMMPropItem</name>
@ -2474,6 +2478,10 @@ This preview is no longer valid.</source>
<source>datasourceName</source>
<translation>Имя источника данных</translation>
</message>
<message>
<source>Seconds</source>
<translation>Секунды</translation>
</message>
</context>
<context>
<name>LimeReport::SettingDialog</name>