VPTissue Reference Manual
WorkspaceWizard.h
Go to the documentation of this file.
1 #ifndef WORKSPACE_WIZARD_H_INCLUDED
2 #define WORKSPACE_WIZARD_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 <QWizard>
23 #include <QFileDialog>
24 #include <QListWidget>
25 #include <QComboBox>
26 #include <QLabel>
27 #include <QCheckBox>
28 #include <memory>
29 
30 namespace SimShell {
31 
32 namespace Ws {
33  class IWorkspaceFactory;
34 }
35 
36 namespace Gui {
37 
42 class WorkspaceWizard : public QWizard
43 {
44  Q_OBJECT
45 public:
46  WorkspaceWizard(const std::shared_ptr<Ws::IWorkspaceFactory>&, QWidget * parent = 0);
47 
53  std::string GetWorkspaceDir() const;
54 
55 private:
56  class PathPage;
57  class ExistingPage;
58  class InitPage;
59  class DonePage;
60 
61  enum { Page_Path, Page_Existing, Page_Init, Page_Done };
62 
63  std::shared_ptr<Ws::IWorkspaceFactory> m_workspace_factory;
64 };
65 
67 {
68  Q_OBJECT
69 public:
70  PathPage(const std::shared_ptr<Ws::IWorkspaceFactory>&);
71  virtual ~PathPage() {}
72 
73  virtual int nextId() const;
74 
75 private slots:
76  void showBrowseDialog();
77  void pathSelected(const QString &);
78 
79 private:
80  QFileDialog* dialog;
81 
82  std::shared_ptr<Ws::IWorkspaceFactory> m_workspace_factory;
83 
84 };
85 
88 {
89  Q_OBJECT
90 public:
91  ExistingPage(const std::shared_ptr<Ws::IWorkspaceFactory>&);
92  virtual ~ExistingPage() {}
93 
94  virtual void initializePage();
95  virtual int nextId() const;
96 
97 private:
98  QListWidget* projects;
99 
100  std::shared_ptr<Ws::IWorkspaceFactory> m_workspace_factory;
101 };
102 
105 {
106  Q_OBJECT
107 public:
108  InitPage(const std::shared_ptr<Ws::IWorkspaceFactory>&);
109  virtual ~InitPage() {}
110 
111  virtual void initializePage();
112  virtual int nextId() const;
113 
114 protected:
115  virtual bool validatePage();
116 
117 private:
118  QLabel* directory_label;
119 
120  std::shared_ptr<Ws::IWorkspaceFactory> m_workspace_factory;
121 };
122 
124 {
125  Q_OBJECT
126 public:
127  DonePage(const std::shared_ptr<Ws::IWorkspaceFactory>&);
128  virtual ~DonePage() {}
129 
130  virtual void initializePage();
131  virtual int nextId() const;
132 
133 signals:
134  void done(std::string const & workspace_dir);
135 
136 protected:
137  virtual bool validatePage();
138 
139 private:
140  QCheckBox* check_default;
141 
142  std::shared_ptr<Ws::IWorkspaceFactory> m_workspace_factory;
143 };
144 
145 } // namespace
146 } // namespace
147 
148 #endif // end_of_inclde_guard
Page shown when user specified a path that doesn't contain a workspace already.
std::string GetWorkspaceDir() const
After WorkspaceWizard::exec() returns QDialog::Accepted, this function will return workspace director...
see the online Qt documentation
A wizard that assists the user either specifying an existing workspace, or creating a new workspace...
see the online Qt documentation
see the online Qt documentation
Page shown when user specified an existing workspace.
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32