X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fsatelliteviewwindow.cpp;fp=src%2Fsatelliteviewwindow.cpp;h=c0cdcdf61780558b99de9b2eefab6225a62a73d3;hb=e142c4137c90c764282de17aa1c39efccd6d0c32;hp=0000000000000000000000000000000000000000;hpb=9c5810009491f943e31128f17aeac7517c1ce0f4;p=gpsdata diff --git a/src/satelliteviewwindow.cpp b/src/satelliteviewwindow.cpp new file mode 100644 index 0000000..c0cdcdf --- /dev/null +++ b/src/satelliteviewwindow.cpp @@ -0,0 +1,90 @@ +/* + * GPSData for Maemo. + * Copyright (C) 2011 Roman Moravcik + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "satelliteviewwindow.h" + +SatelliteViewWindow::SatelliteViewWindow(QWidget *parent) : QMainWindow(parent) +{ + m_screenLocked = false; + + createUi(); + + connect(parent, SIGNAL(screenLocked(bool)), this, SLOT(onScreenLocked(bool))); +} + +void SatelliteViewWindow::createUi() +{ +#if defined(Q_OS_SYMBIAN) + setAttribute(Qt::WA_DeleteOnClose); +#elif defined(Q_WS_MAEMO_5) + setAttribute(Qt::WA_Maemo5PortraitOrientation, true); + setWindowFlags(Qt::Dialog); +#endif + + setWindowTitle(tr("Satellite view")); + + m_satelliteView = new SatelliteView(); +#ifdef Q_WS_MAEMO_5 + m_satelliteView->setMinimumSize(480, 480); +#endif + setCentralWidget(m_satelliteView); + +#ifdef Q_OS_SYMBIAN + QAction* backSoftkey = new QAction(tr("Back"), this); + backSoftkey->setSoftKeyRole(QAction::NegativeSoftKey); + connect(backSoftkey, SIGNAL(triggered()), this, SLOT(close())); + addAction(backSoftkey); +#endif +} + +void SatelliteViewWindow::onScreenLocked(bool locked) +{ + m_screenLocked = locked; +} + +void SatelliteViewWindow::onSatellitesInViewUpdated(const QList &satellites) +{ + if (m_screenLocked) + return; + + m_satelliteView->updateWidget(satellites, false); +} + +void SatelliteViewWindow::onSatellitesInUseUpdated(const QList &satellites) +{ + if (m_screenLocked) + return; + + m_satelliteView->updateWidget(satellites, true); +} + +void SatelliteViewWindow::setSatelliteInfoSource(QGeoSatelliteInfoSource *satelliteInfoSource) +{ + m_satellite = satelliteInfoSource; + if (m_satellite) { + connect(m_satellite, SIGNAL(satellitesInViewUpdated(const QList &)), this, + SLOT(onSatellitesInViewUpdated(const QList &))); + connect(m_satellite, SIGNAL(satellitesInUseUpdated(const QList &)), this, + SLOT(onSatellitesInUseUpdated(const QList &))); + + m_satellite->requestUpdate(); + } +}