[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kpresenter
From: Benjamin Port <port.benjamin () gmail ! com>
Date: 2010-05-06 12:08:46
Message-ID: 20100506120846.A7551AC8AC () svn ! kde ! org
[Download RAW message or body]
SVN commit 1123617 by bport:
Add 3d transition into Kpresenter with two transition (Space rotation and Swap \
effect)
M +1 -1 part/CMakeLists.txt
M +6 -0 part/pageeffects/KPrPageEffect.cpp
M +12 -2 part/pageeffects/KPrPageEffect.h
M +44 -1 part/pageeffects/KPrPageEffectRunner.cpp
M +8 -1 part/pageeffects/KPrPageEffectStrategy.cpp
M +7 -1 part/pageeffects/KPrPageEffectStrategy.h
M +2 -0 plugins/pageeffects/CMakeLists.txt
A plugins/pageeffects/spacerotation (directory)
A plugins/pageeffects/spacerotation/CMakeLists.txt
A plugins/pageeffects/spacerotation/KPrSpaceRotationEffectFactory.cpp \
[License: LGPL (v2+)] A \
plugins/pageeffects/spacerotation/KPrSpaceRotationEffectFactory.h [License: LGPL \
(v2+)] A \
plugins/pageeffects/spacerotation/KPrSpaceRotationFromBottomStrategy.cpp [License: \
LGPL (v2+)] A \
plugins/pageeffects/spacerotation/KPrSpaceRotationFromBottomStrategy.h [License: \
LGPL (v2+)] A \
plugins/pageeffects/spacerotation/KPrSpaceRotationFromLeftStrategy.cpp [License: \
LGPL (v2+)] A \
plugins/pageeffects/spacerotation/KPrSpaceRotationFromLeftStrategy.h [License: LGPL \
(v2+)] A \
plugins/pageeffects/spacerotation/KPrSpaceRotationFromRightStrategy.cpp [License: \
LGPL (v2+)] A \
plugins/pageeffects/spacerotation/KPrSpaceRotationFromRightStrategy.h [License: \
LGPL (v2+)] A \
plugins/pageeffects/spacerotation/KPrSpaceRotationFromTopStrategy.cpp [License: \
LGPL (v2+)] A \
plugins/pageeffects/spacerotation/KPrSpaceRotationFromTopStrategy.h [License: LGPL \
(v2+)] A plugins/pageeffects/spacerotation/Plugin.cpp [License: LGPL \
(v2+)] A plugins/pageeffects/spacerotation/Plugin.h [License: LGPL \
(v2+)] A \
plugins/pageeffects/spacerotation/kpr_pageeffect_spacerotation.desktop A \
plugins/pageeffects/swapeffect (directory) A \
plugins/pageeffects/swapeffect/CMakeLists.txt A \
plugins/pageeffects/swapeffect/KPrSwapEffectFactory.cpp [License: LGPL (v2+)] A \
plugins/pageeffects/swapeffect/KPrSwapEffectFactory.h [License: LGPL (v2+)] A \
plugins/pageeffects/swapeffect/KPrSwapEffectHorizontalStrategy.cpp [License: LGPL \
(v2+)] A \
plugins/pageeffects/swapeffect/KPrSwapEffectHorizontalStrategy.h [License: LGPL \
(v2+)] A plugins/pageeffects/swapeffect/Plugin.cpp [License: LGPL \
(v2+)] A plugins/pageeffects/swapeffect/Plugin.h [License: LGPL (v2+)]
A plugins/pageeffects/swapeffect/kpr_pageeffect_swapeffect.desktop
--- trunk/koffice/kpresenter/part/CMakeLists.txt #1123616:1123617
@@ -115,7 +115,7 @@
kde4_add_library(kpresenterprivate SHARED ${kpresenterprivate_LIB_SRCS})
-target_link_libraries(kpresenterprivate kopageapp kowidgets ${KDE4_PHONON_LIBRARY})
+target_link_libraries(kpresenterprivate kopageapp kowidgets ${KDE4_PHONON_LIBRARY} \
${QT_QTOPENGL_LIBRARY}) target_link_libraries(kpresenterprivate \
LINK_INTERFACE_LIBRARIES kopageapp)
set_target_properties(kpresenterprivate PROPERTIES VERSION \
${GENERIC_KOFFICE_LIB_VERSION} SOVERSION \
${GENERIC_KOFFICE_LIB_SOVERSION} )
--- trunk/koffice/kpresenter/part/pageeffects/KPrPageEffect.cpp #1123616:1123617
@@ -1,5 +1,6 @@
/* This file is part of the KDE project
Copyright (C) 2007-2008 Thorsten Zachmann <zachmann@kde.org>
+ Copyright (C) 2010 Benjamin Port <port.benjamin@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -43,6 +44,11 @@
timeLine.setCurveShape( QTimeLine::LinearCurve );
}
+bool KPrPageEffect::useGraphicsView()
+{
+ return m_strategy->useGraphicsView();
+}
+
bool KPrPageEffect::paint( QPainter &p, const Data &data )
{
int currPos = data.m_timeLine.frameForTime( data.m_currentTime );
--- trunk/koffice/kpresenter/part/pageeffects/KPrPageEffect.h #1123616:1123617
@@ -1,5 +1,6 @@
/* This file is part of the KDE project
Copyright (C) 2007-2008 Thorsten Zachmann <zachmann@kde.org>
+ Copyright (C) 2010 Benjamin Port <port.benjamin@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -23,10 +24,13 @@
#include <QPixmap>
#include <QTimeLine>
+#include <KoXmlReaderForward.h>
#include "kpresenter_export.h"
class QPainter;
-#include "KoXmlReaderForward.h"
+class QGraphicsScene;
+class QGraphicsPixmapItem;
+class QGraphicsView;
class KoXmlWriter;
class KoGenStyle;
class KPrPageEffectStrategy;
@@ -52,6 +56,8 @@
: m_oldPage( oldPage )
, m_newPage( newPage )
, m_widget( w )
+ , m_scene( 0 )
+ , m_graphicsView( 0 )
, m_finished( false )
, m_currentTime( 0 )
, m_lastTime( 0 )
@@ -61,6 +67,10 @@
QPixmap m_newPage;
QWidget * m_widget;
QTimeLine m_timeLine;
+ QGraphicsScene *m_scene;
+ QGraphicsView *m_graphicsView;
+ QGraphicsPixmapItem *m_oldPageItem;
+ QGraphicsPixmapItem *m_newPageItem;
bool m_finished;
int m_currentTime;
int m_lastTime;
@@ -76,7 +86,7 @@
virtual ~KPrPageEffect();
virtual void setup( const Data &data, QTimeLine &timeLine );
-
+ virtual bool useGraphicsView();
/**
* Paint the page effect
*
--- trunk/koffice/kpresenter/part/pageeffects/KPrPageEffectRunner.cpp \
#1123616:1123617 @@ -1,5 +1,6 @@
/* This file is part of the KDE project
Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
+ Copyright (C) 2010 Benjamin Port <port.benjamin@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -18,18 +19,59 @@
*/
#include "KPrPageEffectRunner.h"
-
+#include <QGLFormat>
+#include <QGraphicsScene>
+#include <QGraphicsPixmapItem>
+#include <QGraphicsView>
#include "KPrPageEffect.h"
KPrPageEffectRunner::KPrPageEffectRunner( const QPixmap &oldPage, const QPixmap \
&newPage, QWidget *w, KPrPageEffect *effect ) : m_effect( effect )
, m_data( oldPage, newPage, w )
{
+ if (m_effect->useGraphicsView()) {
+ m_data.m_scene = new QGraphicsScene();
+ m_data.m_graphicsView = new QGraphicsView(m_data.m_scene, m_data.m_widget);
+ m_data.m_graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_data.m_graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_data.m_graphicsView->resize(m_data.m_widget->size());
+ m_data.m_graphicsView->setFrameShape(QFrame::Panel);
+ m_data.m_graphicsView->setLineWidth(0);
+
+ m_data.m_oldPageItem = new QGraphicsPixmapItem(m_data.m_oldPage, 0, \
m_data.m_scene); + m_data.m_newPageItem = new \
QGraphicsPixmapItem(m_data.m_newPage, 0, m_data.m_scene); + \
m_data.m_oldPageItem->hide(); + m_data.m_newPageItem->hide();
+
+ // set a black background
+ m_data.m_graphicsView->setBackgroundBrush(Qt::black);
+
+ m_data.m_graphicsView->show();
+
+ // Do some optimization
+ m_data.m_scene->setItemIndexMethod(QGraphicsScene::NoIndex);
+ m_data.m_graphicsView->setOptimizationFlag(QGraphicsView::DontClipPainter, \
true); + m_data.m_graphicsView->setOptimizationFlag(QGraphicsView::DontSavePainterState, \
true); + m_data.m_graphicsView->setOptimizationFlag(QGraphicsView::DontAdjustForAntialiasing, \
true); + m_data.m_graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
+
+ // If computer support openGL
+ if (QGLFormat::hasOpenGL()) {
+ m_data.m_graphicsView->setRenderHints(QPainter::SmoothPixmapTransform);
+ m_data.m_graphicsView->setRenderHints(QPainter::Antialiasing);
+ m_data.m_graphicsView->setRenderHints(QPainter::HighQualityAntialiasing);
+ QGLWidget *openGLWidget = new QGLWidget();
+ openGLWidget->format().setSwapInterval(0);
+ m_data.m_graphicsView->setViewport(openGLWidget);
+ }
+ }
m_effect->setup( m_data, m_data.m_timeLine );
}
KPrPageEffectRunner::~KPrPageEffectRunner()
{
+ delete m_data.m_graphicsView;
+ delete m_data.m_scene;
}
bool KPrPageEffectRunner::paint( QPainter &painter )
@@ -41,6 +83,7 @@
{
m_data.m_lastTime = m_data.m_currentTime;
m_data.m_currentTime = currentTime;
+
m_effect->next( m_data );
}
--- trunk/koffice/kpresenter/part/pageeffects/KPrPageEffectStrategy.cpp \
#1123616:1123617 @@ -1,5 +1,6 @@
/* This file is part of the KDE project
Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
+ Copyright (C) 2010 Benjamin Port <port.benjamin@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -24,9 +25,10 @@
#include <KoXmlWriter.h>
#include <KoGenStyle.h>
-KPrPageEffectStrategy::KPrPageEffectStrategy( int subType, const char * smilType, \
const char *smilSubType, bool reverse ) \
+KPrPageEffectStrategy::KPrPageEffectStrategy( int subType, const char * smilType, \
const char *smilSubType, bool reverse, bool graphicsView ) : m_subType( subType )
, m_smilData( smilType, smilSubType, reverse )
+, m_graphicsView(graphicsView)
{
}
@@ -76,3 +78,8 @@
{
return m_smilData.reverse;
}
+
+bool KPrPageEffectStrategy::useGraphicsView() const
+{
+ return m_graphicsView;
+}
--- trunk/koffice/kpresenter/part/pageeffects/KPrPageEffectStrategy.h \
#1123616:1123617 @@ -1,5 +1,6 @@
/* This file is part of the KDE project
Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
+ Copyright (C) 2010 Benjamin Port <port.benjamin@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -35,7 +36,7 @@
* @param smilSubType The smil:subType used for loading/saving
* @param revers The flag for the smil:direction used for loading/saving true \
means reverse false means forward
*/
- KPrPageEffectStrategy( int subType, const char * smilType, const char \
*smilSubType, bool reverse ); + KPrPageEffectStrategy( int subType, const char * \
smilType, const char *smilSubType, bool reverse, bool graphicsView = false); virtual \
~KPrPageEffectStrategy();
/**
@@ -111,6 +112,10 @@
*/
bool reverse() const;
+ /**
+ * @return true if we use QGraphicsView, false otherwise
+ */
+ bool useGraphicsView() const;
private:
struct SmilData
{
@@ -127,6 +132,7 @@
int m_subType;
SmilData m_smilData;
+ bool m_graphicsView;
};
#endif /* KPRPAGEEFFECTSTRATEGY_H */
--- trunk/koffice/kpresenter/plugins/pageeffects/CMakeLists.txt #1123616:1123617
@@ -4,3 +4,5 @@
add_subdirectory( slidewipe )
add_subdirectory( edgewipe )
add_subdirectory( iriswipe )
+add_subdirectory( spacerotation )
+add_subdirectory( swapeffect )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic