Welcome to mirror list, hosted at ThFree Co, Russian Federation.

OpenFilesIncludingProjectsDialog.qml « Dialogs « qml « resources - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 18891cebeee743580a135dfdce2ec5ff6cee5ee7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (c) 2022 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.2
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.1

import UM 1.5 as UM
import Cura 1.5 as Cura

UM.Dialog
{
    // This dialog asks the user whether he/she wants to open the project file we have detected or the model files.
    id: base

    title: catalog.i18nc("@title:window", "Open file(s)")

    width: UM.Theme.getSize("small_popup_dialog").width
    height: UM.Theme.getSize("small_popup_dialog").height
    maximumHeight: height
    maximumWidth: width
    minimumHeight: height
    minimumWidth: width

    modality: Qt.WindowModal

    property var fileUrls: []
    property var addToRecent: true

    function loadProjectFile(projectFile)
    {
        UM.WorkspaceFileHandler.readLocalFile(projectFile, base.addToRecent);
    }

    function loadModelFiles(fileUrls)
    {
        for (var i in fileUrls)
        {
            CuraApplication.readLocalFile(fileUrls[i], "open_as_model", base.addToRecent);
        }
    }

    onAccepted: loadModelFiles(base.fileUrls)

    UM.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
    }

    buttonSpacing: UM.Theme.getSize("thin_margin").width

    // Buttons
    rightButtons:
    [
        Cura.SecondaryButton
        {
            text: catalog.i18nc("@action:button", "Cancel");
            onClicked: base.reject()
        },
        Cura.PrimaryButton
        {
            text: catalog.i18nc("@action:button", "Import all as models");
            onClicked: base.accept()
        }
    ]
}