1 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 2 // 3 // Copyright (c) 2003, OpenBeOS 4 // 5 // This software is part of the OpenBeOS distribution and is covered 6 // by the OpenBeOS license. 7 // 8 // 9 // File: MediaWindow.h 10 // Author: Sikosis, Jérôme Duval 11 // Description: Media Preferences 12 // Created : June 25, 2003 13 // 14 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 15 #ifndef __MEDIAWINDOWS_H__ 16 #define __MEDIAWINDOWS_H__ 17 18 19 #include <ListView.h> 20 #include <MediaAddOn.h> 21 #include <ParameterWeb.h> 22 #include <StringView.h> 23 #include <Window.h> 24 25 #include <ObjectList.h> 26 27 #include "MediaAlert.h" 28 #include "MediaIcons.h" 29 #include "MediaListItem.h" 30 #include "MediaViews.h" 31 32 33 #define SETTINGS_FILE "MediaPrefs Settings" 34 35 36 class BCardLayout; 37 class BSeparatorView; 38 // struct dormant_node_info; 39 40 41 class MediaWindow : public BWindow 42 { 43 public: 44 MediaWindow(BRect frame); 45 ~MediaWindow(); 46 status_t InitCheck(); 47 48 // methods to be called by MediaListItems... 49 void SelectNode(const dormant_node_info* node); 50 void SelectAudioSettings(const char* title); 51 void SelectVideoSettings(const char* title); 52 void SelectAudioMixer(const char* title); 53 54 // methods to be called by SettingsViews... 55 void UpdateInputListItem( 56 MediaListItem::media_type type, 57 const dormant_node_info* node); 58 void UpdateOutputListItem( 59 MediaListItem::media_type type, 60 const dormant_node_info* node); 61 62 virtual bool QuitRequested(); 63 virtual void MessageReceived(BMessage* message); 64 65 private: 66 67 typedef BObjectList<dormant_node_info> NodeList; 68 69 70 status_t InitMedia(bool first); 71 void _FindNodes(); 72 void _FindNodes(media_type type, uint64 kind, 73 NodeList& into); 74 void _AddNodeItems(NodeList &from, 75 MediaListItem::media_type type); 76 void _EmptyNodeLists(); 77 void _UpdateListViewMinWidth(); 78 79 NodeListItem* _FindNodeListItem(dormant_node_info* info); 80 void InitWindow(); 81 82 static status_t RestartMediaServices(void* data); 83 static bool UpdateProgress(int stage, const char * message, 84 void * cookie); 85 86 void _ClearParamView(); 87 void _MakeParamView(); 88 void _MakeEmptyParamView(); 89 90 struct SmartNode { 91 SmartNode(const BMessenger& notifyHandler); 92 ~SmartNode(); 93 void SetTo(const dormant_node_info* node); 94 void SetTo(const media_node& node); 95 bool IsSet(); 96 operator media_node(); 97 98 private: 99 void _FreeNode(); 100 media_node* fNode; 101 BMessenger fMessenger; 102 }; 103 104 BListView* fListView; 105 BSeparatorView* fTitleView; 106 BCardLayout* fContentLayout; 107 AudioSettingsView* fAudioView; 108 VideoSettingsView* fVideoView; 109 110 SmartNode fCurrentNode; 111 BParameterWeb* fParamWeb; 112 113 114 NodeList fAudioInputs; 115 NodeList fAudioOutputs; 116 NodeList fVideoInputs; 117 NodeList fVideoOutputs; 118 119 MediaAlert* fAlert; 120 status_t fInitCheck; 121 }; 122 123 #endif 124