/*! Unregisters the DBus object */ void ObjectEndPoint::unregisterObjectDBus(const QRemoteServiceRegister::Entry& entry, const QUuid& id) { uint hash = qHash(id.toString()); QString objPath = "/" + entry.interfaceName() + "/" + entry.version() + "/" + QString::number(hash); objPath.replace(QString("."), QString("/")); connection->unregisterObject(objPath, QDBusConnection::UnregisterTree); }
bool OctreeElement::matchesSourceUUID(const QUuid& sourceUUID) const { if (_sourceUUIDKey > KEY_FOR_NULL) { if (_mapKeysToSourceUUIDs.end() != _mapKeysToSourceUUIDs.find(_sourceUUIDKey)) { return QUuid(_mapKeysToSourceUUIDs[_sourceUUIDKey]) == sourceUUID; } } return sourceUUID.isNull(); }
void ScriptUUID::print(const QString& label, const QUuid& id) { QString message = QString("%1 %2").arg(qPrintable(label)); message = message.arg(id.toString()); qCDebug(scriptengine) << message; if (ScriptEngine* scriptEngine = qobject_cast<ScriptEngine*>(engine())) { scriptEngine->print(message); } }
void ConsoleWidget::saveContext(const QUuid &AContextId) { OptionsNode node = Options::node(OPV_CONSOLE_CONTEXT_ITEM, AContextId.toString()); node.setValue(ui.cmbStreamJid->currentIndex()>0 ? ui.cmbStreamJid->itemData(ui.cmbStreamJid->currentIndex()).toString() : QString::null,"streamjid"); QStringList conditions; for (int i=0; i<ui.ltwConditions->count(); i++) conditions.append(ui.ltwConditions->item(i)->text()); node.setValue(conditions,"conditions"); node.setValue(ui.chbWordWrap->isChecked(),"word-wrap"); node.setValue(ui.chbHilightXML->checkState(),"highlight-xml"); Options::setFileValue(saveGeometry(),"console.context.window-geometry",AContextId.toString()); Options::setFileValue(ui.sptHSplitter->saveState(),"console.context.hsplitter-state",AContextId.toString()); Options::setFileValue(ui.sptVSplitter->saveState(),"console.context.vsplitter-state",AContextId.toString()); }
uint16_t OctreeElement::getSourceNodeUUIDKey(const QUuid& sourceUUID) { uint16_t key = KEY_FOR_NULL; QString sourceUUIDString = sourceUUID.toString(); if (_mapSourceUUIDsToKeys.end() != _mapSourceUUIDsToKeys.find(sourceUUIDString)) { key = _mapSourceUUIDsToKeys[sourceUUIDString]; } return key; }
void TorServiceInterface::autorizeConnection(const QUuid &connection, const bool allow) { if (auto peer = getPeer(connection)) { peer->authorize(allow); } else { LFLOG_WARN << "No peer with id " << connection.toString(); } }
void NLPacket::writeSourceID(const QUuid& sourceID) const { Q_ASSERT(!NON_SOURCED_PACKETS.contains(_type)); auto offset = Packet::totalHeaderSize(isPartOfMessage()) + sizeof(PacketType) + sizeof(PacketVersion); memcpy(_packet.get() + offset, sourceID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID); _sourceID = sourceID; }
//* Create the NoteTable table. void DataStore::createTable() { db->lockForWrite(); QLOG_TRACE() << "Entering DataStore::createTable()"; QLOG_DEBUG() << "Creating table DataStore"; NSqlQuery sql(db); QString command("Create table DataStore (" + QString("lid integer,") + QString("key integer,") + QString("data blob default null collate nocase)")); if (!sql.exec(command)) { QLOG_ERROR() << "Creation of DataStore table failed: " << sql.lastError(); } sql.exec("CREATE INDEX DataStore_Lid on DataStore (lid)"); sql.exec("CREATE INDEX DataStore_Key on DataStore (key)"); sql.prepare("Create view SearchModel as select lid, data as name from DataStore where key=2001"); if (!sql.exec()) { QLOG_ERROR() << "Creation of SearchModel table failed: " << sql.lastError(); } sql.prepare("Create View TagModel as select a.lid, (select d.data from DataStore d where d.key=1000 and a.lid = d.lid) as guid, (select data from datastore b1 where b1.lid = (select b.data from DataStore b where b.key=1002 and a.lid = b.lid)) as parent_gid, (select c.data from DataStore c where c.key=1001 and a.lid = c.lid) as name, (select e.data from DataStore e where e.key=1006 and a.lid = e.lid) as account from DataStore a where a.key=1000;"); if (!sql.exec()) { QLOG_ERROR() << "Creation of TagModel table failed: " << sql.lastError(); } sql.prepare("Create View NotebookModel as select a.lid, (select b.data from DataStore b where b.key=3002 and a.lid = b.lid) as stack, (select c.data from DataStore c where c.key=3001 and a.lid = c.lid) as name, (select d.data from DataStore d where d.key=3201 and a.lid = d.lid) as username, (select e.data from DataStore e where e.key=3999 and a.lid = e.lid) as isClosed from DataStore a where a.key=3000;"); if (!sql.exec()) { QLOG_ERROR() << "Creation of NotebookModel table failed: " << sql.lastError(); } if (!sql.exec("Create virtual table SearchIndex using fts4 (lid int, weight int, source text, content text)")) { QLOG_ERROR() << "Creation of SearchIndex table failed: " << sql.lastError(); } sql.finish(); db->unlock(); Notebook notebook; NotebookTable table(db); notebook.name = "My Notebook"; notebook.defaultNotebook = true; QUuid uuid; notebook.guid = uuid.createUuid().toString().replace("{","").replace("}",""); table.add(0,notebook,true,false); }
QString JSKitLocalStorage::getStorageFileFor(const QUuid &uuid) { QDir dataDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); dataDir.mkpath("js-storage"); QString fileName = uuid.toString(); fileName.remove('{'); fileName.remove('}'); return dataDir.absoluteFilePath("js-storage/" + fileName + ".ini"); }
QDomElement CatSolution::createCommand(const QUuid& uid) { QDomElement cmd = myDoc.createElement("Command"); QDomElement id = myDoc.createElement("UID"); QDomText uuidStr = myDoc.createTextNode(uid.toString()); id.appendChild(uuidStr); cmd.appendChild(id); return cmd; }
QString Database::buildNameFromId(const QString& prefix, const QUuid& id) { QString str; str = prefix + id.toString(); str.remove(QChar('{')); str.remove(QChar('}')); str.remove(QChar('-')); return str; }
void KoRdfFoaF::updateFromEditorData() { if (m_uri.size() <= 0) { QUuid u = QUuid::createUuid(); m_uri = u.toString(); kDebug(30015) << "no uuid, created one:" << u.toString(); } QString predBase = "http://xmlns.com/foaf/0.1/"; kDebug(30015) << "name:" << m_name << " newV:" << editWidget.name->text(); setRdfType(predBase + "Person"); updateTriple(m_name, editWidget.name->text(), predBase + "name"); updateTriple(m_nick, editWidget.nick->text(), predBase + "nick"); updateTriple(m_homePage, editWidget.url->text(), predBase + "homepage"); updateTriple(m_phone, editWidget.phone->text(), predBase + "phone"); if (documentRdf()) { const_cast<KoDocumentRdf*>(documentRdf())->emitSemanticObjectUpdated(hKoRdfSemanticItem(this)); } }
void PlaylistWindow::changePlaylistSelection( QUrl itemUrl, QUuid playlistUuid, QUuid itemUuid) { (void)itemUrl; if (!activateItem(playlistUuid, itemUuid)) return; auto pl = PlaylistCollection::getSingleton()->playlistOf(playlistUuid); if (!itemUuid.isNull() && pl->queueFirst() == itemUuid) pl->queueTakeFirst(); }
static PyObject *meth_QUuid_toString(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { QUuid *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QUuid, &sipCpp)) { QString *sipRes; Py_BEGIN_ALLOW_THREADS sipRes = new QString(sipCpp->toString()); Py_END_ALLOW_THREADS return sipConvertFromNewType(sipRes,sipType_QString,NULL); } }
void AudioMixerClientData::parsePerAvatarGainSet(ReceivedMessage& message, const SharedNodePointer& node) { QUuid uuid = node->getUUID(); // parse the UUID from the packet QUuid avatarUuid = QUuid::fromRfc4122(message.readWithoutCopy(NUM_BYTES_RFC4122_UUID)); uint8_t packedGain; message.readPrimitive(&packedGain); float gain = unpackFloatGainFromByte(packedGain); if (avatarUuid.isNull()) { // set the MASTER avatar gain setMasterAvatarGain(gain); qCDebug(audio) << "Setting MASTER avatar gain for " << uuid << " to " << gain; } else { // set the per-source avatar gain hrtfForStream(avatarUuid, QUuid()).setGainAdjustment(gain); qCDebug(audio) << "Setting avatar gain adjustment for hrtf[" << uuid << "][" << avatarUuid << "] to " << gain; } }
String createCanonicalUUIDString() { #if PLATFORM(QT) QUuid uuid = QUuid::createUuid(); String canonicalUuidStr = uuid.toString().mid(1, 36).toLower(); // remove opening and closing bracket and make it lower. ASSERT(canonicalUuidStr[uuidVersionIdentifierIndex] == uuidVersionRequired); return canonicalUuidStr; #elif OS(WINDOWS) GUID uuid = { 0 }; HRESULT hr = CoCreateGuid(&uuid); if (FAILED(hr)) return String(); wchar_t uuidStr[40]; int num = StringFromGUID2(uuid, reinterpret_cast<LPOLESTR>(uuidStr), ARRAYSIZE(uuidStr)); ASSERT(num == 39); String canonicalUuidStr = String(uuidStr + 1, num - 3).lower(); // remove opening and closing bracket and make it lower. ASSERT(canonicalUuidStr[uuidVersionIdentifierIndex] == uuidVersionRequired); return canonicalUuidStr; #elif OS(DARWIN) CFUUIDRef uuid = CFUUIDCreate(0); CFStringRef uuidStrRef = CFUUIDCreateString(0, uuid); String uuidStr(uuidStrRef); CFRelease(uuidStrRef); CFRelease(uuid); String canonicalUuidStr = uuidStr.lower(); // make it lower. ASSERT(canonicalUuidStr[uuidVersionIdentifierIndex] == uuidVersionRequired); return canonicalUuidStr; #elif OS(LINUX) FILE* fptr = fopen("/proc/sys/kernel/random/uuid", "r"); if (!fptr) return String(); char uuidStr[37]; char* result = fgets(uuidStr, sizeof(uuidStr), fptr); fclose(fptr); if (!result) return String(); String canonicalUuidStr = String(uuidStr).lower(); // make it lower. ASSERT(canonicalUuidStr[uuidVersionIdentifierIndex] == uuidVersionRequired); return canonicalUuidStr; #else notImplemented(); return String(); #endif }
bool LimitedNodeList::packetVersionMatch(const udt::Packet& packet) { PacketType headerType = NLPacket::typeInHeader(packet); PacketVersion headerVersion = NLPacket::versionInHeader(packet); if (headerVersion != versionForPacketType(headerType)) { static QMultiHash<QUuid, PacketType> sourcedVersionDebugSuppressMap; static QMultiHash<HifiSockAddr, PacketType> versionDebugSuppressMap; bool hasBeenOutput = false; QString senderString; if (NON_SOURCED_PACKETS.contains(headerType)) { const HifiSockAddr& senderSockAddr = packet.getSenderSockAddr(); hasBeenOutput = versionDebugSuppressMap.contains(senderSockAddr, headerType); if (!hasBeenOutput) { versionDebugSuppressMap.insert(senderSockAddr, headerType); senderString = QString("%1:%2").arg(senderSockAddr.getAddress().toString()).arg(senderSockAddr.getPort()); } } else { QUuid sourceID = NLPacket::sourceIDInHeader(packet); hasBeenOutput = sourcedVersionDebugSuppressMap.contains(sourceID, headerType); if (!hasBeenOutput) { sourcedVersionDebugSuppressMap.insert(sourceID, headerType); senderString = uuidStringWithoutCurlyBraces(sourceID.toString()); } } if (!hasBeenOutput) { qCDebug(networking) << "Packet version mismatch on" << headerType << "- Sender" << senderString << "sent" << qPrintable(QString::number(headerVersion)) << "but" << qPrintable(QString::number(versionForPacketType(headerType))) << "expected."; emit packetVersionMismatch(headerType); } return false; } else { return true; } }
/*! Removes all instances of the client from the instance manager */ void ObjectEndPoint::disconnected(const QString& clientId, const QString& instanceId) { // Service Side Q_ASSERT(d->endPointType != ObjectEndPoint::Client); for (int i=d->clientList.size()-1; i>=0; i--) { // Find right client process if (d->clientList[i].clientId == clientId) { QRemoteServiceRegister::Entry entry = d->clientList[i].entry; QUuid instance = d->clientList[i].instanceId; if (instance.toString() == instanceId) { // Remove an instance from the InstanceManager and local list InstanceManager::instance()->removeObjectInstance(entry, instance); d->clientList.removeAt(i); } } } }
void ConnectionManager::setProxy(const QUuid &AProxyId, const IConnectionProxy &AProxy) { if (!AProxyId.isNull() && AProxyId!=APPLICATION_PROXY_REF_UUID) { LOG_INFO(QString("Proxy added or updated, id=%1").arg(AProxyId.toString())); OptionsNode pnode = Options::node(OPV_PROXY_ITEM,AProxyId.toString()); pnode.setValue(AProxy.name,"name"); pnode.setValue(AProxy.proxy.type(),"type"); pnode.setValue(AProxy.proxy.hostName(),"host"); pnode.setValue(AProxy.proxy.port(),"port"); pnode.setValue(AProxy.proxy.user(),"user"); pnode.setValue(Options::encrypt(AProxy.proxy.password()),"pass"); emit proxyChanged(AProxyId, AProxy); } else { LOG_ERROR(QString("Failed to add or change proxy, id=%1: Invalid proxy Id").arg(AProxyId.toString())); } }
// Write UUID fetched from the file name or generate QString getPatternUuidLazy(const KoPattern *pattern) { QUuid uuid; QString patternFileName = pattern->filename(); if (patternFileName.endsWith(".pat", Qt::CaseInsensitive)) { QString strUuid = patternFileName.left(patternFileName.size() - 4); uuid = QUuid(strUuid); } if (uuid.isNull()) { warnKrita << "WARNING: Saved pattern doesn't have a UUID, generating..."; warnKrita << ppVar(patternFileName) << ppVar(pattern->name()); uuid = QUuid::createUuid(); } return uuid.toString().mid(1, 36); }
QVariant HeriotSettings::getWindowSetting(const QUuid &uuid, const QString &name, const QVariant &defaultValue) { this->beginGroup(HeriotSettings::windows); this->beginGroup(uuid.toString()); QVariant value = this->value(name, defaultValue); this->endGroup(); this->endGroup(); return value; }
int populatePacketHeader(char* packet, PacketType type, const QUuid& connectionUUID) { int numTypeBytes = packArithmeticallyCodedValue(type, packet); packet[numTypeBytes] = versionForPacketType(type); char* position = packet + numTypeBytes + sizeof(PacketVersion); QUuid packUUID = connectionUUID.isNull() ? NodeList::getInstance()->getSessionUUID() : connectionUUID; QByteArray rfcUUID = packUUID.toRfc4122(); memcpy(position, rfcUUID.constData(), NUM_BYTES_RFC4122_UUID); position += NUM_BYTES_RFC4122_UUID; // pack 16 bytes of zeros where the md5 hash will be placed one data is packed memset(position, 0, NUM_BYTES_MD5_HASH); position += NUM_BYTES_MD5_HASH; // return the number of bytes written for pointer pushing return position - packet; }
void Node::addIgnoredNode(const QUuid& otherNodeID) { if (!otherNodeID.isNull() && otherNodeID != _uuid) { qCDebug(networking) << "Adding" << uuidStringWithoutCurlyBraces(otherNodeID) << "to ignore set for" << uuidStringWithoutCurlyBraces(_uuid); // add the session UUID to the set of ignored ones for this listening node _ignoredNodeIDSet.insert(otherNodeID); } else { qCWarning(networking) << "Node::addIgnoredNode called with null ID or ID of ignoring node."; } }
int indexOfUuid(const QUuid &uuid) { qDebug()<<uuid.toString(); if(sCacheHash.contains(uuid)) { return sCacheHash.value(uuid); } sCacheHash.insert(uuid,++sCurIdx); return sCurIdx; }
CCompilerSet::CCompilerSet(QObject *parent) : QObject(parent) , m_countOfSuccessful(0) , m_countOfFailure(0) { QUuid uuid = QUuid::createUuid(); m_server = new QLocalServer(this); if( !m_server->listen("hspide." + uuid.toString()) ) { } connect(m_server, SIGNAL(newConnection()), this, SLOT(attachDebugger())); setCompilerSlotNum(1); // 設定の変更通史の登録と設定からの初期化処理 connect(theConf, SIGNAL(updateConfiguration(const Configuration*)), this, SLOT(updateConfiguration(const Configuration*))); updateConfiguration(theConf); }
void LimitedNodeList::fillPacketHeader(const NLPacket& packet, const QUuid& connectionSecret) { if (!NON_SOURCED_PACKETS.contains(packet.getType())) { packet.writeSourceID(getSessionUUID()); } if (!connectionSecret.isNull() && !NON_SOURCED_PACKETS.contains(packet.getType()) && !NON_VERIFIED_PACKETS.contains(packet.getType())) { packet.writeVerificationHashGivenSecret(connectionSecret); } }
bool fromJson(const QJsonObject& obj) { if (!obj["id"].isString() || !obj["x"].isDouble() || !obj["y"].isDouble()) { return false; } id = obj["id"].toString(); pos = QPointF(obj["x"].toDouble(), obj["y"].toDouble()); return !id.isNull(); }
std::string* uuid() { #ifndef WINDOWS uuid_t t; uuid_generate(t); char ch[36]; memset(ch, 0, 36); uuid_unparse(t, ch); string* res = new string(ch); return res; #else QUuid uuid = QUuid::createUuid(); QString suuid = uuid.toString(); string res = suuid.toStdString(); // removes the { } characters res = res.substr(1, res.size() - 2); return new string(res); #endif }
void MainWindow::client_disconnected(const QUuid &id) { QList<QListWidgetItem *> l( ui->lstClients->findItems(id.toString(), Qt::MatchContains)); int cnt(l.count()); if(cnt > 0) { int row(ui->lstClients->row(l[0])); if(row >= 0) ui->lstClients->takeItem(row); } }
void UnplacedComponentsDock::on_pushButton_clicked() { if ((!mBoard) || (!mSelectedGenComp) || (!mSelectedComponent)) return; QUuid genCompLibUuid = mSelectedGenComp->getGenComp().getUuid(); QUuid compLibUuid = mSelectedComponent->getUuid(); mDisableListUpdate = true; for (int i = 0; i < mUi->lstUnplacedComponents->count(); i++) { QUuid genCompUuid = mUi->lstUnplacedComponents->item(i)->data(Qt::UserRole).toUuid(); Q_ASSERT(genCompUuid.isNull() == false); GenCompInstance* genComp = mProject.getCircuit().getGenCompInstanceByUuid(genCompUuid); if (!genComp) continue; if (genComp->getGenComp().getUuid() != genCompLibUuid) continue; addComponent(*genComp, compLibUuid); } mDisableListUpdate = false; updateComponentsList(); }