All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TL4FinalPageWizardPage.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/plugins/terralib4/TL4FinalPageWizardPage.cpp
22 
23  \brief A wizard page for selecting converted datasets to layers in TerraLib 5.
24 */
25 
26 // TerraLib
27 #include "../../../../common/StringUtils.h"
28 #include "ui_TL4FinalPageWizardPageForm.h"
29 #include "TL4FinalPageWizardPage.h"
30 
32  : QWizardPage(parent),
33  m_ui(new Ui::TL4FinalPageWizardPageForm)
34 {
35 // setup controls
36  m_ui->setupUi(this);
37 
38  connect(m_ui->m_selectAllPushButton, SIGNAL(clicked()), this, SLOT(onSelectAllPushButtonClicked()));
39  connect(m_ui->m_deselectAllPushButton, SIGNAL(clicked()), this, SLOT(onDeselectAllPushButtonClicked()));
40 }
41 
43 {
44 }
45 
46 void te::qt::plugins::terralib4::TL4FinalPageWizardPage::setDataSets(const std::vector<std::string>& datasets)
47 {
48  m_ui->m_layersListWidget->clear();
49 
50  for(std::size_t i = 0; i < datasets.size(); ++i)
51  {
52  QListWidgetItem* item = new QListWidgetItem(QString::fromLatin1(datasets[i].c_str()), m_ui->m_layersListWidget);
53 
54  item->setCheckState(Qt::Checked);
55 
56  m_ui->m_layersListWidget->addItem(item);
57  }
58 }
59 
61 {
62  std::vector<std::string> checked;
63 
64  for(int i = 0; i < m_ui->m_layersListWidget->count(); ++i)
65  {
66  QListWidgetItem* item = m_ui->m_layersListWidget->item(i);
67 
68  if(item->checkState() != Qt::Checked)
69  continue;
70 
71  std::string aux = m_ui->m_layersListWidget->item(i)->text().toLatin1();
72 
73  checked.push_back(aux);
74  }
75 
76  return checked;
77 }
78 
80 {
81  for(int i = 0; i < m_ui->m_layersListWidget->count(); ++i)
82  {
83  Qt::CheckState state = m_ui->m_layersListWidget->item(i)->checkState();
84 
85  if(state != Qt::Checked)
86  m_ui->m_layersListWidget->item(i)->setCheckState(Qt::Checked);
87  }
88 }
89 
91 {
92  for(int i = 0; i < m_ui->m_layersListWidget->count(); ++i)
93  {
94  Qt::CheckState state = m_ui->m_layersListWidget->item(i)->checkState();
95 
96  if(state == Qt::Checked)
97  m_ui->m_layersListWidget->item(i)->setCheckState(Qt::Unchecked);
98  }
99 }
void setDataSets(const std::vector< std::string > &datasets)
std::auto_ptr< Ui::TL4FinalPageWizardPageForm > m_ui