1 /*****************************************************************************
2 * actions_manager.cpp : Controller for the main interface
3 ****************************************************************************
4 * Copyright (C) 2006-2008 the VideoLAN team
7 * Authors: Jean-Baptiste Kempf <jb@videolan.org>
8 * Ilkka Ollakka <ileoo@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * ( at your option ) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
30 #include <vlc_aout_intf.h>
33 #include "actions_manager.hpp"
34 #include "dialogs_provider.hpp" /* Opening Dialogs */
35 #include "input_manager.hpp"
36 #include "main_interface.hpp" /* Show playlist */
37 #include "components/controller.hpp" /* Toggle FSC controller width */
39 ActionsManager * ActionsManager::instance = NULL;
41 ActionsManager::ActionsManager( intf_thread_t * _p_i, QObject *_parent )
47 ActionsManager::~ActionsManager(){}
49 void ActionsManager::doAction( int id_action )
56 THEMIM->stop(); break;
58 THEDP->openDialog(); break;
60 THEMIM->prev(); break;
62 THEMIM->next(); break;
64 THEMIM->getIM()->slower(); break;
66 THEMIM->getIM()->faster(); break;
67 case FULLSCREEN_ACTION:
70 THEDP->extendedDialog(); break;
80 THEMIM->getIM()->setAtoB(); break;
82 THEMIM->getIM()->reverse(); break;
83 case SKIP_BACK_ACTION:
92 THEMIM->toggleRandom(); break;
94 THEDP->mediaInfoDialog(); break;
96 THEDP->loadSubtitlesFile(); break;
97 case FULLWIDTH_ACTION:
98 if( p_intf->p_sys->p_mi )
99 p_intf->p_sys->p_mi->getFullscreenControllerWidget()->toggleFullwidth();
102 msg_Dbg( p_intf, "Action: %i", id_action );
107 void ActionsManager::play()
109 if( THEPL->current.i_size == 0 )
111 /* The playlist is empty, open a file requester */
112 THEDP->openFileDialog();
115 THEMIM->togglePlayPause();
120 * This functions toggle the fullscreen mode
121 * If there is no video, it should first activate Visualisations...
122 * This has also to be fixed in enableVideo()
124 void ActionsManager::fullscreen()
126 bool fs = var_ToggleBool( THEPL, "fullscreen" );
127 vout_thread_t *p_vout = THEMIM->getVout();
130 var_SetBool( p_vout, "fullscreen", fs );
131 vlc_object_release( p_vout );
135 void ActionsManager::snapshot()
137 vout_thread_t *p_vout = THEMIM->getVout();
140 var_TriggerCallback( p_vout, "video-snapshot" );
141 vlc_object_release( p_vout );
145 void ActionsManager::playlist()
147 if( p_intf->p_sys->p_mi ) p_intf->p_sys->p_mi->togglePlaylist();
150 void ActionsManager::record()
152 input_thread_t *p_input = THEMIM->getInput();
155 /* This method won't work fine if the stream can't be cut anywhere */
156 var_ToggleBool( p_input, "record" );
160 /* 'record' access-filter is not loaded, we open Save dialog */
161 input_item_t *p_item = input_GetItem( p_input );
165 char *psz = input_item_GetURI( p_item );
167 THEDP->streamingDialog( NULL, qfu(psz), true );
173 void ActionsManager::frame()
175 input_thread_t *p_input = THEMIM->getInput();
177 var_TriggerCallback( p_input, "frame-next" );
180 void ActionsManager::toggleMuteAudio()
182 aout_ToggleMute( THEPL, NULL );
185 void ActionsManager::AudioUp()
187 aout_VolumeUp( THEPL, 1, NULL );
190 void ActionsManager::AudioDown()
192 aout_VolumeDown( THEPL, 1, NULL );
195 void ActionsManager::skipForward()
197 THEMIM->getIM()->jumpFwd();
200 void ActionsManager::skipBackward()
202 THEMIM->getIM()->jumpBwd();