00001 /********************************************************************* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2012, Willow Garage, Inc. 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * * Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the following 00015 * disclaimer in the documentation and/or other materials provided 00016 * with the distribution. 00017 * * Neither the name of Willow Garage nor the names of its 00018 * contributors may be used to endorse or promote products derived 00019 * from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 *********************************************************************/ 00034 00035 /* Author: Dave Coleman */ 00036 00037 #ifndef MOVEIT_ROS_MOVEIT_SETUP_ASSISTANT_WIDGETS_END_EFFECTORS_WIDGET_ 00038 #define MOVEIT_ROS_MOVEIT_SETUP_ASSISTANT_WIDGETS_END_EFFECTORS_WIDGET_ 00039 00040 // Qt 00041 #include <QWidget> 00042 #include <QVBoxLayout> 00043 #include <QHBoxLayout> 00044 #include <QScrollArea> 00045 #include <QGroupBox> 00046 #include <QLabel> 00047 #include <QPushButton> 00048 #include <QTableWidget> 00049 #include <QStackedLayout> 00050 #include <QString> 00051 #include <QComboBox> 00052 00053 // SA 00054 #ifndef Q_MOC_RUN 00055 #include <moveit/setup_assistant/tools/moveit_config_data.h> 00056 #endif 00057 00058 #include "header_widget.h" 00059 #include "setup_screen_widget.h" // a base class for screens in the setup assistant 00060 00061 namespace moveit_setup_assistant 00062 { 00063 class EndEffectorsWidget : public SetupScreenWidget 00064 { 00065 Q_OBJECT 00066 00067 public: 00068 // ****************************************************************************************** 00069 // Public Functions 00070 // ****************************************************************************************** 00071 00072 EndEffectorsWidget(QWidget* parent, moveit_setup_assistant::MoveItConfigDataPtr config_data); 00073 00075 virtual void focusGiven(); 00076 00077 // ****************************************************************************************** 00078 // Qt Components 00079 // ****************************************************************************************** 00080 QTableWidget* data_table_; 00081 QPushButton* btn_edit_; 00082 QPushButton* btn_delete_; 00083 QPushButton* btn_save_; 00084 QPushButton* btn_cancel_; 00085 QStackedLayout* stacked_layout_; 00086 QLineEdit* effector_name_field_; 00087 QComboBox* parent_name_field_; 00088 QComboBox* parent_group_name_field_; 00089 QComboBox* group_name_field_; 00090 QWidget* effector_list_widget_; 00091 QWidget* effector_edit_widget_; 00092 00093 private Q_SLOTS: 00094 00095 // ****************************************************************************************** 00096 // Slot Event Functions 00097 // ****************************************************************************************** 00098 00100 void showNewScreen(); 00101 00103 void editSelected(); 00104 00106 void editDoubleClicked(int row, int column); 00107 00109 void previewClicked(int row, int column); 00110 00112 void previewClickedString(const QString& name); 00113 00115 void deleteSelected(); 00116 00118 void doneEditing(); 00119 00121 void cancelEditing(); 00122 00123 private: 00124 // ****************************************************************************************** 00125 // Variables 00126 // ****************************************************************************************** 00127 00129 moveit_setup_assistant::MoveItConfigDataPtr config_data_; 00130 00132 std::string current_edit_effector_; 00133 00134 // ****************************************************************************************** 00135 // Private Functions 00136 // ****************************************************************************************** 00137 00144 srdf::Model::EndEffector* findEffectorByName(const std::string& name); 00145 00151 QWidget* createContentsWidget(); 00152 00158 QWidget* createEditWidget(); 00159 00164 void loadDataTable(); 00165 00170 void loadGroupsComboBox(); 00171 00176 void loadParentComboBox(); 00177 00183 void edit(const std::string& name); 00184 }; 00185 00186 } // namespace 00187 00188 #endif