/ src /
/src/video.lisp
1 (in-package :qt.examples)
2
3 (defun play-video ()
4 "Play video"
5 (qt:with-app ()
6 (setf (cxx:application-name (qt:app)) "Lisp")
7 (let ((widget (make-instance 'qt:widget))
8 (video-player (make-instance 'qt:phonon.video-player
9 :arg0 qt:phonon.+video-category+)))
10 (let ((layout (make-instance 'qt:vbox-layout))
11 (open-button (make-instance 'qt:push-button :arg0 "Open")))
12 (cxx:add-widget layout video-player)
13 (cxx:add-widget layout open-button)
14 (qt:connect (qt:get-signal open-button "clicked()")
15 #'(lambda ()
16 (let ((file (qt:file-dialog.get-open-file-name
17 video-player
18 "Select the file to play")))
19 (when (> (length file) 0)
20 (cxx:play video-player file)))))
21 (cxx:set-layout widget layout))
22 (cxx:resize widget 300 300)
23 (cxx:show widget)
24 (qt:exec))))