summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2019-08-26 15:47:53 +0300
committerMahmoud Badri <mahmoud.badri@qt.io>2019-08-28 14:33:54 +0300
commit2dd28a0abe4ad4118644b94afb8a8e9abc43e1a0 (patch)
treee3604abf66682323eb78272fd35a1861665c60ca
parentd8ac34450532d27a934b93673ed13a45d69a8f24 (diff)
Remove OffsetKeyframesCommandHelper class
Remove a useless class Change-Id: Ic011ff3f47ec6458c6645e2b364b699d2cd0aa87 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.cpp66
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.h65
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/PathTimelineItemBinding.cpp1
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h1
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp1
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp9
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.h2
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/KeyframeManager.cpp14
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/RowManager.cpp1
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp1
-rw-r--r--src/Authoring/Qt3DStudio/Qt3DStudio.pro1
11 files changed, 13 insertions, 149 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.cpp b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.cpp
deleted file mode 100644
index a0c4ee99..00000000
--- a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2008 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "Qt3DSCommonPrecompile.h"
-#include "OffsetKeyframesCommandHelper.h"
-#include "Core.h"
-
-// Data model specific
-#include "IDoc.h"
-#include "CmdDataModelChangeKeyframe.h"
-#include "IDocumentEditor.h"
-
-#include "Qt3DSDMTimelineKeyframe.h" //TODO: remove once we resolve the precision issue
-
-using namespace qt3dsdm;
-
-COffsetKeyframesCommandHelper::COffsetKeyframesCommandHelper(CDoc &inDoc)
- : Q3DStudio::CUpdateableDocumentEditor(inDoc)
- , m_Doc(inDoc)
-{
-}
-
-COffsetKeyframesCommandHelper::~COffsetKeyframesCommandHelper()
-{
- Finalize();
-}
-
-//@param inTime time in millisecs
-void COffsetKeyframesCommandHelper::SetCommandTime(qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe,
- long inTime)
-{
- // The DataModel system will take care of merging these under the hood.
- ENSURE_EDITOR(QObject::tr("Set Keyframe Time")).SetKeyframeTime(inKeyframe, inTime);
-}
-
-// equivalent to commit (onmouseup)
-void COffsetKeyframesCommandHelper::Finalize()
-{
- CommitEditor();
-}
diff --git a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.h b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.h
deleted file mode 100644
index 0e57773e..00000000
--- a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2008 NVIDIA Corporation.
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt 3D Studio.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//==============================================================================
-// Prefix
-//==============================================================================
-#ifndef INCLUDED_OFFSET_KEYFRAMES_COMMAND_HELPER_H
-#define INCLUDED_OFFSET_KEYFRAMES_COMMAND_HELPER_H 1
-
-#pragma once
-
-// Data model
-#include "Qt3DSDMHandles.h"
-#include "IDocumentEditor.h"
-
-namespace Q3DStudio {
-class IDocumentEditor;
-}
-
-//==============================================================================
-// Classes
-//==============================================================================
-class CCmdDataModelSetKeyframeTime;
-
-class COffsetKeyframesCommandHelper : public Q3DStudio::CUpdateableDocumentEditor
-{
-protected:
- CDoc &m_Doc;
-
-public:
- COffsetKeyframesCommandHelper(CDoc &inDoc);
- ~COffsetKeyframesCommandHelper();
-
- void SetCommandTime(qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe, long inTime);
- void Finalize();
- void Rollback() { RollbackEditor(); }
-};
-
-#endif \ No newline at end of file
diff --git a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/PathTimelineItemBinding.cpp b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/PathTimelineItemBinding.cpp
index f646415d..952c10da 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/PathTimelineItemBinding.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/PathTimelineItemBinding.cpp
@@ -30,6 +30,7 @@
#include "PathTimelineItemBinding.h"
#include "TimelineTranslationManager.h"
#include "Doc.h"
+#include "IDocumentEditor.h"
bool CPathTimelineItemBinding::IsExternalizeable()
{
diff --git a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h
index 39c81c6d..3980c0e1 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h
+++ b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h
@@ -42,7 +42,6 @@
#include "Qt3DSDMHandles.h"
#include "IDragable.h"
#include "Qt3DSDMAssetTimelineKeyframe.h"
-#include "OffsetKeyframesCommandHelper.h"
#include "Qt3DSDMTimeline.h"
#include "Qt3DSDMSignals.h"
#include "DispatchListeners.h"
diff --git a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp
index a5c49bfa..453ebc8c 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp
@@ -38,6 +38,7 @@
#include "StudioApp.h"
#include "Core.h"
#include "RowTree.h"
+#include "IDocumentEditor.h"
// Link to data model
#include "TimeEditDlg.h"
diff --git a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp
index acfbf4ac..081c2768 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp
@@ -33,7 +33,6 @@
#include "CmdDataModelChangeKeyframe.h"
#include "CmdBatch.h"
#include "Qt3DSDMStudioSystem.h"
-#include "OffsetKeyframesCommandHelper.h"
#include "Doc.h"
#include "StudioApp.h"
@@ -152,14 +151,6 @@ void Qt3DSDMTimelineKeyframe::SetSelected(bool inSelected)
m_Selected = inSelected;
}
-// For colors, there would be 3 keyframe handles
-void Qt3DSDMTimelineKeyframe::UpdateKeyframesTime(COffsetKeyframesCommandHelper *inCommandHelper,
- long inTime)
-{
- for (size_t i = 0; i < m_KeyframeHandles.size(); ++i)
- inCommandHelper->SetCommandTime(m_KeyframeHandles[i], inTime);
-}
-
void Qt3DSDMTimelineKeyframe::GetKeyframeHandles(TKeyframeHandleList &outList) const
{
outList = m_KeyframeHandles;
diff --git a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.h b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.h
index 3b73a3e7..e131418a 100644
--- a/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.h
+++ b/src/Authoring/Qt3DStudio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.h
@@ -37,7 +37,6 @@
class IDoc;
class CDoc;
class CCmdBatch;
-class COffsetKeyframesCommandHelper;
struct Keyframe;
class Qt3DSDMTimelineKeyframe : public IKeyframe
@@ -60,7 +59,6 @@ public:
void AddKeyframeHandle(qt3dsdm::Qt3DSDMKeyframeHandle inHandle);
bool HasKeyframeHandle(qt3dsdm::Qt3DSDMKeyframeHandle inHandle) const;
void SetSelected(bool inSelected);
- void UpdateKeyframesTime(COffsetKeyframesCommandHelper *inCommandHelper, long inTime);
void GetKeyframeHandles(TKeyframeHandleList &outList) const;
private:
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/KeyframeManager.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/KeyframeManager.cpp
index 4da0d376..f00d7117 100644
--- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/KeyframeManager.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/KeyframeManager.cpp
@@ -41,13 +41,13 @@
#include "CmdDataModelInsertKeyframe.h"
#include "CmdDataModelChangeKeyframe.h"
#include "ClientDataModelBridge.h"
-#include "Bindings/OffsetKeyframesCommandHelper.h"
#include "Bindings/PasteKeyframesCommandHelper.h"
#include "Bindings/ITimelineItemBinding.h"
#include "StudioPreferences.h"
#include "Dialogs.h"
#include "TimeEnums.h"
#include "RowTimelinePropertyGraph.h"
+#include "IDocumentEditor.h"
using namespace qt3dsdm;
@@ -144,11 +144,15 @@ QList<Keyframe *> KeyframeManager::selectedKeyframes() const
// update bindings after selected keyframes are moved
void KeyframeManager::commitMoveSelectedKeyframes()
{
- CDoc *theDoc = g_StudioApp.GetCore()->GetDoc();
- COffsetKeyframesCommandHelper h(*theDoc);
+ Q3DStudio::ScopedDocumentEditor editor(*g_StudioApp.GetCore()->GetDoc(),
+ QObject::tr("Set Keyframe Time"), __FILE__, __LINE__);
+ for (Keyframe *keyframe : qAsConst(m_selectedKeyframes)) {
+ Qt3DSDMTimelineKeyframe::TKeyframeHandleList kfHandles;
+ keyframe->binding->GetKeyframeHandles(kfHandles);
- for (Keyframe *keyframe : qAsConst(m_selectedKeyframes))
- keyframe->binding->UpdateKeyframesTime(&h, keyframe->time);
+ for (auto h : kfHandles)
+ editor->SetKeyframeTime(h, keyframe->time);
+ }
}
void KeyframeManager::selectKeyframesInRect(const QRectF &rect)
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/RowManager.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/RowManager.cpp
index 624b6d80..b250062c 100644
--- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/RowManager.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/RowManager.cpp
@@ -44,6 +44,7 @@
#include "StudioObjectTypes.h"
#include "Qt3DSDMStudioSystem.h"
#include "ClientDataModelBridge.h"
+#include "IDocumentEditor.h"
#include <QtWidgets/qgraphicslinearlayout.h>
#include <QtCore/qpointer.h>
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp
index cde22595..90bdc3f3 100644
--- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp
@@ -38,6 +38,7 @@
#include "Qt3DSDMStudioSystem.h"
#include "ClientDataModelBridge.h"
#include "qcursor.h"
+#include "IDocumentEditor.h"
RowTreeContextMenu::RowTreeContextMenu(RowTree *inRowTree, QWidget *parent)
: QMenu(parent)
diff --git a/src/Authoring/Qt3DStudio/Qt3DStudio.pro b/src/Authoring/Qt3DStudio/Qt3DStudio.pro
index 93faf19c..4043d027 100644
--- a/src/Authoring/Qt3DStudio/Qt3DStudio.pro
+++ b/src/Authoring/Qt3DStudio/Qt3DStudio.pro
@@ -351,7 +351,6 @@ SOURCES += \
Palettes/Timeline/Bindings/ImageTimelineItemBinding.cpp \
Palettes/Timeline/Bindings/LayerTimelineItemBinding.cpp \
Palettes/Timeline/Bindings/MaterialTimelineItemBinding.cpp \
- Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.cpp \
Palettes/Timeline/Bindings/PathAnchorPointTimelineItemBinding.cpp \
Palettes/Timeline/Bindings/PathTimelineItemBinding.cpp \
Palettes/Timeline/Bindings/Qt3DSDMAssetTimelineKeyframe.cpp \