-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMagicalArchiveDialog.qml
More file actions
920 lines (864 loc) · 37.4 KB
/
MagicalArchiveDialog.qml
File metadata and controls
920 lines (864 loc) · 37.4 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
import QtQuick
import QtQuick.Layouts
import qmlcomponents
import QtQuick.LegacyControls
Item {
id: root
required property var controller
property var initialFocusItem: root
property var spellListModel: null
property bool validSpellSelected: _currentModelData && (_currentModelData.enumId ?? -1) != -1
property var _currentModelData: {}
property bool runePageEnabled: false
property int initialSpellID: controller != null ? controller.initialSpellID : -1
property int _currentDetailTabId: 0
property var _currentSpellPreview: {}
property var _spellsPreviews: controller != null ? controller.spellsPreviewsJson : {}
KeyNavigation.tab: root
onControllerChanged: {
if (controller) {
root.spellListModel = controller.spellListModel;
selectSpellID(controller.initialSpellID);
//onInitialSpellIDChanged();
}
}
onInitialSpellIDChanged: {
if (controller) {
Qt.callLater(selectSpellID, root.initialSpellID);
}
}
on_SpellsPreviewsChanged: {
if (controller) {
selectSpellID(root.initialSpellID)
}
}
function selectSpellID(spellID) {
var newCurrentModelData = {}
var newSpellListIndex = -1;
var foundSpellPreview = {};
if (root.spellListModel) {
var _helperModel = AbstractItemModelHelper.wrapInHelperProxyModel(root.spellListModel);
if (_helperModel.rowCount() > 0) {
newSpellListIndex = 0;
}
for (var i = 0; i < _helperModel.rowCount(); i++) {
var tempModelData = _helperModel.sourceItemDataByRowIndex(i);
if (spellID == tempModelData.enumId) {
newSpellListIndex = i;
newCurrentModelData = tempModelData;
break;
}
}
}
if (_currentModelData != newCurrentModelData) {
_currentModelData = newCurrentModelData;
}
spellList.externalSelectedIndex = newSpellListIndex;
if (root._spellsPreviews) {
var newSpellPreviewData = root._spellsPreviews[spellID]
if (!newSpellPreviewData) {
newSpellPreviewData = {}
}
if (root._currentSpellPreview != newSpellPreviewData) {
root._currentSpellPreview = newSpellPreviewData
}
}
}
on_CurrentModelDataChanged: {
if (_currentModelData) {
runePageEnabled = root._currentModelData.isRune ?? false;
if (controller != null) {
controller.selectedSpellID = _currentModelData.enumId ?? 0;
}
} else {
_currentModelData = {}
}
}
TapHandler {
onTapped: {
if (filterPanel.expanded) {
filterPanel.expanded = false;
}
}
}
RowLayout {
id: slotsLayout
anchors.fill: parent
anchors.bottomMargin: TibiaStyle.marginRelated
spacing: TibiaStyle.marginRelated
TibiaPanel2PixelUpFilledWithCaption {
caption: qsTrId("magicalarchive_select_spell_caption")
autoHeight: false
Layout.preferredWidth: 170
Layout.fillHeight: true
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
spacing: TibiaStyle.marginRelated
ColumnLayout {
TibiaPanelWithCaption {
id: filterPanel
caption: "Filter"
Layout.fillWidth: true
HoverHandler {
onHoveredChanged: {
if (hovered) {
delayedCloseTimer.stop();
} else {
delayedCloseTimer.start();
}
}
}
Timer {
id: delayedCloseTimer
interval: 400
repeat: false
onTriggered: {
if (filterPanel.expanded) {
filterPanel.expanded = false;
}
}
}
contentDelegate: ColumnLayout {
id: filterColumnLayout
component SpellFilterCheckBox: TibiaCheckBox {
property var spellListModel: controller.spellListModel ? controller.spellListModel : undefined
property bool filterInverted: false
required property string filterProperty
Layout.fillWidth: true
onSpellListModelChanged: {
if (spellListModel) {
let currentValue = spellListModel[filterProperty];
if (filterInverted) {
shouldBeChecked = !currentValue;
} else {
shouldBeChecked = currentValue;
}
}
}
onCheckedChanged: {
if (spellListModel) {
let newValue = checked;
if (filterInverted) {
newValue = !checked;
}
spellListModel[filterProperty] = newValue;
}
}
}
component SpellFilterGroupCheckbox: TibiaCheckBox {
property var managedCheckboxes: []
shouldBeChecked: {
let numberOfChecked = 0;
for (var i = 0; i < managedCheckboxes.length; i++) {
numberOfChecked += managedCheckboxes[i].checked ? 1 : 0;
}
return (numberOfChecked == managedCheckboxes.length);
}
nextCheckState: function() {
let newShouldBeChecked = true;
if (checked) {
newShouldBeChecked = false;
} else {
newShouldBeChecked = true;
}
for (var i = 0; i < managedCheckboxes.length; i++) {
managedCheckboxes[i].checked = newShouldBeChecked;
}
if (newShouldBeChecked) {
return Qt.Checked;
} else {
return Qt.Unchecked;
}
}
}
SpellFilterCheckBox {
text: qsTrId("spelllist_only_current_vocation")
filterProperty: "showOnlyCurrentVocation"
}
SpellFilterCheckBox {
text: qsTrId("spelllist_only_current_level")
filterProperty: "showOnlyCurrentLevel"
}
SpellFilterCheckBox {
text: qsTrId("spelllist_show_only_known_spells")
filterProperty: "showUnkownSpells"
filterInverted: true
}
TibiaHorizontalSeparator {}
SpellFilterCheckBox {
id: vocationDruidCheckBox
text: qsTrId("druid")
filterProperty: "showDruidSpells"
}
SpellFilterCheckBox {
id: vocationKnightCheckBox
text: qsTrId("knight")
filterProperty: "showKnightSpells"
}
SpellFilterCheckBox {
id: vocationPaladinCheckBox
text: qsTrId("paladin")
filterProperty: "showPaladinSpells"
}
SpellFilterCheckBox {
id: vocationSorcererCheckBox
text: qsTrId("sorcerer")
filterProperty: "showSorcererSpells"
}
SpellFilterCheckBox {
id: vocationMonkCheckBox
text: qsTrId("monk")
filterProperty: "showMonkSpells"
}
SpellFilterGroupCheckbox {
managedCheckboxes: [vocationDruidCheckBox, vocationKnightCheckBox, vocationPaladinCheckBox, vocationSorcererCheckBox, vocationMonkCheckBox]
text: qsTrId("spelllist_all_vocations")
}
TibiaHorizontalSeparator {}
SpellFilterCheckBox {
id: attackSpellGroupCheckBox
text: qsTrId("spell_attack")
filterProperty: "showAttackSpellGroup"
}
SpellFilterCheckBox {
id: healingSpellGroupCheckBox
text: qsTrId("spell_healing")
filterProperty: "showHealingSpellGroup"
}
SpellFilterCheckBox {
id: supportSpellGroupCheckBox
text: qsTrId("spell_support")
filterProperty: "showSupportSpellGroup"
}
SpellFilterGroupCheckbox {
managedCheckboxes: [attackSpellGroupCheckBox, healingSpellGroupCheckBox, supportSpellGroupCheckBox]
text: qsTrId("spelllist_all_spell_groups")
}
TibiaHorizontalSeparator {}
SpellFilterCheckBox {
text: qsTrId("spelllist_premium_only")
filterProperty: "showPremiumOnlySpells"
}
SpellFilterCheckBox {
text: qsTrId("spelllist_free_account")
filterProperty: "showFreeSpells"
}
TibiaHorizontalSeparator {}
SpellFilterCheckBox {
text: qsTrId("spelllist_rune_spells")
filterProperty: "showRuneSpells"
}
SpellFilterCheckBox {
text: qsTrId("spelllist_instant_spells")
filterProperty: "showInstantSpells"
}
}
}
Item {
Layout.fillHeight: true
visible: filterPanel.expanded
}
}
ColumnLayout {
visible: !filterPanel.expanded
TibiaFrame1PixelDown {
Layout.fillHeight: true
Layout.fillWidth: true
TibiaScrollView {
anchors.fill: parent
anchors.margins: 1
SpellList {
id: spellList
model: root.spellListModel
smallIcons: true
externalSelectedIndex: controller != null ? 0 : -1
patternedBackground: true
allowDrag: false
onSpellSelected: (spellEnumId) => {
selectSpellID(spellEnumId);
}
} //SpellList
}
}
TibiaTextSearchField {
id: searchField
Layout.fillWidth: true
KeyNavigation.tab: searchField
KeyNavigation.backtab: searchField
maximumLength: TibiaStyle.maxCharacterNameLength
onSearchTextChanged: {
if (controller && controller.spellListModel) {
controller.spellListModel.filterText = searchText;
}
}
shouldBeText: controller && controller.spellListModel ? controller.spellListModel.filterText : ""
}
}
}
}
TibiaPanel2PixelUpFilledWithCaption {
id: detailView
caption: qsTrId("magicalarchive_spell_information_caption")
autoHeight: false
Layout.fillWidth: true
Layout.fillHeight: true
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Loader {
Layout.fillWidth: true
Layout.fillHeight: true
sourceComponent: root.validSpellSelected ? informationComponent : hintTextComponent
Component {
id: hintTextComponent
Item {
TibiaText {
anchors.centerIn: parent
text: qsTrId("magicalarchive_select_a_spell_hint")
}
}
}
Component {
id: informationComponent
ColumnLayout {
TibiaFrame2PixelUpFilled {
Layout.fillWidth: true
Layout.preferredHeight: 44
RowLayout {
anchors.fill: parent
anchors.margins: TibiaStyle.marginRelated;
TibiaFrame1PixelDown {
id: iconUrlBorder
Layout.preferredWidth: iconUrlImage.width + 2
Layout.preferredHeight: iconUrlImage.height + 2
Layout.alignment: Qt.AlignHCenter
Image {
id: iconUrlImage
x: 1
y: 1
source: _currentModelData.iconUrl ?? ""
}
}
ColumnLayout {
Layout.alignment: Qt.AlignHCenter
Layout.maximumHeight: iconUrlBorder.height
TibiaText {
text: _currentModelData.name ?? ""
}
TibiaText {
text: `${_currentModelData.formulaRaw}` + (_currentModelData.parameterHints ? ` ${_currentModelData.parameterHints}` : "")
}
}
Item {
Layout.fillWidth: true
}
ColumnLayout {
Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: true
Layout.maximumHeight: iconUrlBorder.height
RowLayout {
Layout.alignment: Qt.AlignRight
Layout.minimumHeight: 12
spacing: TibiaStyle.marginRelated
Repeater {
model: _currentModelData.relevantUsageInfo.allowedVocationInfos
Image {
source: modelData.iconUrl
Tooltip {
anchors.fill: parent
text: modelData.tooltip
}
}
}
RowLayout {
Layout.maximumHeight: premiumIcon.height
visible: root._currentModelData.isPremium ?? false
TibiaVerticalSeparator {
}
Image {
id: premiumIcon
source: "/images/skin/classic/pic-premium.png"
Tooltip {
anchors.fill: parent
text: qsTrId("spelllist_label_spell_premium")
}
}
}
}
RowLayout {
spacing: TibiaStyle.marginRelated
TibiaText {
text: {
if (_currentModelData.isRune) {
return qsTrId("magicalarchive_magic_level_restriction").arg(_currentModelData.minimumMagicLevel);
} else if (_currentModelData.minimumCasterLevel > 0) {
return qsTrId("magicalarchive_level_restriction_template").arg(_currentModelData.minimumCasterLevel);
} else {
return qsTrId("magicalarchive_level_no_restriction");
}
}
}
}
}
}
}
TibiaFrame2PixelUpFilled {
visible: root.validSpellSelected
Layout.fillWidth: true
Layout.fillHeight: true
ColumnLayout {
anchors.fill: parent
anchors.margins: parent.borderWidth
TibiaFrame1PixelDown {
id: simpleTabBar
property int activeTabId: 0
property int buttonImageXOffset: 0
property int buttonTextXOffset: 15
property int buttonWidth: width / 3
property bool runePageEnabled: root.runePageEnabled
onActiveTabIdChanged: {
root._currentDetailTabId = activeTabId;
}
onRunePageEnabledChanged: {
if (activeTabId == 2 && !runePageEnabled) {
activeTabId = 0;
}
}
property var tabModelArray: {
let newTabModelArray = [
{
"tabId": 0,
"caption": qsTrId("magicalarchive_tabbar_combat_stats"),
"icon": "/images/icon-magicalarchive-combatstats.png"
}
, {
"tabId": 1,
"caption": qsTrId("magicalarchive_tabbar_additional_information"),
"icon": "/images/icon-magicalarchive-additionalinfo.png"
}
]; //tabModel
if (simpleTabBar.runePageEnabled) {
newTabModelArray.push({
"tabId": 2,
"caption": qsTrId("magicalarchive_tabbar_rune_information"),
"icon": "/images/icon-magicalarchive-runeinfo.png",
});
}
return newTabModelArray;
}
Layout.fillWidth: true
Layout.preferredHeight: 38
BorderImage {
source: "/images/background-dark.png"
anchors.fill: parent
anchors.margins: parent.borderWidth
horizontalTileMode: BorderImage.Repeat
verticalTileMode: BorderImage.Repeat
}
RowLayout {
anchors.fill: parent
anchors.margins: parent.borderWidth
spacing: 0
Repeater {
model: simpleTabBar.tabModelArray
TibiaButton {
Layout.fillHeight: true
Layout.preferredWidth: simpleTabBar.buttonWidth
Layout.alignment: Qt.AlignLeft
text: modelData.caption
textFont: TibiaStyle.defaultTextFont
imageSource: modelData.icon;
imageAnchor: "left"
imageXOffset: simpleTabBar.buttonImageXOffset
textXOffset: simpleTabBar.buttonTextXOffset
checkable: true
checked: simpleTabBar.buttonIndexChecked == modelData
useButtonShouldBeChecked: true
buttonShouldBeChecked: simpleTabBar.activeTabId == modelData.tabId
onClicked: {
simpleTabBar.activeTabId = modelData.tabId ?? 0;
}
}
}
Item {
Layout.fillWidth: true
}
}
}
Loader {
id: detailPageLoader
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: TibiaStyle.marginRelated
sourceComponent: {
if (!root.validSpellSelected) {
return undefined;
}
switch (root._currentDetailTabId) {
case 0:
return combatStatsComponent;
case 1:
return additionalComponent;
case 2:
return runeStatsComponent;
}
}
}
Component {
id: combatStatsComponent
Item {
property var currentModelData: root._currentModelData ? root._currentModelData.relevantUsageInfo : {}
ColumnLayout {
anchors.fill: parent
spacing: TibiaStyle.marginRelated
GridLayout {
id: gridLayout
property int detailRowHeight: 78
Layout.fillWidth: true
columns: 4
rows: 2
rowSpacing: 0
columnSpacing: 0
TibiaFrame1PixelDown {
Layout.fillWidth: true
Layout.preferredHeight: gridLayout.detailRowHeight
ColumnLayout {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: TibiaStyle.marginRelated
TibiaText {
Layout.fillWidth: true
text: {
if (currentModelData.soulPointsCost > 0) {
return qsTrId("spelllist_label_spell_mana_soulpoints")
} else {
return qsTrId("spelllist_label_spell_mana")
}
}
}
TibiaText {
Layout.fillWidth: true
text: qsTrId("magicalarchive_combat_stats_spell_group")
}
TibiaText {
Layout.fillWidth: true
text: qsTrId("magicalarchive_combat_stats_basepower")
}
TibiaText {
Layout.fillWidth: true
text: qsTrId("magicalarchive_combat_stats_damage_scaling")
}
}
}
TibiaFrame1PixelDown {
Layout.fillWidth: true
Layout.preferredHeight: gridLayout.detailRowHeight
ColumnLayout {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: TibiaStyle.marginRelated
TibiaText {
Layout.fillWidth: true
text: {
if (currentModelData.manaCost == 0 && currentModelData.soulPointsCost == 0) {
return "-"
} else {
return `${currentModelData.manaCost ?? "-"}` + (currentModelData.soulPointsCost ? ` / ${currentModelData.soulPointsCost}` : "");
}
}
}
TibiaText {
Layout.fillWidth: true
text: currentModelData.groups ?? "-"
}
// TibiaText {
// text: root._currentModelData.type
// }
TibiaText {
property int meanValue: currentModelData.mean ?? "0"
Layout.fillWidth: true
text: meanValue != 0 ? meanValue : "-"
}
TibiaText {
property var scalingArray: root._currentModelData.scaling ?? []
Layout.fillWidth: true
text: scalingArray.length > 0 ? scalingArray.join(", ") : "-"
}
}
}
TibiaFrame1PixelDown {
Layout.fillWidth: true
Layout.preferredHeight: gridLayout.detailRowHeight
ColumnLayout {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: TibiaStyle.marginRelated
TibiaText {
text: qsTrId("magicalarchive_combat_stats_cooldown")
}
TibiaText {
text: qsTrId("magicalarchive_combat_stats_group_cooldown")
}
TibiaText {
text: qsTrId("spelllist_label_damage_type")
}
TibiaText {
text: qsTrId("magicalarchive_combat_stats_range")
}
}
}
TibiaFrame1PixelDown {
Layout.fillWidth: true
Layout.preferredHeight: gridLayout.detailRowHeight
ColumnLayout {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: TibiaStyle.marginRelated
TibiaText {
text: currentModelData.cooldown ?? "-"
}
TibiaText {
text: currentModelData.groupCooldowns ?? "-"
}
TibiaText {
text: currentModelData.damagetype ?? "-"
}
TibiaText {
text: (magicalArchiveSpellPreview.spellRange ?? "0") == 0 ? "-" : magicalArchiveSpellPreview.spellRange
}
}
}
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
TibiaFrame1PixelDown {
anchors.fill: parent
visible: root._currentSpellPreview && (root._currentSpellPreview.timestamps ?? []).length > 0 ? true : false
MagicalArchiveSpellPreview {
id: magicalArchiveSpellPreview
spellPreviewData: root._currentSpellPreview
anchors.fill: parent
anchors.margins: parent.borderWidth * 2
}
}
}
}
}
}
Component {
id: additionalComponent
Item {
property int detailRowHeight: 40
property int detailRowHeightSmall: 24
property int leftColumnWidth: 80
property var currentModelData: root._currentModelData
GridLayout {
id: gridLayout
anchors.fill: parent
columns: 2
rowSpacing: 0
columnSpacing: 0
TibiaFrame1PixelDown {
Layout.preferredWidth: leftColumnWidth
Layout.preferredHeight: detailRowHeightSmall
ColumnLayout {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: TibiaStyle.marginRelated
TibiaText {
text: qsTrId("magicalarchive_additional_spell_source")
}
}
}
TibiaFrame1PixelDown {
Layout.fillWidth: true
Layout.preferredHeight: detailRowHeightSmall
ColumnLayout {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: TibiaStyle.marginRelated
TibiaText {
textFormat: Text.RichText
text: {
if (currentModelData.source == TibiaEnums.SpellSourceWheelOfDestiny) {
return qsTrId("magicalarchive_additional_spell_source_wheelofdestiny");
} else if (currentModelData.source == TibiaEnums.SpellSourceThreeFoldPath) {
return qsTrId("magicalarchive_additional_spell_source_threefoldpath")
} else if (currentModelData.minimumCasterLevel <= 2) {
return qsTrId("magicalarchive_additional_spell_source_initial");
} else {
return qsTrId("magicalarchive_additional_spell_source_level_template").arg(TextHelper.formatNumberWithThousandSeparators(currentModelData.minimumCasterLevel))
}
}
}
}
}
//if new fields are needed check history for old layout
TibiaFrame1PixelDown {
id: descriptionFrame
Layout.fillWidth: true
Layout.fillHeight: true
Layout.columnSpan: 2
Layout.topMargin: TibiaStyle.marginRelated
TibiaScrollView {
id: descriptionTextScrollView
anchors.fill: parent
anchors.margins: parent.borderWidth
ColumnLayout {
width: descriptionTextScrollView.width - descriptionTextScrollView.effectiveScrollBarWidth
TibiaText {
id: descriptionText
onTextChanged: {
descriptionTextScrollView.contentItem.contentY = 0;
}
Layout.fillWidth: true
Layout.margins: TibiaStyle.marginRelated
text: `<html><style>a { text-decoration: none; color: ${color} }</style>${currentModelData.description}<html>`
textFormat: TextEdit.RichText
wrapMode: Text.WordWrap
}
}
}
}
}
}
}
Component {
id: runeStatsComponent
Item {
property var currentModelData: root._currentModelData ? root._currentModelData.spellUsageInfo : {}
ColumnLayout {
anchors.fill: parent
GridLayout {
id: gridLayout
property int detailRowHeight: 78
Layout.fillWidth: true
columns: 4
rows: 2
rowSpacing: 0
columnSpacing: 0
TibiaFrame1PixelDown {
Layout.fillWidth: true
Layout.preferredHeight: gridLayout.detailRowHeight
ColumnLayout {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: TibiaStyle.marginRelated
TibiaText {
Layout.fillWidth: true
text: qsTrId("spelllist_label_spell_mana_soulpoints")
}
TibiaText {
Layout.fillWidth: true
text: qsTrId("magicalarchive_combat_stats_spell_group")
}
TibiaText {
Layout.fillWidth: true
text: qsTrId("magicalarchive_level_restriction_caption")
}
TibiaText {
Layout.fillWidth: true
text: qsTrId("magicalarchive_rune_stats_amount")
}
}
}
TibiaFrame1PixelDown {
Layout.fillWidth: true
Layout.preferredHeight: gridLayout.detailRowHeight
ColumnLayout {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: TibiaStyle.marginRelated
TibiaText {
Layout.fillWidth: true
text: `${currentModelData.manaCost ?? "-"}` + (currentModelData.soulPointsCost ? ` / ${currentModelData.soulPointsCost}` : "")
}
TibiaText {
Layout.fillWidth: true
text: currentModelData.groups ?? "-"
}
TibiaText {
Layout.fillWidth: true
text: qsTrId("magicalarchive_level_restriction_template").arg(root._currentModelData.minimumCasterLevel)
}
TibiaText {
Layout.fillWidth: true
text: root._currentModelData.runeAmount
}
}
}
TibiaFrame1PixelDown {
Layout.fillWidth: true
Layout.preferredHeight: gridLayout.detailRowHeight
ColumnLayout {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: TibiaStyle.marginRelated
TibiaText {
text: qsTrId("magicalarchive_combat_stats_cooldown")
}
TibiaText {
text: qsTrId("magicalarchive_combat_stats_group_cooldown")
}
TibiaText {
text: qsTrId("magicalarchive_rune_stats_vocations")
}
}
}
TibiaFrame1PixelDown {
Layout.fillWidth: true
Layout.preferredHeight: gridLayout.detailRowHeight
ColumnLayout {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: TibiaStyle.marginRelated
TibiaText {
text: currentModelData.cooldown ?? "-"
}
TibiaText {
text: currentModelData.groupCooldowns ?? "-"
}
RowLayout {
Layout.alignment: Qt.AlignLeft
spacing: TibiaStyle.marginRelated
Repeater {
model: currentModelData.allowedVocationInfos
Image {
source: modelData.iconUrl
Tooltip {
anchors.fill: parent
text: modelData.tooltip
}
}
}
}
}
}
}
Item {
Layout.fillHeight: true
}
}
}
}
}
}
}
}
}
}
}
}
} // Item