Commit 7acc8749 authored by Clément Stenac's avatar Clément Stenac

Beginning of menus implementation

Fix a make dist bug
parent 375ec894
...@@ -16,6 +16,7 @@ TOUI = ui/input_stats ui/main_interface ui/file_open \ ...@@ -16,6 +16,7 @@ TOUI = ui/input_stats ui/main_interface ui/file_open \
UIH = $(TOUI:%=%.h) UIH = $(TOUI:%=%.h)
TOMOC = main_interface \ TOMOC = main_interface \
menus \
dialogs_provider \ dialogs_provider \
input_manager \ input_manager \
playlist_model \ playlist_model \
...@@ -34,6 +35,7 @@ MOCCPP = $(TOMOC:%=%.moc.cpp) ...@@ -34,6 +35,7 @@ MOCCPP = $(TOMOC:%=%.moc.cpp)
nodist_SOURCES_qt4 = \ nodist_SOURCES_qt4 = \
main_interface.moc.cpp \ main_interface.moc.cpp \
menus.moc.cpp \
dialogs_provider.moc.cpp \ dialogs_provider.moc.cpp \
input_manager.moc.cpp \ input_manager.moc.cpp \
playlist_model.moc.cpp \ playlist_model.moc.cpp \
...@@ -70,6 +72,7 @@ $(UIH): %.h: %.ui ...@@ -70,6 +72,7 @@ $(UIH): %.h: %.ui
SOURCES_qt4 = qt4.cpp \ SOURCES_qt4 = qt4.cpp \
menus.cpp \
main_interface.cpp \ main_interface.cpp \
dialogs_provider.cpp \ dialogs_provider.cpp \
input_manager.cpp \ input_manager.cpp \
...@@ -89,6 +92,7 @@ SOURCES_qt4 = qt4.cpp \ ...@@ -89,6 +92,7 @@ SOURCES_qt4 = qt4.cpp \
EXTRA_DIST += \ EXTRA_DIST += \
qt4.hpp \ qt4.hpp \
menus.hpp
main_interface.hpp \ main_interface.hpp \
dialogs_provider.hpp \ dialogs_provider.hpp \
input_manager.hpp \ input_manager.hpp \
...@@ -104,6 +108,7 @@ EXTRA_DIST += \ ...@@ -104,6 +108,7 @@ EXTRA_DIST += \
components/open.hpp \ components/open.hpp \
components/video_widget.hpp \ components/video_widget.hpp \
components/playlist/panels.hpp \ components/playlist/panels.hpp \
components/playlist/selector.hpp \
util/input_slider.hpp \ util/input_slider.hpp \
ui/input_stats.ui \ ui/input_stats.ui \
ui/file_open.ui \ ui/file_open.ui \
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include "dialogs/prefs_dialog.hpp" #include "dialogs/prefs_dialog.hpp"
#include "dialogs/streaminfo.hpp" #include "dialogs/streaminfo.hpp"
#include <QApplication> #include <QApplication>
#include <QSignalMapper>
#include "menus.hpp"
DialogsProvider* DialogsProvider::instance = NULL; DialogsProvider* DialogsProvider::instance = NULL;
...@@ -38,12 +40,16 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) : ...@@ -38,12 +40,16 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
fixed_timer = new QTimer( this ); fixed_timer = new QTimer( this );
fixed_timer->start( 150 /* milliseconds */ ); fixed_timer->start( 150 /* milliseconds */ );
menusMapper = new QSignalMapper();
connect( menusMapper, SIGNAL( mapped(QObject *) ), this,
SLOT(menuAction( QObject *)) );
} }
DialogsProvider::~DialogsProvider() DialogsProvider::~DialogsProvider()
{ {
} }
void DialogsProvider::customEvent( QEvent *event ) void DialogsProvider::customEvent( QEvent *event )
{ {
if( event->type() == DialogEvent_Type ) if( event->type() == DialogEvent_Type )
...@@ -85,6 +91,10 @@ void DialogsProvider::playlistDialog() ...@@ -85,6 +91,10 @@ void DialogsProvider::playlistDialog()
PlaylistDialog::getInstance( p_intf )->toggleVisible(); PlaylistDialog::getInstance( p_intf )->toggleVisible();
} }
void DialogsProvider::openDialog()
{
openDialog( 0 );
}
void DialogsProvider::openDialog( int i_dialog ) void DialogsProvider::openDialog( int i_dialog )
{ {
} }
...@@ -124,6 +134,10 @@ void DialogsProvider::streaminfoDialog() ...@@ -124,6 +134,10 @@ void DialogsProvider::streaminfoDialog()
StreamInfoDialog::getInstance( p_intf, true )->toggleVisible(); StreamInfoDialog::getInstance( p_intf, true )->toggleVisible();
} }
void DialogsProvider::streamingDialog()
{
}
void DialogsProvider::prefsDialog() void DialogsProvider::prefsDialog()
{ {
PrefsDialog::getInstance( p_intf )->toggleVisible(); PrefsDialog::getInstance( p_intf )->toggleVisible();
...@@ -133,6 +147,15 @@ void DialogsProvider::messagesDialog() ...@@ -133,6 +147,15 @@ void DialogsProvider::messagesDialog()
{ {
} }
void DialogsProvider::menuAction( QObject *data )
{
QVLCMenu::DoAction( p_intf, data );
}
void DialogsProvider::simpleOpenDialog()
{
}
void DialogsProvider::popupMenu( int i_dialog ) void DialogsProvider::popupMenu( int i_dialog )
{ {
......
...@@ -29,13 +29,21 @@ ...@@ -29,13 +29,21 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/intf.h> #include <vlc/intf.h>
#include "dialogs/interaction.hpp" #include "dialogs/interaction.hpp"
#include <assert.h>
class QEvent; class QEvent;
class QSignalMapper;
class QVLCMenu;
class DialogsProvider : public QObject class DialogsProvider : public QObject
{ {
Q_OBJECT; Q_OBJECT;
public: public:
static DialogsProvider *getInstance()
{
assert( instance );
return instance;
}
static DialogsProvider *getInstance( intf_thread_t *p_intf ) static DialogsProvider *getInstance( intf_thread_t *p_intf )
{ {
if( !instance ) if( !instance )
...@@ -46,6 +54,8 @@ public: ...@@ -46,6 +54,8 @@ public:
QTimer *idle_timer; QTimer *idle_timer;
QTimer *fixed_timer; QTimer *fixed_timer;
protected: protected:
friend class QVLCMenu;
QSignalMapper *menusMapper;
void customEvent( QEvent *); void customEvent( QEvent *);
private: private:
DialogsProvider( intf_thread_t *); DialogsProvider( intf_thread_t *);
...@@ -57,9 +67,13 @@ public slots: ...@@ -57,9 +67,13 @@ public slots:
void streaminfoDialog(); void streaminfoDialog();
void prefsDialog(); void prefsDialog();
void messagesDialog(); void messagesDialog();
void simpleOpenDialog();
void openDialog();
void openDialog( int ); void openDialog( int );
void popupMenu( int ); void popupMenu( int );
void doInteraction( intf_dialog_args_t * ); void doInteraction( intf_dialog_args_t * );
void menuAction( QObject *);
void streamingDialog();
}; };
......
This diff is collapsed.
/*****************************************************************************
* menus.hpp : Menus handling
****************************************************************************
* Copyright (C) 2000-2005 the VideoLAN team
* $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 _MENUS_H_
#define _MENUS_H_
#include "qt4.hpp"
#include <QObject>
#include <vector>
using namespace std;
class QMenu;
class QPoint;
class MenuItemData : public QObject
{
public:
MenuItemData( int i_id, int _i_type, vlc_value_t _val, const char *_var )
{
i_object_id = i_id;
i_val_type = _i_type;
val = _val;
psz_var = strdup( _var );
}
virtual ~MenuItemData()
{
if( psz_var ) free( psz_var );
if( ((i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING)
&& val.psz_string ) free( val.psz_string );
}
int i_object_id;
int i_val_type;
vlc_value_t val;
char *psz_var;
};
class QVLCMenu : public QObject
{
Q_OBJECT;
public:
/* Individual menu builders */
static QMenu *FileMenu();
static void AudioPopupMenu( intf_thread_t *, const QPoint& );
static void VideoPopupMenu( intf_thread_t *, const QPoint& );
static QMenu *NavigMenu( intf_thread_t * , QMenu * );
static QMenu *VideoMenu( intf_thread_t * , QMenu * );
static QMenu *AudioMenu( intf_thread_t * , QMenu * );
/* Generic automenu methods */
static QMenu * Populate( intf_thread_t *, QMenu *current,
vector<const char*>&, vector<int>& );
static void CreateAndConnect( QMenu *, const char *, QString, QString,
int, int, vlc_value_t, int, bool c = false );
static void CreateItem( QMenu *, const char *, vlc_object_t * );
static QMenu *CreateChoicesMenu( const char *, vlc_object_t *, bool );
static void DoAction( intf_thread_t *, QObject * );
};
#endif
...@@ -44,6 +44,7 @@ struct intf_sys_t ...@@ -44,6 +44,7 @@ struct intf_sys_t
}; };
#define THEPL p_intf->p_sys->p_playlist #define THEPL p_intf->p_sys->p_playlist
#define THEDP DialogsProvider::getInstance()
static int DialogEvent_Type = QEvent::User + 1; static int DialogEvent_Type = QEvent::User + 1;
......
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