summaryrefslogtreecommitdiff
path: root/flashplayer_part.cpp
blob: f2ee16fdf20783bd61d263ae1160189f5922a16c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

// Own
#include "flashplayer_part.h"

// Qt
#include <qurl.h>

// Local
#include "flashplayerwidget.h"

extern "C"
{
    // entry point for the swfdec-based flash player part library,
    // returns a new factory which can be used to construct Konsole parts
    KDE_EXPORT void* init_libflashplayerpart()
    {
        return new FlashPlayer::PartFactory;
    }
}

using namespace FlashPlayer;

KParts::Part* PartFactory::createPartObject( QWidget* parentWidget,
                                             const char* /* something */,
                                             QObject* parent,
                                             const char* /*classname*/,
                                             const char* /* something_2 */,
                                             const QStringList& /*args*/)
{
    return new Part(parentWidget,parent);
}

class Part::Private
{
public:
    FlashPlayerWidget* player;        
};

Part::Part(QWidget* parentWidget , QObject* parent)
 : KParts::ReadOnlyPart(parent)
 , d(new Private)
{
    d->player = new FlashPlayerWidget(parentWidget);
    
    setWidget(d->player);
}
bool Part::openFile()
{
    d->player->load( QUrl(url().path()) );
    d->player->play();

    return true;
}

#include "flashplayer_part.moc"