summaryrefslogtreecommitdiffstats
path: root/src/example_kjsembed.js
blob: 3412398cfc0af9a07e6999d5b8dd9bdaf594f19b (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
#!/usr/bin/env kjscmd

/**
 * Simple video widget added to your own KJSEmbed application that plays a movie
 */

// Create main view
var mw = new KMainWindow();
var box = new QVBox( mw );
mw.setCentralWidget(box);

var part = Factory.createROPart("application/x-kmplayer", box, "video_win");

/**
 * KJS Bindings for KDE-3.3 also allows passing extra arguments to the part
 * This allows to split of the control panel from the video widget:
 
var part = Factory.createROPart("application/x-kmplayer", "'KParts/ReadOnlyPart' in ServiceTypes", box, "video_win", ["CONSOLE=foo", "CONTROLS=ImageWindow"]);
var part1 = Factory.createROPart("application/x-kmplayer", "'KParts/ReadOnlyPart' in ServiceTypes", box, "control_win", ["CONSOLE=foo", "CONTROLS=ControlPanel"]);

 * The order in which the part are created doesn't really matter. Also on which
 * part openURL is called should not make a difference
 */

/**
 * There are at least two ways to communicate with kmplayer part
 * 1. use the slots of the part (see below), an array of slots is returned by
 *    part.slots()
 * 2. use kmplayer's DCOP interface
 */
 
var stopbutton = new QPushButton( box, 'Stop' );
stopbutton.text = "&Stop";
mw.connect( stopbutton, 'clicked()', part, 'stop()' );
part.openURL( "file:/home/koos/doc/example.avi" );

mw.show();
application.exec();