1 /*****************************************************************************
2  * actions_manager.hpp : Controller for the main interface
3  ****************************************************************************
4  * Copyright (C) 2006-2008 the VideoLAN team
5  * $Id: 5592429aaf470fafcd961618375baebff7db872a $
6  *
7  * Authors: Jean-Baptiste Kempf <jb@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23 
24 #ifndef QVLC_ACTIONS_MANAGER_H_
25 #define QVLC_ACTIONS_MANAGER_H_ 1
26 
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30 
31 #include "qt.hpp"
32 #include "util/singleton.hpp"
33 #include <QVector>
34 
35 #include <QObject>
36 #include <QTimer>
37 class QAction;
38 
39 typedef enum actionType_e
40 {
41     PLAY_ACTION,
42     STOP_ACTION,
43     OPEN_ACTION,
44     PREVIOUS_ACTION,
45     NEXT_ACTION,
46     SLOWER_ACTION,
47     FASTER_ACTION,
48     FULLSCREEN_ACTION,
49     FULLWIDTH_ACTION,
50     EXTENDED_ACTION,
51     PLAYLIST_ACTION,
52     SNAPSHOT_ACTION,
53     RECORD_ACTION,
54     FRAME_ACTION,
55     ATOB_ACTION,
56     REVERSE_ACTION,
57     SKIP_BACK_ACTION,
58     SKIP_FW_ACTION,
59     QUIT_ACTION,
60     RANDOM_ACTION,
61     LOOP_ACTION,
62     INFO_ACTION,
63     OPEN_SUB_ACTION,
64 } actionType_e;
65 
66 class ActionsManager : public QObject, public Singleton<ActionsManager>
67 {
68 
69     Q_OBJECT
70     friend class Singleton<ActionsManager>;
71 
72 public:
73 
74 private:
75     ActionsManager( intf_thread_t  *_p_i );
76     virtual ~ActionsManager();
77 
78     intf_thread_t* const p_intf;
79     QVector<vlc_renderer_discovery_t*> m_rds;
80     QTimer m_stop_scan_timer;
81     bool m_scanning;
82 
83     static void renderer_event_item_added( vlc_renderer_discovery_t *,
84                                            vlc_renderer_item_t * );
85     static void renderer_event_item_removed( vlc_renderer_discovery_t *,
86                                              vlc_renderer_item_t * );
87     static vlc_renderer_item_t* compareRenderers( const QVariant &m_obj,
88                                                   vlc_renderer_item_t* p_item );
89 
90 public slots:
91     void toggleMuteAudio();
92     void AudioUp();
93     void AudioDown();
94     void play();
95     void record();
96     void skipForward();
97     void skipBackward();
98     void StartRendererScan();
99     void RendererMenuCountdown();
100     void StopRendererScan();
101     void RendererSelected( QAction * );
102 
103 protected slots:
104     void onRendererItemAdded( vlc_renderer_item_t* );
105     void onRendererItemRemoved( vlc_renderer_item_t* );
106     void fullscreen();
107     void snapshot();
108     void playlist();
109     void frame();
110 
111     virtual void doAction( int );
112 
113 signals:
114     void rendererItemAdded( vlc_renderer_item_t* );
115     void rendererItemRemoved( vlc_renderer_item_t* );
116 };
117 
118 #endif
119 
120