-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBossTrackingWidget.qml
More file actions
162 lines (130 loc) · 5.59 KB
/
BossTrackingWidget.qml
File metadata and controls
162 lines (130 loc) · 5.59 KB
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import QtQuick
import QtQuick.Layouts
import qmlcomponents
TibiaSidebarWidget {
caption: qsTrId("bosstracker_caption")
picSource: "/images/skin/classic/icon-bosstracker-widget.png"
minContentHeight: 45
highlightFocus: widgetController != null && widgetController.hasFocus
onWidgetControllerChanged: {
if (widgetController != null) {
widgetController.requestWidgetControlToTakeFocus.connect(setFocusToSearchField);
}
} //onWidgetControllerChanged
customButtonContainerData: [
TibiaIconButton {
id: showConfigButton
sourceUp: "/images/skin/classic/button-contextmenu-12x12-idle.png"
sourceDown: "/images/skin/classic/button-contextmenu-12x12-pressed.png"
tooltipText: widgetController != null ? qsTrId("bosstracker_options_tooltip") : qsTrId("dummy_unknown")
onClicked: widgetController != null ? widgetController.requestWidgetConfigurationMenu() : undefined
} //TibiaIconButton
] //customButtonContainerData
function setFocusToSearchField() {
searchField.forceActiveFocus()
}
TibiaScrollView {
id: scrollView
anchors { left: parent.left; leftMargin: TibiaStyle.marginNarrow;
right: parent.right;
top: parent.top; bottom: parent.bottom }
Flickable {
contentHeight: bossTrackerList.count > 0 ? searchField.height + TibiaStyle.marginNarrow + bossTrackerList.height : noBossesText.height
interactive: false //prevent flick behavior on touch screens
boundsBehavior: Flickable.StopAtBounds
pixelAligned: true
TibiaTextSearchField {
id: searchField
visible: widgetController != null && widgetController.hasUnlockedAnyBosses
anchors { left: parent.left; leftMargin: TibiaStyle.marginNarrow;
right: parent.right; rightMargin: TibiaStyle.marginRelated;
top: parent.top; topMargin: TibiaStyle.marginNarrow; }
KeyNavigation.tab: searchField
KeyNavigation.backtab: searchField
maximumLength: TibiaStyle.maxCharacterNameLength
onSearchTextChanged: {
if (widgetController != null) {
widgetController.requestFilterByBossName(searchText);
}
}
onActiveFocusChanged: {
if (activeFocus && widgetController != null) {
widgetController.takeFocus()
}
}
onEscPressedInSearchTextField: {
if (widgetController != null) {
widgetController.releaseFocus()
}
}
}
TibiaText {
id: noBossesText
text: qsTrId("bosstracker_no_unlocked_bosses")
visible: widgetController != null && !widgetController.hasUnlockedAnyBosses
wrapMode: Text.Wrap
anchors { left: parent.left; leftMargin: TibiaStyle.marginNarrow;
right: parent.right; rightMargin: TibiaStyle.marginRelated;
top: parent.top; topMargin: TibiaStyle.marginNarrow; }
}
ListView {
id: bossTrackerList
model: widgetController != null ? widgetController.bosses : null
anchors { left: parent.left; leftMargin: TibiaStyle.marginNarrow;
right: parent.right; rightMargin: TibiaStyle.marginNarrow;
top: searchField.bottom; topMargin: TibiaStyle.marginNarrow; }
height: contentItem.height
interactive: false //prevent flick behavior on touch screens
boundsBehavior: Flickable.StopAtBounds
delegate: Item {
width: bossTrackerList.width
height: trackingEntryLayout.height
RowLayout {
id: trackingEntryLayout
anchors { left: parent.left; right: parent.right }
OutfitAppearanceInstanceRenderer {
Layout.preferredWidth: 32
Layout.preferredHeight: 32
outfitId: model.outfit != null ? model.outfit.outfitID : 0
headColor: model.outfit != null ? model.outfit.colors.headColor : "black"
legsColor: model.outfit != null ? model.outfit.colors.legsColor : "black"
torsoColor: model.outfit != null ? model.outfit.colors.torsoColor : "black"
detailColor: model.outfit != null ? model.outfit.colors.detailColor : "black"
firstAddOn: model.outfit != null ? model.outfit.firstAddOn : false
secondAddOn: model.outfit != null ? model.outfit.secondAddOn : false
outfitIsObject: model.outfit != null ? model.outfit.isObjectOutfit : false
shrinkToFit: true
}
ColumnLayout {
spacing: TibiaStyle.marginNarrow
TibiaText {
text: model.name
styleType: "Default"
Layout.fillWidth: true
}
TibiaText {
text: model.hasCooldown ? model.cooldownEndString : qsTrId("bosstracker_no_cooldown")
styleType: model.hasCooldown ? "ModifierNegative" : "Dialog"
Layout.fillWidth: true
}
} // ColumnLayout
} // RowLayout
MouseArea {
anchors.fill: parent
onClicked: {
if (widgetController != null) {
widgetController.requestOpenBosstiary(model.bossRaceId)
}
}
} // MouseArea
} // delegate: Item
} // ListView
} // Flickable
} // TibiaScrollView
Lenshelp {
anchors.fill: parent
triggerRect: mapFromItem(widgetRoot, 0, 0, widgetRoot.width, widgetRoot.height)
caption: qsTrId("bosstracker_lenshelp_caption")
content: qsTrId("bosstracker_lenshelp")
} //Lenshelp
} // TibiaSidebarWidget