summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Laing <david.laing@nokia.com>2009-12-24 13:41:55 +1000
committerDavid Laing <david.laing@nokia.com>2009-12-24 13:41:55 +1000
commita19ce0eb8c419894c0e9abd77e5b8845f81df31a (patch)
treea30b96c12f5eafb2b615d294047856b982ce5029
parent7ac3b24dce5198de1f99d05384057faa81e27208 (diff)
Examples cleaned up and audited
-rw-r--r--examples/fetchgooglemaps/main.cpp5
-rw-r--r--examples/fetchgooglemaps/mapwindow.cpp42
-rw-r--r--examples/fetchgooglemaps/mapwindow.h1
-rw-r--r--examples/flickrdemo/flickrdemo.cpp125
-rw-r--r--examples/flickrdemo/flickrdemo.h66
-rw-r--r--examples/flickrdemo/main.cpp43
-rw-r--r--examples/flickrdemo/xqlistwidget.cpp43
-rw-r--r--examples/flickrdemo/xqlistwidget.h47
-rw-r--r--examples/lightmaps/lightmaps.cpp225
-rw-r--r--examples/satellitedialog/main.cpp48
-rw-r--r--examples/satellitedialog/satellitedialog.cpp165
-rw-r--r--examples/satellitedialog/satellitedialog.h56
-rw-r--r--examples/weatherinfo/weatherinfo.cpp81
13 files changed, 614 insertions, 333 deletions
diff --git a/examples/fetchgooglemaps/main.cpp b/examples/fetchgooglemaps/main.cpp
index f2abbac658..433961d258 100644
--- a/examples/fetchgooglemaps/main.cpp
+++ b/examples/fetchgooglemaps/main.cpp
@@ -38,6 +38,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include <QApplication>
#include "mapwindow.h"
@@ -49,9 +50,9 @@ int main(int argc, char *argv[])
MapWindow win;
#if defined(Q_OS_SYMBIAN)
win.showMaximized();
-#else
+#else
win.show();
-#endif
+#endif
win.start();
return app.exec();
diff --git a/examples/fetchgooglemaps/mapwindow.cpp b/examples/fetchgooglemaps/mapwindow.cpp
index f2bfdb82b1..78b69df941 100644
--- a/examples/fetchgooglemaps/mapwindow.cpp
+++ b/examples/fetchgooglemaps/mapwindow.cpp
@@ -38,6 +38,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include <QtGui>
#include <QtWebKit>
@@ -56,7 +57,7 @@ const QString GMAPS_STATICMAP_URL_TEMPLATE = "http://maps.google.com/staticmap?
MapWindow::MapWindow(QWidget *parent, Qt::WFlags flags)
- : QMainWindow(parent, flags),
+ : QMainWindow(parent, flags),
webView(new QWebView),
posLabel(new QLabel),
headingAndSpeedLabel(new QLabel),
@@ -66,10 +67,10 @@ MapWindow::MapWindow(QWidget *parent, Qt::WFlags flags)
location(0)
{
location = QGeoPositionInfoSource::createDefaultSource(this);
- if (!location) {
+ if (!location) {
QNmeaPositionInfoSource *nmeaSource = new QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode, this);
QFile *logFile = new QFile(QApplication::applicationDirPath()
- + QDir::separator() + "nmealog.txt", this);
+ + QDir::separator() + "nmealog.txt", this);
nmeaSource->setDevice(logFile);
location = nmeaSource;
@@ -91,7 +92,7 @@ MapWindow::MapWindow(QWidget *parent, Qt::WFlags flags)
layout->addWidget(dateTimeLabel);
setCentralWidget(mainWidget);
-#if !defined(Q_OS_SYMBIAN)
+#if !defined(Q_OS_SYMBIAN)
resize(300, 300);
#endif
setWindowTitle(tr("Google Maps Demo"));
@@ -105,25 +106,26 @@ MapWindow::~MapWindow()
session->close();
}
-void MapWindow::delayedInit() {
+void MapWindow::delayedInit()
+{
if (usingLogFile) {
- QMessageBox::information(this, tr("Fetch Google Maps"),
- tr("No GPS support detected, using GPS data from a sample log file instead."));
+ QMessageBox::information(this, tr("Fetch Google Maps"),
+ tr("No GPS support detected, using GPS data from a sample log file instead."));
} else {
QGeoSatelliteInfoSource *satellite = QGeoSatelliteInfoSource::createDefaultSource(this);
if (satellite) {
- SatelliteDialog *dialog = new SatelliteDialog(this,
- 30,
- SatelliteDialog::ExitOnFixOrCancel,
- SatelliteDialog::OrderByPrnNumber,
- SatelliteDialog::ScaleToMaxPossible);
+ SatelliteDialog *dialog = new SatelliteDialog(this,
+ 30,
+ SatelliteDialog::ExitOnFixOrCancel,
+ SatelliteDialog::OrderByPrnNumber,
+ SatelliteDialog::ScaleToMaxPossible);
dialog->connectSources(location, satellite);
location->startUpdates();
satellite->startUpdates();
-
+
dialog->exec();
location->stopUpdates();
@@ -134,12 +136,12 @@ void MapWindow::delayedInit() {
// Set Internet Access Point
QNetworkConfigurationManager manager;
const bool canStartIAP = (manager.capabilities()
- & QNetworkConfigurationManager::CanStartAndStopInterfaces);
+ & QNetworkConfigurationManager::CanStartAndStopInterfaces);
// Is there default access point, use it
QNetworkConfiguration cfg = manager.defaultConfiguration();
if (!cfg.isValid() || (!canStartIAP && cfg.state() != QNetworkConfiguration::Active)) {
QMessageBox::information(this, tr("Flickr Demo"), tr(
- "Available Access Points not found."));
+ "Available Access Points not found."));
return;
}
@@ -167,17 +169,17 @@ void MapWindow::positionUpdated(const QGeoPositionInfo &info)
headingAndSpeedLabel->setText(tr("Bearing %1, travelling at %2 km/h").arg(heading).arg(speed));
dateTimeLabel->setText(tr("(Last update: %1)").
- arg(info.dateTime().toLocalTime().time().toString()));
+ arg(info.dateTime().toLocalTime().time().toString()));
if (!loading) {
// Google Maps does not provide maps larger than 640x480
int width = qMin(webView->width(), 640);
int height = qMin(webView->height(), 480);
QString url = GMAPS_STATICMAP_URL_TEMPLATE
- .arg(QString::number(info.coordinate().latitude()))
- .arg(QString::number(info.coordinate().longitude()))
- .arg(QString::number(width))
- .arg(QString::number(height));
+ .arg(QString::number(info.coordinate().latitude()))
+ .arg(QString::number(info.coordinate().longitude()))
+ .arg(QString::number(width))
+ .arg(QString::number(height));
webView->load(url);
}
}
diff --git a/examples/fetchgooglemaps/mapwindow.h b/examples/fetchgooglemaps/mapwindow.h
index e081c8474b..7ba47c3c52 100644
--- a/examples/fetchgooglemaps/mapwindow.h
+++ b/examples/fetchgooglemaps/mapwindow.h
@@ -38,6 +38,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef MAPWINDOW_H
#define MAPWINDOW_H
diff --git a/examples/flickrdemo/flickrdemo.cpp b/examples/flickrdemo/flickrdemo.cpp
index f4da002494..e2ea724f78 100644
--- a/examples/flickrdemo/flickrdemo.cpp
+++ b/examples/flickrdemo/flickrdemo.cpp
@@ -1,11 +1,54 @@
-/*
- * Copyright (c) 2009 Nokia Corporation.
- */
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#include "flickrdemo.h"
#include <QDomDocument>
#include <qnmeapositioninfosource.h>
+#include <qgeopositioninfosource.h>
+#include <qgeosatelliteinfosource.h>
+#include <qgeopositioninfo.h>
+#include <qgeosatelliteinfo.h>
+#include <qnetworkconfigmanager.h>
+#include <qnetworksession.h>
static const QSize gridSize(52, 52);
static const QSize thumbnailSize(50, 50);
@@ -20,8 +63,8 @@ static const QString savePath = QDir::tempPath();
FlickrDemo::FlickrDemo(QWidget* parent) :
QMainWindow(parent),
- m_session(0),
m_logfileInUse(false),
+ m_session(0),
m_file(0),
m_httpGetId(-1),
m_httpThumbnailGetId(-1),
@@ -33,21 +76,21 @@ FlickrDemo::FlickrDemo(QWidget* parent) :
m_longitude(-1000),
m_downloadPictureList(true),
m_downloadingThumbnails(false)
-{
+{
resize(252, 344);
- QWidget *centralWidget = new QWidget;
+ QWidget *centralWidget = new QWidget;
QVBoxLayout *verticalLayout = new QVBoxLayout();
- locationLabel = new QLabel(tr("Lat: Long:"));
+ locationLabel = new QLabel(tr("Lat: Long:"));
verticalLayout->addWidget(locationLabel);
- satellitesLabel = new QLabel(tr("Using 0 of 0 satellites"));
+ satellitesLabel = new QLabel(tr("Using 0 of 0 satellites"));
verticalLayout->addWidget(satellitesLabel);
listWidget = new XQListWidget();
verticalLayout->addWidget(listWidget);
- downloadButton = new QPushButton(tr("Download Picture List"));
+ downloadButton = new QPushButton(tr("Download Picture List"));
verticalLayout->addWidget(downloadButton);
centralWidget->setLayout(verticalLayout);
@@ -63,7 +106,7 @@ FlickrDemo::FlickrDemo(QWidget* parent) :
if (m_location == 0) {
QNmeaPositionInfoSource *nmeaLocation = new QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode, this);
QFile *logFile = new QFile(QApplication::applicationDirPath()
- + QDir::separator() + "nmealog.txt", this);
+ + QDir::separator() + "nmealog.txt", this);
nmeaLocation->setDevice(logFile);
m_location = nmeaLocation;
m_logfileInUse = true;
@@ -78,9 +121,9 @@ FlickrDemo::FlickrDemo(QWidget* parent) :
// Listen satellite status changes
if (m_satellite != 0) {
connect(m_satellite, SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&)),
- this, SLOT(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&)));
+ this, SLOT(satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&)));
connect(m_satellite, SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&)),
- this, SLOT(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&)));
+ this, SLOT(satellitesInUseUpdated(const QList<QGeoSatelliteInfo>&)));
}
// QHttp
@@ -116,15 +159,15 @@ FlickrDemo::~FlickrDemo()
m_satellite->stopUpdates();
m_http.abort();
if (m_session)
- m_session->close();
+ m_session->close();
}
void FlickrDemo::delayedInit()
{
if (m_logfileInUse) {
- QMessageBox::information(this, tr("Flickr Demo"),
- tr("No GPS support detected, using GPS data from a sample log file instead."));
+ QMessageBox::information(this, tr("Flickr Demo"),
+ tr("No GPS support detected, using GPS data from a sample log file instead."));
}
}
@@ -143,7 +186,7 @@ void FlickrDemo::createMenus()
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
}
-void FlickrDemo::positionUpdated(QGeoPositionInfo gpsPos)
+void FlickrDemo::positionUpdated(const QGeoPositionInfo &gpsPos)
{
if (gpsPos.isValid()) {
QGeoCoordinate coord = gpsPos.coordinate();
@@ -169,8 +212,7 @@ void FlickrDemo::satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &satellit
void FlickrDemo::viewSatelliteInfo()
{
if (m_satellite != 0) {
- satellitesLabel->setText(tr("Using %1 of %2 satellites").arg(
- QString::number(m_satellitesUsed), QString::number(m_satellitesInView)));
+ satellitesLabel->setText(tr("Using %1 of %2 satellites").arg(QString::number(m_satellitesUsed), QString::number(m_satellitesInView)));
} else {
satellitesLabel->setText(tr("GPS not detected, replaying coordinates from sample log file."));
}
@@ -188,9 +230,12 @@ void FlickrDemo::downloadButtonClicked()
void FlickrDemo::downloadFlickerPictureList()
{
if (m_latitude == -1000 || m_longitude == -1000) {
- if (QMessageBox::question(this, tr("Flickr Demo"), tr("No satellite connection.\n"
- "Use hard coded coordinates?"), QMessageBox::Ok | QMessageBox::Cancel,
- QMessageBox::Cancel) == QMessageBox::Cancel) {
+ if (QMessageBox::question(this,
+ tr("Flickr Demo"),
+ tr("No satellite connection.\n""Use hard coded coordinates?"),
+ QMessageBox::Ok | QMessageBox::Cancel,
+ QMessageBox::Cancel)
+ == QMessageBox::Cancel) {
return;
}
// If GPS signal is not detected, Tampere area is used as default location
@@ -206,7 +251,7 @@ void FlickrDemo::downloadFlickerPictureList()
QMessageBox::information(this, tr("Flickr Demo"), tr("Available Access Points not found."));
return;
}
- m_session = new QNetworkSession(cfg, this);
+ m_session = new QNetworkSession(cfg, this);
m_session->open();
bool ok = m_session->waitForOpened();
@@ -251,9 +296,9 @@ bool FlickrDemo::parsePictureList(QString xmlString)
QDomDocument domDocument;
if (!domDocument.setContent(xmlString, true, &errorStr, &errorLine, &errorColumn)) {
- QMessageBox::information(window(), tr("Flickr Demo"), tr(
- "XML Parse error at line %1, column %2:\n%3") .arg(errorLine) .arg(errorColumn) .arg(
- errorStr));
+ QMessageBox::information(window(),
+ tr("Flickr Demo"),
+ tr("XML Parse error at line %1, column %2:\n%3").arg(errorLine).arg(errorColumn).arg(errorStr));
return false;
}
QDomElement root = domDocument.documentElement();
@@ -325,8 +370,12 @@ void FlickrDemo::downloadPictureFromFlickr()
m_filePath.append(fileName);
if (QFile::exists(m_filePath)) {
- if (QMessageBox::question(this, tr("Flickr Demo"), tr("File %1 is already downloaded."
- "Overwrite?").arg(fileName), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel)
+ if (QMessageBox::question(this,
+ tr("Flickr Demo"),
+ tr("File %1 is already downloaded."
+ "Overwrite?").arg(fileName),
+ QMessageBox::Ok | QMessageBox::Cancel,
+ QMessageBox::Cancel)
== QMessageBox::Cancel) {
return;
}
@@ -336,7 +385,7 @@ void FlickrDemo::downloadPictureFromFlickr()
m_file = new QFile(m_filePath);
if (!m_file->open(QIODevice::WriteOnly)) {
QMessageBox::information(this, tr("Flickr Demo"),
- tr("Unable to save the file %1: %2.") .arg(m_filePath).arg(m_file->errorString()));
+ tr("Unable to save the file %1: %2.").arg(m_filePath).arg(m_file->errorString()));
delete m_file;
m_file = 0;
return;
@@ -411,8 +460,9 @@ void FlickrDemo::httpRequestFinished(int requestId, bool error)
if (!m_downloadPictureList) {
m_file->remove();
}
- QMessageBox::information(this, tr("Flickr Demo"), tr("Download failed: %1.") .arg(
- m_http.errorString()));
+ QMessageBox::information(this,
+ tr("Flickr Demo"),
+ tr("Download failed: %1.").arg(m_http.errorString()));
}
if (m_downloadPictureList) {
@@ -449,8 +499,9 @@ void FlickrDemo::readResponseHeader(const QHttpResponseHeader& responseHeader)
// these are not error conditions
break;
default:
- QMessageBox::information(this, tr("Flickr Demo"), tr("Download failed: %1.") .arg(
- responseHeader.reasonPhrase()));
+ QMessageBox::information(this,
+ tr("Flickr Demo"),
+ tr("Download failed: %1.").arg(responseHeader.reasonPhrase()));
m_downloadingThumbnails = false;
m_httpRequestAborted = true;
m_progressDialog.hide();
@@ -487,11 +538,11 @@ void FlickrDemo::downloadNextThumbnail()
PictureDialog::PictureDialog(const QString& filePath, const QString& pictureName, QWidget* parent) :
QDialog(parent)
-{
+{
resize(252, 361);
QVBoxLayout *verticalLayout = new QVBoxLayout();
verticalLayout->setSpacing(6);
- verticalLayout->setContentsMargins(11, 11, 11, 11);
+ verticalLayout->setContentsMargins(11, 11, 11, 11);
label = new QLabel();
QString fileName = QFileInfo(filePath).fileName();
@@ -505,7 +556,7 @@ PictureDialog::PictureDialog(const QString& filePath, const QString& pictureName
verticalLayout->addWidget(label);
- imageLabel = new QLabel();
+ imageLabel = new QLabel();
QImage image;
image.load(filePath);
imageLabel->setPixmap(QPixmap::fromImage(image.scaled(imageSize, Qt::KeepAspectRatio,
@@ -513,8 +564,8 @@ PictureDialog::PictureDialog(const QString& filePath, const QString& pictureName
verticalLayout->addWidget(imageLabel);
- buttonBox = new QDialogButtonBox();
- buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
+ buttonBox = new QDialogButtonBox();
+ buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
diff --git a/examples/flickrdemo/flickrdemo.h b/examples/flickrdemo/flickrdemo.h
index 81676595ac..25674ad8e3 100644
--- a/examples/flickrdemo/flickrdemo.h
+++ b/examples/flickrdemo/flickrdemo.h
@@ -1,6 +1,43 @@
-/*
- * Copyright (c) 2009 Nokia Corporation.
- */
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#ifndef FLICKRDEMO_H
#define FLICKRDEMO_H
@@ -9,21 +46,24 @@
#include <QtNetwork>
//// QtMobility API headers
-#include <qgeopositioninfosource.h>
-#include <qgeopositioninfo.h>
-#include <qgeosatelliteinfosource.h>
-#include <qgeosatelliteinfo.h>
-#include <qnetworkconfigmanager.h>
-#include <qnetworksession.h>
+#include <qmobilityglobal.h>
#include "xqlistwidget.h"
+QTM_BEGIN_NAMESPACE
+class QNetworkSession;
+class QGeoPositionInfoSource;
+class QGeoPositionInfo;
+class QGeoSatelliteInfoSource;
+class QGeoSatelliteInfo;
+QTM_END_NAMESPACE
+
// Use the QtMobility namespace
-using namespace QtMobility;
+QTM_USE_NAMESPACE
class FlickrDemo: public QMainWindow
{
-Q_OBJECT
+ Q_OBJECT
public:
FlickrDemo(QWidget* parent = 0);
@@ -48,7 +88,7 @@ private Q_SLOTS:
void updateDataReadProgress(int bytesRead, int totalBytes);
// QGeoPositionInfoSource
- void positionUpdated(QGeoPositionInfo);
+ void positionUpdated(const QGeoPositionInfo &gpsPos);
// QGeoSatelliteInfoSource
void satellitesInViewUpdated(const QList<QGeoSatelliteInfo>&);
@@ -92,7 +132,7 @@ private:
class PictureDialog: public QDialog
{
-Q_OBJECT
+ Q_OBJECT
public:
PictureDialog(const QString& filePath, const QString& pictureName, QWidget* parent = 0);
diff --git a/examples/flickrdemo/main.cpp b/examples/flickrdemo/main.cpp
index 7eb5d58536..c513ad539d 100644
--- a/examples/flickrdemo/main.cpp
+++ b/examples/flickrdemo/main.cpp
@@ -1,6 +1,43 @@
-/*
- * Copyright (c) 2009 Nokia Corporation.
- */
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#include <QApplication>
#include "flickrdemo.h"
diff --git a/examples/flickrdemo/xqlistwidget.cpp b/examples/flickrdemo/xqlistwidget.cpp
index 4189c4bdb9..2ce07a41f2 100644
--- a/examples/flickrdemo/xqlistwidget.cpp
+++ b/examples/flickrdemo/xqlistwidget.cpp
@@ -1,6 +1,43 @@
-/*
- * Copyright (c) 2009 Nokia Corporation.
- */
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#include "xqlistwidget.h"
diff --git a/examples/flickrdemo/xqlistwidget.h b/examples/flickrdemo/xqlistwidget.h
index cc02a13241..dd8b1a6cdd 100644
--- a/examples/flickrdemo/xqlistwidget.h
+++ b/examples/flickrdemo/xqlistwidget.h
@@ -1,6 +1,43 @@
-/*
- * Copyright (c) 2009 Nokia Corporation.
- */
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#ifndef XQLISTWIDGET_H
#define XQLISTWIDGET_H
@@ -11,8 +48,8 @@
class XQListWidget: public QListWidget
{
public:
- XQListWidget(QWidget* parent = 0);
-
+ XQListWidget(QWidget* parent = 0);
+
protected:
void keyPressEvent(QKeyEvent* event);
};
diff --git a/examples/lightmaps/lightmaps.cpp b/examples/lightmaps/lightmaps.cpp
index af3f006123..e2463f439b 100644
--- a/examples/lightmaps/lightmaps.cpp
+++ b/examples/lightmaps/lightmaps.cpp
@@ -44,7 +44,9 @@
#include <QtNetwork>
// QtMobility API headers
+#include <qmobilityglobal.h>
#include <qgeopositioninfosource.h>
+#include <qgeosatelliteinfosource.h>
#include <qnmeapositioninfosource.h>
#include <qgeopositioninfo.h>
#include <qnetworkconfigmanager.h>
@@ -53,7 +55,7 @@
#include "satellitedialog.h"
// Use the QtMobility namespace
-using namespace QtMobility;
+QTM_USE_NAMESPACE
#include <math.h>
@@ -81,7 +83,7 @@ const int tdim = 256;
QPointF tileForCoordinate(qreal lat, qreal lng, int zoom)
{
- qreal zn = static_cast<qreal> (1 << zoom);
+ qreal zn = static_cast<qreal>(1 << zoom);
qreal tx = (lng + 180.0) / 360.0;
qreal ty = (1.0 - log(tan(lat * M_PI / 180.0) + 1.0 / cos(lat * M_PI / 180.0)) / M_PI) / 2.0;
return QPointF(tx * zn, ty * zn);
@@ -89,14 +91,14 @@ QPointF tileForCoordinate(qreal lat, qreal lng, int zoom)
qreal longitudeFromTile(qreal tx, int zoom)
{
- qreal zn = static_cast<qreal> (1 << zoom);
+ qreal zn = static_cast<qreal>(1 << zoom);
qreal lat = tx / zn * 360.0 - 180.0;
return lat;
}
qreal latitudeFromTile(qreal ty, int zoom)
{
- qreal zn = static_cast<qreal> (1 << zoom);
+ qreal zn = static_cast<qreal>(1 << zoom);
qreal n = M_PI - 2 * M_PI * ty / zn;
qreal lng = 180.0 / M_PI * atan(0.5 * (exp(n) - exp(-n)));
return lng;
@@ -104,7 +106,7 @@ qreal latitudeFromTile(qreal ty, int zoom)
class SlippyMap: public QObject
{
-Q_OBJECT
+ Q_OBJECT
public:
int width;
@@ -121,8 +123,7 @@ public:
latitude(59.9138204),
longitude(10.7387413),
m_location(location),
- m_session(session)
- {
+ m_session(session) {
m_emptyTile = QPixmap(tdim, tdim);
m_emptyTile.fill(Qt::lightGray);
@@ -132,21 +133,19 @@ public:
cache->setCacheDirectory(QDesktopServices::storageLocation(QDesktopServices::CacheLocation));
m_manager->setCache(cache);
connect(m_manager, SIGNAL(finished(QNetworkReply*)),
- this, SLOT(handleNetworkData(QNetworkReply*)));
+ this, SLOT(handleNetworkData(QNetworkReply*)));
// Listen gps position changes
connect(m_location, SIGNAL(positionUpdated(QGeoPositionInfo)),
- this, SLOT(positionUpdated(QGeoPositionInfo)));
+ this, SLOT(positionUpdated(QGeoPositionInfo)));
}
- ~SlippyMap()
- {
+ ~SlippyMap() {
m_session->close();
delete m_session;
- }
+ }
- void invalidate()
- {
+ void invalidate() {
if (width <= 0 || height <= 0)
return;
@@ -161,15 +160,15 @@ public:
// first tile vertical and horizontal
int xa = (xp + tdim - 1) / tdim;
int ya = (yp + tdim - 1) / tdim;
- int xs = static_cast<int> (tx) - xa;
- int ys = static_cast<int> (ty) - ya;
+ int xs = static_cast<int>(tx) - xa;
+ int ys = static_cast<int>(ty) - ya;
// offset for top-left tile
m_offset = QPoint(xp - xa * tdim, yp - ya * tdim);
// last tile vertical and horizontal
- int xe = static_cast<int> (tx) + (width - xp - 1) / tdim;
- int ye = static_cast<int> (ty) + (height - yp - 1) / tdim;
+ int xe = static_cast<int>(tx) + (width - xp - 1) / tdim;
+ int ye = static_cast<int>(ty) + (height - yp - 1) / tdim;
// build a rect
m_tilesRect = QRect(xs, ys, xe - xs + 1, ye - ys + 1);
@@ -180,8 +179,7 @@ public:
emit updated(QRect(0, 0, width, height));
}
- void render(QPainter *p, const QRect &rect)
- {
+ void render(QPainter *p, const QRect &rect) {
for (int x = 0; x <= m_tilesRect.width(); ++x)
for (int y = 0; y <= m_tilesRect.height(); ++y) {
QPoint tp(x + m_tilesRect.left(), y + m_tilesRect.top());
@@ -195,8 +193,7 @@ public:
}
}
- void pan(const QPoint &delta)
- {
+ void pan(const QPoint &delta) {
QPointF dx = QPointF(delta) / qreal(tdim);
QPointF center = tileForCoordinate(latitude, longitude, zoom) - dx;
latitude = latitudeFromTile(center.y(), zoom);
@@ -206,15 +203,13 @@ public:
private slots:
- void positionUpdated(QGeoPositionInfo gpsPos)
- {
+ void positionUpdated(const QGeoPositionInfo &gpsPos) {
latitude = gpsPos.coordinate().latitude();
longitude = gpsPos.coordinate().longitude();
invalidate();
}
- void handleNetworkData(QNetworkReply *reply)
- {
+ void handleNetworkData(QNetworkReply *reply) {
QImage img;
QPoint tp = reply->request().attribute(QNetworkRequest::User).toPoint();
QUrl url = reply->url();
@@ -229,15 +224,14 @@ private slots:
// purge unused spaces
QRect bound = m_tilesRect.adjusted(-2, -2, 2, 2);
- foreach(QPoint tp, m_tilePixmaps.keys())
- if (!bound.contains(tp))
- m_tilePixmaps.remove(tp);
+ foreach(QPoint tp, m_tilePixmaps.keys())
+ if (!bound.contains(tp))
+ m_tilePixmaps.remove(tp);
download();
}
- void download()
- {
+ void download() {
QPoint grab(0, 0);
for (int x = 0; x <= m_tilesRect.width(); ++x)
for (int y = 0; y <= m_tilesRect.height(); ++y) {
@@ -261,12 +255,11 @@ private slots:
m_manager->get(request);
}
- signals:
+signals:
void updated(const QRect &rect);
protected:
- QRect tileRect(const QPoint &tp)
- {
+ QRect tileRect(const QPoint &tp) {
QPoint t = tp - m_tilesRect.topLeft();
int x = t.x() * tdim + m_offset.x();
int y = t.y() * tdim + m_offset.y();
@@ -288,7 +281,7 @@ private:
class LightMaps: public QWidget
{
-Q_OBJECT
+ Q_OBJECT
public:
LightMaps(QWidget *parent = 0) :
@@ -298,13 +291,12 @@ public:
zoomed(false),
invert(false),
m_usingLogFile(false),
- m_location(0)
- {
+ m_location(0) {
// Set Internet Access Point
QNetworkConfigurationManager manager;
const bool canStartIAP = (manager.capabilities()
- & QNetworkConfigurationManager::CanStartAndStopInterfaces);
+ & QNetworkConfigurationManager::CanStartAndStopInterfaces);
// Is there default access point, use it
QNetworkConfiguration cfg1 = manager.defaultConfiguration();
@@ -316,9 +308,6 @@ public:
QNetworkSession *session = new QNetworkSession(cfg1);
- connect(session, SIGNAL(error(QNetworkSession::SessionError)),
- this, SLOT(displaySessionError(QNetworkSession::SessionError)));
-
session->open();
if (!session->waitForOpened()) {
m_networkSetupError = QString(tr("Unable to open network session."));
@@ -327,12 +316,12 @@ public:
return;
}
- m_location = QGeoPositionInfoSource::createDefaultSource(this);
+ m_location = QGeoPositionInfoSource::createDefaultSource(this);
- if (!m_location) {
+ if (!m_location) {
QNmeaPositionInfoSource *nmeaLocation = new QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode, this);
QFile *logFile = new QFile(QApplication::applicationDirPath()
- + QDir::separator() + "nmealog.txt", this);
+ + QDir::separator() + "nmealog.txt", this);
nmeaLocation->setDevice(logFile);
m_location = nmeaLocation;
m_usingLogFile = true;
@@ -341,30 +330,26 @@ public:
m_normalMap = new SlippyMap(session, m_location, this);
m_largeMap = new SlippyMap(session, m_location, this);
- connect(m_normalMap, SIGNAL(updated(QRect)),SLOT(updateMap(QRect)));
- connect(m_largeMap, SIGNAL(updated(QRect)),SLOT(update()));
+ connect(m_normalMap, SIGNAL(updated(QRect)), SLOT(updateMap(QRect)));
+ connect(m_largeMap, SIGNAL(updated(QRect)), SLOT(update()));
connect(m_location, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo)));
QTimer::singleShot(100, this, SLOT(delayedInit()));
}
- ~LightMaps()
- {
+ ~LightMaps() {
m_location->stopUpdates();
}
- void stopPositioning()
- {
+ void stopPositioning() {
m_location->stopUpdates();
}
- void startPositioning()
- {
+ void startPositioning() {
m_location->startUpdates();
}
- void setCenter(qreal lat, qreal lng)
- {
+ void setCenter(qreal lat, qreal lng) {
m_normalMap->latitude = lat;
m_normalMap->longitude = lng;
m_normalMap->invalidate();
@@ -374,67 +359,35 @@ public:
}
public slots:
- void toggleNightMode()
- {
+ void toggleNightMode() {
invert = !invert;
update();
}
private slots:
- void positionUpdated(const QGeoPositionInfo &pos)
- {
+ void positionUpdated(const QGeoPositionInfo &pos) {
setCenter(pos.coordinate().latitude(), pos.coordinate().longitude());
}
-
- void displaySessionError(QNetworkSession::SessionError error)
- {
- switch(error) {
- case QNetworkSession::UnknownSessionError:
- QMessageBox::information(this, tr("LightMaps"),
- tr("UnknownSessionError"));
- break;
- case QNetworkSession::SessionAbortedError:
- QMessageBox::information(this, tr("LightMaps"),
- tr("SessionAbortedError"));
- break;
- case QNetworkSession::RoamingError:
- QMessageBox::information(this, tr("LightMaps"),
- tr("RoamingError"));
- break;
- case QNetworkSession::OperationNotSupportedError:
- QMessageBox::information(this, tr("LightMaps"),
- tr("OperationNotSupportedError"));
- break;
- case QNetworkSession::InvalidConfigurationError:
- QMessageBox::information(this, tr("LightMaps"),
- tr("InvalidConfigurationError"));
- break;
- default:
- QMessageBox::information(this, tr("LightMaps"),
- tr("Unknown Error"));
- }
- }
- void delayedInit()
- {
+ void delayedInit() {
if (m_usingLogFile) {
- QMessageBox::information(this, tr("LightMaps"),
- tr("No GPS support detected, using GPS data from a sample log file instead."));
+ QMessageBox::information(this, tr("LightMaps"),
+ tr("No GPS support detected, using GPS data from a sample log file instead."));
} else {
QGeoSatelliteInfoSource *m_satellite = QGeoSatelliteInfoSource::createDefaultSource(this);
if (m_satellite) {
- SatelliteDialog *dialog = new SatelliteDialog(this,
- 30,
- SatelliteDialog::ExitOnFixOrCancel,
- SatelliteDialog::OrderByPrnNumber,
- SatelliteDialog::ScaleToMaxPossible);
+ SatelliteDialog *dialog = new SatelliteDialog(this,
+ 30,
+ SatelliteDialog::ExitOnFixOrCancel,
+ SatelliteDialog::OrderByPrnNumber,
+ SatelliteDialog::ScaleToMaxPossible);
dialog->connectSources(m_location, m_satellite);
m_location->startUpdates();
m_satellite->startUpdates();
-
+
dialog->exec();
m_location->stopUpdates();
@@ -444,21 +397,19 @@ private slots:
if (!m_networkSetupError.isEmpty()) {
QMessageBox::information(this, tr("LightMaps"),
- m_networkSetupError);
+ m_networkSetupError);
}
startPositioning();
}
- void updateMap(const QRect &r)
- {
+ void updateMap(const QRect &r) {
update(r);
}
protected:
- void activateZoom()
- {
+ void activateZoom() {
stopPositioning();
zoomed = true;
tapTimer.stop();
@@ -471,8 +422,7 @@ protected:
update();
}
- void resizeEvent(QResizeEvent *)
- {
+ void resizeEvent(QResizeEvent *) {
m_normalMap->width = width();
m_normalMap->height = height();
m_normalMap->invalidate();
@@ -481,8 +431,7 @@ protected:
m_largeMap->invalidate();
}
- void paintEvent(QPaintEvent *event)
- {
+ void paintEvent(QPaintEvent *event) {
QPainter p;
p.begin(this);
m_normalMap->render(&p, event->rect());
@@ -493,7 +442,7 @@ protected:
p.setFont(font);
#endif
p.drawText(rect(), Qt::AlignBottom | Qt::TextWordWrap,
- "Map data CCBYSA 2009 OpenStreetMap.org contributors");
+ "Map data CCBYSA 2009 OpenStreetMap.org contributors");
p.end();
if (zoomed) {
@@ -564,15 +513,13 @@ protected:
}
}
- void timerEvent(QTimerEvent *)
- {
+ void timerEvent(QTimerEvent *) {
if (!zoomed)
activateZoom();
update();
}
- void mousePressEvent(QMouseEvent *event)
- {
+ void mousePressEvent(QMouseEvent *event) {
if (event->buttons() != Qt::LeftButton)
return;
pressed = snapped = true;
@@ -581,8 +528,7 @@ protected:
tapTimer.start(HOLD_TIME, this);
}
- void mouseMoveEvent(QMouseEvent *event)
- {
+ void mouseMoveEvent(QMouseEvent *event) {
if (!event->buttons())
return;
@@ -594,8 +540,7 @@ protected:
pressPos = event->pos();
m_normalMap->pan(delta);
return;
- }
- else {
+ } else {
const int threshold = 10;
QPoint delta = event->pos() - pressPos;
if (snapped) {
@@ -607,21 +552,18 @@ protected:
if (!snapped)
tapTimer.stop();
}
- }
- else {
+ } else {
dragPos = event->pos();
update();
}
}
- void mouseReleaseEvent(QMouseEvent *)
- {
+ void mouseReleaseEvent(QMouseEvent *) {
zoomed = false;
update();
}
- void keyPressEvent(QKeyEvent *event)
- {
+ void keyPressEvent(QKeyEvent *event) {
if (!zoomed) {
if (event->key() == Qt::Key_Left)
m_normalMap->pan(QPoint(20, 0));
@@ -635,8 +577,7 @@ protected:
dragPos = QPoint(width() / 2, height() / 2);
activateZoom();
}
- }
- else {
+ } else {
if (event->key() == Qt::Key_Z || event->key() == Qt::Key_Select) {
zoomed = false;
update();
@@ -658,8 +599,7 @@ protected:
}
private:
- QNetworkSession *m_session;
- QString m_networkSetupError;
+ QString m_networkSetupError;
SlippyMap *m_normalMap;
SlippyMap *m_largeMap;
bool pressed;
@@ -677,16 +617,14 @@ private:
class MapZoom: public QMainWindow
{
-Q_OBJECT
+ Q_OBJECT
private:
LightMaps *map;
- //QNetworkSession* m_session;
public:
MapZoom() :
- QMainWindow(0)
- {
+ QMainWindow(0) {
map = new LightMaps(this);
setCentralWidget(map);
map->setFocus();
@@ -696,16 +634,16 @@ public:
QAction *berlinAction = new QAction("&Berlin", this);
QAction *jakartaAction = new QAction("&Jakarta", this);
QAction *nightModeAction = new QAction("Night Mode", this);
-
+
nightModeAction->setCheckable(true);
nightModeAction->setChecked(false);
QAction *osmAction = new QAction("About OpenStreetMap", this);
- connect(gpsAction, SIGNAL(triggered()),SLOT(chooseGps()));
- connect(osloAction, SIGNAL(triggered()),SLOT(chooseOslo()));
- connect(berlinAction, SIGNAL(triggered()),SLOT(chooseBerlin()));
- connect(jakartaAction, SIGNAL(triggered()),SLOT(chooseJakarta()));
+ connect(gpsAction, SIGNAL(triggered()), SLOT(chooseGps()));
+ connect(osloAction, SIGNAL(triggered()), SLOT(chooseOslo()));
+ connect(berlinAction, SIGNAL(triggered()), SLOT(chooseBerlin()));
+ connect(jakartaAction, SIGNAL(triggered()), SLOT(chooseJakarta()));
connect(nightModeAction, SIGNAL(triggered()), map, SLOT(toggleNightMode()));
- connect(osmAction, SIGNAL(triggered()),SLOT(aboutOsm()));
+ connect(osmAction, SIGNAL(triggered()), SLOT(aboutOsm()));
#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WINCE_WM)
menuBar()->addAction(gpsAction);
@@ -729,36 +667,31 @@ public:
QAction *exitAction = new QAction("Exit", this);
connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
menuBar()->addAction(exitAction);
-#endif
+#endif
}
private slots:
- void chooseGps()
- {
+ void chooseGps() {
map->startPositioning();
}
- void chooseOslo()
- {
+ void chooseOslo() {
map->stopPositioning();
map->setCenter(59.9138204, 10.7387413);
}
- void chooseBerlin()
- {
+ void chooseBerlin() {
map->stopPositioning();
map->setCenter(52.52958999943302, 13.383053541183472);
}
- void chooseJakarta()
- {
+ void chooseJakarta() {
map->stopPositioning();
map->setCenter(-6.211544, 106.845172);
}
- void aboutOsm()
- {
+ void aboutOsm() {
QDesktopServices::openUrl(QUrl("http://www.openstreetmap.org"));
}
};
diff --git a/examples/satellitedialog/main.cpp b/examples/satellitedialog/main.cpp
index 2825f9e654..6938547d7a 100644
--- a/examples/satellitedialog/main.cpp
+++ b/examples/satellitedialog/main.cpp
@@ -1,3 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#include <QApplication>
#include <QMainWindow>
@@ -10,7 +50,11 @@ int main(int argc, char* argv[])
{
QApplication app(argc, argv);
- SatelliteDialog *dialog = new SatelliteDialog(0, 30, SatelliteDialog::ExitOnCancel, SatelliteDialog::OrderByPrnNumber, SatelliteDialog::ScaleToMaxPossible);
+ SatelliteDialog *dialog = new SatelliteDialog(0,
+ 30,
+ SatelliteDialog::ExitOnCancel,
+ SatelliteDialog::OrderByPrnNumber,
+ SatelliteDialog::ScaleToMaxPossible);
QGeoPositionInfoSource *posSource = QGeoPositionInfoSource::createDefaultSource(0);
QGeoSatelliteInfoSource *satSource = QGeoSatelliteInfoSource::createDefaultSource(0);
@@ -18,7 +62,7 @@ int main(int argc, char* argv[])
dialog->connectSources(posSource, satSource);
posSource->startUpdates();
- satSource->startUpdates();
+ satSource->startUpdates();
QTimer::singleShot(1, dialog, SLOT(show()));
diff --git a/examples/satellitedialog/satellitedialog.cpp b/examples/satellitedialog/satellitedialog.cpp
index 2cb319a7a2..c776466a1f 100644
--- a/examples/satellitedialog/satellitedialog.cpp
+++ b/examples/satellitedialog/satellitedialog.cpp
@@ -1,3 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#include "satellitedialog.h"
@@ -16,16 +56,21 @@
#include <QAction>
#include <QMenuBar>
+#include "qgeopositioninfosource.h"
+#include "qgeosatelliteinfosource.h"
+#include "qgeopositioninfo.h"
+#include "qgeosatelliteinfo.h"
+
class SatelliteWidget : public QWidget
{
public:
- SatelliteWidget(QWidget *parent,
- SatelliteDialog::Ordering ordering,
- SatelliteDialog::StrengthScaling scaling);
+ SatelliteWidget(QWidget *parent,
+ SatelliteDialog::Ordering ordering,
+ SatelliteDialog::StrengthScaling scaling);
void noSatelliteTimeout();
void satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &list);
- void satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &list);
+ void satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &list);
QSize sizeHint() const;
@@ -46,10 +91,13 @@ private:
static const int borderOffset = 4;
static const int legendTextOffset = 5;
int textHeight;
- int legendHeight;
+ int legendHeight;
+
+ QColor inUseColor;
+ QColor inViewColor;
SatelliteDialog::Ordering m_ordering;
- SatelliteDialog::StrengthScaling m_scaling;
+ SatelliteDialog::StrengthScaling m_scaling;
int m_maximumSignalStrength;
void updateSatelliteList();
@@ -61,15 +109,18 @@ private:
QList<QPair<QGeoSatelliteInfo, bool> > satellites;
};
-SatelliteWidget::SatelliteWidget(QWidget *parent,
- SatelliteDialog::Ordering ordering,
- SatelliteDialog::StrengthScaling scaling) : QWidget(parent),
- m_ordering(ordering),
- m_scaling(scaling)
-{
+SatelliteWidget::SatelliteWidget(QWidget *parent,
+ SatelliteDialog::Ordering ordering,
+ SatelliteDialog::StrengthScaling scaling) : QWidget(parent),
+ m_ordering(ordering),
+ m_scaling(scaling)
+{
QPainter painter(this);
textHeight = painter.fontMetrics().height();
- legendHeight = borderOffset + textHeight + 2;
+ legendHeight = borderOffset + textHeight + 2;
+
+ inViewColor = QColor(192, 192, 255);
+ inUseColor = QColor(64, 64, 255);
}
SatelliteDialog::Ordering SatelliteWidget::ordering() const
@@ -129,12 +180,12 @@ void SatelliteWidget::satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &lis
updateSatelliteList();
}
-bool sortPairsByPrn(const QPair<QGeoSatelliteInfo, bool> &p1, const QPair<QGeoSatelliteInfo, bool> &p2 )
+bool sortPairsByPrn(const QPair<QGeoSatelliteInfo, bool> &p1, const QPair<QGeoSatelliteInfo, bool> &p2)
{
return sortByPrn(p1.first, p2.first);
}
-bool sortPairsBySignalStrength(const QPair<QGeoSatelliteInfo, bool> &p1, const QPair<QGeoSatelliteInfo, bool> &p2 )
+bool sortPairsBySignalStrength(const QPair<QGeoSatelliteInfo, bool> &p1, const QPair<QGeoSatelliteInfo, bool> &p2)
{
return sortBySignalStrength(p1.first, p2.first);
}
@@ -147,7 +198,7 @@ void SatelliteWidget::updateSatelliteList()
int viewSize = satellitesInView.size();
if ((useSize == 0) && (viewSize == 0)) {
- update();
+ update();
return;
}
@@ -158,18 +209,18 @@ void SatelliteWidget::updateSatelliteList()
QList<QGeoSatelliteInfo>::iterator end = satellitesInUse.end();
- for (int i = 0; i < viewSize; ++i) {
+ for (int i = 0; i < viewSize; ++i) {
if (satellitesInView.at(i).signalStrength() == 0)
continue;
- QList<QGeoSatelliteInfo>::iterator j =
- qBinaryFind(
- satellitesInUse.begin(),
- end,
- satellitesInView.at(i),
- sortByPrn
- );
-
+ QList<QGeoSatelliteInfo>::iterator j =
+ qBinaryFind(
+ satellitesInUse.begin(),
+ end,
+ satellitesInView.at(i),
+ sortByPrn
+ );
+
if (j == end) {
satellites << QPair<QGeoSatelliteInfo, bool>(satellitesInView.at(i), false);
}
@@ -189,7 +240,7 @@ void SatelliteWidget::updateSatelliteList()
qSort(satellites.begin(), satellites.end(), sortPairsBySignalStrength);
m_maximumSignalStrength = satellites.at(satSize - 1).first.signalStrength();
}
-
+
update();
}
@@ -199,9 +250,9 @@ void SatelliteWidget::paintEvent(QPaintEvent * /*event*/)
painter.setRenderHint(QPainter::Antialiasing);
QRect satBounds = QRect(rect().x() + borderOffset,
- rect().y() + borderOffset,
- rect().width() - 2 * borderOffset,
- rect().height() - legendHeight - 2 * borderOffset);
+ rect().y() + borderOffset,
+ rect().width() - 2 * borderOffset,
+ rect().height() - legendHeight - 2 * borderOffset);
painter.setPen(QApplication::palette().color(QPalette::WindowText));
@@ -214,30 +265,30 @@ void SatelliteWidget::paintEvent(QPaintEvent * /*event*/)
}
QRect legendBounds = QRect(rect().x() + borderOffset,
- rect().height() - legendHeight,
- rect().width() - 2 * borderOffset,
- legendHeight);
+ rect().height() - legendHeight,
+ rect().width() - 2 * borderOffset,
+ legendHeight);
paintLegend(painter, legendBounds);
}
void SatelliteWidget::paintSatellite(QPainter &painter, const QRect &bounds, int index)
-{
+{
int bars = numBars;
if (m_ordering == SatelliteDialog::OrderBySignalStrength)
bars = satellites.size();
- double pixelsPerUnit = (double) bounds.width() / (double) (bars * spanWidth + gapWidth);
+ double pixelsPerUnit = (double) bounds.width() / (double)(bars * spanWidth + gapWidth);
double spanPixels = pixelsPerUnit * spanWidth;
double gapPixels = pixelsPerUnit * gapWidth;
double barPixels = pixelsPerUnit * barWidth;
painter.setPen(QApplication::palette().color(QPalette::WindowText));
if (!satellites.at(index).second) {
- painter.setBrush(QColor(192, 192, 255));
+ painter.setBrush(inViewColor);
} else {
- painter.setBrush(QColor(64, 64, 255));
- }
+ painter.setBrush(inUseColor);
+ }
int maximum = 100;
if (m_scaling == SatelliteDialog::ScaleToMaxAvailable) {
@@ -248,10 +299,10 @@ void SatelliteWidget::paintSatellite(QPainter &painter, const QRect &bounds, int
if (m_ordering == SatelliteDialog::OrderByPrnNumber)
i = satellites.at(index).first.prnNumber() - 1;
- double height = ((double) satellites.at(index).first.signalStrength() / (double) maximum ) * bounds.height();
+ double height = ((double) satellites.at(index).first.signalStrength() / (double) maximum) * bounds.height();
QRectF r(bounds.x() + gapPixels + i * spanPixels, bounds.y() + bounds.height() - 1 - height, barPixels, height);
-
+
painter.drawRect(r);
}
@@ -261,22 +312,22 @@ void SatelliteWidget::paintLegend(QPainter &painter, const QRect &bounds)
double keyX = bounds.x() + 1;
double textX = keyX + legendHeight + 2 + legendTextOffset;
- double y = bounds.y()+ 1;
+ double y = bounds.y() + 1;
double keyWidth = legendHeight - 2 - borderOffset;
double textWidth = halfWidth - legendHeight - 3 - legendTextOffset;
double height = legendHeight - 2 - borderOffset;
- QRectF viewKeyRect(keyX, y, keyWidth, height);
+ QRectF viewKeyRect(keyX, y, keyWidth, height);
QRectF viewTextRect(textX, y, textWidth, height);
- QRectF useKeyRect(keyX + halfWidth, y, keyWidth, height);
+ QRectF useKeyRect(keyX + halfWidth, y, keyWidth, height);
QRectF useTextRect(textX + halfWidth, y, textWidth, height);
painter.setPen(QApplication::palette().color(QPalette::WindowText));
- painter.setBrush(QColor(192, 192, 255));
+ painter.setBrush(inViewColor);
painter.drawRect(viewKeyRect);
- painter.setBrush(QColor(64, 64, 255));
+ painter.setBrush(inUseColor);
painter.drawRect(useKeyRect);
painter.setPen(QApplication::palette().color(QPalette::Text));
@@ -287,17 +338,17 @@ void SatelliteWidget::paintLegend(QPainter &painter, const QRect &bounds)
QSize SatelliteWidget::sizeHint() const
{
- return QSize(parentWidget()->width(), parentWidget()->width()/2 + legendHeight);
+ return QSize(parentWidget()->width(), parentWidget()->width() / 2 + legendHeight);
}
SatelliteDialog::SatelliteDialog(QWidget *parent,
- int noSatelliteTimeoutSeconds,
- ExitBehaviour exitBehaviour,
- Ordering ordering,
- StrengthScaling scaling) : QDialog(parent),
- m_noSatelliteTimeoutSeconds(noSatelliteTimeoutSeconds),
- m_exitBehaviour(exitBehaviour)
-{
+ int noSatelliteTimeoutSeconds,
+ ExitBehaviour exitBehaviour,
+ Ordering ordering,
+ StrengthScaling scaling) : QDialog(parent),
+ m_noSatelliteTimeoutSeconds(noSatelliteTimeoutSeconds),
+ m_exitBehaviour(exitBehaviour)
+{
noSatelliteTimer = new QTimer(this);
noSatelliteTimer->setInterval(m_noSatelliteTimeoutSeconds * 1000);
noSatelliteTimer->setSingleShot(true);
@@ -311,7 +362,7 @@ SatelliteDialog::SatelliteDialog(QWidget *parent,
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(label);
- mainLayout->addWidget(satelliteWidget);
+ mainLayout->addWidget(satelliteWidget);
#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WINCE)
QAction *switchAction = new QAction(tr("Switch"), this);
@@ -322,7 +373,7 @@ SatelliteDialog::SatelliteDialog(QWidget *parent,
QAction *cancelAction = new QAction(tr("Cancel"), this);
cancelAction->setSoftKeyRole(QAction::NegativeSoftKey);
-
+
connect(cancelAction, SIGNAL(triggered()), this, SLOT(reject()));
addAction(cancelAction);
@@ -336,7 +387,7 @@ SatelliteDialog::SatelliteDialog(QWidget *parent,
#else
cancelButton = new QPushButton(tr("Cancel"));
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
switchButton = new QPushButton(tr("Switch"));
connect(switchButton, SIGNAL(clicked()), this, SLOT(switchButtonClicked()));
@@ -389,7 +440,7 @@ void SatelliteDialog::switchButtonClicked()
setOrdering(SatelliteDialog::OrderByPrnNumber);
}
-SatelliteDialog::ExitBehaviour SatelliteDialog::exitBehaviour() const
+SatelliteDialog::ExitBehaviour SatelliteDialog::exitBehaviour() const
{
return m_exitBehaviour;
}
@@ -427,7 +478,7 @@ void SatelliteDialog::noSatelliteTimeout()
void SatelliteDialog::satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &list)
{
noSatelliteTimer->stop();
- satelliteWidget->satellitesInViewUpdated(list);
+ satelliteWidget->satellitesInViewUpdated(list);
noSatelliteTimer->start();
}
diff --git a/examples/satellitedialog/satellitedialog.h b/examples/satellitedialog/satellitedialog.h
index 33334147f9..077306453c 100644
--- a/examples/satellitedialog/satellitedialog.h
+++ b/examples/satellitedialog/satellitedialog.h
@@ -1,3 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
#ifndef QGEOSATELLITEDIALOG_H
#define QGEOSATELLITEDIALOG_H
@@ -8,10 +48,12 @@
#include <qmobilityglobal.h>
-#include "qgeopositioninfosource.h"
-#include "qgeosatelliteinfosource.h"
-#include "qgeopositioninfo.h"
-#include "qgeosatelliteinfo.h"
+QTM_BEGIN_NAMESPACE
+class QGeoPositionInfoSource;
+class QGeoPositionInfo;
+class QGeoSatelliteInfoSource;
+class QGeoSatelliteInfo;
+QTM_END_NAMESPACE
class SatelliteWidget;
class QPushButton;
@@ -38,7 +80,11 @@ public:
ScaleToMaxPossible
};
- SatelliteDialog(QWidget *parent = 0, int noSatelliteTimeoutSeconds = 30, ExitBehaviour exitBehaviour = ExitOnFixOrCancel, Ordering ordering = OrderBySignalStrength, StrengthScaling scaling = ScaleToMaxPossible);
+ SatelliteDialog(QWidget *parent = 0,
+ int noSatelliteTimeoutSeconds = 30,
+ ExitBehaviour exitBehaviour = ExitOnFixOrCancel,
+ Ordering ordering = OrderBySignalStrength,
+ StrengthScaling scaling = ScaleToMaxPossible);
void connectSources(QGeoPositionInfoSource *posSource, QGeoSatelliteInfoSource *satSource);
diff --git a/examples/weatherinfo/weatherinfo.cpp b/examples/weatherinfo/weatherinfo.cpp
index ad95f360d7..5fc0edda87 100644
--- a/examples/weatherinfo/weatherinfo.cpp
+++ b/examples/weatherinfo/weatherinfo.cpp
@@ -45,7 +45,9 @@
#include <QtSvg>
// QtMobility API headers
+#include <qmobilityglobal.h>
#include <qgeopositioninfosource.h>
+#include <qgeosatelliteinfosource.h>
#include <qnmeapositioninfosource.h>
#include <qgeopositioninfo.h>
#include <qnetworkconfigmanager.h>
@@ -54,7 +56,7 @@
#include "satellitedialog.h"
// Use the QtMobility namespace
-using namespace QtMobility;
+QTM_USE_NAMESPACE
class WeatherInfo: public QMainWindow
{
@@ -76,10 +78,10 @@ private:
QTimeLine m_timeLine;
QHash<QString, QString> m_icons;
QNetworkAccessManager* m_nam;
-
+
bool m_usingLogFile;
bool m_gpsWeather;
- QGeoPositionInfoSource* m_location;
+ QGeoPositionInfoSource* m_location;
QNetworkSession* m_session;
QGeoCoordinate m_coordinate;
@@ -97,13 +99,13 @@ public:
m_view->setFrameShape(QFrame::NoFrame);
setWindowTitle("Weather Info");
- QAction *your = new QAction("Your weather", this);
+ QAction *your = new QAction("Your weather", this);
connect(your, SIGNAL(triggered()), SLOT(yourWeather()));
addAction(your);
#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WINCE)
- menuBar()->addAction(your);
+ menuBar()->addAction(your);
#endif
-
+
QStringList cities;
cities << "Helsinki";
cities << "Oslo";
@@ -127,7 +129,7 @@ public:
#endif
setContextMenuPolicy(Qt::ActionsContextMenu);
-
+
// QNetworkAccessManager
m_nam = new QNetworkAccessManager(this);
connect(m_nam, SIGNAL(finished(QNetworkReply*)),
@@ -141,31 +143,30 @@ public:
QTimer::singleShot(100, this, SLOT(delayedInit()));
}
- ~WeatherInfo()
- {
+ ~WeatherInfo() {
if (m_location)
m_location->stopUpdates();
m_session->close();
}
-
-
+
+
private slots:
void delayedInit() {
// Set Internet Access Point
QNetworkConfigurationManager manager;
const bool canStartIAP = (manager.capabilities()
- & QNetworkConfigurationManager::CanStartAndStopInterfaces);
+ & QNetworkConfigurationManager::CanStartAndStopInterfaces);
// Is there default access point, use it
QNetworkConfiguration cfg = manager.defaultConfiguration();
if (!cfg.isValid() || (!canStartIAP && cfg.state() != QNetworkConfiguration::Active)) {
QMessageBox::information(this, tr("Weather Info"), tr(
- "Available Access Points not found."));
+ "Available Access Points not found."));
return;
}
m_session = new QNetworkSession(cfg, this);
m_session->open();
m_session->waitForOpened();
-
+
m_gpsWeather = false;
request("Helsinki");
}
@@ -180,21 +181,21 @@ private slots:
m_location = QGeoPositionInfoSource::createDefaultSource(this);
if (!m_location) {
- QNmeaPositionInfoSource *nmeaLocation =
- new QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode, this);
+ QNmeaPositionInfoSource *nmeaLocation =
+ new QNmeaPositionInfoSource(QNmeaPositionInfoSource::SimulationMode, this);
QFile *logFile = new QFile(QApplication::applicationDirPath() + QDir::separator()
- + "nmealog.txt", this);
+ + "nmealog.txt", this);
nmeaLocation->setDevice(logFile);
m_location = nmeaLocation;
m_usingLogFile = true;
- QMessageBox::information(this, tr("Weather Info"),
- tr("No GPS support detected, using GPS data from a sample log file instead."));
+ QMessageBox::information(this, tr("Weather Info"),
+ tr("No GPS support detected, using GPS data from a sample log file instead."));
}
// Listen gps position changes
- connect(m_location, SIGNAL(positionUpdated(QGeoPositionInfo)), this,
+ connect(m_location, SIGNAL(positionUpdated(QGeoPositionInfo)), this,
SLOT(positionUpdated(QGeoPositionInfo)));
}
@@ -204,23 +205,23 @@ private slots:
QGeoSatelliteInfoSource *m_satellite = QGeoSatelliteInfoSource::createDefaultSource(this);
if (m_satellite) {
- SatelliteDialog *dialog = new SatelliteDialog(this,
- 30,
- SatelliteDialog::ExitOnFixOrCancel,
- SatelliteDialog::OrderByPrnNumber,
- SatelliteDialog::ScaleToMaxPossible);
+ SatelliteDialog *dialog = new SatelliteDialog(this,
+ 30,
+ SatelliteDialog::ExitOnFixOrCancel,
+ SatelliteDialog::OrderByPrnNumber,
+ SatelliteDialog::ScaleToMaxPossible);
dialog->connectSources(m_location, m_satellite);
m_location->startUpdates();
m_satellite->startUpdates();
-
+
dialog->exec();
m_location->stopUpdates();
m_satellite->stopUpdates();
}
- }
+ }
// Start listening GPS position updates
m_location->startUpdates();
@@ -237,11 +238,11 @@ private slots:
requestTownName(longitude, latitude);
m_gpsWeather = false;
} else {
- QMessageBox::information(this,"Weather Info","Waiting for your GPS position...");
+ QMessageBox::information(this, "Weather Info", "Waiting for your GPS position...");
}
}
}
-
+
void chooseCity() {
QAction *action = qobject_cast<QAction*>(sender());
if (action) {
@@ -257,7 +258,7 @@ private slots:
if (!networkReply->error()) {
QString data = QString::fromUtf8(networkReply->readAll());
qDebug() << data;
- if (data.contains("<LocalityName>",Qt::CaseInsensitive)) {
+ if (data.contains("<LocalityName>", Qt::CaseInsensitive)) {
requestWeatherOfTown(data);
} else {
digest(data);
@@ -324,9 +325,9 @@ private:
void requestTownName(QString longitude, QString latitude) {
// http://code.google.com/intl/en/apis/maps/documentation/geocoding/index.html#ReverseGeocoding
QUrl url("http://maps.google.com/maps/geo");
- url.addEncodedQueryItem("q", QUrl::toPercentEncoding(latitude+","+longitude));
+ url.addEncodedQueryItem("q", QUrl::toPercentEncoding(latitude + "," + longitude));
url.addEncodedQueryItem("output", QUrl::toPercentEncoding("xml"));
-
+
m_nam->get(QNetworkRequest(url));
city = QString();
@@ -336,16 +337,16 @@ private:
void requestWeatherOfTown(QString xml) {
// Try to find <LocalityName>xxxxxx</LocalityName>
int start = xml.indexOf("<LocalityName>");
- int end = xml.indexOf("</LocalityName>",start);
- QString town = xml.mid(start+14,end-start-14);
+ int end = xml.indexOf("</LocalityName>", start);
+ QString town = xml.mid(start + 14, end - start - 14);
request(town);
}
-
+
void request(const QString &location) {
QUrl url("http://www.google.com/ig/api");
url.addEncodedQueryItem("hl", "en");
url.addEncodedQueryItem("weather", QUrl::toPercentEncoding(location));
-
+
m_nam->get(QNetworkRequest(url));
city = QString();
@@ -395,7 +396,7 @@ private:
if (!ok)
return QString();
if (unit != "SI")
- degree = ((degree - 32) * 5 + 8)/ 9;
+ degree = ((degree - 32) * 5 + 8) / 9;
return QString::number(degree) + QChar(176);
}
@@ -406,11 +407,11 @@ private:
if (data.contains("<problem_cause")) {
setWindowTitle("Weather Info");
- QMessageBox::information(this,"Weather Info","Could not find weather info");
+ QMessageBox::information(this, "Weather Info", "Could not find weather info");
return;
}
-
+
QColor textColor = palette().color(QPalette::WindowText);
QString unitSystem;
@@ -472,7 +473,7 @@ private:
xml.readNext();
if (xml.name() == "forecast_conditions") {
if (dayItem && statusItem &&
- !lowT.isEmpty() && !highT.isEmpty()) {
+ !lowT.isEmpty() && !highT.isEmpty()) {
m_dayItems << dayItem;
m_conditionItems << statusItem;
QString txt = highT + '/' + lowT;