configuration_files_widget.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2012, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Dave Coleman */
36 
37 #ifndef MOVEIT_ROS_MOVEIT_SETUP_ASSISTANT_WIDGETS_CONFIGURATION_FILES_WIDGET_
38 #define MOVEIT_ROS_MOVEIT_SETUP_ASSISTANT_WIDGETS_CONFIGURATION_FILES_WIDGET_
39 
40 #include <QWidget>
41 #include <QPushButton>
42 #include <QString>
43 #include <QProgressBar>
44 #include <QLabel>
45 #include <QListWidget>
46 #include <QList>
47 
48 #ifndef Q_MOC_RUN
50 #endif
51 
52 #include "header_widget.h"
53 #include "setup_screen_widget.h" // a base class for screens in the setup assistant
54 
55 namespace moveit_setup_assistant
56 {
57 // Struct for storing all the file operations
59 {
61  {
62  }
63  std::string file_name_;
64  std::string rel_path_;
65  std::string description_;
66  unsigned long write_on_changes; // bitfield indicating required rewrite
67  bool generate_; // "generate" checkbox ticked?
68  bool modified_; // file externally modified?
69  boost::function<bool(std::string)> gen_func_;
70 };
71 
72 // Typedef for storing template string replacement pairs
73 typedef std::vector<std::pair<std::string, std::string> > StringPairVector;
74 
75 // Class
77 {
78  Q_OBJECT
79 
80 public:
81  // ******************************************************************************************
82  // Public Functions
83  // ******************************************************************************************
84 
85  ConfigurationFilesWidget(QWidget* parent, moveit_setup_assistant::MoveItConfigDataPtr config_data);
86 
88  virtual void focusGiven();
89 
90  // ******************************************************************************************
91  // Qt Components
92  // ******************************************************************************************
93  QPushButton* btn_save_;
95  QProgressBar* progress_bar_;
96  QListWidget* action_list_;
97  QLabel* action_label_;
98  QLabel* success_label_;
99  QList<QString> action_desc_; // Holds the descriptions explaining all performed actions
100 
101 private Q_SLOTS:
102 
103  // ******************************************************************************************
104  // Slot Event Functions
105  // ******************************************************************************************
106 
108  void savePackage();
109 
111  bool generatePackage();
112 
114  void exitSetupAssistant();
115 
117  void changeActionDesc(int id);
118 
120  void changeCheckedState(QListWidgetItem* item);
121 
122 private:
123  // ******************************************************************************************
124  // Variables
125  // ******************************************************************************************
126 
128  moveit_setup_assistant::MoveItConfigDataPtr config_data_;
129 
131  std::string new_package_name_;
132 
134  unsigned int action_num_;
135 
138 
141 
143  std::vector<GenerateFile> gen_files_;
144 
146  StringPairVector template_strings_;
147 
148  // ******************************************************************************************
149  // Private Functions
150  // ******************************************************************************************
151 
153  bool loadGenFiles();
154 
157  bool checkGenFiles();
158 
160  bool showGenFiles();
161 
163  bool checkDependencies();
164 
166  void updateProgress();
167 
169  const std::string getPackageName(std::string package_path);
170 
172  bool noGroupsEmpty();
173 
178  void loadTemplateStrings();
179 
186  bool addTemplateString(const std::string& key, const std::string& value);
187 
197  bool copyTemplate(const std::string& template_path, const std::string& output_path);
198 
204  bool createFolder(const std::string& output_path);
205 };
206 
207 } // namespace moveit_setup_assistant
208 
209 #endif
std::string new_package_name_
Name of the new package that is being (or going) to be generated, based on user specified save path...
moveit_setup_assistant::MoveItConfigDataPtr config_data_
Contains all the configuration data for the setup assistant.
bool has_generated_pkg_
Has the package been generated yet this program execution? Used for popping up exit warning...
StringPairVector template_strings_
Vector of all strings to search for in templates, and their replacements.
std::vector< std::pair< std::string, std::string > > StringPairVector
bool first_focusGiven_
Populate the &#39;Files to be Generated&#39; list just once.
std::vector< GenerateFile > gen_files_
Vector of all files to be generated.
boost::function< bool(std::string)> gen_func_


moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Wed Jul 10 2019 04:04:33