0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +03:00

Some unused code was deleted

This commit is contained in:
Arin Alexander 2019-01-16 20:26:17 +03:00
parent fa53885d1e
commit 561f64b1b6
3 changed files with 204 additions and 228 deletions

View File

@ -77,7 +77,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 4 LIMEREPORT_VERSION_MINOR = 4
LIMEREPORT_VERSION_RELEASE = 113 LIMEREPORT_VERSION_RELEASE = 114
LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"'
DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\"

View File

@ -67,8 +67,6 @@ bool bandSortBandLessThen(const BandDesignIntf *c1, const BandDesignIntf *c2)
PageDesignIntf::PageDesignIntf(QObject *parent): PageDesignIntf::PageDesignIntf(QObject *parent):
QGraphicsScene(parent), QGraphicsScene(parent),
m_pageSize(A4),
m_orientation(Portrait),
m_pageItem(0), m_pageItem(0),
m_insertMode(false), m_insertMode(false),
m_itemInsertRect(0), m_itemInsertRect(0),
@ -84,8 +82,6 @@ PageDesignIntf::PageDesignIntf(QObject *parent):
m_executingGroupCommand(false), m_executingGroupCommand(false),
m_settings(0), m_settings(0),
m_selectionRect(0), m_selectionRect(0),
//m_verticalGridStep(1*Const::mmFACTOR),
//m_horizontalGridStep(1*Const::mmFACTOR)
m_verticalGridStep(2), m_verticalGridStep(2),
m_horizontalGridStep(2), m_horizontalGridStep(2),
m_updating(false), m_updating(false),
@ -134,22 +130,22 @@ void PageDesignIntf::updatePageRect()
emit sceneRectChanged(sceneRect()); emit sceneRectChanged(sceneRect());
} }
PageDesignIntf::Orientation PageDesignIntf::getOrientation() //PageDesignIntf::Orientation PageDesignIntf::getOrientation()
{ //{
return m_orientation; // return m_orientation;
} //}
void PageDesignIntf::setPageSize(PageDesignIntf::PageSize sizeType, QSizeF sizeValue) //void PageDesignIntf::setPageSize(PageDesignIntf::PageSize sizeType, QSizeF sizeValue)
{ //{
m_pageSize = sizeType; // m_pageSize = sizeType;
m_pageSizeValue = sizeValue; // m_pageSizeValue = sizeValue;
updatePageRect(); // updatePageRect();
} //}
PageDesignIntf::PageSize PageDesignIntf::pageSize() const //PageDesignIntf::PageSize PageDesignIntf::pageSize() const
{ //{
return m_pageSize; // return m_pageSize;
} //}
void PageDesignIntf::keyPressEvent(QKeyEvent *event) void PageDesignIntf::keyPressEvent(QKeyEvent *event)
{ {
@ -672,22 +668,22 @@ bool PageDesignIntf::isExistsObjectName(const QString &objectName, QList<QGraphi
return false; return false;
} }
QRectF PageDesignIntf::getRectByPageSize(PageDesignIntf::PageSize pageSize) //QRectF PageDesignIntf::getRectByPageSize(PageDesignIntf::PageSize pageSize)
{ //{
if (m_pageSize != Custom) { // if (m_pageSize != PageSize::Custom) {
QPrinter printer; // QPrinter printer;
printer.setOutputFormat(QPrinter::PdfFormat); // printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOrientation((QPrinter::Orientation)getOrientation()); // printer.setOrientation((QPrinter::Orientation)getOrientation());
printer.setPageSize((QPrinter::PageSize)pageSize); // printer.setPageSize((QPrinter::PageSize)pageSize);
return QRectF(0, 0, printer.paperRect(QPrinter::Millimeter).width() * 10, // return QRectF(0, 0, printer.paperRect(QPrinter::Millimeter).width() * 10,
printer.paperSize(QPrinter::Millimeter).height() * 10); // printer.paperSize(QPrinter::Millimeter).height() * 10);
} // }
else { // else {
return QRectF(0, 0, m_pageSizeValue.width() * 10, // return QRectF(0, 0, m_pageSizeValue.width() * 10,
m_pageSizeValue.height() * 10); // m_pageSizeValue.height() * 10);
} // }
} //}
bool PageDesignIntf::isLoading() bool PageDesignIntf::isLoading()
{ {

View File

@ -99,223 +99,203 @@ namespace LimeReport {
class PageDesignIntf : public QGraphicsScene, public ObjectLoadingStateIntf{ class PageDesignIntf : public QGraphicsScene, public ObjectLoadingStateIntf{
Q_OBJECT Q_OBJECT
Q_PROPERTY(QObject* pageItem READ pageItem()) Q_PROPERTY(QObject* pageItem READ pageItem())
public: public:
friend class PropertyChangedCommand; friend class PropertyChangedCommand;
friend class InsertHLayoutCommand; friend class InsertHLayoutCommand;
enum Orientation {Portrait, Landscape}; explicit PageDesignIntf(QObject* parent = 0);
enum PageSize {A4, B5, Letter, Legal, Executive, ~PageDesignIntf();
A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, void updatePageRect();
B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E,
DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom
};
explicit PageDesignIntf(QObject* parent = 0); void startInsertMode(const QString& ItemType);
~PageDesignIntf(); void startEditMode();
void updatePageRect();
Orientation getOrientation();
void setPageSize(PageSize sizeType, QSizeF sizeValue=QSizeF()); PageItemDesignIntf *pageItem();
PageSize pageSize() const; void setPageItem(PageItemDesignIntf::Ptr pageItem);
void setPageItems(QList<PageItemDesignIntf::Ptr> pages);
QList<PageItemDesignIntf::Ptr> pageItems(){return m_reportPages;}
void startInsertMode(const QString& ItemType); bool isItemInsertMode();
void startEditMode(); ReportEnginePrivate* reportEditor();
void setReportEditor(ReportEnginePrivate* value){m_reportEditor=value;}
PageItemDesignIntf *pageItem(); QStringList possibleParentItems();
void setPageItem(PageItemDesignIntf::Ptr pageItem); void registerItem(BaseDesignIntf* item);
void setPageItems(QList<PageItemDesignIntf::Ptr> pages); void registerBand(BandDesignIntf* band);
QList<PageItemDesignIntf::Ptr> pageItems(){return m_reportPages;} void removeAllItems();
bool isItemInsertMode(); void setItemMode(BaseDesignIntf::ItemMode state);
ReportEnginePrivate* reportEditor(); BaseDesignIntf::ItemMode itemMode(){return m_itemMode;}
void setReportEditor(ReportEnginePrivate* value){m_reportEditor=value;} BaseDesignIntf* reportItemByName(const QString& name);
QList<BaseDesignIntf *> reportItemsByName(const QString &name);
BaseDesignIntf* addReportItem(const QString& itemType, QPointF pos, QSizeF size);
BaseDesignIntf* addReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0);
BaseDesignIntf* createReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0);
void removeReportItem(BaseDesignIntf* item, bool createComand = true);
CommandIf::Ptr removeReportItemCommand(BaseDesignIntf *item);
bool saveCommand(CommandIf::Ptr command, bool runCommand = true);
QStringList possibleParentItems(); bool isCanRedo();
void registerItem(BaseDesignIntf* item); bool isCanUndo();
void registerBand(BandDesignIntf* band); bool isHasChanges();
void removeAllItems();
void setItemMode(BaseDesignIntf::ItemMode state); void reactivatePageItem(PageItemDesignIntf::Ptr pageItem);
BaseDesignIntf::ItemMode itemMode(){return m_itemMode;}
BaseDesignIntf* reportItemByName(const QString& name);
QList<BaseDesignIntf *> reportItemsByName(const QString &name);
BaseDesignIntf* addReportItem(const QString& itemType, QPointF pos, QSizeF size);
BaseDesignIntf* addReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0);
BaseDesignIntf* createReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0);
void removeReportItem(BaseDesignIntf* item, bool createComand = true);
CommandIf::Ptr removeReportItemCommand(BaseDesignIntf *item);
bool saveCommand(CommandIf::Ptr command, bool runCommand = true);
bool isCanRedo(); void setSettings(QSettings* settings){ m_settings = settings;}
bool isCanUndo(); QSettings* settings(){ return m_settings;}
bool isHasChanges();
void reactivatePageItem(PageItemDesignIntf::Ptr pageItem); QString genObjectName(const QObject& object);
void setSettings(QSettings* settings){ m_settings = settings;} void animateItem(BaseDesignIntf* item);
QSettings* settings(){ return m_settings;} void setSelectionRect(QRectF selectionRect);
void emitRegisterdItem(BaseDesignIntf *item);
void emitItemRemoved(BaseDesignIntf* item);
QString genObjectName(const QObject& object); DataSourceManager* datasourceManager();
bool isSaved(){ return !m_hasHanges;}
void changeSelectedGrpoupTextAlignPropperty(const bool& horizontalAlign, Qt::AlignmentFlag flag);
void animateItem(BaseDesignIntf* item); int verticalGridStep() const;
void setSelectionRect(QRectF selectionRect); void setVerticalGridStep(int verticalGridStep);
void emitRegisterdItem(BaseDesignIntf *item);
void emitItemRemoved(BaseDesignIntf* item);
DataSourceManager* datasourceManager(); int horizontalGridStep() const;
bool isSaved(){ return !m_hasHanges;} void setHorizontalGridStep(int horizontalGridStep);
void changeSelectedGrpoupTextAlignPropperty(const bool& horizontalAlign, Qt::AlignmentFlag flag);
int verticalGridStep() const; void beginUpdate(){m_updating = true;}
void setVerticalGridStep(int verticalGridStep); bool isUpdating(){return m_updating;}
void endUpdate();
int horizontalGridStep() const; void itemMoved(BaseDesignIntf* item);
void setHorizontalGridStep(int horizontalGridStep); bool magneticMovement() const;
void setMagneticMovement(bool magneticMovement);
void beginUpdate(){m_updating = true;} ReportSettings *getReportSettings() const;
bool isUpdating(){return m_updating;} void setReportSettings(ReportSettings *reportSettings);
void endUpdate(); void setPropertyToSelectedItems(const char *name, const QVariant &value);
void itemMoved(BaseDesignIntf* item);
bool magneticMovement() const;
void setMagneticMovement(bool magneticMovement);
ReportSettings *getReportSettings() const;
void setReportSettings(ReportSettings *reportSettings);
void setPropertyToSelectedItems(const char *name, const QVariant &value);
protected: protected:
virtual void keyPressEvent(QKeyEvent *event);
virtual void keyReleaseEvent(QKeyEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void keyPressEvent(QKeyEvent *event); virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
virtual void keyReleaseEvent(QKeyEvent *event); virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event); LimeReport::BandDesignIntf::BandsType findPriorType(LimeReport::BandDesignIntf::BandsType bandType);
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *); BaseDesignIntf *findDestObject(BaseDesignIntf *item);
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
LimeReport::BandDesignIntf::BandsType findPriorType(LimeReport::BandDesignIntf::BandsType bandType); bool isExistsObjectName (const QString& objectName, QList<QGraphicsItem *> &itemsList) const;
BaseDesignIntf *findDestObject(BaseDesignIntf *item);
bool isExistsObjectName (const QString& objectName, QList<QGraphicsItem *> &itemsList) const; bool isLoading();
QRectF getRectByPageSize(PageSize pageSize); void objectLoadStarted();
void objectLoadFinished();
bool isLoading(); HorizontalLayout* internalAddHLayout();
void objectLoadStarted(); QPointF placePosOnGrid(QPointF point);
void objectLoadFinished(); QSizeF placeSizeOnGrid(QSizeF size);
HorizontalLayout* internalAddHLayout();
QPointF placePosOnGrid(QPointF point);
QSizeF placeSizeOnGrid(QSizeF size);
signals: signals:
void geometryChanged(QRectF newGeometry); void geometryChanged(QRectF newGeometry);
void insertModeStarted(); void insertModeStarted();
void itemInserted(LimeReport::PageDesignIntf* report, QPointF pos, const QString& ItemType); void itemInserted(LimeReport::PageDesignIntf* report, QPointF pos, const QString& ItemType);
void itemInsertCanceled(const QString& ItemType); void itemInsertCanceled(const QString& ItemType);
void itemSelected(LimeReport::BaseDesignIntf *item); void itemSelected(LimeReport::BaseDesignIntf *item);
void multiItemsSelected(QList<QObject*>* objectsList); void multiItemsSelected(QList<QObject*>* objectsList);
void miltiItemsSelectionFinished(); void miltiItemsSelectionFinished();
void commandHistoryChanged(); void commandHistoryChanged();
void itemPropertyChanged(const QString& objectName, const QString& propertyName, const QVariant& oldValue, const QVariant& newValue); void itemPropertyChanged(const QString& objectName, const QString& propertyName, const QVariant& oldValue, const QVariant& newValue);
void itemAdded(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item); void itemAdded(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item);
void itemRemoved(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item); void itemRemoved(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item);
void bandAdded(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band); void bandAdded(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band);
void bandRemoved(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band); void bandRemoved(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band);
void pageUpdateFinished(LimeReport::PageDesignIntf* page); void pageUpdateFinished(LimeReport::PageDesignIntf* page);
public slots: public slots:
BaseDesignIntf* addBand(const QString& bandType); BaseDesignIntf* addBand(const QString& bandType);
BaseDesignIntf* addBand(BandDesignIntf::BandsType bandType); BaseDesignIntf* addBand(BandDesignIntf::BandsType bandType);
void removeBand(LimeReport::BandDesignIntf* band); void removeBand(LimeReport::BandDesignIntf* band);
void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
void bandPosChanged(QObject* object, QPointF newPos, QPointF oldPos); void bandPosChanged(QObject* object, QPointF newPos, QPointF oldPos);
void slotUpdateItemSize(); void slotUpdateItemSize();
void undo(); void undo();
void redo(); void redo();
void copy(); void copy();
void paste(); void paste();
void deleteSelected(); void deleteSelected();
void cut(); void cut();
void setToSaved(); void setToSaved();
void bringToFront(); void bringToFront();
void sendToBack(); void sendToBack();
void alignToLeft(); void alignToLeft();
void alignToRigth(); void alignToRigth();
void alignToVCenter(); void alignToVCenter();
void alignToTop(); void alignToTop();
void alignToBottom(); void alignToBottom();
void alignToHCenter(); void alignToHCenter();
void sameWidth(); void sameWidth();
void sameHeight(); void sameHeight();
void addHLayout(); void addHLayout();
void setFont(const QFont &font); void setFont(const QFont &font);
void setTextAlign(const Qt::Alignment& alignment); void setTextAlign(const Qt::Alignment& alignment);
void setBorders(const BaseDesignIntf::BorderLines& border); void setBorders(const BaseDesignIntf::BorderLines& border);
private slots: private slots:
void slotPageGeometryChanged(QObject*, QRectF, QRectF ); void slotPageGeometryChanged(QObject*, QRectF, QRectF );
void slotItemPropertyChanged(QString propertyName, const QVariant &oldValue, const QVariant &newValue); void slotItemPropertyChanged(QString propertyName, const QVariant &oldValue, const QVariant &newValue);
void slotItemPropertyObjectNameChanged(const QString& oldName, const QString& newName); void slotItemPropertyObjectNameChanged(const QString& oldName, const QString& newName);
void bandDeleted(QObject* band); void bandDeleted(QObject* band);
void slotPageItemLoaded(QObject *); void slotPageItemLoaded(QObject *);
void slotSelectionChanged(); void slotSelectionChanged();
void slotAnimationStoped(QObject *animation); void slotAnimationStoped(QObject *animation);
private: private:
template <typename T> template <typename T>
BaseDesignIntf* internalAddBand(T bandType); BaseDesignIntf* internalAddBand(T bandType);
void finalizeInsertMode(); void finalizeInsertMode();
void saveSelectedItemsPos(); void saveSelectedItemsPos();
void saveSelectedItemsGeometry(); void saveSelectedItemsGeometry();
void checkSizeOrPosChanges(); void checkSizeOrPosChanges();
CommandIf::Ptr createChangePosCommand(); CommandIf::Ptr createChangePosCommand();
CommandIf::Ptr createChangeSizeCommand(); CommandIf::Ptr createChangeSizeCommand();
void saveChangeProppertyCommand(const QString& objectName, const QString& propertyName, const QVariant& oldPropertyValue, const QVariant& newPropertyValue); void saveChangeProppertyCommand(const QString& objectName, const QString& propertyName, const QVariant& oldPropertyValue, const QVariant& newPropertyValue);
void changeSelectedGroupProperty(const QString& name,const QVariant& value); void changeSelectedGroupProperty(const QString& name,const QVariant& value);
private:
private: enum JoinType{Width, Height};
enum JoinType{Width, Height}; LimeReport::PageItemDesignIntf::Ptr m_pageItem;
PageSize m_pageSize; QList<PageItemDesignIntf::Ptr> m_reportPages;
QSizeF m_pageSizeValue; ReportEnginePrivate* m_reportEditor;
Orientation m_orientation; bool m_insertMode;
QRectF m_geometry; QGraphicsItem * m_itemInsertRect;
LimeReport::PageItemDesignIntf::Ptr m_pageItem; QString m_insertItemType;
QList<PageItemDesignIntf::Ptr> m_reportPages; BaseDesignIntf::ItemMode m_itemMode;
ReportEnginePrivate* m_reportEditor; QGraphicsRectItem* m_cutterBorder;
bool m_insertMode; QGraphicsRectItem* m_pageRect;
QGraphicsItem * m_itemInsertRect; QVector<CommandIf::Ptr> m_commandsList;
QString m_insertItemType; QVector<ReportItemPos> m_positionStamp;
BaseDesignIntf::ItemMode m_itemMode; QVector<ReportItemSize> m_geometryStamp;
QGraphicsRectItem* m_cutterBorder; BaseDesignIntf* m_firstSelectedItem;
QGraphicsRectItem* m_pageRect; int m_currentCommand;
QVector<CommandIf::Ptr> m_commandsList; bool m_changeSizeMode;
QVector<ReportItemPos> m_positionStamp; bool m_changePosMode;
QVector<ReportItemSize> m_geometryStamp; bool m_changePosOrSizeMode;
BaseDesignIntf* m_firstSelectedItem; bool m_executingCommand;
int m_currentCommand; bool m_hasHanges;
bool m_changeSizeMode; bool m_isLoading;
bool m_changePosMode; bool m_executingGroupCommand;
bool m_changePosOrSizeMode; QSettings* m_settings;
bool m_executingCommand; QList<QObject*> m_animationList;
bool m_hasHanges; QPointF m_startSelectionPoint;
bool m_isLoading; QGraphicsRectItem* m_selectionRect;
bool m_executingGroupCommand; int m_verticalGridStep;
QSettings* m_settings; int m_horizontalGridStep;
QList<QObject*> m_animationList; bool m_updating;
QPointF m_startSelectionPoint; int m_currentObjectIndex;
QGraphicsRectItem* m_selectionRect; bool m_multiSelectStarted;
int m_verticalGridStep; QList<ItemProjections> m_projections;
int m_horizontalGridStep; BaseDesignIntf* m_movedItem;
bool m_updating; BaseDesignIntf* m_movedItemContainer;
int m_currentObjectIndex; BaseDesignIntf* m_joinItem;
bool m_multiSelectStarted; JoinType m_joinType;
QList<ItemProjections> m_projections; bool m_magneticMovement;
BaseDesignIntf* m_movedItem; ReportSettings* m_reportSettings;
BaseDesignIntf* m_movedItemContainer;
BaseDesignIntf* m_joinItem;
JoinType m_joinType;
bool m_magneticMovement;
ReportSettings* m_reportSettings;
}; };
class AbstractPageCommand : public CommandIf{ class AbstractPageCommand : public CommandIf{