on xenial help sign in
Addressed more MP-comments... wider use of chached map... tightend up qmltest for launcher's progress-changes.
commitfc36f663bda48e0da6f1ea69ee78bb2c4d91c457 authorMirco Müller <mirco.mueller@canonical.com> dateMon 6 Jul 2015, 17:15 (11 years ago) parent9c86a51
3 files changed+9−9
plugins/Greeter/Unity/Launcher/launchermodelas.cpp+7−6 qml/Launcher/LauncherDelegate.qml−1 tests/qmltests/Launcher/tst_Launcher.qml+2−2
plugins/Greeter/Unity/Launcher/launchermodelas.cpp+7−6
@@ -249,15 +249,16 @@ void LauncherModel::refresh()
249249 }
250250
251251 if (itemIndex == -1) {
252+ QMap<QString, QVariant> chachedMap = entry.toMap();
252253 // 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− entry.toMap().value("name").toString(),
255− entry.toMap().value("icon").toString(),
254+ LauncherItem *item = new LauncherItem(chachedMap.value("id").toString(),
255+ chachedMap.value("name").toString(),
256+ chachedMap.value("icon").toString(),
256257 this);
257258 item->setPinned(true);
258− item->setCount(entry.toMap().value("count").toInt());
259− item->setCountVisible(entry.toMap().value("countVisible").toBool());
260− item->setProgress(entry.toMap().value("progress").toInt());
259+ item->setCount(chachedMap.value("count").toInt());
260+ item->setCountVisible(chachedMap.value("countVisible").toBool());
261+ item->setProgress(chachedMap.value("progress").toInt());
261262 beginInsertRows(QModelIndex(), newPosition, newPosition);
262263 m_list.insert(newPosition, item);
263264 endInsertRows();
qml/Launcher/LauncherDelegate.qml−1
@@ -30,7 +30,6 @@ Item {
3030
3131 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
3232 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
33− readonly property bool progressVisible: progressOverlay.visible
3433
3534 property int itemWidth
3635 property int itemHeight
tests/qmltests/Launcher/tst_Launcher.qml+2−2
@@ -668,9 +668,9 @@ Item {
668668 var item = findChild(launcher, "launcherDelegate0")
669669 verify(item != undefined)
670670 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)
672672 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)
674674 LauncherModel.setProgress(LauncherModel.get(0).appId, 0)
675675 }
676676 }