void HistoryDialog::contextMenu(QPoint point) { mContextIndex = ui->tableView->indexAt(point);; QMenu contextMenu(ui->tableView); QAction copyAction((mContextIndex.column() == 0) ? tr("Copy Path") : tr("Copy URL"), &contextMenu); connect(©Action, SIGNAL(triggered()), this, SLOT(copy())); contextMenu.addAction(©Action); QAction deleteAction(tr("Delete from imgur.com"), &contextMenu); QAction locationAction(tr("Open Location"), &contextMenu); QAction removeAction(tr("Remove history entry"), &contextMenu); if (mContextIndex.data().toString().isEmpty()) { copyAction.setEnabled(false); deleteAction.setEnabled(false); } if (mContextIndex.column() == 0) { connect(&locationAction, SIGNAL(triggered()), this, SLOT(location())); contextMenu.addAction(&locationAction); } else { connect(&deleteAction, SIGNAL(triggered()), this, SLOT(deleteImage())); contextMenu.addAction(&deleteAction); } connect(&removeAction, SIGNAL(triggered()), this, SLOT(removeHistoryEntry())); contextMenu.addAction(&removeAction); contextMenu.exec(QCursor::pos()); }
void stopOverdub(int frame) { cmp.a2.frame = frame; bool ringLoop = false; bool nullLoop = false; /* ring loop verification, i.e. a composite action with key_press at * frame N and key_release at frame M, with M <= N */ if (cmp.a2.frame < cmp.a1.frame) { ringLoop = true; gLog("[REC] ring loop! frame1=%d < frame2=%d\n", cmp.a1.frame, cmp.a2.frame); rec(cmp.a2.chan, cmp.a2.type, G_Mixer.totalFrames); // record at the end of the sequencer } else if (cmp.a2.frame == cmp.a1.frame) { nullLoop = true; gLog("[REC] null loop! frame1=%d == frame2=%d\n", cmp.a1.frame, cmp.a2.frame); deleteAction(cmp.a1.chan, cmp.a1.frame, cmp.a1.type, false); // false == don't check values } SampleChannel *ch = (SampleChannel*) G_Mixer.getChannelByIndex(cmp.a2.chan); ch->readActions = false; // don't use disableRead() /* remove any nested action between keypress----keyrel, then record */ if (!nullLoop) deleteActions(cmp.a2.chan, cmp.a1.frame, cmp.a2.frame, cmp.a1.type); deleteActions(cmp.a2.chan, cmp.a1.frame, cmp.a2.frame, cmp.a2.type); if (!ringLoop && !nullLoop) { rec(cmp.a2.chan, cmp.a2.type, cmp.a2.frame); /* avoid underlying action truncation, if keyrel happens inside a * composite action */ action *act = NULL; int res = getNextAction(cmp.a2.chan, cmp.a1.type | cmp.a2.type, cmp.a2.frame, &act); if (res == 1) { if (act->type == cmp.a2.type) { gLog("[REC] add truncation at frame %d, type=%d\n", act->frame, act->type); deleteAction(act->chan, act->frame, act->type, false); // false == don't check values } } } }
void QtButton::deleteFra() { Is_AttFra = false; Is_InjFra = false; Is_ActFra = false; Is_BodyFra = false; Is_EffFra = false; deleteAction(true); }
void deleteActions(int chan, int frame_a, int frame_b, char type) { sortActions(); gVector<int> dels; for (unsigned i=0; i<frames.size; i++) if (frames.at(i) > frame_a && frames.at(i) < frame_b) dels.add(frames.at(i)); for (unsigned i=0; i<dels.size; i++) deleteAction(chan, dels.at(i), type, false); // false == don't check values }
ActionEditor::ActionEditor( QWidget* parent, const char* name, WFlags fl ) : ActionEditorBase( parent, name, fl ), currentAction( 0 ), formWindow( 0 ), explicitlyClosed(false) { listActions->addColumn( i18n( "Actions" ) ); setEnabled( FALSE ); buttonConnect->setEnabled( FALSE ); QPopupMenu *popup = new QPopupMenu( this ); popup->insertItem( i18n( "New &Action" ), this, SLOT( newAction() ) ); popup->insertItem( i18n( "New Action &Group" ), this, SLOT( newActionGroup() ) ); popup->insertItem( i18n( "New &Dropdown Action Group" ), this, SLOT( newDropDownActionGroup() ) ); buttonNewAction->setPopup( popup ); buttonNewAction->setPopupDelay( 0 ); connect( listActions, SIGNAL( insertAction() ), this, SLOT( newAction() ) ); connect( listActions, SIGNAL( insertActionGroup() ), this, SLOT( newActionGroup() ) ); connect( listActions, SIGNAL( insertDropDownActionGroup() ), this, SLOT( newDropDownActionGroup() ) ); connect( listActions, SIGNAL( deleteAction() ), this, SLOT( deleteAction() ) ); connect( listActions, SIGNAL( connectAction() ), this, SLOT( connectionsClicked() ) ); }
bool ActionListView::qt_emit( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->signalOffset() ) { case 0: insertAction(); break; case 1: insertActionGroup(); break; case 2: insertDropDownActionGroup(); break; case 3: deleteAction(); break; case 4: connectAction(); break; default: return QListView::qt_emit(_id,_o); } return TRUE; }
void DeleteRecursive(LPCTSTR target, wregex* ignorePattern) { if (!Utilities::DirectoryExists(target)) { CString message; message.Format(TEXT("Cannot delete directory %s because it does not exist. Proceeding anyway."), target); OutputWriter::WriteLine(message, VERBOSITY_THRESHOLD_NORMAL); return; } CDeleteAction deleteAction(target); ProcessDirectory(target, deleteAction, TEXT(""), true, ignorePattern); }
HarmonyCanvas::HarmonyCanvas(QWidget* parent) : QFrame(parent) { setFrameStyle(QFrame::StyledPanel | QFrame::Raised); setAcceptDrops(true); setFocusPolicy(Qt::StrongFocus); extraMag = 3.0; chordDescription = 0; chordList = 0; moveElement = 0; QAction* a = getAction("delete"); addAction(a); connect(a, SIGNAL(triggered()), SLOT(deleteAction())); }
void resource::dispatch( const reactive::http::request& request_, const reactive::web::router::parameters& parameters_, reactive::http::response& response_ ) const { // call preDispatch preDispatch(request_, parameters_, response_); if (request_.isGet()) { getAction(request_, parameters_, response_); } else if (request_.isPost()) { postAction(request_, parameters_, response_); } else if (request_.isPut()) { putAction(request_, parameters_, response_); } else if (request_.isDelete()) { deleteAction(request_, parameters_, response_); } else if (request_.isOptions()) { optionsAction(request_, parameters_, response_); } else if (request_.isTrace()) { traceAction(request_, parameters_, response_); } else if (request_.isPatch()) { patchAction(request_, parameters_, response_); } else if (request_.isConnect()) { connectAction(request_, parameters_, response_); } else { response_.setStatusCode(reactive::http::status::METHOD_NOT_ALLOWED); } // call postDispatch postDispatch(request_, parameters_, response_); }
bool ActionEditorBase::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: languageChange(); break; case 1: init(); break; case 2: destroy(); break; case 3: connectionsClicked(); break; case 4: currentActionChanged((QListViewItem*)static_QUType_ptr.get(_o+1)); break; case 5: deleteAction(); break; case 6: newAction(); break; default: return QWidget::qt_invoke( _id, _o ); } return TRUE; }
bool ActionEditor::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: currentActionChanged((QListViewItem*)static_QUType_ptr.get(_o+1)); break; case 1: deleteAction(); break; case 2: newAction(); break; case 3: newActionGroup(); break; case 4: newDropDownActionGroup(); break; case 5: connectionsClicked(); break; case 6: removeConnections((QObject*)static_QUType_ptr.get(_o+1)); break; default: return ActionEditorBase::qt_invoke( _id, _o ); } return TRUE; }
void ProviderWindow::setupConnections() { // signals and slots connections // Standard Actions for buttons connect( cancelButton, SIGNAL( clicked() ), this, SLOT( cancelAction() ) ); connect( saveButton, SIGNAL( clicked() ), this, SLOT( saveAction() ) ); connect (deleteButton, SIGNAL( clicked() ), this, SLOT( deleteAction() ) ); // These to connects are for detecting if the ok/save button should be // activated. connect( lastnameEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( activatesaveButton() ) ); connect( firstnameEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( activatesaveButton() ) ); // Detects if the signature on file checkbox changed, and if so // runs sofchanged() to activate or deactivate signature on file date box. connect (sofCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( sofchanged() ) ); }
void TodoView::contextMenuEvent(QContextMenuEvent *event) { QModelIndex index = currentIndex(); const QStandardItemModel *model = static_cast <const QStandardItemModel *> (index.model()); if (index.isValid() && model) { QString title = model->data(index, Qt::DisplayRole).toString(); KMenu *menu = new KMenu(title, this); /* if (model->data(index, TodoModel::PercentRole).toInt() < 100) { QAction *action = new QAction(i18n("Set task as completed ?"), this); action->setCheckable(true); action->setData(model->data(index, TodoModel::UIDRole).toString()); action->setObjectName(MARK_COMPLETE_ACTION_NAME); menu->addAction(action); menu->addSeparator(); } */ QAction editAction(i18n("Edit task"), this); editAction.setIcon(KIcon("document-edit")); editAction.setData(model->data(index, TodoModel::UIDRole).toString()); editAction.setObjectName(EDIT_ACTION_NAME); QAction viewAction(i18n("View task"), this); viewAction.setIcon(KIcon("view-task")); viewAction.setData(model->data(index, TodoModel::UIDRole).toString()); viewAction.setObjectName(OPEN_ACTION_NAME); QAction deleteAction(i18n("Delete task"), this); deleteAction.setIcon(KIcon("edit-delete")); deleteAction.setData(model->data(index, TodoModel::UIDRole).toString()); deleteAction.setObjectName(DELETE_ACTION_NAME); menu->addAction(&editAction); menu->addAction(&viewAction); menu->addAction(&deleteAction); connect(menu, SIGNAL(triggered(QAction *)), SLOT(slotActionClicked(QAction *))); menu->exec(event->globalPos()); } }
void HotkeysTreeViewContextMenu::slotAboutToShow() { clear(); if (_index.isValid()) { KHotKeys::ActionDataBase *element = _view->model()->indexToActionDataBase(_index); KHotKeys::ActionDataGroup *group = _view->model()->indexToActionDataGroup(_index); bool isGroup = group; // Is the current element a group if (!isGroup) { group = element->parent(); } // Create the create actions createTriggerMenus(group->allowedTriggerTypes(), group->allowedActionTypes()); // It is not allowed to create a subgroup for a system group. if (!group->is_system_group()) { addAction( i18n("New Group") , this, SLOT(newGroupAction()) ); } // It is not allowed to delete a system group if (!(isGroup && group->is_system_group())) { // Item related actions addAction( i18n("Delete"), this, SLOT(deleteAction()) ); } } else { createTriggerMenus(KHotKeys::Trigger::AllTypes, KHotKeys::Action::AllTypes); addAction( i18n("New Group") , this, SLOT(newGroupAction()) ); } addSeparator(); addAction( i18n("Export Group..."), this, SLOT(exportAction()) ); addAction( i18n("Import..."), this, SLOT(importAction()) ); }
void run() { switch (routes[action]) { case LOAD: loadAction(); break; case INSERT: insertAction(); break; case FIND: findAction(); break; case REMOVE: removeAction(); break; case CLEAR: clearAction(); break; case DELETE: deleteAction(); break; case SHOW: showAction(); break; case TEST: testAction(); break; case HELP: helpAction(); break; case REPORT: reportAction(); break; default: usageAction(); break; } }
void ActionListView::rmbMenu( QListViewItem *i, const QPoint &p ) { QPopupMenu *popup = new QPopupMenu( this ); popup->insertItem( tr( "New &Action" ), 0 ); popup->insertItem( tr( "New Action &Group" ), 1 ); popup->insertItem( tr( "New &Dropdown Action Group" ), 2 ); if ( i ) { popup->insertSeparator(); popup->insertItem( tr( "&Connect Action..." ), 3 ); popup->insertSeparator(); popup->insertItem( tr( "Delete Action" ), 4 ); } int res = popup->exec( p ); if ( res == 0 ) emit insertAction(); else if ( res == 1 ) emit insertActionGroup(); else if ( res == 2 ) emit insertDropDownActionGroup(); else if ( res == 3 ) emit connectAction(); else if ( res == 4 ) emit deleteAction(); }
void QsciEditor::setupActions() { cutAct = new QAction( QIcon::fromTheme( "edit-cut" ), "Cu&t", this ); cutAct->setStatusTip( "Cut the selected text" ); cutAct->setShortcut( tr( "Ctrl+X" ) ); copyAct = new QAction( QIcon::fromTheme( "edit-copy" ), "&Copy", this ); copyAct->setStatusTip( "Copy the selected text" ); copyAct->setShortcut( tr( "Ctrl+C" ) ); pasteAct = new QAction( QIcon::fromTheme( "edit-paste" ), "&Paste", this ); pasteAct->setStatusTip( "Paste the text on the clipboard" ); pasteAct->setShortcut( tr( "Ctrl+V" ) ); deleteAct = new QAction( QIcon::fromTheme( "edit-delete" ), "&Delete", this ); deleteAct->setStatusTip( "Delete the selected Text" ); deleteAct->setShortcut( tr( "Delete" ) ); selectAct = new QAction( QIcon::fromTheme( "edit-select-all" ), "Select &All", this ); selectAct->setStatusTip( "Select all the text" ); selectAct->setShortcut( tr( "Ctrl+A" ) ); deselectAct = new QAction( QIcon(), "Deselect &All", this ); deselectAct->setStatusTip( "Deselect all the text" ); deselectAct->setShortcut( tr( "Ctrl+Shift+A" ) ); undoAct = new QAction( QIcon::fromTheme( "edit-undo" ), "&Undo", this ); undoAct->setStatusTip( "Undo the last change" ); undoAct->setShortcut( tr( "Ctrl+Z" ) ); redoAct = new QAction( QIcon::fromTheme( "edit-redo" ), "&Redo", this ); redoAct->setStatusTip( "Redo the undone change" ); redoAct->setShortcut( tr( "Ctrl+Y" ) ); searchAct = new QAction( QIcon::fromTheme( "edit-find" ), "&Search", this ); searchAct->setStatusTip( "Search the document" ); searchAct->setShortcut( tr( "Ctrl+F" ) ); replaceAct = new QAction( QIcon::fromTheme( "edit-find-replace" ), "&Replace", this ); replaceAct->setStatusTip( "Replace text in the document" ); replaceAct->setShortcut( tr( "Ctrl+R" ) ); changeFontAct = new QAction( QIcon::fromTheme( "preferences-desktop-font" ), "Change &Font", this ); changeFontAct->setStatusTip( "Change the font of the document" ); changeFontAct->setShortcut( tr( "Ctrl+Shift+F" ) ); toggleCaseAct = new QAction( "T&oggle Case of Selection", this ); toggleCaseAct->setStatusTip( "Toggle the case of the selected text" ); toggleCaseAct->setShortcut( tr( "Ctrl+Alt+U" ) ); connect( this, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( showCustomMenu( const QPoint& ) ) ); connect( cutAct, SIGNAL( triggered() ), this, SLOT( cutAction() ) ); connect( copyAct, SIGNAL( triggered() ), this, SLOT( copyAction() ) ); connect( pasteAct, SIGNAL( triggered() ), this, SLOT( pasteAction() ) ); connect( deleteAct, SIGNAL( triggered() ), this, SLOT( deleteAction() ) ); connect( undoAct, SIGNAL( triggered() ), this, SLOT( undoAction() ) ); connect( redoAct, SIGNAL( triggered() ), this, SLOT( redoAction() ) ); connect( selectAct, SIGNAL( triggered() ), this, SLOT( selectAction() ) ); connect( deselectAct, SIGNAL( triggered() ), this, SLOT( deselectAction() ) ); connect( changeFontAct, SIGNAL( triggered() ), this, SLOT( changeFont() ) ); connect( toggleCaseAct, SIGNAL( triggered() ), this, SLOT( toggleCase() ) ); connect( searchAct, SIGNAL( triggered() ), this, SLOT( showSearch() ) ); connect( this, SIGNAL( linesChanged() ), this, SLOT( resizeMargins() ) ); addAction( cutAct ); addAction( copyAct ); addAction( pasteAct ); addAction( deleteAct ); addAction( selectAct ); addAction( deselectAct ); addAction( undoAct ); addAction( redoAct ); addAction( searchAct ); addAction( replaceAct ); addAction( changeFontAct ); addAction( toggleCaseAct ); /* Change keyBindings */ SendScintilla( SCI_ASSIGNCMDKEY, SCK_DOWN + ( SCMOD_CTRL << 16 ), SCI_PARADOWN ); SendScintilla( SCI_ASSIGNCMDKEY, SCK_UP + ( SCMOD_CTRL << 16 ), SCI_PARAUP ); SendScintilla( SCI_ASSIGNCMDKEY, SCK_DOWN + ( SCMOD_ALT << 16 ), SCI_LINESCROLLDOWN ); SendScintilla( SCI_ASSIGNCMDKEY, SCK_UP + ( SCMOD_ALT << 16 ), SCI_LINESCROLLUP ); /* Remove Ctrl+D as duplicate line */ SendScintilla( SCI_CLEARCMDKEY, 68 + ( SCMOD_CTRL << 16 ) ); };
int main( int argc, const char * argv[] ) { DBLayer * test = new DBLayer(); // Node stuff test assert( test->getNodeByHWID( "test" ) == NULL ); SioxNode * testNode = new SioxNode( "test" ); test->updateNode( testNode ); assert( test->getNodeByHWID( "test" ) != NULL ); assert( test->getNodeByHWID( "test" )->node_id > 0 ); assert( test->getNodeByHWID( "test" )->hw_id == testNode->hw_id ); testNode->node_id = testNode->node_id + 1; test->updateNode( testNode ); assert( test->getNodeByHWID( "test" ) != NULL ); assert( test->getNodeByHWID( "test" )->node_id == testNode->node_id ); assert( test->getNodeByHWID( "test" )->hw_id == testNode->hw_id ); // Storage Devices test assert( test->getAllStorageDevicesByNode( testNode->node_id ) == NULL ); storage_device * testDevice = new storage_device(); testDevice->node_id = testNode->node_id; testDevice->model_name = "model_test"; testDevice->local_address = "address_test"; test->updateStorageDevice( testDevice ); assert( testDevice->device_id > 0 ); assert( test->getAllStorageDevicesByNode( testNode->node_id ) != NULL ); assert( test->getAllStorageDevicesByNode( testNode->node_id )->size() == 1 ); assert( test->getAllStorageDevicesByNode( testNode->node_id )->begin()->model_name == "model_test" ); assert( test->getAllStorageDevicesByNode( testNode->node_id )->begin()->local_address == "address_test" ); assert( test->getAllStorageDevicesByNode( testNode->node_id )->begin()->node_id == testNode->node_id ); assert( test->getStorageDeviceByNodeAndDevice( testNode->node_id, testDevice->device_id )->equals( testDevice ) ); testDevice->model_name = "model_test_new"; testDevice->local_address = "address_test_new"; test->updateStorageDevice( testDevice ); assert( testDevice->device_id > 0 ); assert( test->getAllStorageDevicesByNode( testNode->node_id ) != NULL ); assert( test->getAllStorageDevicesByNode( testNode->node_id )->size() == 1 ); assert( test->getAllStorageDevicesByNode( testNode->node_id )->begin()->model_name == "model_test_new" ); assert( test->getAllStorageDevicesByNode( testNode->node_id )->begin()->local_address == "address_test_new" ); assert( test->getAllStorageDevicesByNode( testNode->node_id )->begin()->node_id == testNode->node_id ); // filesystems test assert( test->getFilesystemByUID( "test" ) == NULL ); filesystem * fs = new filesystem( "test" ); test->updateFilesystem( fs ); assert( test->getFilesystemByUID( "test" ) != NULL ); assert( test->getFilesystemByUID( "test" )->filesystem_id > 0 ); assert( test->getFilesystemByUID( "test" )->unique_id == "test" ); fs->filesystem_id = fs->filesystem_id + 1; test->updateFilesystem( fs ); assert( test->getFilesystemByUID( "test" ) != NULL ); assert( test->getFilesystemByUID( "test" )->filesystem_id == fs->filesystem_id ); assert( test->getFilesystemByUID( "test" )->unique_id == "test" ); // Delete all StorageDevice stuff connection * conn = new connection( "hostaddr=136.172.14.14 port=48142 user=postgres password=postgres dbname=systeminfo_test" ); work deleteAction2( *conn, "Delete Transaction 2" ); deleteAction2.exec( "DELETE FROM storage_devices WHERE node_id =" + to_string( testNode->node_id ) ); deleteAction2.commit(); // Delete all filesystem stuff work deleteAction3( *conn, "Delete Transaction 3" ); deleteAction3.exec( "DELETE FROM filesystems WHERE uid='test'" ); deleteAction3.commit(); // Delete all node stuff work deleteAction( *conn, "Delete Transaction" ); deleteAction.exec( "DELETE FROM nodes WHERE node_id =" + to_string( testNode->node_id ) ); deleteAction.commit(); printf( "All tests passed.\n" ); }
int main (void) { /* program to coordinate the menu options and calls the requested function */ struct node * first = NULL; /* pointer to the first list item */ char option[strMax]; /* user response to menu selection */ printf ("Program to Maintain a List of Robot Actions\n"); while (1) { /* print menu options */ printf ("Options available\n"); printf ("I - Insert an action into the list\n"); printf ("D - Delete an action from the list\n"); printf ("C - Count the number of items in the list\n"); printf ("F - Move an item to the front of the list\n"); printf ("L - Print the last item in the list\n"); printf ("P - Print the actions in the list and the UIDs of the nodes\n"); printf ("R - Print the actions and UIDs in reverse order\n"); printf ("E - Execute all the action commands contained in the list\n"); printf ("Q - Quit\n"); /* determine user selection */ printf ("Enter desired option: "); scanf ("%s", option); switch (option[0]) { case 'I': case 'i': addAction(&first); break; case 'D': case 'd': deleteAction(&first); break; case 'C': case 'c': countList(first); break; case 'F': case 'f': putFirst(&first); break; case 'L': case 'l': printLast(first); break; case 'P': case 'p': print(first); break; case 'R': case 'r': printReverse(first); break; case 'E': case 'e': executeActions(first); break; case 'Q': case 'q': printf ("Program terminated\n"); return 0; break; default: printf ("Invalid Option - Try Again!\n"); continue; } } }