@@ -41,39 +41,13 @@ struct Grid : public SceneGraph::Drawable3D
4141 GL ::Mesh mesh_;
4242};
4343
44- McRtcGui::McRtcGui (const McRtcGui::McRtcGuiConfiguration & config, const Arguments & arguments)
45- : Platform::Application{
46- arguments, Configuration{}
47- .setTitle (" mc_rtc - Magnum based GUI" )
48- .setWindowFlags (Configuration::WindowFlag::Resizable | Configuration::WindowFlag::Maximized)},
49-
50- client_ (*this )
44+ McRtcGui::McRtcGui (const mc_rtc::magnum::McRtcGuiConfiguration & config, const Arguments & arguments)
45+ : Platform::Application{arguments, Configuration{}
46+ .setTitle (" mc_rtc - Magnum based GUI" )
47+ .setWindowFlags (Configuration::WindowFlag::Resizable
48+ | Configuration::WindowFlag::Maximized)},
49+ client_ (*this , config)
5150{
52- {
53- const auto & c = config;
54- if (c.ipcConfig .use_icp && c.tcpConfig .use_tcp )
55- {
56- std::cerr << " Cannot use both TCP and IPC, please choose one of the two communication protocols" << std::endl;
57- this ->exit (1 );
58- return ;
59- }
60- else if (!c.ipcConfig .use_icp && !c.tcpConfig .use_tcp )
61- {
62- std::cerr << " No communication protocol specified, please choose one of TCP or IPC" << std::endl;
63- this ->exit (1 );
64- return ;
65- }
66-
67- if (c.ipcConfig .use_icp )
68- {
69- client_.connect (c.ipcConfig .sub_uri , c.ipcConfig .pub_uri );
70- }
71- else if (c.tcpConfig .use_tcp )
72- {
73- client_.connect (fmt::format (" tcp://{}:{}" , c.tcpConfig .host , c.tcpConfig .sub_port ),
74- fmt::format (" tcp://{}:{}" , c.tcpConfig .host , c.tcpConfig .pub_port ));
75- }
76- }
7751 {
7852 // Update runtime paths (robot modules, etc)
7953 // This is required in nix to ensure that plugins installed in different store location are available
@@ -442,15 +416,12 @@ void McRtcGui::draw(GL::Mesh & mesh, const Color4 & color, const Matrix4 & world
442416
443417} // namespace mc_rtc::magnum
444418
445-
446- void loadFromArgs (int argc, char ** argv)
447- {
448- }
419+ void loadFromArgs (int argc, char ** argv) {}
449420
450421int main (int argc, char ** argv)
451422{
452423 using McRtcGui = mc_rtc::magnum::McRtcGui;
453- auto c = McRtcGui ::McRtcGuiConfiguration{};
424+ auto c = mc_rtc::magnum ::McRtcGuiConfiguration{};
454425 po::options_description desc (" mc-rtc-magnum options" );
455426 // clang-format off
456427 desc.add_options ()
@@ -473,15 +444,18 @@ int main(int argc, char ** argv)
473444 po::notify (vm);
474445 if (vm.count (" tcp" ))
475446 {
447+ mc_rtc::log::warning (" --tcp" );
476448 c.tcpConfig .use_tcp = true ;
477- c.ipcConfig .use_icp = false ;
449+ c.ipcConfig .use_ipc = false ;
478450 c.tcpConfig .host = vm[" tcp" ].as <std::string>();
479- std::cout << " Warning use of '--tcp' option is deprecated, use '--use-tcp --tcp-host <hostname>' instead" << std::endl;
451+ std::cout << " Warning use of '--tcp' option is deprecated, use '--use-tcp --tcp-host <hostname>' instead"
452+ << std::endl;
480453 }
481- if (vm. count ( " use-tcp" ))
454+ if (vm[ " use-tcp" ]. as < bool >( ))
482455 {
456+ mc_rtc::log::warning (" --use-tcp" );
483457 c.tcpConfig .use_tcp = true ;
484- c.ipcConfig .use_icp = false ;
458+ c.ipcConfig .use_ipc = false ;
485459 }
486460 if (vm.count (" help" ))
487461 {
@@ -498,7 +472,7 @@ int main(int argc, char ** argv)
498472 )" << desc << " \n " ;
499473 exit (0 );
500474 }
501-
475+
502476 auto app = McRtcGui{c, {argc, argv}};
503477 return app.exec ();
504478}
0 commit comments