Merge pull request #3803 from stojce/20170

CR for Job #20170 - Add checkbox to boolean item in NewEditEntities.js properties panel
This commit is contained in:
Brad Hefta-Gaub 2014-11-16 08:48:59 -08:00
commit 3ab5753ce0
4 changed files with 37 additions and 11 deletions

View file

@ -41,7 +41,7 @@ EntityPropertyDialogBox = (function () {
array.push({ label: "Entity Type:" + properties.type, type: "header" }); array.push({ label: "Entity Type:" + properties.type, type: "header" });
index++; index++;
array.push({ label: "Locked:", value: properties.locked }); array.push({ label: "Locked:", type: "checkbox", value: properties.locked });
index++; index++;
if (properties.type == "Model") { if (properties.type == "Model") {
@ -49,7 +49,7 @@ EntityPropertyDialogBox = (function () {
index++; index++;
array.push({ label: "Animation URL:", value: properties.animationURL }); array.push({ label: "Animation URL:", value: properties.animationURL });
index++; index++;
array.push({ label: "Animation is playing:", value: properties.animationIsPlaying }); array.push({ label: "Animation is playing:", type: "checkbox", value: properties.animationIsPlaying });
previousAnimationIsPlaying = properties.animationIsPlaying; previousAnimationIsPlaying = properties.animationIsPlaying;
index++; index++;
array.push({ label: "Animation FPS:", value: properties.animationFPS }); array.push({ label: "Animation FPS:", value: properties.animationFPS });
@ -140,15 +140,15 @@ EntityPropertyDialogBox = (function () {
index++; index++;
array.push({ label: "Mass:", value: properties.mass.toFixed(decimals) }); array.push({ label: "Mass:", value: properties.mass.toFixed(decimals) });
index++; index++;
array.push({ label: "Ignore for Collisions:", value: properties.ignoreForCollisions }); array.push({ label: "Ignore for Collisions:", type: "checkbox", value: properties.ignoreForCollisions });
index++; index++;
array.push({ label: "Collisions Will Move:", value: properties.collisionsWillMove }); array.push({ label: "Collisions Will Move:", type: "checkbox", value: properties.collisionsWillMove });
index++; index++;
array.push({ label: "Lifetime:", value: properties.lifetime.toFixed(decimals) }); array.push({ label: "Lifetime:", value: properties.lifetime.toFixed(decimals) });
index++; index++;
array.push({ label: "Visible:", value: properties.visible }); array.push({ label: "Visible:", type: "checkbox", value: properties.visible });
index++; index++;
array.push({ label: "Script:", value: properties.script }); array.push({ label: "Script:", value: properties.script });
@ -354,4 +354,3 @@ EntityPropertyDialogBox = (function () {
return that; return that;
}()); }());

View file

@ -710,7 +710,7 @@ function handeMenuEvent(menuItem) {
var selectedModel = form[0].value; var selectedModel = form[0].value;
if (form[1].value == "Properties") { if (form[1].value == "Properties") {
editModelID = selectedModel; editModelID = selectedModel;
showPropertiesForm(editModelID); entityPropertyDialogBox.openDialog(editModelID);
} else if (form[1].value == "Delete") { } else if (form[1].value == "Delete") {
Entities.deleteEntity(selectedModel); Entities.deleteEntity(selectedModel);
} else if (form[1].value == "Teleport") { } else if (form[1].value == "Teleport") {

View file

@ -252,6 +252,7 @@ QScriptValue WindowScriptingInterface::doPeekNonBlockingFormResult(QScriptValue
int e = -1; int e = -1;
int d = -1; int d = -1;
int c = -1; int c = -1;
int h = -1;
for (int i = 0; i < _form.property("length").toInt32(); ++i) { for (int i = 0; i < _form.property("length").toInt32(); ++i) {
QScriptValue item = _form.property(i); QScriptValue item = _form.property(i);
QScriptValue value = item.property("value"); QScriptValue value = item.property("value");
@ -275,6 +276,11 @@ QScriptValue WindowScriptingInterface::doPeekNonBlockingFormResult(QScriptValue
array.engine()->undefinedValue() array.engine()->undefinedValue()
); );
_form.setProperty(i, item); _form.setProperty(i, item);
} else if (item.property("type").toString() == "checkbox") {
h++;
value = _checks.at(h)->checkState() == Qt::Checked;
item.setProperty("value", value);
_form.setProperty(i, item);
} else { } else {
e += 1; e += 1;
bool ok = true; bool ok = true;
@ -309,6 +315,7 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a
int e = -1; int e = -1;
int d = -1; int d = -1;
int c = -1; int c = -1;
int h = -1;
for (int i = 0; i < _form.property("length").toInt32(); ++i) { for (int i = 0; i < _form.property("length").toInt32(); ++i) {
QScriptValue item = _form.property(i); QScriptValue item = _form.property(i);
QScriptValue value = item.property("value"); QScriptValue value = item.property("value");
@ -332,6 +339,11 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a
array.engine()->undefinedValue() array.engine()->undefinedValue()
); );
_form.setProperty(i, item); _form.setProperty(i, item);
} else if (item.property("type").toString() == "checkbox") {
h++;
value = _checks.at(h)->checkState() == Qt::Checked;
item.setProperty("value", value);
_form.setProperty(i, item);
} else { } else {
e += 1; e += 1;
bool ok = true; bool ok = true;
@ -362,6 +374,7 @@ QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue a
_edits.clear(); _edits.clear();
_directories.clear(); _directories.clear();
_combos.clear(); _combos.clear();
_checks.clear();
array = _form; array = _form;
return (_formResult == QDialog::Accepted); return (_formResult == QDialog::Accepted);
@ -387,6 +400,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal
int e = -1; int e = -1;
int d = -1; int d = -1;
int c = -1; int c = -1;
int h = -1;
for (int i = 0; i < form.property("length").toInt32(); ++i) { for (int i = 0; i < form.property("length").toInt32(); ++i) {
QScriptValue item = form.property(i); QScriptValue item = form.property(i);
QScriptValue value = item.property("value"); QScriptValue value = item.property("value");
@ -410,6 +424,11 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal
form.engine()->undefinedValue() form.engine()->undefinedValue()
); );
form.setProperty(i, item); form.setProperty(i, item);
} else if (item.property("type").toString() == "checkbox") {
h++;
value = _checks.at(h)->checkState() == Qt::Checked;
item.setProperty("value", value);
form.setProperty(i, item);
} else { } else {
e += 1; e += 1;
bool ok = true; bool ok = true;
@ -436,6 +455,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal
delete editDialog; delete editDialog;
_combos.clear(); _combos.clear();
_checks.clear();
_edits.clear(); _edits.clear();
_directories.clear(); _directories.clear();
return (result == QDialog::Accepted); return (result == QDialog::Accepted);
@ -522,6 +542,12 @@ QDialog* WindowScriptingInterface::createForm(const QString& title, QScriptValue
} }
_combos.push_back(combo); _combos.push_back(combo);
formLayout->addRow(new QLabel(item.property("label").toString()), combo); formLayout->addRow(new QLabel(item.property("label").toString()), combo);
} else if (item.property("type").toString() == "checkbox") {
QCheckBox* check = new QCheckBox();
check->setTristate(false);
check->setCheckState(item.property("value").toString() == "true" ? Qt::Checked : Qt::Unchecked);
_checks.push_back(check);
formLayout->addRow(new QLabel(item.property("label").toString()), check);
} else { } else {
QLineEdit* edit = new QLineEdit(item.property("value").toString()); QLineEdit* edit = new QLineEdit(item.property("value").toString());
edit->setMinimumWidth(200); edit->setMinimumWidth(200);

View file

@ -90,6 +90,7 @@ private:
bool _nonBlockingFormActive; bool _nonBlockingFormActive;
int _formResult; int _formResult;
QVector<QComboBox*> _combos; QVector<QComboBox*> _combos;
QVector<QCheckBox*> _checks;
QVector<QLineEdit*> _edits; QVector<QLineEdit*> _edits;
QVector<QPushButton*> _directories; QVector<QPushButton*> _directories;
}; };