From 93f85dc75235c05a0edab277e68a503a836b898f Mon Sep 17 00:00:00 2001 From: Yoann Peronneau Date: Wed, 28 Mar 2007 18:53:27 +0000 Subject: [PATCH] * qt: escape key on QVLCFrame and QVLCDialog closes them --- modules/gui/qt4/dialogs/prefs_dialog.cpp | 20 +++++---------- modules/gui/qt4/dialogs/prefs_dialog.hpp | 7 +++--- modules/gui/qt4/util/qvlcframe.hpp | 31 +++++++++++++++++++++--- 3 files changed, 37 insertions(+), 21 deletions(-) diff --git a/modules/gui/qt4/dialogs/prefs_dialog.cpp b/modules/gui/qt4/dialogs/prefs_dialog.cpp index 172d36b19a..85ca881589 100644 --- a/modules/gui/qt4/dialogs/prefs_dialog.cpp +++ b/modules/gui/qt4/dialogs/prefs_dialog.cpp @@ -1,12 +1,12 @@ /***************************************************************************** * prefs_dialog.cpp : Preferences - **************************************************************************** - * Copyright (C) 2006 the VideoLAN team + ***************************************************************************** + * Copyright (C) 2006-2007 the VideoLAN team * $Id$ * * Authors: Clément Stenac * Jean-Baptiste Kempf - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -19,7 +19,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ #include "dialogs/prefs_dialog.hpp" #include "dialogs_provider.hpp" @@ -37,7 +38,6 @@ #include #include #include -#include PrefsDialog *PrefsDialog::instance = NULL; @@ -266,14 +266,6 @@ void PrefsDialog::reset() { config_ResetAll( p_intf ); // TODO reset changes ? - config_SaveConfigFile( p_intf, NULL ); - } -} - -void PrefsDialog::keyPressEvent( QKeyEvent *e ) -{ - if( e->key() == Qt::Key_Escape ) - { - cancel(); + config_SaveConfigFile( p_intf, NULL ); } } diff --git a/modules/gui/qt4/dialogs/prefs_dialog.hpp b/modules/gui/qt4/dialogs/prefs_dialog.hpp index 4a65edc165..17dc7b9595 100644 --- a/modules/gui/qt4/dialogs/prefs_dialog.hpp +++ b/modules/gui/qt4/dialogs/prefs_dialog.hpp @@ -1,7 +1,7 @@ /***************************************************************************** * prefs_dialog.hpp : Preferences - **************************************************************************** - * Copyright (C) 2006 the VideoLAN team + ***************************************************************************** + * Copyright (C) 2006-2007 the VideoLAN team * $Id$ * * Authors: Clément Stenac @@ -19,7 +19,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - ****************************************************************************/ + *****************************************************************************/ #ifndef _PREFS_DIALOG_H_ #define _PREFS_DIALOG_H_ @@ -86,7 +86,6 @@ private slots: void save(); void cancel(); void reset(); - void keyPressEvent( QKeyEvent * ); }; #endif diff --git a/modules/gui/qt4/util/qvlcframe.hpp b/modules/gui/qt4/util/qvlcframe.hpp index f0f489291a..82f9134688 100644 --- a/modules/gui/qt4/util/qvlcframe.hpp +++ b/modules/gui/qt4/util/qvlcframe.hpp @@ -1,7 +1,7 @@ /***************************************************************************** * qvlcframe.hpp : A few helpers - **************************************************************************** - * Copyright (C) 2006 the VideoLAN team + ***************************************************************************** + * Copyright (C) 2006-2007 the VideoLAN team * $Id$ * * Authors: Clément Stenac @@ -18,7 +18,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ #ifndef _QVLCFRAME_H_ #define _QVLCFRAME_H_ @@ -32,6 +33,7 @@ #include #include #include +#include #include "qt4.hpp" #include #include @@ -104,6 +106,17 @@ protected: settings.setValue( "pos", pos() ); settings.endGroup(); } + void cancel() + { + hide(); + } + void keyPressEvent( QKeyEvent *keyEvent ) + { + if( keyEvent->key() == Qt::Key_Escape ) + { + cancel(); + } + } }; class QVLCDialog : public QDialog @@ -121,6 +134,18 @@ public: protected: intf_thread_t *p_intf; + + void cancel() + { + hide(); + } + void keyPressEvent( QKeyEvent *keyEvent ) + { + if( keyEvent->key() == Qt::Key_Escape ) + { + cancel(); + } + } }; class QVLCMW : public QMainWindow -- 2.39.2