void CreateGroupWindow::verifyGroupName() { QString groupName = Utilities::htmlToWAText(ui->textEdit->toHtml()); if (groupName.isEmpty()) { QMaemo5InformationBox::information(this,"Name can't be empty", QMaemo5InformationBox::NoTimeout); } else if (groupName.length() > 25) { QMaemo5InformationBox::information(this,"Name can't be longer than 25 characters", QMaemo5InformationBox::NoTimeout); } else { SelectGroupParticipantsWindow *window = new SelectGroupParticipantsWindow(roster,this); connect(window,SIGNAL(createGroup(QStringList)), this,SLOT(createGroup(QStringList))); window->setAttribute(Qt::WA_Maemo5StackedWindow); window->setAttribute(Qt::WA_DeleteOnClose); window->setWindowFlags(window->windowFlags() | Qt::Window); window->show(); } }
GroupWidget::GroupWidget(QList <Group*> *group, QWidget *parent) : QWidget(parent), groupList(group) { QHBoxLayout *h1 = new QHBoxLayout(); { QLabel *l = new QLabel(tr("Group: ")); addGroupEdit = new QLineEdit(this); connect(addGroupEdit, SIGNAL(editingFinished()), SLOT(createGroup())); addButton = new QPushButton(tr("Create"), this); connect(addGroupEdit, SIGNAL(textChanged(QString)), SLOT(changeAddGroup(QString))); connect(addButton, SIGNAL(clicked()), SLOT(createGroup())); addButton->setEnabled(false); h1->addWidget(l); h1->addWidget(addGroupEdit); h1->addWidget(addButton); } QHBoxLayout *h2 = new QHBoxLayout(); { h2->setMargin(0); upButton = new QPushButton(this); upButton->setIcon(QIcon(":images/uparrow.png")); downButton = new QPushButton(this); downButton->setIcon(QIcon(":images/downarrow.png")); h2->addStretch(); h2->addWidget(upButton); h2->addWidget(downButton); editButton = new QPushButton(this); editButton->setIcon(QIcon(":images/edit.png")); h2->addWidget(editButton); delButton = new QPushButton(this); delButton->setIcon(QIcon(":images/delete.png")); h2->addWidget(delButton); } groupListWidget = new QListWidget(this); QVBoxLayout *v = new QVBoxLayout; v->setMargin(0); v->setSpacing(0); v->addLayout(h1); v->addWidget(groupListWidget); v->addLayout(h2); setLayout(v); //qDebug() << "BookWidget 3"; connect(upButton, SIGNAL(clicked()), SLOT(upItem())); connect(downButton, SIGNAL(clicked()), SLOT(downItem())); connect(editButton, SIGNAL(clicked()), SLOT(editItem())); connect(delButton, SIGNAL(clicked()), SLOT(delItem())); connect(groupListWidget, SIGNAL(currentRowChanged(int)), SLOT(changeRow(int))); connect(groupListWidget, SIGNAL(itemChanged(QListWidgetItem*)), SLOT(changeName(QListWidgetItem*))); connect(groupListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(editItem(QListWidgetItem*))); connect(groupListWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem*)), SLOT(changeSelect(QListWidgetItem *, QListWidgetItem*))); initGroup(); resetButtons(); }
int KWEFile::createFileStructure() { const uint16 ver = 2; if (createGroup("/recordings")) return -1; if (createGroup("/event_types")) return -1; for (int i=0; i < eventNames.size(); i++) { ScopedPointer<HDF5RecordingData> dSet; String path = "/event_types/" + eventNames[i]; if (createGroup(path)) return -1; path += "/events"; if (createGroup(path)) return -1; dSet = createDataSet(U64,0,EVENT_CHUNK_SIZE,path + "/time_samples"); if (!dSet) return -1; dSet = createDataSet(U16,0,EVENT_CHUNK_SIZE,path + "/recording"); if (!dSet) return -1; path += "/user_data"; if (createGroup(path)) return -1; dSet = createDataSet(U8,0,EVENT_CHUNK_SIZE,path + "/eventID"); if (!dSet) return -1; dSet = createDataSet(U8,0,EVENT_CHUNK_SIZE,path + "/nodeID"); if (!dSet) return -1; dSet = createDataSet(eventTypes[i],0,EVENT_CHUNK_SIZE,path + "/" + eventDataNames[i]); if (!dSet) return -1; } if (setAttribute(U16,(void*)&ver,"/","kwik_version")) return -1; return 0; }
GroupsTab::GroupsTab(GroupManager* manager, QWidget* parent): QWidget(parent) { this->manager = manager; //scrollArea = new QScrollArea(this); //scrollArea->setLayout(scrolledLayout); //scrolledWidget = new QWidget(scrollArea); //scrolledWidget = scrollArea; //scrolledLayout = new QVBoxLayout(scrolledWidget); layout = new QVBoxLayout(this); foreach(QString name, manager->groupNames()) createGroup(name); //scrollArea->setWidget(scrolledWidget); //layout->addWidget(scrollArea); QObject::connect(manager, SIGNAL(groupCreated(QString)), this, SLOT(createGroup(QString))); QObject::connect(manager, SIGNAL(groupRemoved(QString)), this, SLOT(removeGroup(QString))); }
void GxsGroupDialog::submitGroup() { std::cerr << "GxsGroupDialog::submitGroup()"; std::cerr << std::endl; /* switch depending on mode */ switch (mode()) { case MODE_CREATE: { /* just close if down */ createGroup(); } break; case MODE_SHOW: { /* just close if down */ cancelDialog(); } break; case MODE_EDIT: { editGroup(); } break; } }
ECDSAKeyPair::ECDSAKeyPair(const EllipticCurve & curve) throw (AsymmetricKeyException) { this->key = NULL; this->engine = NULL; EC_GROUP * group = createGroup(curve); generateKey(group); EC_GROUP_free(group); }
int KWDFile::createFileStructure() { const uint16 ver = 2; if (createGroup("/recordings")) return -1; if (setAttribute(U16,(void*)&ver,"/","kwik_version")) return -1; return 0; }
ButtonTaskMenu::ButtonTaskMenu(QAbstractButton *button, QObject *parent) : QDesignerTaskMenu(button, parent), m_assignGroupSubMenu(new QMenu), m_assignActionGroup(0), m_assignToGroupSubMenuAction(new QAction(tr("Assign to button group"), this)), m_currentGroupSubMenu(new QMenu), m_currentGroupSubMenuAction(new QAction(tr("Button group"), this)), m_createGroupAction(new QAction(tr("New button group"), this)), m_preferredEditAction(new QAction(tr("Change text..."), this)), m_removeFromGroupAction(new QAction(tr("None"), this)) { connect(m_createGroupAction, SIGNAL(triggered()), this, SLOT(createGroup())); TaskMenuInlineEditor *textEditor = new ButtonTextTaskMenuInlineEditor(button, this); connect(m_preferredEditAction, SIGNAL(triggered()), textEditor, SLOT(editText())); connect(m_removeFromGroupAction, SIGNAL(triggered()), this, SLOT(removeFromGroup())); m_assignToGroupSubMenuAction->setMenu(m_assignGroupSubMenu); m_currentGroupSubMenu->addAction(m_groupMenu.breakGroupAction()); m_currentGroupSubMenu->addAction(m_groupMenu.selectGroupAction()); m_currentGroupSubMenuAction->setMenu(m_currentGroupSubMenu); m_taskActions.append(m_preferredEditAction); m_taskActions.append(m_assignToGroupSubMenuAction); m_taskActions.append(m_currentGroupSubMenuAction); m_taskActions.append(createSeparator()); }
void ResourceManager::addTexture( const std::string& id, resource_group::ResourceGroup resourceGroup, const std::string& filePath, unsigned frameRate, bool repeat, unsigned begin, unsigned end, unsigned flags ) { // create the textures group if we need to createGroup( TEXTURE ); // insert in to the map m_resources[TEXTURE].insert( std::make_pair( id, t_ResourcePtr( new TextureResource( resourceGroup, filePath, frameRate, repeat, begin, end, flags ) ) ) ); }
void Widget::onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t Change) { Group* g = GroupList::findGroup(groupnumber); if (!g) { qDebug() << "Widget::onGroupNamelistChanged: Group not found, creating it"; g = createGroup(groupnumber); } QString name = core->getGroupPeerName(groupnumber, peernumber); TOX_CHAT_CHANGE change = static_cast<TOX_CHAT_CHANGE>(Change); if (change == TOX_CHAT_CHANGE_PEER_ADD) { if (name.isEmpty()) name = tr("<Unknown>", "Placeholder when we don't know someone's name in a group chat"); g->addPeer(peernumber,name); //g->chatForm->addSystemInfoMessage(tr("%1 has joined the chat").arg(name), "green"); // we can't display these messages until irungentoo fixes peernumbers // https://github.com/irungentoo/toxcore/issues/1128 } else if (change == TOX_CHAT_CHANGE_PEER_DEL) { g->removePeer(peernumber); //g->chatForm->addSystemInfoMessage(tr("%1 has left the chat").arg(name), "silver"); } else if (change == TOX_CHAT_CHANGE_PEER_NAME) // core overwrites old name before telling us it changed... g->updatePeer(peernumber,core->getGroupPeerName(groupnumber, peernumber)); }
void ParameterValue::write(const H5::CommonFG &loc, const H5::H5Location &parent) const { assert(invariant()); auto group = loc.createGroup(name); H5::createAttribute(group, "type", parameter.lock()->project.lock()->enumtype, "ParameterValue"); H5::createAttribute(group, "name", name); H5::createHardLink(group, "parameter", parent, string("project/parameters/") + parameter.lock()->name); switch (value_type) { case type_empty: // do nothing break; case type_int: H5::createAttribute(group, "data", value_int); break; case type_double: H5::createAttribute(group, "data", value_double); break; case type_string: H5::createAttribute(group, "data", value_string); break; default: assert(0); } group.createGroup("configurations"); }
void ResourceManager::addSprite( const std::string& id, resource_group::ResourceGroup resourceGroup, int layer, const std::string& material, const glm::vec2& size, const glm::vec2& texSize, const glm::vec2& texOffset ) { // create the sprite group if we need to createGroup( SPRITE ); // insert in to the map m_resources[SPRITE].insert( std::make_pair( id, t_ResourcePtr( new SpriteResource( resourceGroup, layer, material, size, texSize, texOffset )) ) ); }
void ResourceManager::addText( const std::string& id, resource_group::ResourceGroup resourceGroup, int layer, const std::string& material, const std::string& font, const std::string& str, float size ) { // create text group if we need to createGroup( TEXT ); // insert in to the map m_resources[TEXT].insert( std::make_pair( id, t_ResourcePtr( new TextResource( resourceGroup, layer, material, font, str, size ) ) ) ); }
void GroupMgr::addObjectInstance( const GroupID &id, const std::string &objInstanceName, const GroupInstanceType type ) { if( groups.find(id) == groups.end() ) { // not exist createGroup(id); } std::map<GroupID, Group>::iterator i = groups.find(id); assert(i != groups.end()); switch( type ) { case GIT_Camera: i->second.addCameraInstance( objInstanceName ); break; case GIT_Geometry: i->second.addMeshInstance( objInstanceName ); break; default: liquidMessage2(messageError, "group instance type %d is unknown.",type); assert(0&&"group instance type is unknown. see script window for more details."); } }
void clientMessageHandle(int client_sock,string message){ vector<string> choppedString; stringChopper(message,choppedString); if (choppedString[0].compare("LIN") == 0){ userLogin(client_sock,choppedString); } else if (choppedString[0].compare("LOU") == 0){ userLogout(client_sock,choppedString); } else if (choppedString[0].compare("REG") == 0){ userRegister(client_sock,choppedString); } else if (choppedString[0].compare("MSG") == 0){ sendMessage(client_sock,choppedString); } else if (choppedString[0].compare("CGR") == 0){ createGroup(client_sock,choppedString); } else if (choppedString[0].compare("JGR") == 0){ joinGroup(client_sock,choppedString); } else if (choppedString[0].compare("LGR") == 0){ leaveGroup(client_sock,choppedString); } else{ errorReply(client_sock,"000","Protocol error!"); } }
ECDSAKeyPair::ECDSAKeyPair(ByteArray& derEncoded) throw (AsymmetricKeyException) { this->key = NULL; this->engine = NULL; EC_GROUP * group = createGroup(derEncoded); generateKey(group); EC_GROUP_free(group); }
void KeepassGroupView::OnNewSubgroup(){ GroupViewItem* parent=(GroupViewItem*)currentItem(); CGroup NewGroup; CEditGroupDialog dlg(db,&NewGroup,parentWidget()); if(dlg.exec()) createGroup(NewGroup.Title, NewGroup.Image, parent); }
extern "C" void Qt_dispatch_group1() { bool res; QDispatchGroup* group; char* argv = QString("test").toAscii().data(); int argc = 1; QDispatchCoreApplication app(argc,&argv); MU_BEGIN_TEST(Qt_dispatch_group1); group = createGroup(100, 0); MU_ASSERT_NOT_NULL(group); group->wait(); // should be OK to re-use a group group->async(new Foo, QDispatch::globalQueue()); group->wait(); delete group; group = NULL; group = createGroup(3, 7); MU_ASSERT_NOT_NULL(group); res = group->wait(dispatch_time(QDispatch::TimeNow, 5ull * NSEC_PER_SEC)); MU_ASSERT_EQUAL(res, false); // retry after timeout (this time succeed) res = group->wait(dispatch_time(QDispatch::TimeNow, 5ull * NSEC_PER_SEC)); MU_ASSERT_EQUAL(res, true); delete group; group = NULL; group = createGroup(100, 0); MU_ASSERT_NOT_NULL(group); group->notify(new GroupNotify, QDispatch::mainQueue()); delete group; group = NULL; app.exec(); MU_FAIL("Should never reach this"); MU_END_TEST }
ECDSAKeyPair::ECDSAKeyPair(std::string& encoded) throw (AsymmetricKeyException) { this->key = NULL; this->engine = NULL; ByteArray derEncoded = Base64::decode(encoded); EC_GROUP * group = createGroup(derEncoded); generateKey(group); EC_GROUP_free(group); }
void TargetGenerator::initGroups() { int groupId = 1; if (isFromFile) { // 从文件读取目标数据 std::vector<State> states = dateReader -> getNextStates(); // TargetGroup *grp = new TargetGroup(groupId * 1000); // 所有的目标放到一个集群中 // SingleTarget *target; // for (size_t i = 0; i < states.size(); ++i) { // target = new SingleTarget(groupId * 1000 + i, SystemModel::getModel(SystemModel::CV), states[i]); // grp -> addTarget(target); // } // groups.push_back(grp); TargetGroup *grp; SingleTarget *target; for(size_t i = 0; i < states.size();i++){ grp = new TargetGroup(groupId * 1000); target = new SingleTarget(groupId * 1000+1,SystemModel::getModel(SystemModel::CV), states[i]); grp -> addTarget(target); groups.push_back(grp); groupId ++; } } else { // 自动生成目标数据 // 地面集群 for (int i = 0; i < groundGroupNumber; ++i) { int index = qrand() % 15; State initState = states[index]; initState.setPositionX(groupId * 300); TargetGroup * grp = createGroup(groupId * 1000, initState, targetInGroupNumber); groups.push_back(grp); ++groupId; } // 空中集群 for (int i = 0; i < skyGroupNumber; ++i) { int index = qrand() % 15; State initState = states[index + 15]; initState.setPositionX(groupId * 300); TargetGroup * grp = createGroup(groupId * 1000, initState, targetInGroupNumber); groups.push_back(grp); ++groupId; } } }
void File::create( uint64_t N, bool bDouble ) { hsize_t chunkSize[2],dataSize[2], maxSize[2]; maxSize[0] = H5S_UNLIMITED; chunkSize[0] = 16; dataSize[0] = m_classes.size(); H5::DataSpace spaceDisk(1,dataSize,maxSize); H5::DSetCreatPropList propDisk; propDisk.setChunk(1,chunkSize); propDisk.setFletcher32(); H5::Group darkGroup(createGroup( "dark" )); H5::DataSet classesDataSet( darkGroup.createDataSet("classes", m_classType, spaceDisk,propDisk) ); H5::Group parmGroup(createGroup( "parameters" )); maxSize[0] = H5S_UNLIMITED; maxSize[1] = 3; chunkSize[0] = CHUNK_SIZE; chunkSize[1] = 1; dataSize[0] = N; dataSize[1] = 3; H5::DataSpace spaceDisk2(2,dataSize,maxSize); H5::DSetCreatPropList propDisk2; //propDisk.setLayout(H5D_CHUNKED); propDisk2.setChunk(2,chunkSize); propDisk2.setFletcher32(); H5::DataSet positionDataSet( darkGroup.createDataSet( "position", bDouble ? H5::PredType::NATIVE_DOUBLE : H5::PredType::NATIVE_FLOAT, spaceDisk2,propDisk2) ); H5::DataSet velocityDataSet( darkGroup.createDataSet( "velocity", bDouble ? H5::PredType::NATIVE_DOUBLE : H5::PredType::NATIVE_FLOAT, spaceDisk2,propDisk2) ); }
Project::Item Project::Item::addNewSubGroup (const String& name, int insertIndex) { Item group (createGroup (project, name, createGUID (getID() + name + String (getNumChildren())))); jassert (canContain (group)); addChild (group, insertIndex); return group; }
Group::Ptr Handle::addGroup(std::string id) { if (m_groups.find(id) != m_groups.end()) { m_log->error("Mode group already exists"); return Group::Ptr(); } auto group = createGroup(); m_groups[id] = group; return group; }
bool ActorGroup::joinGroup(Actor* actor_leader, Actor* actor_follower) { Evidyon::ActorGroup* group = actor_leader->getGroup(); if (group == NULL) { ASSERT(createGroup(actor_leader)->addMember(actor_follower)); return true; } else { return group->addMember(actor_follower); } }
void KWDFile::startNewRecording(int recordingNumber, int nChannels, KWIKRecordingInfo* info) { this->recordingNumber = recordingNumber; this->nChannels = nChannels; this->multiSample = info->multiSample; uint8 mSample = info->multiSample ? 1 : 0; ScopedPointer<HDF5RecordingData> bitVoltsSet; ScopedPointer<HDF5RecordingData> sampleRateSet; String recordPath = String("/recordings/")+String(recordingNumber); CHECK_ERROR(createGroup(recordPath)); CHECK_ERROR(setAttributeStr(info->name,recordPath,String("name"))); CHECK_ERROR(setAttribute(U64,&(info->start_time),recordPath,String("start_time"))); CHECK_ERROR(setAttribute(U32,&(info->start_sample),recordPath,String("start_sample"))); CHECK_ERROR(setAttribute(F32,&(info->sample_rate),recordPath,String("sample_rate"))); CHECK_ERROR(setAttribute(U32,&(info->bit_depth),recordPath,String("bit_depth"))); CHECK_ERROR(createGroup(recordPath+"/application_data")); // CHECK_ERROR(setAttributeArray(F32,info->bitVolts.getRawDataPointer(),info->bitVolts.size(),recordPath+"/application_data",String("channel_bit_volts"))); bitVoltsSet = createDataSet(F32, info->bitVolts.size(), 0, recordPath + "/application_data/channel_bit_volts"); if (bitVoltsSet.get()) bitVoltsSet->writeDataBlock(info->bitVolts.size(), F32, info->bitVolts.getRawDataPointer()); else std::cerr << "Error creating bitvolts data set" << std::endl; CHECK_ERROR(setAttribute(U8,&mSample,recordPath+"/application_data",String("is_multiSampleRate_data"))); //CHECK_ERROR(setAttributeArray(F32,info->channelSampleRates.getRawDataPointer(),info->channelSampleRates.size(),recordPath+"/application_data",String("channel_sample_rates"))); sampleRateSet = createDataSet(F32, info->channelSampleRates.size(), 0, recordPath + "/application_data/channel_sample_rates"); if (sampleRateSet.get()) sampleRateSet->writeDataBlock(info->channelSampleRates.size(), F32, info->channelSampleRates.getRawDataPointer()); else std::cerr << "Error creating sample rates data set" << std::endl; recdata = createDataSet(I16,0,nChannels,CHUNK_XSIZE,recordPath+"/data"); if (!recdata.get()) std::cerr << "Error creating data set" << std::endl; tsData = createDataSet(I64, 0, nChannels, TIMESTAMP_CHUNK_SIZE, recordPath + "/application_data/timestamps"); if (!tsData.get()) std::cerr << "Error creating timestamps data set" << std::endl; curChan = nChannels; }
void GroupMgr::addLightLink( const GroupID &id, const std::string &objInst, const std::string &lightInst) { if( groups.find(id) == groups.end() ) { // not exist createGroup(id); } std::map<GroupID, Group>::iterator i = groups.find(id); assert(i != groups.end()); i->second.addLightLink( objInst, lightInst); }
int KWXFile::createFileStructure() { const uint16 ver = 2; if (createGroup("/channel_groups")) return -1; if (setAttribute(U16,(void*)&ver,"/","kwik_version")) return -1; for (int i=0; i < channelArray.size(); i++) { int res = createChannelGroup(i); if (res) return -1; } return 0; }
void QgsDwgImportDialog::buttonBox_accepted() { QgsTemporaryCursorOverride waitCursor( Qt::BusyCursor ); QMap<QString, bool> layers; bool allLayers = true; for ( int i = 0; i < mLayers->rowCount(); i++ ) { QTableWidgetItem *item = mLayers->item( i, 0 ); if ( item->checkState() == Qt::Unchecked ) { allLayers = false; continue; } layers.insert( item->text(), mLayers->item( i, 1 )->checkState() == Qt::Checked ); } if ( cbMergeLayers->isChecked() ) { if ( allLayers ) layers.clear(); createGroup( QgisApp::instance()->layerTreeView()->layerTreeModel()->rootGroup(), leLayerGroup->text(), layers.keys(), true ); } else { QgsLayerTreeGroup *dwgGroup = QgisApp::instance()->layerTreeView()->layerTreeModel()->rootGroup()->addGroup( leLayerGroup->text() ); Q_ASSERT( dwgGroup ); const auto constKeys = layers.keys(); for ( const QString &layer : constKeys ) { createGroup( dwgGroup, layer, QStringList( layer ), layers[layer] ); } dwgGroup->setExpanded( false ); } }
Project::Item Project::Item::addNewSubGroup (const String& name, int insertIndex) { String newID (createGUID (getID() + name + String (getNumChildren()))); int n = 0; while (findItemWithID (newID).isValid()) newID = createGUID (newID + String (++n)); Item group (createGroup (project, name, newID)); jassert (canContain (group)); addChild (group, insertIndex); return group; }
Texture* ResourceManager::getTexture(const std::string& id) { // create the textures group if we need to createGroup( TEXTURE ); // check if the texture is in the map if ( m_resources[TEXTURE].find( id ) == m_resources[TEXTURE].end() ) { std::cout << "unable to find texture in resource manager" << std::endl; // TODO: throw an exception } // cast the resource and return return dynamic_cast<TextureResource*>( m_resources[TEXTURE][id].get() )->get(); }