/** * Refreshes the precomposed strings containing such media parameters as * location, size by querying the respective data from the associated * media object. * * Note that some string such as #size() are meaningless if the media state is * KMediumState_NotCreated (i.e. the medium has not yet been checked for * accessibility). */ void UIMedium::refresh() { /* Detect basic parameters */ mId = mMedium.isNull() ? QUuid().toString().remove ('{').remove ('}') : mMedium.GetId(); mIsHostDrive = mMedium.isNull() ? false : mMedium.GetHostDrive(); if (mMedium.isNull()) mName = VBoxGlobal::tr ("Empty", "medium"); else if (!mIsHostDrive) mName = mMedium.GetName(); else if (mMedium.GetDescription().isEmpty()) mName = VBoxGlobal::tr ("Host Drive '%1'", "medium").arg (QDir::toNativeSeparators (mMedium.GetLocation())); else mName = VBoxGlobal::tr ("Host Drive %1 (%2)", "medium").arg (mMedium.GetDescription(), mMedium.GetName()); mLocation = mMedium.isNull() || mIsHostDrive ? QString ("--") : QDir::toNativeSeparators (mMedium.GetLocation()); if (mType == UIMediumType_HardDisk) { mHardDiskFormat = mMedium.GetFormat(); mHardDiskType = vboxGlobal().mediumTypeString (mMedium); mStorageDetails = gpConverter->toString((KMediumVariant)mMedium.GetVariant()); mIsReadOnly = mMedium.GetReadOnly(); /* Adjust the parent if its possible */ CMedium parentMedium = mMedium.GetParent(); Assert (!parentMedium.isNull() || mParent == NULL); if (!parentMedium.isNull() && (mParent == NULL || mParent->mMedium != parentMedium)) { /* Search for the parent (might be there) */ const VBoxMediaList &list = vboxGlobal().currentMediaList(); for (VBoxMediaList::const_iterator it = list.begin(); it != list.end(); ++ it) { if ((*it).mType != UIMediumType_HardDisk) break; if ((*it).mMedium == parentMedium) { mParent = unconst (&*it); break; } } } } else { mHardDiskFormat = QString::null; mHardDiskType = QString::null; mIsReadOnly = false; } /* Detect sizes */ if (mState != KMediumState_Inaccessible && mState != KMediumState_NotCreated && !mIsHostDrive) { mSize = vboxGlobal().formatSize (mMedium.GetSize()); if (mType == UIMediumType_HardDisk) mLogicalSize = vboxGlobal().formatSize(mMedium.GetLogicalSize()); else mLogicalSize = mSize; } else { mSize = mLogicalSize = QString ("--"); } /* Detect usage */ mUsage = QString::null; if (!mMedium.isNull()) { mCurStateMachineIds.clear(); QVector <QString> machineIds = mMedium.GetMachineIds(); if (machineIds.size() > 0) { QString sUsage; CVirtualBox vbox = vboxGlobal().virtualBox(); for (QVector <QString>::ConstIterator it = machineIds.begin(); it != machineIds.end(); ++ it) { CMachine machine = vbox.FindMachine(*it); /* UIMedium object can wrap newly created CMedium object which belongs to * not yet registered machine, like while creating VM clone. * We can skip such a machines in usage string. * CVirtualBox::FindMachine() will return null machine for such case. */ if (machine.isNull()) continue; QString sName = machine.GetName(); QString sSnapshots; QVector <QString> snapIds = mMedium.GetSnapshotIds (*it); for (QVector <QString>::ConstIterator jt = snapIds.begin(); jt != snapIds.end(); ++ jt) { if (*jt == *it) { /* The medium is attached to the machine in the current * state, we don't distinguish this for now by always * giving the VM name in front of snapshot names. */ mCurStateMachineIds.push_back (*jt); continue; } CSnapshot snapshot = machine.FindSnapshot(*jt); if (!snapshot.isNull()) // can be NULL while takeSnaphot is in progress { if (!sSnapshots.isNull()) sSnapshots += ", "; sSnapshots += snapshot.GetName(); } } if (!sUsage.isNull()) sUsage += ", "; sUsage += sName; if (!sSnapshots.isNull()) { sUsage += QString (" (%2)").arg (sSnapshots); mIsUsedInSnapshots = true; } else mIsUsedInSnapshots = false; } if (!sUsage.isEmpty()) mUsage = sUsage; } } /* Compose the tooltip */ if (!mMedium.isNull()) { mToolTip = mRow.arg (QString ("<p style=white-space:pre><b>%1</b></p>").arg (mIsHostDrive ? mName : mLocation)); if (mType == UIMediumType_HardDisk) { mToolTip += mRow.arg (VBoxGlobal::tr ("<p style=white-space:pre>Type (Format): %1 (%2)</p>", "medium") .arg (mHardDiskType).arg (mHardDiskFormat)); } mToolTip += mRow.arg (VBoxGlobal::tr ("<p>Attached to: %1</p>", "image") .arg (mUsage.isNull() ? VBoxGlobal::tr ("<i>Not Attached</i>", "image") : mUsage)); switch (mState) { case KMediumState_NotCreated: { mToolTip += mRow.arg (VBoxGlobal::tr ("<i>Checking accessibility...</i>", "medium")); break; } case KMediumState_Inaccessible: { if (mResult.isOk()) { /* Not Accessible */ mToolTip += mRow.arg ("<hr>") + mRow.arg (VBoxGlobal::highlight (mLastAccessError, true /* aToolTip */)); } else { /* Accessibility check (eg GetState()) itself failed */ mToolTip += mRow.arg ("<hr>") + mRow.arg (VBoxGlobal::tr ("Failed to check media accessibility.", "medium")) + mRow.arg (UIMessageCenter::formatErrorInfo (mResult) + "."); } break; } default: break; } } /* Reset mNoDiffs */ mNoDiffs.isSet = false; }
PickResultPointer RayPick::getHUDIntersection(const PickRay& pick) { glm::vec3 hudRes = DependencyManager::get<HMDScriptingInterface>()->calculateRayUICollisionPoint(pick.origin, pick.direction); return std::make_shared<RayPickResult>(IntersectionType::HUD, QUuid(), glm::distance(pick.origin, hudRes), hudRes, pick); }
QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& scriptSideProperties) { EntityItemProperties properties = scriptSideProperties; auto dimensions = properties.getDimensions(); float volume = dimensions.x * dimensions.y * dimensions.z; auto density = properties.getDensity(); auto newVelocity = properties.getVelocity().length(); float oldVelocity = { 0.0f }; EntityItemID entityID(id); if (!_entityTree) { queueEntityMessage(PacketType::EntityEdit, entityID, properties); //if there is no local entity entity tree, no existing velocity, use 0. float cost = calculateCost(density * volume, oldVelocity, newVelocity); cost *= costMultiplier; if (cost > _currentAvatarEnergy) { return QUuid(); } else { //debit the avatar energy and continue emit debitEnergySource(cost); } return id; } // If we have a local entity tree set, then also update it. bool updatedEntity = false; _entityTree->withWriteLock([&] { if (scriptSideProperties.parentRelatedPropertyChanged()) { // All of parentID, parentJointIndex, position, rotation are needed to make sense of any of them. // If any of these changed, pull any missing properties from the entity. EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); if (!entity) { return; } //existing entity, retrieve old velocity for check down below oldVelocity = entity->getVelocity().length(); if (!scriptSideProperties.parentIDChanged()) { properties.setParentID(entity->getParentID()); } if (!scriptSideProperties.parentJointIndexChanged()) { properties.setParentJointIndex(entity->getParentJointIndex()); } if (!scriptSideProperties.localPositionChanged() && !scriptSideProperties.positionChanged()) { properties.setPosition(entity->getPosition()); } if (!scriptSideProperties.localRotationChanged() && !scriptSideProperties.rotationChanged()) { properties.setRotation(entity->getOrientation()); } } properties = convertLocationFromScriptSemantics(properties); float cost = calculateCost(density * volume, oldVelocity, newVelocity); cost *= costMultiplier; if (cost > _currentAvatarEnergy) { updatedEntity = false; } else { //debit the avatar energy and continue updatedEntity = _entityTree->updateEntity(entityID, properties); if (updatedEntity) { emit debitEnergySource(cost); } } }); if (!updatedEntity) { return QUuid(); } _entityTree->withReadLock([&] { EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); if (entity) { // make sure the properties has a type, so that the encode can know which properties to include properties.setType(entity->getType()); bool hasTerseUpdateChanges = properties.hasTerseUpdateChanges(); bool hasPhysicsChanges = properties.hasMiscPhysicsChanges() || hasTerseUpdateChanges; if (_bidOnSimulationOwnership && hasPhysicsChanges) { auto nodeList = DependencyManager::get<NodeList>(); const QUuid myNodeID = nodeList->getSessionUUID(); if (entity->getSimulatorID() == myNodeID) { // we think we already own the simulation, so make sure to send ALL TerseUpdate properties if (hasTerseUpdateChanges) { entity->getAllTerseUpdateProperties(properties); } // TODO: if we knew that ONLY TerseUpdate properties have changed in properties AND the object // is dynamic AND it is active in the physics simulation then we could chose to NOT queue an update // and instead let the physics simulation decide when to send a terse update. This would remove // the "slide-no-rotate" glitch (and typical double-update) that we see during the "poke rolling // balls" test. However, even if we solve this problem we still need to provide a "slerp the visible // proxy toward the true physical position" feature to hide the final glitches in the remote watcher's // simulation. if (entity->getSimulationPriority() < SCRIPT_POKE_SIMULATION_PRIORITY) { // we re-assert our simulation ownership at a higher priority properties.setSimulationOwner(myNodeID, SCRIPT_POKE_SIMULATION_PRIORITY); } } else { // we make a bid for simulation ownership properties.setSimulationOwner(myNodeID, SCRIPT_POKE_SIMULATION_PRIORITY); entity->pokeSimulationOwnership(); } } if (properties.parentRelatedPropertyChanged() && entity->computePuffedQueryAACube()) { properties.setQueryAACube(entity->getQueryAACube()); } entity->setLastBroadcast(usecTimestampNow()); // if we've moved an entity with children, check/update the queryAACube of all descendents and tell the server // if they've changed. entity->forEachDescendant([&](SpatiallyNestablePointer descendant) { if (descendant->getNestableType() == NestableType::Entity) { if (descendant->computePuffedQueryAACube()) { EntityItemPointer entityDescendant = std::static_pointer_cast<EntityItem>(descendant); EntityItemProperties newQueryCubeProperties; newQueryCubeProperties.setQueryAACube(descendant->getQueryAACube()); newQueryCubeProperties.setLastEdited(properties.getLastEdited()); queueEntityMessage(PacketType::EntityEdit, descendant->getID(), newQueryCubeProperties); entityDescendant->setLastBroadcast(usecTimestampNow()); } } }); } }); queueEntityMessage(PacketType::EntityEdit, entityID, properties); return id; }
bool GstEnginePipeline::Init() { // Here we create all the parts of the gstreamer pipeline - from the source // to the sink. The parts of the pipeline are split up into bins: // uri decode bin -> audio bin // The uri decode bin is a gstreamer builtin that automatically picks the // right type of source and decoder for the URI. // The audio bin gets created here and contains: // queue ! audioconvert ! <caps32> // ! ( rgvolume ! rglimiter ! audioconvert2 ) ! tee // rgvolume and rglimiter are only created when replaygain is enabled. // After the tee the pipeline splits. One split is converted to 16-bit int // samples for the scope, the other is kept as float32 and sent to the // speaker. // tee1 ! probe_queue ! probe_converter ! <caps16> ! probe_sink // tee2 ! audio_queue ! equalizer_preamp ! equalizer ! volume ! audioscale // ! convert ! audiosink // Audio bin audiobin_ = gst_bin_new("audiobin"); gst_bin_add(GST_BIN(pipeline_), audiobin_); // Create the sink if (!(audiosink_ = engine_->CreateElement(sink_, audiobin_))) return false; if (g_object_class_find_property(G_OBJECT_GET_CLASS(audiosink_), "device") && !device_.toString().isEmpty()) { switch (device_.type()) { case QVariant::Int: g_object_set(G_OBJECT(audiosink_), "device", device_.toInt(), nullptr); break; case QVariant::String: g_object_set(G_OBJECT(audiosink_), "device", device_.toString().toUtf8().constData(), nullptr); break; #ifdef Q_OS_WIN32 case QVariant::ByteArray: { GUID guid = QUuid(device_.toByteArray()); g_object_set(G_OBJECT(audiosink_), "device", &guid, nullptr); break; } #endif // Q_OS_WIN32 default: qLog(Warning) << "Unknown device type" << device_; break; } } // Create all the other elements GstElement* tee, *probe_queue, *probe_converter, *probe_sink, *audio_queue, *convert; queue_ = engine_->CreateElement("queue2", audiobin_); audioconvert_ = engine_->CreateElement("audioconvert", audiobin_); tee = engine_->CreateElement("tee", audiobin_); probe_queue = engine_->CreateElement("queue", audiobin_); probe_converter = engine_->CreateElement("audioconvert", audiobin_); probe_sink = engine_->CreateElement("fakesink", audiobin_); audio_queue = engine_->CreateElement("queue", audiobin_); equalizer_preamp_ = engine_->CreateElement("volume", audiobin_); equalizer_ = engine_->CreateElement("equalizer-nbands", audiobin_); stereo_panorama_ = engine_->CreateElement("audiopanorama", audiobin_); volume_ = engine_->CreateElement("volume", audiobin_); audioscale_ = engine_->CreateElement("audioresample", audiobin_); convert = engine_->CreateElement("audioconvert", audiobin_); if (!queue_ || !audioconvert_ || !tee || !probe_queue || !probe_converter || !probe_sink || !audio_queue || !equalizer_preamp_ || !equalizer_ || !stereo_panorama_ || !volume_ || !audioscale_ || !convert) { return false; } // Create the replaygain elements if it's enabled. event_probe is the // audioconvert element we attach the probe to, which will change depending // on whether replaygain is enabled. convert_sink is the element after the // first audioconvert, which again will change. GstElement* event_probe = audioconvert_; GstElement* convert_sink = tee; if (rg_enabled_) { rgvolume_ = engine_->CreateElement("rgvolume", audiobin_); rglimiter_ = engine_->CreateElement("rglimiter", audiobin_); audioconvert2_ = engine_->CreateElement("audioconvert", audiobin_); event_probe = audioconvert2_; convert_sink = rgvolume_; if (!rgvolume_ || !rglimiter_ || !audioconvert2_) { return false; } // Set replaygain settings g_object_set(G_OBJECT(rgvolume_), "album-mode", rg_mode_, nullptr); g_object_set(G_OBJECT(rgvolume_), "pre-amp", double(rg_preamp_), nullptr); g_object_set(G_OBJECT(rglimiter_), "enabled", int(rg_compression_), nullptr); } // Create a pad on the outside of the audiobin and connect it to the pad of // the first element. GstPad* pad = gst_element_get_static_pad(queue_, "sink"); gst_element_add_pad(audiobin_, gst_ghost_pad_new("sink", pad)); gst_object_unref(pad); // Add a data probe on the src pad of the audioconvert element for our scope. // We do it here because we want pre-equalized and pre-volume samples // so that our visualization are not be affected by them. pad = gst_element_get_static_pad(event_probe, "src"); gst_pad_add_event_probe(pad, G_CALLBACK(EventHandoffCallback), this); gst_object_unref(pad); // Configure the fakesink properly g_object_set(G_OBJECT(probe_sink), "sync", TRUE, nullptr); // Set the equalizer bands g_object_set(G_OBJECT(equalizer_), "num-bands", 10, nullptr); int last_band_frequency = 0; for (int i = 0; i < kEqBandCount; ++i) { GstObject* band = gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), i); const float frequency = kEqBandFrequencies[i]; const float bandwidth = frequency - last_band_frequency; last_band_frequency = frequency; g_object_set(G_OBJECT(band), "freq", frequency, "bandwidth", bandwidth, "gain", 0.0f, nullptr); g_object_unref(G_OBJECT(band)); } // Set the stereo balance. g_object_set(G_OBJECT(stereo_panorama_), "panorama", stereo_balance_, nullptr); // Set the buffer duration. We set this on this queue instead of the // decode bin (in ReplaceDecodeBin()) because setting it on the decode bin // only affects network sources. // Disable the default buffer and byte limits, so we only buffer based on // time. g_object_set(G_OBJECT(queue_), "max-size-buffers", 0, nullptr); g_object_set(G_OBJECT(queue_), "max-size-bytes", 0, nullptr); g_object_set(G_OBJECT(queue_), "max-size-time", buffer_duration_nanosec_, nullptr); g_object_set(G_OBJECT(queue_), "low-percent", buffer_min_fill_, nullptr); if (buffer_duration_nanosec_ > 0) { g_object_set(G_OBJECT(queue_), "use-buffering", true, nullptr); } gst_element_link(queue_, audioconvert_); // Create the caps to put in each path in the tee. The scope path gets 16-bit // ints and the audiosink path gets float32. GstCaps* caps16 = gst_caps_new_simple("audio/x-raw-int", "width", G_TYPE_INT, 16, "signed", G_TYPE_BOOLEAN, true, nullptr); GstCaps* caps32 = gst_caps_new_simple("audio/x-raw-float", "width", G_TYPE_INT, 32, nullptr); if (mono_playback_) { gst_caps_set_simple(caps32, "channels", G_TYPE_INT, 1, nullptr); } // Link the elements with special caps gst_element_link_filtered(probe_converter, probe_sink, caps16); gst_element_link_filtered(audioconvert_, convert_sink, caps32); gst_caps_unref(caps16); gst_caps_unref(caps32); // Link the outputs of tee to the queues on each path. gst_pad_link(gst_element_get_request_pad(tee, "src%d"), gst_element_get_static_pad(probe_queue, "sink")); gst_pad_link(gst_element_get_request_pad(tee, "src%d"), gst_element_get_static_pad(audio_queue, "sink")); // Link replaygain elements if enabled. if (rg_enabled_) { gst_element_link_many(rgvolume_, rglimiter_, audioconvert2_, tee, nullptr); } // Link everything else. gst_element_link(probe_queue, probe_converter); gst_element_link_many(audio_queue, equalizer_preamp_, equalizer_, stereo_panorama_, volume_, audioscale_, convert, audiosink_, nullptr); // Add probes and handlers. gst_pad_add_buffer_probe(gst_element_get_static_pad(probe_converter, "src"), G_CALLBACK(HandoffCallback), this); gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), BusCallbackSync, this); bus_cb_id_ = gst_bus_add_watch(gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), BusCallback, this); MaybeLinkDecodeToAudio(); return true; }
void DBusPebble::ConfigurationClosed(const QString &uuid, const QString &result) { m_pebble->configurationClosed(QUuid(uuid), result); }
void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { auto ownerEntity = _ownerEntity.lock(); if (!ownerEntity) { qDebug() << "AvatarActionHold::doKinematicUpdate -- no owning entity"; return; } if (ownerEntity->getParentID() != QUuid()) { // if the held entity has been given a parent, stop acting on it. return; } void* physicsInfo = ownerEntity->getPhysicsInfo(); if (!physicsInfo) { qDebug() << "AvatarActionHold::doKinematicUpdate -- no owning physics info"; return; } ObjectMotionState* motionState = static_cast<ObjectMotionState*>(physicsInfo); btRigidBody* rigidBody = motionState ? motionState->getRigidBody() : nullptr; if (!rigidBody) { qDebug() << "AvatarActionHold::doKinematicUpdate -- no rigidBody"; return; } withWriteLock([&]{ if (_previousSet && _positionalTarget != _previousPositionalTarget) { // don't average in a zero velocity if we get the same data glm::vec3 oneFrameVelocity = (_positionalTarget - _previousPositionalTarget) / deltaTimeStep; _measuredLinearVelocities[_measuredLinearVelocitiesIndex++] = oneFrameVelocity; if (_measuredLinearVelocitiesIndex >= AvatarActionHold::velocitySmoothFrames) { _measuredLinearVelocitiesIndex = 0; } } glm::vec3 measuredLinearVelocity; for (int i = 0; i < AvatarActionHold::velocitySmoothFrames; i++) { // there is a bit of lag between when someone releases the trigger and when the software reacts to // the release. we calculate the velocity from previous frames but we don't include several // of the most recent. // // if _measuredLinearVelocitiesIndex is // 0 -- ignore i of 3 4 5 // 1 -- ignore i of 4 5 0 // 2 -- ignore i of 5 0 1 // 3 -- ignore i of 0 1 2 // 4 -- ignore i of 1 2 3 // 5 -- ignore i of 2 3 4 // This code is now disabled, but I'm leaving it commented-out because I suspect it will come back. // if ((i + 1) % AvatarActionHold::velocitySmoothFrames == _measuredLinearVelocitiesIndex || // (i + 2) % AvatarActionHold::velocitySmoothFrames == _measuredLinearVelocitiesIndex || // (i + 3) % AvatarActionHold::velocitySmoothFrames == _measuredLinearVelocitiesIndex) { // continue; // } measuredLinearVelocity += _measuredLinearVelocities[i]; } measuredLinearVelocity /= (float)(AvatarActionHold::velocitySmoothFrames // - 3 // 3 because of the 3 we skipped, above ); if (_kinematicSetVelocity) { rigidBody->setLinearVelocity(glmToBullet(measuredLinearVelocity)); rigidBody->setAngularVelocity(glmToBullet(_angularVelocityTarget)); } btTransform worldTrans = rigidBody->getWorldTransform(); worldTrans.setOrigin(glmToBullet(_positionalTarget)); worldTrans.setRotation(glmToBullet(_rotationalTarget)); rigidBody->setWorldTransform(worldTrans); motionState->dirtyInternalKinematicChanges(); _previousPositionalTarget = _positionalTarget; _previousRotationalTarget = _rotationalTarget; _previousDeltaTimeStep = deltaTimeStep; _previousSet = true; }); forceBodyNonStatic(); activateBody(true); }
QUuid WmscMapAdapter::getId() const { return QUuid("{E238750A-AC27-429e-995C-A60C17B9A1E0}"); }
void AssetServer::sendStatsPacket() { QJsonObject serverStats; auto stats = DependencyManager::get<NodeList>()->sampleStatsForAllConnections(); for (const auto& stat : stats) { QJsonObject nodeStats; auto endTimeMs = std::chrono::duration_cast<std::chrono::milliseconds>(stat.second.endTime); QDateTime date = QDateTime::fromMSecsSinceEpoch(endTimeMs.count()); static const float USEC_PER_SEC = 1000000.0f; static const float MEGABITS_PER_BYTE = 8.0f / 1000000.0f; // Bytes => Mbits float elapsed = (float)(stat.second.endTime - stat.second.startTime).count() / USEC_PER_SEC; // sec float megabitsPerSecPerByte = MEGABITS_PER_BYTE / elapsed; // Bytes => Mb/s QJsonObject connectionStats; connectionStats["1. Last Heard"] = date.toString(); connectionStats["2. Est. Max (P/s)"] = stat.second.estimatedBandwith; connectionStats["3. RTT (ms)"] = stat.second.rtt; connectionStats["4. CW (P)"] = stat.second.congestionWindowSize; connectionStats["5. Period (us)"] = stat.second.packetSendPeriod; connectionStats["6. Up (Mb/s)"] = stat.second.sentBytes * megabitsPerSecPerByte; connectionStats["7. Down (Mb/s)"] = stat.second.receivedBytes * megabitsPerSecPerByte; nodeStats["Connection Stats"] = connectionStats; using Events = udt::ConnectionStats::Stats::Event; const auto& events = stat.second.events; QJsonObject upstreamStats; upstreamStats["1. Sent (P/s)"] = stat.second.sendRate; upstreamStats["2. Sent Packets"] = stat.second.sentPackets; upstreamStats["3. Recvd ACK"] = events[Events::ReceivedACK]; upstreamStats["4. Procd ACK"] = events[Events::ProcessedACK]; upstreamStats["5. Recvd LACK"] = events[Events::ReceivedLightACK]; upstreamStats["6. Recvd NAK"] = events[Events::ReceivedNAK]; upstreamStats["7. Recvd TNAK"] = events[Events::ReceivedTimeoutNAK]; upstreamStats["8. Sent ACK2"] = events[Events::SentACK2]; upstreamStats["9. Retransmitted"] = events[Events::Retransmission]; nodeStats["Upstream Stats"] = upstreamStats; QJsonObject downstreamStats; downstreamStats["1. Recvd (P/s)"] = stat.second.receiveRate; downstreamStats["2. Recvd Packets"] = stat.second.receivedPackets; downstreamStats["3. Sent ACK"] = events[Events::SentACK]; downstreamStats["4. Sent LACK"] = events[Events::SentLightACK]; downstreamStats["5. Sent NAK"] = events[Events::SentNAK]; downstreamStats["6. Sent TNAK"] = events[Events::SentTimeoutNAK]; downstreamStats["7. Recvd ACK2"] = events[Events::ReceivedACK2]; downstreamStats["8. Duplicates"] = events[Events::Duplicate]; nodeStats["Downstream Stats"] = downstreamStats; QString uuid; auto nodelist = DependencyManager::get<NodeList>(); if (stat.first == nodelist->getDomainHandler().getSockAddr()) { uuid = uuidStringWithoutCurlyBraces(nodelist->getDomainHandler().getUUID()); nodeStats[USERNAME_UUID_REPLACEMENT_STATS_KEY] = "DomainServer"; } else { auto node = nodelist->findNodeWithAddr(stat.first); uuid = uuidStringWithoutCurlyBraces(node ? node->getUUID() : QUuid()); nodeStats[USERNAME_UUID_REPLACEMENT_STATS_KEY] = uuid; } serverStats[uuid] = nodeStats; } // send off the stats packets ThreadedAssignment::addPacketStatsAndSendStatsPacket(serverStats); }
void DomainInfo::parseAuthInformationFromJsonObject(const QJsonObject& jsonObject) { QJsonObject dataObject = jsonObject["data"].toObject(); _connectionSecret = QUuid(dataObject["connection_secret"].toString()); _registrationToken = QByteArray::fromHex(dataObject["registration_token"].toString().toUtf8()); _publicKey = dataObject["public_key"].toString(); }
void DiagramItem::loadFromXml(QDomElement element, DiagramDocument *) { setId(element.attribute("id", QUuid().toString())); qreal x = element.attribute("x").toDouble(); qreal y = element.attribute("y").toDouble(); setPos(QPointF(x, y)); }
// // Manage the seasons array // void Seasons::readSeasons() { QFile seasonFile(home.absolutePath() + "/seasons.xml"); QXmlInputSource source( &seasonFile ); QXmlSimpleReader xmlReader; SeasonParser( handler ); xmlReader.setContentHandler(&handler); xmlReader.setErrorHandler(&handler); xmlReader.parse( source ); seasons = handler.getSeasons(); Season season; QDate today = QDate::currentDate(); QDate eom = QDate(today.year(), today.month(), today.daysInMonth()); // add Default Date Ranges season.setName(tr("All Dates")); season.setType(Season::temporary); season.setStart(QDate::currentDate().addYears(-50)); season.setEnd(QDate::currentDate().addYears(50)); season.setId(QUuid("{00000000-0000-0000-0000-000000000001}")); seasons.append(season); season.setName(tr("This Year")); season.setType(Season::temporary); season.setStart(QDate(today.year(), 1,1)); season.setEnd(QDate(today.year(), 12, 31)); season.setId(QUuid("{00000000-0000-0000-0000-000000000002}")); seasons.append(season); season.setName(tr("This Month")); season.setType(Season::temporary); season.setStart(QDate(today.year(), today.month(),1)); season.setEnd(eom); season.setId(QUuid("{00000000-0000-0000-0000-000000000003}")); seasons.append(season); season.setName(tr("This Week")); season.setType(Season::temporary); // from Mon-Sun QDate wstart = QDate::currentDate(); wstart = wstart.addDays(Qt::Monday - wstart.dayOfWeek()); QDate wend = wstart.addDays(6); // first day + 6 more season.setStart(wstart); season.setEnd(wend); season.setId(QUuid("{00000000-0000-0000-0000-000000000004}")); seasons.append(season); season.setName(tr("Last 7 days")); season.setType(Season::temporary); season.setStart(today.addDays(-6)); // today plus previous 6 season.setEnd(today); season.setId(QUuid("{00000000-0000-0000-0000-000000000005}")); seasons.append(season); season.setName(tr("Last 14 days")); season.setType(Season::temporary); season.setStart(today.addDays(-13)); season.setEnd(today); season.setId(QUuid("{00000000-0000-0000-0000-000000000006}")); seasons.append(season); season.setName(tr("Last 21 days")); season.setType(Season::temporary); season.setStart(today.addDays(-20)); season.setEnd(today); season.setId(QUuid("{00000000-0000-0000-0000-000000000011}")); seasons.append(season); season.setName(tr("Last 28 days")); season.setType(Season::temporary); season.setStart(today.addDays(-27)); season.setEnd(today); season.setId(QUuid("{00000000-0000-0000-0000-000000000007}")); seasons.append(season); season.setName(tr("Last 3 months")); season.setType(Season::temporary); season.setEnd(today); season.setStart(today.addMonths(-3)); season.setId(QUuid("{00000000-0000-0000-0000-000000000008}")); seasons.append(season); season.setName(tr("Last 6 months")); season.setType(Season::temporary); season.setEnd(today); season.setStart(today.addMonths(-6)); season.setId(QUuid("{00000000-0000-0000-0000-000000000009}")); seasons.append(season); season.setName(tr("Last 12 months")); season.setType(Season::temporary); season.setEnd(today); season.setStart(today.addMonths(-12)); season.setId(QUuid("{00000000-0000-0000-0000-000000000010}")); seasons.append(season); seasonsChanged(); // signal! }
void QGenieGetRouterWlanInfoThread::getResponse(QtSoapMessage &message,QUuid &uuid,QString &session) { GeniePlugin_WSetupPlugin::output_log(QString("recv:get wlan infomation response,uuid-%1").arg(uuid.toString())); if(!m_bcontinue) return; /* if(uuid == QUuid("{14E65BB7-0D3B-4c90-871E-187E58D6712C}"))//start { if(message.isFault()) { qDebug("Error: %s", message.faultString().value().toString().toLatin1().constData()); } else { if( message.returnResponseCode().toString().toInt() == 0) { m_bstart_ok = true; } } if(!m_bstart_ok) { m_bcontinue = false; emit getwlaninfo_complete(false,QString(),QString(),QString(),QString()); } } else */if(uuid == QUuid("{CFE911FE-C5E8-4a0e-A073-6FD28B017E41}"))//ssid { if(message.isFault()) { qDebug("Error: %s", message.faultString().value().toString().toLatin1().constData()); } else { if( message.returnResponseCode().toString().toInt() == 0) { m_bgetssid_ok = true; const QtSoapType &value = message.returnValue(); m_strssid = value["NewSSID"].value().toString(); } } if(!m_bgetssid_ok) { m_bcontinue = false; emit getwlaninfo_complete(false,QString(),QString(),QString(),QString()); } } else if(uuid == QUuid("{B8D2DCFD-0A58-4e46-882A-5EB1DC77EBB4}"))//key { if(message.isFault()) { qDebug("Error: %s", message.faultString().value().toString().toLatin1().constData()); } else { if( message.returnResponseCode().toString().toInt() == 0) { m_bgetkey_ok = true; const QtSoapType &value = message.returnValue(); m_strkey = value["NewWPAPassphrase"].value().toString(); } } if(!m_bgetkey_ok) { m_bcontinue = false; emit getwlaninfo_complete(false,QString(),QString(),QString(),QString()); } } if(m_bgetssid_ok && m_bgetkey_ok) { m_bcontinue = false; emit getwlaninfo_complete(true,m_strssid,m_strkey,QString(),QString()); } }
void EntityItemIDfromScriptValue(const QScriptValue &object, EntityItemID& id) { id.id = QUuid(object.property("id").toVariant().toString()); id.creatorTokenID = object.property("creatorTokenID").toVariant().toUInt(); id.isKnownID = object.property("isKnownID").toVariant().toBool(); }
void QShaderGraphLoader::load() { if (m_status == Error) return; auto error = QJsonParseError(); const auto document = QJsonDocument::fromJson(m_device->readAll(), &error); if (error.error != QJsonParseError::NoError) { qWarning() << "Invalid JSON document:" << error.errorString(); m_status = Error; return; } if (document.isEmpty() || !document.isObject()) { qWarning() << "Invalid JSON document, root should be an object"; m_status = Error; return; } const auto root = document.object(); const auto nodesValue = root.value(QStringLiteral("nodes")); if (!nodesValue.isArray()) { qWarning() << "Invalid nodes property, should be an array"; m_status = Error; return; } const auto edgesValue = root.value(QStringLiteral("edges")); if (!edgesValue.isArray()) { qWarning() << "Invalid edges property, should be an array"; m_status = Error; return; } bool hasError = false; const auto nodes = nodesValue.toArray(); for (const auto &nodeValue : nodes) { if (!nodeValue.isObject()) { qWarning() << "Invalid node found"; hasError = true; continue; } const auto nodeObject = nodeValue.toObject(); const auto uuidString = nodeObject.value(QStringLiteral("uuid")).toString(); const auto uuid = QUuid(uuidString); if (uuid.isNull()) { qWarning() << "Invalid UUID found in node:" << uuidString; hasError = true; continue; } const auto type = nodeObject.value(QStringLiteral("type")).toString(); if (!m_prototypes.contains(type)) { qWarning() << "Unsupported node type found:" << type; hasError = true; continue; } const auto layersArray = nodeObject.value(QStringLiteral("layers")).toArray(); auto layers = QStringList(); for (const auto &layerValue : layersArray) { layers.append(layerValue.toString()); } auto node = m_prototypes.value(type); node.setUuid(uuid); node.setLayers(layers); const auto parametersValue = nodeObject.value(QStringLiteral("parameters")); if (parametersValue.isObject()) { const auto parametersObject = parametersValue.toObject(); for (const auto ¶meterName : parametersObject.keys()) { const auto parameterValue = parametersObject.value(parameterName); if (parameterValue.isObject()) { const auto parameterObject = parameterValue.toObject(); const auto type = parameterObject.value(QStringLiteral("type")).toString(); const auto typeId = QMetaType::type(type.toUtf8()); const auto value = parameterObject.value(QStringLiteral("value")).toString(); auto variant = QVariant(value); if (QMetaType::typeFlags(typeId) & QMetaType::IsEnumeration) { const auto metaObject = QMetaType::metaObjectForType(typeId); const auto className = metaObject->className(); const auto enumName = type.mid(static_cast<int>(qstrlen(className)) + 2).toUtf8(); const auto metaEnum = metaObject->enumerator(metaObject->indexOfEnumerator(enumName)); const auto enumValue = metaEnum.keyToValue(value.toUtf8()); variant = QVariant(enumValue); variant.convert(typeId); } else { variant.convert(typeId); } node.setParameter(parameterName, variant); } else { node.setParameter(parameterName, parameterValue.toVariant()); } } } m_graph.addNode(node); } const auto edges = edgesValue.toArray(); for (const auto &edgeValue : edges) { if (!edgeValue.isObject()) { qWarning() << "Invalid edge found"; hasError = true; continue; } const auto edgeObject = edgeValue.toObject(); const auto sourceUuidString = edgeObject.value(QStringLiteral("sourceUuid")).toString(); const auto sourceUuid = QUuid(sourceUuidString); if (sourceUuid.isNull()) { qWarning() << "Invalid source UUID found in edge:" << sourceUuidString; hasError = true; continue; } const auto sourcePort = edgeObject.value(QStringLiteral("sourcePort")).toString(); const auto targetUuidString = edgeObject.value(QStringLiteral("targetUuid")).toString(); const auto targetUuid = QUuid(targetUuidString); if (targetUuid.isNull()) { qWarning() << "Invalid target UUID found in edge:" << targetUuidString; hasError = true; continue; } const auto targetPort = edgeObject.value(QStringLiteral("targetPort")).toString(); const auto layersArray = edgeObject.value(QStringLiteral("layers")).toArray(); auto layers = QStringList(); for (const auto &layerValue : layersArray) { layers.append(layerValue.toString()); } auto edge = QShaderGraph::Edge(); edge.sourceNodeUuid = sourceUuid; edge.sourcePortName = sourcePort; edge.targetNodeUuid = targetUuid; edge.targetPortName = targetPort; edge.layers = layers; m_graph.addEdge(edge); } if (hasError) { m_status = Error; m_graph = QShaderGraph(); } else { m_status = Ready; } }
QT_BEGIN_NAMESPACE /*! \class QUuid \brief The QUuid class stores a Universally Unique Identifier (UUID). \reentrant \ingroup misc Using \e{U}niversally \e{U}nique \e{ID}entifiers (UUID) is a standard way to uniquely identify entities in a distributed computing environment. A UUID is a 16-byte (128-bit) number generated by some algorithm that is meant to guarantee that the UUID will be unique in the distributed computing environment where it is used. The acronym GUID is often used instead, \e{G}lobally \e{U}nique \e{ID}entifiers, but it refers to the same thing. \target Variant field Actually, the GUID is one \e{variant} of UUID. Multiple variants are in use. Each UUID contains a bit field that specifies which type (variant) of UUID it is. Call variant() to discover which type of UUID an instance of QUuid contains. It extracts the three most signifcant bits of byte 8 of the 16 bytes. In QUuid, byte 8 is \c{QUuid::data4[0]}. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the three most significant bits of parameter \c{b1}, which becomes \c{QUuid::data4[0]} and contains the variant field in its three most significant bits. In the table, 'x' means \e {don't care}. \table \header \o msb0 \o msb1 \o msb2 \o Variant \row \o 0 \o x \o x \o NCS (Network Computing System) \row \o 1 \o 0 \o x \o DCE (Distributed Computing Environment) \row \o 1 \o 1 \o 0 \o Microsoft (GUID) \row \o 1 \o 1 \o 1 \o Reserved for future expansion \endtable \target Version field If variant() returns QUuid::DCE, the UUID also contains a \e{version} field in the four most significant bits of \c{QUuid::data3}, and you can call version() to discover which version your QUuid contains. If you create instances of QUuid using the constructor that accepts all the numeric values as parameters, use the following table to set the four most significant bits of parameter \c{w2}, which becomes \c{QUuid::data3} and contains the version field in its four most significant bits. \table \header \o msb0 \o msb1 \o msb2 \o msb3 \o Version \row \o 0 \o 0 \o 0 \o 1 \o Time \row \o 0 \o 0 \o 1 \o 0 \o Embedded POSIX \row \o 0 \o 0 \o 1 \o 1 \o Name \row \o 0 \o 1 \o 0 \o 0 \o Random \endtable The field layouts for the DCE versions listed in the table above are specified in the \l{http://www.ietf.org/rfc/rfc4122.txt} {Network Working Group UUID Specification}. Most platforms provide a tool for generating new UUIDs, e.g. \c uuidgen and \c guidgen. You can also use createUuid(). UUIDs generated by createUuid() are of the random type. Their QUuid::Version bits are set to QUuid::Random, and their QUuid::Variant bits are set to QUuid::DCE. The rest of the UUID is composed of random numbers. Theoretically, this means there is a small chance that a UUID generated by createUuid() will not be unique. But it is \l{http://en.wikipedia.org/wiki/Universally_Unique_Identifier#Random_UUID_probability_of_duplicates} {a \e{very} small chance}. UUIDs can be constructed from numeric values or from strings, or using the static createUuid() function. They can be converted to a string with toString(). UUIDs have a variant() and a version(), and null UUIDs return true from isNull(). */ /*! \fn QUuid::QUuid(const GUID &guid) Casts a Windows \a guid to a Qt QUuid. \warning This function is only for Windows platforms. */ /*! \fn QUuid &QUuid::operator=(const GUID &guid) Assigns a Windows \a guid to a Qt QUuid. \warning This function is only for Windows platforms. */ /*! \fn QUuid::operator GUID() const Returns a Windows GUID from a QUuid. \warning This function is only for Windows platforms. */ /*! \fn QUuid::QUuid() Creates the null UUID. toString() will output the null UUID as "{00000000-0000-0000-0000-000000000000}". */ /*! \fn QUuid::QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) Creates a UUID with the value specified by the parameters, \a l, \a w1, \a w2, \a b1, \a b2, \a b3, \a b4, \a b5, \a b6, \a b7, \a b8. Example: \snippet doc/src/snippets/code/src_corelib_plugin_quuid.cpp 0 */ #ifndef QT_NO_QUUID_STRING /*! Creates a QUuid object from the string \a text, which must be formatted as five hex fields separated by '-', e.g., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex digit. The curly braces shown here are optional, but it is normal to include them. If the conversion fails, a null UUID is created. See toString() for an explanation of how the five hex fields map to the public data members in QUuid. \sa toString(), QUuid() */ QUuid::QUuid(const QString &text) { bool ok; if (text.isEmpty()) { *this = QUuid(); return; } QString temp = text.toUpper(); if (temp[0] != QLatin1Char('{')) temp = QLatin1Char('{') + text; if (text[(int)text.length()-1] != QLatin1Char('}')) temp += QLatin1Char('}'); data1 = temp.mid(1, 8).toULongLong(&ok, 16); if (!ok) { *this = QUuid(); return; } data2 = temp.mid(10, 4).toUInt(&ok, 16); if (!ok) { *this = QUuid(); return; } data3 = temp.mid(15, 4).toUInt(&ok, 16); if (!ok) { *this = QUuid(); return; } data4[0] = temp.mid(20, 2).toUInt(&ok, 16); if (!ok) { *this = QUuid(); return; } data4[1] = temp.mid(22, 2).toUInt(&ok, 16); if (!ok) { *this = QUuid(); return; } for (int i = 2; i<8; i++) { data4[i] = temp.mid(25 + (i-2)*2, 2).toUShort(&ok, 16); if (!ok) { *this = QUuid(); return; } } }
void UploadProject::loadFromFile(bool clear, const QString & whe) { if(whe.isEmpty() == false) proj_path = whe; if(!proj_setts || proj_setts->fileName() != proj_path) proj_setts = QSharedPointer<QSettings>(new QSettings(proj_path, QSettings::IniFormat)); if(proj_setts->status() != QSettings::NoError) { QString err; switch(proj_setts->status()) { case QSettings::AccessError: err = tr("Can't acces project file"); break; case QSettings::FormatError: err = tr("Project file has an invalid format."); break; default: err = tr("Unknown or no error"); break; } throw UploadProjectError(tr("Can't load settings file '%1': %2").arg(proj_path).arg(err)); } if(clear) { clearObjs(); is_modifed = true; } const quint64 files = proj_setts->value("meta/file_count", 0).toULongLong(); QStringList filelist; QHash<QString, QUuid> uuids; for(quint64 i = 0; i < files; ++i) { const QString &grpn = QString("file_%1").arg(i+1); if(proj_setts->contains(grpn + "/file_path") == false) continue; proj_setts->beginGroup(grpn); known_objs.insert(QUuid(proj_setts->value("file_uuid").toString()), proj_setts->group()); uuids.insert(proj_setts->value("file_path").toString(), QUuid(proj_setts->value("file_uuid").toString())); filelist << proj_setts->value("file_path").toString(); proj_setts->endGroup(); } if(imldr) { imldr->terminate(); imldr->deleteLater(); imldr = 0; } imldr = new ImageLoader(filelist, uuids, false, this); imldr->start(); }
QUuid ScriptUUID::fromString(const QString& s) { return QUuid(s); }
QMultiMap<int, IOptionsDialogWidget *> DataStreamsManger::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent) { QMultiMap<int, IOptionsDialogWidget *> widgets; if (FOptionsManager && ANodeId==OPN_DATATRANSFER) { int index = 0; foreach(IDataStreamMethod *method, FMethods) { widgets.insertMulti(OHO_DATATRANSFER_METHODNAME + index, FOptionsManager->newOptionsDialogHeader(tr("Transfer method %1").arg(method->methodName()),AParent)); widgets.insertMulti(OWO_DATATRANSFER_METHODSETTINGS + index, method->methodSettingsWidget(settingsProfileNode(QUuid(),method->methodNS()),AParent)); index += 10; }
OAF::CGitUrl& OAF::CGitUrl::operator= (const QUrl& _other) { // // Защищаемся от последствий самоприсваивания // if (m_git_url != _other) { // // Очищаем старые данные // m_git_url.clear (); m_copy_id = QUuid (); m_hash.clear (); m_file_name.clear (); // // Разбираем переданный URI и сохраняем интересующие нас части в переменных класса, // для последующего быстрого обращения к ним // m_git_url = _other; Q_ASSERT (m_git_url.isValid ()); // // Специальная обработка параметра as_copy // if (_other.hasQueryItem ("oaf_as_copy") && (_other.queryItemValue ("oaf_as_copy").compare ("no" , Qt::CaseInsensitive) != 0) && (_other.queryItemValue ("oaf_as_copy").compare ("false", Qt::CaseInsensitive) != 0)) { // // Генерируем новый уникальный идентификатор копии // m_copy_id = QUuid::createUuid (); // // ...и заменяем на него oaf_as_copy // m_git_url.removeQueryItem ("oaf_as_copy"); m_git_url.addQueryItem ("oaf_copy_id", m_copy_id.toString ()); } // // Специальная обработка параметра oaf_copy_id // if (_other.hasQueryItem ("oaf_copy_id")) m_copy_id = QUuid (_other.queryItemValue ("oaf_copy_id")); // // Специальная обработка параметра hash (SHA1-идентификатора объекта в git-репозитории) // if (_other.hasQueryItem ("hash")) m_hash = _other.queryItemValue ("hash"); // // Абсолютное путь и имя файла для извлечения из репозитория // // NOTE: под Windows нужно три разделителя, т.к. только в Unix все пути начинаются с корня ("/") // m_file_name = _other.toString (QUrl::RemoveScheme | QUrl::RemoveQuery); #ifdef Q_OS_WIN32 if (m_file_name.startsWith ("///")) m_file_name.remove (0, 3); #else if (m_file_name.startsWith ("//")) m_file_name.remove (0, 2); #endif if (!QFileInfo (m_file_name).exists ()) qWarning () << Q_FUNC_INFO << "File does not exists:" << m_file_name; } // // Возвращаем ссылку на себя согласно общепринятой практике (для использования сложных цепочек присваивания) // return (*this); }
void CSecureRule::load(CSecureRule*& pRule, QDataStream &fsFile, int) { if ( pRule ) { delete pRule; pRule = NULL; } quint8 nType; quint8 nAction; QString sComment; QString sUUID; bool bForever; quint32 tExpire; quint32 nTotal; bool bAutomatic; fsFile >> nType; fsFile >> nAction; fsFile >> sComment; fsFile >> sUUID; fsFile >> bForever; fsFile >> tExpire; fsFile >> nTotal; fsFile >> bAutomatic; QString sTmp; bool bTmp = true; switch ( nType ) { case 0: // contentless rule pRule = new CSecureRule(); Q_ASSERT( false ); break; case 1: pRule = new CIPRule(); fsFile >> sTmp; pRule->parseContent( sTmp ); break; case 2: pRule = new CIPRangeRule(); fsFile >> sTmp; pRule->parseContent( sTmp ); break; case 4: pRule = new CHashRule(); fsFile >> sTmp; pRule->parseContent( sTmp ); break; case 5: pRule = new CRegularExpressionRule(); fsFile >> sTmp; pRule->parseContent( sTmp ); break; case 6: pRule = new CUserAgentRule(); fsFile >> sTmp; fsFile >> bTmp; pRule->parseContent( sTmp ); ((CUserAgentRule*)pRule)->setRegExp( bTmp ); break; case 7: pRule = new CContentRule(); fsFile >> sTmp; fsFile >> bTmp; pRule->parseContent( sTmp ); ((CContentRule*)pRule)->setAll( bTmp ); break; default: Q_ASSERT( false ); break; } if ( pRule ) { pRule->m_nAction = (RuleAction::Action)nAction; pRule->m_sComment = sComment; pRule->m_oUUID = QUuid( sUUID ); pRule->setForever(bForever); pRule->setExpiryTime(tExpire); pRule->m_nTotal.storeRelease(nTotal); pRule->m_bAutomatic = bAutomatic; } }
bool ObjectConstraintSlider::updateArguments(QVariantMap arguments) { glm::vec3 pointInA; glm::vec3 axisInA; QUuid otherEntityID; glm::vec3 pointInB; glm::vec3 axisInB; float linearLow; float linearHigh; float angularLow; float angularHigh; bool needUpdate = false; bool somethingChanged = ObjectDynamic::updateArguments(arguments); withReadLock([&]{ bool ok = true; pointInA = EntityDynamicInterface::extractVec3Argument("slider constraint", arguments, "point", ok, false); if (!ok) { pointInA = _pointInA; } ok = true; axisInA = EntityDynamicInterface::extractVec3Argument("slider constraint", arguments, "axis", ok, false); if (!ok) { axisInA = _axisInA; } ok = true; otherEntityID = QUuid(EntityDynamicInterface::extractStringArgument("slider constraint", arguments, "otherEntityID", ok, false)); if (!ok) { otherEntityID = _otherID; } ok = true; pointInB = EntityDynamicInterface::extractVec3Argument("slider constraint", arguments, "otherPoint", ok, false); if (!ok) { pointInB = _pointInB; } ok = true; axisInB = EntityDynamicInterface::extractVec3Argument("slider constraint", arguments, "otherAxis", ok, false); if (!ok) { axisInB = _axisInB; } ok = true; linearLow = EntityDynamicInterface::extractFloatArgument("slider constraint", arguments, "linearLow", ok, false); if (!ok) { linearLow = _linearLow; } ok = true; linearHigh = EntityDynamicInterface::extractFloatArgument("slider constraint", arguments, "linearHigh", ok, false); if (!ok) { linearHigh = _linearHigh; } ok = true; angularLow = EntityDynamicInterface::extractFloatArgument("slider constraint", arguments, "angularLow", ok, false); if (!ok) { angularLow = _angularLow; } ok = true; angularHigh = EntityDynamicInterface::extractFloatArgument("slider constraint", arguments, "angularHigh", ok, false); if (!ok) { angularHigh = _angularHigh; } if (somethingChanged || pointInA != _pointInA || axisInA != _axisInA || otherEntityID != _otherID || pointInB != _pointInB || axisInB != _axisInB || linearLow != _linearLow || linearHigh != _linearHigh || angularLow != _angularLow || angularHigh != _angularHigh) { // something changed needUpdate = true; } }); if (needUpdate) { withWriteLock([&] { _pointInA = pointInA; _axisInA = axisInA; _otherID = otherEntityID; _pointInB = pointInB; _axisInB = axisInB; _linearLow = linearLow; _linearHigh = linearHigh; _angularLow = angularLow; _angularHigh = angularHigh; _active = true; auto ownerEntity = _ownerEntity.lock(); if (ownerEntity) { ownerEntity->setDynamicDataDirty(true); ownerEntity->setDynamicDataNeedsTransmit(true); } }); updateSlider(); } return true; }
CSecureRule* CSecureRule::fromXML(QXmlStreamReader& oXMLdocument, float nVersion) { QXmlStreamAttributes attributes = oXMLdocument.attributes(); const QString sType = attributes.value( "type" ).toString(); if ( sType.isEmpty() ) return NULL; CSecureRule* pRule = NULL; if ( sType.compare( "address", Qt::CaseInsensitive ) == 0 ) { QString sAddress = attributes.value( "address" ).toString(); pRule = new CIPRule(); pRule->parseContent( sAddress ); } else if ( sType.compare( "addressrange", Qt::CaseInsensitive ) == 0 ) { QString sStartAddress = attributes.value( "startaddress" ).toString(); QString sEndAddress = attributes.value( "endaddress" ).toString(); pRule = new CIPRangeRule(); pRule->parseContent( QString("%1-%2").arg(sStartAddress).arg(sEndAddress) ); } else if ( sType.compare( "hash", Qt::CaseInsensitive ) == 0 ) { CHashRule* rule = new CHashRule(); if ( !rule->parseContent( attributes.value( "content" ).toString() ) ) { delete rule; return NULL; } pRule = rule; } else if ( sType.compare( "regexp", Qt::CaseInsensitive ) == 0 ) { CRegularExpressionRule* rule = new CRegularExpressionRule(); if ( !rule->parseContent( attributes.value( "content" ).toString() ) ) { delete rule; return NULL; } pRule = rule; } else if ( sType.compare( "content", Qt::CaseInsensitive ) == 0 ) { const QString sMatch = attributes.value( "match" ).toString(); const QString sContent = attributes.value( "content" ).toString(); const QString sUrn = sContent.left( 4 ); if ( nVersion < 2.0 ) { // This handles "old style" Shareaza RegExp rules. if ( sMatch.compare( "regexp", Qt::CaseInsensitive ) == 0 ) { CRegularExpressionRule* rule = new CRegularExpressionRule(); if ( !rule->parseContent( sContent ) ) { delete rule; return NULL; } pRule = rule; } // This handles "old style" Shareaza hash rules. else if ( sUrn.compare( "urn:", Qt::CaseInsensitive ) == 0 ) { CHashRule* rule = new CHashRule(); if ( !rule->parseContent( sContent ) ) { delete rule; return NULL; } pRule = rule; } } if ( !pRule ) { bool all = ( sMatch.compare( "all", Qt::CaseInsensitive ) == 0 ); if ( all || sMatch.compare( "any", Qt::CaseInsensitive ) == 0 ) { CContentRule* rule = new CContentRule(); if ( !rule->parseContent( sContent ) ) { delete rule; return NULL; } rule->setAll( all ); pRule = rule; } else { return NULL; } } } else { return NULL; } const QString sAction = attributes.value( "action" ).toString(); if ( sAction.compare( "deny", Qt::CaseInsensitive ) == 0 || sAction.isEmpty() ) { pRule->m_nAction = RuleAction::Deny; } else if ( sAction.compare( "accept", Qt::CaseInsensitive ) == 0 ) { pRule->m_nAction = RuleAction::Accept; } else if ( sAction.compare( "null", Qt::CaseInsensitive ) == 0 ) { pRule->m_nAction = RuleAction::None; } else { delete pRule; return NULL; } const QString sAutomatic = attributes.value( "automatic" ).toString(); if(sAutomatic == "true") pRule->m_bAutomatic = true; else pRule->m_bAutomatic = false; pRule->m_sComment = attributes.value( "comment" ).toString().trimmed(); QString sExpire = attributes.value( "expire" ).toString(); if ( sExpire.compare( "forever", Qt::CaseInsensitive ) == 0 ) { pRule->setForever(true); } else if ( sExpire.compare( "session", Qt::CaseInsensitive ) == 0 ) { pRule->setForever(false); pRule->m_tExpire = RuleTime::Special; } else { pRule->m_tExpire = sExpire.toUInt(); } QString sUUID = attributes.value( "uuid" ).toString(); if ( sUUID.isEmpty() ) sUUID = attributes.value( "guid" ).toString(); if ( sUUID.isEmpty() ) { pRule->m_oUUID = QUuid::createUuid(); } else { pRule->m_oUUID = QUuid( sUUID ); } return pRule; }
void DBusPebble::ConfigurationURL(const QString &uuid) { m_pebble->requestConfigurationURL(QUuid(uuid)); }
QUuid QUuid::createUuid() { return QUuid(); }
void DBusPebble::SetAppOrder(const QStringList &newList) { QList<QUuid> uuidList; foreach (const QString &id, newList) { uuidList << QUuid(id); }
/*! \internal */ QUuid::QUuid( const char *text ) { *this = QUuid( QString(text) ); }
void SimulationOwner::clear() { _id = QUuid(); _priority = 0; _expiry = 0; }
/*! \internal */ QUuid::QUuid(const char *text) { *this = QUuid(QString::fromLatin1(text)); }
void VoxelPacketProcessor::processPacket(const SharedNodePointer& sendingNode, const QByteArray& packet) { PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "VoxelPacketProcessor::processPacket()"); QByteArray mutablePacket = packet; const int WAY_BEHIND = 300; if (packetsToProcessCount() > WAY_BEHIND && Application::getInstance()->getLogger()->extraDebugging()) { qDebug("VoxelPacketProcessor::processPacket() packets to process=%d", packetsToProcessCount()); } ssize_t messageLength = mutablePacket.size(); Application* app = Application::getInstance(); bool wasStatsPacket = false; // check to see if the UI thread asked us to kill the voxel tree. since we're the only thread allowed to do that if (app->_wantToKillLocalVoxels) { app->_voxels.killLocalVoxels(); app->_wantToKillLocalVoxels = false; } PacketType voxelPacketType = packetTypeForPacket(mutablePacket); // note: PacketType_OCTREE_STATS can have PacketType_VOXEL_DATA // immediately following them inside the same packet. So, we process the PacketType_OCTREE_STATS first // then process any remaining bytes as if it was another packet if (voxelPacketType == PacketTypeOctreeStats) { int statsMessageLength = app->parseOctreeStats(mutablePacket, sendingNode); wasStatsPacket = true; if (messageLength > statsMessageLength) { mutablePacket = mutablePacket.mid(statsMessageLength); // TODO: this does not look correct, the goal is to test the packet version for the piggyback, but // this is testing the version and hash of the original packet if (!NodeList::getInstance()->packetVersionAndHashMatch(packet)) { return; // bail since piggyback data doesn't match our versioning } } else { // Note... stats packets don't have sequence numbers, so we don't want to send those to trackIncomingVoxelPacket() return; // bail since no piggyback data } } // fall through to piggyback message voxelPacketType = packetTypeForPacket(mutablePacket); if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { app->trackIncomingVoxelPacket(mutablePacket, sendingNode, wasStatsPacket); if (sendingNode) { switch(voxelPacketType) { case PacketTypeParticleErase: { app->_particles.processEraseMessage(mutablePacket, sendingNode); } break; case PacketTypeParticleData: { app->_particles.processDatagram(mutablePacket, sendingNode); } break; case PacketTypeEnvironmentData: { app->_environment.parseData(*sendingNode->getActiveSocket(), mutablePacket); } break; default : { app->_voxels.setDataSourceUUID(sendingNode->getUUID()); app->_voxels.parseData(mutablePacket); app->_voxels.setDataSourceUUID(QUuid()); } break; } } } }
#else /* !VBOX_WITH_PRECOMPILED_HEADERS */ /* Qt includes: */ # include <QDir> /* GUI includes: */ # include "UIMedium.h" # include "VBoxGlobal.h" # include "UIConverter.h" # include "UIMessageCenter.h" # include "UIExtraDataManager.h" # include "UIIconPool.h" /* COM includes: */ # include "CMachine.h" # include "CSnapshot.h" #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ QString UIMedium::m_sstrNullID = QUuid().toString().remove('{').remove('}'); QString UIMedium::m_sstrTable = QString("<table>%1</table>"); QString UIMedium::m_sstrRow = QString("<tr><td>%1</td></tr>"); UIMedium::UIMedium() : m_type(UIMediumType_Invalid) , m_medium(CMedium()) , m_state(KMediumState_NotCreated) { refresh(); } UIMedium::UIMedium(const CMedium &medium, UIMediumType type) : m_type(type) , m_medium(medium) , m_state(KMediumState_NotCreated)