mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-19 00:04:52 -04:00
Merge branch 'master' of github.com:qgis/Quantum-GIS
This commit is contained in:
commit
e51dd2cc10
@ -1,7 +1,7 @@
|
||||
<style>table {font-size:80%;}th {text-align:left; }.bartodo{ background-color:red;width:100px;height:20px;}.bardone{ background-color:green;width:80px;height:20px;font-size:80%;text-align:center;padding-top:4px;height:16px;color:white;}</style><table><tr><th colspan="2" style="width:250px;">Language</th><th>Finished %</th><th>Translators</th></tr>
|
||||
|
||||
<tr><td><img src="qrc:/images/flags/de.png"></td><td>German</td><td><div class="bartodo"><div class="bardone" style="width:99.9px">99.9</div></div></td><td>Jürgen E. Fischer, Stephan Holl, Otto Dassau, Werner Macho</tr></tr>
|
||||
<tr><td><img src="qrc:/images/flags/et.png"></td><td>Estonian</td><td><div class="bartodo"><div class="bardone" style="width:99.9px">99.9</div></div></td><td>Veiko Viil</tr></tr>
|
||||
<tr><td><img src="qrc:/images/flags/et_EE.png"></td><td>Estonian (Estonia)</td><td><div class="bartodo"><div class="bardone" style="width:99.9px">99.9</div></div></td><td>Veiko Viil</tr></tr>
|
||||
<tr><td><img src="qrc:/images/flags/es.png"></td><td>Spanish</td><td><div class="bartodo"><div class="bardone" style="width:99.1px">99.1</div></div></td><td>Carlos Dávila, Javier César Aldariz, Gabriela Awad, Edwin Amado, Mayeul Kauffmann</tr></tr>
|
||||
<tr><td><img src="qrc:/images/flags/hu.png"></td><td>Hungarian</td><td><div class="bartodo"><div class="bardone" style="width:96.6px">96.6</div></div></td><td>Zoltan Siki</tr></tr>
|
||||
<tr><td><img src="qrc:/images/flags/fr.png"></td><td>French</td><td><div class="bartodo"><div class="bardone" style="width:96.6px">96.6</div></div></td><td>Eve Rousseau, Marc Monnerat, Lionel Roubeyrie, Jean Roc Morreale, Benjamin Bohard, Jeremy Garniaux, Yves Jacolin, Benjamin Lerre, Stéphane Morel, Marie Silvestre, Tahir Tamba, Xavier M, Mayeul Kauffmann, Mehdi Semchaoui</tr></tr>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 592 B |
BIN
images/flags/et_EE.png
Executable file
BIN
images/flags/et_EE.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 429 B |
@ -386,7 +386,6 @@
|
||||
<file>flags/de.png</file>
|
||||
<file>flags/el_GR.png</file>
|
||||
<file>flags/es.png</file>
|
||||
<file>flags/et.png</file>
|
||||
<file>flags/fa.png</file>
|
||||
<file>flags/fi.png</file>
|
||||
<file>flags/fr.png</file>
|
||||
@ -426,6 +425,7 @@
|
||||
<file>flags/zh_TW.png</file>
|
||||
<file>flags/en_US.png</file>
|
||||
<file>flags/da_DK.png</file>
|
||||
<file>flags/et_EE.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/images/tips">
|
||||
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
|
||||
|
@ -29,7 +29,7 @@ my $translators= {
|
||||
de => 'Jürgen E. Fischer, Stephan Holl, Otto Dassau, Werner Macho',
|
||||
es => 'Carlos Dávila, Javier César Aldariz, Gabriela Awad, Edwin Amado, Mayeul Kauffmann',
|
||||
el_GR => 'Evripidis Argyropoulos, Mike Pegnigiannis, Nikos Ves',
|
||||
et => 'Veiko Viil',
|
||||
et_EE => 'Veiko Viil',
|
||||
fa => 'Mola Pahnadayan',
|
||||
fi => 'Marko Jarvenpaa',
|
||||
fr => 'Eve Rousseau, Marc Monnerat, Lionel Roubeyrie, Jean Roc Morreale, Benjamin Bohard, Jeremy Garniaux, Yves Jacolin, Benjamin Lerre, Stéphane Morel, Marie Silvestre, Tahir Tamba, Xavier M, Mayeul Kauffmann, Mehdi Semchaoui',
|
||||
|
@ -1866,7 +1866,7 @@ QgsRasterBandStats QgsGdalProvider::bandStatistics( int theBandNo )
|
||||
{
|
||||
GDALRasterBandH myGdalBand = GDALGetRasterBand( mGdalDataset, theBandNo );
|
||||
QgsRasterBandStats myRasterBandStats;
|
||||
int bApproxOK = false;
|
||||
int bApproxOK = true;
|
||||
double pdfMin;
|
||||
double pdfMax;
|
||||
double pdfMean;
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
QGISEXTERN bool deleteLayer( const QString& uri, QString& errCause );
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
QgsPGConnectionItem::QgsPGConnectionItem( QgsDataItem* parent, QString name, QString path )
|
||||
: QgsDataCollectionItem( parent, name, path )
|
||||
@ -237,6 +239,32 @@ QgsPGLayerItem::~QgsPGLayerItem()
|
||||
{
|
||||
}
|
||||
|
||||
QList<QAction*> QgsPGLayerItem::actions()
|
||||
{
|
||||
QList<QAction*> lst;
|
||||
|
||||
QAction* actionDeleteLayer = new QAction( tr( "Delete layer" ), this );
|
||||
connect( actionDeleteLayer, SIGNAL( triggered() ), this, SLOT( deleteLayer() ) );
|
||||
lst.append( actionDeleteLayer );
|
||||
|
||||
return lst;
|
||||
}
|
||||
|
||||
void QgsPGLayerItem::deleteLayer()
|
||||
{
|
||||
QString errCause;
|
||||
bool res = ::deleteLayer( mUri, errCause );
|
||||
if ( !res )
|
||||
{
|
||||
QMessageBox::warning( 0, tr( "Delete layer" ), errCause );
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information( 0, tr( "Delete layer" ), tr( "Layer deleted successfully." ) );
|
||||
mParent->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
QString QgsPGLayerItem::createUri()
|
||||
{
|
||||
QString pkColName = mLayerProperty.pkCols.size() > 0 ? mLayerProperty.pkCols.at( 0 ) : QString::null;
|
||||
|
@ -83,6 +83,11 @@ class QgsPGLayerItem : public QgsLayerItem
|
||||
|
||||
QString createUri();
|
||||
|
||||
virtual QList<QAction*> actions();
|
||||
|
||||
public slots:
|
||||
void deleteLayer();
|
||||
|
||||
private:
|
||||
QgsPostgresLayerProperty mLayerProperty;
|
||||
};
|
||||
|
@ -2934,9 +2934,9 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer(
|
||||
}
|
||||
schemaTableName += quotedIdentifier( tableName );
|
||||
|
||||
QgsDebugMsg( QString( "Connection info is " ).arg( dsUri.connectionInfo() ) );
|
||||
QgsDebugMsg( QString( "Geometry column is: " ).arg( geometryColumn ) );
|
||||
QgsDebugMsg( QString( "Schema is: " ).arg( schemaName ) );
|
||||
QgsDebugMsg( QString( "Connection info is: %1" ).arg( dsUri.connectionInfo() ) );
|
||||
QgsDebugMsg( QString( "Geometry column is: %1" ).arg( geometryColumn ) );
|
||||
QgsDebugMsg( QString( "Schema is: %1" ).arg( schemaName ) );
|
||||
QgsDebugMsg( QString( "Table name is: %1" ).arg( tableName ) );
|
||||
|
||||
// create the table
|
||||
@ -3248,3 +3248,76 @@ QGISEXTERN QgsVectorLayerImport::ImportError createEmptyLayer(
|
||||
oldToNewAttrIdxMap, errorMessage, options
|
||||
);
|
||||
}
|
||||
|
||||
QGISEXTERN bool deleteLayer( const QString& uri, QString& errCause )
|
||||
{
|
||||
QgsDebugMsg( "deleting layer " + uri );
|
||||
|
||||
QgsDataSourceURI dsUri( uri );
|
||||
QString schemaName = dsUri.schema();
|
||||
QString tableName = dsUri.table();
|
||||
QString geometryCol = dsUri.geometryColumn();
|
||||
|
||||
QString schemaTableName;
|
||||
if ( !schemaName.isEmpty() )
|
||||
{
|
||||
schemaTableName = QgsPostgresConn::quotedIdentifier( schemaName ) + ".";
|
||||
}
|
||||
schemaTableName += QgsPostgresConn::quotedIdentifier( tableName );
|
||||
|
||||
QgsPostgresConn* conn = QgsPostgresConn::connectDb( dsUri.connectionInfo(), false );
|
||||
if ( !conn )
|
||||
{
|
||||
errCause = QObject::tr( "Connection to database failed" );
|
||||
return false;
|
||||
}
|
||||
|
||||
// check the geometry column count
|
||||
QString sql = QString( "SELECT count(*) "
|
||||
"FROM geometry_columns, pg_class, pg_namespace "
|
||||
"WHERE f_table_name=relname AND f_table_schema=nspname "
|
||||
"AND pg_class.relnamespace=pg_namespace.oid "
|
||||
"AND f_table_schema=%1 AND f_table_name=%2" )
|
||||
.arg( QgsPostgresConn::quotedValue( schemaName ) )
|
||||
.arg( QgsPostgresConn::quotedValue( tableName ) );
|
||||
QgsPostgresResult result = conn->PQexec( sql );
|
||||
if ( result.PQresultStatus() != PGRES_TUPLES_OK )
|
||||
{
|
||||
errCause = QObject::tr( "Unable to delete layer %1: \n%2" )
|
||||
.arg( schemaTableName )
|
||||
.arg( result.PQresultErrorMessage() );
|
||||
conn->disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
int count = result.PQgetvalue( 0, 0 ).toInt();
|
||||
|
||||
if ( !geometryCol.isEmpty() && count > 1 )
|
||||
{
|
||||
// the table has more geometry columns, drop just the geometry column
|
||||
sql = QString( "SELECT DropGeometryColumn(%1,%2,%3)" )
|
||||
.arg( QgsPostgresConn::quotedValue( schemaName ) )
|
||||
.arg( QgsPostgresConn::quotedValue( tableName ) )
|
||||
.arg( QgsPostgresConn::quotedValue( geometryCol ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// drop the table
|
||||
sql = QString( "SELECT DropGeometryTable(%1,%2)" )
|
||||
.arg( QgsPostgresConn::quotedValue( schemaName ) )
|
||||
.arg( QgsPostgresConn::quotedValue( tableName ) );
|
||||
}
|
||||
|
||||
result = conn->PQexec( sql );
|
||||
if ( result.PQresultStatus() != PGRES_TUPLES_OK )
|
||||
{
|
||||
errCause = QObject::tr( "Unable to delete layer %1: \n%2" )
|
||||
.arg( schemaTableName )
|
||||
.arg( result.PQresultErrorMessage() );
|
||||
conn->disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
conn->disconnect();
|
||||
return true;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QCryptographicHash>
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
#include <QBuffer>
|
||||
|
||||
QgsRenderChecker::QgsRenderChecker( ) :
|
||||
mReport( "" ),
|
||||
@ -52,7 +53,20 @@ void QgsRenderChecker::setControlName(const QString theName)
|
||||
+ theName + ".png";
|
||||
}
|
||||
|
||||
bool QgsRenderChecker::isKnownAnomaly( QImage theDifferenceImage )
|
||||
QString QgsRenderChecker::imageToHash( QString theImageFile )
|
||||
{
|
||||
QImage myImage;
|
||||
myImage.load( theImageFile );
|
||||
QByteArray myByteArray;
|
||||
QBuffer myBuffer( &myByteArray );
|
||||
myImage.save(&myBuffer, "PNG");
|
||||
QString myImageString = QString::fromUtf8( myByteArray.toBase64().data() );
|
||||
QCryptographicHash myHash( QCryptographicHash::Md5 );
|
||||
myHash.addData(myImageString.toUtf8());
|
||||
return myHash.result().toHex().constData();
|
||||
}
|
||||
|
||||
bool QgsRenderChecker::isKnownAnomaly( QString theDiffImageFile )
|
||||
{
|
||||
QString myControlImageDir = controlImagePath() + mControlName
|
||||
+ QDir::separator();
|
||||
@ -64,11 +78,9 @@ bool QgsRenderChecker::isKnownAnomaly( QImage theDifferenceImage )
|
||||
//remove the control file from teh list as the anomalies are
|
||||
//all files except the control file
|
||||
myList.removeAt(myList.indexOf(mExpectedImageFile));
|
||||
//todo compare each hash to diff path
|
||||
QByteArray myData((const char*)theDifferenceImage.bits(),
|
||||
theDifferenceImage.numBytes());
|
||||
QByteArray mySourceHash = QCryptographicHash::hash(
|
||||
myData, QCryptographicHash::Md5);
|
||||
|
||||
QString myImageHash = imageToHash( theDiffImageFile );
|
||||
|
||||
|
||||
for (int i = 0; i < myList.size(); ++i)
|
||||
{
|
||||
@ -76,20 +88,22 @@ bool QgsRenderChecker::isKnownAnomaly( QImage theDifferenceImage )
|
||||
mReport += "<tr><td colspan=3>"
|
||||
"Checking if " + myFile + " is a known anomaly.";
|
||||
mReport += "</td></tr>";
|
||||
QImage myAnomalyImage( myFile );
|
||||
QByteArray myData((const char*)myAnomalyImage.bits(),
|
||||
myAnomalyImage.numBytes());
|
||||
QByteArray myAnomolyHash = QCryptographicHash::hash(
|
||||
myData, QCryptographicHash::Md5);
|
||||
QString myHashMessage = QString("Source image hash %1 : Anomaly hash: %2").arg(
|
||||
QString(mySourceHash.toHex())).arg(QString(myAnomolyHash.toHex()));
|
||||
//fro CDash
|
||||
QString myAnomalyHash = imageToHash( controlImagePath() + mControlName
|
||||
+ QDir::separator() + myFile );
|
||||
QString myHashMessage = QString(
|
||||
"Checking if anomaly %1 (hash %2)")
|
||||
.arg( myFile )
|
||||
.arg( myAnomalyHash );
|
||||
myHashMessage += QString( " matches %1 (hash %2)" )
|
||||
.arg( theDiffImageFile )
|
||||
.arg( myImageHash );
|
||||
//foo CDash
|
||||
QString myMeasureMessage = "<DartMeasurement name=\"Anomoly check"
|
||||
"\" type=\"text/text\">" + myHashMessage +
|
||||
"</DartMeasurement>";
|
||||
qDebug() << myMeasureMessage;
|
||||
mReport += "<tr><td colspan=3>" + myHashMessage + "</td></tr>";
|
||||
if ( mySourceHash.toHex() == myAnomolyHash.toHex() )
|
||||
if ( myImageHash == myAnomalyHash )
|
||||
{
|
||||
mReport += "<tr><td colspan=3>"
|
||||
"Anomaly found! " + myFile;
|
||||
@ -179,7 +193,7 @@ bool QgsRenderChecker::compareImages( QString theTestName,
|
||||
QImage myDifferenceImage( myExpectedImage.width(),
|
||||
myExpectedImage.height(),
|
||||
QImage::Format_RGB32 );
|
||||
QString myResultDiffImage = QDir::tempPath() + QDir::separator() +
|
||||
QString myDiffImageFile = QDir::tempPath() + QDir::separator() +
|
||||
QDir::separator() +
|
||||
theTestName + "_result_diff.png";
|
||||
myDifferenceImage.fill( qRgb( 152, 219, 249 ) );
|
||||
@ -213,7 +227,7 @@ bool QgsRenderChecker::compareImages( QString theTestName,
|
||||
"\"></td>\n<td><img src=\"file://" +
|
||||
mExpectedImageFile +
|
||||
"\"></td><td><img src=\"file://" +
|
||||
myResultDiffImage +
|
||||
myDiffImageFile +
|
||||
"\"></td>\n</tr>\n</table>";
|
||||
//
|
||||
// To get the images into CDash
|
||||
@ -224,7 +238,7 @@ bool QgsRenderChecker::compareImages( QString theTestName,
|
||||
"<DartMeasurementFile name=\"Expected Image\" type=\"image/png\">" +
|
||||
mExpectedImageFile + "</DartMeasurementFile>"
|
||||
"<DartMeasurementFile name=\"Difference Image\" type=\"image/png\">" +
|
||||
myResultDiffImage + "</DartMeasurementFile>";
|
||||
myDiffImageFile + "</DartMeasurementFile>";
|
||||
qDebug( ) << myDashMessage;
|
||||
|
||||
//
|
||||
@ -266,7 +280,7 @@ bool QgsRenderChecker::compareImages( QString theTestName,
|
||||
//
|
||||
//save the diff image to disk
|
||||
//
|
||||
myDifferenceImage.save( myResultDiffImage );
|
||||
myDifferenceImage.save( myDiffImageFile );
|
||||
|
||||
//
|
||||
// Send match result to debug
|
||||
@ -293,7 +307,7 @@ bool QgsRenderChecker::compareImages( QString theTestName,
|
||||
"</DartMeasurement>";
|
||||
qDebug( ) << myDashMessage;
|
||||
|
||||
bool myAnomalyMatchFlag = isKnownAnomaly( myDifferenceImage );
|
||||
bool myAnomalyMatchFlag = isKnownAnomaly( myDiffImageFile );
|
||||
|
||||
if ( myAnomalyMatchFlag )
|
||||
{
|
||||
|
@ -49,6 +49,9 @@ public:
|
||||
* controlImagePath + '/' + mControlName + '/' + mControlName + '.png'
|
||||
*/
|
||||
void setControlName(const QString theName);
|
||||
/** Get an md5 hash that uniquely identifies an image */
|
||||
QString imageToHash( QString theImageFile );
|
||||
|
||||
void setRenderedImage (QString theImageFileName) { mRenderedImageFile = theImageFileName; };
|
||||
void setMapRenderer ( QgsMapRenderer * thepMapRenderer) { mpMapRenderer = thepMapRenderer; };
|
||||
/**
|
||||
@ -81,7 +84,7 @@ public:
|
||||
* acceptible.
|
||||
* @return a bool indicating if the diff matched one of the anomaly files
|
||||
*/
|
||||
bool isKnownAnomaly( QImage theDifferenceImage );
|
||||
bool isKnownAnomaly( QString theDiffImageFile );
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user