// Based on ErrorPrototype's errorProtoFuncToString(), but is modified to // have no observable side effects to the user (i.e. does not call proxies, // and getters). String ErrorInstance::sanitizedToString(ExecState* exec) { VM& vm = exec->vm(); auto scope = DECLARE_THROW_SCOPE(vm); JSValue nameValue; auto namePropertName = vm.propertyNames->name; PropertySlot nameSlot(this, PropertySlot::InternalMethodType::VMInquiry); JSValue currentObj = this; unsigned prototypeDepth = 0; // We only check the current object and its prototype (2 levels) because normal // Error objects may have a name property, and if not, its prototype should have // a name property for the type of error e.g. "SyntaxError". while (currentObj.isCell() && prototypeDepth++ < 2) { JSObject* obj = jsCast<JSObject*>(currentObj); if (JSObject::getOwnPropertySlot(obj, exec, namePropertName, nameSlot) && nameSlot.isValue()) { nameValue = nameSlot.getValue(exec, namePropertName); break; } currentObj = obj->getPrototypeDirect(); } ASSERT(!scope.exception()); String nameString; if (!nameValue) nameString = ASCIILiteral("Error"); else { nameString = nameValue.toWTFString(exec); RETURN_IF_EXCEPTION(scope, String()); } JSValue messageValue; auto messagePropertName = vm.propertyNames->message; PropertySlot messageSlot(this, PropertySlot::InternalMethodType::VMInquiry); if (JSObject::getOwnPropertySlot(this, exec, messagePropertName, messageSlot) && messageSlot.isValue()) messageValue = messageSlot.getValue(exec, messagePropertName); ASSERT(!scope.exception()); String messageString; if (!messageValue) messageString = String(); else { messageString = messageValue.toWTFString(exec); RETURN_IF_EXCEPTION(scope, String()); } if (!nameString.length()) return messageString; if (!messageString.length()) return nameString; StringBuilder builder; builder.append(nameString); builder.appendLiteral(": "); builder.append(messageString); return builder.toString(); }
Controller::Controller(QObject *parent) : QObject(parent) { client = new Client(); nmea = new Nmea(); mrk = new Mrk(); connect(client, SIGNAL(messageSignal(QByteArray)), nmea, SLOT(messageSlot(QByteArray))); connect(nmea, SIGNAL(receiveSignal(QByteArray)), mrk, SLOT(receiveSlot(QByteArray))); }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: messageSignal((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break; case 1: checkPage((*reinterpret_cast< bool(*)>(_a[1]))); break; case 2: checkPage(); break; case 3: cancelcheckPage(); break; case 4: httpRequestFinished((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; case 5: httpResponseHeaderReceived((*reinterpret_cast< const QHttpResponseHeader(*)>(_a[1]))); break; case 6: httpDataReadProgress((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 7: messageSlot((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); break; case 8: setRandomNumbers(); break; case 9: clickAdd((*reinterpret_cast< const bool(*)>(_a[1]))); break; case 10: clickAdd(); break; case 11: clickDelete(); break; case 12: setCheckBoxState((*reinterpret_cast< const bool(*)>(_a[1]))); break; case 13: showOrHideDrawingFormMenuAction((*reinterpret_cast< bool(*)>(_a[1]))); break; case 14: showOrHideDrawingFormMenuAction(); break; case 15: showOrHideFormMenuAction((*reinterpret_cast< bool(*)>(_a[1]))); break; case 16: showOrHideFormMenuAction(); break; case 17: startNewTimer(); break; case 18: changeColorAndValue(); break; case 19: showAbout(); break; case 20: showAboutAction(); break; case 21: readConfiguration(); break; case 22: writeConfiguration(); break; default: ; } _id -= 23; } return _id; }
ChatMainWindow::ChatMainWindow() : m_nickname(QLatin1String("nickname")) { setupUi(this); sendButton->setEnabled(false); connect(messageLineEdit, SIGNAL(textChanged(QString)), this, SLOT(textChangedSlot(QString))); connect(sendButton, SIGNAL(clicked(bool)), this, SLOT(sendClickedSlot())); connect(actionChangeNickname, SIGNAL(triggered(bool)), this, SLOT(changeNickname())); connect(actionAboutQt, SIGNAL(triggered(bool)), this, SLOT(aboutQt())); connect(qApp, SIGNAL(lastWindowClosed()), this, SLOT(exiting())); // add our D-Bus interface and connect to D-Bus new ChatAdaptor(this); QDBusConnection::sessionBus().registerObject("/", this); com::trolltech::chat *iface; iface = new com::trolltech::chat(QString(), QString(), QDBusConnection::sessionBus(), this); //connect(iface, SIGNAL(message(QString,QString)), this, SLOT(messageSlot(QString,QString))); QDBusConnection::sessionBus().connect(QString(), QString(), "com.trolltech.chat", "message", this, SLOT(messageSlot(QString,QString))); connect(iface, SIGNAL(action(QString,QString)), this, SLOT(actionSlot(QString,QString))); NicknameDialog dialog; dialog.cancelButton->setVisible(false); dialog.exec(); m_nickname = dialog.nickname->text().trimmed(); emit action(m_nickname, QLatin1String("joins the chat")); }