mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Remove rating packages/materials.
Online teams decided not to support ratings anymore, making this a rather useless feature in the upcoming release. CURA-7606
This commit is contained in:
parent
302e0c6277
commit
51a13675a5
6 changed files with 2 additions and 226 deletions
|
@ -1,106 +0,0 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.1
|
||||
import UM 1.0 as UM
|
||||
import Cura 1.1 as Cura
|
||||
Item
|
||||
{
|
||||
id: ratingWidget
|
||||
|
||||
property real rating: 0
|
||||
property int indexHovered: -1
|
||||
property string packageId: ""
|
||||
|
||||
property int userRating: 0
|
||||
property bool canRate: false
|
||||
|
||||
signal rated(int rating)
|
||||
|
||||
width: contentRow.width
|
||||
height: contentRow.height
|
||||
MouseArea
|
||||
{
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: ratingWidget.canRate
|
||||
acceptedButtons: Qt.NoButton
|
||||
onExited:
|
||||
{
|
||||
if(ratingWidget.canRate)
|
||||
{
|
||||
ratingWidget.indexHovered = -1
|
||||
}
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
id: contentRow
|
||||
height: childrenRect.height
|
||||
Repeater
|
||||
{
|
||||
model: 5 // We need to get 5 stars
|
||||
Button
|
||||
{
|
||||
id: control
|
||||
hoverEnabled: true
|
||||
onHoveredChanged:
|
||||
{
|
||||
if(hovered && ratingWidget.canRate)
|
||||
{
|
||||
indexHovered = index
|
||||
}
|
||||
}
|
||||
|
||||
ToolTip.visible: control.hovered && !ratingWidget.canRate
|
||||
ToolTip.text: !Cura.API.account.isLoggedIn ? catalog.i18nc("@label", "You need to login first before you can rate"): catalog.i18nc("@label", "You need to install the package before you can rate")
|
||||
|
||||
property bool isStarFilled:
|
||||
{
|
||||
// If the entire widget is hovered, override the actual rating.
|
||||
if(ratingWidget.indexHovered >= 0)
|
||||
{
|
||||
return indexHovered >= index
|
||||
}
|
||||
|
||||
if(ratingWidget.userRating > 0)
|
||||
{
|
||||
return userRating >= index +1
|
||||
}
|
||||
|
||||
return rating >= index + 1
|
||||
}
|
||||
|
||||
contentItem: Item {}
|
||||
height: UM.Theme.getSize("rating_star").height
|
||||
width: UM.Theme.getSize("rating_star").width
|
||||
background: UM.RecolorImage
|
||||
{
|
||||
source: UM.Theme.getIcon(control.isStarFilled ? "star_filled" : "star_empty")
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
|
||||
// Unfilled stars should always have the default color. Only filled stars should change on hover
|
||||
color:
|
||||
{
|
||||
if(!ratingWidget.canRate)
|
||||
{
|
||||
return UM.Theme.getColor("rating_star")
|
||||
}
|
||||
if((ratingWidget.indexHovered >= 0 || ratingWidget.userRating > 0) && isStarFilled)
|
||||
{
|
||||
return UM.Theme.getColor("primary")
|
||||
}
|
||||
return UM.Theme.getColor("rating_star")
|
||||
}
|
||||
}
|
||||
onClicked:
|
||||
{
|
||||
if(ratingWidget.canRate)
|
||||
{
|
||||
rated(index + 1) // Notify anyone who cares about this.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
import QtQuick 2.3
|
||||
import QtQuick.Controls 1.4
|
||||
import UM 1.1 as UM
|
||||
import Cura 1.1 as Cura
|
||||
|
||||
Row
|
||||
{
|
||||
id: rating
|
||||
height: UM.Theme.getSize("rating_star").height
|
||||
visible: model.average_rating > 0 //Has a rating at all.
|
||||
spacing: UM.Theme.getSize("thick_lining").width
|
||||
width: starIcon.width + spacing + numRatingsLabel.width
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: starIcon
|
||||
source: UM.Theme.getIcon("star_filled")
|
||||
color: model.user_rating == 0 ? UM.Theme.getColor("rating_star") : UM.Theme.getColor("primary")
|
||||
height: UM.Theme.getSize("rating_star").height
|
||||
width: UM.Theme.getSize("rating_star").width
|
||||
sourceSize.height: height
|
||||
sourceSize.width: width
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: numRatingsLabel
|
||||
text: model.average_rating != undefined ? model.average_rating.toFixed(1) + " (" + model.num_ratings + " " + catalog.i18nc("@label", "ratings") + ")": ""
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
height: starIcon.height
|
||||
width: contentWidth
|
||||
anchors.verticalCenter: starIcon.verticalCenter
|
||||
color: starIcon.color
|
||||
font: UM.Theme.getFont("default")
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
}
|
|
@ -117,19 +117,9 @@ Item
|
|||
color: UM.Theme.getColor("text")
|
||||
font: UM.Theme.getFont("default")
|
||||
anchors.top: name.bottom
|
||||
anchors.bottom: rating.top
|
||||
anchors.bottom: parent.bottom
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
maximumLineCount: 2
|
||||
}
|
||||
SmallRatingWidget
|
||||
{
|
||||
id: rating
|
||||
anchors
|
||||
{
|
||||
bottom: parent.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ Rectangle
|
|||
property int installedPackages: toolbox.viewCategory == "material" ? toolbox.getNumberOfInstalledPackagesByAuthor(model.id) : (toolbox.isInstalled(model.id) ? 1 : 0)
|
||||
id: tileBase
|
||||
width: UM.Theme.getSize("toolbox_thumbnail_large").width + (2 * UM.Theme.getSize("default_lining").width)
|
||||
height: thumbnail.height + packageName.height + rating.height + UM.Theme.getSize("default_margin").width
|
||||
height: thumbnail.height + packageName.height + UM.Theme.getSize("default_margin").width
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: UM.Theme.getColor("lining")
|
||||
color: UM.Theme.getColor("main_background")
|
||||
|
@ -67,13 +67,6 @@ Rectangle
|
|||
source: "../../images/installed_check.svg"
|
||||
}
|
||||
|
||||
SmallRatingWidget
|
||||
{
|
||||
id: rating
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: UM.Theme.getSize("narrow_margin").height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
Rectangle
|
||||
{
|
||||
id: bottomBorder
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue