7 #include <boost/format.hpp> 
    9 #include <std_srvs/Empty.h> 
   27     QHBoxLayout* layout = 
new QHBoxLayout();
 
   29     if (nh.
hasParam(
"robot_command_buttons")) {
 
   32         nh.
param(
"robot_command_buttons", robot_command_buttons_xmlrpc, robot_command_buttons_xmlrpc);
 
   37           for (
size_t i = 0; 
i < robot_command_buttons_xmlrpc.
size(); 
i++) {
 
   44               QToolButton* button = 
new QToolButton();
 
   46               button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
   49                 name = (std::string)button_xmlrpc[
"name"];
 
   54               button->setText(QString(name.c_str()));
 
   58                 icon = (std::string)button_xmlrpc[
"icon"];
 
   59                 if (icon.find(
"package://") == 0) {
 
   60                   icon.erase(0, strlen(
"package://"));
 
   61                   size_t package_end = icon.find(
"/");
 
   62                   std::string 
package = icon.substr(0, package_end);
 
   63                   icon.erase(0, package_end);
 
   64                   std::string package_path;
 
   66                   icon = package_path + icon;
 
   68                 button->setIcon(QIcon(QPixmap(QString(icon.c_str()))));
 
   69                 button->setIconSize(QSize(80, 80));
 
   70                 button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
 
   74                 type = (std::string)button_xmlrpc[
"type"];
 
   76               if (
type == 
"euscommand") {
 
   85               else if (
type == 
"emptysrv") {
 
  100               layout->addWidget(button);
 
  106         popupDialog((boost::format(
"Malformed ~robot_command_buttons parameter.\n" 
  108                                   "See package://jsk_rviz_plugins/config/default_robot_command.yaml")
 
  109                      % e.what()).str().c_str());
 
  113       popupDialog(
"You need to specify ~robot_command_buttons parameter.\n" 
  114                   "See package://jsk_rviz_plugins/launch/robot_command_interface_sample.launch");
 
  116     layout->addStretch();
 
  126     this->setLayout(layout);
 
  131     jsk_rviz_plugins::EusCommand 
srv;
 
  151       popupDialog((boost::format(
"Failed to find corresponding command for %d") % 
i).
str().c_str());
 
  158     msg_box.setText(
"Unexpected error");
 
  159     msg_box.setText(QString(
text.c_str()));