1 /* 2 * Copyright 2004-2015 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Axel Dörfler, <axeld@pinc-software.de> 7 * Alexander von Gluck, <kallisti5@unixzen.com> 8 */ 9 #ifndef NETWORK_WINDOW_H 10 #define NETWORK_WINDOW_H 11 12 13 #include <map> 14 15 #include <ObjectList.h> 16 #include <Window.h> 17 18 #include <NetworkSettings.h> 19 #include <NetworkSettingsAddOn.h> 20 21 22 using namespace BNetworkKit; 23 24 class BButton; 25 class BMenu; 26 class InterfaceListItem; 27 class InterfaceView; 28 29 30 enum { 31 kMsgSettingsItemUpdated = 'SIup' 32 }; 33 34 35 class NetworkWindow : public BWindow { 36 public: 37 NetworkWindow(); 38 virtual ~NetworkWindow(); 39 40 bool QuitRequested(); 41 void MessageReceived(BMessage* message); 42 43 private: 44 typedef BWindow inherited; 45 46 void _BuildProfilesMenu(BMenu* menu, int32 what); 47 void _ScanInterfaces(); 48 void _ScanAddOns(); 49 BNetworkSettingsItem* 50 _SettingsItemFor(BListItem* item); 51 void _SortItemsUnder(BListItem* item); 52 BListItem* _ListItemFor(BNetworkSettingsType type); 53 BListItem* _CreateItem(const char* label); 54 void _SelectItem(BListItem* listItem); 55 void _BroadcastSettingsUpdate(uint32 type); 56 void _BroadcastConfigurationUpdate( 57 const BMessage& message); 58 void _UpdateRevertButton(); 59 60 bool _IsReplicantInstalled(); 61 void _ShowReplicant(bool show); 62 63 static const char* _ItemName(const BListItem* item); 64 static int _CompareTopLevelListItems(const BListItem* a, 65 const BListItem* b); 66 static int _CompareListItems(const BListItem* a, 67 const BListItem* b); 68 69 private: 70 typedef BObjectList<BNetworkSettingsAddOn> AddOnList; 71 typedef std::map<BString, BListItem*> ItemMap; 72 typedef std::map<BListItem*, BNetworkSettingsItem*> SettingsMap; 73 74 BNetworkSettings fSettings; 75 AddOnList fAddOns; 76 77 BOutlineListView* fListView; 78 ItemMap fInterfaceItemMap; 79 BListItem* fServicesItem; 80 BListItem* fDialUpItem; 81 BListItem* fVPNItem; 82 BListItem* fOtherItem; 83 84 SettingsMap fSettingsMap; 85 86 InterfaceView* fInterfaceView; 87 BView* fAddOnShellView; 88 89 BButton* fRevertButton; 90 }; 91 92 93 extern BMessenger gNetworkWindow; 94 95 96 #endif // NETWORK_WINDOW_H 97