#endif
#include "components/interface_widgets.hpp"
+#include "dialogs_provider.hpp"
+#include "util/customwidgets.hpp" // qtEventToVLCKey, QVLCStackedWidget
#include "menus.hpp" /* Popup menu on bgWidget */
#include <QLabel>
#include <QToolButton>
#include <QPalette>
+#include <QEvent>
#include <QResizeEvent>
#include <QDate>
#include <QMenu>
VideoWidget *owner;
public:
ReparentableWidget( VideoWidget *owner ) : owner( owner )
- {
- }
-
-protected:
- void keyPressEvent( QKeyEvent *e )
- {
- emit owner->keyPressed( e );
- }
+ {}
};
/**********************************************************************
* mode, and within the root window (NULL parent) in full-screen mode.
*/
reparentable = new ReparentableWidget( this );
+ reparentable->installEventFilter(this );
QLayout *innerLayout = new QHBoxLayout( reparentable );
innerLayout->setContentsMargins( 0, 0, 0, 0 );
hide();
}
+#undef KeyPress
+bool VideoWidget::eventFilter(QObject *obj, QEvent *event)
+{
+ if( obj == reparentable )
+ {
+ if (event->type() == QEvent::Close)
+ {
+ THEDP->quit();
+ return true;
+ }
+ else if( event->type() == QEvent::KeyPress )
+ {
+ emit keyPressed( static_cast<QKeyEvent *>(event) );
+ return true;
+ }
+ else if( event->type() == QEvent::Wheel )
+ {
+ int i_vlckey = qtWheelEventToVLCKey( static_cast<QWheelEvent *>( event) );
+ var_SetInteger( p_intf->p_libvlc, "key-pressed", i_vlckey );
+ msg_Dbg( p_intf, "Here: %i", i_vlckey );
+ return true;
+ }
+ }
+ return false;
+}
+
/**********************************************************************
* Background Widget. Show a simple image background. Currently,
* it's album art if present or cone.