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 
28 #include <QFileDialog>
29 
30 #include <ArmarXGui/gui-plugins/ScenarioManager/gui/ui_namelocationview.h>
31 
32 NameLocationView::NameLocationView(QWidget* parent) : QDialog(parent), ui(new Ui::NameLocationView)
33 {
34  ui->setupUi(this);
35  ui->okButton->setDefault(true);
36 }
37 
39 {
40  delete ui;
41 }
42 
43 void
44 NameLocationView::on_locationChooserButton_clicked()
45 {
46  QDir directory(".");
47  QString path = QFileDialog::getExistingDirectory(this, tr("Directory"), directory.path());
48  if (path.isNull() == false)
49  {
50  this->path = path.toStdString();
51  }
52 }
53 
54 void
55 NameLocationView::on_nameLineEdit_textChanged(const QString& text)
56 {
57  name = text.toStdString();
58 }
59 
60 void
61 NameLocationView::on_okButton_clicked()
62 {
63  if (name.length() != 0 && path.length() != 0)
64  {
65  emit created(name, path);
66  accept();
67  }
68 }
69 
70 void
71 NameLocationView::on_cancelButton_clicked()
72 {
73  reject();
74 }
75 
76 void
77 NameLocationView::on_nameLineEdit_editingFinished()
78 {
79 }
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:32
NameLocationView::created
void created(std::string name, std::string path)