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_MOVEIT_SETUP_ASSISTANT_WIDGETS_START_SCREEN_WIDGET_ 00038 #define MOVEIT_MOVEIT_SETUP_ASSISTANT_WIDGETS_START_SCREEN_WIDGET_ 00039 00040 #include <QWidget> 00041 #include <QLineEdit> 00042 #include <QPushButton> 00043 #include <QCheckBox> 00044 #include <QLabel> 00045 #include <QProgressBar> 00046 00047 #ifndef Q_MOC_RUN 00048 #include <urdf/model.h> // for testing a valid urdf is loaded 00049 #include <srdfdom/model.h> // for testing a valid srdf is loaded 00050 #include <moveit/setup_assistant/tools/moveit_config_data.h> // common datastructure class 00051 #endif 00052 00053 #include "setup_screen_widget.h" // a base class for screens in the setup assistant 00054 00055 namespace moveit_setup_assistant 00056 { 00057 // Class Prototypes 00058 class SelectModeWidget; 00059 class LoadPathWidget; 00060 // class LoadURDFWidget; 00061 00065 class StartScreenWidget : public SetupScreenWidget 00066 { 00067 Q_OBJECT 00068 00069 public: 00070 // ****************************************************************************************** 00071 // Public Functions 00072 // ****************************************************************************************** 00073 00077 StartScreenWidget(QWidget* parent, moveit_setup_assistant::MoveItConfigDataPtr config_data); 00078 00079 ~StartScreenWidget(); 00080 00081 // ****************************************************************************************** 00082 // Qt Components 00083 // ****************************************************************************************** 00084 SelectModeWidget* select_mode_; 00085 LoadPathWidget* stack_path_; 00086 LoadPathWidget* urdf_file_; 00087 // LoadPathWidget *srdf_file_; 00088 QCheckBox* chk_use_jade_xacro_; 00089 QPushButton* btn_load_; 00090 QLabel* next_label_; 00091 QProgressBar* progress_bar_; 00092 QImage* right_image_; 00093 QLabel* right_image_label_; 00094 QImage* logo_image_; 00095 QLabel* logo_image_label_; 00096 00098 moveit_setup_assistant::MoveItConfigDataPtr config_data_; 00099 00100 private Q_SLOTS: 00101 00102 // ****************************************************************************************** 00103 // Slot Event Functions 00104 // ****************************************************************************************** 00105 00107 void showNewOptions(); 00108 00110 void showExistingOptions(); 00111 00113 void loadFilesClick(); 00114 00115 Q_SIGNALS: 00116 00117 // ****************************************************************************************** 00118 // Emitted Signal Functions 00119 // ****************************************************************************************** 00120 00122 void readyToProgress(); 00123 00125 void loadRviz(); 00126 00127 private: 00128 // ****************************************************************************************** 00129 // Variables 00130 // ****************************************************************************************** 00131 00133 bool create_new_package_; 00134 00135 // ****************************************************************************************** 00136 // Private Functions 00137 // ****************************************************************************************** 00138 00140 bool loadNewFiles(); 00141 00143 bool loadExistingFiles(); 00144 00146 bool loadURDFFile(const std::string& urdf_file_path, bool use_jade_xacro = false); 00147 00149 bool loadSRDFFile(const std::string& srdf_file_path); 00150 00152 bool setSRDFFile(const std::string& srdf_string); 00153 00155 bool extractPackageNameFromPath(); 00156 00158 bool createFullURDFPath(); 00159 00161 bool createFullSRDFPath(const std::string& package_path); 00162 00164 bool createFullPackagePath(); 00165 }; 00166 00167 // ****************************************************************************************** 00168 // ****************************************************************************************** 00169 // Class for selecting which mode 00170 // ****************************************************************************************** 00171 // ****************************************************************************************** 00172 00173 class SelectModeWidget : public QFrame 00174 { 00175 Q_OBJECT 00176 00177 private: 00178 private Q_SLOTS: 00179 00180 public: 00181 SelectModeWidget(QWidget* parent); 00182 00183 // Load file button 00184 QPushButton* btn_new_; 00185 QPushButton* btn_exist_; 00186 }; 00187 } 00188 00189 #endif