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)));
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();
28 } else if (e
->key() == Qt::Key_Escape
&& !e
->modifiers()) {
33 Phonon::VideoWidget::keyPressEvent(e
);
36 bool MediaVideoWidget::event(QEvent
*e
)
41 //we just ignore the cose events on the video widget
42 //this prevents ALT+F4 from having an effect in fullscreen mode
45 case QEvent::MouseMove
:
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);
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
77 setCursor(Qt::BlankCursor
);
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();