mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-01 08:14:22 +08:00
Update OpenFiles Dialog
CURA 8687
This commit is contained in:
parent
8fc0fb2737
commit
f59a23fd82
@ -4,11 +4,9 @@
|
|||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import QtQuick.Controls 2.0
|
import QtQuick.Controls 2.0
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import QtQuick.Dialogs 1.1
|
|
||||||
import QtQuick.Window 2.1
|
|
||||||
|
|
||||||
import UM 1.3 as UM
|
import UM 1.5 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.5 as Cura
|
||||||
|
|
||||||
UM.Dialog
|
UM.Dialog
|
||||||
{
|
{
|
||||||
@ -16,9 +14,9 @@ UM.Dialog
|
|||||||
id: base
|
id: base
|
||||||
|
|
||||||
title: catalog.i18nc("@title:window", "Open file(s)")
|
title: catalog.i18nc("@title:window", "Open file(s)")
|
||||||
width: 420 * screenScaleFactor
|
|
||||||
height: 170 * screenScaleFactor
|
|
||||||
|
|
||||||
|
width: UM.Theme.getSize("small_popup_dialog").width
|
||||||
|
height: UM.Theme.getSize("small_popup_dialog").height
|
||||||
maximumHeight: height
|
maximumHeight: height
|
||||||
maximumWidth: width
|
maximumWidth: width
|
||||||
minimumHeight: height
|
minimumHeight: height
|
||||||
@ -28,12 +26,6 @@ UM.Dialog
|
|||||||
|
|
||||||
property var fileUrls: []
|
property var fileUrls: []
|
||||||
property var addToRecent: true
|
property var addToRecent: true
|
||||||
property int spacerHeight: 10 * screenScaleFactor
|
|
||||||
|
|
||||||
function loadProjectFile(projectFile)
|
|
||||||
{
|
|
||||||
UM.WorkspaceFileHandler.readLocalFile(projectFile, base.addToRecent);
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadModelFiles(fileUrls)
|
function loadModelFiles(fileUrls)
|
||||||
{
|
{
|
||||||
@ -43,69 +35,31 @@ UM.Dialog
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column
|
onAccepted: loadModelFiles(base.fileUrls)
|
||||||
|
|
||||||
|
UM.Label
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
text: catalog.i18nc("@text:window", "We have found one or more project file(s) within the files you have selected. You can open only one project file at a time. We suggest to only import models from those files. Would you like to proceed?")
|
||||||
anchors.leftMargin: 20 * screenScaleFactor
|
|
||||||
anchors.rightMargin: 20 * screenScaleFactor
|
|
||||||
anchors.bottomMargin: 20 * screenScaleFactor
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
spacing: 10 * screenScaleFactor
|
font: UM.Theme.getFont("default")
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@text:window", "We have found one or more project file(s) within the files you have selected. You can open only one project file at a time. We suggest to only import models from those files. Would you like to proceed?")
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
font: UM.Theme.getFont("default")
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
}
|
|
||||||
|
|
||||||
Item // Spacer
|
|
||||||
{
|
|
||||||
height: base.spacerHeight
|
|
||||||
width: height
|
|
||||||
}
|
|
||||||
|
|
||||||
UM.I18nCatalog
|
|
||||||
{
|
|
||||||
id: catalog
|
|
||||||
name: "cura"
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonGroup
|
|
||||||
{
|
|
||||||
buttons: [cancelButton, importAllAsModelsButton]
|
|
||||||
checkedButton: importAllAsModelsButton
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onAccepted: loadModelFiles(base.fileUrls)
|
buttonSpacing: UM.Theme.getSize("thin_margin").width
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
rightButtons:
|
rightButtons:
|
||||||
[
|
[
|
||||||
Button
|
Cura.SecondaryButton
|
||||||
{
|
{
|
||||||
id: cancelButton
|
|
||||||
text: catalog.i18nc("@action:button", "Cancel");
|
text: catalog.i18nc("@action:button", "Cancel");
|
||||||
onClicked:
|
onClicked: base.reject()
|
||||||
{
|
|
||||||
// cancel
|
|
||||||
base.hide();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
Button
|
Cura.PrimaryButton
|
||||||
{
|
{
|
||||||
id: importAllAsModelsButton
|
|
||||||
text: catalog.i18nc("@action:button", "Import all as models");
|
text: catalog.i18nc("@action:button", "Import all as models");
|
||||||
onClicked:
|
onClicked: base.accept()
|
||||||
{
|
|
||||||
// load models from all selected file
|
|
||||||
loadModelFiles(base.fileUrls);
|
|
||||||
base.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user