mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 18:44:00 +02:00
More attachment bits.
This commit is contained in:
parent
53a2760905
commit
e898b4a900
2 changed files with 88 additions and 3 deletions
|
@ -9,7 +9,11 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QFormLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
|
@ -25,6 +29,10 @@ AttachmentsDialog::AttachmentsDialog() :
|
|||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
setLayout(layout);
|
||||
|
||||
foreach (const AttachmentData& data, Application::getInstance()->getAvatar()->getAttachmentData()) {
|
||||
addAttachment(data);
|
||||
}
|
||||
|
||||
QPushButton* newAttachment = new QPushButton("New Attachment");
|
||||
connect(newAttachment, SIGNAL(clicked(bool)), SLOT(addAttachment()));
|
||||
layout->addWidget(newAttachment);
|
||||
|
@ -34,6 +42,51 @@ AttachmentsDialog::AttachmentsDialog() :
|
|||
connect(buttons, SIGNAL(accepted()), SLOT(deleteLater()));
|
||||
}
|
||||
|
||||
void AttachmentsDialog::addAttachment() {
|
||||
|
||||
void AttachmentsDialog::addAttachment(const AttachmentData& data) {
|
||||
QVBoxLayout* layout = static_cast<QVBoxLayout*>(this->layout());
|
||||
layout->insertWidget(layout->count() - 2, new AttachmentPanel(data));
|
||||
}
|
||||
|
||||
AttachmentPanel::AttachmentPanel(const AttachmentData& data) {
|
||||
QFormLayout* layout = new QFormLayout();
|
||||
setLayout(layout);
|
||||
|
||||
QHBoxLayout* urlBox = new QHBoxLayout();
|
||||
layout->addRow("Model URL:", urlBox);
|
||||
urlBox->addWidget(_modelURL = new QLineEdit(data.modelURL.toString()), 1);
|
||||
QPushButton* chooseURL = new QPushButton("Choose");
|
||||
urlBox->addWidget(chooseURL);
|
||||
connect(chooseURL, SIGNAL(clicked(bool)), SLOT(chooseModelURL()));
|
||||
|
||||
layout->addRow("Joint:", _jointName = new QComboBox());
|
||||
|
||||
QHBoxLayout* translationBox = new QHBoxLayout();
|
||||
translationBox->addWidget(_translationX = new QDoubleSpinBox());
|
||||
translationBox->addWidget(_translationY = new QDoubleSpinBox());
|
||||
translationBox->addWidget(_translationZ = new QDoubleSpinBox());
|
||||
layout->addRow("Translation:", translationBox);
|
||||
|
||||
QHBoxLayout* rotationBox = new QHBoxLayout();
|
||||
rotationBox->addWidget(_rotationX = new QDoubleSpinBox());
|
||||
rotationBox->addWidget(_rotationY = new QDoubleSpinBox());
|
||||
rotationBox->addWidget(_rotationZ = new QDoubleSpinBox());
|
||||
layout->addRow("Rotation:", rotationBox);
|
||||
|
||||
layout->addRow("Scale:", _scale = new QDoubleSpinBox());
|
||||
_scale->setSingleStep(0.01);
|
||||
_scale->setMaximum(FLT_MAX);
|
||||
|
||||
QPushButton* remove = new QPushButton("Delete");
|
||||
layout->addRow(remove);
|
||||
connect(remove, SIGNAL(clicked(bool)), SLOT(deleteLater()));
|
||||
}
|
||||
|
||||
void AttachmentPanel::chooseModelURL() {
|
||||
ModelsBrowser modelBrowser(ATTACHMENT_MODEL, this);
|
||||
connect(&modelBrowser, SIGNAL(selected(QString)), SLOT(setModelURL(const QString&)));
|
||||
modelBrowser.browse();
|
||||
}
|
||||
|
||||
void AttachmentPanel::setModelURL(const QString& url) {
|
||||
_modelURL->setText(url);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
#include <AvatarData.h>
|
||||
|
||||
class QComboBox;
|
||||
class QDoubleSpinner;
|
||||
class QLineEdit;
|
||||
|
||||
/// Allows users to edit the avatar attachments.
|
||||
class AttachmentsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
@ -24,7 +30,33 @@ public:
|
|||
|
||||
private slots:
|
||||
|
||||
void addAttachment();
|
||||
void addAttachment(const AttachmentData& data = AttachmentData());
|
||||
};
|
||||
|
||||
/// A panel controlling a single attachment.
|
||||
class AttachmentPanel : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
AttachmentPanel(const AttachmentData& data = AttachmentData());
|
||||
|
||||
private slots:
|
||||
|
||||
void chooseModelURL();
|
||||
void setModelURL(const QString& url);
|
||||
|
||||
private:
|
||||
|
||||
QLineEdit* _modelURL;
|
||||
QComboBox* _jointName;
|
||||
QDoubleSpinBox* _translationX;
|
||||
QDoubleSpinBox* _translationY;
|
||||
QDoubleSpinBox* _translationZ;
|
||||
QDoubleSpinBox* _rotationX;
|
||||
QDoubleSpinBox* _rotationY;
|
||||
QDoubleSpinBox* _rotationZ;
|
||||
QDoubleSpinBox* _scale;
|
||||
};
|
||||
|
||||
#endif // hifi_AttachmentsDialog_h
|
||||
|
|
Loading…
Reference in a new issue