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 *****************************************************************************/
33 #include "actions_manager.hpp"
34 #include "dialogs_provider.hpp" /* Opening Dialogs */
35 #include "input_manager.hpp"
36 #include "main_interface.hpp" /* Show playlist */
38 ActionsManager * ActionsManager::instance = NULL;
40 ActionsManager::ActionsManager( intf_thread_t * _p_i, QObject *_parent )
46 ActionsManager::~ActionsManager(){}
48 void ActionsManager::doAction( int id_action )
55 THEMIM->stop(); break;
57 THEDP->openDialog(); break;
59 THEMIM->prev(); break;
61 THEMIM->next(); break;
63 THEMIM->getIM()->slower(); break;
65 THEMIM->getIM()->faster(); break;
66 case FULLSCREEN_ACTION:
69 THEDP->extendedDialog(); break;
79 THEMIM->getIM()->setAtoB(); break;
81 THEMIM->getIM()->reverse(); break;
82 case SKIP_BACK_ACTION:
83 var_SetInteger( p_intf->p_libvlc, "key-action",
84 ACTIONID_JUMP_BACKWARD_SHORT );
87 var_SetInteger( p_intf->p_libvlc, "key-action",
88 ACTIONID_JUMP_FORWARD_SHORT );
93 THEMIM->toggleRandom(); break;
95 msg_Dbg( p_intf, "Action: %i", id_action );
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();
113 * This functions toggle the fullscreen mode
114 * If there is no video, it should first activate Visualisations...
115 * This has also to be fixed in enableVideo()
117 void ActionsManager::fullscreen()
119 vout_thread_t *p_vout = THEMIM->getVout();
122 var_ToggleBool( p_vout, "fullscreen" );
123 vlc_object_release( p_vout );
127 void ActionsManager::snapshot()
129 vout_thread_t *p_vout = THEMIM->getVout();
132 var_TriggerCallback( p_vout, "video-snapshot" );
133 vlc_object_release( p_vout );
137 void ActionsManager::playlist()
139 if( p_intf->p_sys->p_mi ) p_intf->p_sys->p_mi->togglePlaylist();
142 void ActionsManager::record()
144 input_thread_t *p_input = THEMIM->getInput();
147 /* This method won't work fine if the stream can't be cut anywhere */
148 var_ToggleBool( p_input, "record" );
152 /* 'record' access-filter is not loaded, we open Save dialog */
153 input_item_t *p_item = input_GetItem( p_input );
157 char *psz = input_item_GetURI( p_item );
159 THEDP->streamingDialog( NULL, psz, true );
165 void ActionsManager::frame()
167 input_thread_t *p_input = THEMIM->getInput();
169 var_TriggerCallback( p_input, "frame-next" );
172 void ActionsManager::toggleMuteAudio()
174 aout_ToggleMute( THEPL, NULL );
177 void ActionsManager::AudioUp()
179 aout_VolumeUp( THEPL, 1, NULL );
182 void ActionsManager::AudioDown()
184 aout_VolumeDown( THEPL, 1, NULL );