1 /*****************************************************************************
2 * actions_manager.cpp : Controller for the main interface
3 ****************************************************************************
4 * Copyright © 2009-2014 VideoLAN and VLC authors
6 * Authors: Jean-Baptiste Kempf <jb@videolan.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * ( at your option ) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
27 #include <vlc_common.h>
28 #include <vlc_actions.h>
30 #include "actions_manager.hpp"
32 #include "dialogs_provider.hpp" /* Opening Dialogs */
33 #include "input_manager.hpp" /* THEMIM */
34 #include "main_interface.hpp" /* Show playlist */
35 #include "components/controller.hpp" /* Toggle FSC controller width */
36 #include "components/extended_panels.hpp"
39 ActionsManager::ActionsManager( intf_thread_t
* _p_i
)
44 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
:
91 THEMIM
->toggleRandom(); break;
93 THEDP
->mediaInfoDialog(); break;
95 THEDP
->loadSubtitlesFile(); break;
96 case FULLWIDTH_ACTION
:
97 if( p_intf
->p_sys
->p_mi
)
98 p_intf
->p_sys
->p_mi
->getFullscreenControllerWidget()->toggleFullwidth();
101 msg_Warn( p_intf
, "Action not supported: %i", id_action
);
106 void ActionsManager::play()
108 if( THEPL
->current
.i_size
== 0 && THEPL
->items
.i_size
== 0 )
110 /* The playlist is empty, open a file requester */
111 THEDP
->openFileDialog();
114 THEMIM
->togglePlayPause();
119 * This functions toggle the fullscreen mode
120 * If there is no video, it should first activate Visualisations...
121 * This has also to be fixed in enableVideo()
123 void ActionsManager::fullscreen()
125 bool fs
= var_ToggleBool( THEPL
, "fullscreen" );
126 vout_thread_t
*p_vout
= THEMIM
->getVout();
129 var_SetBool( p_vout
, "fullscreen", fs
);
130 vlc_object_release( p_vout
);
134 void ActionsManager::snapshot()
136 vout_thread_t
*p_vout
= THEMIM
->getVout();
139 var_TriggerCallback( p_vout
, "video-snapshot" );
140 vlc_object_release( p_vout
);
144 void ActionsManager::playlist()
146 if( p_intf
->p_sys
->p_mi
)
147 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 playlist_MuteToggle( THEPL
);
185 void ActionsManager::AudioUp()
187 playlist_VolumeUp( THEPL
, 1, NULL
);
190 void ActionsManager::AudioDown()
192 playlist_VolumeDown( THEPL
, 1, NULL
);
195 void ActionsManager::skipForward()
197 input_thread_t
*p_input
= THEMIM
->getInput();
199 THEMIM
->getIM()->jumpFwd();
202 void ActionsManager::skipBackward()
204 input_thread_t
*p_input
= THEMIM
->getInput();
206 THEMIM
->getIM()->jumpBwd();