namelocationview.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarXCore::core
19  * @author Cedric Seehausen (usdnr at kit dot edu)
20  * @date 2016
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 
26 #include "namelocationview.h"
27 #include <ArmarXGui/gui-plugins/ScenarioManager/gui/ui_namelocationview.h>
28 #include <QFileDialog>
29 
31  QDialog(parent),
32  ui(new Ui::NameLocationView)
33 {
34  ui->setupUi(this);
35  ui->okButton->setDefault(true);
36 }
37 
39 {
40  delete ui;
41 }
42 
43 void NameLocationView::on_locationChooserButton_clicked()
44 {
45  QDir directory(".");
46  QString path = QFileDialog::getExistingDirectory(this, tr("Directory"), directory.path());
47  if (path.isNull() == false)
48  {
49  this->path = path.toStdString();
50  }
51 }
52 
53 void NameLocationView::on_nameLineEdit_textChanged(const QString& text)
54 {
55  name = text.toStdString();
56 }
57 
58 void NameLocationView::on_okButton_clicked()
59 {
60  if (name.length() != 0 && path.length() != 0)
61  {
62  emit created(name, path);
63  accept();
64  }
65 }
66 
67 void NameLocationView::on_cancelButton_clicked()
68 {
69  reject();
70 }
71 
72 void NameLocationView::on_nameLineEdit_editingFinished()
73 {
74 }
namelocationview.h
NameLocationView
View that allows to choose the name and the location of something.
Definition: namelocationview.h:39
Ui
ArmarX Headers.
Definition: ArmarXMainWindow.h:54
NameLocationView::~NameLocationView
~NameLocationView() override
Destructor.
Definition: namelocationview.cpp:38
NameLocationView::NameLocationView
NameLocationView(QWidget *parent=0)
Constructor that sets up the ui.
Definition: namelocationview.cpp:30
NameLocationView::created
void created(std::string name, std::string path)