From 1cf58dffe1f9e95fafe4d1f4f7c9ad8bf54eec87 Mon Sep 17 00:00:00 2001 From: Kaj Wallin Date: Mon, 7 Jun 2010 12:36:33 +0300 Subject: [PATCH] Initial map scale Reviewed by: --- src/src.pro | 6 +++-- src/ui/mainwindow.cpp | 11 +++++++-- src/ui/mapscale.cpp | 42 ++++++++++++++++++++++++++++++++++ src/ui/mapscale.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 src/ui/mapscale.cpp create mode 100644 src/ui/mapscale.h diff --git a/src/src.pro b/src/src.pro index 10e7c8a..4c9298b 100644 --- a/src/src.pro +++ b/src/src.pro @@ -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 diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 2ec3199..c2e4fcb 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -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 index 0000000..c6d3110 --- /dev/null +++ b/src/ui/mapscale.cpp @@ -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 +#include +#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 index 0000000..2642350 --- /dev/null +++ b/src/ui/mapscale.h @@ -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 + +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 -- 1.7.9.5