VPTissue Reference Manual
NewProjectDialog.h
Go to the documentation of this file.
1 #ifndef NEWPROJECTDIALOG_H_INCLUDED
2 #define NEWPROJECTDIALOG_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include "workspace/IWorkspace.h"
23 
24 #include <QComboBox>
25 #include <QDialog>
26 #include <QFileDialog>
27 #include <QLineEdit>
28 #include <QPushButton>
29 #include <QRadioButton>
30 
31 #include <memory>
32 
33 namespace SimShell {
34 
35 namespace Ws {
36  class IWorkspaceFactory;
37 }
38 
39 namespace Gui {
40 
47 class NewProjectDialog : public QDialog
48 {
49  Q_OBJECT
50 public:
51  NewProjectDialog(const std::shared_ptr<Ws::IWorkspaceFactory>&, QWidget* parent = nullptr);
52 
56  std::string GetProjectName() const;
57 
61  std::string GetSrcPath() const;
62 
66  Ws::IWorkspace::ConstProjectIterator GetSrcProject() const;
67 
71  bool IsCopyProject() const;
72 
73 private slots:
78  void Cancel();
79 
84  void FileChanged(bool use_default);
85 
90  void FileChanged(QString const& filename);
91 
96  void ProjectNameChanged(QString const& name);
97 
102  void Ok();
103 
108  void ShowBrowseDialog();
109 
110 private:
114  void ValidateForm();
115 
116 private:
117  bool project_name_ok;
118  bool file_ok;
119 
120  std::shared_ptr<Ws::IWorkspace> m_workspace_model;
121 
122  QPushButton* m_button_cancel;
123  QPushButton* m_button_ok;
124  QComboBox* m_combo_models;
125  QFileDialog* m_dialog;
126  QLineEdit* m_edit_custom;
127  QLineEdit* m_edit_name;
128  QRadioButton* m_radio_custom;
129  QRadioButton* m_radio_default;
130 };
131 
132 } // namespace
133 } // namespace
134 
135 #endif // end_of_inclde_guard
std::string GetSrcPath() const
Get path of custom file select by user.
Ws::IWorkspace::ConstProjectIterator GetSrcProject() const
Get project selected by user.
Dialog that asks user about information for setting up a new project.
Interface for IWorkspace.
bool IsCopyProject() const
Whether user wants to copy an existing project from template workspace or just copy a single data fil...
std::string GetProjectName() const
Get project name string entered by user.
see the online Qt documentation
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32
see the online Qt documentation