Added CuraDirve plugin to Cura build

CURA-6005
This commit is contained in:
Aleksei S 2018-12-10 14:18:10 +01:00
parent 3db3203e0d
commit c62cb84c75
43 changed files with 1287 additions and 1 deletions

View file

@ -0,0 +1,67 @@
// Copyright (c) 2018 Ultimaker B.V.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import UM 1.1 as UM
Button
{
id: button
property alias cursorShape: mouseArea.cursorShape
property var iconSource: ""
property var busy: false
property var color: UM.Theme.getColor("primary")
property var hoverColor: UM.Theme.getColor("primary_hover")
property var disabledColor: color
property var textColor: UM.Theme.getColor("button_text")
property var textHoverColor: UM.Theme.getColor("button_text_hover")
property var textDisabledColor: textColor
property var textFont: UM.Theme.getFont("action_button")
contentItem: RowLayout
{
Icon
{
id: buttonIcon
iconSource: button.iconSource
width: 16 * screenScaleFactor
color: button.hovered ? button.textHoverColor : button.textColor
visible: button.iconSource != "" && !loader.visible
}
Icon
{
id: loader
iconSource: "../images/loading.gif"
width: 16 * screenScaleFactor
color: button.hovered ? button.textHoverColor : button.textColor
visible: button.busy
animated: true
}
Label
{
id: buttonText
text: button.text
color: button.enabled ? (button.hovered ? button.textHoverColor : button.textColor): button.textDisabledColor
font: button.textFont
visible: button.text != ""
renderType: Text.NativeRendering
}
}
background: Rectangle
{
color: button.enabled ? (button.hovered ? button.hoverColor : button.color) : button.disabledColor
}
MouseArea
{
id: mouseArea
anchors.fill: parent
onPressed: mouse.accepted = false
hoverEnabled: true
cursorShape: button.enabled ? (hovered ? Qt.PointingHandCursor : Qt.ArrowCursor) : Qt.ForbiddenCursor
}
}

View file

@ -0,0 +1,49 @@
// Copyright (c) 2018 Ultimaker B.V.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import UM 1.3 as UM
CheckBox
{
id: checkbox
hoverEnabled: true
property var label: ""
indicator: Rectangle {
implicitWidth: 30 * screenScaleFactor
implicitHeight: 30 * screenScaleFactor
x: 0
y: Math.round(parent.height / 2 - height / 2)
color: UM.Theme.getColor("sidebar")
border.color: UM.Theme.getColor("text")
Rectangle {
width: 14 * screenScaleFactor
height: 14 * screenScaleFactor
x: 8 * screenScaleFactor
y: 8 * screenScaleFactor
color: UM.Theme.getColor("primary")
visible: checkbox.checked
}
}
contentItem: Label {
anchors
{
left: checkbox.indicator.right
leftMargin: 5 * screenScaleFactor
}
text: catalog.i18nc("@checkbox:description", "Auto Backup")
color: UM.Theme.getColor("text")
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
}
ActionToolTip
{
text: checkbox.label
}
}

View file

@ -0,0 +1,29 @@
// Copyright (c) 2018 Ultimaker B.V.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import UM 1.1 as UM
ToolTip
{
id: tooltip
visible: parent.hovered
opacity: 0.9
delay: 500
background: Rectangle
{
color: UM.Theme.getColor("sidebar")
border.color: UM.Theme.getColor("primary")
border.width: 1 * screenScaleFactor
}
contentItem: Label
{
text: tooltip.text
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("very_small")
renderType: Text.NativeRendering
}
}

View file

@ -0,0 +1,31 @@
// Copyright (c) 2018 Ultimaker B.V.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import UM 1.1 as UM
ListView
{
id: backupList
width: parent.width
clip: true
delegate: Item
{
width: parent.width
height: childrenRect.height
BackupListItem
{
id: backupListItem
width: parent.width
}
Divider
{
width: parent.width
anchors.top: backupListItem.bottom
}
}
ScrollBar.vertical: RightSideScrollBar {}
}

View file

@ -0,0 +1,42 @@
// Copyright (c) 2018 Ultimaker B.V.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import UM 1.3 as UM
import "../components"
RowLayout
{
id: backupListFooter
width: parent.width
property bool showInfoButton: false
ActionButton
{
id: infoButton
text: catalog.i18nc("@button", "Want more?")
iconSource: "../images/info.svg"
onClicked: Qt.openUrlExternally("https://goo.gl/forms/QACEP8pP3RV60QYG2")
visible: backupListFooter.showInfoButton
}
ActionButton
{
id: createBackupButton
text: catalog.i18nc("@button", "Backup Now")
iconSource: "../images/backup.svg"
enabled: !CuraDrive.isCreatingBackup && !CuraDrive.isRestoringBackup
onClicked: CuraDrive.createBackup()
busy: CuraDrive.isCreatingBackup
}
ActionCheckBox
{
id: autoBackupEnabled
checked: CuraDrive.autoBackupEnabled
onClicked: CuraDrive.toggleAutoBackup(autoBackupEnabled.checked)
label: catalog.i18nc("@checkbox:description", "Automatically create a backup each day that Cura is started.")
}
}

View file

@ -0,0 +1,112 @@
// Copyright (c) 2018 Ultimaker B.V.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.1
import UM 1.1 as UM
Item
{
id: backupListItem
width: parent.width
height: showDetails ? dataRow.height + backupDetails.height : dataRow.height
property bool showDetails: false
// Backup details toggle animation.
Behavior on height
{
PropertyAnimation
{
duration: 70
}
}
RowLayout
{
id: dataRow
spacing: UM.Theme.getSize("default_margin").width * 2
width: parent.width
height: 50 * screenScaleFactor
ActionButton
{
color: "transparent"
hoverColor: "transparent"
textColor: UM.Theme.getColor("text")
textHoverColor: UM.Theme.getColor("primary")
iconSource: "../images/info.svg"
onClicked: backupListItem.showDetails = !backupListItem.showDetails
}
Label
{
text: new Date(model["generated_time"]).toLocaleString(UM.Preferences.getValue("general/language"))
color: UM.Theme.getColor("text")
elide: Text.ElideRight
Layout.minimumWidth: 100 * screenScaleFactor
Layout.maximumWidth: 500 * screenScaleFactor
Layout.fillWidth: true
renderType: Text.NativeRendering
}
Label
{
text: model["data"]["description"]
color: UM.Theme.getColor("text")
elide: Text.ElideRight
Layout.minimumWidth: 100 * screenScaleFactor
Layout.maximumWidth: 500 * screenScaleFactor
Layout.fillWidth: true
renderType: Text.NativeRendering
}
ActionButton
{
text: catalog.i18nc("@button", "Restore")
color: "transparent"
hoverColor: "transparent"
textColor: UM.Theme.getColor("text")
textHoverColor: UM.Theme.getColor("text_link")
enabled: !CuraDrive.isCreatingBackup && !CuraDrive.isRestoringBackup
onClicked: confirmRestoreDialog.visible = true
}
ActionButton
{
color: "transparent"
hoverColor: "transparent"
textColor: UM.Theme.getColor("setting_validation_error")
textHoverColor: UM.Theme.getColor("setting_validation_error")
iconSource: "../images/delete.svg"
onClicked: confirmDeleteDialog.visible = true
}
}
BackupListItemDetails
{
id: backupDetails
backupDetailsData: model
width: parent.width
visible: parent.showDetails
anchors.top: dataRow.bottom
}
MessageDialog
{
id: confirmDeleteDialog
title: catalog.i18nc("@dialog:title", "Delete Backup")
text: catalog.i18nc("@dialog:info", "Are you sure you want to delete this backup? This cannot be undone.")
standardButtons: StandardButton.Yes | StandardButton.No
onYes: CuraDrive.deleteBackup(model["backup_id"])
}
MessageDialog
{
id: confirmRestoreDialog
title: catalog.i18nc("@dialog:title", "Restore Backup")
text: catalog.i18nc("@dialog:info", "You will need to restart Cura before your backup is restored. Do you want to close Cura now?")
standardButtons: StandardButton.Yes | StandardButton.No
onYes: CuraDrive.restoreBackup(model["backup_id"])
}
}

View file

@ -0,0 +1,61 @@
// Copyright (c) 2018 Ultimaker B.V.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import UM 1.1 as UM
ColumnLayout
{
id: backupDetails
width: parent.width
spacing: 10 * screenScaleFactor
property var backupDetailsData
// Cura version
BackupListItemDetailsRow
{
iconSource: "../images/cura.svg"
label: catalog.i18nc("@backuplist:label", "Cura Version")
value: backupDetailsData["data"]["cura_release"]
}
// Machine count.
BackupListItemDetailsRow
{
iconSource: "../images/printer.svg"
label: catalog.i18nc("@backuplist:label", "Machines")
value: backupDetailsData["data"]["machine_count"]
}
// Meterial count.
BackupListItemDetailsRow
{
iconSource: "../images/material.svg"
label: catalog.i18nc("@backuplist:label", "Materials")
value: backupDetailsData["data"]["material_count"]
}
// Meterial count.
BackupListItemDetailsRow
{
iconSource: "../images/profile.svg"
label: catalog.i18nc("@backuplist:label", "Profiles")
value: backupDetailsData["data"]["profile_count"]
}
// Meterial count.
BackupListItemDetailsRow
{
iconSource: "../images/plugin.svg"
label: catalog.i18nc("@backuplist:label", "Plugins")
value: backupDetailsData["data"]["plugin_count"]
}
// Spacer.
Item
{
width: parent.width
height: 10 * screenScaleFactor
}
}

View file

@ -0,0 +1,52 @@
// Copyright (c) 2018 Ultimaker B.V.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import UM 1.3 as UM
RowLayout
{
id: detailsRow
width: parent.width
height: 40 * screenScaleFactor
property var iconSource
property var label
property var value
// Spacing.
Item
{
width: 40 * screenScaleFactor
}
Icon
{
width: 18 * screenScaleFactor
iconSource: detailsRow.iconSource
color: UM.Theme.getColor("text")
}
Label
{
text: detailsRow.label
color: UM.Theme.getColor("text")
elide: Text.ElideRight
Layout.minimumWidth: 50 * screenScaleFactor
Layout.maximumWidth: 100 * screenScaleFactor
Layout.fillWidth: true
renderType: Text.NativeRendering
}
Label
{
text: detailsRow.value
color: UM.Theme.getColor("text")
elide: Text.ElideRight
Layout.minimumWidth: 50 * screenScaleFactor
Layout.maximumWidth: 100 * screenScaleFactor
Layout.fillWidth: true
renderType: Text.NativeRendering
}
}

View file

@ -0,0 +1,11 @@
// Copyright (c) 2018 Ultimaker B.V.
import QtQuick 2.7
import UM 1.3 as UM
Rectangle
{
id: divider
color: UM.Theme.getColor("lining")
height: UM.Theme.getSize("default_lining").height
}

View file

@ -0,0 +1,56 @@
// Copyright (c) 2018 Ultimaker B.V.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtGraphicalEffects 1.0
Item
{
id: icon
width: parent.height
height: width
property var color: "transparent"
property var iconSource
property bool animated: false
Image
{
id: iconImage
width: parent.height
height: width
smooth: true
source: icon.iconSource
sourceSize.width: width
sourceSize.height: height
antialiasing: true
visible: !icon.animated
}
AnimatedImage
{
id: animatedIconImage
width: parent.height
height: width
smooth: true
antialiasing: true
source: "../images/loading.gif"
visible: icon.animated
}
ColorOverlay
{
anchors.fill: iconImage
source: iconImage
color: icon.color
antialiasing: true
visible: !icon.animated
}
ColorOverlay
{
anchors.fill: animatedIconImage
source: animatedIconImage
color: icon.color
antialiasing: true
visible: icon.animated
}
}

View file

@ -0,0 +1,13 @@
// Copyright (c) 2018 Ultimaker B.V.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
ScrollBar
{
active: true
size: parent.height
anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: parent.bottom
}