All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ParameterDialog.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 /*!
21  \file terralib/qt/widgets/utils/ParameterDialog.cpp
22 
23  \brief A dialog to be used as input of key/value pairs.
24 */
25 
26 // TerraLib
27 #include "ui_ParameterDialogForm.h"
28 #include "ParameterDialog.h"
29 
30 
31 te::qt::widgets::ParameterDialog::ParameterDialog(QWidget* parent, Qt::WindowFlags f)
32  : QDialog(parent, f),
33  m_ui(new Ui::ParameterDialogForm)
34 {
35  m_ui->setupUi(this);
36 
37  connect(m_ui->m_paramNameLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(onParamNameTextEdited(const QString&)));
38  connect(m_ui->m_paramValueLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(onParamValueTextEdited(const QString&)));
39 }
40 
42 {
43 }
44 
46 {
47  return m_ui->m_paramNameLineEdit->text().trimmed();
48 }
49 
51 {
52  m_pname = name;
53  m_ui->m_paramNameLineEdit->setText(name);
54 }
55 
57 {
58  return m_ui->m_paramValueLineEdit->text().trimmed();
59 }
60 
62 {
63  m_pvalue = value;
64  m_ui->m_paramValueLineEdit->setText(value);
65 }
66 
68 {
69  if(nextTxt != m_pname)
70  m_ui->m_okPushButton->setEnabled(true);
71  else if(m_pvalue == m_ui->m_paramValueLineEdit->text())
72  m_ui->m_okPushButton->setEnabled(false);
73 }
74 
76 {
77  if(nextTxt != m_pvalue)
78  m_ui->m_okPushButton->setEnabled(true);
79  else if(m_pname == m_ui->m_paramNameLineEdit->text())
80  m_ui->m_okPushButton->setEnabled(false);
81 }
82 
std::auto_ptr< Ui::ParameterDialogForm > m_ui
void onParamValueTextEdited(const QString &nextTxt)
ParameterDialog(QWidget *parent=0, Qt::WindowFlags f=0)
void onParamNameTextEdited(const QString &nextTxt)
void setValue(const QString &value)
void setName(const QString &name)
A dialog to be used as input of key/value pairs.