ff7tk  1.2.0.13
Work with Final Fantasy 7 game data
LocationViewer.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2013 - 2023 Chris Rizzitello <sithlord48@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-or-later
3 
4 #pragma once
5 
6 #include <QEvent>
7 #include <QModelIndex>
8 #include <QWidget>
9 #include <ff7tkwidgets_export.h>
10 
11 class QAction;
12 class QCheckBox;
13 class QGroupBox;
14 class QLabel;
15 class QLineEdit;
16 class QListWidget;
17 class QPushButton;
18 class QSpinBox;
19 class QTableWidget;
20 class QToolButton;
21 
26 class FF7TKWIDGETS_EXPORT LocationViewer : public QWidget
27 {
28  Q_OBJECT
29 public:
30  enum filterMode {NAME, ITEM};
31  explicit LocationViewer(QWidget *parent = nullptr);
32  void setFilterString(QString filter = "", LocationViewer::filterMode mode = LocationViewer::NAME);
33 signals:
34  void locationChanged(QString);
35  void xChanged(int x);
36  void yChanged(int y);
37  void tChanged(int t);
38  void dChanged(int d);
39  void mapIdChanged(int mapId);
40  void locIdChanged(int locId);
41  void locationStringChanged(QString);
42  void fieldItemConnectRequest(quint8 index, QList<quint16> offset, QList<quint8>bit);
43  void fieldItemCheck(int index);
44  void fieldItemChanged(int index, bool checked);
45 
46 public slots:
47  void setSelected(const QString &);
48  void setRegion(const QString &region);
49  void setX(int x);
50  void setY(int y);
51  void setT(int t);
52  void setD(int d);
53  void setMapId(int mapId);
54  void setLocationId(int locId);
55  void setLocationString(const QString &);
56  void setHorizontalHeaderStyle(QString styleSheet);
57  void setFieldItemChecked(int row, bool checked);
58  void init_fieldItems(void);
59  void setAdvancedMode(bool advancedMode);
60  bool advancedMode(void);
61 
62 private slots:
63  void itemChanged(int currentRow, int currentColumn, int prevRow, int prevColumn);
64  void sbMapIdChanged(int mapId);
65  void sbLocIdChanged(int locId);
66  void sbXChanged(int x);
67  void sbYChanged(int y);
68  void sbTChanged(int t);
69  void sbDChanged(int d);
70  void lineLocationNameChanged(const QString &);
71  void setLocation(int mapId, int locId);
72  void filterLocations(QString filter);
73  void actionNameSearchToggled(bool checked);
74  void actionItemSearchToggled(bool checked);
75  void actionRegExpSearchToggled(bool checked);
76  void actionCaseSensitiveToggled(bool checked);
77  void fieldItemListItemChanged(QModelIndex index);
78  void btnUpdateSaveLocationClicked();
79 protected:
80  void resizeEvent(QResizeEvent *ev);
81  void changeEvent(QEvent *e);
82 private:
83  const int COL_ID = 0;
84  const int COL_FNAME = 1;
85  const int COL_NAME = 2;
86  void init_display(void);
87  void init_connections(void);
88  void init_disconnect(void);
89  void updateText();
90  void updateItemText(int locID = -1, bool currentLoc = false);
91  QString translate(QString text);
92  void searchItem(QRegularExpression exp);
93  void searchName(QRegularExpression exp);
94  QString region;
95  int currentStartingLocation = -1;
96  bool regExpSearch;
97  bool caseSensitive;
98  bool _advancedMode;
99  quint8 searchMode;
100  QTableWidget *locationTable;
101  QToolButton *btnSearchOptions;
102  QAction *actionNameSearch;
103  QAction *actionItemSearch;
104  QAction *actionRegExpSearch;
105  QAction *actionCaseSensitive;
106  QWidget *CoordsWidget;
107  QLabel *lblLocationPreview;
108  QLineEdit *lineTableFilter;
109  QLineEdit *lineLocationName;
110  QSpinBox *sbMapID;
111  QSpinBox *sbLocID;
112  QSpinBox *sbX;
113  QSpinBox *sbY;
114  QSpinBox *sbT;
115  QSpinBox *sbD;
116  QListWidget *fieldItemList;
117  QGroupBox *groupFieldItems;
118  QPushButton *btnUpdateSaveLocation;
119 
120  inline static const QString _tooltip = QStringLiteral("<html><head/><body><p><img src=\":/locations/%1_%2\" width=\"%3\" height\"%4\" /></p></body></html>");
121 };
LocationViewer
Set Saves Location or View Field Locations and Toggle the items picked up from them.
Definition: LocationViewer.h:26
LocationViewer::filterMode
filterMode
Definition: LocationViewer.h:30
LocationViewer::NAME
@ NAME
Definition: LocationViewer.h:30