mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Add login fequired link to packages that have the login-required tag
CURA-6006
This commit is contained in:
parent
62c5398933
commit
4e2ab163ed
2 changed files with 23 additions and 1 deletions
|
@ -5,11 +5,14 @@ import QtQuick 2.7
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import QtQuick.Controls.Styles 1.4
|
import QtQuick.Controls.Styles 1.4
|
||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
|
import Cura 1.1 as Cura
|
||||||
|
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
property bool installed: toolbox.isInstalled(model.id)
|
property bool installed: toolbox.isInstalled(model.id)
|
||||||
property bool canUpdate: toolbox.canUpdate(model.id)
|
property bool canUpdate: toolbox.canUpdate(model.id)
|
||||||
|
property bool loginRequired: model.login_required && !Cura.API.account.isLoggedIn
|
||||||
|
|
||||||
width: UM.Theme.getSize("toolbox_action_button").width
|
width: UM.Theme.getSize("toolbox_action_button").width
|
||||||
spacing: UM.Theme.getSize("narrow_margin").height
|
spacing: UM.Theme.getSize("narrow_margin").height
|
||||||
|
|
||||||
|
@ -28,11 +31,28 @@ Column
|
||||||
onCompleteAction: toolbox.viewCategory = "installed"
|
onCompleteAction: toolbox.viewCategory = "installed"
|
||||||
|
|
||||||
// Don't allow installing while another download is running
|
// Don't allow installing while another download is running
|
||||||
enabled: installed || !(toolbox.isDownloading && toolbox.activePackage != model)
|
enabled: installed || (!(toolbox.isDownloading && toolbox.activePackage != model) && !loginRequired)
|
||||||
opacity: enabled ? 1.0 : 0.5
|
opacity: enabled ? 1.0 : 0.5
|
||||||
visible: !updateButton.visible // Don't show when the update button is visible
|
visible: !updateButton.visible // Don't show when the update button is visible
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text:"<a href='%1'>Log in</a> is required to install"
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
linkColor: UM.Theme.getColor("text_link")
|
||||||
|
visible: loginRequired
|
||||||
|
width: installButton.width
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked:Cura.API.account.login()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ToolboxProgressButton
|
ToolboxProgressButton
|
||||||
{
|
{
|
||||||
id: updateButton
|
id: updateButton
|
||||||
|
|
|
@ -40,6 +40,7 @@ class PackagesModel(ListModel):
|
||||||
self.addRoleName(Qt.UserRole + 19, "tags")
|
self.addRoleName(Qt.UserRole + 19, "tags")
|
||||||
self.addRoleName(Qt.UserRole + 20, "links")
|
self.addRoleName(Qt.UserRole + 20, "links")
|
||||||
self.addRoleName(Qt.UserRole + 21, "website")
|
self.addRoleName(Qt.UserRole + 21, "website")
|
||||||
|
self.addRoleName(Qt.UserRole + 22, "login_required")
|
||||||
|
|
||||||
# List of filters for queries. The result is the union of the each list of results.
|
# List of filters for queries. The result is the union of the each list of results.
|
||||||
self._filter = {} # type: Dict[str, str]
|
self._filter = {} # type: Dict[str, str]
|
||||||
|
@ -100,6 +101,7 @@ class PackagesModel(ListModel):
|
||||||
"tags": package["tags"] if "tags" in package else [],
|
"tags": package["tags"] if "tags" in package else [],
|
||||||
"links": links_dict,
|
"links": links_dict,
|
||||||
"website": package["website"] if "website" in package else None,
|
"website": package["website"] if "website" in package else None,
|
||||||
|
"login_required": "login-required" in package.get("tags", [])
|
||||||
})
|
})
|
||||||
|
|
||||||
# Filter on all the key-word arguments.
|
# Filter on all the key-word arguments.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue