diff --git a/plugins/PluginBrowser/PluginBrowser.py b/plugins/PluginBrowser/PluginBrowser.py index 8912a7a202..68056786ab 100644 --- a/plugins/PluginBrowser/PluginBrowser.py +++ b/plugins/PluginBrowser/PluginBrowser.py @@ -44,6 +44,7 @@ class PluginBrowser(QObject, Extension): # Can be 'installed' or 'available' self._view = "available" + self._detail_view = None self._restart_required = False @@ -135,7 +136,7 @@ class PluginBrowser(QObject, Extension): def _createDialog(self, qml_name): Logger.log("d", "Creating dialog [%s]", qml_name) - path = os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), qml_name) + path = os.path.join(PluginRegistry.getInstance().getPluginPath(self.getPluginId()), "resources", "qml", qml_name) dialog = Application.getInstance().createQmlComponent(path, {"manager": self}) return dialog @@ -283,6 +284,13 @@ class PluginBrowser(QObject, Extension): self.viewChanged.emit() self.pluginsMetadataChanged.emit() + @pyqtSlot(str) + def setDetailView(self, item): + self._detail_view = item if item else None + print("Now looking at", self._detail_view) + self.viewChanged.emit() + self.pluginsMetadataChanged.emit() + @pyqtProperty(QObject, notify=pluginsMetadataChanged) def pluginsModel(self): self._plugins_model = PluginsModel(None, self._view) diff --git a/plugins/PluginBrowser/PluginBrowser.qml b/plugins/PluginBrowser/PluginBrowser.qml deleted file mode 100644 index ec4c2a9135..0000000000 --- a/plugins/PluginBrowser/PluginBrowser.qml +++ /dev/null @@ -1,368 +0,0 @@ -// Copyright (c) 2017 Ultimaker B.V. -// PluginBrowser is released under the terms of the LGPLv3 or higher. - -import QtQuick 2.2 -import QtQuick.Dialogs 1.1 -import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 - -// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles - -import UM 1.1 as UM - -Window { - id: base - - title: catalog.i18nc("@title:tab", "Plugins"); - width: 800 * screenScaleFactor - height: 640 * screenScaleFactor - minimumWidth: 350 * screenScaleFactor - minimumHeight: 350 * screenScaleFactor - color: UM.Theme.getColor("sidebar") - - Item { - id: view - anchors { - fill: parent - leftMargin: UM.Theme.getSize("default_margin").width - rightMargin: UM.Theme.getSize("default_margin").width - topMargin: UM.Theme.getSize("default_margin").height - bottomMargin: UM.Theme.getSize("default_margin").height - } - - Rectangle { - id: topBar - width: parent.width - color: "transparent" - height: childrenRect.height - - Row { - spacing: 12 - height: childrenRect.height - width: childrenRect.width - anchors.horizontalCenter: parent.horizontalCenter - - Button { - text: "Install" - style: ButtonStyle { - background: Rectangle { - color: "transparent" - implicitWidth: 96 - implicitHeight: 48 - Rectangle { - visible: manager.viewing == "available" ? true : false - color: UM.Theme.getColor("primary") - anchors.bottom: parent.bottom - width: parent.width - height: 3 - } - } - label: Text { - text: control.text - color: UM.Theme.getColor("text") - font { - pixelSize: 15 - } - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - } - onClicked: manager.setView("available") - } - - Button { - text: "Manage" - style: ButtonStyle { - background: Rectangle { - color: "transparent" - implicitWidth: 96 - implicitHeight: 48 - Rectangle { - visible: manager.viewing == "installed" ? true : false - color: UM.Theme.getColor("primary") - anchors.bottom: parent.bottom - width: parent.width - height: 3 - } - } - label: Text { - text: control.text - color: UM.Theme.getColor("text") - font { - pixelSize: 15 - } - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - } - onClicked: manager.setView("installed") - } - } - } - - // Scroll view breaks in QtQuick.Controls 2.x - ScrollView { - id: installedPluginList - width: parent.width - height: 400 - - anchors { - top: topBar.bottom - topMargin: UM.Theme.getSize("default_margin").height - bottom: bottomBar.top - bottomMargin: UM.Theme.getSize("default_margin").height - } - - frameVisible: true - - ListView { - id: pluginList - property var activePlugin - property var filter: "installed" - - anchors.fill: parent - - model: manager.pluginsModel - delegate: PluginEntry {} - } - } - - Rectangle { - id: bottomBar - width: parent.width - height: childrenRect.height - color: "transparent" - anchors.bottom: parent.bottom - - Label { - visible: manager.restartRequired - text: "You will need to restart Cura before changes in plugins have effect." - height: 30 - verticalAlignment: Text.AlignVCenter - } - Button { - id: restartChangedButton - text: "Quit Cura" - anchors.right: closeButton.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - visible: manager.restartRequired - iconName: "dialog-restart" - onClicked: manager.restart() - style: ButtonStyle { - background: Rectangle { - implicitWidth: 96 - implicitHeight: 30 - color: UM.Theme.getColor("primary") - } - label: Text { - verticalAlignment: Text.AlignVCenter - color: UM.Theme.getColor("button_text") - font { - pixelSize: 13 - bold: true - } - text: control.text - horizontalAlignment: Text.AlignHCenter - } - } - } - - Button { - id: closeButton - text: catalog.i18nc("@action:button", "Close") - iconName: "dialog-close" - onClicked: { - if ( manager.isDownloading ) { - manager.cancelDownload() - } - base.close(); - } - anchors.right: parent.right - style: ButtonStyle { - background: Rectangle { - color: "transparent" - implicitWidth: 96 - implicitHeight: 30 - border { - width: 1 - color: UM.Theme.getColor("lining") - } - } - label: Text { - verticalAlignment: Text.AlignVCenter - color: UM.Theme.getColor("text") - text: control.text - horizontalAlignment: Text.AlignHCenter - } - } - } - } - - UM.I18nCatalog { id: catalog; name: "cura" } - - Connections { - target: manager - onShowLicenseDialog: { - licenseDialog.pluginName = manager.getLicenseDialogPluginName(); - licenseDialog.licenseContent = manager.getLicenseDialogLicenseContent(); - licenseDialog.pluginFileLocation = manager.getLicenseDialogPluginFileLocation(); - licenseDialog.show(); - } - } - - UM.Dialog { - id: licenseDialog - title: catalog.i18nc("@title:window", "Plugin License Agreement") - - minimumWidth: UM.Theme.getSize("license_window_minimum").width - minimumHeight: UM.Theme.getSize("license_window_minimum").height - width: minimumWidth - height: minimumHeight - - property var pluginName; - property var licenseContent; - property var pluginFileLocation; - - Item - { - anchors.fill: parent - - Label - { - id: licenseTitle - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - text: licenseDialog.pluginName + catalog.i18nc("@label", "This plugin contains a license.\nYou need to accept this license to install this plugin.\nDo you agree with the terms below?") - wrapMode: Text.Wrap - } - - TextArea - { - id: licenseText - anchors.top: licenseTitle.bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.topMargin: UM.Theme.getSize("default_margin").height - readOnly: true - text: licenseDialog.licenseContent != null ? licenseDialog.licenseContent : "" - } - } - - rightButtons: [ - Button - { - id: acceptButton - anchors.margins: UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@action:button", "Accept") - onClicked: - { - licenseDialog.close(); - manager.installPlugin(licenseDialog.pluginFileLocation); - } - }, - Button - { - id: declineButton - anchors.margins: UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@action:button", "Decline") - onClicked: - { - licenseDialog.close(); - } - } - ] - } - - Connections { - target: manager - onShowRestartDialog: { - restartDialog.message = manager.getRestartDialogMessage(); - restartDialog.show(); - } - } - - Window { - id: restartDialog - // title: catalog.i18nc("@title:tab", "Plugins"); - width: 360 * screenScaleFactor - height: 120 * screenScaleFactor - minimumWidth: 360 * screenScaleFactor - minimumHeight: 120 * screenScaleFactor - color: UM.Theme.getColor("sidebar") - property var message; - - Text { - id: message - anchors { - left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width - top: parent.top - topMargin: UM.Theme.getSize("default_margin").height - } - text: restartDialog.message != null ? restartDialog.message : "" - } - Button { - id: laterButton - text: "Later" - onClicked: restartDialog.close(); - anchors { - left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width - bottom: parent.bottom - bottomMargin: UM.Theme.getSize("default_margin").height - } - style: ButtonStyle { - background: Rectangle { - color: "transparent" - implicitWidth: 96 - implicitHeight: 30 - border { - width: 1 - color: UM.Theme.getColor("lining") - } - } - label: Text { - verticalAlignment: Text.AlignVCenter - color: UM.Theme.getColor("text") - text: control.text - horizontalAlignment: Text.AlignHCenter - } - } - } - - - Button { - id: restartButton - text: "Quit Cura" - anchors { - right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width - bottom: parent.bottom - bottomMargin: UM.Theme.getSize("default_margin").height - } - onClicked: manager.restart() - style: ButtonStyle { - background: Rectangle { - implicitWidth: 96 - implicitHeight: 30 - color: UM.Theme.getColor("primary") - } - label: Text { - verticalAlignment: Text.AlignVCenter - color: UM.Theme.getColor("button_text") - font { - pixelSize: 13 - bold: true - } - text: control.text - horizontalAlignment: Text.AlignHCenter - } - } - } - } - - } -} diff --git a/plugins/PluginBrowser/resources/qml/PluginBrowser.qml b/plugins/PluginBrowser/resources/qml/PluginBrowser.qml new file mode 100644 index 0000000000..ee27a3cc31 --- /dev/null +++ b/plugins/PluginBrowser/resources/qml/PluginBrowser.qml @@ -0,0 +1,136 @@ +// Copyright (c) 2018 Ultimaker B.V. +// PluginBrowser is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles + +import UM 1.1 as UM + +Window + { + id: base + title: catalog.i18nc("@title:tab", "Plugins"); + width: 800 * screenScaleFactor + height: 640 * screenScaleFactor + minimumWidth: 800 * screenScaleFactor + maximumWidth: 800 * screenScaleFactor + minimumHeight: 350 * screenScaleFactor + color: UM.Theme.getColor("sidebar") + Item + { + id: view + anchors.fill: parent + ToolboxHeader + { + id: topBar + } + Rectangle + { + id: mainView + width: parent.width + anchors + { + top: topBar.bottom + bottom: bottomBar.top + } + ToolboxViewDownloads + { + id: viewDownloads + visible: manager.viewing == "available" ? true : false + } + ToolboxViewInstalled + { + id: installedPluginList + visible: manager.viewing == "installed" ? true : false + } + } + Rectangle + { + anchors + { + top: topBar.bottom + } + width: parent.width + height: 8 + gradient: Gradient + { + GradientStop + { + position: 0.0 + color: Qt.rgba(0,0,0,0.1) + } + GradientStop + { + position: 1.0 + color: Qt.rgba(0,0,0,0) + } + } + } + ToolboxFooter + { + id: bottomBar + } + Rectangle + { + anchors + { + top: bottomBar.top + } + width: parent.width + height: 8 + gradient: Gradient + { + GradientStop + { + position: 0.0 + color: Qt.rgba(0,0,0,0.1) + } + GradientStop + { + position: 1.0 + color: Qt.rgba(0,0,0,0) + } + } + } + + + + + UM.I18nCatalog { id: catalog; name: "cura" } + + Connections + { + target: manager + onShowLicenseDialog: + { + licenseDialog.pluginName = manager.getLicenseDialogPluginName(); + licenseDialog.licenseContent = manager.getLicenseDialogLicenseContent(); + licenseDialog.pluginFileLocation = manager.getLicenseDialogPluginFileLocation(); + licenseDialog.show(); + } + } + Connections + { + target: manager + onShowRestartDialog: + { + restartDialog.message = manager.getRestartDialogMessage(); + restartDialog.show(); + } + } + ToolboxLicenseDialog + { + id: licenseDialog + } + + ToolboxRestartDialog + { + id: restartDialog + } + } +} diff --git a/plugins/PluginBrowser/PluginEntry.qml b/plugins/PluginBrowser/resources/qml/PluginEntry.qml similarity index 99% rename from plugins/PluginBrowser/PluginEntry.qml rename to plugins/PluginBrowser/resources/qml/PluginEntry.qml index 9dbcb96e79..5ab4d1b2bf 100644 --- a/plugins/PluginBrowser/PluginEntry.qml +++ b/plugins/PluginBrowser/resources/qml/PluginEntry.qml @@ -19,12 +19,10 @@ Component { // Don't show required plugins as they can't be managed anyway: height: !model.required ? 84 : 0 visible: !model.required ? true : false - color: "transparent" + color: Qt.rgba(1.0, 0.0, 0.0, 0.1) anchors { left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width } diff --git a/plugins/PluginBrowser/resources/qml/ToolboxFooter.qml b/plugins/PluginBrowser/resources/qml/ToolboxFooter.qml new file mode 100644 index 0000000000..5ff336320f --- /dev/null +++ b/plugins/PluginBrowser/resources/qml/ToolboxFooter.qml @@ -0,0 +1,82 @@ +// Copyright (c) 2018 Ultimaker B.V. +// PluginBrowser is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles + +import UM 1.1 as UM + +Rectangle { + width: parent.width + height: UM.Theme.getSize("base_unit").height * 4 + color: "transparent" + anchors.bottom: parent.bottom + + Label { + visible: manager.restartRequired + text: "You will need to restart Cura before changes in plugins have effect." + height: 30 + verticalAlignment: Text.AlignVCenter + } + Button { + id: restartChangedButton + text: "Quit Cura" + anchors.right: closeButton.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width + visible: manager.restartRequired + iconName: "dialog-restart" + onClicked: manager.restart() + style: ButtonStyle { + background: Rectangle { + implicitWidth: 96 + implicitHeight: 30 + color: UM.Theme.getColor("primary") + } + label: Text { + verticalAlignment: Text.AlignVCenter + color: UM.Theme.getColor("button_text") + font { + pixelSize: 13 + bold: true + } + text: control.text + horizontalAlignment: Text.AlignHCenter + } + } + } + + Button { + id: closeButton + text: catalog.i18nc("@action:button", "Close") + iconName: "dialog-close" + onClicked: { + if ( manager.isDownloading ) { + manager.cancelDownload() + } + base.close(); + } + anchors.right: parent.right + style: ButtonStyle { + background: Rectangle { + color: "transparent" + implicitWidth: 96 + implicitHeight: 30 + border { + width: 1 + color: UM.Theme.getColor("lining") + } + } + label: Text { + verticalAlignment: Text.AlignVCenter + color: UM.Theme.getColor("text") + text: control.text + horizontalAlignment: Text.AlignHCenter + } + } + } +} diff --git a/plugins/PluginBrowser/resources/qml/ToolboxGridTile.qml b/plugins/PluginBrowser/resources/qml/ToolboxGridTile.qml new file mode 100644 index 0000000000..bf2d4827bc --- /dev/null +++ b/plugins/PluginBrowser/resources/qml/ToolboxGridTile.qml @@ -0,0 +1,61 @@ +// Copyright (c) 2018 Ultimaker B.V. +// PluginBrowser is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import UM 1.1 as UM + +Item +{ + id: base + width: parent.columnSize + height: childrenRect.height + Row + { + width: parent.width + height: childrenRect.height + spacing: Math.floor(UM.Theme.getSize("base_unit").width / 2) + Rectangle + { + id: thumbnail + width: UM.Theme.getSize("base_unit").width * 6 + height: UM.Theme.getSize("base_unit").height * 6 + color: "white" + border.width: 1 + } + Column + { + width: UM.Theme.getSize("base_unit").width * 12 + Label + { + id: name + text: "Auto Orientation" + width: parent.width + wrapMode: Text.WordWrap + height: UM.Theme.getSize("base_unit").height * 2 + verticalAlignment: Text.AlignVCenter + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("default_bold") + } + Label + { + id: info + text: "Automatically orientate your model." + width: parent.width + wrapMode: Text.WordWrap + color: UM.Theme.getColor("text_medium") + font: UM.Theme.getFont("very_small") + } + } + } + MouseArea + { + anchors.fill: parent + onClicked: { + manager.setDetailView("thingy") + } + } +} diff --git a/plugins/PluginBrowser/resources/qml/ToolboxHeader.qml b/plugins/PluginBrowser/resources/qml/ToolboxHeader.qml new file mode 100644 index 0000000000..cce078035d --- /dev/null +++ b/plugins/PluginBrowser/resources/qml/ToolboxHeader.qml @@ -0,0 +1,113 @@ +// Copyright (c) 2018 Ultimaker B.V. +// PluginBrowser is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles + +import UM 1.1 as UM + +Rectangle { + + width: parent.width + color: "transparent" + height: childrenRect.height + + Row { + spacing: 12 + height: childrenRect.height + width: childrenRect.width + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + + Button { + text: "Plugins" + style: ButtonStyle { + background: Rectangle { + color: "transparent" + implicitWidth: 96 + implicitHeight: 48 + Rectangle { + visible: manager.viewing == "available" ? true : false + color: UM.Theme.getColor("primary") + anchors.bottom: parent.bottom + width: parent.width + height: 3 + } + } + label: Text { + text: control.text + color: UM.Theme.getColor("text") + font { + pixelSize: 15 + } + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } + } + onClicked: manager.setView("available") + } + + Button { + text: "Materials" + style: ButtonStyle { + background: Rectangle { + color: "transparent" + implicitWidth: 96 + implicitHeight: 48 + Rectangle { + visible: manager.viewing == "available" ? true : false + color: UM.Theme.getColor("primary") + anchors.bottom: parent.bottom + width: parent.width + height: 3 + } + } + label: Text { + text: control.text + color: UM.Theme.getColor("text") + font { + pixelSize: 15 + } + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } + } + onClicked: manager.setView("available") + } + } + + Button { + text: "Installed" + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + style: ButtonStyle { + background: Rectangle { + color: "transparent" + implicitWidth: 96 + implicitHeight: 48 + Rectangle { + visible: manager.viewing == "installed" ? true : false + color: UM.Theme.getColor("primary") + anchors.bottom: parent.bottom + width: parent.width + height: 3 + } + } + label: Text { + text: control.text + color: UM.Theme.getColor("text") + font { + pixelSize: 15 + } + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } + } + onClicked: manager.setView("installed") + } +} diff --git a/plugins/PluginBrowser/resources/qml/ToolboxItemGrid.qml b/plugins/PluginBrowser/resources/qml/ToolboxItemGrid.qml new file mode 100644 index 0000000000..6d642dc165 --- /dev/null +++ b/plugins/PluginBrowser/resources/qml/ToolboxItemGrid.qml @@ -0,0 +1,50 @@ +// Copyright (c) 2018 Ultimaker B.V. +// PluginBrowser is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Layouts 1.3 +import UM 1.1 as UM + +// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles + +Rectangle +{ + id: base + width: parent.width + height: 1200 + color: "transparent" + Label + { + id: heading + text: "Community Plugins" + width: parent.width + height: UM.Theme.getSize("base_unit").width * 4 + verticalAlignment: Text.AlignVCenter + color: UM.Theme.getColor("text_medium") + font: UM.Theme.getFont("medium") + } + GridLayout + { + id: grid + width: base.width + anchors + { + top: heading.bottom + } + columns: 3 + columnSpacing: UM.Theme.getSize("base_unit").width + rowSpacing: UM.Theme.getSize("base_unit").height + ToolboxGridTile {} + ToolboxGridTile {} + ToolboxGridTile {} + ToolboxGridTile {} + ToolboxGridTile {} + ToolboxGridTile {} + ToolboxGridTile {} + ToolboxGridTile {} + } +} diff --git a/plugins/PluginBrowser/resources/qml/ToolboxLicenseDialog.qml b/plugins/PluginBrowser/resources/qml/ToolboxLicenseDialog.qml new file mode 100644 index 0000000000..eb9f7fb5e7 --- /dev/null +++ b/plugins/PluginBrowser/resources/qml/ToolboxLicenseDialog.qml @@ -0,0 +1,76 @@ +// Copyright (c) 2018 Ultimaker B.V. +// PluginBrowser is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles + +import UM 1.1 as UM + +UM.Dialog { + title: catalog.i18nc("@title:window", "Plugin License Agreement") + + minimumWidth: UM.Theme.getSize("license_window_minimum").width + minimumHeight: UM.Theme.getSize("license_window_minimum").height + width: minimumWidth + height: minimumHeight + + property var pluginName; + property var licenseContent; + property var pluginFileLocation; + + Item + { + anchors.fill: parent + + Label + { + id: licenseTitle + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + text: licenseDialog.pluginName + catalog.i18nc("@label", "This plugin contains a license.\nYou need to accept this license to install this plugin.\nDo you agree with the terms below?") + wrapMode: Text.Wrap + } + + TextArea + { + id: licenseText + anchors.top: licenseTitle.bottom + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.topMargin: UM.Theme.getSize("default_margin").height + readOnly: true + text: licenseDialog.licenseContent != null ? licenseDialog.licenseContent : "" + } + } + + rightButtons: [ + Button + { + id: acceptButton + anchors.margins: UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@action:button", "Accept") + onClicked: + { + licenseDialog.close(); + manager.installPlugin(licenseDialog.pluginFileLocation); + } + }, + Button + { + id: declineButton + anchors.margins: UM.Theme.getSize("default_margin").width + text: catalog.i18nc("@action:button", "Decline") + onClicked: + { + licenseDialog.close(); + } + } + ] +} diff --git a/plugins/PluginBrowser/resources/qml/ToolboxRestartDialog.qml b/plugins/PluginBrowser/resources/qml/ToolboxRestartDialog.qml new file mode 100644 index 0000000000..08c5e759b8 --- /dev/null +++ b/plugins/PluginBrowser/resources/qml/ToolboxRestartDialog.qml @@ -0,0 +1,91 @@ +// Copyright (c) 2018 Ultimaker B.V. +// PluginBrowser is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles + +import UM 1.1 as UM + +Window { + // title: catalog.i18nc("@title:tab", "Plugins"); + width: 360 * screenScaleFactor + height: 120 * screenScaleFactor + minimumWidth: 360 * screenScaleFactor + minimumHeight: 120 * screenScaleFactor + color: UM.Theme.getColor("sidebar") + property var message; + + Text { + id: message + anchors { + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + top: parent.top + topMargin: UM.Theme.getSize("default_margin").height + } + text: restartDialog.message != null ? restartDialog.message : "" + } + Button { + id: laterButton + text: "Later" + onClicked: restartDialog.close(); + anchors { + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + bottom: parent.bottom + bottomMargin: UM.Theme.getSize("default_margin").height + } + style: ButtonStyle { + background: Rectangle { + color: "transparent" + implicitWidth: 96 + implicitHeight: 30 + border { + width: 1 + color: UM.Theme.getColor("lining") + } + } + label: Text { + verticalAlignment: Text.AlignVCenter + color: UM.Theme.getColor("text") + text: control.text + horizontalAlignment: Text.AlignHCenter + } + } + } + + + Button { + id: restartButton + text: "Quit Cura" + anchors { + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + bottom: parent.bottom + bottomMargin: UM.Theme.getSize("default_margin").height + } + onClicked: manager.restart() + style: ButtonStyle { + background: Rectangle { + implicitWidth: 96 + implicitHeight: 30 + color: UM.Theme.getColor("primary") + } + label: Text { + verticalAlignment: Text.AlignVCenter + color: UM.Theme.getColor("button_text") + font { + pixelSize: 13 + bold: true + } + text: control.text + horizontalAlignment: Text.AlignHCenter + } + } + } +} diff --git a/plugins/PluginBrowser/resources/qml/ToolboxShowcase.qml b/plugins/PluginBrowser/resources/qml/ToolboxShowcase.qml new file mode 100644 index 0000000000..f5aec67e09 --- /dev/null +++ b/plugins/PluginBrowser/resources/qml/ToolboxShowcase.qml @@ -0,0 +1,54 @@ +// Copyright (c) 2018 Ultimaker B.V. +// PluginBrowser is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import UM 1.1 as UM + +// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles + +Rectangle +{ + id: base + width: parent.width + height: childrenRect.height + color: "transparent" + Label + { + id: heading + text: "Top Downloads" + width: parent.width + height: UM.Theme.getSize("base_unit").width * 4 + verticalAlignment: Text.AlignVCenter + color: UM.Theme.getColor("text_medium") + font: UM.Theme.getFont("medium") + } + Row + { + height: childrenRect.height + width: childrenRect.width + spacing: UM.Theme.getSize("base_unit").width * 2 + anchors + { + horizontalCenter: parent.horizontalCenter + top: heading.bottom + } + + ToolboxShowcaseTile {} + ToolboxShowcaseTile {} + ToolboxShowcaseTile {} + } + Rectangle + { + color: UM.Theme.getColor("text_medium") + width: parent.width + height: UM.Theme.getSize("base_unit").height / 6 + anchors + { + bottom: parent.bottom + } + } +} diff --git a/plugins/PluginBrowser/resources/qml/ToolboxShowcaseTile.qml b/plugins/PluginBrowser/resources/qml/ToolboxShowcaseTile.qml new file mode 100644 index 0000000000..dbcd4c4ade --- /dev/null +++ b/plugins/PluginBrowser/resources/qml/ToolboxShowcaseTile.qml @@ -0,0 +1,48 @@ +// Copyright (c) 2018 Ultimaker B.V. +// PluginBrowser is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import UM 1.1 as UM + +/* NOTE: This file uses the UM.Theme's "base_unit" size. It's commonly agreed +that good design is consistent design, and since the UM.Theme's JSON file does +not provide a method for interiting base units across the interface, adding more +properties for severy single UI element is undesirable for both developers and +theme makers/modfiers. Thus, "base_unit" is used wherever it can be. */ + +Item +{ + width: UM.Theme.getSize("base_unit").width * 12 + height: UM.Theme.getSize("base_unit").width * 12 + Rectangle + { + color: "white" + width: UM.Theme.getSize("base_unit").width * 8 + height: UM.Theme.getSize("base_unit").width * 8 + border.width: 1 + anchors + { + top: parent.top + horizontalCenter: parent.horizontalCenter + } + } + Label + { + text: "Solidworks Integration" + anchors + { + bottom: parent.bottom + horizontalCenter: parent.horizontalCenter + } + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + height: UM.Theme.getSize("base_unit").width * 4 + width: parent.width + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("medium_bold") + } +} diff --git a/plugins/PluginBrowser/resources/qml/ToolboxViewDownloads.qml b/plugins/PluginBrowser/resources/qml/ToolboxViewDownloads.qml new file mode 100644 index 0000000000..a2349d5c8c --- /dev/null +++ b/plugins/PluginBrowser/resources/qml/ToolboxViewDownloads.qml @@ -0,0 +1,40 @@ +// Copyright (c) 2018 Ultimaker B.V. +// PluginBrowser is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import UM 1.1 as UM + +// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles + +ScrollView +{ + id: base + frameVisible: false + anchors.fill: parent + style: UM.Theme.styles.scrollview + Column + { + width: base.width + spacing: UM.Theme.getSize("base_unit").height + height: childrenRect.height + anchors + { + fill: parent + topMargin: UM.Theme.getSize("base_unit").height + bottomMargin: UM.Theme.getSize("base_unit").height + leftMargin: UM.Theme.getSize("base_unit").width * 2 + rightMargin: UM.Theme.getSize("base_unit").width * 2 + } + ToolboxShowcase + { + id: showcase + } + ToolboxItemGrid + { + id: allPlugins + } + } +} diff --git a/plugins/PluginBrowser/resources/qml/ToolboxViewInstalled.qml b/plugins/PluginBrowser/resources/qml/ToolboxViewInstalled.qml new file mode 100644 index 0000000000..7db50f6a24 --- /dev/null +++ b/plugins/PluginBrowser/resources/qml/ToolboxViewInstalled.qml @@ -0,0 +1,33 @@ +// Copyright (c) 2018 Ultimaker B.V. +// PluginBrowser is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Dialogs 1.1 +import QtQuick.Window 2.2 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles + +import UM 1.1 as UM + +ScrollView +{ + anchors.fill: parent + ListView + { + id: pluginList + property var activePlugin + property var filter: "installed" + anchors + { + fill: parent + topMargin: UM.Theme.getSize("default_margin").height + bottomMargin: UM.Theme.getSize("default_margin").height + leftMargin: UM.Theme.getSize("default_margin").width + rightMargin: UM.Theme.getSize("default_margin").width + } + model: manager.pluginsModel + delegate: PluginEntry {} + } +} diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 0fde7f3bc9..0c3980f0ea 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -68,6 +68,9 @@ }, "colors": { + + + "sidebar": [255, 255, 255, 255], "lining": [192, 193, 194, 255], "viewport_overlay": [0, 0, 0, 192], @@ -92,6 +95,7 @@ "text_hover": [70, 84, 113, 255], "text_pressed": [12, 169, 227, 255], "text_subtext": [0, 0, 0, 255], + "text_medium": [128, 128, 128, 255], "text_emphasis": [255, 255, 255, 255], "text_scene": [31, 36, 39, 255], "text_scene_hover": [70, 84, 113, 255], @@ -317,6 +321,7 @@ }, "sizes": { + "base_unit": [1.0, 1.0], "window_minimum_size": [70, 50], "window_margin": [1.0, 1.0], "default_margin": [1.0, 1.0],