layout->addWidget (_label);
setLayout (layout);
+ _light->setVisible (_settings->check (Settings::C_Light));
+
connect (_traffic, SIGNAL (updated ()), SLOT (trafficUpdated ()));
// every 5 minutes (TODO, make option)
ExtendedTrafficInfo info = _traffic->lookup_ext ("1");
if (info.valid ()) {
+ QString data;
+ bool first = true;
_light->setColor (info.color ());
- _label->setText (QString ("%1, %2\n%3")
- .arg (QString::number (info.level ()))
- .arg (info.localtime ())
- .arg (info.hint ()));
+
+ if (_settings->check (Settings::C_Rank)) {
+ data.append (QString::number (info.level ()));
+ data.append (info.level () > 1 ? tr (" points") : tr (" point"));
+ first = false;
+ }
+
+ if (_settings->check (Settings::C_Time)) {
+ if (!first)
+ data.append (", ");
+ data.append (info.localtime ());
+ first = false;
+ }
+
+ if (_settings->check (Settings::C_Hint)) {
+ data.append ("\n");
+ data.append (info.hint ());
+ }
+
+ _label->setText (data);
}
else
_light->setColor (ExtendedTrafficInfo::Unknown);
SettingsDialog dlg (_settings);
dlg.exec ();
+
+ // Handle settings
+ _light->setVisible (_settings->check (Settings::C_Light));
+
+ trafficUpdated ();
}
_cities["10174"] = tr ("Kiev");
_cities["11162"] = tr ("Ekaterinburg");
_cities["11079"] = tr ("N.Novgorod");
+
+ setCheck (C_Light, true);
+ setCheck (C_Rank, true);
+ setCheck (C_Hint, true);
}