3 * Copyright (C) 2011 Roman Moravcik
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "satelliteviewwindow.h"
24 SatelliteViewWindow::SatelliteViewWindow(QWidget *parent) : QMainWindow(parent)
26 m_screenLocked = false;
30 connect(parent, SIGNAL(screenLocked(bool)), this, SLOT(onScreenLocked(bool)));
33 void SatelliteViewWindow::createUi()
35 #if defined(Q_OS_SYMBIAN)
36 setAttribute(Qt::WA_DeleteOnClose);
37 #elif defined(Q_WS_MAEMO_5)
38 setAttribute(Qt::WA_Maemo5PortraitOrientation, true);
39 setWindowFlags(Qt::Dialog);
42 setWindowTitle(tr("Satellite view"));
44 m_satelliteView = new SatelliteView();
46 m_satelliteView->setMinimumSize(480, 480);
48 setCentralWidget(m_satelliteView);
51 QAction* backSoftkey = new QAction(tr("Back"), this);
52 backSoftkey->setSoftKeyRole(QAction::NegativeSoftKey);
53 connect(backSoftkey, SIGNAL(triggered()), this, SLOT(close()));
54 addAction(backSoftkey);
58 void SatelliteViewWindow::onScreenLocked(bool locked)
60 m_screenLocked = locked;
63 void SatelliteViewWindow::onSatellitesInViewUpdated(const QList<QGeoSatelliteInfo> &satellites)
68 m_satelliteView->updateWidget(satellites, false);
71 void SatelliteViewWindow::onSatellitesInUseUpdated(const QList<QGeoSatelliteInfo> &satellites)
76 m_satelliteView->updateWidget(satellites, true);
79 void SatelliteViewWindow::setSatelliteInfoSource(QGeoSatelliteInfoSource *satelliteInfoSource)
81 m_satellite = satelliteInfoSource;
83 connect(m_satellite, SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &)), this,
84 SLOT(onSatellitesInViewUpdated(const QList<QGeoSatelliteInfo> &)));
85 connect(m_satellite, SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &)), this,
86 SLOT(onSatellitesInUseUpdated(const QList<QGeoSatelliteInfo> &)));
88 m_satellite->requestUpdate();