Debugger: Implement use of connection config roster.

Debugger:
- Initialize/Deinitialize roster as appropriate.

ConnectionConfigWindow:
- Implement config view listener interface, and use roster
  to retrieve and add appropriate config view when switching
  between interface types.
This commit is contained in:
Rene Gollent
2016-12-05 18:18:11 -05:00
parent eede6646dd
commit 7e6e3c1be2
3 changed files with 41 additions and 3 deletions
+6
View File
@@ -24,6 +24,7 @@
#include "AppMessageCodes.h"
#include "CommandLineUserInterface.h"
#include "ConnectionConfigHandlerRoster.h"
#include "ConnectionConfigWindow.h"
#include "DebuggerGlobals.h"
#include "DebuggerSettingsManager.h"
@@ -303,6 +304,7 @@ Debugger::~Debugger()
{
DebuggerUiSettingsFactory::DeleteDefault();
ValueHandlerRoster::DeleteDefault();
ConnectionConfigHandlerRoster::DeleteDefault();
debugger_global_uninit();
}
@@ -323,6 +325,10 @@ Debugger::Init()
if (error != B_OK)
return error;
error = ConnectionConfigHandlerRoster::CreateDefault();
if (error != B_OK)
return error;
return fSettingsManager.Init(DebuggerUiSettingsFactory::Default());
}
@@ -10,9 +10,11 @@
#include <MenuField.h>
#include <LayoutBuilder.h>
#include <AutoDeleter.h>
#include <AutoLocker.h>
#include "AppMessageCodes.h"
#include "ConnectionConfigHandlerRoster.h"
#include "TargetHostInterfaceInfo.h"
#include "TargetHostInterfaceRoster.h"
#include "TargetHostInterface.h"
@@ -28,6 +30,7 @@ ConnectionConfigWindow::ConnectionConfigWindow()
:
BWindow(BRect(), "Create new connection", B_TITLED_WINDOW,
B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE),
ConnectionConfigView::Listener(),
fConnectionTypeField(NULL),
fConfigGroupView(NULL),
fCloseButton(NULL),
@@ -74,6 +77,13 @@ ConnectionConfigWindow::QuitRequested()
}
void
ConnectionConfigWindow::ConfigurationChanged(Settings* settings)
{
// TODO: implement
}
void
ConnectionConfigWindow::MessageReceived(BMessage* message)
{
@@ -82,7 +92,6 @@ ConnectionConfigWindow::MessageReceived(BMessage* message)
BWindow::MessageReceived(message);
break;
}
}
@@ -161,5 +170,21 @@ ConnectionConfigWindow::_UpdateActiveConfig(TargetHostInterfaceInfo* info)
delete view;
}
ConnectionConfigHandlerRoster* roster
= ConnectionConfigHandlerRoster::Default();
if (roster->HasHandlerFor(info)) {
ConnectionConfigView* view = NULL;
status_t error = roster->CreateConfigView(info, this, view);
if (error != B_OK)
return;
ObjectDeleter<ConnectionConfigView> viewDeleter(view);
BLayoutItem* item = fConfigGroupView->GroupLayout()->AddView(view);
if (item != NULL) {
viewDeleter.Detach();
}
}
fConfigGroupView->InvalidateLayout();
}
@@ -5,18 +5,21 @@
#ifndef CONNECTION_CONFIG_WINDOW_H
#define CONNECTION_CONFIG_WINDOW_H
#include <Window.h>
#include "ConnectionConfigView.h"
class BButton;
class BGroupView;
class BMenu;
class BMenuField;
class Settings;
class TargetHostInterfaceInfo;
class ConnectionConfigWindow : public BWindow
class ConnectionConfigWindow : public BWindow,
private ConnectionConfigView::Listener
{
public:
ConnectionConfigWindow();
@@ -33,6 +36,10 @@ public:
virtual bool QuitRequested();
// ConnectionConfigView::Listener
virtual void ConfigurationChanged(Settings* settings);
private:
void _Init();
BMenu* _BuildTypeMenu();