void EventCanvas::actionCommand(int action)/*{{{*/ { switch(action) { case LOCATORS_TO_SELECTION: { int tick_max = 0; int tick_min = INT_MAX; bool found = false; for (iCItem i = _items.begin(); i != _items.end(); i++) { if (!i->second->isSelected()) continue; int tick = i->second->x(); int len = i->second->event().lenTick(); found = true; if (tick + len > tick_max) tick_max = tick + len; if (tick < tick_min) tick_min = tick; } if (found) { Pos p1(tick_min, true); Pos p2(tick_max, true); song->setPos(1, p1); song->setPos(2, p2); } } break; case SEL_RIGHT ... SEL_RIGHT_ADD: { if (action == SEL_RIGHT && allItemsAreSelected()) { deselectAll(); selectAtTick(song->cpos()); return; } iCItem i, iRightmost; CItem* rightmost = NULL; // get a list of items that belong to the current part // since multiple parts have populated the _items list // we need to filter on the actual current Part! CItemList list = _items; if(multiPartSelectionAction && !multiPartSelectionAction->isChecked()) list = getItemlistForCurrentPart(); //Get the rightmost selected note (if any) i = list.begin(); while (i != list.end()) { if (i->second->isSelected()) { iRightmost = i; rightmost = i->second; } ++i; } if (rightmost) { iCItem temp = iRightmost; temp++; //If so, deselect current note and select the one to the right if (temp != list.end()) { if (action != SEL_RIGHT_ADD) deselectAll(); iRightmost++; iRightmost->second->setSelected(true); itemPressed(iRightmost->second); m_tempPlayItems.append(iRightmost->second); QTimer::singleShot(NOTE_PLAY_TIME, this, SLOT(playReleaseForItem())); if(editor->isGlobalEdit()) populateMultiSelect(iRightmost->second); updateSelection(); } } else // there was no item selected at all? Then select nearest to tick if there is any { selectAtTick(song->cpos()); updateSelection(); } } break; case SEL_LEFT ... SEL_LEFT_ADD: { if (action == SEL_LEFT && allItemsAreSelected()) { deselectAll(); selectAtTick(song->cpos()); return; } iCItem i, iLeftmost; CItem* leftmost = NULL; // get a list of items that belong to the current part // since multiple parts have populated the _items list // we need to filter on the actual current Part! CItemList list = _items; if(multiPartSelectionAction && !multiPartSelectionAction->isChecked()) list = getItemlistForCurrentPart(); if (list.size() > 0) { i = list.end(); while (i != list.begin()) { --i; if (i->second->isSelected()) { iLeftmost = i; leftmost = i->second; } } if (leftmost) { if (iLeftmost != list.begin()) { //Add item if (action != SEL_LEFT_ADD) deselectAll(); iLeftmost--; iLeftmost->second->setSelected(true); itemPressed(iLeftmost->second); m_tempPlayItems.append(iLeftmost->second); QTimer::singleShot(NOTE_PLAY_TIME, this, SLOT(playReleaseForItem())); if(editor->isGlobalEdit()) populateMultiSelect(iLeftmost->second); updateSelection(); } else { leftmost->setSelected(true); itemPressed(leftmost); m_tempPlayItems.append(leftmost); QTimer::singleShot(NOTE_PLAY_TIME, this, SLOT(playReleaseForItem())); if(editor->isGlobalEdit()) populateMultiSelect(leftmost); updateSelection(); } } else // there was no item selected at all? Then select nearest to tick if there is any { selectAtTick(song->cpos()); updateSelection(); } } } break; case INC_PITCH_OCTAVE: { modifySelected(NoteInfo::VAL_PITCH, 12); } break; case DEC_PITCH_OCTAVE: { modifySelected(NoteInfo::VAL_PITCH, -12); } break; case INC_PITCH: { modifySelected(NoteInfo::VAL_PITCH, 1); } break; case DEC_PITCH: { modifySelected(NoteInfo::VAL_PITCH, -1); } break; case INC_POS: { // TODO: Check boundaries modifySelected(NoteInfo::VAL_TIME, editor->raster()); } break; case DEC_POS: { // TODO: Check boundaries modifySelected(NoteInfo::VAL_TIME, 0 - editor->raster()); } break; case INCREASE_LEN: { // TODO: Check boundaries modifySelected(NoteInfo::VAL_LEN, editor->raster()); } break; case DECREASE_LEN: { // TODO: Check boundaries modifySelected(NoteInfo::VAL_LEN, 0 - editor->raster()); } break; case GOTO_SEL_NOTE: { CItem* leftmost = getLeftMostSelected(); if (leftmost) { unsigned newtick = leftmost->event().tick() + leftmost->part()->tick(); Pos p1(newtick, true); song->setPos(0, p1, true, true, false); } } break; case MIDI_PANIC: { song->panic(); } break; } }/*}}}*/
void searchwidget::search(){ QVector<account*> resultVector; if(dynamic_cast<companyaccount*>(Searcher) && Searcher->type()==1){ QString userTemp= usernLineEdit->text(); account* temp=dynamic_cast<companyaccount*>(Searcher)->businessSearch(userTemp); if(temp) resultVector.push_back(temp); } else{ if(userSearchRadio->isChecked()){ if(usernsearchBox->isChecked()){ QString userTemp= usernLineEdit->text(); account* temp=Boss->basicSearch(userTemp); if(temp) resultVector.push_back(temp); } if(userInfoBox->isChecked()){ QVector<account*> resTemp=Boss->userInfoSearch(nameUserLineEdit->text(), surnameLineEdit->text(), birthDateEdit->date(), placeLineEdit->text(), telnumLineEdit->text(), emailLineEdit->text()); if(!resTemp.isEmpty()) resultVector+=resTemp; } if(experienceBox->isChecked()){ QString nameTemp= nameLineEdit->text(), descrTemp= descrLineEdit->text(); if(workingSeachCheck->isChecked()){ QVector<account*> resTemp= Boss->experienceSearch(0, nameTemp, descrTemp); if(!resTemp.isEmpty()) resultVector+=resTemp; } if(formativeSearchCheck->isChecked()){ QVector<account*> resTemp= Boss->experienceSearch(1, nameTemp, descrTemp); if(!resTemp.isEmpty()) resultVector+=resTemp; } } } else if(companySearchRadio->isChecked()){ if(usernsearchBox->isChecked()){ QString userTemp= usernLineEdit->text(); account* temp=Boss->basicSearch(userTemp); if(temp) resultVector.push_back(temp); } if(companyInfoBox->isChecked()){ QVector<account*> resTemp= Boss->companyInfoSearch(nameCompanyLineEdit->text(), addressLineEdit->text(), cotypeLineEdit->text()); if(!resTemp.isEmpty()) resultVector+=resTemp; } } } usersListView= new QListView(this); usersModel= new QStandardItemModel(this); QStandardItem* usersRootItem= usersModel->invisibleRootItem(); if(!resultVector.isEmpty()){ QVector<account*>::iterator it=resultVector.begin(); for(;it<resultVector.end();++it){ account* temp= (*it); QStandardItem* userTemp= new QStandardItem(temp->user()->user()); usersRootItem->appendRow(userTemp); } } usersListView->setModel(usersModel); connect(usersListView, SIGNAL(clicked(QModelIndex)), this, SLOT(modifySelected(QModelIndex))); layout->addWidget(usersListView, 5, 0); showButton= new QPushButton(tr("Show profile selected"), this); connect(showButton, SIGNAL(clicked()), this, SLOT(showSelected())); layout->addWidget(showButton, 6, 0); resize(parentWidget()->size()); }