-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreatureTrackerWidget.qml
More file actions
147 lines (123 loc) · 5.31 KB
/
CreatureTrackerWidget.qml
File metadata and controls
147 lines (123 loc) · 5.31 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
import QtQuick
import QtQuick.Layouts
import qmlcomponents
import qmlenumvalues
TibiaSidebarWidget {
id: root
property var widgetMode: widgetController != null ? widgetController.widgetMode : CreatureTrackerWidgetController.Bestiary
customButtonContainerData: [
TibiaButton {
id: addEntryButton
Layout.preferredWidth: TibiaStyle.widgetControllButtonSize
Layout.preferredHeight: TibiaStyle.widgetControllButtonSize
imageSource: "/images/skin/classic/icon-additionalwidget.png"
color: "verydarkgrey"
tooltipText: root.widgetMode == CreatureTrackerWidgetController.Bestiary ? qsTrId("bestiary_tracker_add_creature_tooltip") : qsTrId("bosstiary_tracker_add_creature_tooltip")
onClicked: widgetController != null ? widgetController.requestOpenBestiary() : undefined
}, //TibiaIconButton
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("bestiary_tracker_options_tooltip") : qsTrId("dummy_unknown")
onClicked: widgetController != null ? widgetController.requestWidgetConfigurationMenu() : undefined
} //TibiaIconButton
] //customButtonContainerData
caption: root.widgetMode == CreatureTrackerWidgetController.Bestiary ? qsTrId("bestiary_tracker_caption") : qsTrId("bosstiary_tracker_caption")
picSource: root.widgetMode == CreatureTrackerWidgetController.Bestiary ? "/images/skin/classic/icon-bestiarytracker-widget.png" : "/images/skin/classic/icon-bosstiarytracker-widget.png"
TibiaScrollView {
anchors.fill: parent
ListView {
id: creatureList
model: widgetController != null ? widgetController.trackedCreatures : null
boundsBehavior: Flickable.StopAtBounds
interactive: false //prevent flick behavior on touch screens
rebound: Transition {}
delegate: Item {
width: creatureList.width
height: contentColumnLayout.height + TibiaStyle.marginRelated
MouseArea {
anchors { left: parent.left; right: parent.right }
height: raceRenderer.height
acceptedButtons: Qt.LeftButton | Qt.RightButton
hoverEnabled: true
onEntered: {
if (tibiaMouseCursorController != null) {
tibiaMouseCursorController.setPointingHand(true);
}
} //onEntered
onExited: {
if (tibiaMouseCursorController != null) {
tibiaMouseCursorController.setPointingHand(false);
}
} //onExited
onClicked: (mouse) => {
if (tibiaMouseCursorController != null) {
tibiaMouseCursorController.setPointingHand(false);
}
if (mouse.button == Qt.RightButton) {
widgetController.requestContextMenu(model.raceID, model.name);
} else {
widgetController.requestOpenBestiaryEntry(model.raceID);
}
} // onClicked
} //MouseArea
ColumnLayout {
id: contentColumnLayout
spacing: TibiaStyle.marginNarrow
anchors.left: parent.left
anchors.right: parent.right
RowLayout {
Layout.rightMargin: TibiaStyle.marginRelated
spacing: TibiaStyle.marginRelated
RaceAppearanceInstanceRenderer {
id: raceRenderer
width: 16
height: 16
raceID: model.raceID
moving: true
} //RaceAppearanceInstanceRenderer
TibiaText {
Layout.fillWidth: true
text: model.name
} //TibiaText
Loader {
id: cooldownLoader
property bool creatureHasCooldown: model.creatureHasCooldown
property bool cooldownIsExpired: model.cooldownIsExpired
property string cooldownEndText: model.cooldownEndText
Component {
id: cooldownTextComponent
Image {
source: cooldownLoader.cooldownIsExpired ? "/images/icon-cooldown-finished.png" : "/images/icon-cooldown-running.png"
Tooltip {
anchors.fill: parent
delayInMs: 0
text: cooldownLoader.cooldownEndText
}
}
}
sourceComponent: cooldownLoader.creatureHasCooldown ? cooldownTextComponent : undefined
}
}
CreatureUnlockProgress {
id: unlockProgress
Layout.fillWidth: true
Layout.preferredHeight: TibiaStyle.progressBarSmallHeight
currentKills: model.currentKills
killsToUnlockDetails1: model.killsForDetails1
killsToUnlockDetails2: model.killsForDetails2
killsToFullUnlock: model.killsForDetails3
isFullyUnlocked: model.isFullyUnlocked
} // CreatureUnlockProgress
}
} //delegate: Item
} //ListView
} //TibiaScrollView
Lenshelp {
anchors.fill: parent
triggerRect: mapFromItem(widgetRoot, 0, 0, widgetRoot.width, widgetRoot.height)
caption: qsTrId("bestiary_tracker_widget_lenshelp_caption")
content: qsTrId("bestiary_tracker_widget_lenshelp")
} //Lenshelp
} // TibiaSidebarWidget