From 710558812a257db67179e0efd856ebb9d2f5120f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 14 Oct 2016 17:11:15 +0300 Subject: [PATCH] Improved performans commands Select all/Select none in the list of details in layout. --HG-- branch : develop --- src/app/valentina/dialogs/vwidgetdetails.cpp | 4 ++-- .../undocommands/toggledetailinlayout.cpp | 19 +------------------ .../undocommands/toggledetailinlayout.h | 12 +++++++----- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/app/valentina/dialogs/vwidgetdetails.cpp b/src/app/valentina/dialogs/vwidgetdetails.cpp index 80672e979..90d98b239 100644 --- a/src/app/valentina/dialogs/vwidgetdetails.cpp +++ b/src/app/valentina/dialogs/vwidgetdetails.cpp @@ -81,7 +81,7 @@ void VWidgetDetails::InLayoutStateChanged(int row, int column) const bool inLayout = not allDetails->value(id).IsInLayout(); ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, inLayout, m_data, m_doc); - connect(togglePrint, &ToggleDetailInLayout::NeedLiteParsing, m_doc, &VAbstractPattern::LiteParseTree); + connect(togglePrint, &ToggleDetailInLayout::UpdateList, this, &VWidgetDetails::UpdateList); qApp->getUndoStack()->push(togglePrint); } @@ -194,7 +194,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos) if (not select == m_data->DataDetails()->value(id).IsInLayout()) { ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, select, m_data, m_doc); - connect(togglePrint, &ToggleDetailInLayout::NeedLiteParsing, m_doc, &VAbstractPattern::LiteParseTree); + connect(togglePrint, &ToggleDetailInLayout::UpdateList, this, &VWidgetDetails::UpdateList); qApp->getUndoStack()->push(togglePrint); } } diff --git a/src/libs/vtools/undocommands/toggledetailinlayout.cpp b/src/libs/vtools/undocommands/toggledetailinlayout.cpp index 8c71997c7..88aa7daf2 100644 --- a/src/libs/vtools/undocommands/toggledetailinlayout.cpp +++ b/src/libs/vtools/undocommands/toggledetailinlayout.cpp @@ -82,22 +82,6 @@ void ToggleDetailInLayout::redo() } } -//--------------------------------------------------------------------------------------------------------------------- -bool ToggleDetailInLayout::mergeWith(const QUndoCommand *command) -{ - const ToggleDetailInLayout *stateCommand = static_cast(command); - SCASSERT(stateCommand != nullptr); - const quint32 id = stateCommand->getDetId(); - - if (id != m_id) - { - return false; - } - - m_newState = stateCommand->getNewState(); - return true; -} - //--------------------------------------------------------------------------------------------------------------------- int ToggleDetailInLayout::id() const { @@ -134,8 +118,7 @@ void ToggleDetailInLayout::Do(bool state) VDetail det = m_data->DataDetails()->value(m_id); det.SetInLayout(state); m_data->UpdateDetail(m_id, det); - - emit NeedLiteParsing(Document::LiteParse); + emit UpdateList(); } else { diff --git a/src/libs/vtools/undocommands/toggledetailinlayout.h b/src/libs/vtools/undocommands/toggledetailinlayout.h index eca12d4e4..9ba65da8c 100644 --- a/src/libs/vtools/undocommands/toggledetailinlayout.h +++ b/src/libs/vtools/undocommands/toggledetailinlayout.h @@ -50,16 +50,18 @@ public: virtual ~ToggleDetailInLayout(); virtual void undo() Q_DECL_OVERRIDE; virtual void redo() Q_DECL_OVERRIDE; - virtual bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE; virtual int id() const Q_DECL_OVERRIDE; quint32 getDetId() const; bool getNewState() const; + +signals: + void UpdateList(); private: Q_DISABLE_COPY(ToggleDetailInLayout) - quint32 m_id; - VContainer *m_data; - bool m_oldState; - bool m_newState; + quint32 m_id; + VContainer *m_data; + bool m_oldState; + bool m_newState; void Do(bool state); };