History

add rescale support to entity properties UI

ZappoMan committed 12 years ago

Commit cbc50251 parent 3f517be3 files · +91 −0Browse files

Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 3 files). Show all

Unified · Split

interface/src/scripting/WindowScriptingInterface.cpp+60−0
@@ -127,6 +127,14 @@ QScriptValue WindowScriptingInterface::getNonBlockingFormResult(QScriptValue for · 126 unmodified lines
127 return retVal;127 return retVal;
128}128}
129 129
130QScriptValue WindowScriptingInterface::peekNonBlockingFormResult(QScriptValue form) {
131 QScriptValue retVal;
132 QMetaObject::invokeMethod(this, "doPeekNonBlockingFormResult", Qt::BlockingQueuedConnection,
133 Q_RETURN_ARG(QScriptValue, retVal),
134 Q_ARG(QScriptValue, form));
135 return retVal;
136}
137
130 138
131/// Display an alert box139/// Display an alert box
132/// \param const QString& message message to display140/// \param const QString& message message to display
@@ -234,6 +242,58 @@ bool WindowScriptingInterface::nonBlockingFormActive() { · 101 unmodified lines
234 return _nonBlockingFormActive;242 return _nonBlockingFormActive;
235}243}
236 244
245QScriptValue WindowScriptingInterface::doPeekNonBlockingFormResult(QScriptValue array) {
246 QScriptValue retVal;
247
248 int e = -1;
249 int d = -1;
250 int c = -1;
251 for (int i = 0; i < _form.property("length").toInt32(); ++i) {
252 QScriptValue item = _form.property(i);
253 QScriptValue value = item.property("value");
254
255 if (item.property("button").toString() != "") {
256 // Nothing to do
257 } else if (item.property("type").toString() == "inlineButton") {
258 // Nothing to do
259 } else if (item.property("type").toString() == "header") {
260 // Nothing to do
261 } else if (item.property("directory").toString() != "") {
262 d += 1;
263 value = _directories.at(d)->property("path").toString();
264 item.setProperty("directory", value);
265 _form.setProperty(i, item);
266 } else if (item.property("options").isArray()) {
267 c += 1;
268 item.setProperty("value", _combos.at(c)->currentText());
269 _form.setProperty(i, item);
270 } else {
271 e += 1;
272 bool ok = true;
273 if (value.isNumber()) {
274 value = _edits.at(e)->text().toDouble(&ok);
275 } else if (value.isString()) {
276 value = _edits.at(e)->text();
277 } else if (value.isBool()) {
278 if (_edits.at(e)->text() == "true") {
279 value = true;
280 } else if (_edits.at(e)->text() == "false") {
281 value = false;
282 } else {
283 ok = false;
284 }
285 }
286 if (ok) {
287 item.setProperty("value", value);
288 _form.setProperty(i, item);
289 }
290 }
291 }
292
293 array = _form;
294 return (_formResult == QDialog::Accepted);
295}
296
237QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue array) {297QScriptValue WindowScriptingInterface::doGetNonBlockingFormResult(QScriptValue array) {
238 QScriptValue retVal;298 QScriptValue retVal;
239 299