Skip to content

Commit

Permalink
Finish 1.7.10
Browse files Browse the repository at this point in the history
  • Loading branch information
fralx committed Jul 24, 2024
2 parents e833461 + d97e7e9 commit f3d2efe
Show file tree
Hide file tree
Showing 14 changed files with 142 additions and 21 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.14)
project(limereport)

set(DEFAULT_ITEM_PADDING 0)
set(LIMEREPORT_VERSION_MAJOR 1)
set(LIMEREPORT_VERSION_MINOR 7)
set(LIMEREPORT_VERSION_RELEASE 9)
Expand Down Expand Up @@ -391,7 +392,7 @@ if(ENABLE_ZINT)
target_link_libraries( ${PROJECT_NAME} PRIVATE QZint)
endif(ENABLE_ZINT)

target_compile_definitions( ${PROJECT_NAME} PRIVATE -DHAVE_QT${QT_VERSION_MAJOR} -DHAVE_REPORT_DESIGNER -DUSE_QJSENGINE -D_CRT_SECURE_NO_WARNINGS)
target_compile_definitions( ${PROJECT_NAME} PRIVATE -DDEFAULT_ITEM_PADDING=${DEFAULT_ITEM_PADDING} -DHAVE_QT${QT_VERSION_MAJOR} -DHAVE_REPORT_DESIGNER -DUSE_QJSENGINE -D_CRT_SECURE_NO_WARNINGS)

target_include_directories( ${PROJECT_NAME} PRIVATE
limereport/
Expand Down
19 changes: 17 additions & 2 deletions include/lrglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,27 @@ namespace Const{

class LIMEREPORT_EXPORT ReportSettings{
public:
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false){}
void setDefaultValues(){m_suppressAbsentFieldsAndVarsWarnings = false;}
#ifdef DEFAULT_ITEM_PADDING
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false), m_baseItemPadding(DEFAULT_ITEM_PADDING){}
#else
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false), m_baseItemPadding(0){}
#endif
void setDefaultValues(){
m_suppressAbsentFieldsAndVarsWarnings = false;
#ifdef DEFAULT_ITEM_PADDING
m_baseItemPadding = DEFAULT_ITEM_PADDING;
#else
m_baseItemPadding = 0;
#endif

}
bool suppressAbsentFieldsAndVarsWarnings() const;
void setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentFieldsAndVarsWarnings);
int baseItemPadding() const;
void setBaseItemPadding(int newBaseTextItemPadding);
private:
bool m_suppressAbsentFieldsAndVarsWarnings;
int m_baseItemPadding;
};

class LIMEREPORT_EXPORT IExternalPainter{
Expand Down
2 changes: 2 additions & 0 deletions limereport/limereport.pro
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
DEFINES += DEFAULT_ITEM_PADDING=0

CONFIG(debug, debug|release) {
TARGET = limereportd
} else {
Expand Down
6 changes: 4 additions & 2 deletions limereport/lrbasedesignintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ class LIMEREPORT_EXPORT BaseDesignIntf :
int possibleMoveDirectionFlags() const;
void setPossibleMoveFlags(int directionsFlags);

int marginSize() const {return m_margin;}
int marginSize() const {
return m_margin + m_reportSettings != 0 ? m_reportSettings->baseItemPadding() : 0;
}
void setMarginSize(int value);

QString itemTypeName() const;
Expand Down Expand Up @@ -494,7 +496,7 @@ private slots:
bool m_itemGeometryLocked;
bool m_isChangingPos;
bool m_isMoveable;
bool m_shadow;
bool m_shadow;

signals:
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
Expand Down
10 changes: 10 additions & 0 deletions limereport/lrglobal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ void ReportSettings::setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentF
m_suppressAbsentFieldsAndVarsWarnings = suppressAbsentFieldsAndVarsWarnings;
}

int ReportSettings::baseItemPadding() const
{
return m_baseItemPadding;
}

void ReportSettings::setBaseItemPadding(int newBaseTextItemPadding)
{
m_baseItemPadding = newBaseTextItemPadding;
}

QString escapeSimbols(const QString &value)
{
QString result = value;
Expand Down
19 changes: 17 additions & 2 deletions limereport/lrglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,27 @@ namespace Const{

class LIMEREPORT_EXPORT ReportSettings{
public:
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false){}
void setDefaultValues(){m_suppressAbsentFieldsAndVarsWarnings = false;}
#ifdef DEFAULT_ITEM_PADDING
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false), m_baseItemPadding(DEFAULT_ITEM_PADDING){}
#else
ReportSettings():m_suppressAbsentFieldsAndVarsWarnings(false), m_baseItemPadding(0){}
#endif
void setDefaultValues(){
m_suppressAbsentFieldsAndVarsWarnings = false;
#ifdef DEFAULT_ITEM_PADDING
m_baseItemPadding = DEFAULT_ITEM_PADDING;
#else
m_baseItemPadding = 0;
#endif

}
bool suppressAbsentFieldsAndVarsWarnings() const;
void setSuppressAbsentFieldsAndVarsWarnings(bool suppressAbsentFieldsAndVarsWarnings);
int baseItemPadding() const;
void setBaseItemPadding(int newBaseTextItemPadding);
private:
bool m_suppressAbsentFieldsAndVarsWarnings;
int m_baseItemPadding;
};

class LIMEREPORT_EXPORT IExternalPainter{
Expand Down
1 change: 1 addition & 0 deletions limereport/lrpagedesignintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ BaseDesignIntf *PageDesignIntf::addReportItem(const QString &itemType, QPointF p
PageItemDesignIntf* page = pageItem() ? pageItem() : m_currentPage;
if (page){
BaseDesignIntf *reportItem = addReportItem(itemType, page, page);
reportItem->setReportSettings(m_reportSettings);
reportItem->setPos(placePosOnGrid(page->mapFromScene(pos)));
reportItem->setSize(placeSizeOnGrid(size));
reportItem->setUnitType(pageItem()->unitType());
Expand Down
2 changes: 2 additions & 0 deletions limereport/lrreportdesignwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@ void ReportDesignWidget::editSetting()
setting.setHorizontalGridStep(m_horizontalGridStep);
setting.setDefaultFont(m_defaultFont);
setting.setSuppressAbsentFieldsAndVarsWarnings(m_report->suppressFieldAndVarError());
setting.setBaseItemPadding(m_report->baseItemPadding());

QStringList themes;
themes.append(QObject::tr("Default"));
Expand Down Expand Up @@ -833,6 +834,7 @@ void ReportDesignWidget::editSetting()
m_theme = "Default";
}
m_report->setSuppressFieldAndVarError(setting.suppressAbsentFieldsAndVarsWarnings());
m_report->setBaseItemPadding(setting.baseItemPadding());
if (m_report->currentDesignerLanguage() != setting.designerLanguage() ){
m_report->setCurrentDesignerLanguage(setting.designerLanguage());
}
Expand Down
4 changes: 2 additions & 2 deletions limereport/lrreportdesignwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1167,9 +1167,9 @@ void ReportDesignWindow::slotSaveReportAs()

void ReportDesignWindow::slotLoadReport()
{
if (!checkNeedToSave()) return; // don't need to save
if (!checkNeedToSave()) return;

if (m_reportDesignWidget->emitLoadReport()) return; // report loaded via signal
if (m_reportDesignWidget->emitLoadReport()) return;

QString fileName = QFileDialog::getOpenFileName(
this,tr("Report file name"),
Expand Down
10 changes: 10 additions & 0 deletions limereport/lrreportengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,16 @@ void ReportEnginePrivate::setSuppressFieldAndVarError(bool suppressFieldAndVarEr
m_reportSettings.setSuppressAbsentFieldsAndVarsWarnings(suppressFieldAndVarError);
}

int ReportEnginePrivate::baseItemPadding() const
{
return m_reportSettings.baseItemPadding();
}

void ReportEnginePrivate::setBaseItemPadding(int baseTextItemPadding)
{
m_reportSettings.setBaseItemPadding(baseTextItemPadding);
}

bool ReportEnginePrivate::isBusy()
{
return m_reportRendering;
Expand Down
5 changes: 5 additions & 0 deletions limereport/lrreportengine_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ class ReportEnginePrivateInterface {
virtual void setShowProgressDialog(bool value) = 0;
virtual bool isShowProgressDialog() const = 0;
virtual bool isBusy() = 0;
virtual int baseItemPadding() const = 0;
virtual void setBaseItemPadding(int baseTextItemPadding) = 0;
};

class PrintProcessor{
Expand Down Expand Up @@ -142,6 +144,7 @@ class ReportEnginePrivate : public QObject,
Q_PROPERTY(QObject* datasourcesManager READ dataManager)
Q_PROPERTY(QObject* scriptContext READ scriptContext)
Q_PROPERTY(bool suppressFieldAndVarError READ suppressFieldAndVarError WRITE setSuppressFieldAndVarError)
Q_PROPERTY(int baseItemPadding READ baseItemPadding WRITE setBaseItemPadding)
Q_PROPERTY(ATranslationProperty translation READ fakeTranslationReader)

enum AppendType{MixPages, AppendPages};
Expand Down Expand Up @@ -221,6 +224,8 @@ class ReportEnginePrivate : public QObject,

bool suppressFieldAndVarError() const;
void setSuppressFieldAndVarError(bool suppressFieldAndVarError);
int baseItemPadding() const;
void setBaseItemPadding(int baseTextItemPadding);
bool isBusy();
bool resultIsEditable() const;
void setResultEditable(bool value);
Expand Down
10 changes: 10 additions & 0 deletions limereport/lrsettingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,20 @@ QString SettingDialog::reportUnits()
return ui->reportUnits->currentText();
}

int SettingDialog::baseItemPadding()
{
return ui->neBaseItemPadding->value();
}

void SettingDialog::setSuppressAbsentFieldsAndVarsWarnings(bool value){
ui->cbSuppressWarnings->setChecked(value);
}

void SettingDialog::setBaseItemPadding(int value)
{
ui->neBaseItemPadding->setValue(value);
}

void SettingDialog::setHorizontalGridStep(int value)
{
ui->horizontalGridStep->setValue(value);
Expand Down
2 changes: 2 additions & 0 deletions limereport/lrsettingdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class SettingDialog : public QDialog
bool suppressAbsentFieldsAndVarsWarnings();
QLocale::Language designerLanguage();
QString reportUnits();
int baseItemPadding();
void setSuppressAbsentFieldsAndVarsWarnings(bool value);
void setBaseItemPadding(int value);
void setHorizontalGridStep(int value);
void setVerticalGridStep(int value);
void setDefaultFont(const QFont& value);
Expand Down
70 changes: 58 additions & 12 deletions limereport/lrsettingdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>521</width>
<height>445</height>
<height>506</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -23,15 +23,15 @@
<item>
<widget class="QToolBox" name="toolBox">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="page">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>503</width>
<height>301</height>
<width>499</width>
<height>339</height>
</rect>
</property>
<attribute name="label">
Expand Down Expand Up @@ -215,8 +215,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>503</width>
<height>301</height>
<width>499</width>
<height>339</height>
</rect>
</property>
<attribute name="label">
Expand Down Expand Up @@ -304,8 +304,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>503</width>
<height>301</height>
<width>499</width>
<height>339</height>
</rect>
</property>
<attribute name="label">
Expand All @@ -319,6 +319,52 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Base Item Padding: </string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="neBaseItemPadding">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>46</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>44</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
Expand Down Expand Up @@ -374,8 +420,8 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>221</x>
<y>307</y>
<x>485</x>
<y>493</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
Expand All @@ -390,8 +436,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>221</x>
<y>307</y>
<x>485</x>
<y>493</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
Expand Down

0 comments on commit f3d2efe

Please sign in to comment.