Commit 4936cc77 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Add a folder opening option with an icon, due to popular request,

    Clean some code, comment it and cosmetics.
    Fix also a cosmetic button bug spotted by funman.
parent 88b35bff
......@@ -73,11 +73,11 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput,
uriLine = new QLineEdit;
QLabel *uriLabel = new QLabel( qtr( "Location :" ) );
layout->addWidget( IT, 0, 0, 1, 7 );
layout->addWidget( closeButton, 2, 6 );
layout->addWidget( saveMetaButton, 2, 5 );
layout->addWidget( IT, 0, 0, 1, 8 );
layout->addWidget( uriLabel, 1, 0, 1, 1 );
layout->addWidget( uriLine, 1, 1, 1, 6 );
layout->addWidget( uriLine, 1, 1, 1, 7 );
layout->addWidget( saveMetaButton, 2, 6 );
layout->addWidget( closeButton, 2, 7 );
BUTTONACT( closeButton, close() );
......
......@@ -155,7 +155,7 @@ void DialogsProvider::gotoTimeDialog()
void DialogsProvider::vlmDialog()
{
/* FIXME */
/* FIXME - Implement me */
/* VLMDialog::getInstance( p_intf )->toggleVisible(); */
}
......@@ -181,14 +181,19 @@ void DialogsProvider::mediaCodecDialog()
void DialogsProvider::bookmarksDialog()
{
/* FIXME */
/* FIXME - Implement me */
/* BookmarkDialog::getInstance( p_intf )->toggleVisible(); */
}
/****************************************************************************
* All the open/add stuff
* Open Dialog first - Simple Open then
****************************************************************************/
void DialogsProvider::openDialog( int i_tab )
{
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf )->showTab( i_tab );
}
void DialogsProvider::openDialog()
{
openDialog( OPEN_FILE_TAB );
......@@ -209,22 +214,25 @@ void DialogsProvider::openCaptureDialog()
{
openDialog( OPEN_CAPTURE_TAB );
}
void DialogsProvider::openDialog( int i_tab )
{
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf )->showTab( i_tab );
}
/* Same as the open one, but force the enqueue */
void DialogsProvider::PLAppendDialog()
{
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, ENQUEUE )
->showTab(0);
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, ENQUEUE)->showTab(0);
}
/* Unimplemmented yet - Usefull ? */
void DialogsProvider::MLAppendDialog()
{
}
/**** Simple open ****/
QStringList DialogsProvider::showSimpleOpen( QString help, int filters,
/**
* Simple open
* Not used anymore. Let the code until we are sure we don't want it
* Two opens make it confusing for the user.
***/
QStringList DialogsProvider::showSimpleOpen( QString help,
int filters,
QString path )
{
QString fileTypes = "";
......@@ -283,6 +291,42 @@ void DialogsProvider::simpleOpenDialog()
addFromSimple( true, true );
}
/* Directory */
/**
* Open a directory,
* pl helps you to choose from playlist or media library,
* go to start or enqueue
**/
static void openDirectory( intf_thread_t* p_intf, bool pl, bool go )
{
QString dir = QFileDialog::getExistingDirectory ( 0, _("Open directory") );
if (!dir.isEmpty()) {
input_item_t *p_input = input_ItemNewExt( THEPL, qtu(dir), NULL,
0, NULL, -1 );
playlist_AddInput( THEPL, p_input,
go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
PLAYLIST_END, pl, VLC_FALSE );
input_Read( THEPL, p_input, VLC_FALSE );
}
}
void DialogsProvider::openDirDialog()
{
openDirectory( p_intf, true, true );
}
void DialogsProvider::PLAppendDir()
{
openDirectory( p_intf, true, false );
}
void DialogsProvider::MLAppendDir()
{
openDirectory( p_intf, false , false );
}
/****************
* Playlist *
****************/
......@@ -338,37 +382,12 @@ void DialogsProvider::savePlaylist()
delete qfd;
}
static void openDirectory( intf_thread_t* p_intf, bool pl, bool go )
{
QString dir = QFileDialog::getExistingDirectory ( 0,
_("Open directory") );
if (!dir.isEmpty()) {
input_item_t *p_input = input_ItemNewExt( THEPL, qtu(dir), NULL,
0, NULL, -1 );
playlist_AddInput( THEPL, p_input,
go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
PLAYLIST_END, pl, VLC_FALSE );
input_Read( THEPL, p_input, VLC_FALSE );
}
}
void DialogsProvider::PLAppendDir()
{
openDirectory( p_intf, true, false );
}
void DialogsProvider::MLAppendDir()
{
openDirectory( p_intf, false , false );
}
/****************************************************************************
* Sout emulation
****************************************************************************/
//FIXME !!
void DialogsProvider::streamingDialog( QString mrl, bool b_transcode_only )
{
SoutDialog *s = new SoutDialog( p_intf->p_sys->p_mi, p_intf,
......@@ -447,11 +466,9 @@ void DialogsProvider::SDMenuAction( QString data )
playlist_ServicesDiscoveryAdd( THEPL, psz_sd );
else
playlist_ServicesDiscoveryRemove( THEPL, psz_sd );
free( psz_sd );
}
void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
{
InteractionDialog *qdialog;
......@@ -486,7 +503,9 @@ void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
void DialogsProvider::hideMenus()
{
/* TODO */
/* TODO
* Simplify the main Interface
*/
}
void DialogsProvider::switchToSkins()
......
......@@ -125,6 +125,11 @@ private:
void addFromSimple( bool, bool );
public slots:
void doInteraction( intf_dialog_args_t * );
void menuAction( QObject *);
void menuUpdateAction( QObject *);
void SDMenuAction( QString );
void playlistDialog();
void bookmarksDialog();
void mediaInfoDialog();
......@@ -132,35 +137,38 @@ public slots:
void prefsDialog();
void extendedDialog();
void messagesDialog();
void vlmDialog();
void helpDialog();
void aboutDialog();
void gotoTimeDialog();
void simpleOpenDialog();
void simplePLAppendDialog();
void simpleMLAppendDialog();
void simpleOpenDialog();
void openDialog();
void openDialog(int );
void openDialog( int );
void openDiscDialog();
void openFileDialog();
void openNetDialog();
void openCaptureDialog();
void openDiscDialog();
void openDirDialog();
void PLAppendDialog();
void MLAppendDialog();
void doInteraction( intf_dialog_args_t * );
void menuAction( QObject *);
void menuUpdateAction( QObject *);
void SDMenuAction( QString );
void PLAppendDir();
void MLAppendDir();
void streamingDialog( QString mrl = "", bool b_stream = true );
void openThenStreamingDialogs();
void openThenTranscodingDialogs();
void openPlaylist();
void savePlaylist();
void PLAppendDir();
void MLAppendDir();
void quit();
void hideMenus();
void switchToSkins();
void gotoTimeDialog();
void vlmDialog();
void helpDialog();
void aboutDialog();
void quit();
};
#endif
......@@ -152,6 +152,7 @@ static int AudioAutoMenuBuilder( vlc_object_t *p_object,
/*****************************************************************************
* All normal menus
* Simple Code
*****************************************************************************/
#define BAR_ADD( func, title ) { \
......@@ -163,6 +164,9 @@ static int AudioAutoMenuBuilder( vlc_object_t *p_object,
CONNECT( menu, aboutToShow(), THEDP->menusUpdateMapper, map() ); \
THEDP->menusUpdateMapper->setMapping( menu, f ); }
/**
* Main Menu Bar Creation
**/
void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf,
bool playlist, bool adv_controls_enabled,
bool visual_selector_enabled )
......@@ -176,11 +180,11 @@ void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf,
sigemptyset( &set );
sigaddset( &set, SIGCHLD );
pthread_sigmask( SIG_UNBLOCK, &set, NULL );
#endif
#endif /* WIN32 */
QMenuBar *bar = mi->menuBar();
#ifndef WIN32
pthread_sigmask( SIG_BLOCK, &set, NULL );
#endif
#endif /* WIN32 */
BAR_ADD( FileMenu(), qtr("&Media") );
if( playlist )
{
......@@ -194,11 +198,26 @@ void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf,
BAR_ADD( HelpMenu(), qtr("&Help" ) );
}
/**
* Media (File) Menu
* Opening, streaming and quit
**/
QMenu *QVLCMenu::FileMenu()
{
QMenu *menu = new QMenu();
DP_SADD( menu, qtr("Open &File..." ), "",
":/pixmaps/vlc_file-asym_16px.png", openFileDialog(), "Ctrl+O" );
/* Folder vs. Directory */
#ifdef WIN32
DP_SADD( menu, qtr( "Open Folder..." ), "",
":/pixmaps/vlc_folder-grey_16px.png", openDirDialog(), "Ctrl+F" );
#else
DP_SADD( menu, qtr( "Open Directory..." ), "",
":/pixmaps/vlc_folder-grey_16px.png", openDirDialog(), "Ctrl+F" );
#endif /* WIN32 */
DP_SADD( menu, qtr("Open &Disc..." ), "", "", openDiscDialog(), "Ctrl+D" );
DP_SADD( menu, qtr("Open &Network..." ), "",
":/pixmaps/vlc_network_16px.png", openNetDialog(), "Ctrl+N" );
......@@ -216,6 +235,7 @@ QMenu *QVLCMenu::FileMenu()
return menu;
}
/* Playlist Menu, undocked when playlist is undocked */
QMenu *QVLCMenu::PlaylistMenu( MainInterface *mi, intf_thread_t *p_intf )
{
QMenu *menu = new QMenu();
......@@ -230,6 +250,11 @@ QMenu *QVLCMenu::PlaylistMenu( MainInterface *mi, intf_thread_t *p_intf )
return menu;
}
/**
* Tools/View Menu
* This is kept in the same menu for now, but could change if it gets much
* longer.
**/
QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
bool adv_controls_enabled,
bool visual_selector_enabled, bool with_intf )
......@@ -248,8 +273,10 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
DP_SADD( menu, qtr( I_MENU_CODECINFO ) , "", ":/pixmaps/vlc_info_16px.png",
mediaCodecDialog(), "Ctrl+I" );
DP_SADD( menu, qtr( I_MENU_GOTOTIME ), "","", gotoTimeDialog(), "Ctrl+T" );
#if 0 /* Not Implemented yet */
DP_SADD( menu, qtr( I_MENU_BOOKMARK ), "","", bookmarksDialog(), "Ctrl+B" );
DP_SADD( menu, qtr( I_MENU_VLM ), "","", vlmDialog(), "Ctrl+V" );
#endif
menu->addSeparator();
if( mi )
......@@ -258,7 +285,7 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
mi, SLOT( advanced() ) );
adv->setCheckable( true );
if( adv_controls_enabled ) adv->setChecked( true );
#if 0
#if 0 /* For Visualisations. Not yet working */
adv = menu->addAction( qtr("Visualizations selector" ),
mi, SLOT( visual() ) );
adv->setCheckable( true );
......@@ -268,12 +295,16 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi,
}
DP_SADD( menu, qtr( I_MENU_EXT ), "","",extendedDialog(), "Ctrl+E" );
DP_SADD( menu, qtr( "Hide Menus..." ), "","",hideMenus(), "Ctrl+H" );
menu->addSeparator();
DP_SADD( menu, qtr("Preferences"), "", ":/pixmaps/vlc_preferences_16px.png",
prefsDialog(), "Ctrl+P" );
return menu;
}
/**
* Interface Sub-Menu, to list extras interface and skins
**/
QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
{
vector<int> objects;
......@@ -296,6 +327,9 @@ QMenu *QVLCMenu::InterfacesMenu( intf_thread_t *p_intf, QMenu *current )
return menu;
}
/**
* Main Audio Menu
*/
QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
{
vector<int> objects;
......@@ -319,7 +353,10 @@ QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
return Populate( p_intf, current, varnames, objects );
}
/**
* Main Video Menu
* Subtitles are part of Video.
**/
QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
{
vlc_object_t *p_object;
......@@ -345,6 +382,10 @@ QMenu *QVLCMenu::VideoMenu( intf_thread_t *p_intf, QMenu *current )
return Populate( p_intf, current, varnames, objects );
}
/**
* Navigation Menu
* For DVD, MP4, MOV and other chapter based format
**/
QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *current )
{
vlc_object_t *p_object;
......@@ -364,6 +405,9 @@ QMenu *QVLCMenu::NavigMenu( intf_thread_t *p_intf, QMenu *current )
return Populate( p_intf, current, varnames, objects );
}
/**
* Service Discovery Menu
**/
QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
{
QMenu *menu = new QMenu();
......@@ -389,7 +433,8 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
while( p_parser->pp_shortcuts[++i] != NULL );
i--;
if( playlist_IsServicesDiscoveryLoaded( THEPL,
i>=0?p_parser->pp_shortcuts[i] : p_parser->psz_object_name ) )
i>=0?p_parser->pp_shortcuts[i]
: p_parser->psz_object_name ) )
{
a->setChecked( true );
}
......@@ -402,11 +447,14 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
vlc_list_release( p_list );
return menu;
}
/**
* Help/About Menu
**/
QMenu *QVLCMenu::HelpMenu()
{
QMenu *menu = new QMenu();
DP_SADD( menu, qtr("Help") , "", ":/pixmaps/vlc_help_16px.png", helpDialog(), "F1" );
DP_SADD( menu, qtr("Help") , "", ":/pixmaps/vlc_help_16px.png",
helpDialog(), "F1" );
menu->addSeparator();
DP_SADD( menu, qtr( I_MENU_ABOUT ), "", "", aboutDialog(), "Ctrl+F1");
return menu;
......@@ -414,7 +462,7 @@ QMenu *QVLCMenu::HelpMenu()
/*****************************************************************************
* Popup menus *
* Popup menus - Right Click menus *
*****************************************************************************/
#define POPUP_BOILERPLATE \
unsigned int i_last_separator = 0; \
......@@ -478,6 +526,7 @@ QMenu *QVLCMenu::HelpMenu()
\
DP_SADD( menu, qtr("Quit"), "", "", quit() , "Ctrl+Q" );
/* Video Tracks and Subtitles tracks */
void QVLCMenu::VideoPopupMenu( intf_thread_t *p_intf )
{
POPUP_BOILERPLATE;
......@@ -500,6 +549,7 @@ void QVLCMenu::VideoPopupMenu( intf_thread_t *p_intf )
CREATE_POPUP;
}
/* Audio Tracks */
void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf )
{
POPUP_BOILERPLATE;
......@@ -520,7 +570,7 @@ void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf )
CREATE_POPUP;
}
/* Navigation stuff, and general */
/* Navigation stuff, and general menus (open) */
void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
{
POPUP_BOILERPLATE;
......@@ -542,6 +592,7 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
p_intf->p_sys->p_popup_menu = NULL;
}
/* Main Menu that sticks everything together */
void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
{
if( show )
......@@ -602,12 +653,17 @@ void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
* Systray Menu *
************************************************************************/
void QVLCMenu::updateSystrayMenu( MainInterface *mi, intf_thread_t *p_intf,
bool b_force_visible )
void QVLCMenu::updateSystrayMenu( MainInterface *mi,
intf_thread_t *p_intf,
bool b_force_visible )
{
POPUP_BOILERPLATE;
/* Get the systray menu and clean it */
QMenu *sysMenu = mi->getSysTrayMenu();
sysMenu->clear();
/* Hide / Show VLC and cone */
if( mi->isVisible() || b_force_visible )
{
sysMenu->addAction( QIcon( ":/vlc16.png" ),
......@@ -620,14 +676,17 @@ void QVLCMenu::updateSystrayMenu( MainInterface *mi, intf_thread_t *p_intf,
qtr("Show VLC media player"), mi,
SLOT( toggleUpdateSystrayMenu() ) );
}
sysMenu->addSeparator();
POPUP_PLAY_ENTRIES( sysMenu );
sysMenu->addSeparator();
DP_SADD( sysMenu, qtr("&Open Media" ), "",
":/pixmaps/vlc_file-wide_16px.png", openFileDialog(), "" );
DP_SADD( sysMenu, qtr("&Quit") , "", ":/pixmaps/vlc_quit_16px.png",
quit(), "" );
/* Set the menu */
mi->getSysTray()->setContextMenu( sysMenu );
}
......
......@@ -31,6 +31,7 @@
<file>pixmaps/vlc_quit_16px.png</file>
<file>pixmaps/vlc_file-asym_16px.png</file>
<file>pixmaps/vlc_file-wide_16px.png</file>
<file>pixmaps/vlc_folder-grey_16px.png</file>
<file>pixmaps/vlc_capture-card_16px.png</file>
<file>pixmaps/vlc_preferences_16px.png</file>
<file>pixmaps/vlc_stream_16px.png</file>
......
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