From 021ff1ca467bc8f1a95b7d61377a8a65b20fbc8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 4 Feb 2015 21:04:51 +0100 Subject: [PATCH] Network: no need for public constants. --- .../network_settings/NetworkSettingsAddOn.h | 3 +- src/preferences/network/NetworkWindow.cpp | 34 +++++++++++++------ src/preferences/network/NetworkWindow.h | 9 +---- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/headers/os/add-ons/network_settings/NetworkSettingsAddOn.h b/headers/os/add-ons/network_settings/NetworkSettingsAddOn.h index 479f2efaf5..8cebdf7bc5 100644 --- a/headers/os/add-ons/network_settings/NetworkSettingsAddOn.h +++ b/headers/os/add-ons/network_settings/NetworkSettingsAddOn.h @@ -33,7 +33,8 @@ public: virtual BNetworkSettingsType Type() const = 0; - virtual BListItem* CreateListItem() = 0; + virtual BListItem* ListItem() = 0; + virtual BView* View() = 0; virtual status_t ProfileChanged( const BNetworkProfile* newProfile); diff --git a/src/preferences/network/NetworkWindow.cpp b/src/preferences/network/NetworkWindow.cpp index 9f52ba5e7f..a1e6417b3a 100644 --- a/src/preferences/network/NetworkWindow.cpp +++ b/src/preferences/network/NetworkWindow.cpp @@ -3,8 +3,9 @@ * Distributed under the terms of the MIT License. * * Authors: - * Alexander von Gluck, * Adrien Destugues, + * Axel Dörfler, + * Alexander von Gluck, */ @@ -43,6 +44,15 @@ const char* kNetworkStatusSignature = "application/x-vnd.Haiku-NetworkStatus"; +static const uint32 kMsgProfileSelected = 'prof'; +static const uint32 kMsgProfileManage = 'mngp'; +static const uint32 kMsgProfileNew = 'newp'; +static const uint32 kMsgApply = 'aply'; +static const uint32 kMsgRevert = 'rvrt'; +static const uint32 kMsgToggleReplicant = 'trep'; +static const uint32 kMsgItemSelected = 'ItSl'; + + #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "NetworkWindow" @@ -75,16 +85,18 @@ NetworkWindow::NetworkWindow() // fRevertButton->SetEnabled(false); BMessage* message = new BMessage(kMsgToggleReplicant); - BCheckBox* replicantStatus = new BCheckBox("replicantStatus", + BCheckBox* showReplicantCheckBox = new BCheckBox("showReplicantCheckBox", B_TRANSLATE("Show network status in Deskbar"), message); - replicantStatus->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); - replicantStatus->SetValue(_IsReplicantInstalled()); + showReplicantCheckBox->SetExplicitMaxSize( + BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); + showReplicantCheckBox->SetValue(_IsReplicantInstalled()); fListView = new BOutlineListView("list", B_SINGLE_SELECTION_LIST, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS | B_NAVIGABLE); + fListView->SetSelectionMessage(new BMessage(kMsgItemSelected)); - BScrollView* scrollView = new BScrollView("ScrollView", - fListView, 0/*B_WILL_DRAW | B_FRAME_EVENTS*/, false, true); + BScrollView* scrollView = new BScrollView("ScrollView", fListView, + 0, false, true); // Build the layout BLayoutBuilder::Group<>(this, B_VERTICAL) @@ -100,7 +112,7 @@ NetworkWindow::NetworkWindow() .Add(scrollView) .AddGlue() .End() - .Add(replicantStatus) + .Add(showReplicantCheckBox) .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING) .Add(fRevertButton) .AddGlue() @@ -149,6 +161,9 @@ NetworkWindow::MessageReceived(BMessage* message) break; } + case kMsgItemSelected: + break; + case kMsgRevert: { for (int index = 0; index < fItems.CountItems(); index++) @@ -315,7 +330,7 @@ NetworkWindow::_ScanAddOns() fItems.AddItem(item); // TODO: sort - fListView->AddUnder(interfaceItem, item->CreateListItem()); + fListView->AddUnder(interfaceItem, item->ListItem()); } } @@ -328,8 +343,7 @@ NetworkWindow::_ScanAddOns() fItems.AddItem(item); // TODO: sort - fListView->AddUnder(_ItemFor(item->Type()), - item->CreateListItem()); + fListView->AddUnder(_ItemFor(item->Type()), item->ListItem()); } } } diff --git a/src/preferences/network/NetworkWindow.h b/src/preferences/network/NetworkWindow.h index 3980dce4b9..073e500798 100644 --- a/src/preferences/network/NetworkWindow.h +++ b/src/preferences/network/NetworkWindow.h @@ -3,6 +3,7 @@ * Distributed under the terms of the MIT License. * * Authors: + * Axel Dörfler, * Alexander von Gluck, */ #ifndef NETWORK_WINDOW_H @@ -26,14 +27,6 @@ class BMenu; class NetworkWindow : public BWindow { -public: - static const uint32 kMsgProfileSelected = 'prof'; - static const uint32 kMsgProfileManage = 'mngp'; - static const uint32 kMsgProfileNew = 'newp'; - static const uint32 kMsgApply = 'aply'; - static const uint32 kMsgRevert = 'rvrt'; - static const uint32 kMsgToggleReplicant = 'trep'; - public: NetworkWindow(); virtual ~NetworkWindow();