1 /*****************************************************************************
2 * Controller.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 *****************************************************************************/
32 #include "actions_manager.hpp"
33 #include "dialogs_provider.hpp" /* Opening Dialogs */
34 #include "input_manager.hpp"
35 #include "main_interface.hpp" /* Show playlist */
37 ActionsManager * ActionsManager::instance = NULL;
39 ActionsManager::ActionsManager( intf_thread_t * _p_i, QObject *_parent )
45 ActionsManager::~ActionsManager()
49 void ActionsManager::doAction( int id_action )
65 case FULLSCREEN_ACTION:
76 THEMIM->getIM()->setAtoB(); break;
81 case SKIP_BACK_ACTION:
82 var_SetInteger( p_intf->p_libvlc, "key-pressed",
83 ACTIONID_JUMP_BACKWARD_SHORT );
86 var_SetInteger( p_intf->p_libvlc, "key-pressed",
87 ACTIONID_JUMP_FORWARD_SHORT );
90 msg_Dbg( p_intf, "Action: %i", id_action );
95 void ActionsManager::stop()
100 void ActionsManager::play()
102 if( THEPL->current.i_size == 0 )
104 /* The playlist is empty, open a file requester */
105 THEDP->openFileDialog();
108 THEMIM->togglePlayPause();
111 void ActionsManager::prev()
116 void ActionsManager::next()
123 * This functions toggle the fullscreen mode
124 * If there is no video, it should first activate Visualisations...
125 * This has also to be fixed in enableVideo()
127 void ActionsManager::fullscreen()
129 vout_thread_t *p_vout =
130 (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
133 var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) );
134 vlc_object_release( p_vout );
138 void ActionsManager::snapshot()
140 vout_thread_t *p_vout =
141 (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
144 vout_Control( p_vout, VOUT_SNAPSHOT );
145 vlc_object_release( p_vout );
149 void ActionsManager::extSettings()
151 THEDP->extendedDialog();
154 void ActionsManager::reverse()
156 THEMIM->getIM()->reverse();
159 void ActionsManager::slower()
161 THEMIM->getIM()->slower();
164 void ActionsManager::faster()
166 THEMIM->getIM()->faster();
169 void ActionsManager::playlist()
171 if( p_intf->p_sys->p_mi ) p_intf->p_sys->p_mi->togglePlaylist();
174 void ActionsManager::record()
176 input_thread_t *p_input = THEMIM->getInput();
179 /* This method won't work fine if the stream can't be cut anywhere */
180 const bool b_recording = var_GetBool( p_input, "record" );
181 var_SetBool( p_input, "record", !b_recording );
185 /* 'record' access-filter is not loaded, we open Save dialog */
186 input_item_t *p_item = input_GetItem( p_input );
190 char *psz = input_item_GetURI( p_item );
192 THEDP->streamingDialog( NULL, psz, true );
198 void ActionsManager::frame()
200 input_thread_t *p_input = THEMIM->getInput();
202 var_SetVoid( p_input, "frame-next" );