8 #include <terralib/qt/widgets/dataview/TabularViewer.h> 9 #include <terralib/Config.h> 13 #include <terralib/dataaccess/datasource/DataSourceCatalogLoader.h> 18 #include <QGridLayout> 19 #include <QVBoxLayout> 20 #include <QPushButton> 21 #include <QMessageBox> 25 #include <QInputDialog> 37 std::map<std::string, std::string> connInfo;
38 connInfo[
"SOURCE"] = src ;
43 return (res) ? ds : 0;
52 te::da::DataSourceCatalogLoader* cloader = transactor->getCatalogLoader();
55 boost::ptr_vector<std::string> datasets;
57 cloader->getDataSets(datasets);
73 QMenuBar* mbar=
new QMenuBar(wd);
74 QMenu* file_mnu =
new QMenu(QObject::tr(
"File"), mbar);
75 QAction* act =
new QAction(QObject::tr(
"Change icons theme..."), file_mnu);
77 file_mnu->addAction(act);
78 mbar->addMenu(file_mnu);
85 tv =
new te::qt::widgets::TabularViewer(wd);
87 QVBoxLayout* vlay =
new QVBoxLayout;
88 QGridLayout* grdLay =
new QGridLayout(wid);
101 tv->setItemDelegate(st);
104 tv->updatePopupMenus();
110 vlay->addWidget(btn);
113 grdLay->addLayout(vlay, 0, 0, 1, 1);
115 tab->addTab(wid, QObject::tr(
"Data viewer"));
116 tab->addTab(pkeySel, QObject::tr(
"Primary keys"));
117 tab->addTab(
new HighlightedInfo(tv, wd), QObject::tr(
"Query by primary key"));
119 tab->setTabEnabled(1,
false);
120 tab->setTabEnabled(2,
false);
122 wd->setCentralWidget(tab);
125 wd->connect(btn, SIGNAL(pressed()), SLOT(updateViewer()));
126 tv->connect(pkeySel, SIGNAL(pkeysChanged(
const std::vector<size_t>&)), SLOT(setPrimaryKeys(
const std::vector<size_t>&)));
127 wd->connect(pkeySel, SIGNAL(pkeysChanged(
const std::vector<size_t>&)), SLOT(pkeysChanged(
const std::vector<size_t>&)));
128 wd->connect(act, SIGNAL(triggered()), SLOT(changeThemeName()));
134 m_tab(new QTabWidget(this))
138 QMainWindow::setWindowTitle(tr(
"Shapefile tabular viewer"));
140 QString filter(tr(
"Shape Files (*.shp *.SHP)"));
157 QMessageBox::warning(
this, tr(
"Example warning"), tr(
"There's no file selected."));
175 m_tab->setTabEnabled(1,
true);
176 m_tab->setTabEnabled(2,
false);
183 m_tab->setTabEnabled(2,
true);
188 QIcon::setThemeName(tName);
189 QMainWindow::update();
195 QString text = QInputDialog::getText(
this, tr(
"Enter the name of the new icon theme."), tr(
"Icon theme name:"),
QLineEdit::Normal, QDir::home().dirName(), &ok);
197 if (ok && !text.isEmpty())
te::da::DataSource * m_dsrc
virtual bool isValid() const =0
It checks if the data source is valid (available for using).
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
te::qt::widgets::FileChooser * m_fchooser
virtual std::unique_ptr< DataSourceTransactor > getTransactor()=0
It returns the set of parameters used to set up the access channel to the underlying repository...
te::da::DataSource * getDataSource(const std::string &src)
TerraLib include files.
virtual void open()=0
It opens the data source and makes it ready for using.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
void initDialog(TabularViewerEx *wd, QTabWidget *tab, te::qt::widgets::FileChooser *&fc, te::qt::widgets::TabularViewer *&tv, SelectPKey *&pkeySel)
Function for initialize the TabularViewerEx dialog.
Defines a component for choose a file.
virtual bool isOpened() const =0
It returns true if the data source is opened, otherwise it returns false.
static te::dt::Date ds(2010, 01, 01)
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
void updateColumns(te::da::DataSet *dset)
A DataSourceTransactor can be viewed as a connection to the data source for reading/writing things in...
TabularViewerEx(QWidget *parent=0)
A factory for data sources.
A DataSourceTransactor can be viewed as a connection to the data source for reading/writing things in...
A dataset is the unit of information manipulated by the data access module of TerraLib.
virtual void close()=0
It closes the data source and clears all the resources used by its internal communication channel...
virtual std::unique_ptr< DataSet > getDataSet(const std::string &name, te::common::TraverseType travType=te::common::FORWARDONLY, bool connected=false, const te::common::AccessPolicy accessPolicy=te::common::RAccess)=0
It gets the dataset identified by the given name. A dataset can be connected or disconnected. A connected dataset, after its creation through the data source transactor, continues to depend on the connection given by its associated data source. Differently, a disconnected dataset, after its creation, no more depends of the connection given by the data source, and it continues to live after the connection has been released to the data source.
void setHighlightColor(const QColor &value)
te::da::DataSet * getDataSet(te::da::DataSource *ds)
void pkeysChanged(const std::vector< size_t > &ids)
te::qt::widgets::TabularViewer * m_viewer
This file contains several utility functions for dealing with STL containers.
void setThemeName(const QString &tName)