-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCyclopediaMapDialog.qml
More file actions
1185 lines (1051 loc) · 47.8 KB
/
CyclopediaMapDialog.qml
File metadata and controls
1185 lines (1051 loc) · 47.8 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
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import qmlcomponents
Item {
id: rendererWrapper
property var controller: null
property int baseLayer: 7
property bool isUnderground: baseLayer > 7
property bool isAboveGround: baseLayer < 7
property alias mapTileType: minimapRenderer.tileType
property alias userSelectedMapTileType: minimapRenderer.userSelectedTileType
property bool showInformationSidebar: true
property alias showZones: minimapRenderer.showZones
property alias showExploreOverlay: minimapRenderer.showExploreOverlay
property alias levelSeparator: minimapRenderer.levelSeparator
property alias showNPCMarkers: minimapRenderer.showNPCMarkers
property alias showPassages: minimapRenderer.showPassages
property alias showHouses: minimapRenderer.showHouses
property alias markerSymbolsToShow: minimapRenderer.minimapMarkersFilter
property var selectedItem: controller != null ? controller.selectedItem : null
property var selectedItemComponent: null
property string selectedItemCaption: ""
property string currentTooltip: controller != null ? controller.currentTooltip : ""
onCurrentTooltipChanged: {
mapTooltip.hideTooltip();
}
Connections {
id: controllerConnections
target: null
function onShowTooltip() {
mapTooltip.showTooltip();
} //onShowTooltip
function onRequestSetScaleFactor(ScaleFactor) {
minimapRenderer.scaleFactorAnimationBehavior.enabled = false;
minimapRenderer.targetScaleFactor = ScaleFactor;
minimapRenderer.scaleFactorAnimationBehavior.enabled = true;
} //onRequestSetScaleFactor
} //Connections
function changeLayer(direction, x, y) {
var addValue = direction;
if (direction > 0) {
addValue = -1;
} else if (direction < 0) {
addValue = 1;
}
rendererWrapper.baseLayer = Math.min(15, Math.max(0, rendererWrapper.baseLayer + addValue));
mapTooltip.hideTooltip();
}
function changeZoom(direction, x, y) {
var multiplyValue = 0;
if (direction > 0) {
multiplyValue = 2.0;
} else if (direction < 0) {
multiplyValue = 0.5;
}
if (x == null) {
x = minimapRenderer.width / 2;
}
if (y == null) {
y = minimapRenderer.height / 2;
}
minimapRenderer.camera.referencePoint = Qt.point(x, y);
minimapRenderer.targetScaleFactor = Math.max(Math.min(minimapRenderer.camera.scaleFactor * multiplyValue, 1.0 / 2.0), 1.0 / 64.0);
mapTooltip.hideTooltip();
}
function moveInDirection(x, y) {
var offset = Qt.point(x * 10, y * 10);
minimapRenderer.camera.referencePoint = Qt.point(0,0);
minimapRenderer.camera.moveDistanceRelativeToReferencePoint(offset);
mapTooltip.hideTooltip();
}
Shortcut {
sequence: StandardKey.MoveToNextPage
onActivated: {
changeLayer(-1);
}
}
Shortcut {
sequence: StandardKey.MoveToPreviousPage
onActivated: {
changeLayer(1);
}
}
Shortcut {
sequences: [StandardKey.MoveToEndOfLine, "Ctrl+E"]
onActivated: {
changeZoom(1);
}
}
Shortcut {
sequence: StandardKey.MoveToStartOfLine
onActivated: {
changeZoom(-1);
}
}
Shortcut {
sequence: StandardKey.MoveToNextChar
onActivated: {
moveInDirection(1, 0);
}
}
Shortcut {
sequence: StandardKey.MoveToPreviousChar
onActivated: {
moveInDirection(-1, 0);
}
}
Shortcut {
sequence: StandardKey.MoveToNextLine
onActivated: {
moveInDirection(0, 1);
}
}
Shortcut {
sequence: StandardKey.MoveToPreviousLine
onActivated: {
moveInDirection(0, -1);
}
}
onSelectedItemChanged: {
if (selectedItem != null) {
if (selectedItem.selectionType == TibiaEnums.SelectionTypeSubArea) {
selectedItemComponent = areaAndSubAreaInfo;
selectedItemCaption = qsTrId("cyclopedia_map_subarea")
setScrollingPosition();
} else if (selectedItem.selectionType == TibiaEnums.SelectionTypeArea) {
selectedItemComponent = areaInfo;
selectedItemCaption = qsTrId("cyclopedia_map_area")
setScrollingPosition();
} else if (selectedItem.selectionType == TibiaEnums.SelectionTypePassage) {
selectedItemComponent = passageInfo;
selectedItemCaption = qsTrId("cyclopedia_map_passage")
setScrollingPosition();
} else {
selectedItemComponent = null;
}
} else {
selectedItemComponent = null;
}
}
function calculateCorrectMapTileTypeDependingOnBaseLayer() {
if (baseLayer > 7) {
mapTileType = MinimapRenderer.LocalMinimap;
} else {
mapTileType = userSelectedMapTileType;
}
}
onBaseLayerChanged: {
minimapRenderer.camera.changeLayerWithIsometricProjection(baseLayer);
calculateCorrectMapTileTypeDependingOnBaseLayer();
}
onControllerChanged: {
if (controller != null) {
controllerConnections.target = controller;
controller.setMinimapRendererQuickItem(minimapRenderer);
}
} //onControllerChanged
onUserSelectedMapTileTypeChanged: {
calculateCorrectMapTileTypeDependingOnBaseLayer();
} //onUserSelectedMapTileTypeChanged
function resetMarkerFilters(value) {
var newArray = rendererWrapper.markerSymbolsToShow.slice(0);
for (var i = 0; i < newArray.length; i++) {
newArray[i] = value;
}
setNewMinimapMarkerModel(newArray);
rendererWrapper.showNPCMarkers = value;
rendererWrapper.showPassages = value;
rendererWrapper.showHouses = value;
}
function setMinimapMarker(index, value) {
var newArray = rendererWrapper.markerSymbolsToShow.slice(0);
newArray[index] = value;
setNewMinimapMarkerModel(newArray);
}
function setNewMinimapMarkerModel(array) {
for (var i = 0; i < TibiaStyle.numberOfMinimapMarkers; i++) {
if (rendererWrapper.markerSymbolsToShow[i] != array[i]) {
rendererWrapper.markerSymbolsToShow = array;
break;
}
}
}
Timer {
id: scrollBarPositionTimer
interval: 1;
running: false;
repeat: false
onTriggered: {
if (selectionPanel.expanded) {
var upperPanelsHeight = mapMarkerPanel.height + navigationPanel.height + 2*informationPanelContent.spacing;
var totalHeight = upperPanelsHeight + selectionPanel.height;
var scrollPositionEnd = Math.max(totalHeight - scrollView.height, 0);
flickableInformation.contentY = (selectionPanel.height > scrollView.height ? upperPanelsHeight : scrollPositionEnd );
}
} //onTriggered
} //Timer
function setScrollingPosition() {
scrollBarPositionTimer.restart();
}
Component {
id: creatureOccurrencesComponent
ColumnLayout {
id: creatureOccurrencesRoot
property var creatureOccurrencesModel
property var subAreaName: creatureOccurrencesModel != null ? creatureOccurrencesModel.subAreaName : ""
property var showSubAreaName: false
property var commonCreaturesModel: creatureOccurrencesModel != null ? creatureOccurrencesModel.commonCreatures : null
property var rareCreaturesModel: creatureOccurrencesModel != null ? creatureOccurrencesModel.rareCreatures : null
property var dynamicCreaturesModel: creatureOccurrencesModel != null ? creatureOccurrencesModel.dynamicCreatures : null
Component {
id: creatureList
ColumnLayout {
id: categoryMonsters
property var creaturesModel: null
property var categoryString: ""
property var preferredHeight: categoryText.height + spacing + monstersGrid.height
TibiaText {
id: categoryText
Layout.alignment: Qt.AlignTop | Qt.AlignLeft;
Layout.fillWidth: true
text: categoryString
}
GridView {
id: monstersGrid
Layout.alignment: Qt.AlignTop | Qt.AlignLeft;
Layout.fillWidth: true
Layout.preferredHeight: Math.ceil(count / 4) * cellHeight
cellWidth: 34
cellHeight: 34
snapMode: GridView.SnapToRow
interactive: false
clip: true
model: categoryMonsters.creaturesModel
delegate:
Item {
width: 32
height: 32
TibiaButton {
id: monsterIconButton
anchors.fill: parent
// imageSourceDisabled:true
enabled: !modelData.isUnknown
onClicked: {
if (controller != null) {
controller.onCreatureClicked(modelData.raceID);
}
}
RaceAppearanceInstanceRenderer {
anchors.fill: parent
anchors.margins: 1
raceID: modelData.raceID
isUnknown: modelData.isUnknown
autofit: true
}
} // TibiaButton
Tooltip {
anchors.fill: parent
text: modelData.raceName
}
}
}
}
}
Loader {
Component {
id: loaderComponent
TibiaText {
text: subAreaName
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
}
}
Layout.fillWidth: true;
sourceComponent: showSubAreaName ? loaderComponent : null
}
Loader {
sourceComponent: commonCreaturesModel != null ? (commonCreaturesModel.length > 0 ? creatureList : null) : null
onItemChanged: {
if (item == null) {
Layout.preferredHeight = 0;
} else {
Layout.fillWidth = true;
Layout.preferredHeight = Qt.binding(function(){ return item.preferredHeight; });
item.creaturesModel = Qt.binding(function(){ return commonCreaturesModel; });
item.categoryString = qsTrId("cyclopedia_map_creature_occurrence_common")
}
}
}
Loader {
sourceComponent: rareCreaturesModel != null ? (rareCreaturesModel.length > 0 ? creatureList : null) : null
onItemChanged: {
if (item == null) {
Layout.preferredHeight = 0;
} else {
Layout.fillWidth = true;
Layout.preferredHeight = Qt.binding(function(){ return item.preferredHeight; });
item.creaturesModel = Qt.binding(function(){ return rareCreaturesModel; });
item.categoryString = qsTrId("cyclopedia_map_creature_occurrence_rare")
}
}
}
Loader {
sourceComponent: dynamicCreaturesModel != null ? (dynamicCreaturesModel.length > 0 ? creatureList : null) : null
onItemChanged: {
if (item == null) {
Layout.preferredHeight = 0;
} else {
Layout.fillWidth = true;
Layout.preferredHeight = Qt.binding(function(){ return item.preferredHeight; });
item.creaturesModel = Qt.binding(function(){ return dynamicCreaturesModel; });
item.categoryString = qsTrId("cyclopedia_map_creature_occurrence_dynamic")
}
}
}
}
}
RowLayout {
anchors { left: parent.left;
right: parent.right;
top: parent.top;
bottom: parent.bottom; bottomMargin: TibiaStyle.marginRelated;}
TibiaFrame2PixelUpFilled {
id: informationPanel
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
Layout.preferredWidth: 170
Layout.fillHeight: true
visible: rendererWrapper.showInformationSidebar
TibiaFrame1PixelDown {
id: informationPanelInnerBorder
anchors.fill: parent
anchors.margins: 5
anchors.topMargin: parent.topMarginToContent
TibiaScrollView {
id: scrollView
anchors.fill: parent
anchors.margins: parent.borderWidth
Flickable {
id: flickableInformation
contentHeight: informationPanelContent.height
interactive: false //prevent flick behavior on touch screens
boundsBehavior: Flickable.StopAtBounds
ColumnLayout {
id: informationPanelContent
anchors.left: parent.left
anchors.right: parent.right
spacing: TibiaStyle.marginRelated
TibiaPanelWithCaption {
id: mapMarkerPanel
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
Layout.fillWidth: true
visible: rendererWrapper.showInformationSidebar
caption: qsTrId("cyclopedia_map_information_panel_display_caption")
shouldBeExpanded: controller != null && controller.showMapMarkerPanel
onExpandedChanged: {
if (controller != null) {
controller.showMapMarkerPanel = expanded;
}
} //onExpandedChanged
contentDelegate: ColumnLayout {
TibiaText {
Layout.alignment: Qt.AlignCenter
text: qsTrId("cyclopedia_map_information_panel_map_markers_caption")
} //TibiaText
TibiaFrame1PixelDown {
Layout.fillWidth: true
Layout.preferredHeight: mapMarkersContent.height + TibiaStyle.marginRelated * 2
ColumnLayout {
id: mapMarkersContent
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: TibiaStyle.marginRelated
RowLayout {
spacing: 0
Layout.fillWidth: true
GridView {
id: minimapMarkersGridView
property var markerSymbolsToShow: rendererWrapper.markerSymbolsToShow
onMarkerSymbolsToShowChanged: {
// needs this workaround because otherwise the model wont work
model = markerSymbolsToShow.slice(0);
}
Layout.preferredHeight: 4 * cellWidth - TibiaStyle.marginRelated
Layout.fillWidth: true
cellWidth: 16 + TibiaStyle.marginRelated
cellHeight: cellWidth
flow: GridView.FlowLeftToRight
interactive: false //prevent flick behavior on touch screens
boundsBehavior: Flickable.StopAtBounds
model: markerSymbolsToShow
delegate: TibiaIconSelectionButton {
required property int index
width: 16
height: 16
iconPath: "image://minimap-markers/" + index
checked: rendererWrapper.markerSymbolsToShow[index]
onCheckedChanged: {
rendererWrapper.setMinimapMarker(index, checked);
} //onCheckedChanged
} //delegate: TibiaIconSelectionButton
Tooltip {
anchors.fill: parent
text: qsTrId("cyclopedia_map_information_panel_map_marker_tooltip")
} //Tooltip
} //GridView
ColumnLayout {
Layout.alignment: Qt.AlignTop
spacing: TibiaStyle.marginRelated
TibiaIconSelectionButton {
property var checkedValue: minimapRenderer.showNPCMarkers
onCheckedValueChanged: {
checked = checkedValue;
} //TibiaIconSelectionButton
iconPath: "/images/icon-map-npc.png"
iconOffset: Qt.point(10,6)
width: 16
height: 16
checked: checkedValue
onCheckedChanged: {
minimapRenderer.showNPCMarkers = checked;
} //onCheckedChanged
Tooltip {
anchors.fill: parent
text: qsTrId("cyclopedia_map_information_panel_npc_marker_tooltip")
} //Tooltip
} //TibiaIconSelectionButton
TibiaIconSelectionButton {
property var checkedValue: minimapRenderer.showPassages
onCheckedValueChanged: {
checked = checkedValue;
} //onCheckedValueChanged
iconPath: "/images/icon-map-passage-idle.png"
iconOffset: Qt.point(0,0)
width: 16
height: 16
checked: rendererWrapper.showPassages
onCheckedChanged: {
minimapRenderer.showPassages = checked;
} //onCheckedChanged
Tooltip {
anchors.fill: parent
text: qsTrId("cyclopedia_map_information_panel_passage_marker_tooltip")
} //Tooltip
} //TibiaIconSelectionButton
TibiaIconSelectionButton {
property var checkedValue: minimapRenderer.showHouses
onCheckedValueChanged: {
checked = checkedValue;
} //onCheckedValueChanged
iconPath: "/images/icon-map-house.png"
iconOffset: Qt.point(0,0)
width: 16
height: 16
checked: rendererWrapper.showHouses
onCheckedChanged: {
minimapRenderer.showHouses = checked;
} //onCheckedChanged
Tooltip {
anchors.fill: parent
text: qsTrId("cyclopedia_map_information_panel_house_marker_tooltip")
} //Tooltip
} //TibiaIconSelectionButton
} //ColumnLayout
} //RowLayout
TibiaCheckBox {
text: qsTrId("cyclopedia_map_information_panel_show_all")
shouldBeChecked: {
var allMinimapMarkers = true;
for (var i = 0; i < TibiaStyle.numberOfMinimapMarkers; i++) {
if (!rendererWrapper.markerSymbolsToShow[i]) {
allMinimapMarkers = false;
break;
}
}
return minimapRenderer.showNPCMarkers
&& minimapRenderer.showPassages
&& minimapRenderer.showHouses
&& allMinimapMarkers;
}
onClicked: {
if (checked) {
rendererWrapper.resetMarkerFilters(true);
} else {
rendererWrapper.resetMarkerFilters(false);
}
} //onClicked
} //TibiaCheckbox
} //ColumnLayout
} //TibiaFrame1PixelDown
TibiaText {
Layout.alignment: Qt.AlignCenter
text: qsTrId("cyclopedia_map_information_panel_views_caption")
} //TibiaText
TibiaFrame1PixelDown {
Layout.fillWidth: true
Layout.preferredHeight: viewContent.height + TibiaStyle.marginRelated * 2
ColumnLayout {
id: viewContent
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: TibiaStyle.marginRelated
anchors.leftMargin: TibiaStyle.marginRelated
anchors.rightMargin: TibiaStyle.marginRelated
ButtonGroup { id: mapTileTypeExclusiveGroup }
TibiaRadioButton {
text: qsTrId("cyclopedia_map_information_panel_surface_view")
enabled: !isUnderground
ButtonGroup.group: mapTileTypeExclusiveGroup
Component.onCompleted: {
checked = (rendererWrapper.userSelectedMapTileType == MinimapRenderer.Satellite);
}
onCheckedChanged: {
if (checked) {
rendererWrapper.userSelectedMapTileType = MinimapRenderer.Satellite;
}
}
}
TibiaRadioButton {
text: qsTrId("cyclopedia_map_information_panel_map_view")
enabled: !isUnderground
ButtonGroup.group: mapTileTypeExclusiveGroup
Component.onCompleted: {
checked = (rendererWrapper.userSelectedMapTileType == MinimapRenderer.Minimap);
}
onCheckedChanged: {
if (checked) {
rendererWrapper.userSelectedMapTileType = MinimapRenderer.Minimap;
}
}
}
TibiaText {
text: qsTrId("cyclopedia_map_information_panel_level_separator")
enabled: rendererWrapper.isAboveGround
}
TibiaSlider {
id: levelSeparatorSlider
Layout.fillWidth: true
enabled: rendererWrapper.isAboveGround
minimumValue: 0
maximumValue: 100
stepSize: 1
value: rendererWrapper.levelSeparator
onValueChanged: {
rendererWrapper.levelSeparator = value;
} //onValueChanged
} //TibiaSlider
}
}
}
}
TibiaPanelWithCaption {
id: navigationPanel
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
Layout.fillWidth: true
visible: rendererWrapper.showInformationSidebar
caption: qsTrId("cyclopedia_map_navigation_panel_caption")
shouldBeExpanded: controller != null && controller.showNavigationPanel
onExpandedChanged: {
if (controller != null) {
controller.showNavigationPanel = expanded;
}
} //onExpandedChanged
contentDelegate: ColumnLayout {
spacing: TibiaStyle.marginRelated
TibiaText {
visible: controller != null && controller.currentPlayerArea != 0
text: qsTrId("player_area_headline_text")
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
} // TibiaText
TibiaText {
visible: controller != null && controller.currentPlayerArea != 0
text: controller != null ? controller.currentPlayerAreaName : ""
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
} // TibiaText
RowLayout {
Layout.alignment: Qt.AlignTop | Qt.AlignCenter
spacing: TibiaStyle.marginRelated
ColumnLayout {
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
spacing: TibiaStyle.marginRelated
TibiaMinimapRose {
id: minimapRose
timeOfDayNormalized: controller != null ? controller.timeOfDayNormalized : 0.0
onMouseButtonClicked: (offsetX, offsetY) => {
if (offsetX == 0 && offsetY == 0) {
if (controller != null) {
controller.centerToPlayer();
}
} else {
var offset = Qt.point(offsetX * 10, offsetY * 10);
minimapRenderer.camera.referencePoint = Qt.point(0,0);
minimapRenderer.camera.moveDistanceRelativeToReferencePoint(offset);
}
} //onMouseButtonClicked
} //TibiaMinimapRose
RowLayout {
id: buttonsWrapper
spacing: 0
Layout.maximumWidth: minimapRose.width
TibiaIconButton {
id: automap_button_zoomout
sourceUp: "/images/automap-button-zoomout-up.png"
sourceDown: "/images/automap-button-zoomout-down.png"
tooltipText: qsTrId("cyclopedia_map_zoom_out_tooltip")
onClicked: {
changeZoom(-1);
} //onClicked
} // TibiaIconButton
Item { Layout.fillWidth: true }
TibiaIconButton {
id: automap_button_zoomin
sourceUp: "/images/automap-button-zoomin-up.png"
sourceDown: "/images/automap-button-zoomin-down.png"
tooltipText: qsTrId("cyclopedia_map_zoom_in_tooltip")
onClicked: {
changeZoom(1);
} //onClicked
} // TibiaIconButton
} // RowLayout
} // ColumnLayout
TibiaMapLayersSlider {
property int baseLayer: rendererWrapper.baseLayer
onBaseLayerChanged: {
currentLayer = baseLayer;
} //onBaseLayerChanged
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
id: mapLayersSlider
currentLayer: baseLayer
onCurrentLayerChanged: {
rendererWrapper.baseLayer = currentLayer;
} //onCurrentLayerChanged
tooltip: qsTrId("cyclopedia_map_change_layer_tooltip")
} //TibiaMapLayersSlider
} //RowLayout
} //contentDelegate: ColumnLayout
} //TibiaPanelWithCaption
TibiaPanelWithCaption {
id: selectionPanel
Component {
id: areaAndSubAreaInfo
ColumnLayout {
Component {
id: subAreaExplorationProgressBar
TibiaProgressBar {
fillPercentage: selectedItem != null ? (selectedItem.viewpointsFound / selectedItem.viewpointsCount) : 0
frameSource: "/images/1pixel-down-frame.png"
backgroundSource: "/images/backdrop-dark-grey.png"
fillSource: "/images/progressbar-orange-large.png"
frameBorder { left: 1; right: 1; top:1; bottom: 1}
fillOffset { left: 1; right: 1; top:1; bottom: 1}
TibiaText {
anchors.centerIn: parent
text: selectedItem != null ? (selectedItem.viewpointsCount == selectedItem.viewpointsFound
? qsTrId("cyclopedia_map_subarea_complete_caption")
: qsTrId("count_slash_total").arg(selectedItem.viewpointsFound).arg(selectedItem.viewpointsCount)) : ""
} //TibiaText
}
}
Component {
id: subAreaExplorationStartExploring
TibiaButton {
text: qsTrId("cyclopedia_map_start_exploring_button")
enabled: selectedItem != null ? (selectedItem.unlockable != null ? selectedItem.unlockable : false) : false
onClicked: {
if (controller != null) {
controller.startExploring(selectedItem.subAreaID);
}
}
}
}
TibiaText {
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
text: selectedItem != null ? (selectedItem.areaName != null ? selectedItem.areaName : "") : ""
}
TibiaProgressBar {
id: areaExplorationProgressBar
Layout.preferredHeight: TibiaStyle.progressBarLargeHeight
Layout.fillWidth: true
fillPercentage: selectedItem != null ? selectedItem.percentExplored : 0
visible: selectedItem != null ? (selectedItem.percentExplored <= 1 ? true : false ) : false // a higher number than 1 encodes, that the area is not explorable
frameSource: "/images/1pixel-down-frame.png"
backgroundSource: "/images/backdrop-dark-grey.png"
fillSource: "/images/progressbar-orange-large.png"
frameBorder { left: 1; right: 1; top:1; bottom: 1}
fillOffset { left: 1; right: 1; top:1; bottom: 1}
TibiaText {
anchors.centerIn: parent
text: selectedItem != null ? qsTrId("cyclopedia_map_area_progress_caption").arg(parseInt(selectedItem.percentExplored * 100)) : ""
} //TibiaText
} //TibiaProgressBar
TibiaText {
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: qsTrId("area_donation_text")
visible: selectedItem!= null? !selectedItem.rejectDonations : false
Tooltip {
anchors.fill: parent
useRichText: true
text: selectedItem != null? selectedItem.areaDonationsTooltip : ""
} // Tooltip
} // TibiaText
TibiaProgressBar {
id: subareaValueProgressBar
Layout.preferredHeight: TibiaStyle.progressBarLargeHeight
Layout.fillWidth: true
fillPercentage: selectedItem != null ? (selectedItem.percentUnlockedImprovedRespawn) : 0
visible: selectedItem!= null? !selectedItem.rejectDonations : false
frameSource: "/images/1pixel-down-frame.png"
backgroundSource: "/images/backdrop-dark-grey.png"
fillSource: "/images/progressbar-orange-large.png"
frameBorder { left: 1; right: 1; top:1; bottom: 1}
fillOffset { left: 1; right: 1; top:1; bottom: 1}
RowLayout {
anchors.centerIn: parent
TibiaText {
text: selectedItem != null ? selectedItem.areaDonationString : "0"
} //TibiaText
Image {
source: "/images/icon-goldcoin.png"
}
} // RowLayout
Tooltip {
anchors.fill: parent
text: selectedItem != null? qsTrId("donation_progress_tooltip").arg(selectedItem.areaDonationString).arg(selectedItem.areaDonationThreshold).arg(selectedItem.areaDonationThreshold) : ""
} // Tooltip
} //TibiaProgressBar
RowLayout {
Layout.fillWidth: true
visible: selectedItem!= null? !selectedItem.rejectDonations : false
TibiaTextField {
id: donationField
placeholderText: qsTrId("donation_textbox_text")
Layout.fillWidth: true
validator: RegularExpressionValidator { regularExpression: /[0-9]{0,9}/; }
maximumLength: 9
onTextChanged: {
///
} // onTextChanged
Image {
source: "/images/icon-goldcoin.png"
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: TibiaStyle.marginNarrow
}
} // TibiaTextField
TibiaButton {
text: qsTrId("donation_button_text")
Layout.preferredWidth: 50
Layout.fillWidth: true
enabled: (donationField.text.length > 0) && (storeAndResourceBalanceHelper.totalGoldBalance >= parseInt(donationField.text))
onClicked: {
if (controller != null && parseInt(donationField.text) > 0) {
controller.donateMoneyForArea(selectedItem.areaID, parseInt(donationField.text));
donationField.text = "";
}
} // onClicked
} // TibiaButton
} // RowLayout
TibiaText {
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
text: selectedItem != null ? (selectedItem.subAreaName != null ? selectedItem.subAreaName : "") : ""
}
Loader {
sourceComponent: selectedItem != null ? (selectedItem.viewpointsCount == 0 ? subAreaExplorationStartExploring : subAreaExplorationProgressBar) : null
Layout.preferredHeight: TibiaStyle.progressBarLargeHeight
Layout.fillWidth: true
}
Loader {
sourceComponent: selectedItem != null ? ((selectedItem.viewpointsCount != 0 && selectedItem.unlockable) ? subAreaExplorationStartExploring : null) : null
Layout.fillWidth: true
onItemChanged: {
if (item == null) {
Layout.preferredHeight = 0;
} else {
item.text = qsTrId("cyclopedia_map_reset_points_of_interest");
Layout.preferredHeight = TibiaStyle.progressBarLargeHeight;
}
}
} // Loader
Loader {
sourceComponent: creatureOccurrencesComponent
Layout.fillWidth: true
onLoaded: {
item.creatureOccurrencesModel = Qt.binding(function(){ return (selectedItem != null ? selectedItem.creatureOccurrences : null); });
item.showSubAreaName = false;
}
}
}
}
Component {
id: areaInfo
ColumnLayout {
TibiaText {
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
text: selectedItem != null ? (selectedItem.areaName != null ? selectedItem.areaName : "") : ""
}
TibiaProgressBar {
id: areaExplorationProgressBar
Layout.preferredHeight: TibiaStyle.progressBarLargeHeight
Layout.fillWidth: true
fillPercentage: selectedItem != null ? selectedItem.percentExplored : 0
visible: selectedItem != null ? (selectedItem.percentExplored <= 1 ? true : false ) : false // a higher number than 1 encodes, that the area is not explorable
frameSource: "/images/1pixel-down-frame.png"
backgroundSource: "/images/backdrop-dark-grey.png"
fillSource: "/images/progressbar-orange-large.png"
frameBorder { left: 1; right: 1; top:1; bottom: 1}
fillOffset { left: 1; right: 1; top:1; bottom: 1}
TibiaText {
anchors.centerIn: parent
text: selectedItem != null ? qsTrId("cyclopedia_map_area_progress_caption").arg(parseInt(selectedItem.percentExplored * 100)) : ""
} //TibiaText
} //TibiaProgressBar
TibiaText {
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: qsTrId("area_donation_text")
visible: selectedItem!= null? !selectedItem.rejectDonations : false
Tooltip {
anchors.fill: parent
useRichText: true
text: selectedItem != null? selectedItem.areaDonationsTooltip : ""
} // Tooltip
} // TibiaText
TibiaProgressBar {
id: areaValueProgressBar
Layout.preferredHeight: TibiaStyle.progressBarLargeHeight
Layout.fillWidth: true
fillPercentage: selectedItem != null ? (selectedItem.percentUnlockedImprovedRespawn) : 0
visible: selectedItem!= null? !selectedItem.rejectDonations : false
frameSource: "/images/1pixel-down-frame.png"
backgroundSource: "/images/backdrop-dark-grey.png"
fillSource: "/images/progressbar-orange-large.png"
frameBorder { left: 1; right: 1; top:1; bottom: 1}
fillOffset { left: 1; right: 1; top:1; bottom: 1}
RowLayout {
anchors.centerIn: parent
TibiaText {
text: selectedItem != null ? selectedItem.areaDonationString : "0"
} //TibiaText
Image {
source: "/images/icon-goldcoin.png"
}
} // RowLayout
Tooltip {
anchors.fill: parent
text: selectedItem != null? qsTrId("donation_progress_tooltip").arg(selectedItem.areaDonationString).arg(selectedItem.areaDonationThreshold).arg(selectedItem.areaDonationThreshold) : ""
} // Tooltip
} //TibiaProgressBar
RowLayout {
Layout.fillWidth: true
visible: selectedItem!= null? !selectedItem.rejectDonations : false
TibiaTextField {
id: donationFieldArea
placeholderText: qsTrId("donation_textbox_text")
Layout.fillWidth: true
validator: RegularExpressionValidator { regularExpression: /[0-9]{0,9}/; }
maximumLength: 9
onTextChanged: {
} // onTextChanged
Image {
source: "/images/icon-goldcoin.png"
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: TibiaStyle.marginNarrow
}
} // TibiaTextField