void SpawnListMenu::setCurrentItem(const Item* item) { // set the current item m_currentItem = item; // enable/disable item depending on if there is one setItemEnabled(m_id_filterMenu, (item != NULL)); if (item != NULL) changeItem(m_id_filterMenu, "Add '" + item->name() + "' &Filter"); else changeItem(m_id_filterMenu, "Add &Filter"); }
void EditFunctions::currentReturnTypeChanged( const QString &type ) { if ( !functionListView->currentItem() ) return; changeItem( functionListView->currentItem(), ReturnType, type ); functionListView->currentItem()->setText( 1, type ); }
void ClsQHarborImpl::slotChangeValue(int iItemType, string strItemID, int iIndex, string strParamName, double fValue){ // cout << "ClsQHarborImpl::slotChangeValue()" << endl; #ifndef _WINDOWS // cannot get this to work under minGW at the moment... QString qstr; qstr.setNum(fValue); string strParamValue = qstr.toStdString(); if(iItemType == ClsFESystemManager::ITEM_GROUP){ ClsFEGroup* clsFEGroup = ClsFESystemManager::Instance()->getFEGroup( strItemID ); if(clsFEGroup!=NULL){ clsFEGroup->setNeuronParameter(strParamName, strParamValue); } else { cerr << "ClsQHarborImpl::slotChangeValue: group not found" << endl; } } else if (iItemType == ClsFESystemManager::ITEM_CONNECTION){ ClsFEConnection* clsFEConnection = ClsFESystemManager::Instance()->getFEConnection( strItemID ); if(clsFEConnection!=NULL){ clsFEConnection->setSynapseParameter(strParamName, strParamValue); } else { cerr << "ClsQHarborImpl::slotChangeValue: connection not found" << endl; } } changeItem(iIndex, COL_VALUE, strParamValue.c_str()); #endif }
void EditFunctions::currentAccessChanged( const QString& a ) { if ( !functionListView->currentItem() ) return; changeItem( functionListView->currentItem(), Access, a ); functionListView->currentItem()->setText( 3, a ); }
void SpawnShell::newDoorSpawn(const doorStruct* d, uint32_t len, uint8_t dir) { #ifdef SPAWNSHELL_DIAG printf("SpawnShell::newDoorSpawn(doorStruct*)\n"); #endif Item* item = m_doors.find(d->doorId); if (item != NULL) { Door* door = (Door*)item; door->update(d); if (!showeq_params->fast_machine) item->setDistanceToPlayer(m_player->calcDist2DInt(*item)); else item->setDistanceToPlayer(m_player->calcDist(*item)); updateFilterFlags(door); item->updateLastChanged(); emit changeItem(door, tSpawnChangedALL); } else { item = (Item*)new Door(d); if (!showeq_params->fast_machine) item->setDistanceToPlayer(m_player->calcDist2DInt(*item)); else item->setDistanceToPlayer(m_player->calcDist(*item)); updateFilterFlags(item); m_doors.insert(d->doorId, item); emit addItem(item); } if (item->filterFlags() & FILTER_FLAG_ALERT) emit handleAlert(item, tNewSpawn); }
void SpawnShell::newDoorSpawn(const doorStruct& d, size_t len, uint8_t dir) { #ifdef SPAWNSHELL_DIAG seqDebug("SpawnShell::newDoorSpawn(doorStruct*)"); #endif Item* item = m_doors.find(d.doorId); if (item != NULL) { Door* door = (Door*)item; door->update(&d); if (!showeq_params->fast_machine) item->setDistanceToPlayer(m_player->calcDist2DInt(*item)); else item->setDistanceToPlayer(m_player->calcDist(*item)); updateFilterFlags(door); item->updateLastChanged(); emit changeItem(door, tSpawnChangedALL); } else { item = (Item*)new Door(&d); if (!showeq_params->fast_machine) item->setDistanceToPlayer(m_player->calcDist2DInt(*item)); else item->setDistanceToPlayer(m_player->calcDist(*item)); updateFilterFlags(item); m_doors.insert(d.doorId, item); emit addItem(item); } }
/** * Sets the pixmap showing the linetype of the "By Layer" item. * * @todo needs an update, but not used currently */ void QG_LineTypeBox::setLayerLineType(RS2::LineType t) { if (showByLayer) { QPixmap pixmap; switch(t) { case RS2::NoPen: pixmap = QPixmap(linetype00_xpm); break; default: case RS2::SolidLine: pixmap = QPixmap(linetype01_xpm); break; case RS2::DashLine: pixmap = QPixmap(linetype02_xpm); break; case RS2::DotLine: pixmap = QPixmap(linetype03_xpm); break; case RS2::DashDotLine: pixmap = QPixmap(linetype04_xpm); break; case RS2::DivideLine: pixmap = QPixmap(linetype05_xpm); break; } changeItem(pixmap, tr("By Layer"), 0); // needed for the first time a layer is added: slotLineTypeChanged(currentItem()); } }
void MyMenuBar::setToggleButtonState(const ZLToolbar::ToggleButtonItem &button) { const std::string &actionId = button.actionId(); ToolBarButton *tbButton = myButtons[actionId]; if ((tbButton != 0) && (tbButton->toggle())) { changeItem(myActionIndices[actionId], tbButton->pixmap()); } }
void SpawnShell::newDoorSpawn(const doorStruct* d) { #ifdef SPAWNSHELL_DIAG printf("SpawnShell::newDoorSpawn(doorStruct*)\n"); #endif Item* item = m_doors.find(d->doorId); if (item != NULL) { Door* door = (Door*)item; door->update(d); updateFilterFlags(door); item->updateLastChanged(); emit changeItem(door, tSpawnChangedALL); } else { item = (Item*)new Door(d); updateFilterFlags(item); m_doors.insert(d->doorId, item); emit addItem(item); } if (item->filterFlags() & FILTER_FLAG_ALERT) emit handleAlert(item, tNewSpawn); }
void SpawnShell::newCoinsItem(const dropCoinsStruct *c) { #ifdef SPAWNSHELL_DIAG printf("SpawnShell::newCoinsItem(dropCoinsStruct*)\n"); #endif // if zoning, then don't do anything if (m_zoneMgr->isZoning()) return; if (!c) return; Item* item = m_coins.find(c->dropId); if (item != NULL) { Coin* coin = (Coin*)item; coin->update(c); updateFilterFlags(item); item->updateLastChanged(); emit changeItem(item, tSpawnChangedALL); } else { item = new Coin(c); updateFilterFlags(item); m_coins.insert(c->dropId, item); emit addItem(item); } if (item->filterFlags() & FILTER_FLAG_ALERT) emit handleAlert(item, tNewSpawn); }
void KColorCombo::slotActivated( int index ) { if ( index == 0 ) { if ( KColorDialog::getColor( customColor, this ) == QDialog::Accepted ) { QPainter painter; QPen pen; QRect rect( 0, 0, width(), QFontMetrics(painter.font()).height()+4); QPixmap pixmap( rect.width(), rect.height() ); if ( qGray( customColor.rgb() ) < 128 ) pen.setColor( white ); else pen.setColor( black ); painter.begin( &pixmap ); QBrush brush( customColor ); painter.fillRect( rect, brush ); painter.setPen( pen ); painter.drawText( 2, QFontMetrics(painter.font()).ascent()+2, i18n("Custom...") ); painter.end(); changeItem( pixmap, 0 ); pixmap.detach(); } internalcolor = customColor; } else internalcolor = standardPalette[ index - 1 ]; emit activated( internalcolor ); }
void SpawnShell::clear(void) { #ifdef SPAWNSHELL_DIAG printf("SpawnShell::clear()\n"); #endif emit clearItems(); m_spawns.clear(); m_coins.clear(); m_doors.clear(); m_drops.clear(); // clear the players list, reinsert the player m_players.clear(); m_players.insert(0, m_player); // emit an changeItem for the player emit changeItem(m_player, tSpawnChangedALL); m_cntDeadSpawnIDs = 0; m_posDeadSpawnIDs = 0; for (int i = 0; i < MAX_DEAD_SPAWNIDS; i++) m_deadSpawnID[i] = 0; } // end clear
CustomItemWidget::CustomItemWidget(QListWidgetItem *item,QWidget *parent) : QWidget(parent), item(item) { plusBtn = new QPushButton(); plusBtn->setMaximumSize(24,24); plusBtn->setIcon(QIcon(":/icons/select")); minusBtn = new QPushButton(); minusBtn->setMaximumSize(24,24); minusBtn->setIcon(QIcon(":/icons/delete")); lineEdit = new QLineEdit(); lineEdit->setMaxLength(512); QHBoxLayout *layout= new QHBoxLayout(); layout->setSpacing(1); layout->setContentsMargins(0,0,0,0); layout->addWidget(lineEdit); layout->addWidget(plusBtn); layout->addWidget(minusBtn); setLayout(layout); // 控件相关响应 connect(plusBtn, SIGNAL(clicked()), this, SLOT(changeItem())); connect(minusBtn, SIGNAL(clicked()), this, SLOT(removeItem())); }
void SpawnShell::backfillSpawn(const spawnStruct *spawn) { Item* item = m_spawns.find(spawn->spawnId); if (item == NULL) { // if it's not already in the list, then just add it. newSpawn(*spawn); return; } Spawn* spawnItem = (Spawn*)item; // if we got the self item, then somethings screwy, so only update if // not the self spawn if (!spawnItem->isSelf()) { spawnItem->backfill(spawn); updateFilterFlags(spawnItem); updateRuntimeFilterFlags(spawnItem); spawnItem->updateLastChanged(); emit changeItem(spawnItem, tSpawnChangedALL); if (spawnItem->filterFlags() & FILTER_FLAG_ALERT) emit handleAlert(spawnItem, tFilledSpawn); } }
void KLanguageCombo::changeLanguage(const QString &name, int i) { if(i < 0 || i >= count()) return; QString output = name + QString::fromLatin1(" (") + tag(i) + QString::fromLatin1(")"); changeItem(output, i); }
void SpawnShell::zoneEntry(const uint8_t* data) { const spawnStruct* spawn = (const spawnStruct*)data; #ifdef SPAWNSHELL_DIAG seqDebug("SpawnShell::zoneEntry(spawnStruct *(name='%s'))", spawn->name); #endif // Zone Entry. This is a semi-filled in spawnStruct that we // see for ourself when entering a zone. We also get sent this // when shrouding and when respawning from corpse hover mode. Auras // also get sent this sometimes. if (spawn->NPC == 0) { // Align the player instance with these values m_player->update(spawn); emit changeItem(m_player, tSpawnChangedALL); } else { // Auras. newSpawn(data); } }
void EditFunctions::currentSpecifierChanged( const QString& s ) { if ( !functionListView->currentItem() ) return; changeItem( functionListView->currentItem(), Specifier, s ); functionListView->currentItem()->setText( 2, s ); }
/*! mouseMoveEvent - mouse move on the list box */ void DDListBox::mouseMoveEvent( QMouseEvent * ) { if (count() == max_items && max_items != 0 && flag) { for (unsigned int i = 0; i < count(); i++) changeItem( QPixmap( green_icon ) , text(i) , i); flag = false; } if ( dragging && item(currentItem())->isSelectable() ) { QDragObject *d = new QTextDrag( currentText() , this ); d->dragCopy(); // do NOT delete d. dragging = FALSE; unsigned int current = currentItem(); if (count() == max_items && max_items != 0) { char s[100]; strcpy(s, currentText()); char * traits; traits = strtok(s," "); traits = strtok(NULL, " "); traits = strtok(NULL, " "); traits = strtok(NULL, " "); for (unsigned int i = 0; i < max_items; i++) { char s_i[100]; strcpy(s_i, text(i)); char * traits_i; traits_i = strtok(s_i," "); traits_i = strtok(NULL, " "); traits_i = strtok(NULL, " "); traits_i = strtok(NULL, " "); bool b = (strcmp(traits,traits_i) == 0); if (!b && i != current ) { changeItem( QPixmap( white_icon ) , text(i) , i); item(i)->setSelectable( b ); } } } removeItem ( current ); } }
void KCombo::setText( const char *text) { setCurrentItem(0); if (!set_text_called) { set_text_called = true; insertItem(text, 0); } changeItem(text, 0); }
void World::changeQuality(ScriptItem item, short int amount) { short int tmpQuality = ((amount+item.getDurability())<100) ? (amount + item.getQuality()) : (item.getQuality() - item.getDurability() + 99); if (tmpQuality%100 > 0) { item.setQuality(tmpQuality); changeItem(item); } else { erase(item, item.getNumber()); } }
void clear_interior_next_hops(node *tree) { if(tree->left != NULL) { changeItem(tree->interface_list, DISCARD_VAL); clear_interior_next_hops(tree->left); clear_interior_next_hops(tree->right); } }
void SpawnShell::playerChangedID(uint16_t playerID) { // remove the player from the list (if it had a 0 id) m_players.take(0); // re-insert the player into the list m_players.replace(playerID, m_player); emit changeItem(m_player, tSpawnChangedALL); }
void PanelBrowserMenu::slotMimeCheck() { // get the first map entry QMap<int, bool>::Iterator it = _mimemap.begin(); // no mime types left to check -> stop timer if(it == _mimemap.end()) { _mimecheckTimer->stop(); return; } int id = it.key(); QString file = _filemap[id]; _mimemap.erase(it); KUrl url; url.setPath( path() + '/' + file ); // KMimeType::Ptr mt = KMimeType::findByURL(url, 0, true, false); // QString icon(mt->icon(url, true)); QString icon = KMimeType::iconNameForUrl( url ); // kDebug() << url.url() << ": " << icon; file = fontMetrics().elidedText( file, Qt::ElideMiddle, fontMetrics().maxWidth() * 20 ); file.replace("&", "&&"); if(!_icons->contains(icon)) { QPixmap pm = SmallIcon(icon); if( pm.height() > 16 ) { QPixmap cropped( 16, 16 ); QPainter p(&cropped); p.drawPixmap(0, 0, pm, 0, 0, 16, 16); pm = cropped; } _icons->insert(icon, pm); changeItem(id, pm, file); } else changeItem(id, CICON(icon), file); }
void MIPSmemview::updateList(void) { unsigned int i; int top=topItem(); for(i=0;i<mem.size();i+=4) { changeItem(MemItem(i),i/4); } setCurrentItem(current()); setTopItem(top); }
void MessageOutput::addToLastItem(const QString& s) { int ind = count() - 1; if ( ind != -1 ) { MessageItem *it = dynamic_cast<MessageItem*>( item(ind) ); if ( it ) it->addText( s ); else changeItem( text( ind )+ s, ind ); } }
void PanelBrowserMenu::slotMimeCheck() { // get the first map entry QMap<int, bool>::Iterator it = _mimemap.begin(); // no mime types left to check -> stop timer if(it == _mimemap.end()) { _mimecheckTimer->stop(); return; } int id = it.key(); QString file = _filemap[id]; _mimemap.remove(it); KURL url; url.setPath( path() + '/' + file ); // KMimeType::Ptr mt = KMimeType::findByURL(url, 0, true, false); // QString icon(mt->icon(url, true)); QString icon = KMimeType::iconForURL( url ); // kdDebug() << url.url() << ": " << icon << endl; file = KStringHandler::cEmSqueeze( file, fontMetrics(), 20 ); file.replace("&", "&&"); if(!_icons->contains(icon)) { QPixmap pm = SmallIcon(icon); if( pm.height() > 16 ) { QPixmap cropped( 16, 16 ); copyBlt( &cropped, 0, 0, &pm, 0, 0, 16, 16 ); pm = cropped; } _icons->insert(icon, pm); changeItem(id, pm, file); } else changeItem(id, CICON(icon), file); }
void TListPanel::S_SelectItem(TFrameItem ¤tItem) { frameItems->at(currentIndex)->deSelect(); /*QMessageBox msgBox; QPushButton *connectButton = msgBox.addButton(QString::number(currentIndex), QMessageBox::ActionRole); QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort); msgBox.exec();*/ currentIndex = frameItems->indexOf(¤tItem); emit changeItem(currentIndex); }
void SpawnShell::refilterSpawns(itemType type) { ItemMap& theMap = getMap(type); ItemIterator it(theMap); if (type == tSpawn) { Spawn* spawn; // iterate over all the items in the map for (; it.current(); ++it) { // get the item spawn = (Spawn*)it.current(); // update the flags, if they changed, send a notification if (updateFilterFlags(spawn)) { spawn->updateLastChanged(); emit changeItem(spawn, tSpawnChangedFilter); } } } else { Item* item; // iterate over all the items in the map for (; it.current(); ++it) { // get the item item = it.current(); // update the flags, if they changed, send a notification if (updateFilterFlags(item)) { item->updateLastChanged(); emit changeItem(item, tSpawnChangedFilter); } } } }
void SpawnShell::newSpawn(const spawnStruct& s) { #ifdef SPAWNSHELL_DIAG printf("SpawnShell::newSpawn(spawnStruct *(name='%s'), bSelected=%s)\n", s.name, bSelected?"true":"false"); #endif // if this is the SPAWN_SELF it's the player if (s.NPC == SPAWN_SELF) return; // not the player, so check if it's a recently deleted spawn for (int i =0; i < m_cntDeadSpawnIDs; i++) { if ((m_deadSpawnID[i] != 0) && (m_deadSpawnID[i] == s.spawnId)) { // found a match, remove it from the deleted spawn list m_deadSpawnID[i] = 0; // let the user know what's going on printf("%s(%d) has already been removed from the zone before we processed it.\n", s.name, s.spawnId); // and stop the attempt to add the spawn. return; } } Item* item = m_spawns.find(s.spawnId); if (item != NULL) { Spawn* spawn = (Spawn*)item; spawn->update(&s); updateFilterFlags(item); updateRuntimeFilterFlags(item); item->updateLastChanged(); emit changeItem(item, tSpawnChangedALL); } else { item = new Spawn(&s); updateFilterFlags(item); updateRuntimeFilterFlags(item); m_spawns.insert(s.spawnId, item); emit addItem(item); // send notification of new spawn count emit numSpawns(m_spawns.count()); } if (item->filterFlags() & FILTER_FLAG_ALERT) emit handleAlert(item, tNewSpawn); }
void SpawnListMenu::setCurrentCategory(const Category* cat) { // set the current category m_currentCategory = cat; // update the menu item names if (cat != NULL) { changeItem(m_id_edit_category, "&Edit '" + cat->name() + "' Category..."); setItemEnabled(m_id_edit_category, true); changeItem(m_id_delete_category, "&Delete '" + cat->name() + "' Category..."); setItemEnabled(m_id_delete_category, true); } else { changeItem(m_id_edit_category, "&Edit Category..."); setItemEnabled(m_id_edit_category, false); changeItem(m_id_delete_category, "&Delete Category..."); setItemEnabled(m_id_delete_category, false); } }