equal
deleted
inserted
replaced
856 |
856 |
857 void HWMapContainer::updateModelViews() |
857 void HWMapContainer::updateModelViews() |
858 { |
858 { |
859 // restore theme selection |
859 // restore theme selection |
860 // do this before map selection restore, because map may overwrite theme |
860 // do this before map selection restore, because map may overwrite theme |
861 if (!m_theme.isEmpty()) |
861 if (!m_theme.isNull() && !m_theme.isEmpty()) |
862 { |
862 { |
863 QModelIndexList mdl = m_themeModel->match(m_themeModel->index(0), Qt::DisplayRole, m_theme); |
863 QModelIndexList mdl = m_themeModel->match(m_themeModel->index(0), Qt::DisplayRole, m_theme); |
864 if (mdl.size() > 0) |
864 if (mdl.size() > 0) |
865 updateTheme(mdl.at(0)); |
865 updateTheme(mdl.at(0)); |
866 else |
866 else |
867 setRandomTheme(); |
867 setRandomTheme(); |
868 } |
868 } |
869 |
869 |
870 // restore map selection |
870 // restore map selection |
871 if (!m_curMap.isEmpty()) |
871 if (!m_curMap.isNull() && !m_curMap.isEmpty()) |
872 intSetMap(m_curMap); |
872 intSetMap(m_curMap); |
873 else |
873 else |
874 updatePreview(); |
874 updatePreview(); |
875 } |
875 } |
876 |
876 |
1160 { |
1160 { |
1161 m_mapInfo = mapInfo; |
1161 m_mapInfo = mapInfo; |
1162 m_curMap = m_mapInfo.name; |
1162 m_curMap = m_mapInfo.name; |
1163 |
1163 |
1164 // the map has no pre-defined theme, so let's use the selected one |
1164 // the map has no pre-defined theme, so let's use the selected one |
1165 if (m_mapInfo.theme.isEmpty()) |
1165 if (m_mapInfo.theme.isNull() || m_mapInfo.theme.isEmpty()) |
1166 { |
1166 { |
1167 if (!selectedTheme.isEmpty()) |
1167 if (!selectedTheme.isNull() && !selectedTheme.isEmpty()) |
1168 { |
1168 { |
1169 setTheme(selectedTheme); |
1169 setTheme(selectedTheme); |
1170 emit themeChanged(selectedTheme); |
1170 emit themeChanged(selectedTheme); |
1171 } |
1171 } |
1172 } |
1172 } |
1259 } |
1259 } |
1260 } |
1260 } |
1261 |
1261 |
1262 void HWMapContainer::setMissingTheme(const QString & name) |
1262 void HWMapContainer::setMissingTheme(const QString & name) |
1263 { |
1263 { |
1264 if (name.isEmpty()) return; |
1264 if (name.isNull() || name.isEmpty()) return; |
1265 |
1265 |
1266 m_theme = name; |
1266 m_theme = name; |
1267 QPixmap pixMissing = QPixmap(":/res/missingTheme@2x.png"); |
1267 QPixmap pixMissing = QPixmap(":/res/missingTheme@2x.png"); |
1268 QIcon iconMissing = QIcon(); |
1268 QIcon iconMissing = QIcon(); |
1269 iconMissing.addPixmap(pixMissing, QIcon::Normal); |
1269 iconMissing.addPixmap(pixMissing, QIcon::Normal); |