Added a symbolic link qtc_packaging/debian_fremantle -> debian
[gpsdata] / src / satellitesignalstrengthwindow.cpp
1 /*
2  *  GPSData for Maemo.
3  *  Copyright (C) 2011 Roman Moravcik
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #include <QtGui>
21
22 #include "satellitesignalstrengthwindow.h"
23
24 #ifdef Q_OS_SYMBIAN
25 SatelliteSignalStrengthWindow::SatelliteSignalStrengthWindow(QWidget *parent) : QMainWindow(parent)
26 {
27     m_screenLocked = false;
28
29     createUi();
30
31     connect(parent, SIGNAL(screenLocked(bool)), this, SLOT(onScreenLocked(bool)));
32 }
33
34 void SatelliteSignalStrengthWindow::createUi()
35 {
36     setAttribute(Qt::WA_DeleteOnClose);
37
38     setWindowTitle(tr("Signal strength"));
39
40     m_satelliteSignalStrength = new SatelliteSignalStrength();
41     m_satelliteSignalStrength->showTitle(false);
42     setCentralWidget(m_satelliteSignalStrength);
43
44     QAction* backSoftkey = new QAction(tr("Back"), this);
45     backSoftkey->setSoftKeyRole(QAction::NegativeSoftKey);
46     connect(backSoftkey, SIGNAL(triggered()), this, SLOT(close()));
47     addAction(backSoftkey);
48 }
49
50 void SatelliteSignalStrengthWindow::onScreenLocked(bool locked)
51 {
52     m_screenLocked = locked;
53 }
54
55 void SatelliteSignalStrengthWindow::onSatellitesInViewUpdated(const QList<QGeoSatelliteInfo> &satellites)
56 {
57     if (m_screenLocked)
58         return;
59
60     m_satelliteSignalStrength->updateWidget(satellites, false);
61 }
62
63 void SatelliteSignalStrengthWindow::onSatellitesInUseUpdated(const QList<QGeoSatelliteInfo> &satellites)
64 {
65     if (m_screenLocked)
66         return;
67
68     m_satelliteSignalStrength->updateWidget(satellites, true);
69 }
70
71 void SatelliteSignalStrengthWindow::setSatelliteInfoSource(QGeoSatelliteInfoSource *satelliteInfoSource)
72 {
73     m_satellite = satelliteInfoSource;
74     if (m_satellite) {
75         connect(m_satellite, SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &)), this,
76                 SLOT(onSatellitesInViewUpdated(const QList<QGeoSatelliteInfo> &)));
77         connect(m_satellite, SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &)), this,
78                 SLOT(onSatellitesInUseUpdated(const QList<QGeoSatelliteInfo> &)));
79
80         m_satellite->requestUpdate();
81     }
82 }
83 #endif