Code review comment for lp:~macslow/unity/phablet-notification-renderer

Revision history for this message
MichaƂ Sawicz (saviq) wrote :

* please order the properties on the component in a more structured way (at least public properties first, and secondaryIcon source just after iconSource)
* components should not have their dimensions predefined, unless they depend (as in this case the height) on their child objects
    width: parent.width
    height: childrenRect.height + units.gu (1)
* don't expose private properties on root objects of components - in this case I don't see the need for that separate property, you can simply use the condition itself
    property bool snapDecision: type == "Notifications.Type.SnapDecision"
* components should not define their overall animations - and you're not changing the opacity of it anyway - you're going to that in the transitions
    Behavior on opacity {NumberAnimation{}}
* I would prefer using a Row for the icons and summary+body, all the margin: units.gu(1) make it hard to read, and it would handle the invisible secondaryIcon automatically
* explicitly check for source !== undefined && source != "", you could also check for status == Image.Ready [1], but that might result in some movement while the image is being loaded
    visible: source
* set sourceSize [2] on Images that come from outside to reduce memory
* this is not correct, use bodyLabel.y + bodyLabel.height - height of items does not include anchor margins - and if you use a Row above, you will just anchor to the row's bottom anyway
  top: (icon.height >= summaryLabel.height + bodyLabel.height) ? icon.bottom : bodyLabel.bottom
* why this??
    parent: notification
* set visibility instead
    topMargin: snapDecision ? units.gu (1) : 0
* there's a binding loop - should go away when you move to using a Row, too
    Notifications.qml:48:19: QML Notification: Binding loop detected for property "height"
* don't use space between function name and parenthesis [units.gu(1), not units.gu (1)]
* use camelCase instead of underscores (action_label)
* no need to prefix action's values with action_
* Notifications should not have its own queue or the displayNotification method, it should be a ListView{}, not a Showable{ListView{}}
* Notifications - see above about predefined dimensions
    anchors.fill: parent
* don't add Notifications to Shell, yet, since there's no model to supply to it
* the tests are not really tests - there's no way they would fail, is there?

[1] http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-image.html#status-prop
[2] http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-image.html#sourceSize-prop

review: Needs Fixing

« Back to merge proposal