Skip to content

Commit

Permalink
remove remaining QT_VERSION <=> 5 checks (also fixes b3e8d82)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jan 25, 2017
1 parent 01004d9 commit 43faf33
Show file tree
Hide file tree
Showing 17 changed files with 2 additions and 309 deletions.
File renamed without changes.
Expand Up @@ -18,13 +18,8 @@




#include <QtGlobal> #include <QtGlobal>
#if QT_VERSION < 0x050000
#include <QDesignerCustomWidgetCollectionInterface>
#include <QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerCustomWidgetInterface> #include <QtUiPlugin/QDesignerCustomWidgetInterface>
#include <QtUiPlugin/QDesignerExportWidget> #include <QtUiPlugin/QDesignerExportWidget>
#endif




class CUSTOMWIDGETS_EXPORT %CLASSMIXEDCASE%Plugin : public QObject, public QDesignerCustomWidgetInterface class CUSTOMWIDGETS_EXPORT %CLASSMIXEDCASE%Plugin : public QObject, public QDesignerCustomWidgetInterface
Expand Down
2 changes: 1 addition & 1 deletion scripts/customwidget_create.sh
Expand Up @@ -26,7 +26,7 @@ declare -a EXT=("cpp" "h")
for i in "${EXT[@]}" for i in "${EXT[@]}"
do do
DESTFILE=$DIR/../src/customwidgets/${CLASSLOWER}plugin.$i DESTFILE=$DIR/../src/customwidgets/${CLASSLOWER}plugin.$i
cp $DIR/customwidget_template.$i $DESTFILE cp $DIR/customwidget.$i.template $DESTFILE
sed -i s/%DATE%/"$TODAY"/g "$DESTFILE" sed -i s/%DATE%/"$TODAY"/g "$DESTFILE"
sed -i s/%YEAR%/"$YEAR"/g "$DESTFILE" sed -i s/%YEAR%/"$YEAR"/g "$DESTFILE"
sed -i s/%AUTHOR%/"$AUTHOR"/g "$DESTFILE" sed -i s/%AUTHOR%/"$AUTHOR"/g "$DESTFILE"
Expand Down
5 changes: 0 additions & 5 deletions src/customwidgets/qgiscustomwidgets.cpp
Expand Up @@ -63,8 +63,3 @@ QList<QDesignerCustomWidgetInterface*> QgisCustomWidgets::customWidgets() const
{ {
return mWidgets; return mWidgets;
} }

Q_EXPORT_PLUGIN2( customwidgetsplugin, QgisCustomWidgets )



5 changes: 0 additions & 5 deletions src/providers/oracle/ocispatial/main.cpp
Expand Up @@ -68,9 +68,4 @@ QStringList QOCISpatialDriverPlugin::keys() const
return l; return l;
} }


#if QT_VERSION < 0x050000
Q_EXPORT_STATIC_PLUGIN( QOCISpatialDriverPlugin )
Q_EXPORT_PLUGIN2( qsqlocispatial, QOCISpatialDriverPlugin )
#endif

QT_END_NAMESPACE QT_END_NAMESPACE
4 changes: 0 additions & 4 deletions src/providers/oracle/ocispatial/main.h
Expand Up @@ -47,10 +47,6 @@
#include <QSqlDriverPlugin> #include <QSqlDriverPlugin>
#include <QStringList> #include <QStringList>


#if QT_VERSION < 0x050000
#define Q_PLUGIN_METADATA(x)
#endif

class QOCISpatialDriverPlugin : public QSqlDriverPlugin class QOCISpatialDriverPlugin : public QSqlDriverPlugin
{ {
Q_OBJECT Q_OBJECT
Expand Down
21 changes: 0 additions & 21 deletions src/providers/oracle/ocispatial/qsql_ocispatial.cpp
Expand Up @@ -94,10 +94,8 @@
#define QOCISPATIAL_THREADED #define QOCISPATIAL_THREADED




#if QT_VERSION >= 0x050000
Q_DECLARE_OPAQUE_POINTER( OCIEnv* ) Q_DECLARE_OPAQUE_POINTER( OCIEnv* )
Q_DECLARE_OPAQUE_POINTER( OCIStmt* ) Q_DECLARE_OPAQUE_POINTER( OCIStmt* )
#endif
Q_DECLARE_METATYPE( OCIEnv* ) Q_DECLARE_METATYPE( OCIEnv* )
Q_DECLARE_METATYPE( OCIStmt* ) Q_DECLARE_METATYPE( OCIStmt* )


Expand Down Expand Up @@ -3255,23 +3253,6 @@ QVariant QOCISpatialResult::lastInsertId() const
return QVariant(); return QVariant();
} }


void QOCISpatialResult::virtual_hook( int id, void *data )
{
ENTER
Q_ASSERT( data );

switch ( id )
{
#if QT_VERSION < 0x050000
case QSqlResult::BatchOperation:
QOCISpatialCols::execBatch( d, boundValues(), *reinterpret_cast<bool *>( data ) );
break;
#endif
default:
QSqlCachedResult::virtual_hook( id, data );
}
}

//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////




Expand Down Expand Up @@ -3356,9 +3337,7 @@ bool QOCISpatialDriver::hasFeature( DriverFeature f ) const
case EventNotifications: case EventNotifications:
case FinishQuery: case FinishQuery:
case MultipleResultSets: case MultipleResultSets:
#if QT_VERSION >= 0x050000
case CancelQuery: case CancelQuery:
#endif
return false; return false;
case Unicode: case Unicode:
return d->serverVersion >= 9; return d->serverVersion >= 9;
Expand Down
1 change: 0 additions & 1 deletion src/providers/oracle/ocispatial/qsql_ocispatial.h
Expand Up @@ -83,7 +83,6 @@ class Q_EXPORT_SQLDRIVER_OCISPATIAL QOCISpatialResult : public QSqlCachedResult
int numRowsAffected(); int numRowsAffected();
QSqlRecord record() const; QSqlRecord record() const;
QVariant lastInsertId() const; QVariant lastInsertId() const;
void virtual_hook( int id, void *data );


private: private:
QOCISpatialResultPrivate *d; QOCISpatialResultPrivate *d;
Expand Down
80 changes: 0 additions & 80 deletions src/providers/oracle/qgsoracleprovider.cpp
Expand Up @@ -271,86 +271,6 @@ QString QgsOracleProvider::storageType() const
return "Oracle database with locator/spatial extension"; return "Oracle database with locator/spatial extension";
} }


#if QT_VERSION < 0x050000
static bool operator<( const QVariant &a, const QVariant &b )
{
if ( a.isNull() || b.isNull() )
return false;

if ( a.type() == b.type() )
{
switch ( a.type() )
{
case QVariant::Int:
case QVariant::Char:
return a.toInt() < b.toInt();

case QVariant::Double:
return a.toDouble() < b.toDouble();

case QVariant::LongLong:
return a.toLongLong() < b.toLongLong();

case QVariant::List:
{
QList<QVariant> al = a.toList();
QList<QVariant> bl = b.toList();

int i, n = qMin( al.size(), bl.size() );
for ( i = 0; i < n && al[i] == bl[i]; i++ )
;

if ( i == n )
return al.size() < bl.size();
else
return al[i] < bl[i];
}
break;

case QVariant::StringList:
{
QStringList al = a.toStringList();
QStringList bl = b.toStringList();

int i, n = qMin( al.size(), bl.size() );
for ( i = 0; i < n && al[i] == bl[i]; i++ )
;

if ( i == n )
return al.size() < bl.size();
else
return al[i] < bl[i];
}
break;

case QVariant::Date:
return a.toDate() < b.toDate();

case QVariant::Time:
return a.toTime() < b.toTime();

case QVariant::DateTime:
return a.toDateTime() < b.toDateTime();

case QVariant::Bool:
return a.toBool() < b.toBool();

case QVariant::UInt:
return a.toUInt() < b.toUInt();

case QVariant::ULongLong:
return a.toULongLong() < b.toULongLong();

default:
break;
}
}

return a.canConvert( QVariant::String ) && b.canConvert( QVariant::String ) && a.toString() < b.toString();
}
#endif


QString QgsOracleProvider::pkParamWhereClause() const QString QgsOracleProvider::pkParamWhereClause() const
{ {
QString whereClause; QString whereClause;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -333,7 +333,7 @@ QString QgsPostgresProvider::storageType() const
return QStringLiteral( "PostgreSQL database with PostGIS extension" ); return QStringLiteral( "PostgreSQL database with PostGIS extension" );
} }


#if QT_VERSION >= 0x050000 && QT_VERSION < 0x050600 #if QT_VERSION < 0x050600
#include <algorithm> #include <algorithm>
template <typename T> template <typename T>
bool operator<( const QList<T> &lhs, const QList<T> &rhs ) bool operator<( const QList<T> &lhs, const QList<T> &rhs )
Expand Down
20 changes: 0 additions & 20 deletions src/providers/spatialite/qspatialite/qsql_spatialite.cpp
Expand Up @@ -60,10 +60,8 @@
#include <sqlite3.h> #include <sqlite3.h>
#include <qgsslconnect.h> #include <qgsslconnect.h>


#if QT_VERSION >= 0x050000
Q_DECLARE_OPAQUE_POINTER(sqlite3*) Q_DECLARE_OPAQUE_POINTER(sqlite3*)
Q_DECLARE_OPAQUE_POINTER(sqlite3_stmt*) Q_DECLARE_OPAQUE_POINTER(sqlite3_stmt*)
#endif
Q_DECLARE_METATYPE(sqlite3*) Q_DECLARE_METATYPE(sqlite3*)
Q_DECLARE_METATYPE(sqlite3_stmt*) Q_DECLARE_METATYPE(sqlite3_stmt*)


Expand Down Expand Up @@ -326,20 +324,6 @@ QSpatiaLiteResult::~QSpatiaLiteResult()
delete d; delete d;
} }


void QSpatiaLiteResult::virtual_hook(int id, void *data)
{
switch (id) {
#if QT_VERSION < 0x050000
case QSqlResult::DetachFromResultSet:
if (d->stmt)
sqlite3_reset(d->stmt);
break;
#endif
default:
QSqlCachedResult::virtual_hook(id, data);
}
}

bool QSpatiaLiteResult::reset(const QString &query) bool QSpatiaLiteResult::reset(const QString &query)
{ {
if (!prepare(query)) if (!prepare(query))
Expand Down Expand Up @@ -491,13 +475,11 @@ QSqlRecord QSpatiaLiteResult::record() const
return d->rInf; return d->rInf;
} }


#if QT_VERSION >= 0x050000
void QSpatiaLiteResult::detachFromResultSet() void QSpatiaLiteResult::detachFromResultSet()
{ {
if (d->stmt) if (d->stmt)
sqlite3_reset(d->stmt); sqlite3_reset(d->stmt);
} }
#endif


QVariant QSpatiaLiteResult::handle() const QVariant QSpatiaLiteResult::handle() const
{ {
Expand Down Expand Up @@ -545,9 +527,7 @@ bool QSpatiaLiteDriver::hasFeature(DriverFeature f) const
case BatchOperations: case BatchOperations:
case EventNotifications: case EventNotifications:
case MultipleResultSets: case MultipleResultSets:
#if QT_VERSION >= 0x050000
case CancelQuery: case CancelQuery:
#endif
return false; return false;
} }
return false; return false;
Expand Down
3 changes: 0 additions & 3 deletions src/providers/spatialite/qspatialite/qsql_spatialite.h
Expand Up @@ -80,10 +80,7 @@ class QSpatiaLiteResult : public QSqlCachedResult
int numRowsAffected(); int numRowsAffected();
QVariant lastInsertId() const; QVariant lastInsertId() const;
QSqlRecord record() const; QSqlRecord record() const;
#if QT_VERSION >= 0x050000
void detachFromResultSet(); void detachFromResultSet();
#endif
void virtual_hook(int id, void *data);


private: private:
QSpatiaLiteResultPrivate* d; QSpatiaLiteResultPrivate* d;
Expand Down
5 changes: 0 additions & 5 deletions src/providers/spatialite/qspatialite/smain.cpp
Expand Up @@ -62,8 +62,3 @@ QStringList QSpatiaLiteDriverPlugin::keys() const
l << QLatin1String("QSPATIALITE"); l << QLatin1String("QSPATIALITE");
return l; return l;
} }

#if QT_VERSION < 0x050000
Q_EXPORT_STATIC_PLUGIN( QSpatiaLiteDriverPlugin )
Q_EXPORT_PLUGIN2( qspatialite, QSpatiaLiteDriverPlugin )
#endif
3 changes: 0 additions & 3 deletions src/providers/spatialite/qspatialite/smain.h
Expand Up @@ -45,9 +45,6 @@
#include <QSqlDriverPlugin> #include <QSqlDriverPlugin>
#include <QStringList> #include <QStringList>


#if QT_VERSION < 0x050000
#define Q_PLUGIN_METADATA(x)
#endif


class QSpatiaLiteDriverPlugin : public QSqlDriverPlugin class QSpatiaLiteDriverPlugin : public QSqlDriverPlugin
{ {
Expand Down
26 changes: 0 additions & 26 deletions src/server/qgsremotedatasourcebuilder.cpp
Expand Up @@ -17,10 +17,6 @@


#include "qgis.h" #include "qgis.h"
#include "qgsremotedatasourcebuilder.h" #include "qgsremotedatasourcebuilder.h"
#if QT_VERSION < 0x050000
#include "qgsftptransaction.h"
#include "qgshttptransaction.h"
#endif
#include "qgslogger.h" #include "qgslogger.h"
#include "qgsrasterlayer.h" #include "qgsrasterlayer.h"
#include "qgsvectorlayer.h" #include "qgsvectorlayer.h"
Expand Down Expand Up @@ -158,30 +154,8 @@ QgsVectorLayer* QgsRemoteDataSourceBuilder::vectorLayerFromRemoteVDS( const QDom


int QgsRemoteDataSourceBuilder::loadData( const QString& url, QByteArray& data ) const int QgsRemoteDataSourceBuilder::loadData( const QString& url, QByteArray& data ) const
{ {
#if QT_VERSION < 0x050000
if ( url.startsWith( "http", Qt::CaseInsensitive ) )
{
QgsHttpTransaction http( url );
if ( !http.getSynchronously( data ) )
{
QgsDebugMsg( "Error, loading from http failed" );
return 1; //no success
}
}
else if ( url.startsWith( "ftp", Qt::CaseInsensitive ) )
{
Q_NOWARN_DEPRECATED_PUSH;
QgsFtpTransaction ftp;
if ( ftp.get( url, data ) != 0 )
{
return 1;
}
Q_NOWARN_DEPRECATED_POP;
}
#else
Q_UNUSED( url ) Q_UNUSED( url )
Q_UNUSED( data ) Q_UNUSED( data )
QgsDebugMsg( "http and ftp remote datasources not supported with Qt5" ); QgsDebugMsg( "http and ftp remote datasources not supported with Qt5" );
#endif
return 0; return 0;
} }

0 comments on commit 43faf33

Please sign in to comment.