projects
/
ptas
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1813f83
)
Works now without any existing location settings, enabling a new user to start using it.
author
Max Waterman
<davidmaxwaterman+maemogit@fastmail.co.uk>
Tue, 23 Mar 2010 15:41:24 +0000
(17:41 +0200)
committer
Max Waterman
<davidmaxwaterman+maemogit@fastmail.co.uk>
Tue, 23 Mar 2010 15:41:24 +0000
(17:41 +0200)
zouba/location.cpp
patch
|
blob
|
history
zouba/location_p.cpp
patch
|
blob
|
history
zouba/locations.cpp
patch
|
blob
|
history
zouba/main.cpp
patch
|
blob
|
history
zouba/ui.cpp
patch
|
blob
|
history
zouba/uicontroller.cpp
patch
|
blob
|
history
zouba/ytv.h
patch
|
blob
|
history
diff --git
a/zouba/location.cpp
b/zouba/location.cpp
index
3b289ca
..
4a4a1a7
100644
(file)
--- a/
zouba/location.cpp
+++ b/
zouba/location.cpp
@@
-33,6
+33,7
@@
Location::Location( const QString &x, const QString &y, const QString &label ) :
q( new LocationPrivate( x, y, label ) ),
manager( new QNetworkAccessManager(this) )
{
q( new LocationPrivate( x, y, label ) ),
manager( new QNetworkAccessManager(this) )
{
+ qDebug() << "Location::Location(" << x << "," << y << "," << label <<")";
connect(
manager, SIGNAL( finished(QNetworkReply*) ),
this, SLOT( replyFinished(QNetworkReply*) )
connect(
manager, SIGNAL( finished(QNetworkReply*) ),
this, SLOT( replyFinished(QNetworkReply*) )
@@
-109,6
+110,7
@@
void Location::resolveAddress( const QString &address )
qDebug() << address;
q->setAddress( address );
qDebug() << address;
q->setAddress( address );
+ q->setValid( false );
QUrl fullUrl( Ytv::Url );
QUrl fullUrl( Ytv::Url );
@@
-126,7
+128,7
@@
void Location::replyFinished( QNetworkReply * reply )
q->parseReply( reply->readAll() );
if ( isValid() ) {
q->parseReply( reply->readAll() );
if ( isValid() ) {
- qDebug() << label() << "becomeValid" << this;
+ qDebug() << label() << "becomeValid";
emit( becomeValid() );
}
}
emit( becomeValid() );
}
}
@@
-153,6
+155,7
@@
QString Location::label() const
void Location::setAddress( const QString &address ) const
{
void Location::setAddress( const QString &address ) const
{
+ qDebug() << "setting address to" << address;
q->setAddress( address );
}
q->setAddress( address );
}
@@
-166,7
+169,6
@@
bool Location::isValid() const
return q->isValid();
}
return q->isValid();
}
-
// Degrees to radians
double Location::radians(double deg)
{
// Degrees to radians
double Location::radians(double deg)
{
diff --git
a/zouba/location_p.cpp
b/zouba/location_p.cpp
index
fd32e12
..
b915be2
100644
(file)
--- a/
zouba/location_p.cpp
+++ b/
zouba/location_p.cpp
@@
-51,8
+51,13
@@
void LocationPrivate::parseReply( const QByteArray &reply )
m_valid = false;
} else {
qDebug() << "(" << m_x << "," << m_y << ")";
m_valid = false;
} else {
qDebug() << "(" << m_x << "," << m_y << ")";
- qDebug() << "is now valid";
- m_valid = true;
+ if ( m_x.isEmpty() || m_y.isEmpty() ) {
+ qDebug() << "is NOT valid";
+ m_valid = false;
+ } else {
+ qDebug() << "is now valid";
+ m_valid = true;
+ }
}
}
}
}
diff --git
a/zouba/locations.cpp
b/zouba/locations.cpp
index
ed818c9
..
04cf6ab
100644
(file)
--- a/
zouba/locations.cpp
+++ b/
zouba/locations.cpp
@@
-57,16
+57,17
@@
void Locations::restoreLocations()
for( int i=0; i<labels.size(); ++i ) {
QString label = labels[i];
for( int i=0; i<labels.size(); ++i ) {
QString label = labels[i];
- qDebug() << "restoring" << label;
settings.beginGroup( label );
settings.beginGroup( label );
- QString x = settings.value( "x" ).toString();
- QString y = settings.value( "y" ).toString();
+ QString x = settings.value( "x" ).toString();
+ QString y = settings.value( "y" ).toString();
+ QString address = settings.value( "address" ).toString();
settings.endGroup();
settings.endGroup();
+ qDebug() << "restoring" << label;
Location *location = new Location( x, y, label );
Location *location = new Location( x, y, label );
- location->setAddress( settings.value( "address" ).toString() );
+ location->setAddress( address );
- locationHash[ location->label() ] = location;
+ locationHash[ label ] = location;
}
settings.endGroup();
}
settings.endGroup();
diff --git
a/zouba/main.cpp
b/zouba/main.cpp
index
47402c8
..
7a0020e
100644
(file)
--- a/
zouba/main.cpp
+++ b/
zouba/main.cpp
@@
-15,7
+15,7
@@
int main(int argc, char *argv[] )
{
int main(int argc, char *argv[] )
{
- qInstallMsgHandler( messageHandler );
+ //qInstallMsgHandler( messageHandler );
QApplication app(argc, argv);
QMainWindow *mainWindow = new QMainWindow;
QApplication app(argc, argv);
QMainWindow *mainWindow = new QMainWindow;
diff --git
a/zouba/ui.cpp
b/zouba/ui.cpp
index
330b71e
..
33319f0
100644
(file)
--- a/
zouba/ui.cpp
+++ b/
zouba/ui.cpp
@@
-123,8
+123,8
@@
void Ui::setAddress( const QString &label )
if ( ok ) {
qDebug() << "new address" << address;
if ( ok ) {
qDebug() << "new address" << address;
- Locations *locations=Locations::instance();
- Location *location = locations->location( label );
+ Locations *locations = Locations::instance();
+ Location *location = locations->location( label );
qDebug() << "location" << location;
if ( location ) {
location->resolveAddress( address );
qDebug() << "location" << location;
if ( location ) {
location->resolveAddress( address );
diff --git
a/zouba/uicontroller.cpp
b/zouba/uicontroller.cpp
index
f1a32cf
..
2f823d2
100644
(file)
--- a/
zouba/uicontroller.cpp
+++ b/
zouba/uicontroller.cpp
@@
-19,6
+19,20
@@
UiController::UiController( Ui *ui ) :
Location *homeLocation = locations->location( "home" );
Location *workLocation = locations->location( "work" );
Location *homeLocation = locations->location( "home" );
Location *workLocation = locations->location( "work" );
+ if ( homeLocation==0 ) {
+ homeLocation = new Location( "home" );
+ locations->addLocation( homeLocation );
+ } else if ( homeLocation->isValid() ) {
+ setHomeButtonValid();
+ }
+
+ if ( workLocation==0 ) {
+ workLocation = new Location( "work" );
+ locations->addLocation( workLocation );
+ } else if ( workLocation->isValid() ) {
+ setWorkButtonValid();
+ }
+
connect(
homeLocation, SIGNAL( becomeValid() ),
this, SLOT( setHomeButtonValid() )
connect(
homeLocation, SIGNAL( becomeValid() ),
this, SLOT( setHomeButtonValid() )
@@
-37,9
+51,6
@@
UiController::UiController( Ui *ui ) :
locations, SLOT( saveLocation() )
);
locations, SLOT( saveLocation() )
);
- homeLocation->resolveAddress( Ytv::Home );
- workLocation->resolveAddress( Ytv::Work );
-
destination.append( homeLocation );
destination.append( workLocation );
destination.append( homeLocation );
destination.append( workLocation );
diff --git
a/zouba/ytv.h
b/zouba/ytv.h
index
430e3cb
..
ee867a5
100644
(file)
--- a/
zouba/ytv.h
+++ b/
zouba/ytv.h
@@
-6,8
+6,8
@@
namespace Ytv {
const QString Username( "zouba" );
const QString Password( "caf9r3ee" );
const QString Username( "zouba" );
const QString Password( "caf9r3ee" );
- const QString Home( QByteArray::fromPercentEncoding( "Taivaanvuohentie%207%2CHelsinki" ) );
- const QString Work( QByteArray::fromPercentEncoding( "It%E4merenkatu%2011%2CHelsinki" ) );
+ //const QString Home( QByteArray::fromPercentEncoding( "Taivaanvuohentie%207%2CHelsinki" ) );
+ //const QString Work( QByteArray::fromPercentEncoding( "It%E4merenkatu%2011%2CHelsinki" ) );
enum {
Slow=1,
enum {
Slow=1,