Skip to content

Commit df44f52

Browse files
committed
fix opening WebGUI via context menu
GitHub Issue #4
1 parent cf57a23 commit df44f52

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

tools/rcdiscover-gui/discover-frame.cc

+13-11
Original file line numberDiff line numberDiff line change
@@ -426,13 +426,7 @@ void DiscoverFrame::onDeviceDoubleClick(wxDataViewEvent &event)
426426
return;
427427
}
428428

429-
const auto manufacturer = device_list_->GetTextValue(row, 1);
430-
if (manufacturer == ROBOCEPTION || manufacturer == KUKA)
431-
{
432-
const auto ip_wxstring = device_list_->GetTextValue(
433-
static_cast<unsigned int>(row), 4);
434-
wxLaunchDefaultBrowser("http://" + ip_wxstring + "/");
435-
}
429+
openWebGUI(row);
436430
}
437431

438432
void DiscoverFrame::onDataViewContextMenu(wxDataViewEvent &event)
@@ -521,10 +515,7 @@ void DiscoverFrame::onOpenWebGUI(wxMenuEvent &)
521515
return;
522516
}
523517

524-
const auto ip_wxstring = device_list_->GetTextValue(
525-
static_cast<unsigned int>(menu_event_item_->first),
526-
3);
527-
wxLaunchDefaultBrowser("http://" + ip_wxstring + "/");
518+
openWebGUI(menu_event_item_->first);
528519
}
529520

530521
void DiscoverFrame::onResetContextMenu(wxMenuEvent &)
@@ -625,5 +616,16 @@ void DiscoverFrame::openReconnectDialog(const int row)
625616
reconnect_dialog_->Show();
626617
}
627618

619+
void DiscoverFrame::openWebGUI(int row)
620+
{
621+
const auto manufacturer = device_list_->GetTextValue(row, 1);
622+
if (manufacturer == ROBOCEPTION || manufacturer == KUKA)
623+
{
624+
const auto ip_wxstring = device_list_->GetTextValue(
625+
static_cast<unsigned int>(row), 4);
626+
wxLaunchDefaultBrowser("http://" + ip_wxstring + "/");
627+
}
628+
}
629+
628630
BEGIN_EVENT_TABLE(DiscoverFrame, wxFrame)
629631
END_EVENT_TABLE()

tools/rcdiscover-gui/discover-frame.h

+5
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ class DiscoverFrame : public wxFrame
204204
*/
205205
void updateDeviceList(const std::vector<wxVector<wxVariant>> &d);
206206

207+
/**
208+
* @brief Open WebGUI for device in specific row.
209+
*/
210+
void openWebGUI(int row);
211+
207212
wxDECLARE_EVENT_TABLE();
208213

209214
private:

0 commit comments

Comments
 (0)