/*****************************************************************************
- * Controller.cpp : Controller for the main interface
+ * actions_manager.cpp : Controller for the main interface
****************************************************************************
- * Copyright (C) 2006-2008 the VideoLAN team
+ * Copyright © 2009-2014 VideoLAN and VLC authors
* $Id$
*
* Authors: Jean-Baptiste Kempf <jb@videolan.org>
- * Ilkka Ollakka <ileoo@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <vlc_keys.h>
#include "actions_manager.hpp"
-#include "dialogs_provider.hpp" /* Opening Dialogs */
-#include "input_manager.hpp"
-#include "main_interface.hpp" /* Show playlist */
-ActionsManager * ActionsManager::instance = NULL;
+#include "dialogs_provider.hpp" /* Opening Dialogs */
+#include "input_manager.hpp" /* THEMIM */
+#include "main_interface.hpp" /* Show playlist */
+#include "components/controller.hpp" /* Toggle FSC controller width */
+#include "components/extended_panels.hpp"
-ActionsManager::ActionsManager( intf_thread_t * _p_i, QObject *_parent )
- : QObject( _parent )
+ActionsManager::ActionsManager( intf_thread_t * _p_i )
{
p_intf = _p_i;
}
-ActionsManager::~ActionsManager(){}
-
void ActionsManager::doAction( int id_action )
{
switch( id_action )
case STOP_ACTION:
THEMIM->stop(); break;
case OPEN_ACTION:
- break;
+ THEDP->openDialog(); break;
case PREVIOUS_ACTION:
THEMIM->prev(); break;
case NEXT_ACTION:
case REVERSE_ACTION:
THEMIM->getIM()->reverse(); break;
case SKIP_BACK_ACTION:
- var_SetInteger( p_intf->p_libvlc, "key-pressed",
- ACTIONID_JUMP_BACKWARD_SHORT );
+ skipBackward();
break;
case SKIP_FW_ACTION:
- var_SetInteger( p_intf->p_libvlc, "key-pressed",
- ACTIONID_JUMP_FORWARD_SHORT );
+ skipForward();
+ break;
+ case QUIT_ACTION:
+ THEDP->quit(); break;
+ case RANDOM_ACTION:
+ THEMIM->toggleRandom(); break;
+ case INFO_ACTION:
+ THEDP->mediaInfoDialog(); break;
+ case OPEN_SUB_ACTION:
+ THEDP->loadSubtitlesFile(); break;
+ case FULLWIDTH_ACTION:
+ if( p_intf->p_sys->p_mi )
+ p_intf->p_sys->p_mi->getFullscreenControllerWidget()->toggleFullwidth();
break;
default:
- msg_Dbg( p_intf, "Action: %i", id_action );
+ msg_Warn( p_intf, "Action not supported: %i", id_action );
break;
}
}
void ActionsManager::play()
{
- if( THEPL->current.i_size == 0 )
+ if( THEPL->current.i_size == 0 && THEPL->items.i_size == 0 )
{
/* The playlist is empty, open a file requester */
THEDP->openFileDialog();
}
/**
- * TODO
+ * TODO
* This functions toggle the fullscreen mode
* If there is no video, it should first activate Visualisations...
- * This has also to be fixed in enableVideo()
+ * This has also to be fixed in enableVideo()
*/
void ActionsManager::fullscreen()
{
+ bool fs = var_ToggleBool( THEPL, "fullscreen" );
vout_thread_t *p_vout = THEMIM->getVout();
if( p_vout)
{
- var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) );
+ var_SetBool( p_vout, "fullscreen", fs );
vlc_object_release( p_vout );
}
}
vout_thread_t *p_vout = THEMIM->getVout();
if( p_vout )
{
- vout_Control( p_vout, VOUT_SNAPSHOT );
+ var_TriggerCallback( p_vout, "video-snapshot" );
vlc_object_release( p_vout );
}
}
void ActionsManager::playlist()
{
- if( p_intf->p_sys->p_mi ) p_intf->p_sys->p_mi->togglePlaylist();
+ if( p_intf->p_sys->p_mi )
+ p_intf->p_sys->p_mi->togglePlaylist();
}
void ActionsManager::record()
if( p_input )
{
/* This method won't work fine if the stream can't be cut anywhere */
- const bool b_recording = var_GetBool( p_input, "record" );
- var_SetBool( p_input, "record", !b_recording );
+ var_ToggleBool( p_input, "record" );
#if 0
else
{
char *psz = input_item_GetURI( p_item );
if( psz )
- THEDP->streamingDialog( NULL, psz, true );
+ THEDP->streamingDialog( NULL, qfu(psz), true );
}
#endif
}
{
input_thread_t *p_input = THEMIM->getInput();
if( p_input )
- var_SetVoid( p_input, "frame-next" );
+ var_TriggerCallback( p_input, "frame-next" );
+}
+
+void ActionsManager::toggleMuteAudio()
+{
+ playlist_MuteToggle( THEPL );
+}
+
+void ActionsManager::AudioUp()
+{
+ playlist_VolumeUp( THEPL, 1, NULL );
+}
+
+void ActionsManager::AudioDown()
+{
+ playlist_VolumeDown( THEPL, 1, NULL );
+}
+
+void ActionsManager::skipForward()
+{
+ input_thread_t *p_input = THEMIM->getInput();
+ if( p_input )
+ THEMIM->getIM()->jumpFwd();
+}
+
+void ActionsManager::skipBackward()
+{
+ input_thread_t *p_input = THEMIM->getInput();
+ if( p_input )
+ THEMIM->getIM()->jumpBwd();
}
+void ActionsManager::PPaction( QAction *a )
+{
+ int i_q = -1;
+ if( a != NULL )
+ i_q = a->data().toInt();
+ ExtVideo::setPostprocessing( p_intf, i_q );
+}