Debugger: Implement listener hooks in ConnectionConfigWindow.
ConnectionConfigWindow: - When notified that settings have been changed by the current config view, validate them, and if complete, enable the connect button. - Implement message handler for connect button.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016, Rene Gollent, [email protected].
|
* Copyright 2016-2017, Rene Gollent, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#include "ConnectionConfigWindow.h"
|
#include "ConnectionConfigWindow.h"
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "AppMessageCodes.h"
|
#include "AppMessageCodes.h"
|
||||||
#include "ConnectionConfigHandlerRoster.h"
|
#include "ConnectionConfigHandlerRoster.h"
|
||||||
|
#include "Settings.h"
|
||||||
#include "TargetHostInterfaceInfo.h"
|
#include "TargetHostInterfaceInfo.h"
|
||||||
#include "TargetHostInterfaceRoster.h"
|
#include "TargetHostInterfaceRoster.h"
|
||||||
#include "TargetHostInterface.h"
|
#include "TargetHostInterface.h"
|
||||||
@@ -34,13 +35,17 @@ ConnectionConfigWindow::ConnectionConfigWindow()
|
|||||||
fConnectionTypeField(NULL),
|
fConnectionTypeField(NULL),
|
||||||
fConfigGroupView(NULL),
|
fConfigGroupView(NULL),
|
||||||
fCloseButton(NULL),
|
fCloseButton(NULL),
|
||||||
fConnectButton(NULL)
|
fConnectButton(NULL),
|
||||||
|
fCurrentSettings(NULL),
|
||||||
|
fActiveInfo(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ConnectionConfigWindow::~ConnectionConfigWindow()
|
ConnectionConfigWindow::~ConnectionConfigWindow()
|
||||||
{
|
{
|
||||||
|
if (fCurrentSettings != NULL)
|
||||||
|
fCurrentSettings->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -80,7 +85,12 @@ ConnectionConfigWindow::QuitRequested()
|
|||||||
void
|
void
|
||||||
ConnectionConfigWindow::ConfigurationChanged(Settings* settings)
|
ConnectionConfigWindow::ConfigurationChanged(Settings* settings)
|
||||||
{
|
{
|
||||||
// TODO: implement
|
if (fCurrentSettings != NULL)
|
||||||
|
fCurrentSettings->ReleaseReference();
|
||||||
|
fCurrentSettings = settings;
|
||||||
|
fCurrentSettings->AcquireReference();
|
||||||
|
|
||||||
|
fConnectButton->SetEnabled(fActiveInfo->IsConfigured(settings));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -88,6 +98,23 @@ void
|
|||||||
ConnectionConfigWindow::MessageReceived(BMessage* message)
|
ConnectionConfigWindow::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
|
case MSG_CREATE_CONNECTION:
|
||||||
|
{
|
||||||
|
TargetHostInterfaceRoster* roster
|
||||||
|
= TargetHostInterfaceRoster::Default();
|
||||||
|
AutoLocker<TargetHostInterfaceRoster> rosterLocker(roster);
|
||||||
|
|
||||||
|
TargetHostInterface* interface;
|
||||||
|
status_t error = roster->CreateInterface(fActiveInfo,
|
||||||
|
fCurrentSettings, interface);
|
||||||
|
|
||||||
|
// TODO: notify user.
|
||||||
|
if (error != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
@@ -181,9 +208,10 @@ ConnectionConfigWindow::_UpdateActiveConfig(TargetHostInterfaceInfo* info)
|
|||||||
|
|
||||||
ObjectDeleter<ConnectionConfigView> viewDeleter(view);
|
ObjectDeleter<ConnectionConfigView> viewDeleter(view);
|
||||||
BLayoutItem* item = fConfigGroupView->GroupLayout()->AddView(view);
|
BLayoutItem* item = fConfigGroupView->GroupLayout()->AddView(view);
|
||||||
if (item != NULL) {
|
if (item != NULL)
|
||||||
viewDeleter.Detach();
|
viewDeleter.Detach();
|
||||||
}
|
|
||||||
|
fActiveInfo = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
fConfigGroupView->InvalidateLayout();
|
fConfigGroupView->InvalidateLayout();
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ private:
|
|||||||
BGroupView* fConfigGroupView;
|
BGroupView* fConfigGroupView;
|
||||||
BButton* fCloseButton;
|
BButton* fCloseButton;
|
||||||
BButton* fConnectButton;
|
BButton* fConnectButton;
|
||||||
|
Settings* fCurrentSettings;
|
||||||
|
TargetHostInterfaceInfo*
|
||||||
|
fActiveInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONNECTION_CONFIG_WINDOW_H
|
#endif // CONNECTION_CONFIG_WINDOW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user