odstraneni nekolika gui bugu, pridani librtmp, prepsani parseru na aktualni verzi...
[ctkuk.git] / mediavideowidget.cpp
blob419e9f5e2a3a960e8d0ea69ce63269ac0588c2d6
1 #include "mediavideowidget.h"
3 MediaVideoWidget::MediaVideoWidget(/*MainWindow *player,*/ QWidget *parent) :
4 Phonon::VideoWidget(parent),/* m_player(player),*/ m_action(this)
6 m_action.setCheckable(true);
7 m_action.setChecked(false);
8 m_action.setShortcut(QKeySequence( Qt::AltModifier + Qt::Key_Return));
9 m_action.setShortcutContext(Qt::WindowShortcut);
10 connect(&m_action, SIGNAL(toggled(bool)), SLOT(setFullScreen(bool)));
11 addAction(&m_action);
12 setAcceptDrops(true);
16 void MediaVideoWidget::mouseDoubleClickEvent(QMouseEvent *e)
18 Phonon::VideoWidget::mouseDoubleClickEvent(e);
19 setFullScreen(!isFullScreen());
22 void MediaVideoWidget::keyPressEvent(QKeyEvent *e)
24 if (e->key() == Qt::Key_Space && !e->modifiers()) {
25 //m_player->playPause();
26 e->accept();
27 return;
28 } else if (e->key() == Qt::Key_Escape && !e->modifiers()) {
29 setFullScreen(false);
30 e->accept();
31 return;
33 Phonon::VideoWidget::keyPressEvent(e);
36 bool MediaVideoWidget::event(QEvent *e)
38 switch(e->type())
40 case QEvent::Close:
41 //we just ignore the cose events on the video widget
42 //this prevents ALT+F4 from having an effect in fullscreen mode
43 e->ignore();
44 return true;
45 case QEvent::MouseMove:
46 #ifndef QT_NO_CURSOR
47 unsetCursor();
48 #endif
49 //fall through
50 case QEvent::WindowStateChange:
52 //we just update the state of the checkbox, in case it wasn't already
53 m_action.setChecked(windowState() & Qt::WindowFullScreen);
54 //const Qt::WindowFlags flags = m_player->windowFlags();
55 if (windowState() & Qt::WindowFullScreen) {
56 m_timer.start(1000, this);
57 } else {
58 m_timer.stop();
59 #ifndef QT_NO_CURSOR
60 unsetCursor();
61 #endif
64 break;
65 default:
66 break;
69 return Phonon::VideoWidget::event(e);
72 void MediaVideoWidget::timerEvent(QTimerEvent *e)
74 if (e->timerId() == m_timer.timerId()) {
75 //let's store the cursor shape
76 #ifndef QT_NO_CURSOR
77 setCursor(Qt::BlankCursor);
78 #endif
80 Phonon::VideoWidget::timerEvent(e);
83 void MediaVideoWidget::dropEvent(QDropEvent *e)
85 //m_player->handleDrop(e);
88 void MediaVideoWidget::dragEnterEvent(QDragEnterEvent *e) {
89 if (e->mimeData()->hasUrls())
90 e->acceptProposedAction();