00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2012, Willow Garage, Inc. 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * * Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * * Redistributions in binary form must reproduce the above 00015 * copyright notice, this list of conditions and the following 00016 * disclaimer in the documentation and/or other materials provided 00017 * with the distribution. 00018 * * Neither the name of Willow Garage, Inc. nor the names of its 00019 * contributors may be used to endorse or promote products derived 00020 * from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00025 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00026 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00027 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00028 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00029 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00030 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00031 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00032 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00033 * POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 */ 00036 00037 #ifndef PCL_MODELER_MAIN_WINDOW_H_ 00038 #define PCL_MODELER_MAIN_WINDOW_H_ 00039 00040 #include <pcl/apps/modeler/qt.h> 00041 #include <boost/shared_ptr.hpp> 00042 00043 #include <ui_main_window.h> 00044 00045 00046 namespace pcl 00047 { 00048 namespace modeler 00049 { 00050 class SceneTree; 00051 class AbstractItem; 00052 00053 class MainWindow : public QMainWindow 00054 { 00055 Q_OBJECT 00056 00057 public: 00058 static MainWindow& getInstance() { 00059 static MainWindow theSingleton; 00060 return theSingleton; 00061 } 00062 00063 QString 00064 getRecentFolder(); 00065 00066 RenderWindowItem* 00067 createRenderWindow(); 00068 00069 public slots: 00070 // slots for file menu 00071 void 00072 slotOpenProject(); 00073 void 00074 slotSaveProject(); 00075 void 00076 slotCloseProject(); 00077 void 00078 slotExit(); 00079 void 00080 slotUpdateRecentFile(const QString& filename); 00081 00082 // slots for view menu 00083 void 00084 slotCreateRenderWindow(); 00085 00086 void 00087 slotOnWorkerStarted(); 00088 00089 void 00090 slotOnWorkerFinished(); 00091 00092 private: 00093 // methods for file Menu 00094 void 00095 connectFileMenuActions(); 00096 void 00097 createRecentPointCloudActions(); 00098 void 00099 updateRecentPointCloudActions(); 00100 void 00101 createRecentProjectActions(); 00102 void 00103 updateRecentProjectActions(); 00104 bool 00105 openProjectImpl(const QString& filename); 00106 static void 00107 updateRecentActions(std::vector<boost::shared_ptr<QAction> >& recent_actions, QStringList& recent_items); 00108 00109 // methods for view menu 00110 void 00111 connectViewMenuActions(); 00112 00113 // methods for edit menu 00114 void 00115 connectEditMenuActions(); 00116 00117 // methods for global settings 00118 void 00119 loadGlobalSettings(); 00120 void 00121 saveGlobalSettings(); 00122 00123 private slots: 00124 void 00125 slotOpenRecentPointCloud(); 00126 void 00127 slotOpenRecentProject(); 00128 00129 private: 00130 friend class AbstractItem; 00131 00132 MainWindow(); 00133 MainWindow(const MainWindow &) : QMainWindow () {} // copy ctor hidden 00134 MainWindow& operator=(const MainWindow &) { return (*this); } // assign op. hidden 00135 ~MainWindow(); 00136 00137 Ui::MainWindow *ui_; // Designer form 00138 00139 // shortcuts for recent point clouds/projects 00140 QStringList recent_files_; 00141 QStringList recent_projects_; 00142 static const size_t MAX_RECENT_NUMBER = 8; 00143 std::vector<boost::shared_ptr<QAction> > recent_pointcloud_actions_; 00144 std::vector<boost::shared_ptr<QAction> > recent_project_actions_; 00145 }; 00146 } 00147 } 00148 00149 #endif // PCL_MODELER_MAIN_WINDOW_H_