mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Added CuraDirve plugin to Cura build
CURA-6005
This commit is contained in:
parent
3db3203e0d
commit
c62cb84c75
43 changed files with 1287 additions and 1 deletions
67
plugins/CuraDrive/src/qml/components/ActionButton.qml
Normal file
67
plugins/CuraDrive/src/qml/components/ActionButton.qml
Normal 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
|
||||
}
|
||||
}
|
49
plugins/CuraDrive/src/qml/components/ActionCheckBox.qml
Normal file
49
plugins/CuraDrive/src/qml/components/ActionCheckBox.qml
Normal 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
|
||||
}
|
||||
}
|
29
plugins/CuraDrive/src/qml/components/ActionToolTip.qml
Normal file
29
plugins/CuraDrive/src/qml/components/ActionToolTip.qml
Normal 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
|
||||
}
|
||||
}
|
31
plugins/CuraDrive/src/qml/components/BackupList.qml
Normal file
31
plugins/CuraDrive/src/qml/components/BackupList.qml
Normal 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 {}
|
||||
}
|
42
plugins/CuraDrive/src/qml/components/BackupListFooter.qml
Normal file
42
plugins/CuraDrive/src/qml/components/BackupListFooter.qml
Normal 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.")
|
||||
}
|
||||
}
|
112
plugins/CuraDrive/src/qml/components/BackupListItem.qml
Normal file
112
plugins/CuraDrive/src/qml/components/BackupListItem.qml
Normal 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"])
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
11
plugins/CuraDrive/src/qml/components/Divider.qml
Normal file
11
plugins/CuraDrive/src/qml/components/Divider.qml
Normal 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
|
||||
}
|
56
plugins/CuraDrive/src/qml/components/Icon.qml
Normal file
56
plugins/CuraDrive/src/qml/components/Icon.qml
Normal 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
|
||||
}
|
||||
}
|
13
plugins/CuraDrive/src/qml/components/RightSideScrollBar.qml
Normal file
13
plugins/CuraDrive/src/qml/components/RightSideScrollBar.qml
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue