Initial commit
[iamhere] / src / window.h
1 /*
2  * I Am Here(iamhere) - an application to find user's location
3  * address.
4  * Copyright (C) 2010 Vytarani Mathane <vytarani.mathane@gmail.com>.
5  *
6  * This file is part of I Am Here.
7  *
8  * I Am Here is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * I Am Here is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with I Am Here.  If not, see <http://www.gnu.org/licenses/>.
20  */
21 #include <QtGui>
22 #include <QMainWindow>
23
24 #include <QWidget>
25 #include <QGeoSearchManager>
26 #include <QGeoServiceProvider>
27 #include <QGeoPositionInfoSource>
28 #include <QDebug>
29 #include <QTimer>
30
31  QTM_USE_NAMESPACE 
32  class Window:public QMainWindow {
33  Q_OBJECT 
34  public:
35         Window(QWidget * parent);
36
37         private slots:
38         void positionUpdated(const QGeoPositionInfo & info);
39         void updateTimeout() {
40                 // Current location could not be retrieved within the specified timeout of 5 seconds.
41                 qWarning("Failed to retrieve current position.");
42         }
43         void advance();
44
45         public slots: void handlePressed();
46         void handlePressedClose();
47         void replyFinished(QGeoSearchReply * reply);
48         void resultsError(QGeoSearchReply * reply,
49                           QGeoSearchReply::Error errorCode,
50                           QString errorString);
51  private:
52         QGeoSearchManager * m_searchManager;
53         QGeoServiceProvider *m_serviceProvider;
54         QGeoPositionInfoSource *m_source;
55         QGeoCoordinate m_coord;
56         QLabel *m_imagelabel;
57         QLabel *m_textlabel;
58         QTimer *m_timer;
59         int m_flag;
60 };