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) 2011-2012 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(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(std::size_t 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  checked.push_back(m_ui->m_layersListWidget->item(i)->text().toStdString());
72  }
73 
74  return checked;
75 }
76 
78 {
79  for(std::size_t i = 0; i < m_ui->m_layersListWidget->count(); ++i)
80  {
81  Qt::CheckState state = m_ui->m_layersListWidget->item(i)->checkState();
82 
83  if(state != Qt::Checked)
84  m_ui->m_layersListWidget->item(i)->setCheckState(Qt::Checked);
85  }
86 }
87 
89 {
90  for(std::size_t i = 0; i < m_ui->m_layersListWidget->count(); ++i)
91  {
92  Qt::CheckState state = m_ui->m_layersListWidget->item(i)->checkState();
93 
94  if(state == Qt::Checked)
95  m_ui->m_layersListWidget->item(i)->setCheckState(Qt::Unchecked);
96  }
97 }
void setDataSets(const std::vector< std::string > &datasets)
std::auto_ptr< Ui::TL4FinalPageWizardPageForm > m_ui