All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 "ui_TL4FinalPageWizardPageForm.h"
28 #include "TL4FinalPageWizardPage.h"
29 
31  : QWizardPage(parent),
32  m_ui(new Ui::TL4FinalPageWizardPageForm)
33 {
34 // setup controls
35  m_ui->setupUi(this);
36 
37  connect(m_ui->m_selectAllPushButton, SIGNAL(clicked()), this, SLOT(onSelectAllPushButtonClicked()));
38  connect(m_ui->m_deselectAllPushButton, SIGNAL(clicked()), this, SLOT(onDeselectAllPushButtonClicked()));
39 }
40 
42 {
43 }
44 
45 void te::qt::plugins::terralib4::TL4FinalPageWizardPage::setDataSets(const std::vector<std::string>& datasets)
46 {
47  m_ui->m_layersListWidget->clear();
48 
49  for(std::size_t i = 0; i < datasets.size(); ++i)
50  {
51  QListWidgetItem* item = new QListWidgetItem(datasets[i].c_str(), m_ui->m_layersListWidget);
52 
53  item->setCheckState(Qt::Checked);
54 
55  m_ui->m_layersListWidget->addItem(item);
56  }
57 }
58 
60 {
61  std::vector<std::string> checked;
62 
63  for(int i = 0; i < m_ui->m_layersListWidget->count(); ++i)
64  {
65  if(m_ui->m_layersListWidget->item(i)->checkState() == Qt::Checked)
66  checked.push_back(m_ui->m_layersListWidget->item(i)->text().toStdString());
67  }
68 
69  return checked;
70 }
71 
73 {
74  for(int i = 0; i < m_ui->m_layersListWidget->count(); ++i)
75  {
76  Qt::CheckState state = m_ui->m_layersListWidget->item(i)->checkState();
77 
78  if(state != Qt::Checked)
79  m_ui->m_layersListWidget->item(i)->setCheckState(Qt::Checked);
80  }
81 }
82 
84 {
85  for(int i = 0; i < m_ui->m_layersListWidget->count(); ++i)
86  {
87  Qt::CheckState state = m_ui->m_layersListWidget->item(i)->checkState();
88 
89  if(state == Qt::Checked)
90  m_ui->m_layersListWidget->item(i)->setCheckState(Qt::Unchecked);
91  }
92 }
void setDataSets(const std::vector< std::string > &datasets)
std::auto_ptr< Ui::TL4FinalPageWizardPageForm > m_ui