mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 23:05:01 -06:00
Move QML files to resources
This commit is contained in:
parent
81aac4a1c1
commit
70d714def5
17 changed files with 0 additions and 0 deletions
24
resources/qml/AboutDialog.qml
Normal file
24
resources/qml/AboutDialog.qml
Normal file
|
@ -0,0 +1,24 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Window 2.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
UM.Dialog {
|
||||
id: base
|
||||
|
||||
//: Add Printer dialog title
|
||||
title: qsTr("About Cura");
|
||||
|
||||
Label {
|
||||
text: "Cura";
|
||||
}
|
||||
|
||||
rightButtons: Button {
|
||||
text: "Close";
|
||||
|
||||
onClicked: base.visible = false;
|
||||
}
|
||||
}
|
||||
|
63
resources/qml/AddMachineWizard.qml
Normal file
63
resources/qml/AddMachineWizard.qml
Normal file
|
@ -0,0 +1,63 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Window 2.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
UM.Dialog {
|
||||
id: base
|
||||
|
||||
//: Add Printer dialog title
|
||||
title: qsTr("Add Printer");
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent;
|
||||
anchors.margins: UM.Styles.defaultMargin;
|
||||
|
||||
Label {
|
||||
text: qsTr("Add Printer");
|
||||
font.pointSize: 18;
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Please select the type of printer:");
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
Layout.fillWidth: true;
|
||||
|
||||
ListView {
|
||||
id: machineList;
|
||||
model: UM.Models.availableMachinesModel
|
||||
delegate: RadioButton { exclusiveGroup: printerGroup; text: model.name; onClicked: ListView.view.currentIndex = index; }
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Printer Name:");
|
||||
}
|
||||
|
||||
TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name }
|
||||
|
||||
Item { Layout.fillWidth: true; Layout.fillHeight: true; }
|
||||
|
||||
ExclusiveGroup { id: printerGroup; }
|
||||
}
|
||||
|
||||
rightButtons: [
|
||||
Button {
|
||||
text: qsTr("Next");
|
||||
onClicked: {
|
||||
if(machineList.currentIndex != -1) {
|
||||
UM.Models.availableMachinesModel.createMachine(machineList.currentIndex, machineName.text)
|
||||
base.visible = false
|
||||
}
|
||||
}
|
||||
},
|
||||
Button {
|
||||
text: qsTr("Cancel");
|
||||
onClicked: base.visible = false;
|
||||
}
|
||||
]
|
||||
}
|
68
resources/qml/DescriptionPane.qml
Normal file
68
resources/qml/DescriptionPane.qml
Normal file
|
@ -0,0 +1,68 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Dialogs 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
Rectangle {
|
||||
id: base
|
||||
|
||||
opacity: 0;
|
||||
|
||||
width: 300;
|
||||
height: label.height + label.anchors.topMargin + label.anchors.bottomMargin;
|
||||
|
||||
border.width: 1;
|
||||
|
||||
Label {
|
||||
id: label;
|
||||
|
||||
wrapMode: Text.WordWrap;
|
||||
horizontalAlignment: Text.AlignJustify;
|
||||
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: 10;
|
||||
anchors.right: parent.right;
|
||||
anchors.rightMargin: 10;
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: closeButton.height;
|
||||
anchors.bottomMargin: 10;
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
id: closeButton;
|
||||
anchors.right: parent.right;
|
||||
text: "Close";
|
||||
onClicked: closeAnimation.start();
|
||||
}
|
||||
|
||||
function show(text, x, y)
|
||||
{
|
||||
if(base.opacity > 0) {
|
||||
base._newText = text;
|
||||
base._newY = y;
|
||||
textChangeAnimation.start();
|
||||
} else {
|
||||
label.text = text;
|
||||
base.y = y;
|
||||
showAnimation.start();
|
||||
}
|
||||
}
|
||||
|
||||
property string _newText;
|
||||
property real _newY;
|
||||
|
||||
SequentialAnimation {
|
||||
id: textChangeAnimation;
|
||||
|
||||
NumberAnimation { target: base; property: "opacity"; to: 0; duration: 100; }
|
||||
PropertyAction { target: label; property: "text"; value: base._newText; }
|
||||
PropertyAction { target: base; property: "y"; value: base._newY; }
|
||||
NumberAnimation { target: base; property: "opacity"; to: 1; duration: 100; }
|
||||
}
|
||||
|
||||
NumberAnimation { id: showAnimation; target: base; property: "opacity"; to: 1; duration: 100; }
|
||||
NumberAnimation { id: closeAnimation; target: base; property: "opacity"; to: 0; duration: 100; }
|
||||
}
|
41
resources/qml/EngineLog.qml
Normal file
41
resources/qml/EngineLog.qml
Normal file
|
@ -0,0 +1,41 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
UM.Dialog {
|
||||
id: dialog;
|
||||
|
||||
//: Engine Log dialog title
|
||||
title: qsTr("Engine Log");
|
||||
|
||||
modality: Qt.NonModal;
|
||||
|
||||
TextArea {
|
||||
id: textArea
|
||||
anchors.fill: parent;
|
||||
|
||||
Timer {
|
||||
id: updateTimer;
|
||||
interval: 1000;
|
||||
running: false;
|
||||
repeat: true;
|
||||
onTriggered: textArea.text = Printer.getEngineLog();
|
||||
}
|
||||
}
|
||||
|
||||
rightButtons: Button {
|
||||
text: qsTr("Close");
|
||||
onClicked: dialog.visible = false;
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if(visible) {
|
||||
textArea.text = Printer.getEngineLog();
|
||||
updateTimer.start();
|
||||
} else {
|
||||
updateTimer.stop();
|
||||
}
|
||||
}
|
||||
}
|
86
resources/qml/FilePane.qml
Normal file
86
resources/qml/FilePane.qml
Normal file
|
@ -0,0 +1,86 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
Rectangle {
|
||||
id: base;
|
||||
|
||||
signal requestOpenFile();
|
||||
signal openFile(url file);
|
||||
|
||||
function setDirectory(file)
|
||||
{
|
||||
UM.Models.directoryListModel.directory = file
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent;
|
||||
acceptedButtons: Qt.AllButtons;
|
||||
|
||||
onWheel: {
|
||||
wheel.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent;
|
||||
anchors.margins: UM.Styles.defaultMargin;
|
||||
|
||||
//: Open file button
|
||||
Button { text: qsTr("Open File"); iconSource: UM.Resources.getIcon("open.png"); Layout.fillWidth: true; onClicked: base.requestOpenFile(); }
|
||||
|
||||
Rectangle {
|
||||
Layout.fillWidth: true;
|
||||
Layout.fillHeight: true;
|
||||
border.width: 1;
|
||||
border.color: "#aaa";
|
||||
|
||||
ScrollView {
|
||||
anchors.fill: parent;
|
||||
anchors.margins: 1;
|
||||
|
||||
ListView {
|
||||
id: listView;
|
||||
model: UM.Models.directoryListModel;
|
||||
delegate: listDelegate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
anchors.horizontalCenter: parent.horizontalCenter;
|
||||
iconSource: UM.Resources.getIcon('expand.png');
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: listDelegate;
|
||||
Rectangle {
|
||||
id: item;
|
||||
|
||||
anchors.left: parent.left;
|
||||
anchors.right: parent.right;
|
||||
|
||||
height: 40;
|
||||
|
||||
color: mouseArea.pressed ? "#f00" : index % 2 ? "#eee" : "#fff";
|
||||
|
||||
Label {
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: UM.Styles.defaultMargin;
|
||||
|
||||
text: model.name;
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea;
|
||||
anchors.fill: parent;
|
||||
|
||||
onClicked: base.openFile(model.url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
421
resources/qml/Printer.qml
Normal file
421
resources/qml/Printer.qml
Normal file
|
@ -0,0 +1,421 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Dialogs 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
UM.MainWindow {
|
||||
id: base
|
||||
visible: true
|
||||
|
||||
//width: 1280
|
||||
//height: 720
|
||||
|
||||
title: qsTr("Cura");
|
||||
|
||||
Item {
|
||||
id: backgroundItem;
|
||||
anchors.fill: parent;
|
||||
|
||||
UM.ApplicationMenu {
|
||||
id: menu
|
||||
window: base
|
||||
|
||||
Menu {
|
||||
//: File menu
|
||||
title: qsTr("&File");
|
||||
|
||||
MenuItem { action: actions.open; }
|
||||
MenuItem { action: actions.save; }
|
||||
|
||||
MenuSeparator { }
|
||||
|
||||
MenuItem { action: actions.quit; }
|
||||
}
|
||||
|
||||
Menu {
|
||||
//: Edit menu
|
||||
title: qsTr("&Edit");
|
||||
|
||||
MenuItem { action: actions.undo; }
|
||||
MenuItem { action: actions.redo; }
|
||||
MenuSeparator { }
|
||||
MenuItem { action: actions.deleteSelection; }
|
||||
MenuItem { action: actions.deleteAll; }
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: machineMenu;
|
||||
//: Machine menu
|
||||
title: qsTr("&Machine");
|
||||
|
||||
Instantiator {
|
||||
model: UM.Models.machinesModel
|
||||
MenuItem {
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.active;
|
||||
exclusiveGroup: machineMenuGroup;
|
||||
onTriggered: UM.Models.machinesModel.setActive(index)
|
||||
}
|
||||
onObjectAdded: machineMenu.insertItem(index, object)
|
||||
onObjectRemoved: machineMenu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: machineMenuGroup; }
|
||||
|
||||
MenuSeparator { }
|
||||
|
||||
MenuItem { action: actions.addMachine; }
|
||||
MenuItem { action: actions.configureMachines; }
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: extension_menu
|
||||
//: Extensions menu
|
||||
title: qsTr("E&xtensions");
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: UM.Models.extensionModel
|
||||
|
||||
Menu
|
||||
{
|
||||
id: sub_menu
|
||||
title: model.name;
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: actions
|
||||
MenuItem
|
||||
{
|
||||
text: model.text
|
||||
onTriggered: UM.Models.extensionModel.subMenuTriggered(name, model.text)
|
||||
}
|
||||
onObjectAdded: sub_menu.insertItem(index, object)
|
||||
onObjectRemoved: sub_menu.removeItem(object)
|
||||
}
|
||||
}
|
||||
|
||||
onObjectAdded: extension_menu.insertItem(index, object)
|
||||
onObjectRemoved: extension_menu.removeItem(object)
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
//: Settings menu
|
||||
title: qsTr("&Settings");
|
||||
|
||||
MenuItem { action: actions.preferences; }
|
||||
}
|
||||
|
||||
Menu {
|
||||
//: Help menu
|
||||
title: qsTr("&Help");
|
||||
|
||||
MenuItem { action: actions.showEngineLog; }
|
||||
MenuItem { action: actions.documentation; }
|
||||
MenuItem { action: actions.reportBug; }
|
||||
MenuSeparator { }
|
||||
MenuItem { action: actions.about; }
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: contentItem;
|
||||
|
||||
y: menu.height
|
||||
width: parent.width;
|
||||
height: parent.height - menu.height;
|
||||
|
||||
Keys.forwardTo: menu
|
||||
|
||||
DropArea {
|
||||
anchors.fill: parent;
|
||||
onDropped: {
|
||||
if(drop.urls.length > 0) {
|
||||
for(var i in drop.urls) {
|
||||
UM.Controller.addMesh(drop.urls[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Sidebar {
|
||||
id: sidebar;
|
||||
|
||||
anchors {
|
||||
top: parent.top;
|
||||
bottom: parent.bottom;
|
||||
right: parent.right;
|
||||
rightMargin: UM.Theme.sizes.window_margin.width;
|
||||
}
|
||||
|
||||
width: UM.Theme.sizes.panel.width;
|
||||
|
||||
addMachineAction: actions.addMachine;
|
||||
configureMachinesAction: actions.configureMachines;
|
||||
saveAction: actions.save;
|
||||
}
|
||||
|
||||
UM.MessageStack {
|
||||
anchors {
|
||||
left: toolbar.right;
|
||||
leftMargin: UM.Theme.sizes.window_margin.width;
|
||||
right: sidebar.left;
|
||||
rightMargin: UM.Theme.sizes.window_margin.width;
|
||||
top: parent.verticalCenter;
|
||||
bottom: parent.bottom;
|
||||
}
|
||||
}
|
||||
|
||||
Loader
|
||||
{
|
||||
id: view_panel
|
||||
|
||||
//anchors.left: parent.left;
|
||||
//anchors.right: parent.right;
|
||||
//anchors.bottom: parent.bottom
|
||||
anchors.top: viewModeButton.bottom
|
||||
anchors.topMargin: UM.Theme.sizes.default_margin.height;
|
||||
anchors.right: sidebar.left;
|
||||
anchors.rightMargin: UM.Theme.sizes.window_margin.width;
|
||||
//anchors.bottom: buttons.top;
|
||||
//anchors.bottomMargin: UM.Theme.sizes.default_margin.height;
|
||||
|
||||
height: childrenRect.height;
|
||||
|
||||
source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "";
|
||||
}
|
||||
|
||||
DescriptionPane {
|
||||
id: descriptionPane;
|
||||
anchors.right: sidebar.left;
|
||||
}
|
||||
|
||||
PrinterButton {
|
||||
id: openFileButton;
|
||||
|
||||
iconSource: UM.Theme.icons.open;
|
||||
|
||||
anchors {
|
||||
top: parent.top;
|
||||
topMargin: UM.Theme.sizes.window_margin.height;
|
||||
left: parent.left;
|
||||
leftMargin: UM.Theme.sizes.window_margin.width;
|
||||
}
|
||||
|
||||
action: actions.open;
|
||||
}
|
||||
|
||||
Image {
|
||||
anchors {
|
||||
verticalCenter: openFileButton.verticalCenter;
|
||||
left: openFileButton.right;
|
||||
leftMargin: UM.Theme.sizes.window_margin.width;
|
||||
}
|
||||
|
||||
source: UM.Theme.images.logo;
|
||||
width: UM.Theme.sizes.logo.width;
|
||||
height: UM.Theme.sizes.logo.height;
|
||||
|
||||
sourceSize.width: width;
|
||||
sourceSize.height: height;
|
||||
}
|
||||
|
||||
PrinterButton {
|
||||
anchors {
|
||||
top: parent.top;
|
||||
topMargin: UM.Theme.sizes.window_margin.height;
|
||||
right: sidebar.left;
|
||||
rightMargin: UM.Theme.sizes.window_margin.width;
|
||||
}
|
||||
id: viewModeButton
|
||||
//: View Mode toolbar button
|
||||
text: qsTr("View Mode");
|
||||
iconSource: UM.Theme.icons.viewmode;
|
||||
|
||||
menu: Menu {
|
||||
id: viewMenu;
|
||||
Instantiator {
|
||||
model: UM.Models.viewModel;
|
||||
MenuItem {
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.active;
|
||||
exclusiveGroup: viewMenuGroup;
|
||||
onTriggered: UM.Controller.setActiveView(model.id);
|
||||
}
|
||||
onObjectAdded: viewMenu.insertItem(index, object)
|
||||
onObjectRemoved: viewMenu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: viewMenuGroup; }
|
||||
}
|
||||
}
|
||||
|
||||
PrinterToolbar {
|
||||
id: toolbar;
|
||||
|
||||
anchors {
|
||||
left: parent.left;
|
||||
leftMargin: UM.Theme.sizes.window_margin.width;
|
||||
bottom: parent.bottom;
|
||||
bottomMargin: UM.Theme.sizes.window_margin.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UM.PreferencesDialog {
|
||||
id: preferences
|
||||
|
||||
Component.onCompleted: {
|
||||
insertPage(1, qsTr('View'), 'view-preview', Qt.resolvedUrl('./ViewPage.qml'));
|
||||
}
|
||||
}
|
||||
|
||||
PrinterActions {
|
||||
id: actions;
|
||||
|
||||
open.onTriggered: openDialog.open();
|
||||
save.onTriggered: saveDialog.open();
|
||||
|
||||
quit.onTriggered: base.visible = false;
|
||||
|
||||
undo.onTriggered: UM.OperationStack.undo();
|
||||
undo.enabled: UM.OperationStack.canUndo;
|
||||
redo.onTriggered: UM.OperationStack.redo();
|
||||
redo.enabled: UM.OperationStack.canRedo;
|
||||
|
||||
deleteSelection.onTriggered: UM.Controller.removeSelection();
|
||||
|
||||
deleteObject.onTriggered: {
|
||||
if(objectContextMenu.objectId != 0) {
|
||||
Printer.deleteObject(objectContextMenu.objectId);
|
||||
objectContextMenu.objectId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
multiplyObject.onTriggered: {
|
||||
if(objectContextMenu.objectId != 0) {
|
||||
Printer.multiplyObject(objectContextMenu.objectId, 1);
|
||||
objectContextMenu.objectId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
centerObject.onTriggered: {
|
||||
if(objectContextMenu.objectId != 0) {
|
||||
Printer.centerObject(objectContextMenu.objectId);
|
||||
objectContextMenu.objectId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
deleteAll.onTriggered: Printer.deleteAll()
|
||||
resetAllTranslation.onTriggered: Printer.resetAllTranslation()
|
||||
resetAll.onTriggered: Printer.resetAll()
|
||||
reloadAll.onTriggered: Printer.reloadAll()
|
||||
|
||||
addMachine.onTriggered: addMachine.visible = true;
|
||||
|
||||
preferences.onTriggered: preferences.visible = true;
|
||||
configureMachines.onTriggered: { preferences.visible = true; preferences.setPage(2); }
|
||||
|
||||
documentation.onTriggered: Qt.openUrlExternally("https://ultimaker.com/en/support");
|
||||
reportBug.onTriggered: Qt.openUrlExternally("https://github.com/Ultimaker/PluggableCura/issues");
|
||||
showEngineLog.onTriggered: engineLog.visible = true;
|
||||
about.onTriggered: aboutDialog.visible = true;
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: objectContextMenu;
|
||||
|
||||
property variant objectId: -1;
|
||||
|
||||
MenuItem { action: actions.centerObject; }
|
||||
MenuItem { action: actions.deleteObject; }
|
||||
MenuItem { action: actions.multiplyObject; }
|
||||
MenuItem { action: actions.splitObject; }
|
||||
MenuSeparator { }
|
||||
MenuItem { action: actions.deleteAll; }
|
||||
MenuItem { action: actions.reloadAll; }
|
||||
MenuItem { action: actions.resetAllTranslation; }
|
||||
MenuItem { action: actions.resetAll; }
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: contextMenu;
|
||||
|
||||
MenuItem { action: actions.deleteAll; }
|
||||
MenuItem { action: actions.reloadAll; }
|
||||
MenuItem { action: actions.resetAllTranslation; }
|
||||
MenuItem { action: actions.resetAll; }
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: UM.Controller
|
||||
onContextMenuRequested: {
|
||||
if(objectId == 0) {
|
||||
contextMenu.popup();
|
||||
} else {
|
||||
objectContextMenu.objectId = objectId;
|
||||
objectContextMenu.popup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: openDialog;
|
||||
|
||||
//: File open dialog title
|
||||
title: qsTr("Open File")
|
||||
modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal;
|
||||
//TODO: Support multiple file selection, workaround bug in KDE file dialog
|
||||
//selectMultiple: true
|
||||
|
||||
nameFilters: UM.MeshFileHandler.supportedReadFileTypes;
|
||||
|
||||
onAccepted:
|
||||
{
|
||||
UM.MeshFileHandler.readLocalFile(fileUrl)
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: saveDialog;
|
||||
//: File save dialog title
|
||||
title: qsTr("Save File");
|
||||
selectExisting: false;
|
||||
|
||||
modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal;
|
||||
|
||||
nameFilters: UM.MeshFileHandler.supportedWriteFileTypes
|
||||
|
||||
onAccepted:
|
||||
{
|
||||
UM.MeshFileHandler.writeLocalFile(fileUrl);
|
||||
}
|
||||
}
|
||||
|
||||
EngineLog {
|
||||
id: engineLog;
|
||||
}
|
||||
|
||||
AddMachineWizard {
|
||||
id: addMachine;
|
||||
}
|
||||
|
||||
AboutDialog {
|
||||
id: aboutDialog
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Printer
|
||||
onRequestAddPrinter: addMachine.visible = true;
|
||||
onWriteToLocalFileRequested: saveDialog.open();
|
||||
}
|
||||
|
||||
Component.onCompleted: UM.Theme.load(UM.Resources.getPath(UM.Resources.ThemesLocation, "cura"))
|
||||
}
|
181
resources/qml/PrinterActions.qml
Normal file
181
resources/qml/PrinterActions.qml
Normal file
|
@ -0,0 +1,181 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
Item {
|
||||
property alias open: openAction;
|
||||
property alias save: saveAction;
|
||||
property alias quit: quitAction;
|
||||
|
||||
property alias undo: undoAction;
|
||||
property alias redo: redoAction;
|
||||
|
||||
property alias deleteSelection: deleteSelectionAction;
|
||||
|
||||
property alias deleteObject: deleteObjectAction;
|
||||
property alias centerObject: centerObjectAction;
|
||||
property alias multiplyObject: multiplyObjectAction;
|
||||
property alias splitObject: splitObjectAction;
|
||||
|
||||
property alias deleteAll: deleteAllAction;
|
||||
property alias reloadAll: reloadAllAction;
|
||||
property alias resetAllTranslation: resetAllTranslationAction;
|
||||
property alias resetAll: resetAllAction;
|
||||
|
||||
property alias addMachine: addMachineAction;
|
||||
property alias configureMachines: settingsAction;
|
||||
|
||||
property alias preferences: preferencesAction;
|
||||
|
||||
property alias showEngineLog: showEngineLogAction;
|
||||
property alias documentation: documentationAction;
|
||||
property alias reportBug: reportBugAction;
|
||||
property alias about: aboutAction;
|
||||
|
||||
Action {
|
||||
id: undoAction;
|
||||
//: Undo action
|
||||
text: qsTr("Undo");
|
||||
iconName: "edit-undo";
|
||||
shortcut: StandardKey.Undo;
|
||||
}
|
||||
|
||||
Action {
|
||||
id: redoAction;
|
||||
//: Redo action
|
||||
text: qsTr("Redo");
|
||||
iconName: "edit-redo";
|
||||
shortcut: StandardKey.Redo;
|
||||
}
|
||||
|
||||
Action {
|
||||
id: quitAction;
|
||||
//: Quit action
|
||||
text: qsTr("Quit");
|
||||
iconName: "application-exit";
|
||||
shortcut: StandardKey.Quit;
|
||||
}
|
||||
|
||||
Action {
|
||||
id: preferencesAction;
|
||||
//: Preferences action
|
||||
text: qsTr("Preferences");
|
||||
iconName: "configure";
|
||||
}
|
||||
|
||||
Action {
|
||||
id: addMachineAction;
|
||||
//: Add a Machine action
|
||||
text: qsTr("Add Printer...");
|
||||
}
|
||||
|
||||
Action {
|
||||
id: settingsAction;
|
||||
//: Manage Printers action
|
||||
text: qsTr("Configure Printers");
|
||||
iconName: "configure";
|
||||
}
|
||||
|
||||
Action {
|
||||
id: documentationAction;
|
||||
//: Show Online Documentation action
|
||||
text: qsTr("Show Online Documentation");
|
||||
iconName: "help-contents";
|
||||
shortcut: StandardKey.Help;
|
||||
}
|
||||
|
||||
Action {
|
||||
id: reportBugAction;
|
||||
//: Report a Bug Action
|
||||
text: qsTr("Report a Bug");
|
||||
iconName: "tools-report-bug";
|
||||
}
|
||||
|
||||
Action {
|
||||
id: aboutAction;
|
||||
//: About action
|
||||
text: qsTr("About...");
|
||||
iconName: "help-about";
|
||||
}
|
||||
|
||||
Action {
|
||||
id: deleteSelectionAction;
|
||||
//: Delete selection action
|
||||
text: qsTr("Delete Selection");
|
||||
iconName: "edit-delete";
|
||||
shortcut: StandardKey.Delete;
|
||||
}
|
||||
|
||||
Action {
|
||||
id: deleteObjectAction;
|
||||
//: Delete object action
|
||||
text: qsTr("Delete Object");
|
||||
iconName: "edit-delete";
|
||||
}
|
||||
|
||||
Action {
|
||||
id: centerObjectAction;
|
||||
//: Center object action
|
||||
text: qsTr("Center Object on Platform");
|
||||
}
|
||||
|
||||
Action {
|
||||
id: multiplyObjectAction;
|
||||
//: Duplicate object action
|
||||
text: qsTr("Duplicate Object");
|
||||
}
|
||||
|
||||
Action {
|
||||
id: splitObjectAction;
|
||||
//: Split object action
|
||||
text: qsTr("Split Object into Parts");
|
||||
enabled: false;
|
||||
}
|
||||
|
||||
Action {
|
||||
id: deleteAllAction;
|
||||
//: Clear build platform action
|
||||
text: qsTr("Clear Build Platform");
|
||||
iconName: "edit-clear";
|
||||
}
|
||||
|
||||
Action {
|
||||
id: reloadAllAction;
|
||||
//: Reload all objects action
|
||||
text: qsTr("Reload All Objects");
|
||||
}
|
||||
|
||||
Action {
|
||||
id: resetAllTranslationAction;
|
||||
//: Reset all positions action
|
||||
text: qsTr("Reset All Object Positions");
|
||||
}
|
||||
|
||||
Action {
|
||||
id: resetAllAction;
|
||||
//: Reset all positions action
|
||||
text: qsTr("Reset All Object Transformations");
|
||||
}
|
||||
|
||||
Action {
|
||||
id: openAction;
|
||||
//: Open file action
|
||||
text: qsTr("Open...");
|
||||
iconName: "document-open";
|
||||
shortcut: StandardKey.Open;
|
||||
}
|
||||
|
||||
Action {
|
||||
id: saveAction;
|
||||
//: Save file action
|
||||
text: qsTr("Save...");
|
||||
iconName: "document-save";
|
||||
shortcut: StandardKey.Save;
|
||||
}
|
||||
|
||||
Action {
|
||||
id: showEngineLogAction;
|
||||
//: Show engine log action
|
||||
text: qsTr("Show engine log...");
|
||||
iconName: "view-list-text";
|
||||
}
|
||||
}
|
11
resources/qml/PrinterButton.qml
Normal file
11
resources/qml/PrinterButton.qml
Normal file
|
@ -0,0 +1,11 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
Button {
|
||||
id: base;
|
||||
style: UM.Theme.styles.tool_button;
|
||||
}
|
57
resources/qml/PrinterToolbar.qml
Normal file
57
resources/qml/PrinterToolbar.qml
Normal file
|
@ -0,0 +1,57 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
Item {
|
||||
id: base;
|
||||
|
||||
width: buttons.width;
|
||||
height: buttons.height + panel.height;
|
||||
|
||||
RowLayout {
|
||||
id: buttons;
|
||||
|
||||
anchors.bottom: parent.bottom;
|
||||
anchors.left: parent.left;
|
||||
|
||||
spacing: UM.Theme.sizes.default_margin.width * 2;
|
||||
|
||||
Repeater {
|
||||
id: repeat
|
||||
|
||||
model: UM.Models.toolModel
|
||||
|
||||
PrinterButton {
|
||||
text: model.name;
|
||||
iconSource: UM.Theme.icons[model.icon];
|
||||
tooltip: model.description;
|
||||
|
||||
checkable: true;
|
||||
checked: model.active;
|
||||
|
||||
//Workaround since using ToolButton's onClicked would break the binding of the checked property, instead
|
||||
//just catch the click so we do not trigger that behaviour.
|
||||
MouseArea {
|
||||
anchors.fill: parent;
|
||||
onClicked: parent.checked ? UM.Controller.setActiveTool(null) : UM.Controller.setActiveTool(model.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: panel
|
||||
|
||||
anchors.left: parent.left;
|
||||
anchors.right: parent.right;
|
||||
anchors.bottom: buttons.top;
|
||||
anchors.bottomMargin: UM.Theme.sizes.default_margin.height;
|
||||
|
||||
height: childrenRect.height;
|
||||
|
||||
source: UM.ActiveTool.valid ? UM.ActiveTool.activeToolPanel : "";
|
||||
}
|
||||
}
|
204
resources/qml/SaveButton.qml
Normal file
204
resources/qml/SaveButton.qml
Normal file
|
@ -0,0 +1,204 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
Button {
|
||||
id: base;
|
||||
|
||||
property Action saveAction;
|
||||
|
||||
property real progress: UM.Backend.progress;
|
||||
Behavior on progress { NumberAnimation { duration: 250; } }
|
||||
|
||||
enabled: progress >= 0.95;
|
||||
|
||||
property string currentDevice: 'local_file'
|
||||
property bool defaultOverride: false;
|
||||
property bool defaultAmbiguous: false;
|
||||
|
||||
property variant printDuration: PrintInformation.currentPrintTime;
|
||||
property real printMaterialAmount: PrintInformation.materialAmount;
|
||||
|
||||
iconSource: UM.Theme.icons[Printer.outputDevices[base.currentDevice].icon];
|
||||
tooltip: Printer.outputDevices[base.currentDevice].description;
|
||||
|
||||
Connections {
|
||||
target: Printer;
|
||||
onOutputDevicesChanged: {
|
||||
if(!base.defaultOverride) {
|
||||
base.defaultAmbiguous = false;
|
||||
var device = null;
|
||||
for(var i in Printer.outputDevices) {
|
||||
if(device == null) {
|
||||
device = i;
|
||||
} else if(Printer.outputDevices[i].priority > Printer.outputDevices[device].priority) {
|
||||
device = i;
|
||||
} else if(Printer.outputDevices[i].priority == Printer.outputDevices[device].priority) {
|
||||
base.defaultAmbiguous = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(device != null) {
|
||||
base.currentDevice = device;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
style: ButtonStyle {
|
||||
background: UM.AngledCornerRectangle {
|
||||
implicitWidth: control.width;
|
||||
implicitHeight: control.height;
|
||||
|
||||
color: UM.Theme.colors.save_button_border;
|
||||
cornerSize: UM.Theme.sizes.default_margin.width;
|
||||
|
||||
UM.AngledCornerRectangle {
|
||||
anchors.fill: parent;
|
||||
anchors.margins: UM.Theme.sizes.save_button_border.width;
|
||||
cornerSize: UM.Theme.sizes.default_margin.width;
|
||||
color: UM.Theme.colors.save_button;
|
||||
}
|
||||
|
||||
UM.AngledCornerRectangle {
|
||||
anchors {
|
||||
left: parent.left;
|
||||
top: parent.top;
|
||||
bottom: parent.bottom;
|
||||
}
|
||||
|
||||
width: Math.max(parent.height + (parent.width - parent.height) * control.progress, parent.height);
|
||||
cornerSize: UM.Theme.sizes.default_margin.width;
|
||||
|
||||
color: !control.enabled ? UM.Theme.colors.save_button_inactive : control.hovered ? UM.Theme.colors.save_button_active_hover : UM.Theme.colors.save_button_active;
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
}
|
||||
|
||||
UM.AngledCornerRectangle {
|
||||
anchors.left: parent.left;
|
||||
width: parent.height + UM.Theme.sizes.save_button_border.width;
|
||||
height: parent.height;
|
||||
cornerSize: UM.Theme.sizes.default_margin.width;
|
||||
color: UM.Theme.colors.save_button;
|
||||
}
|
||||
|
||||
UM.AngledCornerRectangle {
|
||||
anchors.left: parent.left;
|
||||
width: parent.height + UM.Theme.sizes.save_button_border.width;
|
||||
height: parent.height;
|
||||
cornerSize: UM.Theme.sizes.default_margin.width;
|
||||
|
||||
color: UM.Theme.colors.save_button;
|
||||
}
|
||||
|
||||
UM.AngledCornerRectangle {
|
||||
id: icon;
|
||||
|
||||
anchors.left: parent.left;
|
||||
width: parent.height;
|
||||
height: parent.height;
|
||||
cornerSize: UM.Theme.sizes.default_margin.width;
|
||||
color: !control.enabled ? UM.Theme.colors.save_button_inactive : control.hovered ? UM.Theme.colors.save_button_active_hover : UM.Theme.colors.save_button_active;
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
|
||||
Image {
|
||||
anchors.centerIn: parent;
|
||||
|
||||
width: UM.Theme.sizes.button_icon.width;
|
||||
height: UM.Theme.sizes.button_icon.height;
|
||||
|
||||
sourceSize.width: width;
|
||||
sourceSize.height: height;
|
||||
|
||||
source: control.iconSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
label: Column {
|
||||
Label {
|
||||
id: label;
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: control.height + UM.Theme.sizes.save_button_label_margin.width;
|
||||
|
||||
color: UM.Theme.colors.save_button_text;
|
||||
font: UM.Theme.fonts.default;
|
||||
|
||||
text: control.text;
|
||||
}
|
||||
Label {
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: control.height + UM.Theme.sizes.save_button_label_margin.width;
|
||||
|
||||
color: UM.Theme.colors.save_button_text;
|
||||
font: UM.Theme.fonts.default;
|
||||
|
||||
text: (!control.printDuration || !control.printDuration.valid) ? "" : control.printDuration.getDisplayString(UM.DurationFormat.Long)
|
||||
}
|
||||
Label {
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: control.height + UM.Theme.sizes.save_button_label_margin.width;
|
||||
|
||||
color: UM.Theme.colors.save_button_text;
|
||||
font: UM.Theme.fonts.default;
|
||||
|
||||
text: control.printMaterialAmount < 0 ? "" : qsTr("%1m material").arg(control.printMaterialAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent;
|
||||
|
||||
acceptedButtons: Qt.RightButton;
|
||||
|
||||
onClicked: devicesMenu.popup();
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: devicesMenu;
|
||||
|
||||
Instantiator {
|
||||
model: Printer.outputDeviceNames;
|
||||
MenuItem {
|
||||
text: Printer.outputDevices[modelData].description;
|
||||
checkable: true;
|
||||
checked: base.defaultAmbiguous ? false : modelData == base.currentDevice;
|
||||
exclusiveGroup: devicesMenuGroup;
|
||||
onTriggered: {
|
||||
base.defaultOverride = true;
|
||||
base.currentDevice = modelData;
|
||||
if(base.defaultAmbiguous) {
|
||||
base.defaultAmbiguous = false;
|
||||
Printer.writeToOutputDevice(modelData);
|
||||
}
|
||||
}
|
||||
}
|
||||
onObjectAdded: devicesMenu.insertItem(index, object)
|
||||
onObjectRemoved: devicesMenu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: devicesMenuGroup; }
|
||||
}
|
||||
|
||||
text: {
|
||||
if(base.progress < 0) {
|
||||
return qsTr("Please load a 3D model");
|
||||
} else if (base.progress < 0.95) {
|
||||
return qsTr("Calculating Print-time");
|
||||
} else {
|
||||
return qsTr("Estimated Print-time");
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if(base.defaultAmbiguous) {
|
||||
devicesMenu.popup();
|
||||
} else {
|
||||
Printer.writeToOutputDevice(base.currentDevice);
|
||||
}
|
||||
}
|
||||
}
|
194
resources/qml/SettingsPane.qml
Normal file
194
resources/qml/SettingsPane.qml
Normal file
|
@ -0,0 +1,194 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
Rectangle {
|
||||
id: base;
|
||||
|
||||
height: childrenRect.height;
|
||||
|
||||
property real expandedHeight: 500;
|
||||
|
||||
property bool collapsed: true;
|
||||
|
||||
signal showDescription(string text, real x, real y);
|
||||
|
||||
MouseArea {
|
||||
anchors.left: parent.left;
|
||||
anchors.right: parent.right;
|
||||
height: contents.height;
|
||||
|
||||
acceptedButtons: Qt.AllButtons;
|
||||
|
||||
onWheel: {
|
||||
wheel.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: contents;
|
||||
spacing: UM.Styles.defaultMargin;
|
||||
|
||||
anchors {
|
||||
left: parent.left;
|
||||
leftMargin: UM.Styles.defaultMargin;
|
||||
right: parent.right;
|
||||
rightMargin: UM.Styles.defaultMargin;
|
||||
}
|
||||
|
||||
//: Print Settings panel title
|
||||
Label { text: qsTr("Print Settings"); width: parent.width; font.capitalization: Font.AllUppercase; font.pointSize: UM.Styles.smallTextSize; }
|
||||
|
||||
Item {
|
||||
width: parent.width;
|
||||
height: 24;
|
||||
|
||||
Row {
|
||||
anchors.fill: parent;
|
||||
spacing: UM.Styles.defaultMargin;
|
||||
|
||||
//: Material selection combo box label
|
||||
Label { text: qsTr("Material"); horizontalAlignment: Text.AlignRight; width: base.width * 0.5; }
|
||||
ComboBox {
|
||||
width: parent.width * 0.35;
|
||||
model: ListModel {
|
||||
ListElement { text: "PLA"; }
|
||||
ListElement { text: "ABS"; }
|
||||
}
|
||||
style: ComboBoxStyle { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: parent.width;
|
||||
height: 24;
|
||||
|
||||
Row {
|
||||
anchors.fill: parent;
|
||||
spacing: UM.Styles.defaultMargin;
|
||||
//: Time display label
|
||||
Label { text: qsTr("Time"); width: base.width * 0.5; horizontalAlignment: Text.AlignRight; }
|
||||
Label { text: Qt.formatTime(new Date(timeSlider.value * 60000)); width: base.width * 0.35; horizontalAlignment: Text.AlignLeft; }
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle { color: "black"; height: 1; width: parent.width; }
|
||||
|
||||
Item {
|
||||
id: speedSlider;
|
||||
|
||||
width: parent.width;
|
||||
height: 60;
|
||||
|
||||
Slider {
|
||||
id: timeSlider;
|
||||
anchors.left: parent.left;
|
||||
anchors.right: parent.right;
|
||||
height: 20;
|
||||
|
||||
minimumValue: 60;
|
||||
maximumValue: 600;
|
||||
stepSize: 10;
|
||||
|
||||
style: SliderStyle {
|
||||
groove: Rectangle {
|
||||
height: 1;
|
||||
color: "black";
|
||||
|
||||
Rectangle {
|
||||
anchors.left: parent.left;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
width: 1;
|
||||
height: control.height;
|
||||
color: "black";
|
||||
}
|
||||
Rectangle {
|
||||
anchors.right: parent.right;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
width: 1;
|
||||
height: control.height;
|
||||
color: "black";
|
||||
}
|
||||
}
|
||||
handle: Rectangle { width: 5; height: control.height; color: UM.Styles.primaryColor; }
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.left: parent.left;
|
||||
anchors.bottom: parent.bottom;
|
||||
|
||||
Label { text: Qt.formatTime(new Date(timeSlider.minimumValue * 60000)); }
|
||||
//: Low quality display label
|
||||
Label { text: qsTr("Low Quality"); }
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.right: parent.right;
|
||||
anchors.bottom: parent.bottom;
|
||||
|
||||
Label { text: Qt.formatTime(new Date(timeSlider.maximumValue * 60000)); anchors.right: parent.right; }
|
||||
//: High quality display label
|
||||
Label { text: qsTr("High Quality"); }
|
||||
}
|
||||
}
|
||||
|
||||
UM.SettingsView {
|
||||
id: settingsView;
|
||||
|
||||
width: parent.width;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
visible: false;
|
||||
|
||||
onShowDescription: base.showDescription(text, x, y);
|
||||
}
|
||||
|
||||
Rectangle { color: "black"; height: 1; width: parent.width; }
|
||||
|
||||
Item {
|
||||
Layout.columnSpan: 2;
|
||||
height: childrenRect.height;
|
||||
width: parent.width;
|
||||
|
||||
ToolButton {
|
||||
anchors.horizontalCenter: parent.horizontalCenter;
|
||||
iconSource: UM.Resources.getIcon('expand.png');
|
||||
onClicked: base.collapsed = !base.collapsed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: 'expanded';
|
||||
when: !base.collapsed;
|
||||
|
||||
PropertyChanges { target: speedSlider; opacity: 0; height: 0; visible: false; }
|
||||
PropertyChanges {
|
||||
target: settingsView;
|
||||
opacity: 1;
|
||||
height: Math.min(settingsView.listHeight, base.expandedHeight * 0.6);
|
||||
visible: true;
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
to: 'expanded';
|
||||
reversible: true;
|
||||
SequentialAnimation {
|
||||
NumberAnimation { target: speedSlider; property: 'opacity'; duration: 100; }
|
||||
PropertyAction { target: settingsView; property: 'visible'; }
|
||||
NumberAnimation { property: 'height'; duration: 200; }
|
||||
PropertyAction { target: speedSlider; property: 'visible'; }
|
||||
NumberAnimation { target: settingsView; property: 'opacity'; duration: 100; }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
107
resources/qml/Sidebar.qml
Normal file
107
resources/qml/Sidebar.qml
Normal file
|
@ -0,0 +1,107 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
UM.AngledCornerRectangle {
|
||||
id: base;
|
||||
|
||||
property Action addMachineAction;
|
||||
property Action configureMachinesAction;
|
||||
property alias saveAction: saveButton.saveAction;
|
||||
|
||||
cornerSize: UM.Theme.sizes.default_margin.width;
|
||||
|
||||
function showTooltip(item, position, text) {
|
||||
tooltip.text = text;
|
||||
position = item.mapToItem(base, position.x, position.y);
|
||||
tooltip.show(position);
|
||||
}
|
||||
|
||||
function hideTooltip() {
|
||||
tooltip.hide();
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.AllButtons;
|
||||
|
||||
onWheel: {
|
||||
wheel.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent;
|
||||
anchors.topMargin: UM.Theme.sizes.default_margin.height;
|
||||
anchors.bottomMargin: UM.Theme.sizes.window_margin.height;
|
||||
|
||||
spacing: UM.Theme.sizes.default_margin.height;
|
||||
|
||||
SidebarHeader {
|
||||
id: header;
|
||||
|
||||
Layout.fillWidth: true;
|
||||
|
||||
addMachineAction: base.addMachineAction;
|
||||
configureMachinesAction: base.configureMachinesAction;
|
||||
modesModel: modesListModel;
|
||||
|
||||
currentModeIndex: {
|
||||
var index = parseInt(UM.Preferences.getValue('cura/active_mode'))
|
||||
if(index) {
|
||||
return index;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
onCurrentModeIndexChanged: UM.Preferences.setValue('cura/active_mode', currentModeIndex);
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: sidebarContents;
|
||||
|
||||
Layout.fillWidth: true;
|
||||
Layout.fillHeight: true;
|
||||
|
||||
source: modesListModel.get(header.currentModeIndex).file;
|
||||
|
||||
property Item sidebar: base;
|
||||
|
||||
onLoaded:
|
||||
{
|
||||
if(item)
|
||||
{
|
||||
item.configureSettings = base.configureMachinesAction;
|
||||
if(item.onShowTooltip != undefined)
|
||||
{
|
||||
item.showTooltip.connect(base.showTooltip)
|
||||
}
|
||||
if(item.onHideTooltip != undefined)
|
||||
{
|
||||
item.hideTooltip.connect(base.hideTooltip)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SaveButton {
|
||||
id: saveButton;
|
||||
Layout.preferredWidth: base.width - UM.Theme.sizes.default_margin.width * 2;
|
||||
Layout.preferredHeight: UM.Theme.sizes.button.height;
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SidebarTooltip {
|
||||
id: tooltip;
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: modesListModel;
|
||||
ListElement { text: QT_TR_NOOP("Simple"); file: "SidebarSimple.qml" }
|
||||
ListElement { text: QT_TR_NOOP("Advanced"); file: "SidebarAdvanced.qml" }
|
||||
}
|
||||
}
|
3
resources/qml/SidebarAdvanced.qml
Normal file
3
resources/qml/SidebarAdvanced.qml
Normal file
|
@ -0,0 +1,3 @@
|
|||
import UM 1.0 as UM
|
||||
|
||||
UM.SettingView { }
|
118
resources/qml/SidebarHeader.qml
Normal file
118
resources/qml/SidebarHeader.qml
Normal file
|
@ -0,0 +1,118 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
Column {
|
||||
id: base;
|
||||
|
||||
property variant modesModel;
|
||||
property alias currentModeIndex: modeMenu.currentIndex;
|
||||
property Action addMachineAction;
|
||||
property Action configureMachinesAction;
|
||||
|
||||
spacing: UM.Theme.sizes.default_margin.height;
|
||||
|
||||
RowLayout {
|
||||
anchors.horizontalCenter: parent.horizontalCenter;
|
||||
|
||||
width: parent.width - UM.Theme.sizes.default_margin.width * 2;
|
||||
height: UM.Theme.sizes.line.height;
|
||||
|
||||
Label {
|
||||
text: qsTr("Mode:");
|
||||
|
||||
font: UM.Theme.fonts.sidebar_header;
|
||||
color: UM.Theme.colors.text_inactive;
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
text: base.modesModel ? qsTr(base.modesModel.get(modeMenu.currentIndex).text) : "";
|
||||
|
||||
style: UM.Theme.styles.sidebar_header_button;
|
||||
|
||||
Layout.preferredWidth: base.width * 0.25;
|
||||
|
||||
menu: Menu {
|
||||
id: modeMenu;
|
||||
|
||||
property int currentIndex: 0;
|
||||
|
||||
Instantiator {
|
||||
model: base.modesModel;
|
||||
|
||||
MenuItem {
|
||||
text: qsTr(model.text);
|
||||
checkable: true;
|
||||
checked: modeMenu.currentIndex == index;
|
||||
exclusiveGroup: modeMenuGroup;
|
||||
onTriggered: modeMenu.currentIndex = index;
|
||||
}
|
||||
onObjectAdded: modeMenu.insertItem(index, object)
|
||||
onObjectRemoved: modeMenu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: modeMenuGroup; }
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 1;
|
||||
height: parent.height;
|
||||
color: UM.Theme.colors.border;
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr("Machine:");
|
||||
|
||||
font: UM.Theme.fonts.sidebar_header;
|
||||
color: UM.Theme.colors.text_inactive;
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
id: machineButton;
|
||||
text: UM.Application.machineName;
|
||||
tooltip: UM.Application.machineName;
|
||||
|
||||
style: UM.Theme.styles.sidebar_header_button;
|
||||
|
||||
Layout.fillWidth: true;
|
||||
|
||||
menu: Menu {
|
||||
id: machineMenu;
|
||||
Instantiator {
|
||||
model: UM.Models.machinesModel
|
||||
MenuItem {
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.active;
|
||||
exclusiveGroup: machineMenuGroup;
|
||||
onTriggered: UM.Models.machinesModel.setActive(index)
|
||||
}
|
||||
onObjectAdded: machineMenu.insertItem(index, object)
|
||||
onObjectRemoved: machineMenu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: machineMenuGroup; }
|
||||
|
||||
MenuSeparator { }
|
||||
|
||||
MenuItem { action: base.addMachineAction; }
|
||||
MenuItem { action: base.configureMachinesAction; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UM.SidebarCategoryHeader {
|
||||
width: parent.width;
|
||||
height: UM.Theme.sizes.section.height;
|
||||
|
||||
iconSource: UM.Theme.icons.printsetup;
|
||||
text: qsTr("Print Setup");
|
||||
enabled: false;
|
||||
|
||||
color: UM.Theme.colors.primary;
|
||||
}
|
||||
}
|
111
resources/qml/SidebarSimple.qml
Normal file
111
resources/qml/SidebarSimple.qml
Normal file
|
@ -0,0 +1,111 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
Item {
|
||||
id: base;
|
||||
|
||||
anchors.fill: parent;
|
||||
anchors.leftMargin: UM.Theme.sizes.default_margin.width;
|
||||
anchors.rightMargin: UM.Theme.sizes.default_margin.width;
|
||||
|
||||
property Action configureSettings;
|
||||
|
||||
property variant minimumPrintTime: PrintInformation.minimumPrintTime;
|
||||
property variant maximumPrintTime: PrintInformation.maximumPrintTime;
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent;
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true;
|
||||
Layout.preferredHeight: UM.Theme.sizes.section.height;
|
||||
|
||||
Label {
|
||||
anchors.left: parent.left;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
text: base.minimumPrintTime.valid ? base.minimumPrintTime.getDisplayString(UM.DurationFormat.Short) : "??:??";
|
||||
font: UM.Theme.fonts.timeslider_time;
|
||||
color: UM.Theme.colors.primary;
|
||||
}
|
||||
Label {
|
||||
anchors.centerIn: parent;
|
||||
text: {
|
||||
if (UM.Backend.progress < 0)
|
||||
{
|
||||
return qsTr("No Model Loaded");
|
||||
}
|
||||
else if (!base.minimumPrintTime.valid || !base.maximumPrintTime.valid)
|
||||
{
|
||||
return qsTr("Calculating...")
|
||||
}
|
||||
else
|
||||
{
|
||||
return qsTr("Estimated Print Time");
|
||||
}
|
||||
}
|
||||
color: UM.Theme.colors.text;
|
||||
font: UM.Theme.fonts.default;
|
||||
}
|
||||
Label {
|
||||
anchors.right: parent.right;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
text: base.maximumPrintTime.valid ? base.maximumPrintTime.getDisplayString(UM.DurationFormat.Short) : "??:??";
|
||||
font: UM.Theme.fonts.timeslider_time;
|
||||
color: UM.Theme.colors.primary;
|
||||
}
|
||||
}
|
||||
|
||||
Slider {
|
||||
Layout.fillWidth: true;
|
||||
Layout.preferredHeight: UM.Theme.sizes.section.height;
|
||||
|
||||
minimumValue: 0;
|
||||
maximumValue: 100;
|
||||
|
||||
value: PrintInformation.timeQualityValue;
|
||||
onValueChanged: PrintInformation.setTimeQualityValue(value);
|
||||
|
||||
style: UM.Theme.styles.slider;
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true;
|
||||
Layout.preferredHeight: UM.Theme.sizes.section.height;
|
||||
|
||||
Label {
|
||||
anchors.left: parent.left;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
text: qsTr("Minimum\nDraft");
|
||||
color: UM.Theme.colors.text;
|
||||
font: UM.Theme.fonts.default;
|
||||
}
|
||||
|
||||
Label {
|
||||
anchors.right: parent.right;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
text: qsTr("Maximum\nQuality");
|
||||
horizontalAlignment: Text.AlignRight;
|
||||
color: UM.Theme.colors.text;
|
||||
font: UM.Theme.fonts.default;
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
Layout.fillWidth: true;
|
||||
Layout.preferredHeight: UM.Theme.sizes.section.height;
|
||||
|
||||
text: qsTr("Enable Support");
|
||||
|
||||
style: UM.Theme.styles.checkbox;
|
||||
|
||||
checked: Printer.getSettingValue('support_enable');
|
||||
onCheckedChanged: Printer.setSettingValue('support_enable', checked);
|
||||
}
|
||||
|
||||
Item { Layout.fillWidth: true; Layout.fillHeight: true; }
|
||||
}
|
||||
}
|
48
resources/qml/SidebarTooltip.qml
Normal file
48
resources/qml/SidebarTooltip.qml
Normal file
|
@ -0,0 +1,48 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
Rectangle {
|
||||
id: base;
|
||||
|
||||
width: UM.Theme.sizes.tooltip.width;
|
||||
height: label.height + UM.Theme.sizes.tooltip_margins.height * 2;
|
||||
color: UM.Theme.colors.tooltip;
|
||||
|
||||
opacity: 0;
|
||||
Behavior on opacity { NumberAnimation { duration: 100; } }
|
||||
|
||||
property alias text: label.text;
|
||||
|
||||
function show(position) {
|
||||
if(position.y + base.height > parent.height) {
|
||||
x = position.x;
|
||||
y = parent.height - base.height;
|
||||
} else {
|
||||
x = position.x;
|
||||
y = position.y;
|
||||
}
|
||||
base.opacity = 1;
|
||||
}
|
||||
|
||||
function hide() {
|
||||
base.opacity = 0;
|
||||
}
|
||||
|
||||
Label {
|
||||
id: label;
|
||||
anchors {
|
||||
top: parent.top;
|
||||
topMargin: UM.Theme.sizes.tooltip_margins.height;
|
||||
left: parent.left;
|
||||
leftMargin: UM.Theme.sizes.tooltip_margins.width;
|
||||
right: parent.right;
|
||||
rightMargin: UM.Theme.sizes.tooltip_margins.width;
|
||||
}
|
||||
wrapMode: Text.Wrap;
|
||||
font: UM.Theme.fonts.default;
|
||||
}
|
||||
}
|
29
resources/qml/ViewPage.qml
Normal file
29
resources/qml/ViewPage.qml
Normal file
|
@ -0,0 +1,29 @@
|
|||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
UM.PreferencesPage {
|
||||
//: View configuration page title
|
||||
title: qsTr("View");
|
||||
|
||||
function reset()
|
||||
{
|
||||
UM.Preferences.resetPreference('view/show_overhang');
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2;
|
||||
|
||||
CheckBox {
|
||||
checked: UM.Preferences.getValue('view/show_overhang');
|
||||
onCheckedChanged: UM.Preferences.setValue('view/show_overhang', checked)
|
||||
|
||||
//: Display Overhang preference checkbox
|
||||
text: qsTr("Display Overhang");
|
||||
}
|
||||
|
||||
Item { Layout.fillHeight: true; Layout.columnSpan: 2 }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue