Просмотр исходного кода

CURA-5035 Improved details pages

Ian Paschal 7 лет назад
Родитель
Сommit
f8672ecbc6

+ 6 - 2
plugins/Toolbox/resources/qml/Toolbox.qml

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

+ 14 - 14
plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml

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

+ 15 - 4
plugins/Toolbox/resources/qml/ToolboxDetailPage.qml

@@ -74,19 +74,19 @@ Item
             width: childrenRect.width
             Label
             {
-                text: "Version:"
+                text: catalog.i18nc("@label", "Version") + ":"
                 font: UM.Theme.getFont("very_small")
                 color: UM.Theme.getColor("text_medium")
             }
             Label
             {
-                text: "Last Update:"
+                text: catalog.i18nc("@label", "Last updated") + ":"
                 font: UM.Theme.getFont("very_small")
                 color: UM.Theme.getColor("text_medium")
             }
             Label
             {
-                text: "Author:"
+                text: catalog.i18nc("@label", "Author") + ":"
                 font: UM.Theme.getFont("very_small")
                 color: UM.Theme.getColor("text_medium")
             }
@@ -117,9 +117,20 @@ Item
             }
             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")
                 color: UM.Theme.getColor("text")
+                onLinkActivated: Qt.openUrlExternally(link)
             }
         }
         Rectangle

+ 15 - 1
plugins/Toolbox/resources/qml/ToolboxDetailTile.qml

@@ -34,7 +34,21 @@ Rectangle
         Label
         {
             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
             color: UM.Theme.getColor("text")
             font: UM.Theme.getFont("default")

+ 2 - 1
plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml

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

+ 0 - 1
plugins/Toolbox/resources/qml/ToolboxFooter.qml

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

+ 4 - 3
plugins/Toolbox/resources/qml/ToolboxShadow.qml

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

+ 1 - 1
plugins/Toolbox/src/AuthorsModel.py

@@ -36,7 +36,7 @@ class AuthorsModel(ListModel):
             items.append({
                 "name": author["name"],
                 "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,
                 "icon_url": author["icon_url"] if "icon_url" in author else None,
                 "packages_count": author["packages_count"] if "packages_count" in author else 0

+ 4 - 10
plugins/Toolbox/src/Toolbox.py

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