All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TL4LayerSelectionWizardPage.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/TL4LayerSelectionWizardPage.cpp
22 
23  \brief A wizard page for selecting the TerraLib 4.x.
24 */
25 
26 // TerraLib
27 #include "ui_TL4LayerSelectionWizardPageForm.h"
29 
30 // Qt
31 #include<QtGui/QListWidgetItem>
32 
34  : QWizardPage(parent),
35  m_ui(new Ui::TL4LayerSelectionWizardPageForm)
36 {
37 // setup controls
38  m_ui->setupUi(this);
39 
40  connect(m_ui->m_selectAllPushButton, SIGNAL(clicked()), this, SLOT(onSelectAllPushButtonClicked()));
41  connect(m_ui->m_deselectAllPushButton, SIGNAL(clicked()), this, SLOT(onDeselectAllPushButtonClicked()));
42 
43 }
44 
46 {
47 }
48 
50 {
51  m_ui->m_layersListWidget->clear();
52 
53  for(std::size_t i = 0; i < datasets.size(); ++i)
54  {
55  QListWidgetItem* item = new QListWidgetItem(datasets[i].c_str(), m_ui->m_layersListWidget);
56  item->setCheckState(Qt::Checked);
57  m_ui->m_layersListWidget->addItem(item);
58  }
59 }
60 
62 {
63  std::vector<std::string> checked;
64  for(int i = 0; i < m_ui->m_layersListWidget->count(); ++i)
65  {
66  if(m_ui->m_layersListWidget->item(i)->checkState() == Qt::Checked)
67  checked.push_back(m_ui->m_layersListWidget->item(i)->text().toStdString());
68  }
69 
70  return checked;
71 }
72 
74 {
75  for(int i = 0; i < m_ui->m_layersListWidget->count(); ++i)
76  {
77  if(m_ui->m_layersListWidget->item(i)->checkState() == Qt::Checked)
78  return true;
79  }
80 
81  return false;
82 }
83 
85 {
86  for(int i = 0; i < m_ui->m_layersListWidget->count(); ++i)
87  {
88  Qt::CheckState state = m_ui->m_layersListWidget->item(i)->checkState();
89  if(state != Qt::Checked)
90  m_ui->m_layersListWidget->item(i)->setCheckState(Qt::Checked);
91  }
92 }
93 
95 {
96  for(int i = 0; i < m_ui->m_layersListWidget->count(); ++i)
97  {
98  Qt::CheckState state = m_ui->m_layersListWidget->item(i)->checkState();
99  if(state == Qt::Checked)
100  m_ui->m_layersListWidget->item(i)->setCheckState(Qt::Unchecked);
101  }
102 }
std::auto_ptr< Ui::TL4LayerSelectionWizardPageForm > m_ui