VPTissue Reference Manual
SendPage.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 "SendPage.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 SendPage::SendPage(const std::shared_ptr<Exploration> &exploration)
61  : m_exploration(exploration)
62 {
63  setTitle("Send exploration");
64  setSubTitle("Give a name for the exploration.");
65 
66  QVBoxLayout* layout = new QVBoxLayout;
67 
68  m_name = new QLineEdit;
69  QRegExpValidator* regex = new QRegExpValidator(QRegExp("[A-Za-z\\d][A-Za-z\\d\\s]*"));
70  m_name->setValidator(regex);
71  layout->addWidget(m_name);
72 
73  setLayout(layout);
74 
75  setFinalPage(true);
76  setButtonText(QWizard::FinishButton, "Send");
77 
78  connect(m_name, SIGNAL(textChanged(const QString&)), this, SIGNAL(completeChanged()));
79 }
80 
81 
82 void SendPage::initializePage()
83 {
84  m_name->setText(QString::fromStdString(m_exploration->GetName()));
85  m_name->selectAll();
86 }
87 
88 
89 bool SendPage::isComplete() const
90 {
91  return m_name->text() != "";
92 }
93 
94 
95 bool SendPage::validatePage()
96 {
97  m_exploration->SetName(m_name->text().toStdString());
98 
99  return true;
100 }
101 
102 } // namespace
Interface for RangeSweep.
Interface for ListSweep.
Namespace for SimPT parameter explorer package.
Definition: Client.cpp:52
Interface for ParameterExploration.
Interface for SendPage.
Interface for FileExploration.