QTM_USE_NAMESPACE
-Location::Location( QString x, QString y ) :
- q( new LocationPrivate( x, y ) ),
+Location::Location( const QString &x, const QString &y, const QString &label ) :
+ q( new LocationPrivate( x, y, label ) ),
manager( new QNetworkAccessManager(this) )
{
- connect( manager, SIGNAL( finished(QNetworkReply*) ), this, SLOT( replyFinished(QNetworkReply*) ) );
+ connect(
+ manager, SIGNAL( finished(QNetworkReply*) ),
+ this, SLOT( replyFinished(QNetworkReply*) )
+ );
}
-Location::Location( const QGeoPositionInfo &positionInfo ) :
- q( new LocationPrivate() ),
+Location::Location( const QGeoPositionInfo &positionInfo, const QString &label ) :
+ q( new LocationPrivate( label ) ),
manager(0)
{
qreal latitude = positionInfo.coordinate().latitude();
Location::Location( const Location &from ) :
QObject(0),
- q( new LocationPrivate() ),
+ q( new LocationPrivate( from.label() ) ),
manager(0)
{
+ q->setAddress( from.address() );
q->setX( from.x() );
q->setY( from.y() );
q->setValid( from.isValid() );
}
}
-Location::Location() :
- q( new LocationPrivate() ),
+Location::Location( const QString &label ) :
+ q( new LocationPrivate( label ) ),
manager( new QNetworkAccessManager(this) )
{
connect( manager, SIGNAL( finished(QNetworkReply*) ), this, SLOT( replyFinished(QNetworkReply*) ) );
Location &Location::operator=( const Location &from )
{
- q = new LocationPrivate();
+ q = new LocationPrivate( from.label() );
+ q->setAddress( from.address() );
q->setX( from.x() );
q->setY( from.y() );
q->setValid( from.isValid() );
return *this;
}
-void Location::resolveAddress( QString address )
+void Location::resolveAddress( const QString &address )
{
qDebug() << "resolving address";
qDebug() << address;
+ q->setAddress( address );
+
QUrl fullUrl( Ytv::Url );
fullUrl.addEncodedQueryItem( "key", address.toAscii().toPercentEncoding() );
return q->y();
}
+void Location::setLabel( const QString &label ) const
+{
+ q->setLabel( label );
+}
+
+QString Location::label() const
+{
+ return q->label();
+}
+
+void Location::setAddress( const QString &address ) const
+{
+ q->setAddress( address );
+}
+
+QString Location::address() const
+{
+ return q->address();
+}
+
bool Location::isValid() const
{
return q->isValid();