equal
deleted
inserted
replaced
157 // Set Internet Access Point |
157 // Set Internet Access Point |
158 QNetworkConfigurationManager manager; |
158 QNetworkConfigurationManager manager; |
159 const bool canStartIAP = (manager.capabilities() |
159 const bool canStartIAP = (manager.capabilities() |
160 & QNetworkConfigurationManager::CanStartAndStopInterfaces); |
160 & QNetworkConfigurationManager::CanStartAndStopInterfaces); |
161 // Is there default access point, use it |
161 // Is there default access point, use it |
162 QNetworkConfiguration cfg = manager.defaultConfiguration(); |
162 QTM_PREPEND_NAMESPACE(QNetworkConfiguration) cfg = manager.defaultConfiguration(); |
163 if (!cfg.isValid() || (!canStartIAP && cfg.state() != QNetworkConfiguration::Active)) { |
163 if (!cfg.isValid() || (!canStartIAP && cfg.state() != QTM_PREPEND_NAMESPACE(QNetworkConfiguration)::Active)) { |
164 QMessageBox::information(this, tr("Weather Info"), tr( |
164 QMessageBox::information(this, tr("Weather Info"), tr( |
165 "Available Access Points not found.")); |
165 "Available Access Points not found.")); |
166 return; |
166 return; |
167 } |
167 } |
168 m_session = new QNetworkSession(cfg, this); |
168 m_session = new QNetworkSession(cfg, this); |
259 |
259 |
260 void handleNetworkData(QNetworkReply *networkReply) { |
260 void handleNetworkData(QNetworkReply *networkReply) { |
261 QUrl url = networkReply->url(); |
261 QUrl url = networkReply->url(); |
262 if (!networkReply->error()) { |
262 if (!networkReply->error()) { |
263 QString data = QString::fromUtf8(networkReply->readAll()); |
263 QString data = QString::fromUtf8(networkReply->readAll()); |
264 qDebug() << data; |
|
265 if (data.contains("<LocalityName>", Qt::CaseInsensitive)) { |
264 if (data.contains("<LocalityName>", Qt::CaseInsensitive)) { |
266 requestWeatherOfTown(data); |
265 requestWeatherOfTown(data); |
267 } else { |
266 } else { |
268 digest(data); |
267 digest(data); |
269 } |
268 } |
296 } |
295 } |
297 |
296 |
298 private: |
297 private: |
299 |
298 |
300 void setupScene() { |
299 void setupScene() { |
|
300 |
|
301 m_scene.setBackgroundBrush(QBrush(palette().color(QPalette::Base))); |
301 |
302 |
302 QColor textColor = palette().color(QPalette::WindowText); |
303 QColor textColor = palette().color(QPalette::WindowText); |
303 QFont textFont = font(); |
304 QFont textFont = font(); |
304 textFont.setBold(true); |
305 textFont.setBold(true); |
305 textFont.setPointSize(textFont.pointSize() * 2); |
306 textFont.setPointSize(textFont.pointSize() * 2); |