| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
#ifndef _MENUS_H_ |
|---|
| 26 |
#define _MENUS_H_ |
|---|
| 27 |
|
|---|
| 28 |
#include "qt4.hpp" |
|---|
| 29 |
|
|---|
| 30 |
#include <QObject> |
|---|
| 31 |
#include <QAction> |
|---|
| 32 |
#include <vector> |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
#if defined( WIN32 ) || defined(__APPLE__) |
|---|
| 36 |
#define I_OPEN_FOLDER N_("Open &Folder...") |
|---|
| 37 |
#else |
|---|
| 38 |
#define I_OPEN_FOLDER N_("Open D&irectory...") |
|---|
| 39 |
#endif //WIN32 |
|---|
| 40 |
|
|---|
| 41 |
using namespace std; |
|---|
| 42 |
|
|---|
| 43 |
class QMenu; |
|---|
| 44 |
class QMenuBar; |
|---|
| 45 |
class QSystemTrayIcon; |
|---|
| 46 |
|
|---|
| 47 |
class MenuItemData : public QObject |
|---|
| 48 |
{ |
|---|
| 49 |
|
|---|
| 50 |
Q_OBJECT |
|---|
| 51 |
|
|---|
| 52 |
public: |
|---|
| 53 |
MenuItemData( QObject* parent, vlc_object_t *p, int _i_type, vlc_value_t _val, const char *_var ) : QObject( parent ) |
|---|
| 54 |
{ |
|---|
| 55 |
p_obj = p; |
|---|
| 56 |
i_val_type = _i_type; |
|---|
| 57 |
val = _val; |
|---|
| 58 |
psz_var = strdup( _var ); |
|---|
| 59 |
} |
|---|
| 60 |
virtual ~MenuItemData() |
|---|
| 61 |
{ |
|---|
| 62 |
free( psz_var ); |
|---|
| 63 |
if( ( i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) |
|---|
| 64 |
free( val.psz_string ); |
|---|
| 65 |
} |
|---|
| 66 |
vlc_object_t *p_obj; |
|---|
| 67 |
int i_val_type; |
|---|
| 68 |
vlc_value_t val; |
|---|
| 69 |
char *psz_var; |
|---|
| 70 |
}; |
|---|
| 71 |
|
|---|
| 72 |
class QVLCMenu : public QObject |
|---|
| 73 |
{ |
|---|
| 74 |
Q_OBJECT; |
|---|
| 75 |
public: |
|---|
| 76 |
static void createMenuBar( MainInterface *mi, intf_thread_t *, bool ); |
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
static QMenu *FileMenu(); |
|---|
| 80 |
static QMenu *SDMenu( intf_thread_t * ); |
|---|
| 81 |
static QMenu *PlaylistMenu( intf_thread_t *, MainInterface * ); |
|---|
| 82 |
static QMenu *ToolsMenu( intf_thread_t *, QMenu *, MainInterface *, |
|---|
| 83 |
bool, bool with = true ); |
|---|
| 84 |
static QMenu *NavigMenu( intf_thread_t *, QMenu * ); |
|---|
| 85 |
static QMenu *VideoMenu( intf_thread_t *, QMenu * ); |
|---|
| 86 |
static QMenu *AudioMenu( intf_thread_t *, QMenu * ); |
|---|
| 87 |
static QMenu *InterfacesMenu( intf_thread_t *p_intf, QMenu * ); |
|---|
| 88 |
static QMenu *HelpMenu( QMenu * ); |
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
static void AudioPopupMenu( intf_thread_t * ); |
|---|
| 92 |
static void VideoPopupMenu( intf_thread_t * ); |
|---|
| 93 |
static void MiscPopupMenu( intf_thread_t * ); |
|---|
| 94 |
static void PopupMenu( intf_thread_t *, bool ); |
|---|
| 95 |
static void PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu ); |
|---|
| 96 |
static void PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf, |
|---|
| 97 |
input_thread_t *p_input ); |
|---|
| 98 |
|
|---|
| 99 |
static void updateSystrayMenu( MainInterface *,intf_thread_t *, |
|---|
| 100 |
bool b_force_visible = false); |
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
static void DoAction( intf_thread_t *, QObject * ); |
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
static QAction *minimalViewAction; |
|---|
| 107 |
private: |
|---|
| 108 |
|
|---|
| 109 |
static QMenu * Populate( intf_thread_t *, QMenu *current, |
|---|
| 110 |
vector<const char*>&, vector<vlc_object_t *>&, |
|---|
| 111 |
bool append = false ); |
|---|
| 112 |
|
|---|
| 113 |
static void CreateAndConnect( QMenu *, const char *, QString, QString, |
|---|
| 114 |
int, vlc_object_t *, vlc_value_t, int, bool c = false ); |
|---|
| 115 |
static void UpdateItem( intf_thread_t *, QMenu *, const char *, |
|---|
| 116 |
vlc_object_t *, bool ); |
|---|
| 117 |
static int CreateChoicesMenu( QMenu *,const char *, vlc_object_t *, bool ); |
|---|
| 118 |
}; |
|---|
| 119 |
|
|---|
| 120 |
class MenuFunc : public QObject |
|---|
| 121 |
{ |
|---|
| 122 |
Q_OBJECT |
|---|
| 123 |
|
|---|
| 124 |
public: |
|---|
| 125 |
MenuFunc( QMenu *_menu, int _id ) { menu = _menu; id = _id; }; |
|---|
| 126 |
void doFunc( intf_thread_t *p_intf) |
|---|
| 127 |
{ |
|---|
| 128 |
switch( id ) |
|---|
| 129 |
{ |
|---|
| 130 |
case 1: QVLCMenu::AudioMenu( p_intf, menu ); break; |
|---|
| 131 |
case 2: QVLCMenu::VideoMenu( p_intf, menu ); break; |
|---|
| 132 |
case 3: QVLCMenu::NavigMenu( p_intf, menu ); break; |
|---|
| 133 |
case 4: QVLCMenu::InterfacesMenu( p_intf, menu ); break; |
|---|
| 134 |
} |
|---|
| 135 |
}; |
|---|
| 136 |
int id; |
|---|
| 137 |
QMenu *menu; |
|---|
| 138 |
}; |
|---|
| 139 |
|
|---|
| 140 |
#endif |
|---|