CURA-5035 Improved details pages

This commit is contained in:
Ian Paschal 2018-04-18 16:35:55 +02:00
parent 7a0fe74989
commit f8672ecbc6
9 changed files with 61 additions and 37 deletions

View file

@ -14,7 +14,7 @@ import UM 1.1 as UM
Window Window
{ {
id: base id: base
title: catalog.i18nc("@title:tab", "Toolbox"); title: catalog.i18nc("@title:tab", "Toolbox")
modality: Qt.ApplicationModal modality: Qt.ApplicationModal
width: 720 * screenScaleFactor width: 720 * screenScaleFactor
height: 640 * screenScaleFactor height: 640 * screenScaleFactor
@ -73,10 +73,14 @@ Window
ToolboxFooter ToolboxFooter
{ {
id: footer id: footer
visible: toolbox.restartRequired
height: toolbox.restartRequired ? UM.Theme.getSize("base_unit").height * 5 : 0
} }
ToolboxShadow ToolboxShadow
{ {
anchors.top: footer.top visible: toolbox.restartRequired
anchors.bottom: footer.top
reversed: true
} }
UM.I18nCatalog { id: catalog; name: "cura" } UM.I18nCatalog { id: catalog; name: "cura" }

View file

@ -74,13 +74,7 @@ Item
width: childrenRect.width width: childrenRect.width
Label Label
{ {
text: "Version:" text: catalog.i18nc("@label", "Contact") + ":"
font: UM.Theme.getFont("very_small")
color: UM.Theme.getColor("text_medium")
}
Label
{
text: "Author:"
font: UM.Theme.getFont("very_small") font: UM.Theme.getFont("very_small")
color: UM.Theme.getColor("text_medium") color: UM.Theme.getColor("text_medium")
} }
@ -99,15 +93,21 @@ Item
width: UM.Theme.getSize("base_unit").width * 12 width: UM.Theme.getSize("base_unit").width * 12
Label Label
{ {
text: details.name text:
font: UM.Theme.getFont("very_small") {
color: UM.Theme.getColor("text") if (details.email)
} {
Label return "<a href=\"mailto:"+details.email+"\">"+details.name+"</a>"
{ }
text: details.name else
{
console.log("<a href=\""+details.website+"\">"+details.author_name+"</a>")
return "<a href=\""+details.website+"\">"+details.name+"</a>"
}
}
font: UM.Theme.getFont("very_small") font: UM.Theme.getFont("very_small")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
onLinkActivated: Qt.openUrlExternally(link)
} }
} }
Rectangle Rectangle

View file

@ -74,19 +74,19 @@ Item
width: childrenRect.width width: childrenRect.width
Label Label
{ {
text: "Version:" text: catalog.i18nc("@label", "Version") + ":"
font: UM.Theme.getFont("very_small") font: UM.Theme.getFont("very_small")
color: UM.Theme.getColor("text_medium") color: UM.Theme.getColor("text_medium")
} }
Label Label
{ {
text: "Last Update:" text: catalog.i18nc("@label", "Last updated") + ":"
font: UM.Theme.getFont("very_small") font: UM.Theme.getFont("very_small")
color: UM.Theme.getColor("text_medium") color: UM.Theme.getColor("text_medium")
} }
Label Label
{ {
text: "Author:" text: catalog.i18nc("@label", "Author") + ":"
font: UM.Theme.getFont("very_small") font: UM.Theme.getFont("very_small")
color: UM.Theme.getColor("text_medium") color: UM.Theme.getColor("text_medium")
} }
@ -117,9 +117,20 @@ Item
} }
Label Label
{ {
text: details.author_name text:
{
if (details.author_email)
{
return "<a href=\"mailto:"+details.author_email+"?Subject=Cura: "+details.name+"\">"+details.author_name+"</a>"
}
else
{
return "<a href=\""+details.website+"\">"+details.author_name+"</a>"
}
}
font: UM.Theme.getFont("very_small") font: UM.Theme.getFont("very_small")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
onLinkActivated: Qt.openUrlExternally(link)
} }
} }
Rectangle Rectangle

View file

@ -34,7 +34,21 @@ Rectangle
Label Label
{ {
width: parent.width width: parent.width
text: model.description text:
{
if (model.description.length > 235)
{
if (model.description.substring(234, 235) == " ")
{
return model.description.substring(0, 234) + "..."
}
else
{
return model.description.substring(0, 235) + "..."
}
}
return model.description
}
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")

View file

@ -58,7 +58,8 @@ Item
Label Label
{ {
id: info id: info
text: { text:
{
if (model.description.length > 50) if (model.description.length > 50)
{ {
return model.description.substring(0, 50) + "..." return model.description.substring(0, 50) + "..."

View file

@ -14,7 +14,6 @@ import UM 1.1 as UM
Item Item
{ {
width: parent.width width: parent.width
height: UM.Theme.getSize("base_unit").height * 4
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
Label Label
{ {

View file

@ -5,18 +5,19 @@ import QtQuick 2.2
Rectangle Rectangle
{ {
property bool reversed: false
width: parent.width width: parent.width
height: 8 height: 8
gradient: Gradient gradient: Gradient
{ {
GradientStop GradientStop
{ {
position: 0.0 position: reversed ? 1.0 : 0.0
color: Qt.rgba(0,0,0,0.2) color: reversed ? Qt.rgba(0,0,0,0.05) : Qt.rgba(0,0,0,0.2)
} }
GradientStop GradientStop
{ {
position: 1.0 position: reversed ? 0.0 : 1.0
color: Qt.rgba(0,0,0,0) color: Qt.rgba(0,0,0,0)
} }
} }

View file

@ -36,7 +36,7 @@ class AuthorsModel(ListModel):
items.append({ items.append({
"name": author["name"], "name": author["name"],
"email": author["email"] if "email" in author else None, "email": author["email"] if "email" in author else None,
"website": author["website"] if "website" in author else None, "website": author["website"],
"type": author["type"] if "type" in author else None, "type": author["type"] if "type" in author else None,
"icon_url": author["icon_url"] if "icon_url" in author else None, "icon_url": author["icon_url"] if "icon_url" in author else None,
"packages_count": author["packages_count"] if "packages_count" in author else 0 "packages_count": author["packages_count"] if "packages_count" in author else 0

View file

@ -129,7 +129,6 @@ class Toolbox(QObject, Extension):
self._active_package = None self._active_package = None
self._dialog = None self._dialog = None
self._restartDialog = None
self._restart_required = False self._restart_required = False
# variables for the license agreement dialog # variables for the license agreement dialog
@ -158,7 +157,6 @@ class Toolbox(QObject, Extension):
filterChanged = pyqtSignal() filterChanged = pyqtSignal()
metadataChanged = pyqtSignal() metadataChanged = pyqtSignal()
showLicenseDialog = pyqtSignal() showLicenseDialog = pyqtSignal()
showRestartDialog = pyqtSignal()
@pyqtSlot(result = str) @pyqtSlot(result = str)
def getLicenseDialogPluginName(self): def getLicenseDialogPluginName(self):
@ -172,20 +170,12 @@ class Toolbox(QObject, Extension):
def getLicenseDialogLicenseContent(self): def getLicenseDialogLicenseContent(self):
return self._license_dialog_license_content return self._license_dialog_license_content
@pyqtSlot(result = str)
def getRestartDialogMessage(self):
return self._restart_dialog_message
def openLicenseDialog(self, plugin_name, license_content, plugin_file_location): def openLicenseDialog(self, plugin_name, license_content, plugin_file_location):
self._license_dialog_plugin_name = plugin_name self._license_dialog_plugin_name = plugin_name
self._license_dialog_license_content = license_content self._license_dialog_license_content = license_content
self._license_dialog_plugin_file_location = plugin_file_location self._license_dialog_plugin_file_location = plugin_file_location
self.showLicenseDialog.emit() self.showLicenseDialog.emit()
def openRestartDialog(self, message):
self._restart_dialog_message = message
self.showRestartDialog.emit()
def _onAppInitialized(self): def _onAppInitialized(self):
self._package_manager = Application.getInstance().getCuraPackageManager() self._package_manager = Application.getInstance().getCuraPackageManager()
@ -250,12 +240,16 @@ class Toolbox(QObject, Extension):
self._plugin_registry.enablePlugin(plugin_id) self._plugin_registry.enablePlugin(plugin_id)
self.enabledChanged.emit() self.enabledChanged.emit()
Logger.log("i", "%s was set as 'active'.", plugin_id) Logger.log("i", "%s was set as 'active'.", plugin_id)
self._restart_required = True
self.restartRequiredChanged.emit()
@pyqtSlot(str) @pyqtSlot(str)
def disable(self, plugin_id): def disable(self, plugin_id):
self._plugin_registry.disablePlugin(plugin_id) self._plugin_registry.disablePlugin(plugin_id)
self.enabledChanged.emit() self.enabledChanged.emit()
Logger.log("i", "%s was set as 'deactive'.", plugin_id) Logger.log("i", "%s was set as 'deactive'.", plugin_id)
self._restart_required = True
self.restartRequiredChanged.emit()
@pyqtProperty(bool, notify = metadataChanged) @pyqtProperty(bool, notify = metadataChanged)
def dataReady(self): def dataReady(self):