Commit 93f85dc7 authored by Yoann Peronneau's avatar Yoann Peronneau

* qt: escape key on QVLCFrame and QVLCDialog closes them

parent c8540099
/***************************************************************************** /*****************************************************************************
* prefs_dialog.cpp : Preferences * prefs_dialog.cpp : Preferences
**************************************************************************** *****************************************************************************
* Copyright (C) 2006 the VideoLAN team * Copyright (C) 2006-2007 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
* Jean-Baptiste Kempf <jb@videolan.org> * Jean-Baptiste Kempf <jb@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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/prefs_dialog.hpp"
#include "dialogs_provider.hpp" #include "dialogs_provider.hpp"
...@@ -37,7 +38,6 @@ ...@@ -37,7 +38,6 @@
#include <QCheckBox> #include <QCheckBox>
#include <QScrollArea> #include <QScrollArea>
#include <QMessageBox> #include <QMessageBox>
#include <QKeyEvent>
PrefsDialog *PrefsDialog::instance = NULL; PrefsDialog *PrefsDialog::instance = NULL;
...@@ -266,14 +266,6 @@ void PrefsDialog::reset() ...@@ -266,14 +266,6 @@ void PrefsDialog::reset()
{ {
config_ResetAll( p_intf ); config_ResetAll( p_intf );
// TODO reset changes ? // TODO reset changes ?
config_SaveConfigFile( p_intf, NULL ); config_SaveConfigFile( p_intf, NULL );
}
}
void PrefsDialog::keyPressEvent( QKeyEvent *e )
{
if( e->key() == Qt::Key_Escape )
{
cancel();
} }
} }
/***************************************************************************** /*****************************************************************************
* prefs_dialog.hpp : Preferences * prefs_dialog.hpp : Preferences
**************************************************************************** *****************************************************************************
* Copyright (C) 2006 the VideoLAN team * Copyright (C) 2006-2007 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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 _PREFS_DIALOG_H_ #ifndef _PREFS_DIALOG_H_
#define _PREFS_DIALOG_H_ #define _PREFS_DIALOG_H_
...@@ -86,7 +86,6 @@ private slots: ...@@ -86,7 +86,6 @@ private slots:
void save(); void save();
void cancel(); void cancel();
void reset(); void reset();
void keyPressEvent( QKeyEvent * );
}; };
#endif #endif
/***************************************************************************** /*****************************************************************************
* qvlcframe.hpp : A few helpers * qvlcframe.hpp : A few helpers
**************************************************************************** *****************************************************************************
* Copyright (C) 2006 the VideoLAN team * Copyright (C) 2006-2007 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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_ #ifndef _QVLCFRAME_H_
#define _QVLCFRAME_H_ #define _QVLCFRAME_H_
...@@ -32,6 +33,7 @@ ...@@ -32,6 +33,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QPlastiqueStyle> #include <QPlastiqueStyle>
#include <QPushButton> #include <QPushButton>
#include <QKeyEvent>
#include "qt4.hpp" #include "qt4.hpp"
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc_charset.h> #include <vlc_charset.h>
...@@ -104,6 +106,17 @@ protected: ...@@ -104,6 +106,17 @@ protected:
settings.setValue( "pos", pos() ); settings.setValue( "pos", pos() );
settings.endGroup(); settings.endGroup();
} }
void cancel()
{
hide();
}
void keyPressEvent( QKeyEvent *keyEvent )
{
if( keyEvent->key() == Qt::Key_Escape )
{
cancel();
}
}
}; };
class QVLCDialog : public QDialog class QVLCDialog : public QDialog
...@@ -121,6 +134,18 @@ public: ...@@ -121,6 +134,18 @@ public:
protected: protected:
intf_thread_t *p_intf; intf_thread_t *p_intf;
void cancel()
{
hide();
}
void keyPressEvent( QKeyEvent *keyEvent )
{
if( keyEvent->key() == Qt::Key_Escape )
{
cancel();
}
}
}; };
class QVLCMW : public QMainWindow class QVLCMW : public QMainWindow
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment