QrcEditor::QrcEditor(QWidget *parent) : QWidget(parent), m_treeview(new ResourceView(&m_history)), m_addFileAction(0) { m_ui.setupUi(this); QHBoxLayout *layout = new QHBoxLayout; layout->setSpacing(0); layout->setMargin(0); m_ui.centralWidget->setLayout(layout); m_treeview->enableContextMenu(false); layout->addWidget(m_treeview); connect(m_ui.removeButton, SIGNAL(clicked()), this, SLOT(onRemove())); // 'Add' button with menu QMenu *addMenu = new QMenu(this); m_addFileAction = addMenu->addAction(tr("Add Files"), this, SLOT(onAddFiles())); addMenu->addAction(tr("Add Prefix"), this, SLOT(onAddPrefix())); m_ui.addButton->setMenu(addMenu); connect(m_treeview, SIGNAL(addPrefixTriggered()), this, SLOT(onAddPrefix())); connect(m_treeview, SIGNAL(addFilesTriggered(QString)), this, SLOT(onAddFiles())); connect(m_treeview, SIGNAL(removeItem()), this, SLOT(onRemove())); connect(m_treeview, SIGNAL(currentIndexChanged()), this, SLOT(updateCurrent())); connect(m_treeview, SIGNAL(dirtyChanged(bool)), this, SIGNAL(dirtyChanged(bool))); m_treeview->setFocus(); connect(m_ui.aliasText, SIGNAL(textEdited(QString)), this, SLOT(onAliasChanged(QString))); connect(m_ui.prefixText, SIGNAL(textEdited(QString)), this, SLOT(onPrefixChanged(QString))); connect(m_ui.languageText, SIGNAL(textEdited(QString)), this, SLOT(onLanguageChanged(QString))); // Prevent undo command merging after a switch of focus: // (0) The initial text is "Green". // (1) The user appends " is a color." --> text is "Green is a color." // (2) The user clicks into some other line edit --> loss of focus // (3) The user gives focuse again and substitutes "Green" with "Red" // --> text now is "Red is a color." // (4) The user hits undo --> text now is "Green is a color." // Without calling advanceMergeId() it would have been "Green", instead. connect(m_ui.aliasText, SIGNAL(editingFinished()), m_treeview, SLOT(advanceMergeId())); connect(m_ui.prefixText, SIGNAL(editingFinished()), m_treeview, SLOT(advanceMergeId())); connect(m_ui.languageText, SIGNAL(editingFinished()), m_treeview, SLOT(advanceMergeId())); connect(m_treeview, SIGNAL(addFilesTriggered(const QString&)), this, SIGNAL(addFilesTriggered(const QString&))); connect(&m_history, SIGNAL(canRedoChanged(bool)), this, SLOT(updateHistoryControls())); connect(&m_history, SIGNAL(canUndoChanged(bool)), this, SLOT(updateHistoryControls())); connect(&m_history, SIGNAL(canRedoChanged(bool)), this, SLOT(updateCurrent())); connect(&m_history, SIGNAL(canUndoChanged(bool)), this, SLOT(updateCurrent())); updateHistoryControls(); updateCurrent(); }
bool SuperHashTable::doAdd(void * donor, bool replace) { unsigned vs = getHashFromElement(donor); unsigned vm = doFind(vs, getFindParam(donor)); void *et = table[vm]; if (et) { if (replace) { onRemove(et); table[vm] = donor; onAdd(donor); return true; } else return false; } else { unsigned tablelim = getTableLimit(tablesize); if (tablecount>=tablelim) { expand(); vm = doFind(vs, getFindParam(donor)); } tablecount++; table[vm] = donor; onAdd(donor); } return true; }
void Entity::remove() { for (auto trit = m_traits.rbegin(); trit != m_traits.rend(); ++trit) { (*trit)->onRemoveTrait(); } onRemove(); world.entityManager.queueDeleteEntity(this); }
bool SuperHashTable::remove(const void *fp) { unsigned v = doFind(fp); void * et = table[v]; if (!et) return false; doDeleteElement(v); onRemove(et); return true; }
/** * @brief * Add a data point to this sliding window. * @param value * the value */ void add(const _DataPointType& dataPoint) { if (!empty() && _new == _old) { onRemove(_dataPoints[_old]); _old = (_old + 1) % _capacity; } _dataPoints[_new] = dataPoint; _new = (_new + 1) % _capacity; _size = (_size + 1) % _capacity; onAdd(dataPoint); }
bool SuperHashTable::removeExact(void *et) { if (!et) return false; unsigned v = doFindExact(et); if (table[v]!=et) return false; doDeleteElement(v); onRemove(et); return true; }
// Keyboard shortcuts LRESULT WaitingUsersFrame::onChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { switch(wParam) { case VK_DELETE: onRemove(0, 0, 0, bHandled); break; default: bHandled = FALSE; } return 0; }
void SuperHashTable::releaseAll(void) { unsigned i; for (i = 0; i < tablesize; i++) { void * et = table[i]; table[i] = NULL; if (et) onRemove(et); } tablecount = 0; }
// called in Stored destructor // removes the object from list. returns iterator to next valid object. virtual void remove(Target * object) { // some STL versions of remove return void instead // of returning iterator to next object. So we // need to get it manually onRemove(object); // raise onRemove event generator->free(object->id()); object->localID=-1; //idGenerator.freeID(object->id()); objects.erase(object->back); }
EntitiesTreeWidget::EntitiesTreeWidget(QWidget *parent) : QTreeWidget(parent) { applicationNode = new QTreeWidgetItem(this,QStringList() << "Application"); modulesNode = new QTreeWidgetItem(this,QStringList() << "Modules"); resourcesNode = new QTreeWidgetItem(this,QStringList() << "Resources"); templatesNode = new QTreeWidgetItem(this,QStringList() << "Templates"); applicationNode->setIcon(0,QIcon(":/images/folderapp_ico.png")); modulesNode->setIcon(0,QIcon(":/images/foldermod_ico.png")); resourcesNode->setIcon(0,QIcon(":/images/folderres_ico.png")); templatesNode->setIcon(0,QIcon(":/images/folder_ico.png")); addTopLevelItem(applicationNode); addTopLevelItem(modulesNode); addTopLevelItem(resourcesNode); addTopLevelItem(templatesNode); setExpandsOnDoubleClick(false); setContextMenuPolicy(Qt::CustomContextMenu); resizeColumnToContents(0); connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),this,SLOT(onItemDoubleClicked(QTreeWidgetItem*,int))); connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(onContext(QPoint))); openFile = new QAction("Open File",this); importFile = new QAction("Import Files...",this); topLevelMenu.addAction(openFile); topLevelMenu.addAction(importFile); loadFiles = new QAction("Load",this); QAction *separator = new QAction(this); separator->setSeparator(true); reopen = new QAction("Reopen",this); remove = new QAction("Remove",this); secondLevelMenu.addAction(loadFiles); secondLevelMenu.addAction(separator); secondLevelMenu.addAction(reopen); secondLevelMenu.addAction(remove); edit = new QAction("Edit",this); leafLevelMenu.addAction(edit); connect(loadFiles,SIGNAL(triggered()),this,SLOT(onLoadFile())); connect(openFile,SIGNAL(triggered()),this,SIGNAL(openFiles())); connect(importFile,SIGNAL(triggered()),this,SIGNAL(importFiles())); connect(edit,SIGNAL(triggered()),this,SLOT(onEdit())); connect(remove,SIGNAL(triggered()),this,SLOT(onRemove())); }
void Kludget::close() { onRemove(); window->hide(); window->close(); #if 1 // forcefully remove preference file settings->sync(); settings->clear(); #endif }
AgentInjector::AgentInjector(QWidget *parent) : QDialog(parent) { ui.setupUi(this); connect(ui.injectButton, SIGNAL(clicked()), this, SLOT(onInject())); connect(ui.removeButton, SIGNAL(clicked()), this, SLOT(onRemove())); connect(ui.agentList, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(onSelect(QListWidgetItem *, QListWidgetItem *))); connect(ui.agentList, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), ui.imagePreview, SLOT(onSelect(QListWidgetItem *, QListWidgetItem *))); setAttribute(Qt::WA_QuitOnClose, false); resize(400,500); readAgents(); }
//============================================================================================================ // MyComponent Overrides //============================================================================================================ // void MyComponent::SetOwner( VisTypedEngineObject_cl *pOwner ) { IVObjectComponent::SetOwner( pOwner ); if (pOwner!=NULL) { MyComponent_ComponentManager::GlobalManager().Instances().AddUnique(this); Vision::Message.Add("myComponent - Component Instance created"); onStartup( pOwner ); } else { onRemove( pOwner ); Vision::Message.Add("myComponent - Removed Component Instance from component Manager"); MyComponent_ComponentManager::GlobalManager().Instances().SafeRemove(this); } }
// -------------------------------------------------------------------------- ctkAddRemoveComboBox::ctkAddRemoveComboBox(QWidget* _parent) : Superclass(_parent) , d_ptr(new ctkAddRemoveComboBoxPrivate(*this)) { Q_D(ctkAddRemoveComboBox); d->setupUi(this); // connect d->connectComboBox(d->ComboBox); this->connect(d->AddPushButton, SIGNAL(pressed()), SLOT(onAdd())); this->connect(d->RemovePushButton, SIGNAL(pressed()), SLOT(onRemove())); this->connect(d->EditPushButton, SIGNAL(pressed()), SLOT(onEdit())); // Add default 'empty item' d->insertEmptyItem(); }
bool widget::remove(widget* widget) { typedef std::vector<class widget*>::iterator widget_iterator; widget_iterator child = impl_->find_child(widget); if (child == impl_->children_.end()) return false; if (!onRemoving(widget)) return false; impl_->children_.erase(child); widget->impl_->father_ = nullptr; onRemove(widget); repaint(); return true; }
void process() { while(nextOperation) { auto operation = nextOperation; switch(operation->type) { case OperationType::Add: onAdd(operation); break; case OperationType::Remove: onRemove(operation); break; case OperationType::RemoveAll: onRemoveAll(operation); break; default: throw std::runtime_error("Unexpected EntityOperation type"); } nextOperation = operation->nextOperation; operation->~T(); memoryManager->free(sizeof(T), alignof(T), operation); } nextOperation = nullptr; lastOperation = nullptr; }
void MainWindow::setupMenuBar() { QMenuBar *myMenuBar = new QMenuBar(this); QMenu *fileMenu = myMenuBar->addMenu(tr("&File")); QMenu *itemMenu = myMenuBar->addMenu(tr("&Entries")); fileMenu->addAction(QIcon(":/icons/save.png"), tr("Save"), rfe_widget, SLOT(saveResourceFile()), QKeySequence::Save); fileMenu->addAction(QIcon(":/icons/load.png"), tr("Open"), rfe_widget, SLOT(loadResourceFile()), QKeySequence::Open); fileMenu->addSeparator(); fileMenu->addAction(QIcon(":/icons/exit.png"), tr("Quit"), qApp, SLOT(quit()), QKeySequence(tr("Ctrl+Q"))); itemMenu->addAction(QIcon(":/icons/group_add.png"), tr("add Group"), rfe_widget, SLOT(addNewGroup()), QKeySequence(tr("Ctrl+G"))); itemMenu->addAction(QIcon(":/icons/add.png"), tr("add Entry"), rfe_widget, SLOT(addNewItem()), QKeySequence(tr("Ctrl+E"))); itemMenu->addAction(QIcon(":/icons/rem.png"), tr("delete Entry"), rfe_widget, SLOT(onRemove()), QKeySequence::Delete); setMenuBar(myMenuBar); }
ConfigurationListUI::ConfigurationListUI(QStringList &list, ConfigurationListMode mode, QString &description, QWidget *parent) : QWidget(parent), m_list(list) { QLabel *descriptionLabel = new QLabel(description); descriptionLabel->setWordWrap(true); m_listModel = new QStringListModel(list); m_buttonAdd = new QPushButton(tr("Add Item")); m_buttonAdd->setIcon(QIcon::fromTheme("list-add")); m_buttonRemove = new QPushButton(tr("Remove Item")); m_buttonRemove->setIcon(QIcon::fromTheme("list-remove")); m_buttonRemove->setEnabled(false); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->setAlignment(Qt::AlignRight); buttonLayout->setMargin(0); buttonLayout->setSpacing(10); buttonLayout->addWidget(m_buttonAdd); buttonLayout->addWidget(m_buttonRemove); QWidget *modificationButtons = new QWidget(); modificationButtons->setLayout(buttonLayout); m_listView = new QListView(); m_listView->setModel(m_listModel); QVBoxLayout *listLayout = new QVBoxLayout; listLayout->setMargin(10); listLayout->setSpacing(20); listLayout->addWidget(descriptionLabel); listLayout->addWidget(m_listView); listLayout->addWidget(modificationButtons); this->setLayout(listLayout); connect(m_listView, SIGNAL(clicked(QModelIndex)), this, SLOT(onItemSeleced())); if (mode == DIRECTORY) { connect(m_buttonAdd, SIGNAL(clicked()), this, SLOT(onAddDirectory())); } else { connect(m_buttonAdd, SIGNAL(clicked()), this, SLOT(onAddPattern())); } connect(m_buttonRemove, SIGNAL(clicked()), this, SLOT(onRemove())); }
void LLPanelOutfitsInventory::onCustomAction(const LLSD& userdata) { if (!isActionEnabled(userdata)) return; const std::string command_name = userdata.asString(); if (command_name == "new") { onSave(); } if (command_name == "edit") { onEdit(); } if (command_name == "wear") { onWearButtonClick(); } // Note: This option has been removed from the gear menu. if (command_name == "add") { onAdd(); } if (command_name == "remove") { onRemove(); } if (command_name == "rename") { onClipboardAction("rename"); } if (command_name == "remove_link") { onClipboardAction("delete"); } if (command_name == "delete") { onClipboardAction("delete"); } updateListCommands(); updateVerbs(); }
/** * \brief widget, creates the Options Tab Shortcuts Widget * \return QWidget*, points to the previously created widget */ QWidget *OptionsTabShortcuts::widget() { if ( w ) return 0; w = new OptShortcutsUI(); OptShortcutsUI *d = (OptShortcutsUI *)w; d->treeShortcuts->setColumnWidth(0, 320); d->add->setEnabled(false); d->remove->setEnabled(false); d->edit->setEnabled(false); connect(d->treeShortcuts, SIGNAL(itemSelectionChanged()), this, SLOT(onItemSelectionChanged())); connect(d->treeShortcuts, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(onItemDoubleClicked(QTreeWidgetItem *, int))); connect(d->add, SIGNAL(clicked()), this, SLOT(onAdd())); connect(d->remove, SIGNAL(clicked()), this, SLOT(onRemove())); connect(d->edit, SIGNAL(clicked()), this, SLOT(onEdit())); connect(d->restoreDefaults, SIGNAL(clicked()), this, SLOT(onRestoreDefaults())); return w; }
void ComExtensionData::onExit() { onRemove(); }
EntitiesTreeWidget::EntitiesTreeWidget(QWidget *parent) : QTreeWidget(parent) { applicationNode = new QTreeWidgetItem(this,QStringList() << "Application"); modulesNode = new QTreeWidgetItem(this,QStringList() << "Modules"); resourcesNode = new QTreeWidgetItem(this,QStringList() << "Resources"); templatesNode = new QTreeWidgetItem(this,QStringList() << "Templates"); applicationNode->setIcon(0,QIcon(":/folder-app.svg")); modulesNode->setIcon(0,QIcon(":/folder-mod.svg")); resourcesNode->setIcon(0,QIcon(":/folder-res.svg")); templatesNode->setIcon(0,QIcon(":/folder.svg")); addTopLevelItem(applicationNode); addTopLevelItem(modulesNode); addTopLevelItem(resourcesNode); addTopLevelItem(templatesNode); setExpandsOnDoubleClick(false); setContextMenuPolicy(Qt::CustomContextMenu); resizeColumnToContents(0); connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),this,SLOT(onItemDoubleClicked(QTreeWidgetItem*,int))); connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(onContext(QPoint))); openFile = new QAction("Open File",this); importFile = new QAction("Import Files...",this); topLevelMenu.addAction(openFile); topLevelMenu.addAction(importFile); loadFiles = new QAction("Load",this); QAction *separator = new QAction(this); separator->setSeparator(true); reopen = new QAction("Refresh",this); remove = new QAction("Remove",this); editApplication = new QAction("Edit",this); secondLevelMenu.addAction(loadFiles); secondLevelMenu.addAction(editApplication); secondLevelMenu.addAction(separator); secondLevelMenu.addAction(reopen); secondLevelMenu.addAction(remove); edit = new QAction("Edit",this); leafLevelMenu.addAction(edit); connect(loadFiles,SIGNAL(triggered()),this,SLOT(onLoadFile())); connect(editApplication,SIGNAL(triggered()),this,SLOT(onEditApplication())); connect(openFile,SIGNAL(triggered()),this,SIGNAL(openFiles())); connect(importFile,SIGNAL(triggered()),this,SIGNAL(importFiles())); connect(edit,SIGNAL(triggered()),this,SLOT(onEdit())); connect(remove,SIGNAL(triggered()),this,SLOT(onRemove())); connect(reopen,SIGNAL(triggered()),this,SLOT(onReopen())); #if defined(WIN32) ext_editor = "notepad.exe"; #else ext_editor = "xdg-open"; #endif setDragEnabled(true); setDragDropMode(DragOnly); }
void datacollector::updateData(vector<Point2f> newData,double minDist){ if(newData.size()>0 && newData.size()<300){ ///POPULATE DISTANCE MATIX for(int i=0;i<newData.size();i++){ used[i]=false; } for(mapIt = data.begin(); mapIt != data.end( ); ++mapIt){ int numB=0; for (it = newData.begin(); it!=newData.end(); ++it){ distances[mapIt->first][numB]=distancePointPoint(Point2f(mapIt->second.x,mapIt->second.y),*it); numB++; } } ///* TO AID IN THE SEARCH */// map<int,Point2f> aux=data; bool buscar=true; while(buscar){ int mI=0; Point2f pI(0,0); double dist=1000000000; bool hayMin=false; int numB=0,numU=10000000; for (it = newData.begin(); it!=newData.end(); ++it){ if(!used[numB]){ for(mapIt = aux.begin(); mapIt != aux.end( ); ++mapIt){ if(dist>distances[mapIt->first][numB]){ dist=distances[mapIt->first][numB]; hayMin=true; mI=mapIt->first; pI.x=it->x;pI.y=it->y; numU=numB; } } } numB++; } if(hayMin){ used[numU]=true; ///UPDATE THE VALUE /// HERE CHANGE UPDATE ONLY IF DISTANCE IS MORE THAN... if(distances[mI][numU]>minDist){ data[mI]=pI; } aux.erase(aux.find(mI)); if(onUpdate==NULL){ cout << "set cur " << mI << " : " << data[mI].x << "," << data[mI].y << endl; if(useMouse && mI==0){ tmw->move(data[mI].x,data[mI].y); } } ///////////////////////////////////////////////////////////////////////////////////////////////////// else{onUpdate(mI,data[mI].x,data[mI].y);} ///////////////////////////////////////////////////////////////////////////////////////////////////// } else{ buscar=false; } } for(mapIt = aux.begin(); mapIt != aux.end( ); ++mapIt ){ //REMOVE THOSE NOT USED data.erase(data.find(mapIt->first)); if(onRemove==NULL){ cout << "del cur " << mapIt->first << endl; if(useMouse && mapIt->first==0){ tmw->release(); } } ///////////////////////////////////////////////////////////////////////////////////////////////////// else{onRemove(mapIt->first);} ///////////////////////////////////////////////////////////////////////////////////////////////////// } int numB=0; for (it = newData.begin(); it!=newData.end(); ++it){ if(!used[numB]){ ///CHECK FOR FREE ID AND ASSIGN THE NEW VALUE: for(int u=0;u<300;u++){ if(data.count(u)==0){ data[u]=Point2f(it->x,it->y); if(onAdd==NULL){ cout << "add cur "<< u << " : " << it->x <<"," <<it->y << endl; if(useMouse && u==0){ tmw->press(it->x,it->y); } } ///////////////////////////////////////////////////////////////////////////////////////////////////// else{ onAdd(u,it->x,it->y); } ///////////////////////////////////////////////////////////////////////////////////////////////////// break; } } } numB++; } //cout << "DATA SIZE : " << data.size() << endl; } else{ if(data.size()>0){ for(mapIt = data.begin(); mapIt != data.end( ); ++mapIt ){ //REMOVE ALL if(onRemove==NULL){ cout << "del cur " << mapIt->first << endl; if(useMouse && mapIt->first==0){ tmw->release(); } } ///////////////////////////////////////////////////////////////////////////////////////////////////// else{onRemove(mapIt->first);} ///////////////////////////////////////////////////////////////////////////////////////////////////// } data.clear(); } } }