Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
remove Qt 4.5 dependencies
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13143 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Mar 22, 2010
1 parent b04de49 commit 1b4be69
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 12 deletions.
11 changes: 7 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -68,11 +68,14 @@
#include <QWhatsThis>

#include <QNetworkAccessManager>
#include <QNetworkDiskCache>
#include <QNetworkReply>
#include <QNetworkProxy>
#include <QAuthenticator>

#if QT_VERSION >= 0x40500
#include <QNetworkDiskCache>
#endif

//
// Mac OS X Includes
// Must include before GEOS 3 due to unqualified use of 'Point'
Expand Down Expand Up @@ -6270,9 +6273,6 @@ void QgisApp::namUpdate()

#if QT_VERSION >= 0x40500
mNAM->setProxyFactory( new QgsNetworkProxyFactory( proxy, excludes ) );
#else
mNAM->setProxy( proxy );
#endif

QNetworkDiskCache *cache = qobject_cast<QNetworkDiskCache*>( nam()->cache() );
if ( !cache )
Expand All @@ -6289,4 +6289,7 @@ void QgisApp::namUpdate()

if ( mNAM->cache() != cache )
mNAM->setCache( cache );
#else
mNAM->setProxy( proxy );
#endif
}
14 changes: 10 additions & 4 deletions src/app/qgsoptions.cpp
Expand Up @@ -29,7 +29,10 @@
#include <QColorDialog>
#include <QLocale>
#include <QNetworkAccessManager>

#if QT_VERSION >= 0x40500
#include <QNetworkDiskCache>
#endif

#include <limits>
#include <sqlite3.h>
Expand Down Expand Up @@ -116,10 +119,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
}
}

#if QT_VERSION < 0x40500
grpUrlExclude->setHidden( true );
#endif

#if QT_VERSION >= 0x40500
// cache settings
QNetworkDiskCache *cache = qobject_cast<QNetworkDiskCache*>( QgisApp::instance()->nam()->cache() );
if ( cache )
Expand All @@ -131,6 +131,10 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
QgsDebugMsg( QString( "set cacheSize: %1" ).arg( cache->maximumCacheSize() ) );
mCacheSize->setValue( cache->maximumCacheSize() / 1024 );
}
#else
grpUrlExclude->setHidden( true );
grpCache->setHidden( true );
#endif

//wms search server
leWmsSearch->setText( settings.value( "/qgis/WMSSearchUrl", "http://geopole.org/wms/search?search=%1&type=rss" ).toString() );
Expand Down Expand Up @@ -868,5 +872,7 @@ void QgsOptions::on_mBrowseCacheDirectory_clicked()

void QgsOptions::on_mClearCache_clicked()
{
#if QT_VERSION >= 0x40500
QgisApp::instance()->nam()->cache()->clear();
#endif
}
Expand Up @@ -238,7 +238,7 @@ QList<QString> QgsPointDisplacementRenderer::usedAttributes()
}
if ( mRenderer )
{
attributeList.append( mRenderer->usedAttributes() );
attributeList += mRenderer->usedAttributes();
}
return attributeList;
}
Expand Down
Expand Up @@ -224,7 +224,11 @@ void QgsPointDisplacementRendererWidget::on_mCircleColorButton_clicked()
return;
}

#if QT_VERSION >= 0x040500
QColor newColor = QColorDialog::getColor( mRenderer->circleColor(), 0, tr( "Circle color" ), QColorDialog::ShowAlphaChannel );
#else
QColor newColor = QColorDialog::getColor( mRenderer->circleColor() );
#endif
if ( newColor.isValid() )
{
mRenderer->setCircleColor( newColor );
Expand All @@ -239,7 +243,11 @@ void QgsPointDisplacementRendererWidget::on_mLabelColorButton_clicked()
return;
}

#if QT_VERSION >= 0x040500
QColor newColor = QColorDialog::getColor( mRenderer->labelColor(), 0, tr( "Label color" ), QColorDialog::ShowAlphaChannel );
#else
QColor newColor = QColorDialog::getColor( mRenderer->labelColor() );
#endif
if ( newColor.isValid() )
{
mRenderer->setLabelColor( newColor );
Expand Down
9 changes: 8 additions & 1 deletion src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -35,9 +35,12 @@
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QNetworkDiskCache>
#include <QNetworkProxy>

#if QT_VERSION >= 0x40500
#include <QNetworkDiskCache>
#endif

#include <QUrl>
#include <QImage>
#include <QPainter>
Expand Down Expand Up @@ -105,6 +108,7 @@ QgsWmsProvider::QgsWmsProvider( QString const &uri )
}
}

#if QT_VERSION >= 0x40500
if ( !smNAM )
{
QgsDebugMsg( "application doesn't have a network access manager - creating wmscache" );
Expand All @@ -113,6 +117,7 @@ QgsWmsProvider::QgsWmsProvider( QString const &uri )
ndc->setCacheDirectory( "wmsCache" );
smNAM->setCache( ndc );
}
#endif
}

// URL may contain username/password information for a WMS
Expand Down Expand Up @@ -670,11 +675,13 @@ void QgsWmsProvider::tileReplyFinished()
{
QNetworkReply *reply = qobject_cast<QNetworkReply*>( sender() );

#if QT_VERSION >= 0x40500
bool fromCache = reply->attribute( QNetworkRequest::SourceIsFromCacheAttribute ).toBool();
if ( fromCache )
mCacheHits++;
else
mCacheMisses++;
#endif
int tileReqNo = reply->request().attribute( static_cast<QNetworkRequest::Attribute>( QNetworkRequest::User + 0 ) ).toInt();
int tileNo = reply->request().attribute( static_cast<QNetworkRequest::Attribute>( QNetworkRequest::User + 1 ) ).toInt();
QRectF r = reply->request().attribute( static_cast<QNetworkRequest::Attribute>( QNetworkRequest::User + 2 ) ).toRectF();
Expand Down
4 changes: 2 additions & 2 deletions src/ui/qgsoptionsbase.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>813</width>
<height>565</height>
<height>605</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -1407,7 +1407,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<widget class="QGroupBox" name="grpCache">
<property name="title">
<string>Cache settings</string>
</property>
Expand Down

0 comments on commit 1b4be69

Please sign in to comment.