2018-04-07 08:44:39 +00:00
|
|
|
#ifndef SKELETON_PART_LIST_WIDGET_H
|
|
|
|
#define SKELETON_PART_LIST_WIDGET_H
|
|
|
|
#include <QListWidget>
|
|
|
|
#include <map>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
2018-04-18 01:49:23 +00:00
|
|
|
#include <QMouseEvent>
|
2018-04-07 08:44:39 +00:00
|
|
|
#include "skeletondocument.h"
|
|
|
|
|
|
|
|
class SkeletonPartWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2018-04-08 01:30:55 +00:00
|
|
|
signals:
|
|
|
|
void setPartLockState(QUuid partId, bool locked);
|
|
|
|
void setPartVisibleState(QUuid partId, bool visible);
|
|
|
|
void setPartSubdivState(QUuid partId, bool subdived);
|
2018-04-11 09:19:27 +00:00
|
|
|
void setPartDisableState(QUuid partId, bool disabled);
|
2018-04-15 12:11:51 +00:00
|
|
|
void setPartXmirrorState(QUuid partId, bool mirrored);
|
|
|
|
void setPartZmirrorState(QUuid partId, bool mirrored);
|
2018-04-17 16:14:31 +00:00
|
|
|
void setPartDeformThickness(QUuid partId, float thickness);
|
|
|
|
void setPartDeformWidth(QUuid partId, float width);
|
2018-04-26 02:23:22 +00:00
|
|
|
void setPartRoundState(QUuid partId, bool rounded);
|
|
|
|
void setPartColorState(QUuid partId, bool hasColor, QColor color);
|
2018-06-16 06:41:52 +00:00
|
|
|
void setPartInverseState(QUuid partId, bool inverse);
|
|
|
|
void movePartUp(QUuid partId);
|
|
|
|
void movePartDown(QUuid partId);
|
|
|
|
void movePartToTop(QUuid partId);
|
|
|
|
void movePartToBottom(QUuid partId);
|
2018-04-18 01:49:23 +00:00
|
|
|
void checkPart(QUuid partId);
|
2018-04-18 02:37:50 +00:00
|
|
|
void groupOperationAdded();
|
2018-04-26 02:23:22 +00:00
|
|
|
void enableBackgroundBlur();
|
|
|
|
void disableBackgroundBlur();
|
2018-04-07 08:44:39 +00:00
|
|
|
public:
|
|
|
|
SkeletonPartWidget(const SkeletonDocument *document, QUuid partId);
|
|
|
|
void reload();
|
2018-04-08 01:30:55 +00:00
|
|
|
void updatePreview();
|
|
|
|
void updateLockButton();
|
|
|
|
void updateVisibleButton();
|
|
|
|
void updateSubdivButton();
|
2018-04-11 09:19:27 +00:00
|
|
|
void updateDisableButton();
|
2018-04-15 12:11:51 +00:00
|
|
|
void updateXmirrorButton();
|
|
|
|
void updateZmirrorButton();
|
2018-04-17 16:14:31 +00:00
|
|
|
void updateDeformButton();
|
2018-04-26 02:23:22 +00:00
|
|
|
void updateRoundButton();
|
|
|
|
void updateColorButton();
|
2018-04-23 00:10:01 +00:00
|
|
|
void updateCheckedState(bool checked);
|
2018-04-18 01:49:23 +00:00
|
|
|
protected:
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event);
|
2018-04-17 13:13:32 +00:00
|
|
|
public slots:
|
2018-04-17 16:14:31 +00:00
|
|
|
void showDeformSettingPopup(const QPoint &pos);
|
2018-04-26 02:23:22 +00:00
|
|
|
void showColorSettingPopup(const QPoint &pos);
|
|
|
|
void showContextMenu(const QPoint &pos);
|
2018-05-10 09:16:22 +00:00
|
|
|
private: // need initialize
|
2018-04-07 08:44:39 +00:00
|
|
|
const SkeletonDocument *m_document;
|
|
|
|
QUuid m_partId;
|
2018-05-10 09:16:22 +00:00
|
|
|
private:
|
2018-04-07 08:44:39 +00:00
|
|
|
QLabel *m_previewLabel;
|
|
|
|
QPushButton *m_visibleButton;
|
2018-04-07 12:30:26 +00:00
|
|
|
QPushButton *m_lockButton;
|
|
|
|
QPushButton *m_subdivButton;
|
2018-04-11 09:19:27 +00:00
|
|
|
QPushButton *m_disableButton;
|
2018-04-15 12:11:51 +00:00
|
|
|
QPushButton *m_xMirrorButton;
|
|
|
|
QPushButton *m_zMirrorButton;
|
2018-04-17 16:14:31 +00:00
|
|
|
QPushButton *m_deformButton;
|
2018-04-23 00:10:01 +00:00
|
|
|
QPushButton *m_roundButton;
|
2018-04-26 02:23:22 +00:00
|
|
|
QPushButton *m_colorButton;
|
2018-04-07 08:44:39 +00:00
|
|
|
QLabel *m_nameLabel;
|
2018-04-23 00:10:01 +00:00
|
|
|
QWidget *m_backgroundWidget;
|
2018-04-08 01:30:55 +00:00
|
|
|
private:
|
2018-04-17 16:14:31 +00:00
|
|
|
void initToolButton(QPushButton *button);
|
2018-04-26 02:23:22 +00:00
|
|
|
void initToolButtonWithoutFont(QPushButton *button);
|
2018-04-08 01:30:55 +00:00
|
|
|
void initButton(QPushButton *button);
|
|
|
|
void updateButton(QPushButton *button, QChar icon, bool highlighted);
|
2018-05-10 09:16:22 +00:00
|
|
|
void updateAllButtons();
|
2018-04-07 08:44:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SkeletonPartListWidget : public QListWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2018-04-23 00:10:01 +00:00
|
|
|
SkeletonPartListWidget(const SkeletonDocument *document, QWidget *parent);
|
2018-04-07 08:44:39 +00:00
|
|
|
public slots:
|
|
|
|
void partChanged(QUuid partId);
|
|
|
|
void partListChanged();
|
|
|
|
void partPreviewChanged(QUuid partid);
|
2018-04-08 01:30:55 +00:00
|
|
|
void partLockStateChanged(QUuid partId);
|
|
|
|
void partVisibleStateChanged(QUuid partId);
|
|
|
|
void partSubdivStateChanged(QUuid partId);
|
2018-04-11 09:19:27 +00:00
|
|
|
void partDisableStateChanged(QUuid partId);
|
2018-04-15 12:11:51 +00:00
|
|
|
void partXmirrorStateChanged(QUuid partId);
|
2018-04-17 16:14:31 +00:00
|
|
|
void partDeformChanged(QUuid partId);
|
2018-04-26 02:23:22 +00:00
|
|
|
void partRoundStateChanged(QUuid partId);
|
|
|
|
void partColorStateChanged(QUuid partId);
|
2018-04-18 01:49:23 +00:00
|
|
|
void partChecked(QUuid partId);
|
|
|
|
void partUnchecked(QUuid partId);
|
2018-04-23 00:10:01 +00:00
|
|
|
protected:
|
|
|
|
virtual QSize sizeHint() const;
|
2018-04-07 08:44:39 +00:00
|
|
|
private:
|
|
|
|
const SkeletonDocument *m_document;
|
|
|
|
std::map<QUuid, QListWidgetItem *> m_itemMap;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|