mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-22 00:06:12 -05:00
support for icons in postgis selection dialog
git-svn-id: http://svn.osgeo.org/qgis/trunk@13 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
2464896061
commit
f75d53578d
84
src/qgisicons.h
Normal file
84
src/qgisicons.h
Normal file
@ -0,0 +1,84 @@
|
||||
#ifndef QGISICONS_H
|
||||
#define QGISICONS_H
|
||||
/* XPM */
|
||||
static const char * layer_points[] = {
|
||||
"16 16 14 1",
|
||||
" c None",
|
||||
". c #60EE0E",
|
||||
"+ c #60EF0E",
|
||||
"@ c #60ED0E",
|
||||
"# c #5FEE0E",
|
||||
"$ c #5DE70E",
|
||||
"% c #5FEB0E",
|
||||
"& c #5CE70D",
|
||||
"* c #5DE70D",
|
||||
"= c #5AE00D",
|
||||
"- c #5CE70E",
|
||||
"; c #60EC0E",
|
||||
"> c #58DB0D",
|
||||
", c #5BE40E",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .++ ",
|
||||
" +++++ ",
|
||||
" +++++++ ",
|
||||
" +++++@+ ",
|
||||
" ##.+$%+ ",
|
||||
" &*=-; ",
|
||||
" >,% ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
/* XPM */
|
||||
static const char * layer_lines[] = {
|
||||
"16 16 2 1",
|
||||
" c None",
|
||||
". c #5272FF",
|
||||
" ",
|
||||
" .. . ",
|
||||
" .. .. ",
|
||||
" . .... ",
|
||||
" . . ",
|
||||
" ... . ",
|
||||
" .... ",
|
||||
" .. ",
|
||||
" .. ",
|
||||
" . ",
|
||||
" .. ",
|
||||
" .. ",
|
||||
" .. ",
|
||||
" .. ",
|
||||
" . ",
|
||||
" "};
|
||||
|
||||
|
||||
/* XPM */
|
||||
static const char * layer_polygon[] = {
|
||||
"16 16 3 1",
|
||||
" c None",
|
||||
". c #D86652",
|
||||
"+ c #ddfcc9",
|
||||
" ",
|
||||
" .. ",
|
||||
" .... ...... ",
|
||||
" .++...++++. ",
|
||||
" ..++++++++. ",
|
||||
" ...++++.. ",
|
||||
" .++++. ",
|
||||
" ..+++++.. ",
|
||||
" ..+++++++. ",
|
||||
" ..++++++++.. ",
|
||||
" .++++++++... ",
|
||||
" .++...+++. ",
|
||||
" .......+++. ",
|
||||
" ..... ",
|
||||
" .. ",
|
||||
" "};
|
||||
|
||||
|
||||
#endif // QGISICONS_H
|
@ -1,9 +1,11 @@
|
||||
#include <libpq++.h>
|
||||
#include <iostream>
|
||||
#include <qsettings.h>
|
||||
#include <qpixmap.h>
|
||||
#include <qlistbox.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qcombobox.h>
|
||||
#include "qgisicons.h"
|
||||
#include "qgsdbsourceselect.h"
|
||||
#include "qgsnewconnection.h"
|
||||
|
||||
@ -27,6 +29,20 @@ void QgsDbSourceSelect::addNewConnection(){
|
||||
if(nc->exec()){
|
||||
}
|
||||
}
|
||||
void QgsDbSourceSelect::editConnection(){
|
||||
|
||||
QgsNewConnection *nc = new QgsNewConnection();
|
||||
// populate the fields with the stored setting parameters
|
||||
QSettings settings;
|
||||
|
||||
QString key = "/Qgis/connections/" + cmbConnections->currentText();
|
||||
QString host = settings.readEntry(key+"/host");
|
||||
QString database = settings.readEntry(key+"/database");
|
||||
QString username = settings.readEntry(key+"/username");
|
||||
QString password = settings.readEntry(key+"/password");
|
||||
if(nc->exec()){
|
||||
}
|
||||
}
|
||||
|
||||
void QgsDbSourceSelect::dbConnect(){
|
||||
// populate the table list
|
||||
@ -41,9 +57,16 @@ void QgsDbSourceSelect::dbConnect(){
|
||||
PgDatabase *pd = new PgDatabase((const char *)conninfo);
|
||||
cout << pd->ErrorMessage();
|
||||
if(pd->Status()==CONNECTION_OK){
|
||||
// create the pixmaps for the layer types
|
||||
QPixmap pxPoint;
|
||||
pxPoint = QPixmap(layer_points);
|
||||
QPixmap pxLine;
|
||||
pxLine = QPixmap(layer_lines);
|
||||
QPixmap pxPoly;
|
||||
pxPoly = QPixmap(layer_polygon);
|
||||
qDebug("Connection succeeded");
|
||||
// get the list of tables
|
||||
QString sql = "select f_table_name from geometry_columns where f_table_schema ='"
|
||||
QString sql = "select * from geometry_columns where f_table_schema ='"
|
||||
+ settings.readEntry(key+"/database") + "'";
|
||||
qDebug("Fetching tables using: " + sql);
|
||||
int result = pd->ExecTuplesOk((const char *)sql);
|
||||
@ -53,7 +76,19 @@ void QgsDbSourceSelect::dbConnect(){
|
||||
qDebug( msg);
|
||||
for(int idx = 0; idx < pd->Tuples(); idx++){
|
||||
QString v = pd->GetValue(idx,"f_table_name");
|
||||
lstTables->insertItem(v);
|
||||
QString type = pd->GetValue(idx,"type");
|
||||
QPixmap *p;
|
||||
if(type == "POINT" || type == "MULTIPOINT")
|
||||
p = &pxPoint;
|
||||
else
|
||||
if(type == "MULTIPOLYGON" || type == "POLYGON")
|
||||
p = &pxPoly;
|
||||
else
|
||||
if(type == "LINESTRING" || type == "MULTILINESTRING")
|
||||
p = &pxLine;
|
||||
else
|
||||
p = 0;
|
||||
lstTables->insertItem(*p,v);
|
||||
}
|
||||
}else{
|
||||
qDebug( "Unable to get list of spatially enabled tables from geometry_columns table");
|
||||
|
@ -8,6 +8,7 @@ class QgsDbSourceSelect : public QgsDbSourceSelectBase
|
||||
QgsDbSourceSelect();
|
||||
~QgsDbSourceSelect();
|
||||
void addNewConnection();
|
||||
void editConnection();
|
||||
void dbConnect();
|
||||
};
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>305</width>
|
||||
<height>367</height>
|
||||
<height>338</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -34,7 +34,7 @@
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QLayoutWidget" row="2" column="1" rowspan="2" colspan="1">
|
||||
<widget class="QLayoutWidget" row="2" column="1">
|
||||
<property name="name">
|
||||
<cstring>Layout5</cstring>
|
||||
</property>
|
||||
@ -112,19 +112,6 @@
|
||||
</spacer>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>TextLabel3_2_2</cstring>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tables</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" row="0" column="0" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>GroupBox1</cstring>
|
||||
@ -142,7 +129,12 @@
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QPushButton" row="1" column="1">
|
||||
<widget class="QComboBox" row="0" column="0" rowspan="1" colspan="3">
|
||||
<property name="name">
|
||||
<cstring>cmbConnections</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>btnConnect</cstring>
|
||||
</property>
|
||||
@ -152,42 +144,36 @@
|
||||
</widget>
|
||||
<widget class="QPushButton" row="1" column="2">
|
||||
<property name="name">
|
||||
<cstring>btnConnect_2</cstring>
|
||||
<cstring>btnEdit</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create</string>
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" row="0" column="0" rowspan="1" colspan="4">
|
||||
<widget class="QPushButton" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>cmbConnections</cstring>
|
||||
<cstring>btnNew</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>Spacer3</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
<spacer row="1" column="3">
|
||||
<property name="name">
|
||||
<cstring>Spacer3_2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="QListBox" row="3" column="0">
|
||||
<widget class="QLabel" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>TextLabel3_2_2</cstring>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tables</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListBox" row="2" column="0">
|
||||
<property name="name">
|
||||
<cstring>lstTables</cstring>
|
||||
</property>
|
||||
@ -217,20 +203,37 @@
|
||||
<slot>addTables()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>btnConnect_2</sender>
|
||||
<sender>btnNew</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QgsDbSourceSelectBase</receiver>
|
||||
<slot>addNewConnection()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>btnEdit</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QgsDbSourceSelectBase</receiver>
|
||||
<slot>editConnection()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<tabstops>
|
||||
<tabstop>cmbConnections</tabstop>
|
||||
<tabstop>btnConnect</tabstop>
|
||||
<tabstop>btnNew</tabstop>
|
||||
<tabstop>btnEdit</tabstop>
|
||||
<tabstop>lstTables</tabstop>
|
||||
<tabstop>btnAdd</tabstop>
|
||||
<tabstop>btnCancel</tabstop>
|
||||
<tabstop>btnHelp</tabstop>
|
||||
</tabstops>
|
||||
<includes>
|
||||
<include location="local" impldecl="in implementation">qgsdbsourceselectbase.ui.h</include>
|
||||
</includes>
|
||||
<slots>
|
||||
<slot>init()</slot>
|
||||
<slot>dbConnect()</slot>
|
||||
<slot>addTables()</slot>
|
||||
<slot>addNewConnection()</slot>
|
||||
<slot>addTables()</slot>
|
||||
<slot>dbConnect()</slot>
|
||||
<slot>init()</slot>
|
||||
<slot>editConnection()</slot>
|
||||
</slots>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
||||
|
@ -26,3 +26,9 @@ void QgsDbSourceSelectBase::addNewConnection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void QgsDbSourceSelectBase::editConnection()
|
||||
{
|
||||
|
||||
}
|
@ -293,6 +293,18 @@
|
||||
<slot>saveConnection()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<tabstops>
|
||||
<tabstop>txtName</tabstop>
|
||||
<tabstop>txtHost</tabstop>
|
||||
<tabstop>txtDatabase</tabstop>
|
||||
<tabstop>txtUsername</tabstop>
|
||||
<tabstop>txtPassword</tabstop>
|
||||
<tabstop>chkStorePassword</tabstop>
|
||||
<tabstop>btnConnect</tabstop>
|
||||
<tabstop>buttonOk</tabstop>
|
||||
<tabstop>buttonCancel</tabstop>
|
||||
<tabstop>buttonHelp</tabstop>
|
||||
</tabstops>
|
||||
<slots>
|
||||
<slot>saveConnection()</slot>
|
||||
<slot>testConnection()</slot>
|
||||
|
Loading…
x
Reference in New Issue
Block a user