38
38
class QgsSpit : public QDialog, private Ui::QgsSpitBase
42
QgsSpit( QWidget *parent = 0, Qt::WFlags fl = 0 );
44
//! Populate the list of available database connections
45
void populateConnectionList();
46
//! Connect to the selected database
48
//! Return a list of selected tables
49
QStringList selectedTables();
50
//! Return the connection info
52
//! Create a new PostgreSQL connection
54
//! Edit a PostgreSQL connection
55
void editConnection();
56
//! Remove a PostgreSQL connection
57
void removeConnection();
58
//! Add file to the queue
60
//! Remove selected file from the queue
62
//! Remove all files from the queue
63
void removeAllFiles();
64
//! Use the default SRID (Spatial Reference ID)
65
void useDefaultSrid();
66
//! Use the default geometry field name (the_geom)
67
void useDefaultGeom();
70
//! Get schemas available in the database
73
//! Import shapefiles into PostgreSQL
75
//! Edit the column names for a shapefile in the queue
76
void editColumns( int, int, int, const QPoint & );
77
//! Edit import properties of a shapefile in the queue
78
void editShapefile( int, int, int, const QPoint & );
82
// In porting from Qt3 to Qt4 it was easier to have these small
83
// redirects for the widget signals rather than rename the existing
84
// functions (which would be been connected to the widgets using the
85
// Qt3 designer signal/slot connection mechanism), in case you were
87
void on_btnConnect_clicked() { dbConnect(); }
88
void on_btnEdit_clicked() { editConnection(); }
89
void on_btnNew_clicked() { newConnection(); }
90
void on_btnRemove_clicked() { removeConnection(); }
91
void on_btnImport_clicked() { import(); }
92
void on_btnHelp_clicked() { helpInfo(); }
93
void on_btnQuit_clicked() { close(); }
94
void on_btnAddFile_clicked() { addFile(); }
95
void on_btnRemoveAll_clicked() { removeAllFiles(); }
96
void on_btnRemoveFile_clicked() { removeFile(); }
97
void on_tblShapefiles_itemClicked(QTableWidgetItem* item)
98
{ tblShapefiles->editItem(item); }
99
// When the user changes the selected connection, update the schema list
100
void on_cmbConnections_activated(int) { getSchema(); }
101
void on_chkUseDefaultSrid_toggled(bool) { useDefaultSrid(); }
102
void on_chkUseDefaultGeom_toggled(bool) { useDefaultGeom(); }
106
// Enum of table columns indexes
110
ColFEATURECLASS = 1, // is editable
112
ColDBRELATIONNAME = 3, // is editable
113
ColDBSCHEMA = 4 // is editable
116
PGconn* checkConnection();
117
QStringList schema_list;
118
QStringList geometry_list;
120
std::vector <QgsShapeFile *> fileList;
123
int defaultSridValue;
124
QString defaultGeomValue;
42
QgsSpit( QWidget *parent = 0, Qt::WFlags fl = 0 );
44
//! Populate the list of available database connections
45
void populateConnectionList();
46
//! Connect to the selected database
48
//! Return a list of selected tables
49
QStringList selectedTables();
50
//! Return the connection info
51
QString connectionInfo();
52
//! Create a new PostgreSQL connection
54
//! Edit a PostgreSQL connection
55
void editConnection();
56
//! Remove a PostgreSQL connection
57
void removeConnection();
58
//! Add file to the queue
60
//! Remove selected file from the queue
62
//! Remove all files from the queue
63
void removeAllFiles();
64
//! Use the default SRID (Spatial Reference ID)
65
void useDefaultSrid();
66
//! Use the default geometry field name (the_geom)
67
void useDefaultGeom();
70
//! Import shapefiles into PostgreSQL
75
// In porting from Qt3 to Qt4 it was easier to have these small
76
// redirects for the widget signals rather than rename the existing
77
// functions (which would be been connected to the widgets using the
78
// Qt3 designer signal/slot connection mechanism), in case you were
80
void on_btnConnect_clicked() { dbConnect(); }
81
void on_btnEdit_clicked() { editConnection(); }
82
void on_btnNew_clicked() { newConnection(); }
83
void on_btnRemove_clicked() { removeConnection(); }
84
void on_buttonBox_accepted() { import(); }
85
void on_buttonBox_helpRequested() { helpInfo(); }
86
void on_buttonBox_rejected() { reject(); }
87
void on_btnAddFile_clicked() { addFile(); }
88
void on_btnRemoveAll_clicked() { removeAllFiles(); }
89
void on_btnRemoveFile_clicked() { removeFile(); }
90
void on_tblShapefiles_itemClicked( QTableWidgetItem* item )
91
{ tblShapefiles->editItem( item ); }
92
// When the user changes the selected connection, update the schema list
93
void on_chkUseDefaultSrid_toggled( bool ) { useDefaultSrid(); }
94
void on_chkUseDefaultGeom_toggled( bool ) { useDefaultGeom(); }
98
// Enum of table columns indexes
102
ColFEATURECLASS = 1, // is editable
104
ColDBRELATIONNAME = 3, // is editable
105
ColDBSCHEMA = 4 // is editable
108
PGconn* checkConnection();
109
QStringList schema_list;
110
QStringList geometry_list;
112
std::vector <QgsShapeFile *> fileList;
115
int defaultSridValue;
116
QString defaultGeomValue;
128
120
// We want to provide combo boxes in the table of shape files to
133
125
class ShapefileTableDelegate : public QItemDelegate
138
ShapefileTableDelegate(QObject *parent, QStringList& schema_list) :
139
mSchemaList(schema_list) {}
141
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
142
const QModelIndex &index) const;
144
void setEditorData(QWidget *editor, const QModelIndex &index) const;
145
void setModelData(QWidget *editor, QAbstractItemModel *model,
146
const QModelIndex &index) const;
148
void updateEditorGeometry(QWidget *editor,
149
const QStyleOptionViewItem &option, const QModelIndex &index) const;
150
void updateSchemaList(QStringList& schema_list, QString currentSchema);
153
QStringList mSchemaList;
130
ShapefileTableDelegate( QObject *parent, QStringList& schema_list ) :
131
mSchemaList( schema_list ) {}
133
QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option,
134
const QModelIndex &index ) const;
136
void setEditorData( QWidget *editor, const QModelIndex &index ) const;
137
void setModelData( QWidget *editor, QAbstractItemModel *model,
138
const QModelIndex &index ) const;
140
void updateEditorGeometry( QWidget *editor,
141
const QStyleOptionViewItem &option, const QModelIndex &index ) const;
142
void updateSchemaList( QStringList& schema_list, QString currentSchema );
145
QStringList mSchemaList;