~ubuntu-branches/ubuntu/karmic/kdeplasma-addons/karmic-updates

« back to all changes in this revision

Viewing changes to applets/weatherstation/weatherstation.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Harald Sitter, Christian Mangold, Alessandro Ghersi, Harald Sitter
  • Date: 2009-08-30 20:11:55 UTC
  • mfrom: (1.1.16 upstream)
  • Revision ID: james.westby@ubuntu.com-20090830201155-ftsg6ehgrdsrcn8f
Tags: 4:4.3.1-0ubuntu1
[ Christian Mangold ]
* New upstream release
* Bump version of KDE build-deps to 4.3.1

[Alessandro Ghersi]
* Add libxcomposite-dev, libxrender-dev and libxdamage-dev to build-deps
  to build compositing support for Lancelot. (LP: #408235)
  (Thanks to Khashayar Naderehvandi)

[ Harald Sitter ]
* Fix armel build using kubuntu_01_fix_armel_build.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
{
46
46
    m_lcd = new LCD(this);
47
47
    m_lcd->setSvg("weatherstation/lcd");
48
 
    // So we don't show in panel
49
 
    m_lcd->setMinimumSize(m_lcd->preferredSize() / 2);
 
48
    // i18n: This and other all-caps messages are pieces of text shown on
 
49
    // an LCD-like image mimicking a electronic weather station display.
 
50
    // If weather station displays in your country are always in English,
 
51
    // you may want to consider leaving these strings in English too,
 
52
    // to achieve a more realistic feeling.
 
53
    m_lcd->setLabel("pressure-label", i18n("PRESSURE"));
 
54
    m_lcd->setLabel("weather-label", i18n("CURRENT WEATHER"));
 
55
    m_lcd->setLabel("temperature-label", i18n("OUTDOOR TEMP"));
 
56
    m_lcd->setLabel("humidity-label", i18n("HUMIDITY"));
 
57
    m_lcd->setLabel("wind-label", i18n("WIND"));
 
58
    m_lcd->setLabel("provider-label", QString());
50
59
    connect(m_lcd, SIGNAL(clicked(const QString&)), this, SLOT(clicked(const QString&)));
51
60
 
52
61
    m_lcdPanel = new LCD(this);
53
62
    m_lcdPanel->setSvg("weatherstation/lcd_panel");
 
63
    m_lcdPanel->setLabel("temperature-label", i18n("OUTDOOR TEMP"));
54
64
    m_lcdPanel->hide();
55
65
 
56
66
    //m_lcd->setItemOn("under_construction");
144
154
        setWind(value(data["Wind Speed"].toString(),
145
155
                WeatherUtils::getUnitString(data["Wind Speed Unit"].toInt(), true)),
146
156
                data["Wind Direction"].toString());
147
 
        m_lcd->setLabel("label0", data["Credit"].toString());
 
157
        m_lcd->setLabel("provider-label", data["Credit"].toString());
148
158
        m_url = data["Credit Url"].toString();
149
 
        m_lcd->setItemClickable("label0", !m_url.isEmpty());
 
159
        m_lcd->setItemClickable("provider-click", !m_url.isEmpty());
150
160
 
151
161
        if (m_showToolTip) {
152
162
            Plasma::ToolTipContent ttc(data["Place"].toString(),
153
 
                    i18n("Last updated: ") + QDateTime::currentDateTime().toString());
 
163
                    i18n("Last updated: %1", KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), KLocale::FancyLongDate)));
154
164
            Plasma::ToolTipManager::self()->setContent(this, ttc);
155
165
        }
156
166
    }
224
234
    current = fromCondition(condition);
225
235
    m_lcd->setGroup("weather", current);
226
236
 
227
 
    QString s = fitValue(Conversion::Converter::self()->convert(pressure, pressureUnit()), 5);
 
237
    Conversion::Value value = Conversion::Converter::self()->convert(pressure, pressureUnit());
 
238
    QString s = fitValue(value, 5);
228
239
    m_lcd->setNumber("pressure", s);
229
 
    m_lcd->setGroup("pressure_unit", QStringList() << pressureUnit());
 
240
    m_lcd->setLabel("pressure-unit-label", value.unit()->symbol());
230
241
 
231
242
    qreal t;
232
243
    if (tendencyString.toLower() == "rising") {
249
260
void WeatherStation::setTemperature(const Conversion::Value& temperature)
250
261
{
251
262
    Conversion::Value v = Conversion::Converter::self()->convert(temperature, temperatureUnit());
252
 
    m_lcd->setGroup("temp_unit", QStringList() << temperatureUnit());
253
 
    m_lcdPanel->setGroup("temp_unit", QStringList() << temperatureUnit());
 
263
    m_lcd->setLabel("temperature-unit-label", v.unit()->symbol());
 
264
    m_lcdPanel->setLabel("temperature-unit-label", v.unit()->symbol());
254
265
    m_lcd->setNumber("temperature", fitValue(v , 4));
255
266
    m_lcdPanel->setNumber("temperature", fitValue(v , 3));
256
267
    setLCDIcon();
269
280
void WeatherStation::setWind(const Conversion::Value& speed, const QString& dir)
270
281
{
271
282
    //kDebug() << speed.number() << speed.unit()->symbol() << dir;
272
 
    QString s = fitValue(Conversion::Converter::self()->convert(speed, speedUnit()), 3);
 
283
    Conversion::Value value = Conversion::Converter::self()->convert(speed, speedUnit());
 
284
    QString s = fitValue(value, 3);
273
285
 
274
286
    if (dir == "N/A") {
275
287
        m_lcd->setGroup("wind", QStringList());
277
289
        m_lcd->setGroup("wind", QStringList() << dir);
278
290
    }
279
291
    m_lcd->setNumber("wind_speed", s);
280
 
    m_lcd->setGroup("wind_unit", QStringList() << speedUnit());
 
292
    m_lcd->setLabel("wind-unit-label", value.unit()->symbol());
281
293
}
282
294
 
283
295
void WeatherStation::clicked(const QString &name)