Network: no need for public constants.

This commit is contained in:
Axel Dörfler 2015-02-04 21:04:51 +01:00
parent 5493c30fed
commit 021ff1ca46
3 changed files with 27 additions and 19 deletions

View File

@ -33,7 +33,8 @@ public:
virtual BNetworkSettingsType virtual BNetworkSettingsType
Type() const = 0; Type() const = 0;
virtual BListItem* CreateListItem() = 0; virtual BListItem* ListItem() = 0;
virtual BView* View() = 0;
virtual status_t ProfileChanged( virtual status_t ProfileChanged(
const BNetworkProfile* newProfile); const BNetworkProfile* newProfile);

View File

@ -3,8 +3,9 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Alexander von Gluck, <kallisti5@unixzen.com>
* Adrien Destugues, <pulkomandy@pulkomandy.tk> * Adrien Destugues, <pulkomandy@pulkomandy.tk>
* Axel Dörfler, <axeld@pinc-software.de>
* Alexander von Gluck, <kallisti5@unixzen.com>
*/ */
@ -43,6 +44,15 @@
const char* kNetworkStatusSignature = "application/x-vnd.Haiku-NetworkStatus"; 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 #undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "NetworkWindow" #define B_TRANSLATION_CONTEXT "NetworkWindow"
@ -75,16 +85,18 @@ NetworkWindow::NetworkWindow()
// fRevertButton->SetEnabled(false); // fRevertButton->SetEnabled(false);
BMessage* message = new BMessage(kMsgToggleReplicant); BMessage* message = new BMessage(kMsgToggleReplicant);
BCheckBox* replicantStatus = new BCheckBox("replicantStatus", BCheckBox* showReplicantCheckBox = new BCheckBox("showReplicantCheckBox",
B_TRANSLATE("Show network status in Deskbar"), message); B_TRANSLATE("Show network status in Deskbar"), message);
replicantStatus->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); showReplicantCheckBox->SetExplicitMaxSize(
replicantStatus->SetValue(_IsReplicantInstalled()); BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
showReplicantCheckBox->SetValue(_IsReplicantInstalled());
fListView = new BOutlineListView("list", B_SINGLE_SELECTION_LIST, fListView = new BOutlineListView("list", B_SINGLE_SELECTION_LIST,
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS | B_NAVIGABLE); B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS | B_NAVIGABLE);
fListView->SetSelectionMessage(new BMessage(kMsgItemSelected));
BScrollView* scrollView = new BScrollView("ScrollView", BScrollView* scrollView = new BScrollView("ScrollView", fListView,
fListView, 0/*B_WILL_DRAW | B_FRAME_EVENTS*/, false, true); 0, false, true);
// Build the layout // Build the layout
BLayoutBuilder::Group<>(this, B_VERTICAL) BLayoutBuilder::Group<>(this, B_VERTICAL)
@ -100,7 +112,7 @@ NetworkWindow::NetworkWindow()
.Add(scrollView) .Add(scrollView)
.AddGlue() .AddGlue()
.End() .End()
.Add(replicantStatus) .Add(showReplicantCheckBox)
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING) .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
.Add(fRevertButton) .Add(fRevertButton)
.AddGlue() .AddGlue()
@ -149,6 +161,9 @@ NetworkWindow::MessageReceived(BMessage* message)
break; break;
} }
case kMsgItemSelected:
break;
case kMsgRevert: case kMsgRevert:
{ {
for (int index = 0; index < fItems.CountItems(); index++) for (int index = 0; index < fItems.CountItems(); index++)
@ -315,7 +330,7 @@ NetworkWindow::_ScanAddOns()
fItems.AddItem(item); fItems.AddItem(item);
// TODO: sort // TODO: sort
fListView->AddUnder(interfaceItem, item->CreateListItem()); fListView->AddUnder(interfaceItem, item->ListItem());
} }
} }
@ -328,8 +343,7 @@ NetworkWindow::_ScanAddOns()
fItems.AddItem(item); fItems.AddItem(item);
// TODO: sort // TODO: sort
fListView->AddUnder(_ItemFor(item->Type()), fListView->AddUnder(_ItemFor(item->Type()), item->ListItem());
item->CreateListItem());
} }
} }
} }

View File

@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Axel Dörfler, <axeld@pinc-software.de>
* Alexander von Gluck, <kallisti5@unixzen.com> * Alexander von Gluck, <kallisti5@unixzen.com>
*/ */
#ifndef NETWORK_WINDOW_H #ifndef NETWORK_WINDOW_H
@ -26,14 +27,6 @@ class BMenu;
class NetworkWindow : public BWindow { 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: public:
NetworkWindow(); NetworkWindow();
virtual ~NetworkWindow(); virtual ~NetworkWindow();