Skip to content

Commit

Permalink
rename some postgres app classes and move a ogr class
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@12702 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jan 7, 2010
1 parent 9024bac commit 9183115
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 93 deletions.
25 changes: 7 additions & 18 deletions src/app/CMakeLists.txt
Expand Up @@ -53,7 +53,6 @@ SET(QGIS_APP_SRCS
qgsmergeattributesdialog.cpp
qgsnewhttpconnection.cpp
qgsnumericsortlistviewitem.cpp
qgsogrsublayersdialog.cpp
qgsoptions.cpp
qgspastetransformations.cpp
qgspointrotationitem.cpp
Expand Down Expand Up @@ -103,6 +102,7 @@ SET(QGIS_APP_SRCS
ogr/qgsogrhelperfunctions.cpp
ogr/qgsopenvectorlayerdialog.cpp
ogr/qgsnewogrconnection.cpp
ogr/qgsogrsublayersdialog.cpp

attributetable/qgsattributetabledialog.cpp
attributetable/qgsattributetablemodel.cpp
Expand Down Expand Up @@ -175,7 +175,6 @@ SET (QGIS_APP_MOC_HDRS
qgsmergeattributesdialog.h
qgsnewhttpconnection.h
qgsoptions.h
qgsogrsublayersdialog.h
qgspastetransformations.h
qgspluginmanager.h
qgspythondialog.h
Expand Down Expand Up @@ -212,6 +211,7 @@ SET (QGIS_APP_MOC_HDRS

ogr/qgsopenvectorlayerdialog.h
ogr/qgsnewogrconnection.h
ogr/qgsogrsublayersdialog.h

attributetable/qgsattributetableview.h
attributetable/qgsattributetablemodel.h
Expand All @@ -220,22 +220,10 @@ SET (QGIS_APP_MOC_HDRS
attributetable/qgsattributetabledelegate.h

gps/qgsgpsinformationwidget.h
gps/qgsgpsmarker.h
gps/qwtpolar/qwt_polar_canvas.h
gps/qwtpolar/qwt_polar_curve.h
gps/qwtpolar/qwt_polar_fitter.h
gps/qwtpolar/qwt_polar_global.h
gps/qwtpolar/qwt_polar_grid.h
gps/qwtpolar/qwt_polar.h
gps/qwtpolar/qwt_polar_itemdict.h
gps/qwtpolar/qwt_polar_item.h
gps/qwtpolar/qwt_polar_layout.h
gps/qwtpolar/qwt_polar_magnifier.h
gps/qwtpolar/qwt_polar_marker.h
gps/qwtpolar/qwt_polar_panner.h
gps/qwtpolar/qwt_polar_plot.h
gps/qwtpolar/qwt_polar_point.h
gps/qwtpolar/qwt_polar_spectrogram.h
)

IF (POSTGRES_FOUND)
Expand All @@ -244,12 +232,12 @@ IF (POSTGRES_FOUND)
ENDIF(HAVE_PGCONFIG)

SET (QGIS_APP_SRCS ${QGIS_APP_SRCS}
qgspgsourceselect.cpp
qgsnewconnection.cpp
postgres/qgspgsourceselect.cpp
postgres/qgspgnewconnection.cpp
)
SET (QGIS_APP_MOC_HDRS ${QGIS_APP_MOC_HDRS}
qgspgsourceselect.h
qgsnewconnection.h
postgres/qgspgsourceselect.h
postgres/qgspgnewconnection.h
)
ENDIF (POSTGRES_FOUND)

Expand All @@ -275,6 +263,7 @@ IF (WIN32)

IF (MSVC)
SET (QGIS_APP_SRCS ${QGIS_APP_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/qgis_win32.rc)
ADD_DEFINITIONS(-DQWT_DLL)
ELSE(MSVC)

# Icon for windows MINGW
Expand Down
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
/***************************************************************************
qgsnewconnection.cpp - description
qgspgnewconnection.cpp - description
-------------------
begin : Sat Jun 22 2002
copyright : (C) 2002 by Gary E.Sherman
Expand All @@ -20,7 +20,7 @@
#include <QMessageBox>
#include <QInputDialog>

#include "qgsnewconnection.h"
#include "qgspgnewconnection.h"
#include "qgscontexthelp.h"
#include "qgsdatasourceuri.h"
#include "qgslogger.h"
Expand All @@ -30,7 +30,7 @@ extern "C"
#include <libpq-fe.h>
}

QgsNewConnection::QgsNewConnection( QWidget *parent, const QString& connName, Qt::WFlags fl )
QgsPgNewConnection::QgsPgNewConnection( QWidget *parent, const QString& connName, Qt::WFlags fl )
: QDialog( parent, fl ), mOriginalConnName( connName )
{
setupUi( this );
Expand Down Expand Up @@ -78,7 +78,7 @@ QgsNewConnection::QgsNewConnection( QWidget *parent, const QString& connName, Qt
}
}
/** Autoconnected SLOTS **/
void QgsNewConnection::accept()
void QgsPgNewConnection::accept()
{
QSettings settings;
QString baseKey = "/PostgreSQL/connections/";
Expand Down Expand Up @@ -116,12 +116,12 @@ void QgsNewConnection::accept()
QDialog::accept();
}

void QgsNewConnection::on_btnConnect_clicked()
void QgsPgNewConnection::on_btnConnect_clicked()
{
testConnection();
}

void QgsNewConnection::on_cb_geometryColumnsOnly_clicked()
void QgsPgNewConnection::on_cb_geometryColumnsOnly_clicked()
{
if ( cb_geometryColumnsOnly->checkState() == Qt::Checked )
cb_publicSchemaOnly->setEnabled( false );
Expand All @@ -131,11 +131,11 @@ void QgsNewConnection::on_cb_geometryColumnsOnly_clicked()

/** end Autoconnected SLOTS **/

QgsNewConnection::~QgsNewConnection()
QgsPgNewConnection::~QgsPgNewConnection()
{
}

void QgsNewConnection::testConnection()
void QgsPgNewConnection::testConnection()
{
QgsDataSourceURI uri;
uri.setConnection( txtHost->text(), txtPort->text(), txtDatabase->text(), txtUsername->text(), txtPassword->text(), ( QgsDataSourceURI::SSLmode ) cbxSSLmode->itemData( cbxSSLmode->currentIndex() ).toInt() );
Expand All @@ -148,28 +148,28 @@ void QgsNewConnection::testConnection()
{
QString password = QString::null;

while( PQstatus( pd ) != CONNECTION_OK )
while ( PQstatus( pd ) != CONNECTION_OK )
{
bool ok = true;
password = QInputDialog::getText( this,
tr( "Enter password" ),
tr( "Error: %1Enter password for %2")
.arg( QString::fromUtf8( PQerrorMessage( pd ) ) )
.arg( uri.connectionInfo() ),
tr( "Error: %1Enter password for %2" )
.arg( QString::fromUtf8( PQerrorMessage( pd ) ) )
.arg( uri.connectionInfo() ),
QLineEdit::Password,
password,
&ok );

::PQfinish( pd );

if( !ok )
if ( !ok )
break;

pd = PQconnectdb( QString( "%1 password='%2'" ).arg( uri.connectionInfo() ).arg( password ).toLocal8Bit() );
}
}

if ( PQstatus( pd ) == CONNECTION_OK )
if ( PQstatus( pd ) == CONNECTION_OK )
{
// Database successfully opened; we can now issue SQL commands.
QMessageBox::information( this, tr( "Test connection" ), tr( "Connection to %1 was successful" ).arg( txtDatabase->text() ) );
Expand Down
@@ -1,5 +1,5 @@
/***************************************************************************
qgsnewconnection.h - description
qgspgnewconnection.h - description
-------------------
begin : Sat Jun 22 2002
copyright : (C) 2002 by Gary E.Sherman
Expand All @@ -15,23 +15,24 @@
* *
***************************************************************************/
/* $Id$ */
#ifndef QGSNEWCONNECTION_H
#define QGSNEWCONNECTION_H
#include "ui_qgsnewconnectionbase.h"
#ifndef QGSPGNEWCONNECTION_H
#define QGSPGNEWCONNECTION_H
#include "ui_qgspgnewconnectionbase.h"
#include "qgisgui.h"
#include "qgscontexthelp.h"
/*! \class QgsNewConnection

/*! \class QgsPgNewConnection
* \brief Dialog to allow the user to configure and save connection
* information for a PostgresQl database
* information for a PostgreSQL database
*/
class QgsNewConnection : public QDialog, private Ui::QgsNewConnectionBase
class QgsPgNewConnection : public QDialog, private Ui::QgsPgNewConnectionBase
{
Q_OBJECT
public:
//! Constructor
QgsNewConnection( QWidget *parent = 0, const QString& connName = QString::null, Qt::WFlags fl = QgisGui::ModalDialogFlags );
QgsPgNewConnection( QWidget *parent = 0, const QString& connName = QString::null, Qt::WFlags fl = QgisGui::ModalDialogFlags );
//! Destructor
~QgsNewConnection();
~QgsPgNewConnection();
//! Tests the connection using the parameters supplied
void testConnection();
public slots:
Expand All @@ -43,4 +44,4 @@ class QgsNewConnection : public QDialog, private Ui::QgsNewConnectionBase
QString mOriginalConnName; //store initial name to delete entry in case of rename
};

#endif // QGSNEWCONNECTIONBASE_H
#endif // QGSPGNEWCONNECTIONBASE_H
Expand Up @@ -23,7 +23,7 @@ email : sherman at mrcc.com
#include "qgslogger.h"
#include "qgsapplication.h"
#include "qgscontexthelp.h"
#include "qgsnewconnection.h"
#include "qgspgnewconnection.h"
#include "qgsquerybuilder.h"
#include "qgsdatasourceuri.h"
#include "qgsvectorlayer.h"
Expand Down Expand Up @@ -96,7 +96,7 @@ QgsPgSourceSelect::QgsPgSourceSelect( QWidget *parent, Qt::WFlags fl )
// Slot for adding a new connection
void QgsPgSourceSelect::on_btnNew_clicked()
{
QgsNewConnection *nc = new QgsNewConnection( this );
QgsPgNewConnection *nc = new QgsPgNewConnection( this );
nc->exec();
delete nc;

Expand Down Expand Up @@ -129,7 +129,7 @@ void QgsPgSourceSelect::on_btnDelete_clicked()
// Slot for editing a connection
void QgsPgSourceSelect::on_btnEdit_clicked()
{
QgsNewConnection *nc = new QgsNewConnection( this, cmbConnections->currentText() );
QgsPgNewConnection *nc = new QgsPgNewConnection( this, cmbConnections->currentText() );
nc->exec();
delete nc;

Expand Down Expand Up @@ -412,21 +412,21 @@ void QgsPgSourceSelect::on_btnConnect_clicked()
{
QString password = QString::null;

while( PQstatus( pd ) != CONNECTION_OK )
while ( PQstatus( pd ) != CONNECTION_OK )
{
bool ok = true;
password = QInputDialog::getText( this,
tr( "Enter password" ),
tr( "Error: %1Enter password for %2")
.arg( QString::fromUtf8( PQerrorMessage( pd ) ) )
.arg( uri.connectionInfo() ),
tr( "Error: %1Enter password for %2" )
.arg( QString::fromUtf8( PQerrorMessage( pd ) ) )
.arg( uri.connectionInfo() ),
QLineEdit::Password,
password,
&ok );

::PQfinish( pd );

if( !ok )
if ( !ok )
break;

pd = PQconnectdb( QString( "%1 password='%2'" ).arg( uri.connectionInfo() ).arg( password ).toLocal8Bit() );
Expand Down
File renamed without changes.
22 changes: 11 additions & 11 deletions src/app/qgisapp.cpp
Expand Up @@ -100,7 +100,6 @@
#include "qgscursors.h"
#include "qgscustomprojectiondialog.h"
#include "qgsencodingfiledialog.h"
#include "qgsogrsublayersdialog.h"
#include "qgsexception.h"
#include "qgsfeature.h"
#include "qgsnewvectorlayerdialog.h"
Expand Down Expand Up @@ -137,6 +136,7 @@
#include "qgsundowidget.h"
#include "qgsvectordataprovider.h"
#include "qgsvectorlayer.h"
#include "ogr/qgsogrsublayersdialog.h"
#include "ogr/qgsopenvectorlayerdialog.h"
#include "qgsattributetabledialog.h"
#include "qgsvectorfilewriter.h"
Expand Down Expand Up @@ -188,7 +188,7 @@
// Conditional Includes
//
#ifdef HAVE_POSTGRESQL
#include "qgspgsourceselect.h"
#include "postgres/qgspgsourceselect.h"
#endif
#ifdef HAVE_SPATIALITE
#include "qgsspatialitesourceselect.h"
Expand Down Expand Up @@ -328,7 +328,7 @@ QgisApp::QgisApp( QSplashScreen *splash, QWidget * parent, Qt::WFlags fl )
mSplash( splash ),
mPythonConsole( NULL ),
mPythonUtils( NULL ),
mpGpsWidget(NULL)
mpGpsWidget( NULL )
{
if ( smInstance )
{
Expand Down Expand Up @@ -559,7 +559,7 @@ void QgisApp::readSettings()
// Restore state of GPS Tracker
if ( settings.value( "/gps/widgetEnabled", false ).toBool() )
{
showGpsTool();
showGpsTool();
}
}

Expand Down Expand Up @@ -957,7 +957,7 @@ void QgisApp::createActions()
mActionGpsTool->setStatusTip( tr( "Show GPS tool" ) );
connect( mActionGpsTool, SIGNAL( triggered() ), this, SLOT( showGpsTool() ) );
mActionGpsTool->setEnabled( true );


mActionLayerProperties = new QAction( tr( "Properties..." ), this );
shortcuts->registerAction( mActionLayerProperties );
Expand Down Expand Up @@ -2074,11 +2074,11 @@ void QgisApp::saveRecentProjectPath( QString projectPath, QSettings & settings )
// Persist state of GPS Tracker
if ( mpGpsWidget )
{
settings.setValue( "/gps/widgetEnabled", true );
settings.setValue( "/gps/widgetEnabled", true );
}
else
{
settings.setValue( "/gps/widgetEnabled", false );
settings.setValue( "/gps/widgetEnabled", false );
}
// Update menu list of paths
updateRecentProjectPaths();
Expand Down Expand Up @@ -2127,12 +2127,12 @@ void QgisApp::restoreWindowState()
// Persist state of GPS Tracker
if ( mpGpsWidget )
{
settings.setValue( "/gps/widgetEnabled", true );
delete mpGpsWidget;
settings.setValue( "/gps/widgetEnabled", true );
delete mpGpsWidget;
}
else
{
settings.setValue( "/gps/widgetEnabled", false );
settings.setValue( "/gps/widgetEnabled", false );
}
}
///////////// END OF GUI SETUP ROUTINES ///////////////
Expand Down Expand Up @@ -4401,7 +4401,7 @@ void QgisApp::removeAllLayers()

void QgisApp::showGpsTool()
{
if(!mpGpsWidget)
if ( !mpGpsWidget )
{
mpGpsWidget = new QgsGPSInformationWidget( mMapCanvas );
//create the dock widget
Expand Down

0 comments on commit 9183115

Please sign in to comment.