[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kpresenter
From: Thorsten Zachmann <t.zachmann () zagge ! de>
Date: 2009-05-09 4:32:44
Message-ID: 1241843564.783928.17165.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 965490 by zachmann:
o merge changes from koffice-isi branch to trunk.
This brings a highlight and a draw function to the presentation mode
of kpresenter. With the highlight function it is possible to have a
spotlight following the mouse to hightlight a part of the slide. With
the draw function it is possible to draw onto the slide.
This is a first merge form the branch. More to follow.
Thanks to the students who worked on the koffice-isi branch for their
hard work.
M +8 -0 part/CMakeLists.txt
AM part/KPrPresentationDrawStrategy.cpp \
branches/work/koffice-isi/kpresenter/part/KPrPresentationDrawStrategy.cpp#957434 \
[License: LGPL (v2+)] AM part/KPrPresentationDrawStrategy.h \
branches/work/koffice-isi/kpresenter/part/KPrPresentationDrawStrategy.h#957434 \
[License: LGPL (v2+)] AM part/KPrPresentationDrawWidget.cpp \
branches/work/koffice-isi/kpresenter/part/KPrPresentationDrawWidget.cpp#957434 \
[License: LGPL (v2+)] AM part/KPrPresentationDrawWidget.h \
branches/work/koffice-isi/kpresenter/part/KPrPresentationDrawWidget.h#957434 \
[License: LGPL (v2+)] AM part/KPrPresentationHighlightStrategy.cpp \
branches/work/koffice-isi/kpresenter/part/KPrPresentationHighlightStrategy.cpp#957434 \
[License: LGPL (v2+)] AM part/KPrPresentationHighlightStrategy.h \
branches/work/koffice-isi/kpresenter/part/KPrPresentationHighlightStrategy.h#957434 \
[License: LGPL (v2+)] AM part/KPrPresentationHighlightWidget.cpp \
branches/work/koffice-isi/kpresenter/part/KPrPresentationHighlightWidget.cpp#957434 \
[License: LGPL (v2+)] AM part/KPrPresentationHighlightWidget.h \
branches/work/koffice-isi/kpresenter/part/KPrPresentationHighlightWidget.h#957434 \
[License: LGPL (v2+)] AM part/KPrPresentationStrategy.cpp \
branches/work/koffice-isi/kpresenter/part/KPrPresentationStrategy.cpp#957708 \
[License: LGPL (v2+)] AM part/KPrPresentationStrategy.h \
branches/work/koffice-isi/kpresenter/part/KPrPresentationStrategy.h#957434 [License: \
LGPL (v2+)] AM part/KPrPresentationStrategyInterface.cpp \
branches/work/koffice-isi/kpresenter/part/KPrPresentationStrategyInterface.cpp#957434 \
[License: LGPL (v2+)] AM part/KPrPresentationStrategyInterface.h \
branches/work/koffice-isi/kpresenter/part/KPrPresentationStrategyInterface.h#957434 \
[License: LGPL (v2+)] M +135 -33 part/KPrPresentationTool.cpp
M +20 -2 part/KPrPresentationTool.h
M +4 -0 part/KPrSoundData.h
M +4 -2 part/KPrViewModePresentation.cpp
AM part/ui/KPrPresentationTool.ui \
branches/work/koffice-isi/kpresenter/part/ui/KPrPresentationTool.ui#953648 AM \
part/ui/KPrPresentationToolWidget.cpp \
branches/work/koffice-isi/kpresenter/part/ui/KPrPresentationToolWidget.cpp#958419 \
[License: LGPL (v2+)] AM part/ui/KPrPresentationToolWidget.h \
branches/work/koffice-isi/kpresenter/part/ui/KPrPresentationToolWidget.h#958419 \
[License: LGPL (v2+)] M +1 -1 pics/CMakeLists.txt
AM pics/hi16-action-highlight.png \
branches/work/koffice-isi/kpresenter/part/ui/pics/hi16-action-highlight.png#953648 \
AM pics/hi16-action-pen.png \
branches/work/koffice-isi/kpresenter/part/ui/pics/hi16-action-pen.png#953648
--- trunk/koffice/kpresenter/part/CMakeLists.txt #965489:965490
@@ -45,6 +45,12 @@
KPrPlaceholderStrategy.cpp
KPrPlaceholderPictureStrategy.cpp
KPrPlaceholderTextStrategy.cpp
+ KPrPresentationHighlightWidget.cpp
+ KPrPresentationDrawWidget.cpp
+ KPrPresentationStrategy.cpp
+ KPrPresentationHighlightStrategy.cpp
+ KPrPresentationStrategyInterface.cpp
+ KPrPresentationDrawStrategy.cpp
commands/KPrAnimationCreateCommand.cpp
commands/KPrPageEffectSetCommand.cpp
@@ -77,6 +83,7 @@
ui/KPrCustomSlideShowsDialog.cpp
ui/KPrConfigureSlideShowDialog.cpp
ui/KPrConfigurePresenterViewDialog.cpp
+ ui/KPrPresentationToolWidget.cpp
tools/KPrPlaceholderTool.cpp
tools/KPrPlaceholderToolFactory.cpp
@@ -86,6 +93,7 @@
ui/KPrCustomSlideShowsDialog.ui
ui/KPrConfigureSlideShow.ui
ui/KPrConfigurePresenterView.ui
+ ui/KPrPresentationTool.ui
)
kde4_add_library(kpresenterprivate SHARED ${kpresenterprivate_LIB_SRCS})
** trunk/koffice/kpresenter/part/KPrPresentationDrawStrategy.cpp #property \
svn:mergeinfo +
** trunk/koffice/kpresenter/part/KPrPresentationDrawStrategy.h #property \
svn:mergeinfo +
** trunk/koffice/kpresenter/part/KPrPresentationDrawWidget.cpp #property \
svn:mergeinfo +
** trunk/koffice/kpresenter/part/KPrPresentationDrawWidget.h #property svn:mergeinfo
+
** trunk/koffice/kpresenter/part/KPrPresentationHighlightStrategy.cpp #property \
svn:mergeinfo +
** trunk/koffice/kpresenter/part/KPrPresentationHighlightStrategy.h #property \
svn:mergeinfo +
** trunk/koffice/kpresenter/part/KPrPresentationHighlightWidget.cpp #property \
svn:mergeinfo +
** trunk/koffice/kpresenter/part/KPrPresentationHighlightWidget.h #property \
svn:mergeinfo +
** trunk/koffice/kpresenter/part/KPrPresentationStrategy.cpp #property svn:mergeinfo
+
** trunk/koffice/kpresenter/part/KPrPresentationStrategy.h #property svn:mergeinfo
+
** trunk/koffice/kpresenter/part/KPrPresentationStrategyInterface.cpp #property \
svn:mergeinfo +
** trunk/koffice/kpresenter/part/KPrPresentationStrategyInterface.h #property \
svn:mergeinfo +
--- trunk/koffice/kpresenter/part/KPrPresentationTool.cpp #965489:965490
@@ -1,5 +1,10 @@
/* This file is part of the KDE project
- * Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
+ * Copyright (C) 2007-2009 Thorsten Zachmann <zachmann@kde.org>
+ * Copyright (C) 2008 Jim Courtiau <jeremy.courtiau@gmail.com>
+ * Copyright (C) 2009 Alexia Allanic <alexia_allanic@yahoo.fr>
+ * Copyright (C) 2009 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
+ * Copyright (C) 2009 Jérémy Lugagne <jejewindsurf@hotmail.com>
+ * Copyright (C) 2009 Johann Hingue <yoan1703@hotmail.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -19,6 +24,9 @@
#include "KPrPresentationTool.h"
+#include <QtGui/QWidget>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QPainter>
#include <QKeyEvent>
#include <KoShape.h>
@@ -26,22 +34,48 @@
#include <KoPointerEvent.h>
#include <KoEventAction.h>
#include <KoPACanvas.h>
+
#include "KPrViewModePresentation.h"
+#include "KPrPresentationStrategy.h"
+#include "KPrPresentationHighlightStrategy.h"
+#include "KPrPresentationDrawStrategy.h"
+#include "ui/KPrPresentationToolWidget.h"
+
KPrPresentationTool::KPrPresentationTool( KPrViewModePresentation & viewMode )
: KoTool( viewMode.canvas() )
, m_viewMode( viewMode )
+, m_strategy( new KPrPresentationStrategy( this ) )
{
+ // tool box
+ m_frame = new QFrame( m_viewMode.canvas() );
+
+ QVBoxLayout *frameLayout = new QVBoxLayout();
+
+ m_presentationToolWidget = new KPrPresentationToolWidget(m_viewMode.canvas());
+ frameLayout->addWidget( m_presentationToolWidget, 0, Qt::AlignLeft | \
Qt::AlignBottom ); + m_frame->setLayout( frameLayout );
+ m_frame->show();
+
+ m_presentationToolWidget->raise();
+ m_presentationToolWidget->setVisible( false );
+ m_presentationToolWidget->installEventFilter(this);
+
+ // Connections of button clicked to slots
+ connect( m_presentationToolWidget->presentationToolUi().penButton, SIGNAL( \
clicked() ), this, SLOT( drawOnPresentation() ) ); + connect( \
m_presentationToolWidget->presentationToolUi().highLightButton, SIGNAL( clicked() ), \
this, SLOT( highLightPresentation() ) ); }
KPrPresentationTool::~KPrPresentationTool()
{
+ delete m_strategy;
}
bool KPrPresentationTool::wantsAutoScroll()
{
return false;
}
+
void KPrPresentationTool::paint( QPainter &painter, const KoViewConverter &converter \
) {
}
@@ -86,51 +120,67 @@
void KPrPresentationTool::keyPressEvent( QKeyEvent *event )
{
finishEventActions();
- event->accept();
-
- switch ( event->key() )
- {
- case Qt::Key_Escape:
- m_viewMode.activateSavedViewMode();
- break;
- case Qt::Key_Home:
- m_viewMode.navigate( KPrAnimationDirector::FirstPage );
- break;
- case Qt::Key_Up:
- case Qt::Key_PageUp:
- m_viewMode.navigate( KPrAnimationDirector::PreviousPage );
- break;
- case Qt::Key_Backspace:
- case Qt::Key_Left:
- m_viewMode.navigate( KPrAnimationDirector::PreviousStep );
- break;
- case Qt::Key_Right:
- case Qt::Key_Space:
- m_viewMode.navigate( KPrAnimationDirector::NextStep );
- break;
- case Qt::Key_Down:
- case Qt::Key_PageDown:
- m_viewMode.navigate( KPrAnimationDirector::NextPage );
- break;
- case Qt::Key_End:
- m_viewMode.navigate( KPrAnimationDirector::LastPage );
- break;
- default:
- event->ignore();
- break;
+ // first try to handle the event in the strategy if it is done there no need to \
use the default action + if ( ! m_strategy->keyPressEvent( event ) ) {
+ switch ( event->key() )
+ {
+ case Qt::Key_Escape:
+ m_viewMode.activateSavedViewMode();
+ break;
+ case Qt::Key_Home:
+ m_viewMode.navigate( KPrAnimationDirector::FirstPage );
+ break;
+ case Qt::Key_Up:
+ case Qt::Key_PageUp:
+ m_viewMode.navigate( KPrAnimationDirector::PreviousPage );
+ break;
+ case Qt::Key_Backspace:
+ case Qt::Key_Left:
+ m_viewMode.navigate( KPrAnimationDirector::PreviousStep );
+ break;
+ case Qt::Key_Right:
+ case Qt::Key_Space:
+ m_viewMode.navigate( KPrAnimationDirector::NextStep );
+ break;
+ case Qt::Key_Down:
+ case Qt::Key_PageDown:
+ m_viewMode.navigate( KPrAnimationDirector::NextPage );
+ break;
+ case Qt::Key_End:
+ m_viewMode.navigate( KPrAnimationDirector::LastPage );
+ break;
+ case Qt::Key_P:
+ drawOnPresentation();
+ break;
+ case Qt::Key_H:
+ highLightPresentation();
+ break;
+ default:
+ event->ignore();
+ break;
+ }
}
}
void KPrPresentationTool::keyReleaseEvent( QKeyEvent *event )
{
+ Q_UNUSED( event );
}
void KPrPresentationTool::wheelEvent( KoPointerEvent * event )
{
+ Q_UNUSED( event );
}
void KPrPresentationTool::activate( bool temporary )
{
+ Q_UNUSED( temporary );
+ m_frame->setGeometry( m_canvas->canvasWidget()->geometry() );
+ m_presentationToolWidget->setVisible( false );
+ // redirect event to tool widget
+ m_frame->installEventFilter( this );
+ // activate tracking for show/hide tool buttons
+ m_frame->setMouseTracking( true );
}
void KPrPresentationTool::deactivate()
@@ -145,4 +195,56 @@
}
}
+void KPrPresentationTool::switchStrategy( KPrPresentationStrategyInterface * \
strategy ) +{
+ Q_ASSERT( strategy );
+ Q_ASSERT( m_strategy != strategy );
+ delete m_strategy;
+ m_strategy = strategy;
+}
+
+// SLOTS
+void KPrPresentationTool::highLightPresentation()
+{
+ KPrPresentationStrategyInterface * strategy;
+ if ( dynamic_cast<KPrPresentationHighlightStrategy *>( m_strategy ) ) {
+ strategy = new KPrPresentationStrategy( this );
+ }
+ else {
+ strategy = new KPrPresentationHighlightStrategy( this );
+ }
+ switchStrategy( strategy );
+}
+
+void KPrPresentationTool::drawOnPresentation()
+{
+ KPrPresentationStrategyInterface * strategy;
+ if ( dynamic_cast<KPrPresentationDrawStrategy*>( m_strategy ) ) {
+ strategy = new KPrPresentationStrategy( this );
+ }
+ else {
+ strategy = new KPrPresentationDrawStrategy( this );
+ }
+ switchStrategy( strategy );
+}
+
+bool KPrPresentationTool::eventFilter( QObject *obj, QEvent * event )
+{
+ if ( event->type() == QEvent::MouseMove ) {
+ QMouseEvent *mouseEvent = static_cast<QMouseEvent*>( event );
+ QWidget *source = static_cast<QWidget*>( obj );
+ QPoint pos = source->mapFrom( m_viewMode.canvas(), mouseEvent->pos() );
+
+ QSize buttonSize = m_presentationToolWidget->size() + QSize( 20, 20 );
+ QRect geometry = QRect( 0, m_frame->height() - buttonSize.height(), \
buttonSize.width(), buttonSize.height() ); + if ( geometry.contains( pos ) ) {
+ m_presentationToolWidget->setVisible( true );
+ }
+ else {
+ m_presentationToolWidget->setVisible( false );
+ }
+ }
+ return false;
+}
+
#include "KPrPresentationTool.moc"
--- trunk/koffice/kpresenter/part/KPrPresentationTool.h #965489:965490
@@ -1,5 +1,10 @@
/* This file is part of the KDE project
- * Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
+ * Copyright (C) 2007-2009 Thorsten Zachmann <zachmann@kde.org>
+ * Copyright (C) 2008 Jim Courtiau <jeremy.courtiau@gmail.com>
+ * Copyright (C) 2009 Alexia Allanic <alexia_allanic@yahoo.fr>
+ * Copyright (C) 2009 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
+ * Copyright (C) 2009 Jérémy Lugagne <jejewindsurf@hotmail.com>
+ * Copyright (C) 2009 Johann Hingue <yoan1703@hotmail.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -23,11 +28,15 @@
#include <QList>
+class QFrame;
class KoEventAction;
class KPrViewModePresentation;
+class KPrPresentationToolWidget;
+class KPrPresentationStrategyInterface;
/// The tool used for presentations
-class KPrPresentationTool : public KoTool {
+class KPrPresentationTool : public KoTool
+{
Q_OBJECT
public:
explicit KPrPresentationTool( KPrViewModePresentation & viewMode );
@@ -48,12 +57,21 @@
public slots:
void activate( bool temporary = false );
void deactivate();
+ void highLightPresentation();
+ void drawOnPresentation();
private:
void finishEventActions();
+ void switchStrategy( KPrPresentationStrategyInterface * strategy );
+ bool eventFilter( QObject * obj, QEvent * event );
KPrViewModePresentation & m_viewMode;
QList<KoEventAction *> m_eventActions;
+
+ KPrPresentationToolWidget * m_presentationToolWidget;
+ QFrame * m_frame;
+ KPrPresentationStrategyInterface * m_strategy;
+ friend class KPrPresentationStrategyInterface;
};
#endif /* KPRPRESENTATIONTOOL_H */
--- trunk/koffice/kpresenter/part/KPrSoundData.h #965489:965490
@@ -32,6 +32,10 @@
* In KPresenter shapes can have click actions attached to them. One such action is \
playing sound.
* The binary data for those sounds are saved in this class.
*/
+
+/*
+ * TODO needs a file for playing, store it as a tmp file
+ */
class KPRESENTER_EXPORT KPrSoundData {
public:
/**
--- trunk/koffice/kpresenter/part/KPrViewModePresentation.cpp #965489:965490
@@ -155,10 +155,12 @@
QRect presentationRect = desktop.screenGeometry( presentationscreen );
- m_canvas->move( presentationRect.topLeft() );
m_canvas->setWindowState( m_canvas->windowState() | Qt::WindowFullScreen ); // \
detach widget to make m_canvas->show();
m_canvas->setFocus(); // it shown full screen
+ // move and resize now as otherwise it is not set when we call activate on the \
tool. + m_canvas->move( presentationRect.topLeft() );
+ m_canvas->resize( presentationRect.size() );
// the main animation director needs to be created first since it will set the \
active page // of the presentation
@@ -175,7 +177,7 @@
m_presenterViewWidget->setWindowState(
m_presenterViewWidget->windowState() | Qt::WindowFullScreen );
m_presenterViewWidget->move( pvRect.topLeft() );
- m_presenterViewWidget->updateWidget( pvRect.size(), \
presentationRect.size() ); + m_presenterViewWidget->updateWidget( \
pvRect.size(), presentationRect.size() ); m_presenterViewWidget->show();
m_presenterViewWidget->setFocus(); // it \
shown full screen
** trunk/koffice/kpresenter/part/ui/KPrPresentationTool.ui #property svn:mergeinfo
+
** trunk/koffice/kpresenter/part/ui/KPrPresentationToolWidget.cpp #property \
svn:mergeinfo +
** trunk/koffice/kpresenter/part/ui/KPrPresentationToolWidget.h #property \
svn:mergeinfo +
--- trunk/koffice/kpresenter/pics/CMakeLists.txt #965489:965490
@@ -5,5 +5,5 @@
layout-elements.svg
DESTINATION ${DATA_INSTALL_DIR}/kpresenter/pics)
-kde4_install_icons( ${ICON_INSTALL_DIR} )
+kde4_install_icons( ${ICON_INSTALL_DIR} )
** trunk/koffice/kpresenter/pics/hi16-action-highlight.png #property svn:mergeinfo
+
** trunk/koffice/kpresenter/pics/hi16-action-highlight.png #property svn:mime-type
+ application/octet-stream
** trunk/koffice/kpresenter/pics/hi16-action-pen.png #property svn:mergeinfo
+
** trunk/koffice/kpresenter/pics/hi16-action-pen.png #property svn:mime-type
+ application/octet-stream
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic