File indexing completed on 2024-03-24 16:22:01

0001 #!/usr/bin/env kjscmd
0002 
0003 /**
0004  * Simple video widget added to your own KJSEmbed application that plays a movie
0005  */
0006 
0007 // Create main view
0008 var mw = new KMainWindow();
0009 var box = new QVBox( mw );
0010 mw.setCentralWidget(box);
0011 
0012 var part = Factory.createROPart("application/x-kmplayer", box, "video_win");
0013 
0014 /**
0015  * KJS Bindings for KDE-3.3 also allows passing extra arguments to the part
0016  * This allows to split of the control panel from the video widget:
0017  
0018 var part = Factory.createROPart("application/x-kmplayer", "'KParts/ReadOnlyPart' in ServiceTypes", box, "video_win", ["CONSOLE=foo", "CONTROLS=ImageWindow"]);
0019 var part1 = Factory.createROPart("application/x-kmplayer", "'KParts/ReadOnlyPart' in ServiceTypes", box, "control_win", ["CONSOLE=foo", "CONTROLS=ControlPanel"]);
0020 
0021  * The order in which the part are created doesn't really matter. Also on which
0022  * part openURL is called should not make a difference
0023  */
0024 
0025 /**
0026  * There are at least two ways to communicate with kmplayer part
0027  * 1. use the slots of the part (see below), an array of slots is returned by
0028  *    part.slots()
0029  * 2. use kmplayer's DCOP interface
0030  */
0031  
0032 var stopbutton = new QPushButton( box, 'Stop' );
0033 stopbutton.text = "&Stop";
0034 mw.connect( stopbutton, 'clicked()', part, 'stop()' );
0035 part.openURL( "file:/home/koos/doc/example.avi" );
0036 
0037 mw.show();
0038 application.exec();