Browse Source

Fix merge conflicts

Lipu Fei 6 years ago
parent
commit
f94344263b

+ 8 - 0
cura/CuraApplication.py

@@ -112,6 +112,7 @@ from cura.UI import CuraSplashScreen, MachineActionManager, PrintInformation
 from cura.UI.MachineSettingsManager import MachineSettingsManager
 from cura.UI.ObjectsModel import ObjectsModel
 from cura.UI.TextManager import TextManager
+from cura.UI.AddPrinterPagesModel import AddPrinterPagesModel
 from cura.UI.WelcomePagesModel import WelcomePagesModel
 
 from .SingleInstance import SingleInstance
@@ -217,6 +218,7 @@ class CuraApplication(QtApplication):
         self._discovered_printer_model = DiscoveredPrintersModel(self)
         self._first_start_machine_actions_model = FirstStartMachineActionsModel(self)
         self._welcome_pages_model = WelcomePagesModel(self)
+        self._add_printer_pages_model = AddPrinterPagesModel(self)
         self._text_manager = TextManager(self)
 
         self._quality_profile_drop_down_menu_model = None
@@ -762,6 +764,7 @@ class CuraApplication(QtApplication):
 
         self._output_device_manager.start()
         self._welcome_pages_model.initialize()
+        self._add_printer_pages_model.initialize()
 
         # Detect in which mode to run and execute that mode
         if self._is_headless:
@@ -873,6 +876,10 @@ class CuraApplication(QtApplication):
     def getWelcomePagesModel(self, *args) -> "WelcomePagesModel":
         return self._welcome_pages_model
 
+    @pyqtSlot(result = QObject)
+    def getAddPrinterPagesModel(self, *args) -> "AddPrinterPagesModel":
+        return self._add_printer_pages_model
+
     @pyqtSlot(result = QObject)
     def getMachineSettingsManager(self, *args) -> "MachineSettingsManager":
         return self._machine_settings_manager
@@ -1014,6 +1021,7 @@ class CuraApplication(QtApplication):
         qmlRegisterSingletonType(MachineActionManager.MachineActionManager, "Cura", 1, 0, "MachineActionManager", self.getMachineActionManager)
 
         qmlRegisterType(WelcomePagesModel, "Cura", 1, 0, "WelcomePagesModel")
+        qmlRegisterType(AddPrinterPagesModel, "Cura", 1, 0, "AddPrinterPagesModel")
         qmlRegisterType(TextManager, "Cura", 1, 0, "TextManager")
 
         qmlRegisterType(NetworkMJPGImage, "Cura", 1, 0, "NetworkMJPGImage")

+ 30 - 0
cura/UI/AddPrinterPagesModel.py

@@ -0,0 +1,30 @@
+# Copyright (c) 2019 Ultimaker B.V.
+# Cura is released under the terms of the LGPLv3 or higher.
+
+from .WelcomePagesModel import WelcomePagesModel
+
+
+#
+# This Qt ListModel is more or less the same the WelcomePagesModel, except that this model is only for adding a printer,
+# so only the steps for adding a printer is included.
+#
+class AddPrinterPagesModel(WelcomePagesModel):
+
+    def initialize(self) -> None:
+        self._pages.append({"id": "add_network_or_local_printer",
+                            "page_url": self._getBuiltinWelcomePagePath("AddNetworkOrLocalPrinterContent.qml"),
+                            "next_page_id": "machine_actions",
+                            "next_page_button_text": self._catalog.i18nc("@action:button", "Add"),
+                            })
+        self._pages.append({"id": "add_printer_by_ip",
+                            "page_url": self._getBuiltinWelcomePagePath("AddPrinterByIpContent.qml"),
+                            "next_page_id": "machine_actions",
+                            })
+        self._pages.append({"id": "machine_actions",
+                            "page_url": self._getBuiltinWelcomePagePath("FirstStartMachineActionsContent.qml"),
+                            "should_show_function": self.shouldShowMachineActions,
+                            })
+        self.setItems(self._pages)
+
+
+__all__ = ["AddPrinterPagesModel"]

+ 19 - 1
cura/UI/WelcomePagesModel.py

@@ -6,6 +6,7 @@ from typing import TYPE_CHECKING, Optional, List, Dict, Any
 
 from PyQt5.QtCore import QUrl, Qt, pyqtSlot, pyqtProperty, pyqtSignal
 
+from UM.i18n import i18nCatalog
 from UM.Logger import Logger
 from UM.Qt.ListModel import ListModel
 from UM.Resources import Resources
@@ -23,6 +24,9 @@ if TYPE_CHECKING:
 #  - page_url     : The QUrl to the QML file that contains the content of this page
 #  - next_page_id : (OPTIONAL) The next page ID to go to when this page finished. This is optional. If this is not
 #                   provided, it will go to the page with the current index + 1
+#  - next_page_button_text: (OPTIONAL) The text to show for the "next" button, by default it's the translated text of
+#                           "Next". Note that each step QML can decide whether to use this text or not, so it's not
+#                           mandatory.
 #  - should_show_function : (OPTIONAL) An optional function that returns True/False indicating if this page should be
 #                           shown. By default all pages should be shown. If a function returns False, that page will
 #                           be skipped and its next page will be shown.
@@ -34,6 +38,7 @@ class WelcomePagesModel(ListModel):
     IdRole = Qt.UserRole + 1  # Page ID
     PageUrlRole = Qt.UserRole + 2  # URL to the page's QML file
     NextPageIdRole = Qt.UserRole + 3  # The next page ID it should go to
+    NextPageButtonTextRole = Qt.UserRole + 4  # The text for the next page button
 
     def __init__(self, application: "CuraApplication", parent: Optional["QObject"] = None) -> None:
         super().__init__(parent)
@@ -41,8 +46,12 @@ class WelcomePagesModel(ListModel):
         self.addRoleName(self.IdRole, "id")
         self.addRoleName(self.PageUrlRole, "page_url")
         self.addRoleName(self.NextPageIdRole, "next_page_id")
+        self.addRoleName(self.NextPageButtonTextRole, "next_page_button_text")
 
         self._application = application
+        self._catalog = i18nCatalog("cura")
+
+        self._default_next_button_text = self._catalog.i18nc("@action:button", "Next")
 
         self._pages = []  # type: List[Dict[str, Any]]
 
@@ -137,7 +146,8 @@ class WelcomePagesModel(ListModel):
         page_index = self.getPageIndexById(page_id)
         if page_index is None:
             # FIXME: If we cannot find the next page, we cannot do anything here.
-            Logger.log("e", "Cannot find page with ID [%s]", page_index)
+            Logger.log("e", "Cannot find page with ID [%s], go to the next page by default", page_index)
+            self.goToNextPage()
             return
 
         if self._shouldPageBeShown(page_index):
@@ -212,6 +222,14 @@ class WelcomePagesModel(ListModel):
 
         self.setItems(self._pages)
 
+    # For convenience, inject the default "next" button text to each item if it's not present.
+    def setItems(self, items: List[Dict[str, Any]]) -> None:
+        for item in items:
+            if "next_page_button_text" not in item:
+                item["next_page_button_text"] = self._default_next_button_text
+
+        super().setItems(items)
+
     # Indicates if the machine action panel should be shown by checking if there's any first start machine actions
     # available.
     def shouldShowMachineActions(self) -> bool:

+ 2 - 2
plugins/UltimakerMachineActions/UM2UpgradeSelectionMachineAction.qml

@@ -23,11 +23,11 @@ Cura.MachineAction
         Label
         {
             id: pageDescription
-            anchors.top: pageTitle.bottom
+            anchors.top: parent.top
             anchors.topMargin: UM.Theme.getSize("default_margin").height
             width: parent.width
             wrapMode: Text.WordWrap
-            text: catalog.i18nc("@label","Please select any upgrades made to this Ultimaker 2.")
+            text: catalog.i18nc("@label", "Please select any upgrades made to this Ultimaker 2.")
             font: UM.Theme.getFont("medium")
             renderType: Text.NativeRendering
         }

+ 26 - 64
resources/qml/Cura.qml

@@ -46,7 +46,7 @@ UM.MainWindow
     {
         id: greyOutBackground
         anchors.fill: parent
-        visible: welcomeDialog.visible
+        visible: welcomeDialogItem.visible
         color: UM.Theme.getColor("window_disabled_background")
         opacity: 0.7
         z: stageMenu.z + 1
@@ -61,9 +61,9 @@ UM.MainWindow
         }
     }
 
-    WelcomeDialog
+    WelcomeDialogItem
     {
-        id: welcomeDialog
+        id: welcomeDialogItem
         visible: true  // True, so if somehow no preferences are found/loaded, it's shown anyway.
         z: greyOutBackground.z + 1
     }
@@ -86,11 +86,11 @@ UM.MainWindow
 
         if (CuraApplication.needToShowUserAgreement)
         {
-            welcomeDialog.visible = true
+            welcomeDialogItem.visible = true
         }
         else
         {
-            welcomeDialog.visible = false
+            welcomeDialogItem.visible = false
         }
         // TODO: While the new onboarding process contains the user-agreement,
         //       it should probably not entirely rely on 'needToShowUserAgreement' for show/hide.
@@ -731,44 +731,6 @@ UM.MainWindow
         }
     }
 
-    AddMachineDialog
-    {
-        id: addMachineDialog
-        onMachineAdded:
-        {
-            machineActionsWizard.firstRun = addMachineDialog.firstRun
-            machineActionsWizard.start(id)
-        }
-    }
-
-    // Dialog to handle first run machine actions
-    UM.Wizard
-    {
-        id: machineActionsWizard;
-
-        title: catalog.i18nc("@title:window", "Add Printer")
-        property var machine;
-
-        function start(id)
-        {
-            var actions = Cura.MachineActionManager.getFirstStartActions(id)
-            resetPages() // Remove previous pages
-
-            for (var i = 0; i < actions.length; i++)
-            {
-                actions[i].displayItem.reset()
-                machineActionsWizard.appendPage(actions[i].displayItem, catalog.i18nc("@title", actions[i].label));
-            }
-
-            //Only start if there are actions to perform.
-            if (actions.length > 0)
-            {
-                machineActionsWizard.currentPage = 0;
-                show()
-            }
-        }
-    }
-
     MessageDialog
     {
         id: messageDialog
@@ -812,10 +774,24 @@ UM.MainWindow
         }
     }
 
+    Cura.WizardDialog
+    {
+        id: addMachineDialog
+        title: catalog.i18nc("@title:window", "Add Printer")
+        model: CuraApplication.getAddPrinterPagesModel()
+        progressBarVisible: false
+    }
+
     Connections
     {
         target: Cura.Actions.addMachine
-        onTriggered: addMachineDialog.visible = true;
+        onTriggered: addMachineDialog.show()
+    }
+
+    Connections
+    {
+        target: CuraApplication
+        onRequestAddPrinter: addMachineDialog.show()
     }
 
     AboutDialog
@@ -829,31 +805,17 @@ UM.MainWindow
         onTriggered: aboutDialog.visible = true;
     }
 
-    Connections
-    {
-        target: CuraApplication
-        onRequestAddPrinter:
-        {
-            addMachineDialog.visible = true
-            addMachineDialog.firstRun = false
-        }
-    }
-
     Timer
     {
-        id: startupTimer;
-        interval: 100;
-        repeat: false;
-        running: true;
+        id: startupTimer
+        interval: 100
+        repeat: false
+        running: true
         onTriggered:
         {
-            if(!base.visible)
-            {
-                base.visible = true;
-            }
-            if(!CuraApplication.needToShowUserAgreement && Cura.MachineManager.activeMachine == null)
+            if (!base.visible)
             {
-                addMachineDialog.open();
+                base.visible = true
             }
         }
     }

+ 0 - 321
resources/qml/Dialogs/AddMachineDialog.qml

@@ -1,321 +0,0 @@
-// Copyright (c) 2019 Ultimaker B.V.
-// Cura is released under the terms of the LGPLv3 or higher.
-
-import QtQuick 2.2
-import QtQuick.Controls 1.1
-import QtQuick.Layouts 1.1
-import QtQuick.Window 2.1
-
-import QtQuick.Controls.Styles 1.1
-
-import UM 1.2 as UM
-import Cura 1.0 as Cura
-
-
-UM.Dialog
-{
-    id: base
-    title: catalog.i18nc("@title:window", "Add Printer")
-    property bool firstRun: false
-    property string preferredCategory: "Ultimaker"
-    property string activeCategory: preferredCategory
-
-    minimumWidth: UM.Theme.getSize("modal_window_minimum").width
-    minimumHeight: UM.Theme.getSize("modal_window_minimum").height
-    width: minimumWidth
-    height: minimumHeight
-
-    flags:
-    {
-        var window_flags = Qt.Dialog | Qt.CustomizeWindowHint | Qt.WindowTitleHint;
-        if (Cura.MachineManager.activeDefinitionId !== "") //Disallow closing the window if we have no active printer yet. You MUST add a printer.
-        {
-            window_flags |= Qt.WindowCloseButtonHint;
-        }
-        return window_flags;
-    }
-
-    onVisibilityChanged:
-    {
-        // Reset selection and machine name
-        if (visible)
-        {
-            activeCategory = preferredCategory;
-            machineList.currentIndex = 0;
-            machineName.text = getMachineName();
-        }
-    }
-
-    signal machineAdded(string id)
-
-    function getMachineName()
-    {
-        if (machineList.model.getItem(machineList.currentIndex) != undefined)
-        {
-            return machineList.model.getItem(machineList.currentIndex).name;
-        }
-        return  "";
-    }
-
-    function getMachineMetaDataEntry(key)
-    {
-        if (machineList.model.getItem(machineList.currentIndex) != undefined)
-        {
-            return machineList.model.getItem(machineList.currentIndex).metadata[key];
-        }
-        return  "";
-    }
-
-    Label
-    {
-        id: titleLabel
-
-        anchors
-        {
-            top: parent.top
-            left: parent.left
-            topMargin: UM.Theme.getSize("default_margin").height
-        }
-        text: catalog.i18nc("@title:tab", "Add a printer to Cura")
-
-        font.pointSize: 18
-    }
-
-    Label
-    {
-        id: captionLabel
-        anchors
-        {
-            left: parent.left
-            top: titleLabel.bottom
-            topMargin: UM.Theme.getSize("default_margin").height
-        }
-        text: catalog.i18nc("@title:tab", "Select the printer you want to use from the list below.\n\nIf your printer is not in the list, use the \"Custom FFF Printer\" from the \"Custom\" category and adjust the settings to match your printer in the next dialog.")
-        width: parent.width
-        wrapMode: Text.WordWrap
-    }
-
-    ScrollView
-    {
-        id: machinesHolder
-
-        anchors
-        {
-            top: captionLabel.visible ? captionLabel.bottom : parent.top;
-            topMargin: captionLabel.visible ? UM.Theme.getSize("default_margin").height : 0;
-            bottom: addPrinterButton.top;
-            bottomMargin: UM.Theme.getSize("default_margin").height
-        }
-
-        width: Math.round(parent.width * 0.45)
-
-        frameVisible: true;
-        Rectangle
-        {
-            parent: viewport
-            anchors.fill: parent
-            color: palette.light
-        }
-
-        ListView
-        {
-            id: machineList
-
-            model: UM.DefinitionContainersModel
-            {
-                id: machineDefinitionsModel
-                filter: { "visible": true }
-                sectionProperty: "category"
-                preferredSectionValue: preferredCategory
-            }
-
-            section.property: "section"
-            section.delegate: Button
-            {
-                id: machineSectionButton
-                text: section
-                width: machineList.width
-                style: ButtonStyle
-                {
-                    background: Item
-                    {
-                        height: UM.Theme.getSize("standard_list_lineheight").height
-                        width: machineList.width
-                    }
-                    label: Label
-                    {
-                        anchors.left: parent.left
-                        anchors.leftMargin: UM.Theme.getSize("standard_arrow").width + UM.Theme.getSize("default_margin").width
-                        text: control.text
-                        color: palette.windowText
-                        font.bold: true
-                        UM.RecolorImage
-                        {
-                            id: downArrow
-                            anchors.verticalCenter: parent.verticalCenter
-                            anchors.right: parent.left
-                            anchors.rightMargin: UM.Theme.getSize("default_margin").width
-                            width: UM.Theme.getSize("standard_arrow").width
-                            height: UM.Theme.getSize("standard_arrow").height
-                            sourceSize.height: width
-                            color: palette.windowText
-                            source: base.activeCategory == section ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_right")
-                        }
-                    }
-                }
-
-                onClicked:
-                {
-                    base.activeCategory = section;
-                    if (machineList.model.getItem(machineList.currentIndex).section != section)
-                    {
-                        // Find the first machine from this section
-                        for(var i = 0; i < machineList.model.count; i++)
-                        {
-                            var item = machineList.model.getItem(i);
-                            if (item.section == section)
-                            {
-                                machineList.currentIndex = i;
-                                break;
-                            }
-                        }
-                    }
-                    machineName.text = getMachineName();
-                }
-            }
-
-            delegate: RadioButton
-            {
-                id: machineButton
-
-                anchors.left: parent.left
-                anchors.leftMargin: UM.Theme.getSize("standard_list_lineheight").width
-
-                opacity: 1;
-                height: UM.Theme.getSize("standard_list_lineheight").height;
-
-                checked: ListView.isCurrentItem;
-
-                exclusiveGroup: printerGroup;
-
-                text: model.name
-
-                onClicked:
-                {
-                    ListView.view.currentIndex = index;
-                    machineName.text = getMachineName()
-                }
-
-                states: State
-                {
-                    name: "collapsed";
-                    when: base.activeCategory != model.section;
-
-                    PropertyChanges { target: machineButton; opacity: 0; height: 0; }
-                }
-            }
-        }
-    }
-
-    Column
-    {
-        anchors
-        {
-            top: machinesHolder.top
-            left: machinesHolder.right
-            right: parent.right
-            leftMargin: UM.Theme.getSize("default_margin").width
-        }
-
-        spacing: UM.Theme.getSize("default_margin").height
-        Label
-        {
-            width: parent.width
-            wrapMode: Text.WordWrap
-            text: getMachineName()
-            font.pointSize: 16
-            elide: Text.ElideRight
-        }
-        Grid
-        {
-            width: parent.width
-            columns: 2
-            rowSpacing: UM.Theme.getSize("default_lining").height
-            columnSpacing: UM.Theme.getSize("default_margin").width
-            verticalItemAlignment: Grid.AlignVCenter
-
-            Label
-            {
-                wrapMode: Text.WordWrap
-                text: catalog.i18nc("@label", "Manufacturer")
-            }
-            Label
-            {
-                width: Math.floor(parent.width * 0.65)
-                wrapMode: Text.WordWrap
-                text: getMachineMetaDataEntry("manufacturer")
-            }
-            Label
-            {
-                wrapMode: Text.WordWrap
-                text: catalog.i18nc("@label", "Author")
-            }
-            Label
-            {
-                width: Math.floor(parent.width * 0.75)
-                wrapMode: Text.WordWrap
-                text: getMachineMetaDataEntry("author")
-            }
-            Label
-            {
-                wrapMode: Text.WordWrap
-                text: catalog.i18nc("@label", "Printer Name")
-            }
-            TextField
-            {
-                id: machineName
-                text: getMachineName()
-                width: Math.floor(parent.width * 0.75)
-                maximumLength: 40
-                //validator: Cura.MachineNameValidator { } //TODO: Gives a segfault in PyQt5.6. For now, we must use a signal on text changed.
-                validator: RegExpValidator
-                {
-                    regExp: {
-                        machineName.machine_name_validator.machineNameRegex
-                    }
-                }
-                property var machine_name_validator: Cura.MachineNameValidator { }
-            }
-        }
-    }
-
-    Button
-    {
-        id: addPrinterButton
-        text: catalog.i18nc("@action:button", "Add Printer")
-        anchors.bottom: parent.bottom
-        anchors.right: parent.right
-        onClicked: addMachine()
-    }
-
-    onAccepted: addMachine()
-
-    function addMachine()
-    {
-        base.visible = false
-        var item = machineList.model.getItem(machineList.currentIndex);
-        Cura.MachineManager.addMachine(item.id, machineName.text)
-        base.machineAdded(item.id) // Emit signal that the user added a machine.
-    }
-
-    Item
-    {
-        UM.I18nCatalog
-        {
-            id: catalog;
-            name: "cura";
-        }
-        SystemPalette { id: palette }
-        ExclusiveGroup { id: printerGroup; }
-    }
-}

+ 146 - 78
resources/qml/WelcomePages/AddLocalPrinterScrollView.qml

@@ -12,9 +12,12 @@ import Cura 1.0 as Cura
 // This is the scroll view widget for adding a (local) printer. This scroll view shows a list view with printers
 // categorized into 3 categories: "Ultimaker", "Custom", and "Other".
 //
-ScrollView
+Item
 {
+    UM.I18nCatalog { id: catalog; name: "cura" }
+
     id: base
+    height: childrenRect.height
 
     // The currently selected machine item in the local machine list.
     property var currentItem: (machineList.currentIndex >= 0)
@@ -25,12 +28,16 @@ ScrollView
     // By default (when this list shows up) we always expand the "Ultimaker" section.
     property string preferredCategory: "Ultimaker"
 
-    ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
-    ScrollBar.vertical.policy: ScrollBar.AsNeeded
     property int maxItemCountAtOnce: 10  // show at max 10 items at once, otherwise you need to scroll.
-    height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height
 
-    clip: true
+    // User-editable printer name
+    property alias printerName: printerNameTextField.text
+    property alias isPrinterNameValid: printerNameTextField.acceptableInput
+
+    onCurrentItemChanged:
+    {
+        printerName = currentItem == null ? "" : currentItem.name
+    }
 
     function updateCurrentItemUponSectionChange()
     {
@@ -51,103 +58,164 @@ ScrollView
         updateCurrentItemUponSectionChange()
     }
 
-    ListView
+    Item
     {
-        id: machineList
-
-        model: UM.DefinitionContainersModel
+        id: localPrinterSelectionItem
+        anchors.left: parent.left
+        anchors.right: parent.right
+        anchors.top: parent.top
+        height: childrenRect.height
+
+        // ScrollView + ListView for selecting a local printer to add
+        ScrollView
         {
-            id: machineDefinitionsModel
-            filter: { "visible": true }
-            sectionProperty: "category"
-            preferredSectionValue: preferredCategory
-        }
-
-        section.property: "section"
-        section.delegate: sectionHeader
-        delegate: machineButton
-    }
-
-    Component
-    {
-        id: sectionHeader
+            id: scrollView
+            anchors.left: parent.left
+            anchors.right: parent.right
+            anchors.top: parent.top
 
-        Button
-        {
-            id: button
-            width: ListView.view.width
-            height: UM.Theme.getSize("action_button").height
-            text: section
+            height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height
 
-            property bool isActive: base.currentSection == section
+            ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
+            ScrollBar.vertical.policy: ScrollBar.AsNeeded
 
-            background: Rectangle
-            {
-                anchors.fill: parent
-                color: isActive ? UM.Theme.getColor("setting_control_highlight") : "transparent"
-            }
+            clip: true
 
-            contentItem: Item
+            ListView
             {
-                width: childrenRect.width
-                height: UM.Theme.getSize("action_button").height
+                id: machineList
 
-                UM.RecolorImage
+                model: UM.DefinitionContainersModel
                 {
-                    id: arrow
-                    anchors.left: parent.left
-                    width: UM.Theme.getSize("standard_arrow").width
-                    height: UM.Theme.getSize("standard_arrow").height
-                    sourceSize.width: width
-                    sourceSize.height: height
-                    color: UM.Theme.getColor("text")
-                    source: base.currentSection == section ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_right")
+                    id: machineDefinitionsModel
+                    filter: { "visible": true }
+                    sectionProperty: "category"
+                    preferredSectionValue: preferredCategory
                 }
 
-                Label
+                section.property: "section"
+                section.delegate: sectionHeader
+                delegate: machineButton
+            }
+
+            Component
+            {
+                id: sectionHeader
+
+                Button
                 {
-                    id: label
-                    anchors.left: arrow.right
-                    anchors.leftMargin: UM.Theme.getSize("default_margin").width
-                    verticalAlignment: Text.AlignVCenter
-                    text: button.text
-                    font.bold: true
-                    renderType: Text.NativeRendering
+                    id: button
+                    width: ListView.view.width
+                    height: UM.Theme.getSize("action_button").height
+                    text: section
+
+                    property bool isActive: base.currentSection == section
+
+                    background: Rectangle
+                    {
+                        anchors.fill: parent
+                        color: isActive ? UM.Theme.getColor("setting_control_highlight") : "transparent"
+                    }
+
+                    contentItem: Item
+                    {
+                        width: childrenRect.width
+                        height: UM.Theme.getSize("action_button").height
+
+                        UM.RecolorImage
+                        {
+                            id: arrow
+                            anchors.left: parent.left
+                            width: UM.Theme.getSize("standard_arrow").width
+                            height: UM.Theme.getSize("standard_arrow").height
+                            sourceSize.width: width
+                            sourceSize.height: height
+                            color: UM.Theme.getColor("text")
+                            source: base.currentSection == section ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_right")
+                        }
+
+                        Label
+                        {
+                            id: label
+                            anchors.left: arrow.right
+                            anchors.leftMargin: UM.Theme.getSize("default_margin").width
+                            verticalAlignment: Text.AlignVCenter
+                            text: button.text
+                            font: UM.Theme.getFont("default_bold")
+                            renderType: Text.NativeRendering
+                        }
+                    }
+
+                    onClicked:
+                    {
+                        base.currentSection = section
+                        base.updateCurrentItemUponSectionChange()
+                    }
                 }
             }
 
-            onClicked:
+            Component
             {
-                base.currentSection = section
-                base.updateCurrentItemUponSectionChange()
+                id: machineButton
+
+                Cura.RadioButton
+                {
+                    id: radioButton
+                    anchors.left: parent.left
+                    anchors.leftMargin: UM.Theme.getSize("standard_list_lineheight").width
+                    anchors.right: parent.right
+                    anchors.rightMargin: UM.Theme.getSize("default_margin").width
+                    height: visible ? UM.Theme.getSize("standard_list_lineheight").height : 0
+
+                    checked: ListView.view.currentIndex == index
+                    text: name
+                    visible: base.currentSection == section
+                    onClicked: ListView.view.currentIndex = index
+                }
             }
         }
     }
 
-    Component
+    // Horizontal line
+    Rectangle
     {
-        id: machineButton
+        id: horizontalLine
+        anchors.top: localPrinterSelectionItem.bottom
+        anchors.left: parent.left
+        anchors.right: parent.right
+        height: UM.Theme.getSize("default_lining").height
+        color: UM.Theme.getColor("lining")
+    }
+
+    // User-editable printer name row
+    Row
+    {
+        anchors.top: horizontalLine.bottom
+        anchors.left: parent.left
+        anchors.right: parent.right
+        anchors.topMargin: UM.Theme.getSize("default_lining").height
+        anchors.leftMargin: UM.Theme.getSize("default_margin").width
+
+        spacing: UM.Theme.getSize("default_margin").width
 
-        Cura.RadioButton
+        Label
         {
-            id: radioButton
-            anchors.left: parent.left
-            anchors.leftMargin: UM.Theme.getSize("standard_list_lineheight").width
-            anchors.right: parent.right
-            anchors.rightMargin: UM.Theme.getSize("default_margin").width
-            height: visible ? UM.Theme.getSize("standard_list_lineheight").height : 0
+            text: catalog.i18nc("@label", "Printer Name")
+            anchors.verticalCenter: parent.verticalCenter
+            font: UM.Theme.getFont("medium")
+            verticalAlignment: Text.AlignVCenter
+            renderType: Text.NativeRendering
+        }
 
-            checked: ListView.view.currentIndex == index
-            onCheckedChanged:
-            {
-                if(checked)
-                {
-                    machineList.currentIndex = index
-                }
-            }
-            text: name
-            visible: base.currentSection == section
-            onClicked: ListView.view.currentIndex = index
+        Cura.TextField
+        {
+            id: printerNameTextField
+            anchors.verticalCenter: parent.verticalCenter
+            width: (parent.width / 2) | 0
+            placeholderText: catalog.i18nc("@text", "Please give your printer a name")
+
+            // Make sure that the fill is not empty
+            validator: RegExpValidator { regExp: /.+/ }
         }
     }
 }

+ 7 - 3
resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml

@@ -118,11 +118,14 @@ Item
             }
             else
             {
-                return addLocalPrinterDropDown.contentItem.currentItem != null
+                // Printer name cannot be empty
+                const localPrinterItem = addLocalPrinterDropDown.contentItem.currentItem
+                const isPrinterNameValid = addLocalPrinterDropDown.contentItem.isPrinterNameValid
+                return localPrinterItem != null && isPrinterNameValid
             }
         }
 
-        text: catalog.i18nc("@button", "Next")
+        text: base.currentItem.next_page_button_text
         onClicked:
         {
             // Create a network printer or a local printer according to the selection
@@ -139,7 +142,8 @@ Item
             {
                 // Create a local printer
                 const localPrinterItem = addLocalPrinterDropDown.contentItem.currentItem
-                Cura.MachineManager.addMachine(localPrinterItem.id)
+                const printerName = addLocalPrinterDropDown.contentItem.printerName
+                Cura.MachineManager.addMachine(localPrinterItem.id, printerName)
 
                 base.showNextPage()
             }

+ 1 - 1
resources/qml/WelcomePages/DropDownWidget.qml

@@ -60,7 +60,7 @@ Item
         anchors.left: header.left
         anchors.right: header.right
         // Add 2x lining, because it needs a bit of space on the top and the bottom.
-        height: contentLoader.height + 2 * UM.Theme.getSize("thick_lining").height
+        height: contentLoader.item.height + 2 * UM.Theme.getSize("thick_lining").height
 
         border.width: UM.Theme.getSize("default_lining").width
         border.color: UM.Theme.getColor("lining")

+ 4 - 4
resources/qml/WelcomePages/WelcomeDialog.qml → resources/qml/WelcomePages/WelcomeDialogItem.qml

@@ -11,7 +11,7 @@ import Cura 1.1 as Cura
 
 
 //
-// This is a no-frame dialog that shows the welcome process.
+// This is an Item that tries to mimic a dialog for showing the welcome process.
 //
 Item
 {
@@ -38,7 +38,7 @@ Item
 
     WizardPanel
     {
-        id: stepPanel
+        id: wizardPanel
         anchors.fill: parent
         model: dialog.model
     }
@@ -48,8 +48,8 @@ Item
     {
         id: shadow
         radius: UM.Theme.getSize("first_run_shadow_radius").width
-        anchors.fill: stepPanel
-        source: stepPanel
+        anchors.fill: wizardPanel
+        source: wizardPanel
         horizontalOffset: shadowOffset
         verticalOffset: shadowOffset
         color: UM.Theme.getColor("first_run_shadow")

Some files were not shown because too many files changed in this diff