• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • plugins
  • render
  • weather
WeatherItem.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2009 Bastian Holst <bastianholst@gmx.de>
9 // Copyright 2012 Illya Kovalevskyy <illya.kovalevskyy@gmail.com>
10 //
11 
12 // Self
13 #include "WeatherItem.h"
14 
15 // Marble
16 #include "GeoPainter.h"
17 #include "MarbleDirs.h"
18 #include "WeatherData.h"
19 #include "weatherGlobal.h"
20 #include "FrameGraphicsItem.h"
21 #include "LabelGraphicsItem.h"
22 #include "MarbleGraphicsGridLayout.h"
23 #include "WidgetGraphicsItem.h"
24 #include "TinyWebBrowser.h"
25 #include "MarbleDebug.h"
26 #include "MarbleWidget.h"
27 #include "layers/PopupLayer.h"
28 
29 // Qt
30 #include <QCoreApplication>
31 #include <QDate>
32 #include <QHash>
33 #include <QObject>
34 #include <QString>
35 #include <QAction>
36 #include <QBrush>
37 #include <QIcon>
38 #include <QFontMetrics>
39 #include <QPushButton>
40 #include <QSvgRenderer>
41 
42 namespace Marble
43 {
44 
45 const QSize borderSpacing( 4, 4 );
46 const QSize imageSize( 28, 28 );
47 const double imageSizeRatio = ( (double) imageSize.width()) / ( (double) imageSize.height() );
48 
49 class WeatherItemPrivate
50 {
51  Q_DECLARE_TR_FUNCTIONS(WeatherItemPrivate)
52 
53  public:
54  WeatherItemPrivate( WeatherItem *parent )
55  : m_marbleWidget( 0 ),
56  m_priority( 0 ),
57  m_browserAction( tr( "Weather" ), parent ),
58  m_favoriteAction( parent ),
59  m_parent( parent ),
60  m_frameItem( m_parent ),
61  m_conditionLabel( &m_frameItem ),
62  m_temperatureLabel( &m_frameItem ),
63  m_windDirectionLabel( &m_frameItem ),
64  m_windSpeedLabel( &m_frameItem ),
65  m_favoriteButton( &m_frameItem )
66  {
67  // Setting minimum sizes
68  m_temperatureLabel.setMinimumSize( QSizeF( 0, imageSize.height() ) );
69  m_windSpeedLabel.setMinimumSize( QSizeF( 0, imageSize.height() ) );
70 
71  QPushButton *button = new QPushButton();
72  button->setStyleSheet( "border-style: outset;" );
73  button->setIcon( QIcon( ":/icons/bookmarks.png" ) );
74  button->setFixedSize( 22, 22 );
75  button->setFlat( true );
76  button->setCheckable( true );
77 
78  m_favoriteButton.setWidget( button );
79 
80  // Layouting the item
81  MarbleGraphicsGridLayout *topLayout = new MarbleGraphicsGridLayout( 1, 1 );
82  parent->setLayout( topLayout );
83  topLayout->addItem( &m_frameItem, 0, 0 );
84 
85  MarbleGraphicsGridLayout *gridLayout = new MarbleGraphicsGridLayout( 2, 3 );
86  gridLayout->setAlignment( Qt::AlignCenter );
87  gridLayout->setSpacing( 4 );
88  m_frameItem.setLayout( gridLayout );
89  m_frameItem.setFrame( FrameGraphicsItem::RoundedRectFrame );
90 
91  gridLayout->addItem( &m_conditionLabel, 0, 0 );
92  gridLayout->addItem( &m_temperatureLabel, 0, 1 );
93  gridLayout->setAlignment( &m_temperatureLabel, Qt::AlignRight | Qt::AlignVCenter );
94  gridLayout->addItem( &m_windDirectionLabel, 1, 0 );
95  gridLayout->addItem( &m_windSpeedLabel, 1, 1 );
96  gridLayout->setAlignment( &m_windSpeedLabel, Qt::AlignRight | Qt::AlignVCenter );
97  gridLayout->addItem( &m_favoriteButton, 0, 2 );
98 
99  updateLabels();
100  }
101 
102  ~WeatherItemPrivate()
103  {
104  }
105 
106  void updateToolTip()
107  {
108  QLocale locale = QLocale::system();
109  QString toolTip;
110  toolTip += tr( "Station: %1\n" ).arg( m_parent->stationName() );
111  if ( m_currentWeather.hasValidCondition() && m_currentWeather.hasValidTemperature() )
112  toolTip += QString( "%2, %3\n" ).arg( m_currentWeather.conditionString() )
113  .arg( temperatureString() );
114  else if ( m_currentWeather.hasValidCondition() )
115  toolTip += QString( "%2\n" ).arg( m_currentWeather.conditionString() );
116  else if ( m_currentWeather.hasValidTemperature() )
117  toolTip += QString( "%2\n" ).arg( temperatureString() );
118 
119  if ( m_currentWeather.hasValidWindSpeed() && m_currentWeather.hasValidWindDirection() )
120  toolTip += tr( "Wind: %4, %5\n", "Wind: WindSpeed, WindDirection" )
121  .arg( windSpeedString( ) )
122  .arg( m_currentWeather.windDirectionString() );
123  else if ( m_currentWeather.hasValidWindSpeed() )
124  toolTip += tr( "Wind: %4\n", "Wind: WindSpeed" )
125  .arg( m_currentWeather.windSpeedString() );
126  else if ( m_currentWeather.hasValidWindDirection() )
127  toolTip += tr( "Wind: %4\n", "Wind: WindDirection" )
128  .arg( m_currentWeather.windDirectionString() );
129 
130  if ( m_currentWeather.hasValidPressure() && m_currentWeather.hasValidPressureDevelopment() )
131  toolTip += tr( "Pressure: %6, %7", "Pressure: Pressure, Development" )
132  .arg( pressureString() )
133  .arg( m_currentWeather.pressureDevelopmentString() );
134  else if ( m_currentWeather.hasValidPressure() )
135  toolTip += tr( "Pressure: %6", "Pressure: Pressure" )
136  .arg( pressureString() );
137  else if ( m_currentWeather.hasValidPressureDevelopment() )
138  toolTip += tr( "Pressure %7", "Pressure Development" )
139  .arg( m_currentWeather.pressureDevelopmentString() );
140 
141  if ( !m_forecastWeather.isEmpty() ) {
142  toolTip += '\n';
143 
144  QDate minDate = QDate::currentDate();
145  minDate.addDays( -1 );
146  foreach( const WeatherData& data, m_forecastWeather ) {
147  QDate date = data.dataDate();
148  if( date >= minDate
149  && data.hasValidCondition()
150  && data.hasValidMinTemperature()
151  && data.hasValidMaxTemperature() )
152  {
153  toolTip += '\n';
154  toolTip += tr( "%1: %2, %3 to %4", "DayOfWeek: Condition, MinTemp to MaxTemp" )
155  .arg( locale.standaloneDayName( date.dayOfWeek() ) )
156  .arg( data.conditionString() )
157  .arg( data.minTemperatureString( temperatureUnit() ) )
158  .arg( data.maxTemperatureString( temperatureUnit() ) );
159  }
160  }
161  }
162 
163  m_parent->setToolTip( toolTip );
164  }
165 
166  void updateLabels()
167  {
168  if ( isConditionShown() ) {
169  m_conditionLabel.setImage( m_currentWeather.icon(), imageSize );
170  }
171  else {
172  m_conditionLabel.clear();
173  }
174 
175  if ( isTemperatureShown() ) {
176  m_temperatureLabel.setText( temperatureString() );
177  }
178  else {
179  m_temperatureLabel.clear();
180  }
181 
182  if ( isWindDirectionShown() ) {
183  QString windDirectionString = m_currentWeather.windDirectionString();
184  QSizeF windDirectionImageSize;
185  QSvgRenderer s_windIcons( MarbleDirs::path( "weather/wind-arrows.svgz" ) );
186  QSizeF windDirectionSizeF = s_windIcons.boundsOnElement( windDirectionString ).size();
187  double windDirectionRatio = windDirectionSizeF.width() / windDirectionSizeF.height();
188  if ( windDirectionRatio >= imageSizeRatio ) {
189  windDirectionImageSize.setWidth( imageSize.width() );
190  windDirectionImageSize.setHeight( imageSize.width() / windDirectionRatio );
191  }
192  else {
193  windDirectionImageSize.setHeight( imageSize.height() );
194  windDirectionImageSize.setWidth( imageSize.height() * windDirectionRatio );
195  }
196 
197  QImage windArrow( windDirectionImageSize.toSize(), QImage::Format_ARGB32 );
198  windArrow.fill( Qt::transparent );
199  QPainter painter( &windArrow );
200  s_windIcons.render( &painter, windDirectionString );
201  m_windDirectionLabel.setImage( windArrow );
202  }
203  else {
204  m_windDirectionLabel.clear();
205  }
206 
207  if ( isWindSpeedShown() ) {
208  m_windSpeedLabel.setText( windSpeedString() );
209  }
210  else {
211  m_windSpeedLabel.clear();
212  }
213 
214  m_parent->update();
215  }
216 
217  void updateFavorite()
218  {
219  QStringList items = m_settings.value( "favoriteItems" ).toString()
220  .split(QLatin1Char(','), QString::SkipEmptyParts);
221  bool favorite = items.contains( m_parent->id() );
222 
223  m_favoriteButton.setVisible( favorite );
224  m_favoriteAction.setText( favorite ? tr( "Remove from Favorites" )
225  : tr( "Add to Favorites" ) );
226 
227  if ( m_parent->isFavorite() != favorite ) {
228  m_parent->setFavorite( favorite );
229  }
230 
231  m_parent->update();
232  }
233 
234  bool isConditionShown() const
235  {
236  return m_currentWeather.hasValidCondition()
237  && m_settings.value( "showCondition", showConditionDefault ).toBool();
238  }
239 
240  bool isTemperatureShown() const
241  {
242  return m_currentWeather.hasValidTemperature()
243  && m_settings.value( "showTemperature", showTemperatureDefault ).toBool();
244  }
245 
246  bool isWindDirectionShown() const
247  {
248  return m_currentWeather.hasValidWindDirection()
249  && m_settings.value( "showWindDirection", showWindDirectionDefault ).toBool();
250  }
251 
252  bool isWindSpeedShown() const
253  {
254  return m_currentWeather.hasValidWindSpeed()
255  && m_settings.value( "showWindSpeed", showWindSpeedDefault ).toBool();
256  }
257 
258  QString temperatureString() const
259  {
260  WeatherData::TemperatureUnit tUnit = temperatureUnit();
261  return m_currentWeather.temperatureString( tUnit );
262  }
263 
264  WeatherData::TemperatureUnit temperatureUnit() const
265  {
266  WeatherData::TemperatureUnit tUnit
267  = (WeatherData::TemperatureUnit) m_settings.value( "temperatureUnit",
268  WeatherData::Celsius ).toInt();
269  return tUnit;
270  }
271 
272  QString windSpeedString() const
273  {
274  return m_currentWeather.windSpeedString( speedUnit() );
275  }
276 
277  WeatherData::SpeedUnit speedUnit() const
278  {
279  return (WeatherData::SpeedUnit) m_settings.value( "windSpeedUnit",
280  WeatherData::kph ).toInt();
281  }
282 
283  QString pressureString() const
284  {
285  return m_currentWeather.pressureString( pressureUnit() );
286  }
287 
288  WeatherData::PressureUnit pressureUnit() const
289  {
290  return (WeatherData::PressureUnit) m_settings.value( "pressureUnit",
291  WeatherData::HectoPascal ).toInt();
292  }
293 
294  MarbleWidget *m_marbleWidget;
295 
296  WeatherData m_currentWeather;
297  QMap<QDate, WeatherData> m_forecastWeather;
298 
299  int m_priority;
300  QAction m_browserAction;
301  QAction m_favoriteAction;
302  WeatherItem *m_parent;
303  QString m_stationName;
304  QHash<QString,QVariant> m_settings;
305 
306  static QFont s_font;
307 
308  // Labels and Layout
309  // We are not the owner of these items.
310  FrameGraphicsItem m_frameItem;
311  LabelGraphicsItem m_conditionLabel;
312  LabelGraphicsItem m_temperatureLabel;
313  LabelGraphicsItem m_windDirectionLabel;
314  LabelGraphicsItem m_windSpeedLabel;
315  WidgetGraphicsItem m_favoriteButton;
316 };
317 
318 // FIXME: Fonts to be defined globally
319 #ifdef Q_OS_MACX
320  QFont WeatherItemPrivate::s_font = QFont( "Sans Serif", 10 );
321 #else
322  QFont WeatherItemPrivate::s_font = QFont( "Sans Serif", 8 );
323 #endif
324 
325 WeatherItem::WeatherItem(QObject *parent )
326  : AbstractDataPluginItem( parent ),
327  d( new WeatherItemPrivate( this ) )
328 {
329  setCacheMode( ItemCoordinateCache );
330 }
331 
332 WeatherItem::WeatherItem(MarbleWidget* widget, QObject *parent )
333  : AbstractDataPluginItem( parent ),
334  d( new WeatherItemPrivate( this ) )
335 {
336  setCacheMode( ItemCoordinateCache );
337  d->m_marbleWidget = widget;
338 }
339 
340 WeatherItem::~WeatherItem()
341 {
342  delete d;
343 }
344 
345 QAction *WeatherItem::action()
346 {
347  disconnect( &d->m_browserAction, SIGNAL(triggered()),
348  this, SLOT(openBrowser()) );
349  connect( &d->m_browserAction, SIGNAL(triggered()),
350  this, SLOT(openBrowser()) );
351  return &d->m_browserAction;
352 }
353 
354 bool WeatherItem::request( const QString& type )
355 {
356  Q_UNUSED( type )
357  return true;
358 }
359 
360 bool WeatherItem::initialized() const
361 {
362  return d->isConditionShown()
363  || d->isTemperatureShown()
364  || d->isWindDirectionShown()
365  || d->isWindSpeedShown();
366 }
367 
368 bool WeatherItem::operator<( const AbstractDataPluginItem *other ) const
369 {
370  const WeatherItem *weatherItem = qobject_cast<const WeatherItem *>(other);
371  if( weatherItem ) {
372  return ( priority() > weatherItem->priority() );
373  }
374  else {
375  return false;
376  }
377 }
378 
379 QString WeatherItem::stationName() const
380 {
381  return d->m_stationName;
382 }
383 
384 void WeatherItem::setStationName( const QString& name )
385 {
386  if ( name != d->m_stationName ) {
387  d->m_browserAction.setText( name );
388  d->m_stationName = name;
389  d->updateToolTip();
390  d->updateLabels();
391  emit stationNameChanged();
392  }
393 }
394 
395 WeatherData WeatherItem::currentWeather() const
396 {
397  return d->m_currentWeather;
398 }
399 
400 void WeatherItem::setCurrentWeather( const WeatherData &weather )
401 {
402  d->m_currentWeather = weather;
403  d->updateToolTip();
404  d->updateLabels();
405  emit updated();
406  emit descriptionChanged();
407  emit imageChanged();
408  emit temperatureChanged();
409 }
410 
411 QMap<QDate, WeatherData> WeatherItem::forecastWeather() const
412 {
413  return d->m_forecastWeather;
414 }
415 
416 void WeatherItem::setForecastWeather( const QMap<QDate, WeatherData>& forecasts )
417 {
418  d->m_forecastWeather = forecasts;
419 
420  d->updateToolTip();
421  emit updated();
422 }
423 
424 void WeatherItem::addForecastWeather( const QList<WeatherData>& forecasts )
425 {
426  foreach( const WeatherData& data, forecasts ) {
427  QDate date = data.dataDate();
428  WeatherData other = d->m_forecastWeather.value( date );
429  if ( !other.isValid() ) {
430  d->m_forecastWeather.insert( date, data );
431  }
432  else if ( other.publishingTime() < data.publishingTime() ) {
433  d->m_forecastWeather.remove( date );
434  d->m_forecastWeather.insert( date, data );
435  }
436  }
437 
438  // Remove old items
439  QDate minDate = QDate::currentDate();
440  minDate.addDays( -1 );
441 
442  QMap<QDate, WeatherData>::iterator it = d->m_forecastWeather.begin();
443 
444  while( it != d->m_forecastWeather.end() ) {
445  if ( it.key() < minDate ) {
446  d->m_forecastWeather.remove( it.key() );
447  }
448  ++it;
449  }
450 
451  d->updateToolTip();
452  emit updated();
453 }
454 
455 quint8 WeatherItem::priority() const
456 {
457  return d->m_priority;
458 }
459 
460 void WeatherItem::setPriority( quint8 priority )
461 {
462  d->m_priority = priority;
463 }
464 
465 void WeatherItem::setSettings( const QHash<QString, QVariant>& settings )
466 {
467  if ( d->m_settings == settings ) {
468  return;
469  }
470 
471  d->m_settings = settings;
472 
473  d->updateToolTip();
474  d->updateLabels();
475  d->updateFavorite();
476 }
477 
478 void WeatherItem::setMarbleWidget(MarbleWidget *widget)
479 {
480  d->m_marbleWidget = widget;
481 }
482 
483 void WeatherItem::openBrowser()
484 {
485  if (d->m_marbleWidget) {
486  PopupLayer *popup = d->m_marbleWidget->popupLayer();
487  popup->setCoordinates( coordinate(), Qt::AlignRight | Qt::AlignVCenter );
488  popup->setSize( QSizeF( 610, 550 ) ); // +10 pixels for the width
489  popup->popup();
490 
491  QFile weatherHtmlFile(":/marble/weather/weather.html");
492  if ( !weatherHtmlFile.open(QIODevice::ReadOnly) ) {
493  return;
494  }
495 
496  QString templateHtml = weatherHtmlFile.readAll();
497  popup->setContent( createFromTemplate(templateHtml) );
498  }
499 }
500 
501 QString WeatherItem::createFromTemplate(const QString &templateHtml)
502 {
503  QString html = templateHtml;
504  QLocale locale = QLocale::system();
505  html.replace("%city_name%", stationName());
506  html.replace("%weather_situation%", "file://"+d->m_currentWeather.iconSource());
507  html.replace("%current_temp%", d->temperatureString());
508  html.replace("%current_condition%", d->m_currentWeather.conditionString());
509  html.replace("%wind_direction%", d->m_currentWeather.windDirectionString());
510  html.replace("%wind_speed%", d->m_currentWeather.windSpeedString());
511  html.replace("%humidity_level%", d->m_currentWeather.humidityString());
512  html.replace("%publish_time%", d->m_currentWeather.publishingTime().toString());
513 
514  if(d->m_forecastWeather.size() < 1) {
515  html.replace("%forecast_available%", "none");
516  } else {
517  html.replace("%forecast_available%", "block");
518  }
519 
520  int forecastNumber = 0;
521 
522  foreach ( const WeatherData &forecast, d->m_forecastWeather ) {
523  forecastNumber++;
524  const QString suffix = QString::number(forecastNumber);
525  QDate date = forecast.dataDate();
526  html.replace(QLatin1String("%day_f")+suffix+'%', locale.standaloneDayName(date.dayOfWeek()));
527  html.replace(QLatin1String("%weather_situation_f")+suffix+'%', "file://"+forecast.iconSource());
528  html.replace(QLatin1String("%max_temp_f")+suffix+'%',
529  forecast.maxTemperatureString(WeatherData::Celsius));
530  html.replace(QLatin1String("%min_temp_f")+suffix+'%',
531  forecast.minTemperatureString(WeatherData::Celsius));
532  html.replace(QLatin1String("%condition_f")+suffix+'%', forecast.conditionString());
533  html.replace(QLatin1String("%wind_direction_f")+suffix+'%', forecast.windDirectionString());
534  html.replace(QLatin1String("%wind_speed_f")+suffix+'%', forecast.windSpeedString());
535  html.replace(QLatin1String("%publish_time_f")+suffix+'%', forecast.publishingTime().toString());
536  }
537 
538  return html;
539 }
540 
541 QList<QAction*> WeatherItem::actions()
542 {
543  QList<QAction*> result;
544  result << &d->m_browserAction;
545 
546  disconnect( &d->m_favoriteAction, SIGNAL(triggered()),
547  this, SLOT(toggleFavorite()) );
548  connect( &d->m_favoriteAction, SIGNAL(triggered()),
549  this, SLOT(toggleFavorite()) );
550 
551  result << &d->m_favoriteAction;
552 
553  return result;
554 }
555 
556 QString WeatherItem::description() const
557 {
558  return d->m_currentWeather.toHtml( WeatherData::Celsius, WeatherData::kph, WeatherData::Bar );
559 }
560 
561 QString WeatherItem::image() const
562 {
563  return d->m_currentWeather.iconSource();
564 }
565 
566 double WeatherItem::temperature() const
567 {
568  return d->m_currentWeather.hasValidTemperature()
569  ? d->m_currentWeather.temperature( WeatherData::Celsius )
570  : 0.0;
571 }
572 
573 } // namespace Marble
574 
575 #include "WeatherItem.moc"
Marble::WeatherData::hasValidCondition
bool hasValidCondition() const
Definition: WeatherData.cpp:354
Marble::WeatherItem::~WeatherItem
~WeatherItem()
Definition: WeatherItem.cpp:340
Marble::WeatherItem::stationNameChanged
void stationNameChanged()
QWidget::setStyleSheet
void setStyleSheet(const QString &styleSheet)
QLocale::standaloneDayName
QString standaloneDayName(int day, FormatType type) const
Marble::FrameGraphicsItem
Definition: FrameGraphicsItem.h:25
TinyWebBrowser.h
Marble::borderSpacing
const QSize borderSpacing(4, 4)
QSize::width
int width() const
LabelGraphicsItem.h
Marble::MarbleDirs::path
static QString path(const QString &relativePath)
Definition: MarbleDirs.cpp:59
QSvgRenderer::render
void render(QPainter *painter)
showWindDirectionDefault
const bool showWindDirectionDefault
Definition: weatherGlobal.h:18
showTemperatureDefault
const bool showTemperatureDefault
Definition: weatherGlobal.h:17
Marble::WeatherItem::operator<
bool operator<(const AbstractDataPluginItem *other) const
Definition: WeatherItem.cpp:368
Marble::AbstractDataPluginItem
Definition: AbstractDataPluginItem.h:28
Marble::WeatherItem::currentWeather
WeatherData currentWeather() const
Definition: WeatherItem.cpp:395
Marble::WeatherData::minTemperatureString
QString minTemperatureString(WeatherData::TemperatureUnit format=WeatherData::Kelvin) const
Definition: WeatherData.cpp:665
QFont
Marble::imageSizeRatio
const double imageSizeRatio
Definition: WeatherItem.cpp:47
QRectF::size
QSizeF size() const
QMap
QSvgRenderer
Marble::WeatherData::publishingTime
QDateTime publishingTime() const
Get the time when the data was published.
Definition: WeatherData.cpp:311
Marble::PopupLayer
The PopupLayer class.
Definition: PopupLayer.h:34
QStringList::contains
bool contains(const QString &str, Qt::CaseSensitivity cs) const
Marble::WeatherItem::initialized
bool initialized() const
Definition: WeatherItem.cpp:360
Marble::WeatherData::PressureUnit
PressureUnit
Definition: WeatherData.h:115
Marble::WeatherItem::descriptionChanged
void descriptionChanged()
Marble::WeatherData::dataDate
QDate dataDate() const
Get the date the data is meant for.
Definition: WeatherData.cpp:327
Marble::PopupLayer::popup
void popup()
Make the dialog pop up.
Definition: PopupLayer.cpp:117
Marble::MarbleGraphicsGridLayout::setAlignment
void setAlignment(Qt::Alignment align)
Definition: MarbleGraphicsGridLayout.cpp:194
QPushButton::setFlat
void setFlat(bool)
Marble::MarbleGraphicsItem::setLayout
void setLayout(AbstractMarbleGraphicsLayout *layout)
Set the layout of the graphics item.
Definition: MarbleGraphicsItem.cpp:146
Marble::MarbleGraphicsGridLayout::addItem
void addItem(ScreenGraphicsItem *item, int row, int column)
Definition: MarbleGraphicsGridLayout.cpp:74
Marble::WeatherData::Bar
Definition: WeatherData.h:118
Marble::WeatherItem::forecastWeather
QMap< QDate, WeatherData > forecastWeather() const
Definition: WeatherItem.cpp:411
QObject::disconnect
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
MarbleDebug.h
QAbstractButton::setIcon
void setIcon(const QIcon &icon)
Marble::WeatherData::SpeedUnit
SpeedUnit
Definition: WeatherData.h:101
Marble::WeatherData::TemperatureUnit
TemperatureUnit
Definition: WeatherData.h:109
QFile
showWindSpeedDefault
const bool showWindSpeedDefault
Definition: weatherGlobal.h:19
QLocale::system
QLocale system()
QList::value
T value(int i) const
Marble::MarbleWidget
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:104
FrameGraphicsItem.h
QString::clear
void clear()
QDate::dayOfWeek
int dayOfWeek() const
Marble::PopupLayer::setContent
void setContent(const QString &html, const QUrl &baseUrl=QUrl())
Sets content of the browser.
Definition: PopupLayer.cpp:144
Marble::WeatherData
Definition: WeatherData.h:26
Marble::WeatherItem::imageChanged
void imageChanged()
QObject::name
const char * name() const
Marble::WeatherData::isValid
bool isValid() const
Definition: WeatherData.cpp:295
QString::number
QString number(int n, int base)
Marble::MarbleGraphicsGridLayout::setSpacing
void setSpacing(int spacing)
Set the spacing between the items inside the layout.
Definition: MarbleGraphicsGridLayout.cpp:209
Marble::FrameGraphicsItem::RoundedRectFrame
Definition: FrameGraphicsItem.h:31
QImage::fill
void fill(uint pixelValue)
QHash< QString, QVariant >
Marble::WeatherItem::actions
virtual QList< QAction * > actions()
Definition: WeatherItem.cpp:541
Marble::WeatherItem::setStationName
void setStationName(const QString &name)
Definition: WeatherItem.cpp:384
QObject
showConditionDefault
const bool showConditionDefault
Definition: weatherGlobal.h:16
Marble::WeatherItem::request
virtual bool request(const QString &type)
Test if the item wants to request type again.
Definition: WeatherItem.cpp:354
Marble::WeatherItem::priority
quint8 priority() const
Definition: WeatherItem.cpp:455
QSizeF::toSize
QSize toSize() const
QSizeF::setWidth
void setWidth(qreal width)
QString::toInt
int toInt(bool *ok, int base) const
QPainter
MarbleDirs.h
QIODevice::readAll
QByteArray readAll()
Marble::MarbleGraphicsItem::ItemCoordinateCache
Definition: MarbleGraphicsItem.h:41
Marble::WeatherItem::setForecastWeather
void setForecastWeather(const QMap< QDate, WeatherData > &forecasts)
Definition: WeatherItem.cpp:416
Marble::WeatherItem::addForecastWeather
void addForecastWeather(const QList< WeatherData > &forecasts)
Adds additional forecasts to the list.
Definition: WeatherItem.cpp:424
Marble::WeatherItem::setPriority
void setPriority(quint8 priority)
Definition: WeatherItem.cpp:460
QDate
Marble::MarbleGraphicsGridLayout
Definition: MarbleGraphicsGridLayout.h:27
Marble::WeatherData::Celsius
Definition: WeatherData.h:110
Marble::WeatherItem::WeatherItem
WeatherItem(QObject *parent=0)
Definition: WeatherItem.cpp:325
QAbstractButton::setCheckable
void setCheckable(bool)
QString
QList
GeoPainter.h
QFile::open
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
Marble::WidgetGraphicsItem
Definition: WidgetGraphicsItem.h:28
WidgetGraphicsItem.h
QStringList
Marble::WeatherItem::action
QAction * action()
Returns the action of this specific item.
Definition: WeatherItem.cpp:345
Marble::WeatherItem::stationName
QString stationName() const
Definition: WeatherItem.cpp:379
Marble::WeatherData::kph
Definition: WeatherData.h:102
QLocale
QSize
weatherGlobal.h
Marble::WeatherData::maxTemperatureString
QString maxTemperatureString(WeatherData::TemperatureUnit format=WeatherData::Kelvin) const
Definition: WeatherData.cpp:649
QWidget::setFixedSize
void setFixedSize(const QSize &s)
QLatin1Char
MarbleGraphicsGridLayout.h
QImage
Marble::imageSize
const QSize imageSize(28, 28)
Marble::WeatherData::HectoPascal
Definition: WeatherData.h:116
QString::replace
QString & replace(int position, int n, QChar after)
QSvgRenderer::boundsOnElement
QRectF boundsOnElement(const QString &id) const
PopupLayer.h
Marble::WeatherData::hasValidMaxTemperature
bool hasValidMaxTemperature() const
Definition: WeatherData.cpp:655
QSizeF
Marble::MarbleGraphicsItem::setCacheMode
void setCacheMode(CacheMode mode)
Set the cache mode of the item.
Definition: MarbleGraphicsItem.cpp:159
QLatin1String
Marble::WeatherItem::setSettings
void setSettings(const QHash< QString, QVariant > &settings)
Set the settings of the item.
Definition: WeatherItem.cpp:465
QDate::currentDate
QDate currentDate()
QAction
Marble::BillboardGraphicsItem::coordinate
GeoDataCoordinates coordinate() const
Definition: BillboardGraphicsItem.cpp:93
QSize::height
int height() const
Marble::LabelGraphicsItem
A label item provides an Item that displays text or images/pixmaps.
Definition: LabelGraphicsItem.h:31
MarbleWidget.h
This file contains the headers for MarbleWidget.
QPushButton
Marble::PopupLayer::setCoordinates
void setCoordinates(const GeoDataCoordinates &coordinates, Qt::Alignment alignment)
Sets coordinates.
Definition: PopupLayer.cpp:133
Marble::WeatherItem::setMarbleWidget
void setMarbleWidget(MarbleWidget *widget)
Definition: WeatherItem.cpp:478
Marble::WeatherItem::description
QString description() const
Marble::WeatherItem::temperature
double temperature() const
QDate::addDays
QDate addDays(int ndays) const
Marble::WeatherItem::openBrowser
void openBrowser()
Definition: WeatherItem.cpp:483
QSizeF::height
qreal height() const
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Marble::AbstractDataPluginItem::toggleFavorite
void toggleFavorite()
Definition: AbstractDataPluginItem.cpp:117
QSizeF::setHeight
void setHeight(qreal height)
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
Marble::PopupLayer::setSize
void setSize(const QSizeF &size)
Sets size of popup item.
Definition: PopupLayer.cpp:163
WeatherData.h
Marble::WeatherItem
This is the class painting a weather item on the screen.
Definition: WeatherItem.h:37
Marble::WeatherData::conditionString
QString conditionString() const
Definition: WeatherData.cpp:359
QSizeF::width
qreal width() const
QMap::iterator
Marble::WeatherData::hasValidMinTemperature
bool hasValidMinTemperature() const
Definition: WeatherData.cpp:677
QIcon
WeatherItem.h
Marble::WeatherItem::temperatureChanged
void temperatureChanged()
Marble::WeatherItem::image
QString image() const
Marble::AbstractDataPluginItem::updated
void updated()
Marble::WeatherItem::setCurrentWeather
void setCurrentWeather(const WeatherData &weather)
Definition: WeatherItem.cpp:400
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal