Ticket #6782: weather_screens.2.patch
File weather_screens.2.patch, 3.0 KB (added by , 15 years ago) |
---|
-
mythplugins/mythweather/mythweather/weatherSetup.cpp
110 110 m_sourceManager->findScriptsDB(); 111 111 m_sourceManager->setupSources(); 112 112 } 113 114 // Deallocate the ScreenListInfo objects created for the active screen list. 115 for (int i=0; i < m_activeList->GetCount(); i++) 116 { 117 MythUIButtonListItem *item = m_activeList->GetItemAt(i); 118 if (item->GetData().isValid()) 119 delete qVariantValue<ScreenListInfo *>(item->GetData()); 120 } 113 121 } 114 122 115 123 bool ScreenSetup::Create() … … 264 272 265 273 QStringList types; 266 274 267 ScreenListMap m_ScreenListMap = loadScreens();275 ScreenListMap screenListMap = loadScreens(); 268 276 269 ScreenListMap::const_iterator i = m_ScreenListMap.constBegin();270 while (i != m_ScreenListMap.constEnd())277 ScreenListMap::const_iterator i = screenListMap.constBegin(); 278 while (i != screenListMap.constEnd()) 271 279 { 272 280 273 si = m_ScreenListMap[i.key()];281 si = screenListMap[i.key()]; 274 282 types = si->dataTypes; 275 283 si->units = ENG_UNITS; 276 284 … … 329 337 QString src = db.value(4).toString(); 330 338 uint draworder = db.value(5).toUInt(); 331 339 332 si = m_ScreenListMap[name]; 333 // Clear types first as we will re-insert the values from the database 334 si->types.clear(); 335 types = si->dataTypes; 340 types = screenListMap[name]->dataTypes; 336 341 337 342 TypeListInfo ti(dataitem, location, 338 343 m_sourceManager->getSourceByName(src)); 339 344 340 345 if (active_screens.find(draworder) == active_screens.end()) 341 346 { 347 si = new ScreenListInfo(*screenListMap[name]); 348 // Clear types first as we will re-insert the values from the database 349 si->types.clear(); 350 si->units = units; 351 342 352 MythUIButtonListItem *item = 343 353 new MythUIButtonListItem(m_activeList, name); 344 si->units = units; 345 354 346 355 // Only insert types meant for this screen 347 356 for (QStringList::Iterator type_i = types.begin(); 348 357 type_i != types.end(); ++type_i ) -
mythplugins/mythweather/mythweather/weatherUtils.h
51 51 class ScreenListInfo 52 52 { 53 53 public: 54 ScreenListInfo() {} 55 ScreenListInfo(const ScreenListInfo &info) 56 : name(info.name), types(info.types), dataTypes(info.dataTypes), 57 helptxt(info.helptxt), sources(info.sources), units(info.units), 58 hasUnits(info.hasUnits), multiLoc(info.multiLoc) 59 { 60 types.detach(); 61 } 62 54 63 TypeListInfo GetCurrentTypeList(void) const; 55 64 56 65 public: