Initial map scale
authorKaj Wallin <kaj.wallin@ixonos.com>
Mon, 7 Jun 2010 09:36:33 +0000 (12:36 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Mon, 7 Jun 2010 09:36:33 +0000 (12:36 +0300)
Reviewed by:

src/src.pro
src/ui/mainwindow.cpp
src/ui/mapscale.cpp [new file with mode: 0644]
src/ui/mapscale.h [new file with mode: 0644]

index 10e7c8a..4c9298b 100644 (file)
@@ -48,7 +48,8 @@ SOURCES += main.cpp \
     network/networkaccessmanager.cpp \
     network/networkhandler.cpp \
     network/networkcookiejar.cpp \
-    network/networkreply.cpp
+    network/networkreply.cpp \
+    ui/mapscale.cpp
 HEADERS += ui/mainwindow.h \
     map/mapengine.h \
     map/mapview.h \
@@ -94,7 +95,8 @@ HEADERS += ui/mainwindow.h \
     network/networkaccessmanager.h \
     network/networkhandler.h \
     network/networkcookiejar.h \
-    network/networkreply.h
+    network/networkreply.h \
+    ui/mapscale.h
 QT += network \
     webkit
 
index 2ec3199..c2e4fcb 100644 (file)
@@ -34,6 +34,7 @@
 #include "settingsdialog.h"
 #include "userinfopanel.h"
 #include "zoombuttonpanel.h"
+#include "mapscale.h"
 
 #include "mainwindow.h"
 
@@ -83,15 +84,21 @@ MainWindow::MainWindow(QWidget *parent)
     createMenus();
     setWindowTitle(tr("Situare"));
 
+    MapScale *mapScale = new MapScale(this);
+    mapScale->move(250,250);
+
     // set stacking order of widgets
     m_zoomButtonPanel->stackUnder(m_userPanel);
     if(m_fullScreenButton) {
         m_fullScreenButton->stackUnder(m_zoomButtonPanel);
         m_osmLicense->stackUnder(m_fullScreenButton);
     } else
-        m_osmLicense->stackUnder(m_zoomButtonPanel);
+        m_osmLicense->stackUnder(m_zoomButtonPanel);    
     m_ownLocationCrosshair->stackUnder(m_osmLicense);
-    m_mapView->stackUnder(m_ownLocationCrosshair);
+
+    mapScale->stackUnder(m_ownLocationCrosshair);
+
+    m_mapView->stackUnder(mapScale);
 
     this->toggleProgressIndicator(true);
 
diff --git a/src/ui/mapscale.cpp b/src/ui/mapscale.cpp
new file mode 100644 (file)
index 0000000..c6d3110
--- /dev/null
@@ -0,0 +1,42 @@
+ /*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Kaj Wallin - kaj.wallin@ixonos.com
+
+    Situare is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    version 2 as published by the Free Software Foundation.
+
+    Situare is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Situare; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+    USA.
+ */
+
+#include <QPainter>
+#include <QLine>
+#include "mapscale.h"
+
+MapScale::MapScale(QWidget *parent) :
+    QWidget(parent)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+}
+
+MapScale::paintEvent(QPaintEvent *event)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    Q_UNUSED(event);
+
+    QLineF mapScaleBaseLine(2.0, 5.0, 20.0, 5.0);
+    QPainter painter(this);
+    painter.drawLine(mapScaleBaseLine);
+
+}
diff --git a/src/ui/mapscale.h b/src/ui/mapscale.h
new file mode 100644 (file)
index 0000000..2642350
--- /dev/null
@@ -0,0 +1,61 @@
+ /*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Kaj Wallin - kaj.wallin@ixonos.com
+
+    Situare is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    version 2 as published by the Free Software Foundation.
+
+    Situare is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Situare; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+    USA.
+ */
+
+
+#ifndef MAPSCALE_H
+#define MAPSCALE_H
+
+#include <QWidget>
+
+class MapScale : public QWidget
+{
+    Q_OBJECT
+
+public:
+    MapScale(QWidget *parent = 0);
+
+/*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+    /**
+     * @brief Event handler for paint events
+     *
+     * Paints the button and its icon
+     * @param event Paint event
+     */
+    void paintEvent(QPaintEvent *event);
+
+/******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public slots:
+
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
+signals:
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+};
+
+#endif // MAPSCALE_H