36
36
#include <KoShapeController.h>
37
37
#include <KoShapeManager.h>
38
38
#include <KoEventAction.h>
39
#include <KoEventActionFactory.h>
39
#include <KoEventActionFactoryBase.h>
40
40
#include <KoEventActionRegistry.h>
41
#include <KoEventActionWidget.h>
41
#include <KPrEventActionWidget.h>
42
42
#include "KPrSoundData.h"
43
#include <KPresenter.h>
43
44
#include "KPrSoundCollection.h"
44
45
#include "KPrView.h"
45
46
#include "KPrPage.h"
58
59
m_cbPlaySound = new QComboBox();
59
60
//layout->addWidget(m_cbPlaySound);
61
QList<KoEventActionFactory *> factories = KoEventActionRegistry::instance()->presentationEventActions();
62
foreach ( KoEventActionFactory * factory, factories ) {
63
KoEventActionWidget * optionWidget = factory->createOptionWidget();
62
QList<KoEventActionFactoryBase *> factories = KoEventActionRegistry::instance()->presentationEventActions();
63
foreach ( KoEventActionFactoryBase * factory, factories ) {
64
QWidget * optionWidget = factory->createOptionWidget();
64
65
layout->addWidget( optionWidget );
65
66
m_eventActionWidgets.insert( factory->id(), optionWidget );
66
67
connect( optionWidget, SIGNAL( addCommand( QUndoCommand * ) ),
78
79
KoShape *shape = selection->firstSelectedShape();
81
QList<KoEventAction *> eventActions = shape->eventActions();
82
QSet<KoEventAction *> eventActions = shape->eventActions();
82
83
QMap<QString, KoEventAction*> eventActionMap;
83
84
foreach ( KoEventAction * eventAction, eventActions ) {
84
85
eventActionMap.insert( eventAction->id(), eventAction );
87
QMap<QString, KoEventActionWidget *>::const_iterator it( m_eventActionWidgets.constBegin() );
88
QMap<QString, QWidget *>::const_iterator it(m_eventActionWidgets.constBegin());
89
for ( ; it != m_eventActionWidgets.constEnd(); ++it ) {
90
// if it is not in the map a default value 0 pointer will be returned
91
KPrEventActionData data( shape, eventActionMap.value( it.key() ), m_soundCollection );
92
it.value()->setData( &data );
90
for (; it != m_eventActionWidgets.constEnd(); ++it) {
91
KPrEventActionWidget *actionWidget = dynamic_cast<KPrEventActionWidget*>(it.value());
93
// if it is not in the map a default value 0 pointer will be returned
94
KPrEventActionData data(shape, eventActionMap.value(it.key()), m_soundCollection);
95
actionWidget->setData(&data);
96
foreach ( KoEventActionWidget * widget, m_eventActionWidgets ) {
97
KPrEventActionData data( 0, 0, m_soundCollection );
98
widget->setData( &data );
100
foreach (QWidget *widget, m_eventActionWidgets) {
101
KPrEventActionWidget *actionWidget = dynamic_cast<KPrEventActionWidget*>(widget);
103
KPrEventActionData data(0, 0, m_soundCollection);
104
actionWidget->setData( &data );
115
122
void KPrClickActionDocker::setView(KoPAView *view )
118
m_soundCollection = dynamic_cast<KPrSoundCollection *>( m_view->kopaDocument()->dataCenterMap()["SoundCollection"] );
125
if (m_view->kopaDocument()->resourceManager()->hasResource(KPresenter::SoundCollection)) {
126
QVariant variant = m_view->kopaDocument()->resourceManager()->resource(KPresenter::SoundCollection);
127
m_soundCollection = variant.value<KPrSoundCollection*>();
120
130
setCanvas(view->kopaCanvas());