void qtVault::addNode(const pnVaultNode& node) { // vault is locked during node adds, to prevent writing processes from // accessing a node while it is being copied and reffed vaultMutex.lock(); bool isUpdate = false; if(nodes.contains(node.getNodeIdx())) { // only copy the node data nodes[node.getNodeIdx()].pnVaultNode::copy(node); emit updatedNode(node.getNodeIdx()); isUpdate = true; }else{ nodes.insert(node.getNodeIdx(), qtVaultNode(node)); } // check to see if there are any queued refs referencing the newly added node foreach(pnVaultNodeRef ref, refQueue) { if(ref.fChild == node.getNodeIdx() || ref.fParent == node.getNodeIdx()) { // if a ref is found, re-add it, this will resolve it, it possible // if not, when the other node arrives, the ref will be resolved addRef(ref); } } vaultMutex.unlock(); // send signals for vault events triggered by this nodeAdd if(rootQueue.contains(node.getNodeIdx())) { rootQueue.removeAll(node.getNodeIdx()); emit gotRootNode(node.getNodeIdx()); }else if(refQueue.count() == 0 && !isUpdate) { // if we just got a root, then the tree fetch just started :P qWarning("Tree fetch complete"); emit fetchComplete(); } }
/** * @brief slot: updates the node data in the internal struct and emits the signal updatedNode, this slot is used to work in both directions * @return * void */ void DLDExchangeServerDBusPosition::updateNode (int id, double x, double y, double z) { ThreeDPoint pos; pos.x = x; pos.y = y; pos.z = z; nodeInfo.insert (id, pos); emit updatedNode (id, x, y, z); }
/** * @brief slot: updates the node data in the internal struct and emits the signal updatedNode, this slot is used to work in both directions * @return * void */ void DLDExchangeServerDBusPosition::updateNode (const QString & id, double x, double y, double z) { nodeInfo.insert (id, QVector3D(x, y, z)); emit updatedNode (id, x, y, z); }
MoulKI::MoulKI(QWidget *parent) : QMainWindow(parent), ui(new Ui::MoulKIClass), gameClient(NULL), authClient(NULL) { resmgr = new plResManager(PlasmaVer::pvMoul); sdlmgr = new plSDLMgr(); ui->setupUi(this); qRegisterMetaType<plUuid>("plUuid"); qRegisterMetaType<plString>("plString"); qRegisterMetaType<uint32_t>("uint32_t"); connect(ui->actionLogin, SIGNAL(triggered()), this, SLOT(showLoginDialog())); connect(ui->actionSet_Active, SIGNAL(triggered()), this, SLOT(showPlayers())); connect(ui->actionFind_Node, SIGNAL(triggered()), this, SLOT(showFindDialog())); connect(ui->actionSubscribe, SIGNAL(triggered()), this, SLOT(showFetchDialog())); connect(ui->actionGet_Public_Ages, SIGNAL(triggered()), this, SLOT(getPublicAgeList())); connect(ui->actionSave_Vault, SIGNAL(triggered()), this, SLOT(writeVault())); connect(ui->actionLoad_Vault, SIGNAL(triggered()), this, SLOT(readVault())); connect(ui->actionJoin_Age, SIGNAL(triggered()), this, SLOT(showJoinAgeDialog())); connect(ui->vaultTree, SIGNAL(itemSelectionChanged()), this, SLOT(setShownNode())); connect(ui->applyButton, SIGNAL(clicked()), this, SLOT(saveNodeData())); connect(ui->revertButton, SIGNAL(clicked()), this, SLOT(revertNode())); connect(ui->nodeEditor, SIGNAL(isDirty(bool)), this, SLOT(nodeDirty(bool))); connect(ui->vaultTree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showItemContextMenu(QPoint))); connect(ui->chatEntry, SIGNAL(returnPressed()), this, SLOT(sendGameChat())); connect(&vault, SIGNAL(addedNode(uint32_t, uint32_t)), this, SLOT(addNode(uint32_t,uint32_t))); connect(&vault, SIGNAL(removedNode(uint32_t, uint32_t)), this, SLOT(removeNode(uint32_t,uint32_t))); connect(&vault, SIGNAL(gotRootNode(uint32_t)), this, SLOT(addRoot(uint32_t))); connect(&vault, SIGNAL(updatedNode(uint32_t)), this, SLOT(updateNode(uint32_t))); connect(&vault, SIGNAL(fetchComplete()), this, SLOT(checkCurrentAge())); ui->vaultTree->setContextMenuPolicy(Qt::CustomContextMenu); // set up the player list agePlayersItem = new QTreeWidgetItem(ui->playersTree); agePlayersItem->setText(0, "AGE PLAYERS"); ui->playersTree->insertTopLevelItem(0, agePlayersItem); agePlayersItem->setExpanded(true); buddiesItem = new QTreeWidgetItem(ui->playersTree); buddiesItem->setText(0, "BUDDIES"); buddiesItem->setExpanded(true); ui->playersTree->insertTopLevelItem(0, buddiesItem); neighborsItem = new QTreeWidgetItem(ui->playersTree); neighborsItem->setText(0, "NEIGHBORS"); ui->playersTree->insertTopLevelItem(0, neighborsItem); neighborsItem->setExpanded(true); QList<int> chatSizes; chatSizes.append(350); chatSizes.append(100); ui->chatSplitter->setSizes(chatSizes); ui->nodeEditor->setMgrs(getSDLMgr(), getResManager()); }