VPTissue Reference Manual
StartPage.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "StartPage.h"
21 
26 
27 #include <boost/property_tree/exceptions.hpp>
28 #include <boost/property_tree/xml_parser.hpp>
29 #include <QComboBox>
30 #include <QDoubleValidator>
31 #include <QFileDialog>
32 #include <QFormLayout>
33 #include <QLabel>
34 #include <QLineEdit>
35 #include <QListView>
36 #include <QListWidget>
37 #include <QMessageBox>
38 #include <QPushButton>
39 #include <QRadioButton>
40 #include <QRegExp>
41 #include <QRegExpValidator>
42 #include <QSettings>
43 #include <QString>
44 #include <QVBoxLayout>
45 
46 #include <algorithm>
47 #include <cctype>
48 #include <fstream>
49 #include <functional>
50 #include <iostream>
51 #include <locale>
52 #include <memory>
53 #include <sstream>
54 
55 using namespace boost::property_tree;
56 using namespace boost::property_tree::xml_parser;
57 
58 namespace SimPT_Parex {
59 
60 StartPage::StartPage(std::shared_ptr<Exploration> &exploration, const std::shared_ptr<const Exploration> &lastExploration)
61  : m_exploration(exploration), m_last_exploration(lastExploration)
62 {
63  setTitle("Select load");
64  setSubTitle("Please select the way to load an exploration.");
65 
66  QVBoxLayout* layout = new QVBoxLayout;
67 
68  m_select_new_sweep = new QRadioButton("New sweep based exploration");
69  m_select_new_file = new QRadioButton("New file based exploration");
70  m_select_new_template = new QRadioButton("New template based exploration");
71  m_select_edit = new QRadioButton("Edit previous exploration");
72  m_select_send = new QRadioButton("Re-send previous exploration");
73 
74  layout->addWidget(m_select_new_sweep);
75  layout->addWidget(m_select_new_file);
76  layout->addWidget(m_select_new_template);
77  layout->addWidget(m_select_edit);
78  layout->addWidget(m_select_send);
79 
80  m_select_new_sweep->setChecked(true);
81  m_select_edit->setEnabled(m_last_exploration != nullptr && dynamic_cast<const ParameterExploration*>(m_last_exploration.get()));
82  m_select_send->setEnabled(m_last_exploration != nullptr);
83 
84  setLayout(layout);
85 }
86 
88 
89 bool StartPage::validatePage()
90 {
91  if (m_select_edit->isChecked() || m_select_send->isChecked()) {
92  assert(!m_select_edit->isChecked() || dynamic_cast<const ParameterExploration*>(m_last_exploration.get())); // m_select_edit->isChecked() implies (=>) dynamic_pointer_cast<const ParameterExploration>(lastExploration)
93  m_exploration = std::shared_ptr<Exploration>(m_last_exploration->Clone());
94  }
95 
96  return true;
97 }
98 
99 int StartPage::nextId() const
100 {
101  if (m_select_new_sweep->isChecked())
102  return Page_Path;
103  else if (m_select_new_file->isChecked())
104  return Page_Files;
105  else if (m_select_new_template->isChecked())
106  return Page_Template_Path;
107  else if (m_select_edit->isChecked())
108  return Page_Param;
109  else if (m_select_send->isChecked())
110  return Page_Send;
111  return -1;
112 }
113 
114 } // namespace
Interface for StartPage.
Interface for RangeSweep.
virtual ~StartPage()
Destructor.
Definition: StartPage.cpp:87
Interface for ListSweep.
Namespace for SimPT parameter explorer package.
Definition: Client.cpp:52
Class describing a parameter exploration and its simulation tasks.
Interface for ParameterExploration.
Interface for FileExploration.