mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-05 16:51:12 -07:00
Move all of Cura's QML files into a qml subdir
This commit is contained in:
parent
cfe29a7b51
commit
4a8f6beb26
10 changed files with 2 additions and 2 deletions
73
qml/AddMachineWizard.qml
Normal file
73
qml/AddMachineWizard.qml
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
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
|
||||
|
||||
Window {
|
||||
id: base
|
||||
|
||||
width: 640
|
||||
height: 480
|
||||
|
||||
//: Add Printer dialog title
|
||||
title: qsTr("Add Printer");
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent;
|
||||
color: palette.window;
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent;
|
||||
anchors.margins: UM.Theme.defaultMargin;
|
||||
|
||||
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; }
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Item { Layout.fillWidth: true; }
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SystemPalette { id: palette; colorGroup: SystemPalette.Active }
|
||||
}
|
||||
68
qml/DescriptionPane.qml
Normal file
68
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; }
|
||||
}
|
||||
86
qml/FilePane.qml
Normal file
86
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.Theme.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.Theme.defaultMargin;
|
||||
|
||||
text: model.name;
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea;
|
||||
anchors.fill: parent;
|
||||
|
||||
onClicked: base.openFile(model.url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
105
qml/OutputGCodeButton.qml
Normal file
105
qml/OutputGCodeButton.qml
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
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;
|
||||
|
||||
color: UM.Theme.primaryColor;
|
||||
border.width: 1;
|
||||
border.color: UM.Theme.borderColor;
|
||||
|
||||
signal saveRequested();
|
||||
signal saveToSDRequested();
|
||||
|
||||
Label {
|
||||
id: label;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
anchors.left: parent.left;
|
||||
anchors.right: icon.left;
|
||||
horizontalAlignment: Text.AlignHCenter;
|
||||
font.pointSize: UM.Theme.largeTextSize;
|
||||
color: "white";
|
||||
|
||||
//: Save file to disk button
|
||||
text: qsTr("Save");
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: icon;
|
||||
|
||||
anchors.right: parent.right;
|
||||
anchors.top: parent.top;
|
||||
anchors.bottom: parent.bottom;
|
||||
anchors.margins: 1;
|
||||
|
||||
color: "white";
|
||||
|
||||
width: height;
|
||||
|
||||
Rectangle {
|
||||
anchors { left: parent.left; top: parent.top; bottom: parent.bottom; }
|
||||
width: 1;
|
||||
color: UM.Theme.borderColor;
|
||||
}
|
||||
|
||||
UM.RecolorImage { id: iconImage; anchors.centerIn: parent; width: 32; height: 32; source: UM.Resources.getIcon('save.png'); color: '#000'; }
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent;
|
||||
|
||||
onClicked: {
|
||||
switch(base.state) {
|
||||
case 'sdcard':
|
||||
base.saveToSDRequested();
|
||||
break;
|
||||
default:
|
||||
base.saveRequested();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: 'sdcard';
|
||||
when: Printer.removableDrives.length > 0;
|
||||
PropertyChanges {
|
||||
target: label;
|
||||
//: Write to SD card button
|
||||
text: qsTr("Write to SD");
|
||||
}
|
||||
PropertyChanges { target: iconImage; source: UM.Resources.getIcon('sdcard.png'); }
|
||||
},
|
||||
State {
|
||||
name: 'usb';
|
||||
PropertyChanges {
|
||||
target: label
|
||||
//: Send print over USB button
|
||||
text: qsTr("Send over USB");
|
||||
}
|
||||
PropertyChanges { target: iconImage; source: UM.Resources.getIcon('usb.png'); }
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
SequentialAnimation {
|
||||
ParallelAnimation {
|
||||
NumberAnimation { target: label; property: 'opacity'; to: 0; duration: 250; }
|
||||
NumberAnimation { target: iconImage; property: 'opacity'; to: 0; duration: 250; }
|
||||
}
|
||||
PropertyAction { target: label; property: 'text'; }
|
||||
PropertyAction { target: iconImage; property: 'source'; }
|
||||
ParallelAnimation {
|
||||
NumberAnimation { target: label; property: 'opacity'; to: 1; duration: 250; }
|
||||
NumberAnimation { target: iconImage; property: 'opacity'; to: 1; duration: 250; }
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
334
qml/Printer.qml
Normal file
334
qml/Printer.qml
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
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.settings; }
|
||||
}
|
||||
|
||||
Menu {
|
||||
//: Extensions menu
|
||||
title: qsTr("E&xtensions");
|
||||
|
||||
//: Empty extensions menu
|
||||
MenuItem { text: qsTr("No extensions loaded"); enabled: false; }
|
||||
}
|
||||
|
||||
Menu {
|
||||
//: Settings menu
|
||||
title: qsTr("&Settings");
|
||||
|
||||
MenuItem { action: actions.preferences; }
|
||||
}
|
||||
|
||||
Menu {
|
||||
//: Help menu
|
||||
title: qsTr("&Help");
|
||||
|
||||
MenuItem { action: actions.help; }
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PrinterToolbar {
|
||||
id: toolbar;
|
||||
|
||||
anchors {
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
top: parent.top;
|
||||
}
|
||||
|
||||
undo: actions.undo;
|
||||
redo: actions.redo;
|
||||
settings: actions.settings;
|
||||
}
|
||||
|
||||
FilePane {
|
||||
id: files;
|
||||
|
||||
anchors.left: parent.left;
|
||||
anchors.leftMargin: UM.Theme.windowLeftMargin;
|
||||
anchors.top: toolbar.bottom;
|
||||
anchors.topMargin: -1;
|
||||
|
||||
border.width: 1;
|
||||
border.color: UM.Theme.borderColor;
|
||||
|
||||
width: UM.Theme.panelWidth;
|
||||
height: base.height / 2 - UM.Theme.toolbarHeight;
|
||||
|
||||
onRequestOpenFile: actions.open.trigger();
|
||||
onOpenFile: UM.Controller.addMesh(file);
|
||||
}
|
||||
|
||||
SettingsPane {
|
||||
id: settings;
|
||||
|
||||
anchors.right: parent.right;
|
||||
anchors.rightMargin: UM.Theme.windowRightMargin;
|
||||
anchors.top: toolbar.bottom;
|
||||
anchors.topMargin: -1;
|
||||
|
||||
border.width: 1;
|
||||
border.color: UM.Theme.borderColor;
|
||||
|
||||
width: UM.Theme.panelWidth;
|
||||
|
||||
expandedHeight: base.height;
|
||||
|
||||
onShowDescription: {
|
||||
descriptionPane.show(text, x, y - contentItem.y);
|
||||
}
|
||||
}
|
||||
|
||||
OutputGCodeButton {
|
||||
anchors.right: parent.right;
|
||||
anchors.rightMargin: UM.Theme.windowRightMargin;
|
||||
|
||||
anchors.bottom: parent.bottom;
|
||||
anchors.bottomMargin: -1;
|
||||
|
||||
width: UM.Theme.panelWidth;
|
||||
height: 40;
|
||||
|
||||
onSaveRequested: actions.save.trigger();
|
||||
onSaveToSDRequested: Printer.saveToSD()
|
||||
}
|
||||
|
||||
UM.MessageStack {
|
||||
anchors.bottom: parent.bottom;
|
||||
anchors.horizontalCenter: parent.horizontalCenter;
|
||||
width: parent.width * 0.333;
|
||||
height: 250;
|
||||
}
|
||||
|
||||
DescriptionPane {
|
||||
id: descriptionPane;
|
||||
anchors.right: settings.left;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UM.PreferencesDialog {
|
||||
id: preferences
|
||||
|
||||
Component.onCompleted: {
|
||||
insertPage(1, qsTr('View'), 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;
|
||||
settings.onTriggered: { preferences.visible = true; preferences.setPage(1); }
|
||||
}
|
||||
|
||||
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.Modal;
|
||||
//TODO: Support multiple file selection, workaround bug in KDE file dialog
|
||||
//selectMultiple: true
|
||||
|
||||
nameFilters: UM.MeshFileHandler.supportedReadFileTypes;
|
||||
|
||||
onAccepted:
|
||||
{
|
||||
UM.MeshFileHandler.readLocalFile(fileUrl)
|
||||
files.setDirectory(fileUrl)
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: saveDialog;
|
||||
//: File save dialog title
|
||||
title: qsTr("Save File");
|
||||
selectExisting: false;
|
||||
|
||||
modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.Modal;
|
||||
|
||||
nameFilters: UM.MeshFileHandler.supportedWriteFileTypes
|
||||
|
||||
onAccepted:
|
||||
{
|
||||
UM.MeshFileHandler.writeLocalFile(fileUrl);
|
||||
}
|
||||
}
|
||||
|
||||
AddMachineWizard {
|
||||
id: addMachine;
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Printer
|
||||
onRequestAddPrinter: addMachine.visible = true;
|
||||
}
|
||||
}
|
||||
164
qml/PrinterActions.qml
Normal file
164
qml/PrinterActions.qml
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
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 settings: settingsAction;
|
||||
|
||||
property alias preferences: preferencesAction;
|
||||
property alias help: helpAction;
|
||||
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: helpAction;
|
||||
//: Show Manual action
|
||||
text: qsTr("Show Manual");
|
||||
iconName: "help-contents";
|
||||
shortcut: StandardKey.Help;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
160
qml/PrinterToolbar.qml
Normal file
160
qml/PrinterToolbar.qml
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
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.Toolbar {
|
||||
id: base;
|
||||
|
||||
property Action undo;
|
||||
property Action redo;
|
||||
property Action settings;
|
||||
|
||||
Item { width: UM.Theme.windowLeftMargin; }
|
||||
|
||||
Item {
|
||||
width: UM.Theme.panelWidth;
|
||||
Image { anchors.centerIn: parent; source: UM.Resources.getIcon("cura_logo.png"); }
|
||||
}
|
||||
|
||||
Item { width: UM.Theme.toolbarSpacing; }
|
||||
|
||||
ToolButton { style: UM.ToolbarButtonStyle { } action: base.undo; iconSource: UM.Resources.getIcon('undo.png'); }
|
||||
ToolButton { style: UM.ToolbarButtonStyle { } action: base.redo; iconSource: UM.Resources.getIcon('redo.png'); }
|
||||
|
||||
// Item { width: 10; }
|
||||
|
||||
// ToolButton { text: "3D"; onClicked: UM.Scene.setActiveCamera('3d'); }
|
||||
// ToolButton { text: "Left"; onClicked: UM.Scene.setActiveCamera('left'); }
|
||||
// ToolButton { text: "Top"; onClicked: UM.Scene.setActiveCamera('top'); }
|
||||
// ToolButton { text: "Front"; onClicked: UM.Scene.setActiveCamera('front'); }
|
||||
|
||||
Item { Layout.fillWidth: true; }
|
||||
|
||||
Repeater {
|
||||
id: repeat
|
||||
|
||||
model: UM.Models.toolModel
|
||||
|
||||
ToolButton {
|
||||
style: UM.ToolbarButtonStyle { }
|
||||
|
||||
text: model.name;
|
||||
iconSource: UM.Resources.getIcon(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item { Layout.fillWidth: true; }
|
||||
|
||||
ToolButton {
|
||||
//: View Mode toolbar button
|
||||
text: qsTr("View Mode");
|
||||
iconSource: UM.Resources.getIcon("viewmode.png");
|
||||
|
||||
style: UM.ToolbarButtonStyle { }
|
||||
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
||||
Item { width: UM.Theme.toolbarSpacing; }
|
||||
|
||||
ToolButton {
|
||||
id: machineButton;
|
||||
width: UM.Theme.panelWidth - UM.Theme.toolbarButtonWidth - 1;
|
||||
height: UM.Theme.toolbarButtonHeight;
|
||||
text: UM.Application.machineName;
|
||||
|
||||
style: UM.ToolbarButtonStyle {
|
||||
backgroundColor: "white";
|
||||
backgroundHighlightColor: "#eee";
|
||||
|
||||
label: Item {
|
||||
anchors.fill: parent;
|
||||
Label {
|
||||
anchors {
|
||||
top: parent.top;
|
||||
topMargin: 2;
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
}
|
||||
text: control.text;
|
||||
elide: Text.ElideRight;
|
||||
fontSizeMode: Text.HorizontalFit;
|
||||
minimumPointSize: UM.Theme.smallTextSize;
|
||||
font.pointSize: UM.Theme.largeTextSize;
|
||||
|
||||
verticalAlignment: Text.AlignBottom;
|
||||
}
|
||||
Label {
|
||||
anchors.bottom: parent.bottom;
|
||||
anchors.bottomMargin: 2;
|
||||
anchors.left: parent.left;
|
||||
//: Machine toolbar button
|
||||
text: qsTr("Machine");
|
||||
font.pointSize: UM.Theme.tinyTextSize;
|
||||
font.capitalization: Font.AllUppercase;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
style: UM.ToolbarButtonStyle {
|
||||
backgroundColor: "white";
|
||||
foregroundColor: "black";
|
||||
backgroundHighlightColor: "#eee";
|
||||
foregroundHighlightColor: "black";
|
||||
}
|
||||
action: base.settings;
|
||||
iconSource: UM.Resources.getIcon("settings.png");
|
||||
}
|
||||
|
||||
Item { width: UM.Theme.windowRightMargin; }
|
||||
}
|
||||
194
qml/SettingsPane.qml
Normal file
194
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.Theme.defaultMargin;
|
||||
|
||||
anchors {
|
||||
left: parent.left;
|
||||
leftMargin: UM.Theme.defaultMargin;
|
||||
right: parent.right;
|
||||
rightMargin: UM.Theme.defaultMargin;
|
||||
}
|
||||
|
||||
//: Print Settings panel title
|
||||
Label { text: qsTr("Print Settings"); width: parent.width; font.capitalization: Font.AllUppercase; font.pointSize: UM.Theme.smallTextSize; }
|
||||
|
||||
Item {
|
||||
width: parent.width;
|
||||
height: 24;
|
||||
|
||||
Row {
|
||||
anchors.fill: parent;
|
||||
spacing: UM.Theme.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.Theme.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.Theme.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; }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
23
qml/ViewPage.qml
Normal file
23
qml/ViewPage.qml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.0 as UM
|
||||
|
||||
UM.PreferencesPage {
|
||||
//: General configuration page title
|
||||
title: qsTr("View");
|
||||
|
||||
GridLayout {
|
||||
columns: 2;
|
||||
|
||||
CheckBox {
|
||||
checked: UM.Preferences.getValue('view/show_overhang');
|
||||
onCheckedChanged: UM.Preferences.setValue('view/show_overhang', checked)
|
||||
|
||||
text: qsTr("Display overhang");
|
||||
}
|
||||
|
||||
Item { Layout.fillHeight: true; Layout.columnSpan: 2 }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue