All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AddColumnDialog.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 #include "AddColumnDialog.h"
21 
22 #include "../../../datatype/DateTimeProperty.h"
23 #include "../../../datatype/SimpleProperty.h"
24 
25 #include <ui_AddColumnDialogForm.h>
26 
27 te::dt::Property* GetProperty(const QString& propertyType)
28 {
29  if(propertyType.compare(QObject::tr("Integer")) == 0)
31  else if(propertyType.compare(QObject::tr("Real")) == 0)
33  else if(propertyType.compare(QObject::tr("String")) == 0)
35  else if(propertyType.compare(QObject::tr("Date")) == 0)
36  return new te::dt::DateTimeProperty("");
37 
38  return 0;
39 }
40 
42 QDialog(parent)
43 {
44  m_ui.reset(new Ui::AddColumnDialogForm);
45  m_ui->setupUi(this);
46 
47  m_ui->m_helpBTN->setPageReference("widgets/table/addColumn.html");
48 
49  connect(m_ui->m_cancelBTN, SIGNAL(pressed()), SLOT(reject()));
50  connect(m_ui->m_okBTN, SIGNAL(pressed()), SLOT(accept()));
51 }
52 
54 {
55 }
56 
58 {
59  te::dt::Property* pr = GetProperty(m_ui->m_colTypeCBB->currentText());
60 
61  pr->setName(m_ui->m_colNameLNE->text().toStdString());
62 
63  return pr;
64 }
65 
67 {
68  m_ui->m_tblNameCBB->addItem(name.c_str());
69 }
An atomic property like an integer or double.
te::dt::Property * GetProperty(const QString &propertyType)
void setTableName(const std::string &name)
It models a property definition.
Definition: Property.h:59
void setName(const std::string &name)
It sets the property name.
Definition: Property.h:137
te::dt::Property * getNewProperty() const
A Qt dialog for inserting columns into a table.
std::auto_ptr< Ui::AddColumnDialogForm > m_ui
The type for date and time types: date, date period, date duration, time duration, time instant, time period, time instant with time zone or time period with time zone.