Merge branch 'master' into userinfo
authorKatri Kaikkonen <katri.kaikkonen@ixonos.com>
Fri, 14 May 2010 12:42:11 +0000 (15:42 +0300)
committerKatri Kaikkonen <katri.kaikkonen@ixonos.com>
Fri, 14 May 2010 12:42:11 +0000 (15:42 +0300)
Conflicts:
src/src.pro
src/ui/mapviewscreen.cpp
src/ui/mapviewscreen.h

1  2 
src/src.pro
src/ui/mapviewscreen.cpp
src/ui/userinfo.cpp

diff --cc src/src.pro
@@@ -83,23 -82,32 +82,34 @@@ HEADERS += ui/mainwindow.h 
      ui/userinfo.h
  QT += network \
      webkit
 -DEFINES += QT_NO_DEBUG_OUTPUT
 +
- # DEFINES += QT_NO_DEBUG_OUTPUT
- !maemo5 { 
++#DEFINES += QT_NO_DEBUG_OUTPUT
+ !maemo5 {
+     SOURCES += gps/gpspositionmockup.cpp
+     HEADERS += gps/gpspositionmockup.h
      message(QJson built in)
      message(Make sure you have QJson development headers installed)
      message(install headers with: sudo apt-get install libqjson-dev)
  }
- maemo5 { 
+ maemo5 {
+     SOURCES += gps/gpsposition.cpp
+     HEADERS += gps/gpsposition.h
      QT += maemo5
-     message(QJson built in)
+     CONFIG += mobility
+     MOBILITY = location
+     message([QJson])
      message(Make sure you have QJson development headers installed)
      message(add: deb http://repository.maemo.org/extras-devel fremantle free non-free)
-     message(to scratchbox's sources.list in /etc/apt)
+     message(to Scratchbox's sources.list in /etc/apt)
      message(run: apt-get update)
      message(install headers with: apt-get install libqjson-dev)
+     message([QtMobility])
+     message(Make sure you have QtMobility development headers installed)
+     message(install headers with: apt-get install libqtm-dev)
  }
  
++
  # -----------------------------------------------------------------
  # Debian packetizing additions
  # -----------------------------------------------------------------
  #include "panelsidebar.h"
  
  MapViewScreen::MapViewScreen(QWidget *parent)
-    : QWidget(parent)
+    : QWidget(parent),
+      m_autoCenteringEnabled(false)
  {
      MapView *mapView = new MapView(this);
-     mapEngine = new MapEngine(this);
-     mapView->setScene(mapEngine->scene());
+     m_mapEngine = new MapEngine(this);
+     mapView->setScene(m_mapEngine->scene());
  
-     FriendListPanel *friendsListPanel = new FriendListPanel(this);
-     userPanel = new UserInfoPanel(this);
-     PanelSideBar *m_userPanelSidebar = new PanelSideBar(this, LEFT);
+     m_friendsListPanel = new FriendListPanel(this);
+     m_userPanel = new UserInfoPanel(this);
+     PanelSideBar *userPanelSidebar = new PanelSideBar(this, LEFT);
      PanelSideBar *friendsListPanelSidebar = new PanelSideBar(this, RIGHT);
  
+     m_zoomButtonPanel = new ZoomButtonPanel(this, ZOOM_BUTTON_PANEL_POSITION_X,
+                                             ZOOM_BUTTON_PANEL_POSITION_Y);
      connect(mapView, SIGNAL(viewScrolled(QPoint)),
-             mapEngine, SLOT(setLocation(QPoint)));
-     connect(mapEngine, SIGNAL(locationChanged(QPoint)),
+             m_mapEngine, SLOT(setLocation(QPoint)));
+     connect(m_mapEngine, SIGNAL(locationChanged(QPoint)),
              mapView, SLOT(centerToSceneCoordinates(QPoint)));
-     connect(mapEngine, SIGNAL(zoomLevelChanged(int)),
+     connect(m_mapEngine, SIGNAL(zoomLevelChanged(int)),
              mapView, SLOT(setZoomLevel(int)));
      connect(mapView, SIGNAL(viewResized(QSize)),
-             mapEngine, SLOT(viewResized(QSize)));
+             m_mapEngine, SLOT(viewResized(QSize)));
      connect(mapView, SIGNAL(viewContentChanged(QPoint)),
-             mapEngine, SLOT(alignImmovableItems(QPoint)));
+             m_mapEngine, SLOT(alignImmovableItems(QPoint)));
      connect(mapView, SIGNAL(viewZoomFinished()),
-             mapEngine, SLOT(viewZoomFinished()));
+             m_mapEngine, SLOT(viewZoomFinished()));
  
-     connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
-             this, SLOT(drawOsmLicense(int, int)));
+     connect(this, SIGNAL(zoomInKeyPressed()),
+             m_mapEngine, SLOT(zoomIn()));
+     connect(this, SIGNAL(zoomOutKeyPressed()),
+             m_mapEngine, SLOT(zoomOut()));
  
-     connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
-             friendsListPanel, SLOT(reDrawFriendsPanel(int,int)));
-     connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
-             userPanel, SLOT(reDrawUserPanel(int,int)));
-     connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
-             friendsListPanelSidebar, SLOT(reDrawSidebar(int,int)));
+     connect(mapView, SIGNAL(viewResizedNewSize(int, int)),
+             this, SLOT(drawOsmLicense(int, int)));
+     connect(mapView, SIGNAL(viewResizedNewSize(int, int)),
+             m_friendsListPanel, SLOT(reDrawFriendsPanel(int, int)));
+     connect(mapView, SIGNAL(viewResizedNewSize(int, int)),
+             m_userPanel, SLOT(reDrawUserPanel(int, int)));
+     connect(mapView, SIGNAL(viewResizedNewSize(int, int)),
+             friendsListPanelSidebar, SLOT(reDrawSidebar(int, int)));
+     connect(m_zoomButtonPanel->m_zoomInBtn, SIGNAL(clicked()),
+             m_mapEngine, SLOT(zoomIn()));
+     connect(m_zoomButtonPanel->m_zoomOutBtn, SIGNAL(clicked()),
+             m_mapEngine, SLOT(zoomOut()));
  
      connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
-             friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
+             m_friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
+     connect(m_friendsListPanel, SIGNAL(findFriend(QPointF)),
+             m_mapEngine, SLOT(setViewLocation(QPointF)));
  
- //    connect(this, SIGNAL(userLocationReady(User*)),
- //            mapEngine, SLOT(receiveOwnLocation(User*)));
      connect(this, SIGNAL(userLocationReady(User*)),
-             this, SLOT(receiveUserData(User*)));
+             m_mapEngine, SLOT(receiveOwnLocation(User*)));
++    connect(this, SIGNAL(userLocationReady(User*)),
++            m_mapEngine, SLOT(receiveOwnLocation(User*)));
      connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
-             mapEngine, SIGNAL(friendsLocationsReady(QList<User*>&)));
+             m_mapEngine, SIGNAL(friendsLocationsReady(QList<User*>&)));
  
-     QHBoxLayout *mapViewLayout = new QHBoxLayout;
+     connect(m_mapEngine, SIGNAL(mapScrolled()),
+             this, SLOT(locationChanged()));
++    connect(this, SIGNAL(userLocationReady(User*)),
++            m_userPanel, SLOT(receiveUserData(User*)));
 +
-     osmLicense = new QLabel(this);
-     osmLicense->setAttribute(Qt::WA_TranslucentBackground, true);
-     osmLicense->setAttribute(Qt::WA_TransparentForMouseEvents, true);
-     osmLicense->setText("<font color='black'>"+OSM_LICENSE+"</font>");
-     osmLicense->setFont(QFont("Nokia Sans", 9));
-     osmLicense->resize(osmLicense->fontMetrics().width(OSM_LICENSE),
-                        osmLicense->fontMetrics().height());
+     QHBoxLayout *mapViewLayout = new QHBoxLayout;
  
-     friendsListPanel->stackUnder(friendsListPanelSidebar);
-     m_userPanelSidebar->stackUnder(friendsListPanel);
-     userPanel->stackUnder(m_userPanelSidebar);
-     osmLicense->stackUnder(userPanel);
-     mapView->stackUnder(osmLicense);
+     m_osmLicense = new QLabel(this);
+     m_osmLicense->setAttribute(Qt::WA_TranslucentBackground, true);
+     m_osmLicense->setAttribute(Qt::WA_TransparentForMouseEvents, true);
+     m_osmLicense->setText("<font color='black'>" + OSM_LICENSE + "</font>");
+     m_osmLicense->setFont(QFont("Nokia Sans", 9));
+     m_osmLicense->resize(m_osmLicense->fontMetrics().width(OSM_LICENSE),
+                          m_osmLicense->fontMetrics().height());
+     m_friendsListPanel->stackUnder(friendsListPanelSidebar);
+     userPanelSidebar->stackUnder(m_friendsListPanel);
+     m_userPanel->stackUnder(userPanelSidebar);
+     m_zoomButtonPanel->stackUnder(m_userPanel);
+     m_osmLicense->stackUnder(m_zoomButtonPanel);
+     mapView->stackUnder(m_osmLicense);
  
      mapViewLayout->addWidget(mapView);
      setLayout(mapViewLayout);
@@@ -274,6 -277,6 +274,7 @@@ void UserInfo::paintEvent(QPaintEvent *
      qDebug() << __PRETTY_FUNCTION__ << " " << aPaintEvent->rect();
  
      QPainter painter(this);
++
      QRect topRect = QRect(0, 0, ITEM_MIN_WIDTH, BACKGROUND_TOP_HEIGHT);
      QRect middleRect = QRect(0, topRect.bottom(), ITEM_MIN_WIDTH,
                               height() - BACKGROUND_TOP_HEIGHT - BACKGROUND_BOTTOM_HEIGHT);