Browse Source

Prepare "Add profile" dialog

fieldOfView 9 years ago
parent
commit
f97e2fa6aa

+ 7 - 0
resources/qml/Actions.qml

@@ -31,6 +31,7 @@ Item
 
     property alias addMachine: addMachineAction;
     property alias configureMachines: settingsAction;
+    property alias addProfile: addProfileAction;
     property alias manageProfiles: manageProfilesAction;
 
     property alias preferences: preferencesAction;
@@ -95,6 +96,12 @@ Item
         iconName: "configure";
     }
 
+    Action
+    {
+        id: addProfileAction;
+        text: catalog.i18nc("@action:inmenu menubar:profile","&Add Profile...");
+    }
+
     Action
     {
         id: manageProfilesAction;

+ 36 - 0
resources/qml/AddProfileDialog.qml

@@ -0,0 +1,36 @@
+// Copyright (c) 2015 Ultimaker B.V.
+// Cura is released under the terms of the AGPLv3 or higher.
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Window 2.1
+
+import UM 1.1 as UM
+
+UM.Dialog
+{
+    id: base
+
+    //: About dialog title
+    title: catalog.i18nc("@title:window","Add profile")
+    width: 400
+    height: childrenRect.height
+
+    rightButtons: Row
+    {
+        spacing: UM.Theme.sizes.default_margin.width
+
+        Button
+        {
+            text: catalog.i18nc("@action:button","Add");
+            isDefault: true
+        }
+        Button
+        {
+            text: catalog.i18nc("@action:button","Cancel");
+
+            onClicked: base.visible = false;
+        }
+    }
+}
+

+ 12 - 0
resources/qml/Cura.qml

@@ -230,6 +230,7 @@ UM.MainWindow
 
                 MenuSeparator { }
 
+                MenuItem { action: actions.addProfile; }
                 MenuItem { action: actions.manageProfiles; }
             }
 
@@ -461,6 +462,7 @@ UM.MainWindow
 
                 addMachineAction: actions.addMachine;
                 configureMachinesAction: actions.configureMachines;
+                addProfileAction: actions.addProfile;
                 manageProfilesAction: actions.manageProfiles;
             }
 
@@ -578,6 +580,7 @@ UM.MainWindow
         reloadAll.onTriggered: Printer.reloadAll()
 
         addMachine.onTriggered: addMachineWizard.visible = true;
+        addProfile.onTriggered: addProfileDialog.visible = true;
 
         preferences.onTriggered: { preferences.visible = true; preferences.setPage(0); }
         configureMachines.onTriggered: { preferences.visible = true; preferences.setPage(3); }
@@ -670,6 +673,15 @@ UM.MainWindow
         id: addMachineWizard
     }
 
+    AddProfileDialog
+    {
+        id: addProfileDialog
+    }
+
+    LoadProfileDialog
+    {
+        id: loadProfileDialog
+    }
 
     AboutDialog
     {

+ 4 - 26
resources/qml/ProfileSetup.qml

@@ -13,6 +13,7 @@ Item{
     UM.I18nCatalog { id: catalog; name:"cura"}
     property int totalHeightProfileSetup: childrenRect.height
     property Action manageProfilesAction
+    property Action addProfileAction
 
     Rectangle{
         id: globalProfileRow
@@ -63,36 +64,13 @@ Item{
                 ExclusiveGroup { id: profileSelectionMenuGroup; }
 
                 MenuSeparator { }
+                MenuItem {
+                    action: base.addProfileAction;
+                }
                 MenuItem {
                     action: base.manageProfilesAction;
-
                 }
             }
-//             Button {
-//                 id: saveProfileButton
-//                 visible: true
-//                 anchors.top: parent.top
-//                 x: globalProfileSelection.width + 2
-//                 width: parent.width/100*25
-//                 text: catalog.i18nc("@action:button", "Save");
-//                 height: parent.height
-//
-//                 style: ButtonStyle {
-//                     background: Rectangle {
-//                         color: control.hovered ? UM.Theme.colors.load_save_button_hover : UM.Theme.colors.load_save_button
-//                         Behavior on color { ColorAnimation { duration: 50; } }
-//                         width: actualLabel.width + UM.Theme.sizes.default_margin.width
-//                         Label {
-//                             id: actualLabel
-//                             anchors.centerIn: parent
-//                             color: UM.Theme.colors.load_save_button_text
-//                             font: UM.Theme.fonts.default
-//                             text: control.text;
-//                         }
-//                     }
-//                 label: Item { }
-//                 }
-//             }
         }
     }
 }

+ 2 - 0
resources/qml/Sidebar.qml

@@ -14,6 +14,7 @@ Rectangle
 
     property Action addMachineAction;
     property Action configureMachinesAction;
+    property Action addProfileAction;
     property Action manageProfilesAction;
     property int currentModeIndex;
 
@@ -63,6 +64,7 @@ Rectangle
 
     ProfileSetup {
         id: profileItem
+        addProfileAction: base.addProfileAction
         manageProfilesAction: base.manageProfilesAction
         anchors.top: settingsModeSelection.bottom
         anchors.topMargin: UM.Theme.sizes.default_margin.height