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

SidebarHeader.qml « qml « resources - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: efc6949668125347011922e256ce41bec7fe0916 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// 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.Controls.Styles 1.1
import QtQuick.Layouts 1.1

import UM 1.0 as UM

Column {
    id: base;

    property variant modesModel;
    property alias currentModeIndex: modeMenu.currentIndex;
    property Action addMachineAction;
    property Action configureMachinesAction;

    spacing: UM.Theme.sizes.default_margin.height;

    RowLayout {
        anchors.horizontalCenter: parent.horizontalCenter;

        width: parent.width - UM.Theme.sizes.default_margin.width * 2;
        height: UM.Theme.sizes.line.height;

        Label {
            //: Configuration mode label
            text: qsTr("Mode:");

            font: UM.Theme.fonts.sidebar_header;
            color: UM.Theme.colors.text_inactive;
        }

        ToolButton {
            text: base.modesModel ? base.modesModel.get(modeMenu.currentIndex).text : "";

            style: UM.Theme.styles.sidebar_header_button;

            Layout.preferredWidth: base.width * 0.25;

            menu: Menu {
                id: modeMenu;

                property int currentIndex: 0;

                Instantiator {
                    model: base.modesModel;

                    MenuItem {
                        text: model.text;
                        checkable: true;
                        checked: modeMenu.currentIndex == index;
                        exclusiveGroup: modeMenuGroup;
                        onTriggered: modeMenu.currentIndex = index;
                    }
                    onObjectAdded: modeMenu.insertItem(index, object)
                    onObjectRemoved: modeMenu.removeItem(object)
                }

                ExclusiveGroup { id: modeMenuGroup; }
            }
        }

        Rectangle {
            width: 1;
            height: parent.height;
            color: UM.Theme.colors.border;
        }

        Label {
            //: Machine selection label
            text: qsTr("Machine:");

            font: UM.Theme.fonts.sidebar_header;
            color: UM.Theme.colors.text_inactive;
        }

        ToolButton {
            id: machineButton;
            text: UM.Application.machineName;
            tooltip: UM.Application.machineName;

            style: UM.Theme.styles.sidebar_header_button;

            Layout.fillWidth: true;

            menu: Menu {
                id: machineMenu;
                Instantiator {
                    model: UM.Models.machinesModel
                    MenuItem {
                        text: model.name;
                        checkable: true;
                        checked: model.active;
                        exclusiveGroup: machineMenuGroup;
                        onTriggered: UM.Models.machinesModel.setActive(index)
                    }
                    onObjectAdded: machineMenu.insertItem(index, object)
                    onObjectRemoved: machineMenu.removeItem(object)
                }

                ExclusiveGroup { id: machineMenuGroup; }

                MenuSeparator { }

                MenuItem { action: base.addMachineAction; }
                MenuItem { action: base.configureMachinesAction; }
            }
        }
    }

    UM.SidebarCategoryHeader {
        width: parent.width;
        height: UM.Theme.sizes.section.height;

        iconSource: UM.Theme.icons.printsetup;

        //: Sidebar header label
        text: qsTr("Print Setup");
        enabled: false;

        color: UM.Theme.colors.primary;
    }
}