Skip to content

Commit

Permalink
refactor: SlotPreview to use camelCase signals
Browse files Browse the repository at this point in the history
  • Loading branch information
sithlord48 committed Jun 14, 2024
1 parent 3c00d4c commit e349a77
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
9 changes: 6 additions & 3 deletions src/widgets/data/SlotPreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@ SlotPreview::SlotPreview(int index, QWidget *parent)
btn_remove = new QToolButton(this);
btn_remove->setIcon(QIcon::fromTheme(QString("edit-clear"), QPixmap(":/common/edit-clear")));
btn_remove->setToolTip(tr("Clear Slot"));
connect(btn_remove, &QToolButton::clicked, this, [this] { Q_EMIT btn_remove_clicked(m_index); });
connect(btn_remove, &QToolButton::clicked, this, [this] { Q_EMIT remove(m_index); });
/* REMOVE FOR 2.0 */connect(btn_remove, &QToolButton::clicked, this, [this] { Q_EMIT btn_remove_clicked(m_index); });

btn_copy = new QToolButton(this);
btn_copy->setIcon(QIcon::fromTheme(QString("edit-copy"), QPixmap(":/common/edit-copy")));
btn_copy->setToolTip(tr("Copy Slot"));
connect(btn_copy, &QToolButton::clicked, this, [this] { Q_EMIT btn_copy_clicked(m_index); });
connect(btn_copy, &QToolButton::clicked, this, [this] { Q_EMIT copy(m_index); });
/* REMOVE FOR 2.0 */connect(btn_copy, &QToolButton::clicked, this, [this] { Q_EMIT btn_copy_clicked(m_index); });

btn_paste = new QToolButton(this);
btn_paste->setIcon(QIcon::fromTheme(QString("edit-paste"), QPixmap(":/common/edit-paste")));
btn_paste->setToolTip(tr("Paste Into Slot"));
connect(btn_paste, &QToolButton::clicked, this, [this] { Q_EMIT btn_paste_clicked(m_index); });
connect(btn_paste, &QToolButton::clicked, this, [this] { Q_EMIT paste(m_index); });
/* REMOVE FOR 2.0 */connect(btn_paste, &QToolButton::clicked, this, [this] { Q_EMIT btn_paste_clicked(m_index); });

const QList<QToolButton*> buttons = findChildren<QToolButton *>();

Expand Down
26 changes: 22 additions & 4 deletions src/widgets/data/SlotPreview.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,28 @@ class FF7TKWIDGETS_EXPORT SlotPreview : public QLabel
void setPSXText(const QString &text);

signals:
void clicked(int); /**< \brief Signal: User Clicked on preview, returns index of click */
void btn_remove_clicked(int); /**< \brief Signal: User Clicked on remove, returns index of click */
void btn_copy_clicked(int); /**< \brief Signal: User Clicked on copy, returns index of click */
void btn_paste_clicked(int); /**< \brief Signal: User Clicked on paste, returns index of click */
/**
* \brief Signal: User Clicked on preview, returns index of click
*/
void clicked(int);

/**
* \brief Signal: User Clicked on remove, returns index of click
*/
void remove(int);
[[ deprecated ("will be removed in ff7tk 2.0, Use SlotPreview::remove") ]]void btn_remove_clicked(int);

/**
* \brief Signal: User Clicked on copy, returns index of click
*/
void copy(int);
[[ deprecated ("will be removed in ff7tk 2.0, Use SlotPreview::copy") ]]void btn_copy_clicked(int);

/**
* \brief Signal: User Clicked on paste, returns index of click
*/
void paste(int);
[[ deprecated ("will be removed in ff7tk 2.0, Use SlotPreview::paste") ]]void btn_paste_clicked(int);

protected:
void mousePressEvent(QMouseEvent *ev);
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/data/SlotSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ void SlotSelect::setSlotPreview(int s)
}

connect(preview[s], &SlotPreview::clicked, this, &SlotSelect::button_clicked);
connect(preview[s], &SlotPreview::btn_remove_clicked, this, &SlotSelect::remove_slot);
connect(preview[s], &SlotPreview::btn_copy_clicked, this, &SlotSelect::copy_slot);
connect(preview[s], &SlotPreview::btn_paste_clicked, this, &SlotSelect::paste_slot);
connect(preview[s], &SlotPreview::remove, this, &SlotSelect::remove_slot);
connect(preview[s], &SlotPreview::copy, this, &SlotSelect::copy_slot);
connect(preview[s], &SlotPreview::paste, this, &SlotSelect::paste_slot);
}

void SlotSelect::newFile(void)
Expand Down

0 comments on commit e349a77

Please sign in to comment.