Debugger: Implement spawning connection window.

TeamsWindow:
- Create new connection button now sends a message to the main app,
  which manages the connection window as a singleton.

Debugger:
- Handle creating/showing connection configuration window as requested.
This commit is contained in:
Rene Gollent
2016-12-05 18:18:06 -05:00
parent c4b2191889
commit 445f00371c
2 changed files with 32 additions and 10 deletions
+25
View File
@@ -24,6 +24,7 @@
#include "AppMessageCodes.h" #include "AppMessageCodes.h"
#include "CommandLineUserInterface.h" #include "CommandLineUserInterface.h"
#include "ConnectionConfigWindow.h"
#include "DebuggerGlobals.h" #include "DebuggerGlobals.h"
#include "DebuggerSettingsManager.h" #include "DebuggerSettingsManager.h"
#include "DebuggerUiSettingsFactory.h" #include "DebuggerUiSettingsFactory.h"
@@ -258,6 +259,7 @@ private:
private: private:
DebuggerSettingsManager fSettingsManager; DebuggerSettingsManager fSettingsManager;
ConnectionConfigWindow* fConnectionWindow;
TeamsWindow* fTeamsWindow; TeamsWindow* fTeamsWindow;
StartTeamWindow* fStartTeamWindow; StartTeamWindow* fStartTeamWindow;
}; };
@@ -290,6 +292,7 @@ Debugger::Debugger()
: :
BApplication(kDebuggerSignature), BApplication(kDebuggerSignature),
TargetHostInterfaceRoster::Listener(), TargetHostInterfaceRoster::Listener(),
fConnectionWindow(NULL),
fTeamsWindow(NULL), fTeamsWindow(NULL),
fStartTeamWindow(NULL) fStartTeamWindow(NULL)
{ {
@@ -377,6 +380,28 @@ Debugger::MessageReceived(BMessage* message)
fStartTeamWindow = NULL; fStartTeamWindow = NULL;
break; break;
} }
case MSG_SHOW_CONNECTION_CONFIG_WINDOW:
{
if (fConnectionWindow != NULL) {
fConnectionWindow->Activate(true);
break;
}
try {
fConnectionWindow = ConnectionConfigWindow::Create();
if (fConnectionWindow != NULL)
fConnectionWindow->Show();
} catch (...) {
// TODO: Notify the user!
fprintf(stderr, "Error: Failed to create Teams window\n");
}
break;
}
case MSG_CONNECTION_CONFIG_WINDOW_CLOSED:
{
fConnectionWindow = NULL;
break;
}
case MSG_DEBUG_THIS_TEAM: case MSG_DEBUG_THIS_TEAM:
{ {
team_id teamID; team_id teamID;
@@ -38,8 +38,7 @@
enum { enum {
MSG_TEAM_SELECTION_CHANGED = 'tesc', MSG_TEAM_SELECTION_CHANGED = 'tesc',
MSG_CHOSE_CORE_FILE = 'chcf', MSG_CHOSE_CORE_FILE = 'chcf',
MSG_SWITCH_TARGET_CONNECTION = 'stco', MSG_SWITCH_TARGET_CONNECTION = 'stco'
MSG_CREATE_NEW_CONNECTION = 'cnco'
}; };
@@ -54,7 +53,8 @@ TeamsWindow::TeamsWindow(SettingsManager* settingsManager)
fLoadCoreButton(NULL), fLoadCoreButton(NULL),
fConnectionField(NULL), fConnectionField(NULL),
fCoreSelectionPanel(NULL), fCoreSelectionPanel(NULL),
fSettingsManager(settingsManager) fSettingsManager(settingsManager),
fListeners()
{ {
team_info info; team_info info;
get_team_info(B_CURRENT_TEAM, &info); get_team_info(B_CURRENT_TEAM, &info);
@@ -173,11 +173,6 @@ TeamsWindow::MessageReceived(BMessage* message)
break; break;
} }
case MSG_CREATE_NEW_CONNECTION:
{
break;
}
case MSG_SWITCH_TARGET_CONNECTION: case MSG_SWITCH_TARGET_CONNECTION:
{ {
TargetHostInterface* interface; TargetHostInterface* interface;
@@ -191,6 +186,7 @@ TeamsWindow::MessageReceived(BMessage* message)
fTargetHostInterface = interface; fTargetHostInterface = interface;
_NotifySelectedInterfaceChanged(interface); _NotifySelectedInterfaceChanged(interface);
fLoadCoreButton->SetEnabled(fTargetHostInterface->IsLocal());
break; break;
} }
@@ -271,7 +267,8 @@ TeamsWindow::_Init()
connectionMenu)) connectionMenu))
.AddGlue() .AddGlue()
.Add(fCreateConnectionButton = new BButton("Create new connection" .Add(fCreateConnectionButton = new BButton("Create new connection"
B_UTF8_ELLIPSIS, new BMessage(MSG_CREATE_NEW_CONNECTION))) B_UTF8_ELLIPSIS, new BMessage(
MSG_SHOW_CONNECTION_CONFIG_WINDOW)))
.End() .End()
.Add(fTeamsListView = new TeamsListView("TeamsList")) .Add(fTeamsListView = new TeamsListView("TeamsList"))
.SetInsets(1.0f, 1.0f, 1.0f, 5.0f) .SetInsets(1.0f, 1.0f, 1.0f, 5.0f)
@@ -297,10 +294,10 @@ TeamsWindow::_Init()
fTeamsListView->SetSelectionMessage(new BMessage( fTeamsListView->SetSelectionMessage(new BMessage(
MSG_TEAM_SELECTION_CHANGED)); MSG_TEAM_SELECTION_CHANGED));
fCreateConnectionButton->SetEnabled(true);
fAttachTeamButton->SetEnabled(false); fAttachTeamButton->SetEnabled(false);
fCreateTeamButton->SetTarget(this); fCreateTeamButton->SetTarget(this);
fLoadCoreButton->SetTarget(this); fLoadCoreButton->SetTarget(this);
fCreateConnectionButton->SetTarget(be_app);
_NotifySelectedInterfaceChanged(fTargetHostInterface); _NotifySelectedInterfaceChanged(fTargetHostInterface);
} }