on xenial help sign in
Addressed more MP-comments... wider use of chached map... tightend up qmltest for launcher's progress-changes.
fc36f66Mirco Müller
plugins/Greeter/Unity/Launcher/launchermodelas.cpp+7−6
@@ -249,15 +249,16 @@ void LauncherModel::refresh()
249 }
249 }
250
250
251 if (itemIndex == -1) {
251 if (itemIndex == -1) {
252+ QMap<QString, QVariant> chachedMap = entry.toMap();
252 // Need to add it. Just add it into the addedIndex to keep same ordering as the list in AS.
253 // Need to add it. Just add it into the addedIndex to keep same ordering as the list in AS.
253− LauncherItem *item = new LauncherItem(entry.toMap().value("id").toString(),
254+ LauncherItem *item = new LauncherItem(chachedMap.value("id").toString(),
254− entry.toMap().value("name").toString(),
255+ chachedMap.value("name").toString(),
255− entry.toMap().value("icon").toString(),
256+ chachedMap.value("icon").toString(),
256 this);
257 this);
257 item->setPinned(true);
258 item->setPinned(true);
258− item->setCount(entry.toMap().value("count").toInt());
259+ item->setCount(chachedMap.value("count").toInt());
259− item->setCountVisible(entry.toMap().value("countVisible").toBool());
260+ item->setCountVisible(chachedMap.value("countVisible").toBool());
260− item->setProgress(entry.toMap().value("progress").toInt());
261+ item->setProgress(chachedMap.value("progress").toInt());
261 beginInsertRows(QModelIndex(), newPosition, newPosition);
262 beginInsertRows(QModelIndex(), newPosition, newPosition);
262 m_list.insert(newPosition, item);
263 m_list.insert(newPosition, item);
263 endInsertRows();
264 endInsertRows();
qml/Launcher/LauncherDelegate.qml−1
@@ -30,7 +30,6 @@ Item {
30
30
31 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
31 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
32 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
32 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
33− readonly property bool progressVisible: progressOverlay.visible
34
33
35 property int itemWidth
34 property int itemWidth
36 property int itemHeight
35 property int itemHeight
tests/qmltests/Launcher/tst_Launcher.qml+2−2
@@ -668,9 +668,9 @@ Item {
668 var item = findChild(launcher, "launcherDelegate0")
668 var item = findChild(launcher, "launcherDelegate0")
669 verify(item != undefined)
669 verify(item != undefined)
670 LauncherModel.setProgress(LauncherModel.get(0).appId, -1)
670 LauncherModel.setProgress(LauncherModel.get(0).appId, -1)
671− tryCompare(item, "progressVisible", false, 1000, "progress-overlay of item #1 should not be visible")
671+ compare(findChild(item, "progressOverlay").visible, false)
672 LauncherModel.setProgress(LauncherModel.get(0).appId, 20)
672 LauncherModel.setProgress(LauncherModel.get(0).appId, 20)
673− tryCompare(item, "progressVisible", true, 1000, "progress-overlay of item #1 should not be invisible")
673+ compare(findChild(item, "progressOverlay").visible, true)
674 LauncherModel.setProgress(LauncherModel.get(0).appId, 0)
674 LauncherModel.setProgress(LauncherModel.get(0).appId, 0)
675 }
675 }
676 }
676 }