Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "stdr_gui/stdr_gui_loader.h"
00023
00024 namespace stdr_gui
00025 {
00032 CGuiLoader::CGuiLoader(int argc,char **argv):
00033 argc_(argc),
00034 argv_(argv)
00035 {
00036 setupUi(this);
00037
00038 addToolbarIcons();
00039 close_signal_ = false;
00040 }
00041
00046 void CGuiLoader::addToolbarIcons(void)
00047 {
00048
00049 QIcon applicationIcon;
00050 applicationIcon.addFile(QString::fromUtf8((
00051 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00052 std::string("/resources/images/favicon.ico")).c_str()),
00053 QSize(),
00054 QIcon::Normal,
00055 QIcon::Off);
00056 setWindowIcon (applicationIcon);
00057
00058 actionLoadMap = new QAction(this);
00059 actionLoadMap->setObjectName(QString::fromUtf8("actionLoadMap"));
00060 actionLoadMap->setCheckable(false);
00061 actionLoadMap->setIconText(QString("Load map"));
00062 QIcon iconLoadMap;
00063
00064
00065 iconLoadMap.addFile(QString::fromUtf8((
00066 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00067 std::string("/resources/images/load_map.png")).c_str()),
00068 QSize(),
00069 QIcon::Normal,
00070 QIcon::Off);
00071 actionLoadMap->setIcon(iconLoadMap);
00072 toolBar->addAction(actionLoadMap);
00073
00074 toolBar->addSeparator();
00075
00076 actionAddRobot = new QAction(this);
00077 actionAddRobot->setObjectName(QString::fromUtf8("actionNewRobot"));
00078 actionAddRobot->setCheckable(false);
00079 actionAddRobot->setIconText(QString("Load robot"));
00080 QIcon iconAddRobot;
00081 iconAddRobot.addFile(QString::fromUtf8((
00082 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00083 std::string("/resources/images/add_robot.png")).c_str()),
00084 QSize(),
00085 QIcon::Normal,
00086 QIcon::Off);
00087 actionAddRobot->setIcon(iconAddRobot);
00088 toolBar->addAction(actionAddRobot);
00089
00090 actionNewRobot = new QAction(this);
00091 actionNewRobot->setObjectName(QString::fromUtf8("actionNewRobot"));
00092 actionNewRobot->setCheckable(false);
00093 actionNewRobot->setIconText(QString("Create robot"));
00094 QIcon iconNewRobot;
00095 iconNewRobot.addFile(QString::fromUtf8((
00096 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00097 std::string("/resources/images/new_robot.png")).c_str()),
00098 QSize(),
00099 QIcon::Normal,
00100 QIcon::Off);
00101 actionNewRobot->setIcon(iconNewRobot);
00102 toolBar->addAction(actionNewRobot);
00103
00104 toolBar->addSeparator();
00105
00106 actionNewRfid = new QAction(this);
00107 actionNewRfid->setObjectName(QString::fromUtf8("actionNewRfid"));
00108 actionNewRfid->setCheckable(false);
00109 actionNewRfid->setIconText(QString("Add RFID tag"));
00110 QIcon iconNewRfid;
00111 iconNewRfid.addFile(QString::fromUtf8((
00112 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00113 std::string("/resources/images/rfid.png")).c_str()),
00114 QSize(),
00115 QIcon::Normal,
00116 QIcon::Off);
00117 actionNewRfid->setIcon(iconNewRfid);
00118 toolBar->addAction(actionNewRfid);
00119
00120 actionNewThermal = new QAction(this);
00121 actionNewThermal->setObjectName(QString::fromUtf8("actionNewThermal"));
00122 actionNewThermal->setCheckable(false);
00123 actionNewThermal->setIconText(QString("Add heat source"));
00124 QIcon iconNewThermal;
00125 iconNewThermal.addFile(QString::fromUtf8((
00126 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00127 std::string("/resources/images/thermal.png")).c_str()),
00128 QSize(),
00129 QIcon::Normal,
00130 QIcon::Off);
00131
00132 actionNewThermal->setIcon(iconNewThermal);
00133 toolBar->addAction(actionNewThermal);
00134
00135 actionNewCo2 = new QAction(this);
00136 actionNewCo2->setObjectName(QString::fromUtf8("actionNewCo2"));
00137 actionNewCo2->setCheckable(false);
00138 actionNewCo2->setIconText(QString("Add CO2 source"));
00139 QIcon iconNewCo2;
00140 iconNewCo2.addFile(QString::fromUtf8((
00141 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00142 std::string("/resources/images/co2.png")).c_str()),
00143 QSize(),
00144 QIcon::Normal,
00145 QIcon::Off);
00146 actionNewCo2->setIcon(iconNewCo2);
00147 toolBar->addAction(actionNewCo2);
00148
00149 actionNewSound = new QAction(this);
00150 actionNewSound->setObjectName(QString::fromUtf8("actionNewSound"));
00151 actionNewSound->setCheckable(false);
00152 actionNewSound->setIconText(QString("Add sound source"));
00153 QIcon iconNewSound;
00154 iconNewSound.addFile(QString::fromUtf8((
00155 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00156 std::string("/resources/images/sound.png")).c_str()),
00157 QSize(),
00158 QIcon::Normal,
00159 QIcon::Off);
00160 actionNewSound->setIcon(iconNewSound);
00161 toolBar->addAction(actionNewSound);
00162
00163 toolBar->addSeparator();
00164
00165 actionProperties = new QAction(this);
00166 actionProperties->setObjectName(QString::fromUtf8("actionProperties"));
00167 actionProperties->setCheckable(false);
00168 actionProperties->setIconText(QString("Properties"));
00169 QIcon iconProperties;
00170 iconProperties.addFile(QString::fromUtf8((
00171 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00172 std::string("/resources/images/properties.png")).c_str()),
00173 QSize(),
00174 QIcon::Normal,
00175 QIcon::Off);
00176 actionProperties->setIcon(iconProperties);
00177 toolBar->addAction(actionProperties);
00178
00179 toolBar->addSeparator();
00180
00181 actionGrid = new QAction(this);
00182 actionGrid->setObjectName(QString::fromUtf8("actionGrid"));
00183 actionGrid->setCheckable(true);
00184 actionGrid->setChecked(false);
00185 actionGrid->setIconText(QString("Enable grid"));
00186 QIcon iconGrid;
00187 iconGrid.addFile(QString::fromUtf8((
00188 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00189 std::string("/resources/images/grid.png")).c_str()),
00190 QSize(),
00191 QIcon::Normal,
00192 QIcon::Off);
00193 actionGrid->setIcon(iconGrid);
00194 toolBar->addAction(actionGrid);
00195
00196 actionZoomIn = new QAction(this);
00197 actionZoomIn->setObjectName(QString::fromUtf8("actionZoomIn"));
00198 actionZoomIn->setCheckable(true);
00199 actionZoomIn->setIconText(QString("Zoom in"));
00200 QIcon iconZoomIn;
00201 iconZoomIn.addFile(QString::fromUtf8((
00202 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00203 std::string("/resources/images/zoom_in_b.png")).c_str()),
00204 QSize(),
00205 QIcon::Normal,
00206 QIcon::Off);
00207 actionZoomIn->setIcon(iconZoomIn);
00208 toolBar->addAction(actionZoomIn);
00209
00210 actionZoomOut = new QAction(this);
00211 actionZoomOut->setObjectName(QString::fromUtf8("actionZoomOut"));
00212 actionZoomOut->setCheckable(true);
00213 actionZoomOut->setIconText(QString("Zoom out"));
00214 QIcon iconZoomOut;
00215 iconZoomOut.addFile(QString::fromUtf8((
00216 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00217 std::string("/resources/images/zoom_out_b.png")).c_str()),
00218 QSize(),
00219 QIcon::Normal,
00220 QIcon::Off);
00221 actionZoomOut->setIcon(iconZoomOut);
00222 toolBar->addAction(actionZoomOut);
00223
00224 actionAdjusted = new QAction(this);
00225 actionAdjusted->setObjectName(QString::fromUtf8("actionAdjusted"));
00226 actionAdjusted->setCheckable(false);
00227 actionAdjusted->setChecked(true);
00228 actionAdjusted->setIconText(QString("Adjust size"));
00229 QIcon iconAdjust;
00230 iconAdjust.addFile(QString::fromUtf8((
00231 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00232 std::string("/resources/images/adjusted.png")).c_str()),
00233 QSize(),
00234 QIcon::Normal,
00235 QIcon::Off);
00236 actionAdjusted->setIcon(iconAdjust);
00237 toolBar->addAction(actionAdjusted);
00238
00239 toolBar->setIconSize(QSize(30,30));
00240 }
00241
00247 void CGuiLoader::closeEvent(QCloseEvent *event)
00248 {
00249
00250 if(close_signal_)
00251 {
00252 event->accept();
00253
00254 ros::shutdown();
00255 exit(0);
00256 return;
00257 }
00258 close_signal_ = true;
00259 event->ignore();
00260 event_ = event;
00261 }
00262
00267 QEvent* CGuiLoader::getCloseEvent(void)
00268 {
00269 return event_;
00270 }
00271
00276 bool CGuiLoader::closeTriggered(void)
00277 {
00278 return close_signal_;
00279 }
00280
00285 void CGuiLoader::shutdown(void)
00286 {
00287 this->close();
00288 }
00289 }