Skip to content

Commit

Permalink
Merge branch 'master' of github.com:qgis/Quantum-GIS
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Apr 24, 2012
2 parents 2978bfa + cd408bc commit 026f0f7
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 105 deletions.
5 changes: 1 addition & 4 deletions CMakeLists.txt
Expand Up @@ -159,10 +159,7 @@ FIND_PACKAGE(Proj)
FIND_PACKAGE(GEOS)
FIND_PACKAGE(GDAL)
FIND_PACKAGE(Expat)

IF (NOT WITH_INTERNAL_SPATIALINDEX)
FIND_PACKAGE(Spatialindex REQUIRED)
ENDIF(NOT WITH_INTERNAL_SPATIALINDEX)
FIND_PACKAGE(Spatialindex REQUIRED)

FIND_PACKAGE(Qwt REQUIRED)
IF (NOT WITH_INTERNAL_QWTPOLAR)
Expand Down
5 changes: 4 additions & 1 deletion src/gui/qgsnewvectorlayerdialog.cpp
Expand Up @@ -286,7 +286,10 @@ QString QgsNewVectorLayerDialog::runAndCreateLayer( QWidget* parent, QString* pE
if ( geometrytype != QGis::WKBUnknown )
{
QgsCoordinateReferenceSystem srs( crsId, QgsCoordinateReferenceSystem::InternalCrsId );
createEmptyDataSource( fileName, fileformat, enc, geometrytype, attributes, &srs );
if ( !createEmptyDataSource( fileName, fileformat, enc, geometrytype, attributes, &srs ) )
{
return QString();
}
}
else
{
Expand Down
34 changes: 0 additions & 34 deletions src/plugins/georeferencer/qgsgeorefplugin.cpp
Expand Up @@ -52,7 +52,6 @@
#include "qgsgeorefplugin.h"

#include <QFile>
//#include <QDialog>
#include <QMessageBox>

//
Expand Down Expand Up @@ -101,17 +100,13 @@ void QgsGeorefPlugin::initGui()
// Connect the action to the run
connect( mActionRunGeoref, SIGNAL( triggered() ), this, SLOT( run() ) );

mActionAbout = new QAction( QIcon(), tr( "&About" ), this );
connect( mActionAbout, SIGNAL( triggered() ), this, SLOT( about() ) );

setCurrentTheme( "" );
// this is called when the icon theme is changed
connect( mQGisIface, SIGNAL( currentThemeChanged( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );

// Add to the toolbar & menu
mQGisIface->addRasterToolBarIcon( mActionRunGeoref );
mQGisIface->addPluginToRasterMenu( tr( "&Georeferencer" ), mActionRunGeoref );
mQGisIface->addPluginToRasterMenu( tr( "&Georeferencer" ), mActionAbout );
}

// Slot called when the buffer menu item is triggered
Expand All @@ -127,12 +122,10 @@ void QgsGeorefPlugin::run()
void QgsGeorefPlugin::unload()
{
// remove the GUI
mQGisIface->removePluginRasterMenu( tr( "&Georeferencer" ), mActionAbout );
mQGisIface->removePluginRasterMenu( tr( "&Georeferencer" ), mActionRunGeoref );
mQGisIface->removeRasterToolBarIcon( mActionRunGeoref );

delete mActionRunGeoref;
delete mActionAbout;

delete mPluginGui;
mPluginGui = NULL;
Expand All @@ -142,7 +135,6 @@ void QgsGeorefPlugin::unload()
void QgsGeorefPlugin::setCurrentTheme( QString )
{
mActionRunGeoref->setIcon( getThemeIcon( "/mGeorefRun.png" ) );
mActionAbout->setIcon( getThemeIcon( "/mActionAbout.png" ) );
}

QIcon QgsGeorefPlugin::getThemeIcon( const QString &theName )
Expand All @@ -161,39 +153,13 @@ QIcon QgsGeorefPlugin::getThemeIcon( const QString &theName )
}
}

void QgsGeorefPlugin::about( )
{
QString title = QString( "About Georeferencer" );
// sort by date of contribution
QString text = QString( "<center><b>Georeferencer GDAL</b></center>"
"<center>%1</center>"
"<p>Adding projection info to rasters using GDAL<br>"
"<b>Developers:</b>"
"<ol type=disc>"
"<li>Jack R"
"<li>Maxim Dubinin"
"<li>Manuel Massing"
"<li>Lars Luthman"
"</ol>"
"<p><b>Homepage:</b><br>"
"<a href=\"http://gis-lab.info/qa/qgis-georef-new-eng.html\">http://gis-lab.info/qa/qgis-georef-new-eng.html</a>" ).arg( sPluginVersion );

// this is required for adding georef icon in to left side of dialog
// create dynamicaly because on Mac this dialog is modeless
QWidget *w = new QWidget;
w->setAttribute( Qt::WA_DeleteOnClose );
w->setWindowIcon( getThemeIcon( "/mGeorefRun.png" ) );
QMessageBox::about( w, title, text );
}

//////////////////////////////////////////////////////////////////////
//
// END OF MANDATORY PLUGIN METHODS
//
//////////////////////////////////////////////////////////////////////



//////////////////////////////////////////////////////////////////////////
//
//
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/georeferencer/qgsgeorefplugin.h
Expand Up @@ -88,7 +88,6 @@ class QgsGeorefPlugin: public QObject, public QgisPlugin
//! update the plugins theme when the app tells us its theme is changed
void setCurrentTheme( QString theThemeName );
QIcon getThemeIcon( const QString &theThemeName );
void about();

//////////////////////////////////////////////////////////////////////
//
Expand All @@ -109,7 +108,6 @@ class QgsGeorefPlugin: public QObject, public QgisPlugin
QgisInterface *mQGisIface;
//!pointer to the qaction for this plugin
QAction * mActionRunGeoref;
QAction *mActionAbout;
////////////////////////////////////////////////////////////////////
//
// ADD YOUR OWN MEMBER DECLARATIONS AFTER THIS POINT.....
Expand Down
58 changes: 1 addition & 57 deletions src/plugins/roadgraph/roadgraphplugin.cpp
Expand Up @@ -101,21 +101,17 @@ void RoadGraphPlugin::initGui()
mQGisIface->addDockWidget( Qt::LeftDockWidgetArea, mQShortestPathDock );

// Create the action for tool
mQSettingsAction = new QAction( QIcon( ":/roadgraph/road.png" ), tr( "Road graph settings" ), this );
mInfoAction = new QAction( QIcon( ":/roadgraph/about.png" ), tr( "About" ), this );
mQSettingsAction = new QAction( QIcon( ":/roadgraph/road.png" ), tr( "Settings" ), this );

// Set the what's this text
mQSettingsAction->setWhatsThis( tr( "Road graph plugin settings" ) );
mInfoAction->setWhatsThis( tr( "About Road graph plugin" ) );

setGuiElementsToDefault();

// Connect the action to slots
connect( mQSettingsAction, SIGNAL( triggered() ), this, SLOT( property() ) );
connect( mInfoAction, SIGNAL( triggered() ), SLOT( about() ) );

mQGisIface->addPluginToVectorMenu( tr( "Road graph" ), mQSettingsAction );
mQGisIface->addPluginToVectorMenu( tr( "Road graph" ), mInfoAction );

connect( mQGisIface, SIGNAL( projectRead() ), this, SLOT( projectRead() ) );
connect( mQGisIface, SIGNAL( newProjectCreated() ), this, SLOT( newProject() ) );
Expand All @@ -131,7 +127,6 @@ void RoadGraphPlugin::unload()
{
// remove the GUI
mQGisIface->removePluginVectorMenu( tr( "Road graph" ), mQSettingsAction );
mQGisIface->removePluginVectorMenu( tr( "Road graph" ), mInfoAction );

// disconnect
disconnect( mQGisIface->mainWindow(), SIGNAL( projectRead() ), this, SLOT( projectRead() ) );
Expand Down Expand Up @@ -185,57 +180,6 @@ void RoadGraphPlugin::property()
setGuiElementsToDefault();
} //RoadGraphPlugin::property()

void RoadGraphPlugin::about()
{
QDialog dlg( mQGisIface->mainWindow() );
dlg.setWindowFlags( dlg.windowFlags() | Qt::MSWindowsFixedSizeDialogHint );
dlg.setWindowFlags( dlg.windowFlags() &~ Qt::WindowContextHelpButtonHint );
dlg.setWindowTitle( tr( "About RoadGraph" ) );
QVBoxLayout *lines = new QVBoxLayout( &dlg );
QLabel *title = new QLabel( "<b>RoadGraph plugin</b>" );
title->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
QLabel *version = new QLabel( sPluginVersion );
version->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
lines->addWidget( title );
lines->addWidget( version );
lines->addWidget( new QLabel( tr( "Find shortest path on road's graph" ) ) );
lines->addWidget( new QLabel( tr( "<b>Developers:</b>" ) ) );
lines->addWidget( new QLabel( " Sergey Yakushev" ) );
lines->addWidget( new QLabel( tr( "<b>Homepage:</b>" ) ) );

QSettings settings;
QString localeFullName, localeShortName;
bool overrideLocale = settings.value( "locale/overrideFlag", QVariant( false ) ).toBool();
if ( !overrideLocale )
{
localeFullName = QLocale().system().name();
}
else
{
localeFullName = settings.value( "locale/userLocale", QVariant( "" ) ).toString();
}

localeShortName = localeFullName.left( 2 );
QLabel *link = new QLabel();
if ( localeShortName == "ru" || localeShortName == "uk" )
{
link->setText( "<a href=\"http://gis-lab.info/qa/road-graph.html\">http://gis-lab.info/qa/road-graph.html</a>" );
}
else
{
link->setText( "<a href=\"http://gis-lab.info/qa/road-graph-eng.html\">http://gis-lab.info/qa/road-graph-eng.html</a>" );
}

link->setOpenExternalLinks( true );
lines->addWidget( link );

QPushButton *btnClose = new QPushButton( tr( "Close" ) );
lines->addWidget( btnClose );
QObject::connect( btnClose, SIGNAL( clicked() ), &dlg, SLOT( close() ) );

dlg.exec();
} //RoadGraphPlugin::about()

void RoadGraphPlugin::projectRead()
{
mSettings->read( QgsProject::instance() );
Expand Down
6 changes: 0 additions & 6 deletions src/plugins/roadgraph/roadgraphplugin.h
Expand Up @@ -95,8 +95,6 @@ class RoadGraphPlugin: public QObject, public QgisPlugin
//! show the help document
void help();

//! show about window
void about();
private slots:
/**
* set show roads direction
Expand Down Expand Up @@ -130,10 +128,6 @@ class RoadGraphPlugin: public QObject, public QgisPlugin
*/
QAction * mQSettingsAction;

/**
* pointer ot the about action
*/
QAction * mInfoAction;
/**
* GUI for use shortest path finder
*/
Expand Down
4 changes: 3 additions & 1 deletion src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -1943,6 +1943,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
{
if ( !uri.endsWith( ".shp", Qt::CaseInsensitive ) )
{
QgsDebugMsg( QString( "uri %1 doesn't end with .shp" ).arg( uri ) );
return false;
}

Expand Down Expand Up @@ -1971,6 +1972,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
dataSource = OGR_Dr_CreateDataSource( driver, TO8F( uri ), NULL );
if ( !dataSource )
{
QgsMessageLog::logMessage( QObject::tr( "Creating the data source %1 failed: %2" ).arg( uri ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ), QObject::tr( "OGR" ) );
return false;
}

Expand Down Expand Up @@ -2028,6 +2030,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
layer = OGR_DS_CreateLayer( dataSource, TO8F( QFileInfo( uri ).completeBaseName() ), reference, OGRvectortype, NULL );
if ( !layer )
{
QgsMessageLog::logMessage( QObject::tr( "Creation of OGR data source %1 failed: %2" ).arg( uri ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ), QObject::tr( "OGR" ) );
return false;
}

Expand All @@ -2041,7 +2044,6 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
Q_ASSERT( codec );
}


for ( std::list<std::pair<QString, QString> >::const_iterator it = attributes.begin(); it != attributes.end(); ++it )
{
QStringList fields = it->second.split( ";" );
Expand Down

0 comments on commit 026f0f7

Please sign in to comment.