mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 15:13:56 -06:00
Connect compare-and-safe profile dialog buttons to actions.
Some rework was needed as to not get the entire Preferences window to show up, which previously came along with the add profile action. part of CURA-9347
This commit is contained in:
parent
c13deba1ea
commit
8f65af61e5
4 changed files with 38 additions and 23 deletions
|
@ -1,86 +0,0 @@
|
|||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Window 2.1
|
||||
|
||||
import UM 1.5 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
UM.Dialog
|
||||
{
|
||||
id: base
|
||||
|
||||
buttonSpacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
property string object: ""
|
||||
|
||||
property alias newName: nameField.text
|
||||
property bool validName: true
|
||||
property string validationError
|
||||
property string dialogTitle: catalog.i18nc("@title:window", "Rename")
|
||||
property string explanation: catalog.i18nc("@info", "Please provide a new name.")
|
||||
|
||||
title: dialogTitle
|
||||
backgroundColor: UM.Theme.getColor("main_background")
|
||||
minimumWidth: UM.Theme.getSize("small_popup_dialog").width
|
||||
minimumHeight: UM.Theme.getSize("small_popup_dialog").height
|
||||
width: minimumWidth
|
||||
height: minimumHeight
|
||||
|
||||
property variant catalog: UM.I18nCatalog { name: "cura" }
|
||||
|
||||
signal textChanged(string text)
|
||||
signal selectText()
|
||||
onSelectText:
|
||||
{
|
||||
nameField.selectAll();
|
||||
nameField.focus = true;
|
||||
}
|
||||
|
||||
Column
|
||||
{
|
||||
anchors.fill: parent
|
||||
|
||||
UM.Label
|
||||
{
|
||||
text: base.explanation + "\n" //Newline to make some space using system theming.
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
Cura.TextField
|
||||
{
|
||||
id: nameField
|
||||
width: parent.width
|
||||
text: base.object
|
||||
maximumLength: 40
|
||||
selectByMouse: true
|
||||
onTextChanged: base.textChanged(text)
|
||||
}
|
||||
|
||||
UM.Label
|
||||
{
|
||||
visible: !base.validName
|
||||
text: base.validationError
|
||||
}
|
||||
}
|
||||
|
||||
rightButtons: [
|
||||
Cura.SecondaryButton
|
||||
{
|
||||
id: cancelButton
|
||||
text: catalog.i18nc("@action:button","Cancel")
|
||||
onClicked: base.reject()
|
||||
},
|
||||
Cura.PrimaryButton
|
||||
{
|
||||
id: okButton
|
||||
text: catalog.i18nc("@action:button", "OK")
|
||||
onClicked: base.accept()
|
||||
enabled: base.validName
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue