[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra/stage-paulm-test3] stage/part: Remove node type method of KPrShapeAnimation class
From: Paul Mendez <paulestebanms () gmail ! com>
Date: 2012-07-31 22:57:25
Message-ID: 20120731225725.495D4A6094 () git ! kde ! org
[Download RAW message or body]
Git commit e52045e31479ab9cafcb4db4276a8549ae64008a by Paul Mendez.
Committed on 01/08/2012 at 00:56.
Pushed by mendez into branch 'stage-paulm-test3'.
Remove node type method of KPrShapeAnimation class
M +32 -26 stage/part/KPrShapeAnimations.cpp
M +9 -1 stage/part/KPrShapeAnimations.h
M +0 -14 stage/part/animations/KPrShapeAnimation.cpp
M +0 -15 stage/part/animations/KPrShapeAnimation.h
M +0 -1 stage/part/tools/animationtool/KPrPredefinedAnimationsLoader.cpp
M +3 -3 stage/part/tools/animationtool/KPrShapeAnimationDocker.cpp
http://commits.kde.org/calligra/e52045e31479ab9cafcb4db4276a8549ae64008a
diff --git a/stage/part/KPrShapeAnimations.cpp b/stage/part/KPrShapeAnimations.cpp
index 429a21a..92b08a1 100644
--- a/stage/part/KPrShapeAnimations.cpp
+++ b/stage/part/KPrShapeAnimations.cpp
@@ -87,19 +87,20 @@ QVariant KPrShapeAnimations::data(const QModelIndex &index, int \
role) const }
// Read Data
- int groupCount = -1;
+ AnimationTmpData currentData;
+ currentData.group = -1;
int thisRow = index.row();
- KPrShapeAnimation *thisAnimation = animationByRow(thisRow, groupCount);
+ KPrShapeAnimation *thisAnimation = animationByRow(thisRow, currentData);
if (!thisAnimation) {
return QVariant();
}
if (role == Qt::DisplayRole || role == Qt::EditRole) {
switch (index.column()) {
- case Group: return groupCount;
+ case Group: return currentData.group;
case StepCount:
- if (thisAnimation->nodeType() == KPrShapeAnimation::OnClick) {
- return groupCount;
+ if (currentData.nodeType == KPrShapeAnimation::OnClick) {
+ return currentData.group;
}
else {
return QVariant();
@@ -111,7 +112,7 @@ QVariant KPrShapeAnimations::data(const QModelIndex &index, int \
role) const case StartTime: return thisAnimation->timeRange().first;
case Duration: return thisAnimation->globalDuration();
case AnimationClass: return thisAnimation->presetClass();
- case NodeType: return thisAnimation->nodeType();
+ case NodeType: return currentData.nodeType;
default: Q_ASSERT(false);
}
}
@@ -126,13 +127,13 @@ QVariant KPrShapeAnimations::data(const QModelIndex &index, int \
role) const case Group: return QVariant();
case StepCount: return QVariant();
case TriggerEvent:
- if (thisAnimation->nodeType() == KPrShapeAnimation::OnClick)
+ if (currentData.nodeType == KPrShapeAnimation::OnClick)
return KIcon("onclick").pixmap(KIconLoader::SizeSmall,
KIconLoader::SizeSmall);
- if (thisAnimation->nodeType() == KPrShapeAnimation::AfterPrevious)
+ if (currentData.nodeType == KPrShapeAnimation::AfterPrevious)
return KIcon("after_previous").pixmap(KIconLoader::SizeSmall,
KIconLoader::SizeSmall);
- if (thisAnimation->nodeType() == KPrShapeAnimation::WithPrevious)
+ if (currentData.nodeType == KPrShapeAnimation::WithPrevious)
return KIcon("with_previous").pixmap(KIconLoader::SizeSmall,
KIconLoader::SizeSmall);
case Name: return QVariant();
@@ -165,11 +166,11 @@ QVariant KPrShapeAnimations::data(const QModelIndex &index, int \
role) const case Group:
case StepCount: return QVariant();
case TriggerEvent:
- if (thisAnimation->nodeType() == KPrShapeAnimation::OnClick)
+ if (currentData.nodeType == KPrShapeAnimation::OnClick)
return i18n("start on mouse click");
- if (thisAnimation->nodeType() == KPrShapeAnimation::AfterPrevious)
+ if (currentData.nodeType == KPrShapeAnimation::AfterPrevious)
return i18n("start after previous animation");
- if (thisAnimation->nodeType() == KPrShapeAnimation::WithPrevious)
+ if (currentData.nodeType == KPrShapeAnimation::WithPrevious)
return i18n("start with previous animation");
case Name: return QVariant();
case ShapeThumbnail: return thisAnimation->shape()->name();
@@ -238,8 +239,7 @@ bool KPrShapeAnimations::setData(const QModelIndex &index, const \
QVariant &value return false;
}
// Read Data
- int groupCount = -1;
- KPrShapeAnimation *thisAnimation = animationByRow(index.row(), groupCount);
+ KPrShapeAnimation *thisAnimation = animationByRow(index.row());
if (!thisAnimation) {
return false;
}
@@ -396,11 +396,6 @@ void KPrShapeAnimations::swapAnimations(KPrShapeAnimation \
*oldAnimation, KPrShap QModelIndex indexNew = indexByAnimation(newAnimation);
emit dataChanged(this->index(indexOld.row(), 0), this->index(indexOld.row(), \
COLUMN_COUNT));
emit dataChanged(this->index(indexNew.row(), 0), this->index(indexNew.row(), \
COLUMN_COUNT));
- if ((newAnimation->nodeType() == KPrShapeAnimation::OnClick) ||
- (oldAnimation->nodeType() == KPrShapeAnimation::OnClick)) {
- notifyOnClickEventChanged();
- }
-
}
void KPrShapeAnimations::replaceAnimation(KPrShapeAnimation *oldAnimation, \
KPrShapeAnimation *newAnimation) @@ -866,10 +861,10 @@ void \
KPrShapeAnimations::notifyOnClickEventChanged() emit onClickEventChanged();
}
-KPrShapeAnimation *KPrShapeAnimations::animationByRow(const int row, int \
&groupCount) const +KPrShapeAnimation *KPrShapeAnimations::animationByRow(const int \
row, AnimationTmpData ¤tData) const {
int rowCount = 0;
- groupCount = 0;
+ int groupCount = 0;
foreach (KPrAnimationStep *step, m_shapeAnimations) {
int stepChild = -1;
for (int i=0; i < step->animationCount(); i++) {
@@ -883,16 +878,17 @@ KPrShapeAnimation *KPrShapeAnimations::animationByRow(const int \
row, int &groupC stepChild++;
subStepChild++;
if (stepChild == 0) {
- b->setNodeType(KPrShapeAnimation::OnClick);
+ currentData.nodeType = KPrShapeAnimation::OnClick;
groupCount = groupCount + 1;
}
else if (subStepChild == 0) {
- b->setNodeType(KPrShapeAnimation::AfterPrevious);
+ currentData.nodeType = \
KPrShapeAnimation::AfterPrevious; }
else {
- b->setNodeType(KPrShapeAnimation::WithPrevious);
+ currentData.nodeType = \
KPrShapeAnimation::WithPrevious; }
if (rowCount == row) {
+ currentData.group = groupCount;
return b;
}
rowCount++;
@@ -907,8 +903,8 @@ KPrShapeAnimation *KPrShapeAnimations::animationByRow(const int \
row, int &groupC
KPrShapeAnimation *KPrShapeAnimations::animationByRow(const int row) const
{
- int groupCount = 0;
- return animationByRow(row, groupCount);
+ AnimationTmpData tmpData;
+ return animationByRow(row, tmpData);
}
void KPrShapeAnimations::insertNewAnimation(KPrShapeAnimation *newAnimation, const \
QModelIndex &previousAnimation) @@ -1081,6 +1077,16 @@ void \
KPrShapeAnimations::resyncStepsWithAnimations() }
}
+KPrShapeAnimation::NodeType KPrShapeAnimations::triggerEventByIndex(const \
QModelIndex &index) +{
+ Q_ASSERT(index.isValid());
+ AnimationTmpData currentData;
+ currentData.group = -1;
+ int thisRow = index.row();
+ animationByRow(thisRow, currentData);
+ return currentData.nodeType;
+}
+
QList<KPrShapeAnimation *> \
KPrShapeAnimations::getWithPreviousSiblings(KPrShapeAnimation *animation) {
bool startAdding = false;
diff --git a/stage/part/KPrShapeAnimations.h b/stage/part/KPrShapeAnimations.h
index b1bbfe2..8faa3ee 100644
--- a/stage/part/KPrShapeAnimations.h
+++ b/stage/part/KPrShapeAnimations.h
@@ -31,6 +31,12 @@
class KPrDocument;
+struct AnimationTmpData
+{
+ int group;
+ KPrShapeAnimation::NodeType nodeType;
+};
+
/**
* Model for Animations data of each KPrPage
@@ -276,6 +282,8 @@ public:
void resyncStepsWithAnimations();
+ KPrShapeAnimation::NodeType triggerEventByIndex(const QModelIndex &index);
+
public slots:
/// Notify a external edition of begin or end time
void notifyAnimationEdited();
@@ -291,7 +299,7 @@ signals:
void onClickEventChanged();
private:
- KPrShapeAnimation *animationByRow(const int row, int &groupCount) const;
+ KPrShapeAnimation *animationByRow(const int row, AnimationTmpData ¤tData) \
const;
QString getAnimationName(KPrShapeAnimation *animation, bool omitSubType = false) \
const;
QPixmap getAnimationShapeThumbnail(KPrShapeAnimation *animation) const;
QPixmap getAnimationIcon(KPrShapeAnimation *animation) const;
diff --git a/stage/part/animations/KPrShapeAnimation.cpp \
b/stage/part/animations/KPrShapeAnimation.cpp index 239e1fc..3fabbf6 100644
--- a/stage/part/animations/KPrShapeAnimation.cpp
+++ b/stage/part/animations/KPrShapeAnimation.cpp
@@ -212,15 +212,6 @@ void KPrShapeAnimation::deactivate()
// onClick would create a new animation
// when putting data in it could check if the shape is the correct one if not create \
a parallel one (with previous)
-
-
-void KPrShapeAnimation::setNodeType(KPrShapeAnimation::NodeType type)
-{
- if (type != m_triggerEvent) {
- m_triggerEvent = type;
- }
-}
-
void KPrShapeAnimation::setPresetClass(KPrShapeAnimation::PresetClass presetClass)
{
m_class = presetClass;
@@ -236,11 +227,6 @@ void KPrShapeAnimation::setPresetSubType(QString subType)
m_presetSubType = subType;
}
-KPrShapeAnimation::NodeType KPrShapeAnimation::nodeType() const
-{
- return m_triggerEvent;
-}
-
KPrShapeAnimation::PresetClass KPrShapeAnimation::presetClass() const
{
return m_class;
diff --git a/stage/part/animations/KPrShapeAnimation.h \
b/stage/part/animations/KPrShapeAnimation.h index e53c2c2..1c79069 100644
--- a/stage/part/animations/KPrShapeAnimation.h
+++ b/stage/part/animations/KPrShapeAnimation.h
@@ -128,14 +128,6 @@ public:
/// to different params of the animation
/// Use set methods to mantain them in sync with the
/// real animation data
- /**
- * @brief Set the node type of the animation
- * used just like quick access, Node Type is actually
- * determined using the step, substep structure
- *
- * @param type Node Type
- */
- void setNodeType(NodeType type);
/**
* @brief Set class of the animation
@@ -154,13 +146,6 @@ public:
void setPresetSubType(QString subType);
/**
- * @brief Returns the stored node type for the animation
- *
- * @return Node_Type
- */
- NodeType nodeType() const;
-
- /**
* @brief Returns stored class of the animation
*
* @return Preset_Class
diff --git a/stage/part/tools/animationtool/KPrPredefinedAnimationsLoader.cpp \
b/stage/part/tools/animationtool/KPrPredefinedAnimationsLoader.cpp index \
48beeee..48937b6 100644
--- a/stage/part/tools/animationtool/KPrPredefinedAnimationsLoader.cpp
+++ b/stage/part/tools/animationtool/KPrPredefinedAnimationsLoader.cpp
@@ -363,7 +363,6 @@ KPrShapeAnimation \
*KPrPredefinedAnimationsLoader::loadOdfShapeAnimation(const Ko }
if (shapeAnimation) {
- shapeAnimation->setNodeType(KPrShapeAnimation::OnClick);
if (presetClass == "custom") {
shapeAnimation->setPresetClass(KPrShapeAnimation::Custom);
}
diff --git a/stage/part/tools/animationtool/KPrShapeAnimationDocker.cpp \
b/stage/part/tools/animationtool/KPrShapeAnimationDocker.cpp index eb89e67..60100ca \
100644
--- a/stage/part/tools/animationtool/KPrShapeAnimationDocker.cpp
+++ b/stage/part/tools/animationtool/KPrShapeAnimationDocker.cpp
@@ -505,7 +505,6 @@ void \
KPrShapeAnimationDocker::showAnimationsCustomContextMenu(const QPoint &pos) \
menu.addSeparator();
if ((m_animationsView->selectionModel()->selectedRows().count() == 1) &&
(m_animationsView->currentIndex().isValid())) {
- KPrShapeAnimation *currentAnimation = \
m_animationsModel->animationByRow(m_animationsView->currentIndex().row()); \
QActionGroup *actionGroup = new QActionGroup(m_animationsView); \
actionGroup->setExclusive(true);
KAction *onClickAction = new KAction(KIcon("onclick"), i18n("start on mouse \
click"), m_animationsView); @@ -523,10 +522,11 @@ void \
KPrShapeAnimationDocker::showAnimationsCustomContextMenu(const QPoint &pos) \
actionGroup->addAction(withAction); actionGroup->setExclusive(true);
- if (currentAnimation->nodeType() == KPrShapeAnimation::OnClick) {
+ KPrShapeAnimation::NodeType currentNodeType = \
m_animationsModel->triggerEventByIndex(m_animationsView->currentIndex()); + if \
(currentNodeType == KPrShapeAnimation::OnClick) { onClickAction->setChecked(true);
}
- else if (currentAnimation->nodeType() == KPrShapeAnimation::AfterPrevious) {
+ else if (currentNodeType == KPrShapeAnimation::AfterPrevious) {
afterAction->setChecked(true);
}
else {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic