/*****************************************************************************
* menus.cpp : Qt menus
*****************************************************************************
- * Copyright (C) 2006 the VideoLAN team
+ * Copyright (C) 2006-2007 the VideoLAN team
* $Id$
*
- * Authors: ClÃment Stenac <zorglub@videolan.org>
+ * 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
#include <QActionGroup>
#include <QSignalMapper>
-#include "main_interface.hpp"
+#ifndef WIN32
+# include <signal.h>
+#endif
+#include <vlc_intf_strings.h>
+
+#include "main_interface.hpp"
#include "menus.hpp"
#include "dialogs_provider.hpp"
#include "input_manager.hpp"
static QActionGroup *currentGroup;
// Add static entries to menus
-#define DP_SADD( text, help, icon, slot ) { if( strlen(icon) > 0 ) { QAction *action = menu->addAction( text, THEDP, SLOT( slot ) ); action->setIcon(QIcon(icon));} else { menu->addAction( text, THEDP, SLOT( slot ) ); } }
-#define MIM_SADD( text, help, icon, slot ) { if( strlen(icon) > 0 ) { QAction *action = menu->addAction( text, THEMIM, SLOT( slot ) ); action->setIcon(QIcon(icon));} else { menu->addAction( text, THEMIM, SLOT( slot ) ); } }
+#define DP_SADD( text, help, icon, slot, shortcut ) \
+ { \
+ if( strlen(icon) > 0 ) \
+ { \
+ if( strlen(shortcut) > 0 ) \
+ { \
+ menu->addAction( QIcon(icon), text, THEDP, SLOT( slot ), \
+ tr(shortcut) );\
+ } \
+ else \
+ { \
+ menu->addAction( QIcon(icon), text, THEDP, SLOT( slot ) );\
+ } \
+ } \
+ else \
+ { \
+ if( strlen(shortcut) > 0 ) \
+ { \
+ menu->addAction( text, THEDP, SLOT( slot ), \
+ qtr(shortcut) ); \
+ } \
+ else \
+ { \
+ menu->addAction( text, THEDP, SLOT( slot ) ); \
+ } \
+ } \
+ }
+#define MIM_SADD( text, help, icon, slot ) \
+ { \
+ if( strlen(icon) > 0 ) \
+ { \
+ QAction *action = menu->addAction( text, THEMIM, SLOT( slot ) ); \
+ action->setIcon(QIcon(icon)); \
+ } \
+ else \
+ { \
+ menu->addAction( text, THEMIM, SLOT( slot ) ); \
+ } \
+ }
#define PL_SADD
/*****************************************************************************
bool playlist, bool adv_controls_enabled,
bool visual_selector_enabled )
{
+#ifndef WIN32
+ /* Ugly klugde
+ * Remove SIGCHLD from the ignored signal the time to initialise
+ * Qt because it call gconf to get the icon theme */
+ sigset_t set;
+
+ sigemptyset( &set );
+ sigaddset( &set, SIGCHLD );
+ pthread_sigmask (SIG_UNBLOCK, &set, NULL);
+#endif
QMenuBar *bar = mi->menuBar();
+#ifndef WIN32
+ pthread_sigmask (SIG_BLOCK, &set, NULL);
+#endif
BAR_ADD( FileMenu(), qtr("Media") );
if( playlist )
{
BAR_DADD( AudioMenu( p_intf, NULL ), qtr("Audio"), 2 );
BAR_DADD( NavigMenu( p_intf, NULL ), qtr("Navigation"), 3 );
- // BAR_ADD( HelpMenu(), qtr("Help" ) );
+ BAR_ADD( HelpMenu(), qtr("Help" ) );
}
QMenu *QVLCMenu::FileMenu()
{
QMenu *menu = new QMenu();
- DP_SADD( qtr("Quick &Open File...") , "", "", simpleOpenDialog() );
- DP_SADD( qtr("&Advanced Open..." ), "", "", openDialog() );
+/* DP_SADD( qtr("Quick &Open File...") , "", "", simpleOpenDialog() );*/
+ DP_SADD( qtr("Open &File..." ), "", "", openFileDialog(), "Ctrl+O" );
+ DP_SADD( qtr("Open &Disc..." ), "", "", openDiscDialog(), "Ctrl+D" );
+ DP_SADD( qtr("Open &Network..." ), "", "", openNetDialog(), "Ctrl+N" );
+ DP_SADD( qtr("Open &Capture Device..." ), "", "", openCaptureDialog(),
+ "Ctrl+A" );
menu->addSeparator();
- DP_SADD( qtr("Streaming..."), "", "", streamingDialog() );
+ DP_SADD( qtr("&Streaming..."), "", "", streamingDialog(), "Ctrl+S" );
menu->addSeparator();
- DP_SADD( qtr("&Quit") , "", "", quit() );
+ DP_SADD( qtr("&Quit") , "", "", quit(), "Ctrl+Q");
return menu;
}
menu->addMenu( SDMenu( p_intf ) );
menu->addSeparator();
- DP_SADD( qtr( "Open playlist file"), "", "", openPlaylist() );
-// DP_SADD( qtr( "Save playlist to file" ), "", "", savePlaylist() );
+ DP_SADD( qtr(I_PL_LOAD), "", "", openPlaylist(), "Ctrl+L" );
+ DP_SADD( qtr(I_PL_SAVE), "", "", savePlaylist(), "Ctrl+P" );
menu->addSeparator();
menu->addAction( qtr("Undock from interface"), mi,
- SLOT( undockPlaylist() ) );
+ SLOT( undockPlaylist() ), qtr("Ctrl+U") );
return menu;
}
menu->addMenu( intfmenu );
menu->addSeparator();
}
- DP_SADD( qtr("Messages" ), "", "", messagesDialog() );
- DP_SADD( qtr("Information") , "", "", streaminfoDialog() );
- DP_SADD( qtr("Bookmarks"), "", "", bookmarksDialog() );
- DP_SADD( qtr("Extended settings"), "","",extendedDialog() );
+ DP_SADD( qtr(I_MENU_MSG), "", "", messagesDialog(), "Ctrl+M" );
+ DP_SADD( qtr(I_MENU_INFO) , "", "", mediaInfoDialog(), "Ctrl+J" );
+ DP_SADD( qtr(I_MENU_CODECINFO) , "", "", mediaCodecDialog(), "Ctrl+I" );
+ DP_SADD( qtr(I_MENU_EXT), "","",extendedDialog(), "Ctrl+G" );
if( mi )
{
menu->addSeparator();
if( visual_selector_enabled ) adv->setChecked( true );
#endif
}
+ DP_SADD( qtr(I_MENU_GOTOTIME), "","",gotoTimeDialog(), "Ctrl+T" );
menu->addSeparator();
- DP_SADD( qtr("Preferences"), "", "", prefsDialog() );
+ DP_SADD( qtr("Preferences"), "", "", prefsDialog(), "Ctrl+P" );
return menu;
}
QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
{
QMenu *menu = new QMenu();
- menu->setTitle( qtr( "Additional sources" ) );
+ menu->setTitle( qtr(I_PL_SD) );
vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
FIND_ANYWHERE );
int i_num = 0;
return menu;
}
+QMenu *QVLCMenu::HelpMenu()
+{
+ QMenu *menu = new QMenu();
+ DP_SADD( qtr("Help") , "", "", helpDialog(), "F1" );
+ menu->addSeparator();
+ DP_SADD( qtr(I_MENU_ABOUT), "", "", aboutDialog(), "Ctrl+Shift+F1");
+ return menu;
+}
+
+
/*****************************************************************************
* Popup menus
*****************************************************************************/