ff7tk  1.2.0.13
Work with Final Fantasy 7 game data
SlotPreview.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2012 - 2023 Chris Rizzitello <sithlord48@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-or-later
3 
4 #pragma once
5 
6 #include <QLabel>
7 #include <ff7tkwidgets_export.h>
8 
9 class QHBoxLayout;
10 class QToolButton;
11 class QVBoxLayout;
12 class SaveIcon;
13 
19 class FF7TKWIDGETS_EXPORT SlotPreview : public QLabel
20 {
21  Q_OBJECT
22 public:
24  enum MODE {
27  FF7SAVE
28  };
29  Q_ENUM(MODE)
30  SlotPreview(int index = 0, QWidget *parent = nullptr);
31  int index(void);
32  void setParty(QPixmap p1, QPixmap p2, QPixmap p3);
33  void setName(QString);
34  void setLevel(int);
35  void setLocation(QString);
36  void setGil(int);
37  void setTime(int hour, int min);
38  void setPsxIcon(const QByteArray &icon_data, quint8 frames = 1);
39  void setPsxIcon(const QList<QByteArray> &icon_data);
40  void setMode(SlotPreview::MODE mode);
41  void setBackground(const QImage &image);
42  void setPSXText(const QString &text);
43 
44 signals:
48  void clicked(int);
49 
53  void remove(int);
54  [[ deprecated ("will be removed in ff7tk 2.0, Use SlotPreview::remove") ]]void btn_remove_clicked(int);
55 
59  void copy(int);
60  [[ deprecated ("will be removed in ff7tk 2.0, Use SlotPreview::copy") ]]void btn_copy_clicked(int);
61 
65  void paste(int);
66  [[ deprecated ("will be removed in ff7tk 2.0, Use SlotPreview::paste") ]]void btn_paste_clicked(int);
67 
68 protected:
69  void mousePressEvent(QMouseEvent *ev);
70  void paintEvent(QPaintEvent *);
71 
72 private:
73  QToolButton *btn_copy = nullptr;
74  QToolButton *btn_paste = nullptr;
75  QToolButton *btn_remove = nullptr;
76  SaveIcon *m_psxIcon = nullptr;
77 
78  int m_index;
79  int m_lineHeight;
80 
81  MODE m_mode = EMPTY;
82  QString m_psxText = QString();
83  QImage m_background = QImage();
84  QPixmap m_p1 = QPixmap();
85  QPixmap m_p2 = QPixmap();
86  QPixmap m_p3 = QPixmap();
87  QString m_name = QString();
88  QString m_time = QString();
89  QString m_level = QString();
90  QString m_gil = QString();
91  QString m_location = QString();
92 };
SlotPreview::MODE
MODE
Definition: SlotPreview.h:24
SlotPreview::PSXGAME
@ PSXGAME
PSX Game or linked block.
Definition: SlotPreview.h:26
SaveIcon
PSX icon data as a QPixmap.
Definition: SaveIcon.h:14
SlotPreview::EMPTY
@ EMPTY
Empty Slot.
Definition: SlotPreview.h:25
SlotPreview
Preview a Single Slot on a Psx memory card or FF7 Save file.
Definition: SlotPreview.h:19