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