SaveEntityDialog.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2013 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef GAZEBO_GUI_SAVEENTITYDIALOG_HH_
18#define GAZEBO_GUI_SAVEENTITYDIALOG_HH_
19
20#include <string>
21#include <sdf/sdf.hh>
22#include "gazebo/gui/qt.h"
23#include "gazebo/util/system.hh"
24
25namespace gazebo
26{
27 namespace gui
28 {
29 class SaveEntityDialogPrivate;
30
33
36 class GZ_GUI_VISIBLE SaveEntityDialog : public QDialog
37 {
38 Q_OBJECT
39
42 public: enum SaveMode {
46 BUILDING
47 };
48
52 public: SaveEntityDialog(int _mode = 0, QWidget *_parent = 0);
53
56
59 public: std::string GetModelName() const;
60
63 public: std::string GetSaveLocation() const;
64
67 public: void SetModelName(const std::string &_name);
68
71 public: void SetSaveLocation(const std::string &_location);
72
75 public: std::string GetAuthorName() const;
76
79 public: std::string GetAuthorEmail() const;
80
83 public: std::string GetDescription() const;
84
87 public: std::string GetVersion() const;
88
94 public: void AddDirToModelPaths(const std::string &_path);
95
100 public: std::string GetFolderNameFromModelName(const std::string
101 &_modelName);
102
105 public: bool OnSaveAs();
106
108 private slots: void OnBrowse();
109
111 private slots: void OnCancel();
112
114 private slots: void OnAcceptSave();
115
118 private slots: void ModelNameChangedOnDialog(QString _modelName);
119
121 private: std::string GetTemplateConfigString();
122
124 public: void GenerateConfig();
125
127 public: void SaveToConfig();
128
131 public: void SaveToSDF(sdf::SDFPtr _modelSDF);
132
135 private slots: void ToggleAdvancedOptions(bool _checked);
136
139 private: SaveEntityDialogPrivate *dataPtr;
140 };
142 }
143}
144
145#endif
gui
Definition KeyEventHandler.hh:29
Dialog for saving to file.
Definition SaveEntityDialog.hh:37
std::string GetDescription() const
Get the model's description.
std::string GetSaveLocation() const
Get the save location.
void SaveToSDF(sdf::SDFPtr _modelSDF)
Save model to SDF format.
std::string GetAuthorName() const
Get the model's author's name.
void GenerateConfig()
Generate the config file.
void SetModelName(const std::string &_name)
Set the model name.
SaveMode
Unique identifiers for all dialog modes.
Definition SaveEntityDialog.hh:42
@ BUILDING
Save building.
Definition SaveEntityDialog.hh:46
@ MODEL
Save model.
Definition SaveEntityDialog.hh:44
void SaveToConfig()
Save config file.
std::string GetVersion() const
Get the model's version.
void AddDirToModelPaths(const std::string &_path)
Add the parent folder of _path to the model path represented by SystemPaths, notify InsertModelWidget...
bool OnSaveAs()
Call to execute the dialog.
void SetSaveLocation(const std::string &_location)
Set the save location.
std::string GetModelName() const
Get the model name.
std::string GetAuthorEmail() const
Get the model's author's email.
SaveEntityDialog(int _mode=0, QWidget *_parent=0)
Constructor.
std::string GetFolderNameFromModelName(const std::string &_modelName)
Helper function to generate a valid folder name from a human-readable model name.
Forward declarations for the common classes.
Definition Animation.hh:27