/////////////////////////////////////////////////////////////////////// // HANDLE NOTE ON MESSAGE void CLogicalChannel::handleNoteOn(byte note, byte velocity) { // Ensure the note is in our valid range if(note < m_fromNote || note > m_toNote) return; // ensure the note is not already in the list (if // it is, it will be moved to top of list) deleteNote(note); // check if the list is out of space if(m_noteCount >= MAX_NOTES) { for(int i=1; i<m_noteCount; ++i) { m_notes[i-1] = m_notes[i]; } } else { ++m_noteCount; } // place the new note at the top of the stack m_notes[m_noteCount-1].note = note; m_notes[m_noteCount-1].velocity = velocity; int voiceCount = m_voiceEnd - m_voiceBegin; if(!isSingleNoteChan(m_conf) && (m_noteCount > voiceCount)) { // more notes than voices, so mute the oldest note int nextMute = m_noteCount-voiceCount-1; untrig(m_notes[nextMute].note); } // trigger the newest note, triggering the amp envelope trig(note, (m_conf->flags & TONE_CONFIG::USE_VELOCITY)? velocity:127, true); }
void SyncManager::deleteAllNotes() { QList<Note*> notes = dbManager->getModel()->getNotes(); for(int i = 0; i < notes.length(); i++) { emit deleteNote(notes.at(i)->getRemoteId()); } }
void ControllerFallingMode::removeOldNotes() { for (int i = 0; i < trackCount; i++) { if (notesInTrack[i].size() == 0) continue; vector<NoteObj>::iterator iter = notesInTrack[i].begin(); if (iter->info.noteType == NoteManager::Note::NoteType::SINGLE && (iter->hitting || curTime - iter->info.startTime>HITRANGE::MISS + 200)) { deleteNote(i, iter); } else if (iter->info.noteType == NoteManager::Note::NoteType::LONG && curTime - iter->info.endTime > HITRANGE::MISS + 200) { deleteNote(i, iter); } } }
NoteViewer::NoteViewer(NoteData& data, QWidget *parent) : QWidget(parent), noteData(data) { this->noteData = noteData; setFixedSize(410, 100); editButton = new QPushButton(tr("Edit")); deleteButton = new QPushButton(tr("Delete")); noteText = new QTextEdit; noteText->setText(this->noteData.getText()); noteText->setReadOnly(true); noteText->setStyleSheet("border: 1px solid grey"); time = new QLabel; time->setText(QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss")); QFont font = time->font(); font.setPointSize(12); time->setFont(font); noteLayout = new QGridLayout; noteLayout->addWidget(noteText, 0, 0, 1, 3); noteLayout->addWidget(editButton, 1, 1); noteLayout->addWidget(deleteButton, 1, 2); noteLayout->addWidget(time, 1, 0); setLayout(noteLayout); connect(editButton, SIGNAL(clicked()), this, SLOT(editNote())); connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteNote())); }
void UAreaResultsTable::converterDeleteNote(int row) { QTableWidgetItem *item = tableRecycleBin->item(row, indexMainColumn); if(item) { QString nameFile = item->data(pointerOnDataItemNote).value<QString>(); emit deleteNote(nameFile); emit refreshTables(); } }
/** * \brief Supprime les notes contenues dans la corbeille */ void Workspace::emptyTrash(){ QDomElement dom_el = dom->documentElement(); QDomNodeList node_list = dom_el.elementsByTagName("trash_notes"); QDomElement node = node_list.at(0).toElement(); QDomNodeList sub_node_list = node.elementsByTagName("note"); QDomElement sub_node; for (int i = 0; i < sub_node_list.count(); i++){ sub_node = sub_node_list.at(i).toElement(); deleteNote(sub_node.text()); } trash_notes.clear(); }
CMindMapDtNoteTool::CMindMapDtNoteTool(QWidget *parent) : CDiagramTool(parent), m_noteEditor(NULL), m_noteSpriteMenu(NULL) { ui = new Ui::CMindMapDtNoteTool(); ui->setupUi(this); m_noteEditor = new CMindMapUiNoteEditor(NULL); m_noteEditor->hide(); m_noteSpriteMenu = new CMindMapNoteSpriteMenu(NULL); // register the menu to the manager CMindMapMenuManager::instance()->setNodeSpriteMenu(CMindMapNode::Note, m_noteSpriteMenu); connect(ui->m_btnAddNote, SIGNAL(clicked()), this, SLOT(onShowNoteEditor())); connect(ui->m_btnDropNote, SIGNAL(clicked()), this, SLOT(onDeleteNote())); connect(m_noteEditor, SIGNAL(deleteNote()), this, SLOT(onDeleteNote())); connect(m_noteEditor, SIGNAL(resetNote(QString)), this, SLOT(onResetNote(QString))); connect(m_noteSpriteMenu, SIGNAL(deleteNote()), this, SLOT(onDeleteNote())); connect(m_noteSpriteMenu, SIGNAL(showNoteEditor()), this, SLOT(onShowNoteEditor())); }
/////////////////////////////////////////////////////////////////////// // HANDLE NOTE OFF MESSAGE void CLogicalChannel::handleNoteOff(byte note) { untrig(note); if(deleteNote(note)) { int voiceCount = isSingleNoteChan(m_conf)? 1:(m_voiceEnd - m_voiceBegin); if(m_noteCount >= voiceCount) { // all voices were in use.. we might be able to // reactivate a note that was previously overridden trig(m_notes[m_noteCount-voiceCount].note, (m_conf->flags & TONE_CONFIG::USE_VELOCITY)? m_notes[m_noteCount-voiceCount].velocity : 127, true); } } }
void CMindMapNoteSpriteMenu::reset(CMindMapNodeSprite *sprite) { QAction *act = NULL; CMindMapNoteSprite *noteSprite = NULL; noteSprite = dynamic_cast<CMindMapNoteSprite*>( sprite ); if (!noteSprite) return; clear(); act = addAction(tr("Edit Note")); connect(act, SIGNAL(triggered()), this, SIGNAL(showNoteEditor())); act = addAction(QIcon(":/mindstorm/icons/ui-delete.png"), tr("Delete Note")); connect(act, SIGNAL(triggered()), this, SIGNAL(deleteNote())); CMindMapNodeSpriteMenu::reset(sprite); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { EdamProtocol *edam = EdamProtocol::GetInstance(); ui->setupUi(this); pdfCache * pdf = new pdfCache(this); CustomNetworkAccessManager *nm = new CustomNetworkAccessManager(ui->editor->page()->networkAccessManager(), this, pdf); edam->setCNAM(nm); ui->editor->page()->setNetworkAccessManager(nm); Speller::setSettings(new DBSpellSettings(this, ui->editor)); ui->editor->setContextMenuPolicy(Qt::CustomContextMenu); ui->editor->load(QUrl("qrc:///html/noteajax.html")); jsB = new jsBridge(this, pdf); jsB->setWebView(ui->editor); enmlWritter = new enml2(this); connect(ui->editor->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJSObject())); loaded = false; editingEnabled = false; tagsActions = new QActionGroup(this); newTag = new TagLabel(this); newTag->hide(); ui->tagsBar->addWidget(newTag); appIcon = QIcon(":img/hippo64.png"); trayIcon = NULL; bool sysTrayEnabled = sql::readSyncStatus("systemTray", true).toBool(); if (QSystemTrayIcon::isSystemTrayAvailable() && sysTrayEnabled) enableSystemTrayIcon(true); connect(edam, SIGNAL(AuthenticateFailed()), this, SLOT(authentificationFailed())); connect(edam, SIGNAL(syncFinished()), this, SLOT(syncFinished())); connect(edam, SIGNAL(syncStarted(int)), this, SLOT(syncStarted(int))); connect(edam, SIGNAL(noteGuidChanged(QString,QString)), this, SLOT(changeNoteGuid(QString,QString))); connect(ui->notebooks, SIGNAL(itemSelectionChanged()), this, SLOT(switchNotebook())); connect(ui->tags, SIGNAL(itemSelectionChanged()), this, SLOT(switchTag())); connect(ui->tags, SIGNAL(tagAdded(QString,QString)), this, SLOT(addTag(QString,QString))); connect(ui->tags, SIGNAL(tagsUpdated()), this, SLOT(updateTagsToolBar())); connect(ui->tags, SIGNAL(tagsUpdated()), this, SLOT(switchTag())); connect(ui->NotesList, SIGNAL(noteSwitched()), this, SLOT(switchNote())); connect(ui->action_Abaut, SIGNAL(triggered()), this, SLOT(loadAboutInfo())); connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(closeWindow())); connect(ui->actionNew_Note, SIGNAL(triggered()), this, SLOT(newNote())); connect(ui->actionSync, SIGNAL(triggered()), this, SLOT(sync())); connect(ui->noteTitle, SIGNAL(textEdited(QString)), this, SLOT(noteTitleChange(QString))); connect(ui->actionAccount_info, SIGNAL(triggered()), this, SLOT(showUserInfo())); connect(ui->editor->page(), SIGNAL(linkClicked(QUrl)), this, SLOT(openURL(QUrl))); connect(ui->editor->page(), SIGNAL(microFocusChanged()), this, SLOT(updateEditButtonsState())); connect(ui->editor, SIGNAL(selectionChanged()), this, SLOT(updateSelectionButtonsState())); connect(ui->editor->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); connect(ui->editor, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(editorContextMenuRequested(QPoint))); connect(ui->editor, SIGNAL(fileInserted(QString)), this, SLOT(insertFile(QString))); connect(ui->notebooks, SIGNAL(noteMoved(QString,QString)), this, SLOT(moveNote(QString,QString))); connect(ui->notebooks, SIGNAL(noteDeleted(QString)), this, SLOT(deleteNote(QString))); connect(ui->notebooks, SIGNAL(noteRestored(QString,QString)), this, SLOT(restoreNote(QString,QString))); connect(ui->NotesList, SIGNAL(noteDeleted(QString)), this, SLOT(deleteNote(QString))); connect(ui->NotesList, SIGNAL(noteRestored(QString)), this, SLOT(restoreNote(QString))); connect(ui->NotesList, SIGNAL(noteCreated()), this, SLOT(newNote())); connect(ui->NotesList, SIGNAL(reloaded()), this, SLOT(updateCurrentNoteName())); connect(ui->editButton, SIGNAL(toggled(bool)), this, SLOT(setEditable(bool))); connect(ui->actionDelete_Note, SIGNAL(triggered()), this, SLOT(deleteNote())); connect(ui->toolBox, SIGNAL(currentChanged(int)), this, SLOT(changeTab(int))); connect(ui->editor->page(), SIGNAL(linkHovered(QString,QString,QString)), this, SLOT(linkHovered(QString,QString,QString))); connect(jsB, SIGNAL(hintMessage(QString,int)), ui->statusbar, SLOT(showMessage(QString,int))); connect(jsB, SIGNAL(noteChanged(QString)), this, SLOT(updateTagsToolBar(QString))); connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->actionDelete_Note, SLOT(setEnabled(bool))); connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->editButton, SLOT(setEnabled(bool))); connect(jsB, SIGNAL(editingStarted(bool)), ui->editButton, SLOT(setChecked(bool))); connect(jsB, SIGNAL(titleUpdated(QString,QString)), this, SLOT(updateNoteTitle(QString,QString))); connect(jsB, SIGNAL(conflictAdded(qint64,QString,bool)), this, SLOT(addConflict(qint64,QString,bool))); connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionNote_Info, SLOT(setEnabled(bool))); connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionExport, SLOT(setEnabled(bool))); connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionPrint, SLOT(setEnabled(bool))); connect(ui->editor, SIGNAL(tagUpdated(QString,bool)), this, SLOT(updateTag(QString,bool))); connect(tagsActions, SIGNAL(triggered(QAction*)), this, SLOT(tagClicked(QAction*))); connect(newTag, SIGNAL(tagCreated(QString)), this, SLOT(createTag(QString))); connect(ui->actionKeep_only_this_Version, SIGNAL(triggered()), this, SLOT(keepThisVersion())); connect(ui->actionNote_Info, SIGNAL(triggered()), this, SLOT(showNoteInfo())); connect(ui->actionExport, SIGNAL(triggered()), this, SLOT(exportNote())); connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print())); connect(this, SIGNAL(titleChanged(QString,QString)), jsB, SIGNAL(titleChanged(QString,QString))); setWindowIcon(appIcon); setWindowTitle("Hippo Notes"); setTabOrder(ui->noteTitle, ui->editor); ui->notebooks->setSortingEnabled(true); ui->notebooks->sortByColumn(0, Qt::AscendingOrder); ui->editBar->setVisible(false); ui->mainToolBar->addAction(ui->actionNew_Note); ui->mainToolBar->addAction(ui->actionSync); QFontComboBox *font = new QFontComboBox(this); font->setDisabled(true); font->setFontFilters(QFontComboBox::ScalableFonts); font->setEditable(false); connect(this, SIGNAL(editButtonsStateChanged(bool)), font, SLOT(setEnabled(bool))); connect(this, SIGNAL(updateFont(QFont)), font, SLOT(setCurrentFont(QFont))); connect(font, SIGNAL(activated(QString)), this, SLOT(changeFont(QString))); ui->editBar->addWidget(font); QComboBox *fontSize = new QComboBox(this); fontSize->setDisabled(true); fontSize->setEditable(false); for (int i = 1; i <= 7; i++) fontSize->addItem(QString::number(i)); connect(this, SIGNAL(editButtonsStateChanged(bool)), fontSize, SLOT(setEnabled(bool))); connect(this, SIGNAL(updateFontSize(int)), fontSize, SLOT(setCurrentIndex(int))); connect(fontSize, SIGNAL(activated(QString)), this, SLOT(changeFontSize(QString))); ui->editBar->addWidget(fontSize); QAction *boldIco = ui->editor->pageAction(QWebPage::ToggleBold); boldIco->setIcon(QIcon::fromTheme("format-text-bold")); ui->editBar->addAction(boldIco); QAction *italicIco = ui->editor->pageAction(QWebPage::ToggleItalic); italicIco->setIcon(QIcon::fromTheme("format-text-italic")); ui->editBar->addAction(italicIco); QAction *underlineIco = ui->editor->pageAction(QWebPage::ToggleUnderline); underlineIco->setIcon(QIcon::fromTheme("format-text-underline")); ui->editBar->addAction(underlineIco); QAction *strikethroughIco = ui->editor->pageAction(QWebPage::ToggleStrikethrough); strikethroughIco->setIcon(QIcon::fromTheme("format-text-strikethrough")); ui->editBar->addAction(strikethroughIco); ui->editBar->addSeparator(); QAction *undoIco = ui->editor->pageAction(QWebPage::Undo); undoIco->setIcon(QIcon::fromTheme("edit-undo")); undoIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z)); ui->editBar->addAction(undoIco); ui->menu_Edit->addAction(undoIco); QAction *redoIco = ui->editor->pageAction(QWebPage::Redo); redoIco->setIcon(QIcon::fromTheme("edit-redo")); redoIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z)); ui->editBar->addAction(redoIco); ui->menu_Edit->addAction(redoIco); ui->editBar->addSeparator(); QAction *rformatIco = ui->editor->pageAction(QWebPage::RemoveFormat); rformatIco->setIcon(QIcon::fromTheme("edit-clear")); ui->editBar->addAction(rformatIco); ui->editBar->addSeparator(); QAction *leftIco = ui->editor->pageAction(QWebPage::AlignLeft); leftIco->setIcon(QIcon::fromTheme("format-justify-left")); ui->editBar->addAction(leftIco); QAction *centerIco = ui->editor->pageAction(QWebPage::AlignCenter); centerIco->setIcon(QIcon::fromTheme("format-justify-center")); ui->editBar->addAction(centerIco); QAction *rightIco = ui->editor->pageAction(QWebPage::AlignRight); rightIco->setIcon(QIcon::fromTheme("format-justify-right")); ui->editBar->addAction(rightIco); QAction *fillIco = ui->editor->pageAction(QWebPage::AlignJustified); fillIco->setIcon(QIcon::fromTheme("format-justify-fill")); ui->editBar->addAction(fillIco); ui->editBar->addSeparator(); QAction *indentIco = ui->editor->pageAction(QWebPage::Indent); indentIco->setIcon(QIcon::fromTheme("format-indent-more")); ui->editBar->addAction(indentIco); QAction *outdentIco = ui->editor->pageAction(QWebPage::Outdent); outdentIco->setIcon(QIcon::fromTheme("format-indent-less")); ui->editBar->addAction(outdentIco); QAction *superscriptIco = ui->editor->pageAction(QWebPage::ToggleSuperscript); superscriptIco->setIcon(QIcon::fromTheme("format-text-superscript")); ui->editBar->addAction(superscriptIco); QAction *subscriptIco = ui->editor->pageAction(QWebPage::ToggleSubscript); subscriptIco->setIcon(QIcon::fromTheme("format-text-subscript")); ui->editBar->addAction(subscriptIco); QAction *unorderedIco = ui->editor->pageAction(QWebPage::InsertUnorderedList); unorderedIco->setIcon(QIcon::fromTheme("format-list-unordered")); ui->editBar->addAction(unorderedIco); QAction *orderedIco = ui->editor->pageAction(QWebPage::InsertOrderedList); orderedIco->setIcon(QIcon::fromTheme("format-list-ordered")); ui->editBar->addAction(orderedIco); QAction *lineIco = new QAction("Insert horizontal line", this); lineIco->setIcon(QIcon::fromTheme("insert-horizontal-rule")); lineIco->setDisabled(true); connect(this, SIGNAL(editButtonsStateChanged(bool)), lineIco, SLOT(setEnabled(bool))); connect(lineIco, SIGNAL(triggered()), this, SLOT(insertHorizontalLine())); ui->editBar->addAction(lineIco); ui->menu_Edit->addSeparator(); QAction *cutIco = ui->editor->pageAction(QWebPage::Cut); cutIco->setIcon(QIcon::fromTheme("edit-cut")); cutIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X)); ui->menu_Edit->addAction(cutIco); QAction *copyIco = ui->editor->pageAction(QWebPage::Copy); copyIco->setIcon(QIcon::fromTheme("edit-copy")); copyIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); ui->menu_Edit->addAction(copyIco); QAction *pasteIco = ui->editor->pageAction(QWebPage::Paste); pasteIco->setIcon(QIcon::fromTheme("edit-paste")); pasteIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V)); ui->menu_Edit->addAction(pasteIco); QAction *pasteSpecialIco = ui->editor->pageAction(QWebPage::PasteAndMatchStyle); pasteSpecialIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V)); ui->menu_Edit->addAction(pasteSpecialIco); ui->menu_Edit->addSeparator(); QAction *insertUrlIco = new QAction("Create link", this); insertUrlIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); insertUrlIco->setDisabled(true); insertUrlIco->setIcon(QIcon::fromTheme("insert-link")); connect(this, SIGNAL(selectionButtonsStateChanged(bool)), insertUrlIco, SLOT(setDisabled(bool))); connect(insertUrlIco, SIGNAL(triggered()), this, SLOT(insertUrl())); ui->menu_Edit->addAction(insertUrlIco); QAction *todoIco = new QAction("Insert To-do Checkbox", this); todoIco->setIcon(QIcon::fromTheme("checkbox")); todoIco->setDisabled(true); connect(this, SIGNAL(editButtonsStateChanged(bool)), todoIco, SLOT(setEnabled(bool))); connect(todoIco, SIGNAL(triggered()), jsB, SIGNAL(insertToDo())); ui->menu_Edit->addAction(todoIco); QAction *insertImage = new QAction("Insert Image", this); insertImage->setIcon(QIcon::fromTheme("insert-image")); insertImage->setDisabled(true); connect(this, SIGNAL(editButtonsStateChanged(bool)), insertImage, SLOT(setEnabled(bool))); connect(insertImage, SIGNAL(triggered()), this, SLOT(insertImg())); ui->menu_Edit->addAction(insertImage); QAction *insertFile = new QAction("Insert File", this); insertFile->setDisabled(true); connect(this, SIGNAL(editButtonsStateChanged(bool)), insertFile, SLOT(setEnabled(bool))); connect(insertFile, SIGNAL(triggered()), this, SLOT(insertFile())); ui->menu_Edit->addAction(insertFile); QAction *encryptIco = new QAction("Encrypt Selected Text...", this); encryptIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_X)); encryptIco->setDisabled(true); encryptIco->setIcon(QIcon::fromTheme("document-edit-encrypt")); connect(this, SIGNAL(selectionButtonsStateChanged(bool)), encryptIco, SLOT(setDisabled(bool))); connect(encryptIco, SIGNAL(triggered()), jsB, SIGNAL(encryptText())); ui->menu_Edit->addAction(encryptIco); ui->menu_Edit->addSeparator(); QAction *options = new QAction("&Options...", this); options->setIcon(QIcon::fromTheme("preferences-other")); connect(options, SIGNAL(triggered()), this, SLOT(showOptions())); ui->menu_Edit->addAction(options); clearConflictBar(); connect(jsB, SIGNAL(showConflict()), ui->conflictBar, SLOT(show())); connect(jsB, SIGNAL(showConflict()), ui->conflictBarBottom, SLOT(show())); conflictsGroup = new QActionGroup(this); connect(conflictsGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeNoteVersion(QAction*))); searchIndex = new SearchIndex(this); connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(search())); connect(edam, SIGNAL(syncFinished()), searchIndex, SLOT(buildSearchIndex())); connect(jsB, SIGNAL(noteUpdated(QString)), searchIndex, SLOT(updateNoteIndex(QString))); connect(edam, SIGNAL(noteUpdated(QString)), searchIndex, SLOT(dropNoteIndex(QString))); connect(ui->searchInput, SIGNAL(returnPressed()), this, SLOT(search())); QByteArray mainWindowGeometry = sql::readSyncStatus("mainWindowGeometry").toString().toLatin1(); if (!mainWindowGeometry.isEmpty()) restoreGeometry(QByteArray::fromBase64(mainWindowGeometry)); QByteArray mainWidgetsSplitterState = sql::readSyncStatus("mainWidgetsSplitterState").toString().toLatin1(); if (!mainWidgetsSplitterState.isEmpty()) ui->mainWidgetsSplitter->restoreState(QByteArray::fromBase64(mainWidgetsSplitterState)); //showWindow(); edam->init(); }
void pluginCore::processMidi(int status, int channel, int byte1, int byte2, long frames) { #if 0 m_logger->log(XML_LOGGER_TYPE_MIDI, channel, byte1, byte2, (int)frames); #endif // Most modern hosts will attempt to schedule MIDI events with a frame offset, so in this case, // we add the event to the wait queue and skip processing (for now). This feature requires the // PluginCore event handling module, which may be included by defining USE_PC_EVENTS #if USE_PC_EVENTS if(frames > 0) { tCoreEvent *ce = (tCoreEvent*)malloc(sizeof(tCoreEvent)); ce->action = EVT_ACTION_MIDI; ce->data.midi_data.status = status; ce->data.midi_data.channel = channel; ce->data.midi_data.byte1 = byte1; ce->data.midi_data.byte2 = byte2; m_events.addEvent(this, frames, ce, false); return; } #endif int index = -1; switch(status) { case 0x80: // Note off index = findMidiNoteIndex((int)byte1); if(index >= 0) { noteOff(m_midi_notes.at(index).number); deleteNote(index); } break; case 0x90: // Note on { index = findMidiNoteIndex((int)byte1); if((int)byte2) { if(index < 0) { tMidiNote note; note.channel = (int)channel; note.number = (int)byte1; note.velocity = (int)byte2; note.frequency = m_freq_table[note.number]; note.reserved = 0; m_midi_notes.push_back(note); ++m_midi_note_count; noteOn(note.number, note.velocity); break; } else { // Note has already been added, so just change the velocity m_midi_notes.at(index).velocity = (int)byte2; } } // Velocity of zero means to actually turn off the note else { if(index >= 0) { noteOff(m_midi_notes.at(index).number); deleteNote(index); } } break; } case 0xa0: // Aftertouch index = findMidiNoteIndex((int)byte1); if(index >= 0) { m_midi_notes.at(index).velocity = (int)byte2; } break; case 0xb0: // Control change { if((int)byte2 == 120 || (int)byte2 == 123) { // Emergency catch for all notes off m_midi_note_count = 0; m_midi_notes.clear(); break; } tMidiMessage cc; cc.channel = channel; cc.byte1 = byte1; cc.byte2 = byte2; cc.reserved = 0; m_midi_ccs.push(cc); controlChange(cc.byte1, cc.byte2); } break; case 0xc0: // Program change #if USE_PC_PRESET // For the moment, the channel number is ignored. Sometimes this is used to specify // the program bank, and then the first byte for the corresponding program number. // Instead, we will treat all channels the same and simply load the preset corresponding // to the respective byte1 value. No bounds checking is done here because the value // gets checked in loadPreset(). if(byte1) { loadPreset((int)byte1); } #endif break; case 0xd0: // Pressure change // Multiply the velocity of all existing notes by a factor for(int i = 0; i < m_midi_note_count; ++i) { m_midi_notes.at(i).velocity = (int)((float)(m_midi_notes.at(i).velocity * byte1) / 127.0); } break; case 0xe0: // Pitch wheel (currently not handled) break; default: break; } }
bool QvernoteStorage::moveNote(Guid noteGuid, Guid toNotebookGuid) { copyNote(noteGuid, toNotebookGuid); return deleteNote(noteGuid); }
void NoteList::reset() { while (anyNotesPressed()) deleteNote(lastNote()); }
Agenda::Agenda(QWidget *parent, QDate date) : QDialog(parent) { QString dateChoisie = date.toString(); groupName = dateChoisie; groupName.replace(" ", "_"); QString jour = QString::number(date.dayOfWeek()); if (jour == "1") { jour = "Lundi"; } else if (jour == "2") { jour = "Mardi"; } else if (jour == "3") { jour = "Mercredi"; } else if (jour == "4") { jour = "Jeudi"; } else if (jour == "5") { jour = "Vendredi"; } else if (jour == "6") { jour = "Samedi"; } else if (jour == "7") { jour = "Dimanche"; } QString mois = QString::number(date.month()); if (mois == "1") { mois = "janvier"; } else if (mois == "2") { mois = "février"; } else if (mois == "3") { mois = "mars"; } else if (mois == "4") { mois = "avril"; } else if (mois == "5") { mois = "mai"; } else if (mois == "6") { mois = "juin"; } else if (mois == "7") { mois = "juillet"; } else if (mois == "8") { mois = "août"; } else if (mois == "9") { mois = "septembre"; } else if (mois == "10") { mois = "octobre"; } else if (mois == "11") { mois = "novembre"; } else if (mois == "12") { mois = "décembre"; } QString jourDuMois = QString::number(date.day()); QString annee = QString::number(date.year()); QString dateComplete = jour + ", " + jourDuMois + " " + mois + " " + annee; setWindowTitle("Multiuso - Agenda : " + dateComplete); setWindowIcon(QIcon(":/icones/widgets/agenda.png")); resize(Multiuso::screenWidth() / 2, Multiuso::screenHeight() / 2); QSettings settings(Multiuso::appDirPath() + "/ini/agenda.ini", QSettings::IniFormat); settings.setValue(groupName + "/date", date); QString texte = settings.value(groupName + "/content").toString(); champDeSaisie = new QTextEdit; champDeSaisie->setPlainText(texte); connect(champDeSaisie, SIGNAL(textChanged()), this, SLOT(slotChangementDeTexte())); QPushButton *deleteButton = new QPushButton("Supprimer"); connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteNote())); QHBoxLayout *layoutButtons = new QHBoxLayout; layoutButtons->addWidget(deleteButton); layoutButtons->addWidget(Multiuso::closeButton(this)); layoutButtons->setAlignment(Qt::AlignRight); QVBoxLayout *layoutAgenda = new QVBoxLayout(this); layoutAgenda->addWidget(champDeSaisie); layoutAgenda->addLayout(layoutButtons); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { // open database connection db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName("/Users/jdoud/dev/brainstorm.sqlite"); if(!db.open()) { qDebug() << db.lastError(); qFatal("Failed to connect."); } // setup UI ui->setupUi(this); ui->toolBar->addWidget(ui->comboFonts); ui->toolBar->addWidget(ui->comboFontSizes); ui->toolBar->addWidget(ui->comboColors); // set text editor defaults ui->textNote->document()->setIndentWidth(20); ui->textNote->setTabStopWidth(20); ui->textNote->setTabChangesFocus(false); ui->actionIncrease_Indent->setShortcut(Qt::Key_Tab); ui->actionDecrease_Indent->setShortcut(Qt::Key_Backtab); // setup comboColors QPixmap pix(16, 16); pix.fill(Qt::white); ui->comboColors->addItem(pix, ""); pix.fill(Qt::black); ui->comboColors->addItem(pix, ""); pix.fill(Qt::red); ui->comboColors->addItem(pix, ""); pix.fill(Qt::blue); ui->comboColors->addItem(pix, ""); pix.fill(Qt::darkGreen); ui->comboColors->addItem(pix, ""); pix.fill(Qt::gray); ui->comboColors->addItem(pix, ""); // create system tray icon createActions(); createTrayIcon(); // create models categoriesModel = new QSqlTableModel(); categoriesModel->setTable("categories"); categoriesModel->setSort(1, Qt::AscendingOrder); categoriesModel->select(); ui->listCategories->setModel(categoriesModel); ui->listCategories->setModelColumn(1); notesModel = new QSqlTableModel(); notesModel->setTable("notes"); ui->listNotes->setModel(notesModel); ui->listNotes->setModelColumn(2); // set splitter size QList<int> sizes; sizes << 230 << 150; ui->splitterLists->setSizes(sizes); sizes.clear(); sizes << 230 << 600; ui->splitterNote->setSizes(sizes); // connect File menu slots connect(ui->actionNew_Category, SIGNAL(triggered()), this, SLOT(newCategory())); connect(ui->actionRename_Category, SIGNAL(triggered()), this, SLOT(renameCategory())); connect(ui->actionDelete_Category, SIGNAL(triggered()), this, SLOT(deleteCategory())); connect(ui->actionNew_Note, SIGNAL(triggered()), this, SLOT(newNote())); connect(ui->actionRename_Note, SIGNAL(triggered()), this, SLOT(renameNote())); connect(ui->actionSave_Note, SIGNAL(triggered()), this, SLOT(saveNote())); connect(ui->actionDelete_Note, SIGNAL(triggered()), this, SLOT(deleteNote())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(quit())); // connect Edit menu slots connect(ui->actionFind_Replace, SIGNAL(triggered()), this, SLOT(findAndReplace())); // connect Format menu slots connect(ui->actionBold, SIGNAL(triggered()), this, SLOT(bold())); connect(ui->actionItalic, SIGNAL(triggered()), this, SLOT(italic())); connect(ui->actionUnderline, SIGNAL(triggered()), this, SLOT(underline())); connect(ui->actionStrikethrough, SIGNAL(triggered()), this, SLOT(strikethrough())); connect(ui->actionBullet_List, SIGNAL(triggered()), this, SLOT(bulletList())); connect(ui->actionNumber_List, SIGNAL(triggered()), this, SLOT(numberList())); connect(ui->actionIncrease_Indent, SIGNAL(triggered()), this, SLOT(increaseIndent())); connect(ui->actionDecrease_Indent, SIGNAL(triggered()), this, SLOT(decreaseIndent())); connect(ui->actionShow_Colors, SIGNAL(triggered()), this, SLOT(showColors())); connect(ui->actionShow_Fonts, SIGNAL(triggered()), this, SLOT(showFonts())); connect(ui->actionIncrease_Font, SIGNAL(triggered()), this, SLOT(increaseFont())); connect(ui->actionDecrease_Font, SIGNAL(triggered()), this, SLOT(decreaseFont())); connect(ui->actionReset_Font, SIGNAL(triggered()), this, SLOT(resetFont())); connect(ui->actionAlign_Left, SIGNAL(triggered()), this, SLOT(alignLeft())); connect(ui->actionAlign_Center, SIGNAL(triggered()), this, SLOT(alignCenter())); connect(ui->actionAlign_Right, SIGNAL(triggered()), this, SLOT(alignRight())); connect(ui->actionAlign_Justify, SIGNAL(triggered()), this, SLOT(alignJustify())); // connect View menu slots connect(ui->actionHide_Window, SIGNAL(triggered()), this, SLOT(hide())); connect(ui->actionPrevious_Category, SIGNAL(triggered()), this, SLOT(previousCategory())); connect(ui->actionNext_Category, SIGNAL(triggered()), this, SLOT(nextCategory())); connect(ui->actionPrevious_Note, SIGNAL(triggered()), this, SLOT(previousNote())); connect(ui->actionNext_Note, SIGNAL(triggered()), this, SLOT(nextNote())); // connect Help menu slots connect(ui->actionAbout_Brainstorm, SIGNAL(triggered()), this, SLOT(aboutBrainstorm())); connect(ui->actionAbout_Qt, SIGNAL(triggered()), this, SLOT(aboutQt())); // connect application slots connect(ui->textNote, SIGNAL(cursorPositionChanged()), this, SLOT(updateMenus())); connect(ui->textNote, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(updateMenus())); connect(ui->comboFonts, SIGNAL(activated(QString)), this, SLOT(setFont(QString))); connect(ui->comboFontSizes, SIGNAL(activated(QString)), this, SLOT(setFontSize(QString))); connect(ui->comboColors, SIGNAL(activated(int)), this, SLOT(setFontColor(int))); // connect category list slots connect(ui->listCategories->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateNoteList(QModelIndex))); // connect note list slots connect(ui->listNotes->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(updateNoteText(QModelIndex))); // connect text slots ui->textNote->installEventFilter((this)); // connect system tray icon connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); // initialize default data ui->listCategories->selectionModel()->setCurrentIndex(categoriesModel->index(0, 1), QItemSelectionModel::SelectCurrent); }
void NoteViewer::editNote() { emit noteEdited(¬eData); deleteNote(); }