SaveDialog.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013-2016 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 
18 #ifndef _SAVE_DIALOG_HH_
19 #define _SAVE_DIALOG_HH_
20 
21 #include <string>
22 #include <sdf/sdf.hh>
23 #include "gazebo/gui/qt.h"
24 #include "gazebo/util/system.hh"
25 
26 namespace gazebo
27 {
28  namespace gui
29  {
30  class SaveDialogPrivate;
31 
34 
37  class GZ_GUI_VISIBLE SaveDialog : public QDialog
38  {
39  Q_OBJECT
40 
43  public: enum SaveMode {
47  BUILDING
48  };
49 
53  public: SaveDialog(int _mode = 0, QWidget *_parent = 0);
54 
56  public: ~SaveDialog();
57 
60  public: std::string GetModelName() const;
61 
64  public: std::string GetSaveLocation() const;
65 
68  public: void SetModelName(const std::string &_name);
69 
72  public: void SetSaveLocation(const std::string &_location);
73 
76  public: std::string GetAuthorName() const;
77 
80  public: std::string GetAuthorEmail() const;
81 
84  public: std::string GetDescription() const;
85 
88  public: std::string GetVersion() const;
89 
95  public: void AddDirToModelPaths(const std::string &_path);
96 
101  public: std::string GetFolderNameFromModelName(const std::string
102  &_modelName);
103 
106  public: bool OnSaveAs();
107 
109  private slots: void OnBrowse();
110 
112  private slots: void OnCancel();
113 
115  private slots: void OnAcceptSave();
116 
119  private slots: void ModelNameChangedOnDialog(QString _modelName);
120 
122  private: std::string GetTemplateConfigString();
123 
125  public: void GenerateConfig();
126 
128  public: void SaveToConfig();
129 
132  public: void SaveToSDF(sdf::SDFPtr _modelSDF);
133 
136  private slots: void ToggleAdvancedOptions(bool _checked);
137 
140  private: SaveDialogPrivate *dataPtr;
141  };
143  }
144 }
145 
146 #endif
Save model.
Definition: SaveDialog.hh:45
Dialog for saving to file.
Definition: SaveDialog.hh:37
SaveMode
Unique identifiers for all dialog modes.
Definition: SaveDialog.hh:43