NotesContentsWidget::NotesContentsWidget(Window *window) : ContentsWidget(window), m_ui(new Ui::NotesContentsWidget) { m_ui->setupUi(this); QMenu *addMenu(new QMenu(m_ui->addButton)); addMenu->addAction(ThemesManager::getIcon(QLatin1String("inode-directory")), tr("Add Folder"), this, SLOT(addFolder())); addMenu->addAction(tr("Add Note"), this, SLOT(addNote())); addMenu->addAction(tr("Add Separator"), this, SLOT(addSeparator())); m_ui->addButton->setMenu(addMenu); m_ui->notesViewWidget->setViewMode(ItemViewWidget::TreeViewMode); m_ui->notesViewWidget->setModel(NotesManager::getModel()); m_ui->notesViewWidget->setExpanded(NotesManager::getModel()->getRootItem()->index(), true); m_ui->notesViewWidget->setFilterRoles(QSet<int>({BookmarksModel::UrlRole, BookmarksModel::TitleRole, BookmarksModel::DescriptionRole, BookmarksModel::KeywordRole})); m_ui->notesViewWidget->viewport()->installEventFilter(this); m_ui->notesViewWidget->viewport()->setMouseTracking(true); m_ui->filterLineEdit->installEventFilter(this); m_ui->textEdit->setPlaceholderText(tr("Add note…")); if (!window) { m_ui->actionsWidget->hide(); } connect(NotesManager::getModel(), SIGNAL(modelReset()), this, SLOT(updateActions())); connect(m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(removeNote())); connect(m_ui->addButton, SIGNAL(clicked()), this, SLOT(addNote())); connect(m_ui->textEdit, SIGNAL(textChanged()), this, SLOT(updateText())); connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)), m_ui->notesViewWidget, SLOT(setFilterString(QString))); connect(m_ui->notesViewWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openUrl(QModelIndex))); connect(m_ui->notesViewWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); connect(m_ui->notesViewWidget, SIGNAL(needsActionsUpdate()), this, SLOT(updateActions())); }
void buttonClicked (Button* b) override { if (b == &showInTabsButton) updateLayoutMode(); else if (b == &addNoteButton) addNote (String ("Note ") + String (multiDocumentPanel.getNumDocuments() + 1), "Hello World!"); }
Notebook::Notebook(QWidget *parent) : QWidget(parent) { setupUi(this); titleLine->setReadOnly(true); contentText->setReadOnly(true); cancelButton->hide(); submitButton->hide(); nextButton->setEnabled(false); previousButton->setEnabled(false); editButton->setEnabled(false); removeButton->setEnabled(false); dialog = new FindDialog; connect(addButton, SIGNAL(clicked()), this, SLOT(addNote())); connect(submitButton, SIGNAL(clicked()), this, SLOT(submitNote())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); connect(previousButton, SIGNAL(clicked()), this, SLOT(previous())); connect(editButton, SIGNAL(clicked()), this, SLOT(editContent())); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeContent())); connect(findButton, SIGNAL(clicked()), this, SLOT(findTitle())); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveToFile())); connect(loadButton, SIGNAL(clicked()), this, SLOT(loadFromFile())); }
void Chunk::setTimingDescription(const TimingDescription &timing_description) { ChunkNotes old_notes = _notes; _notes.clear(); for(const auto & n : old_notes) { int m_start = _timing_description.measure(n.first.startPos()); int b_start = _timing_description.beat(n.first.startPos()); int sb_start = _timing_description.note(n.first.startPos()); int m_dur = _timing_description.measure(n.first.endPos() - n.first.startPos() + 1); int b_dur = _timing_description.beat(n.first.endPos() - n.first.startPos() + 1); int sb_dur = _timing_description.note(n.first.endPos() - n.first.startPos() + 1); ChunkNote nprime = n.first; int new_start = m_start*timing_description.columns() + b_start*timingDescription().beatsPerMeasure() + sb_start; int new_end = new_start + timing_description.columns(m_dur) + b_dur * timingDescription().notesPerBeat() + sb_dur - 1; nprime.setPos(new_start, new_end); removeNote(n.first); addNote(nprime); } _timing_description = timing_description; updateViews(); }
void pattern::ensureBeatNotes() { // make sure, that all step-note exist for( int i = 0; i < m_steps; ++i ) { bool found = false; for( NoteVector::Iterator it = m_notes.begin(); it != m_notes.end(); ++it ) { if( ( *it )->pos() == i * MidiTime::ticksPerTact() / MidiTime::stepsPerTact() && ( *it )->length() <= 0 ) { found = true; break; } } if( found == false ) { addNote( note( MidiTime( 0 ), MidiTime( i * MidiTime::ticksPerTact() / MidiTime::stepsPerTact() ) ), false ); } } }
static void processKeys(void) { uint8_t i; uint8_t hex_max = 0; for (i = 0; i < 48; i++) { //if the current sensor value of a key is positive and it was zero on last count if (manta_data_lock == 0) { if ((butt_states[i] > 0) && (pastbutt_states[i] <= 0)) { addNote(i,butt_states[i]); } else if ((butt_states[i] <= 0) && (pastbutt_states[i] > 0)) { removeNote(i); } if (butt_states[i] > hex_max) { hex_max = butt_states[i]; } // update the past keymap array (stores the previous values of every key's sensor reading) pastbutt_states[i] = butt_states[i]; } } dacsend(3,0,(hex_max * 16)); noteOut(); }
TaskEditor::TaskEditor(QWidget *parent) : QWidget(parent){ setupUi(this); this->setAttribute(Qt::WA_DeleteOnClose); this->taskCombo->addItem(""); connect(this->saveButton,SIGNAL(clicked()),this,SLOT(save())); QList<Json::Value>*tasks=static_cast <qtMushi *>(qApp)->taskDirectory.getAllTasks(); for(int x=0;x<tasks->count();x++){ this->taskCombo->addItem(tasks->at(x).get("title","").asString().c_str(),QVariant(tasks->at(x).get("id","").asCString())); } QList<Json::Value>*statuses=static_cast <qtMushi *>(qApp)->statusDirectory.getAllStatuses(); for(int x=0;x<statuses->count();x++){ this->statusCombo->addItem(statuses->at(x).get("name","").asString().c_str(),QVariant(statuses->at(x).get("id","").asCString())); } QList<Json::Value>*users=static_cast <qtMushi *>(qApp)->userDirectory.getAllUsers(); for(int x=0;x<users->count();x++){ this->ownerCombo->addItem(users->at(x).get("firstName","").asString().append(" ").append(users->at(x).get("lastName","").asString()).c_str(),QVariant(users->at(x).get("id","").asCString())); } this->connect(this->addNoteButton,SIGNAL(clicked()),this,SLOT(addNote())); this->controls->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); this->connect(this->controls,SIGNAL(linkClicked(QUrl)),this,SLOT(linkClicked(QUrl))); this->controls->setTextSizeMultiplier(0.8); }
Note * Pattern::rearrangeNote( const Note * _note_to_proc, const bool _quant_pos ) { // just rearrange the position of the note by removing it and adding // a copy of it -> addNote inserts it at the correct position Note copy_of_note( *_note_to_proc ); removeNote( _note_to_proc ); return addNote( copy_of_note, _quant_pos ); }
std::vector<MidiNote*> MidiData::addNotes(const std::vector<MidiNote*> &new_notes) { std::vector<MidiNote*> p_new_notes; p_new_notes.reserve(new_notes.size()); for(auto n : new_notes) p_new_notes.push_back(addNote(*n)); return p_new_notes; }
QStandardItem * NotesItemView::addNote(const QString &id, const QString &title, const QString &parentID) { QStandardItem *parentItem; if(parentID.isEmpty()) { parentItem = m_itemModel->invisibleRootItem(); } else { parentItem = find(parentID); } return addNote(id,title,parentItem); }
void Pattern::ensureBeatNotes() { // make sure, that all step-note exist for( int i = 0; i < m_steps; ++i ) { bool found = false; NoteVector::Iterator it; for( it = m_notes.begin(); it != m_notes.end(); ++it ) { Note *note = *it; // if a note in this position is the one we want if( note->pos() == ( i * MidiTime::ticksPerTact() ) / MidiTime::stepsPerTact() && note->length() <= 0 ) { found = true; break; } } if( found == false ) { addNote( Note( MidiTime( 0 ), MidiTime( ( i * MidiTime::ticksPerTact() ) / MidiTime::stepsPerTact() ) ), false ); } } // remove notes we no longer need: // that is, disabled notes that no longer fall to the steps of the new time sig for( NoteVector::Iterator it = m_notes.begin(); it != m_notes.end(); ) { bool needed = false; Note *note = *it; for( int i = 0; i < m_steps; ++i ) { if( note->pos() == ( i * MidiTime::ticksPerTact() ) / MidiTime::stepsPerTact() || note->length() != 0 ) { needed = true; break; } } if( needed == false ) { delete note; it = m_notes.erase( it ); } else { ++it; } } }
vector<Note> Analyzer::analyzeDurations(string s) { for(unsigned int i=0;i<s.length();i++) { addNote(s[i]); checkBar(s[i]); } shuffle(); clearDoubleRests(); return notes; }
Ticket::Ticket(string customerName, string ticketID, string creationDate, string serialNumber, string modelNumber, bool isOpen, Note note) { //ctor this->customerName = customerName; this->ticketID = ticketID; this->creationDate = creationDate; this->serialNumber = serialNumber; this->modelNumber = modelNumber; this->isOpen = isOpen; notes = new Note[100]; addNote(note); }
/** * @brief Initialize DPDKPort and start the device */ void DPDKPort::init() { // Start device if(0 != dpdk_start_dev(portId)) return; if(!monitor.isRunning()) monitor.start(); monitor.waitForSetupFinished(); if(!isPromiscModeOn) addNote("Non Promiscuous mode"); }
void createNotesForFiles (const Array<File>& files) { for (int i = 0; i < files.size(); ++i) { const File file (files[i]); String content = file.loadFileAsString(); if (content.length() > 20000) content = "Too long!"; addNote (file.getFileName(), content); } }
/** * Add data to the contact. * All fields must be empty. */ void PIMContact::addDataToContact() { printf("\n==============Add data to contact==============\n"); printf(sFieldSeparator); addContactName(); waitForClick(); addAddress(); waitForClick(); addBirthday(); waitForClick(); addEmail(); waitForClick(); addNickname(); waitForClick(); addNote(); waitForClick(); addOrg(); waitForClick(); // If you want to set a photo URL call addPhotoURL method instead of // addPhoto method. addPhoto(); waitForClick(); addPhone(); waitForClick(); addTitle(); waitForClick(); addURL(); waitForClick(); addIM(); waitForClick(); addRelation(); waitForClick(); addOrgInfo(); waitForClick(); }
void handleMIDIMessage(uint8_t ctrlByte, uint8_t msgByte1, uint8_t msgByte2) { uint8_t control = ctrlByte & 0xf0; //uint8_t channel = ctrlByte & 0x0f; //lcd_clear_line(1); //dip204_printf_string("control: %u",ctrlByte); //lcd_clear_line(2); //dip204_printf_string("note: %u", msgByte1); switch(control) { case 144: if (msgByte2) { addNote(msgByte1,msgByte2); } //to deal with note-offs represented as a note-on with zero velocity else { removeNote(msgByte1); } noteOut(); midiVol(); break; case 128: removeNote(msgByte1); noteOut(); midiVol(); break; // control change case 176: controlChange(msgByte1,msgByte2); //LED_On(LED2); //midiVol(); break; // program change case 192: programChange(msgByte1); break; default: break; } }
void PianoGrid::mouseDown (const MouseEvent& e) { if (isAddOrResizeEvent(e)) { if (getRowsColsByMousePosition (e.x, e.y, draggingRow, draggingColumn)) { draggingNote = new PianoGridNote (this); draggingNote->initialize (draggingRow, draggingColumn, defaultNoteLength, 1.0f); draggingNote->setBounds (getNoteRect (draggingNote)); draggingNote->toFront (true); addNote (draggingNote); } } MidiGrid::mouseDown (e); }
QDomElement KnowItImporter::addNote( KnowItNote note) { QDomElement newElement; int childNotesCount = m_childNotes[ note.id ].size(); // int childNotesCount = note.childNotes.size(); kDebug() << note.title << childNotesCount; if (childNotesCount > 0) { newElement = m_domDoc.createElement("KJotsBook"); } else { newElement = m_domDoc.createElement("KJotsPage"); } QDomElement titleTag = m_domDoc.createElement( "Title" ); titleTag.appendChild( m_domDoc.createTextNode( note.title ) ); newElement.appendChild( titleTag ); QDomElement idTag = m_domDoc.createElement( "ID" ); idTag.appendChild( m_domDoc.createTextNode( "0" ) ); // Gets a valid id later. newElement.appendChild( idTag ); if (childNotesCount > 0) { QDomElement openTag = m_domDoc.createElement( "Open" ); openTag.appendChild( m_domDoc.createTextNode( "1" ) ); newElement.appendChild( openTag ); QDomElement titlePage = m_domDoc.createElement("KJotsPage"); QDomElement titlePageTitleTag = m_domDoc.createElement( "Title" ); titlePageTitleTag.appendChild( m_domDoc.createTextNode( note.title ) ); titlePage.appendChild( titlePageTitleTag ); QDomElement titlePageIdTag = m_domDoc.createElement( "ID" ); titlePageIdTag.appendChild( m_domDoc.createTextNode( "0" ) ); // Gets a valid id later. titlePage.appendChild( titlePageIdTag ); QDomElement titlePageTextTag = m_domDoc.createElement( "Text" ); titlePageTextTag.appendChild( m_domDoc.createCDATASection( note.content ) ); titlePage.appendChild( titlePageTextTag ); newElement.appendChild( titlePage ); foreach (int id, m_childNotes[ note.id ] ) { QDomElement e = addNote( m_noteHash.value(id) ); newElement.appendChild(e); }
void Lilypond::convert() { ci = 0; line = 0; tick = 0; part = new Part(score); score->appendPart(part); staff = new Staff(score, part, 0); score->staves().push_back(staff); part->staves()->push_back(staff); measure = new Measure(score); measure->setTick(tick); score->add(measure); QChar c = lookup(); if (c == '\\') { ++ci; scanCmd(); } if (!lookup('{')) error("{ expected"); ++ci; for (QChar c = lookup(); !c.isNull() && c != '}'; c = lookup()) { switch(c.toAscii()) { case 'a' ... 'g': { LNote note = scanNote(); addNote(note); } break; case 'r': scanRest(); addRest(); break; default: printf("unexpected char <%c>\n", c.toAscii()); ++ci; break; } } }
void NotesItemView::create(const QString &id, QStandardItem *parentItem) { //DEBUG_FUNC_NAME foreach(const QString & i, m_idC) { if(id == "-1") { parentItem = m_itemModel->invisibleRootItem(); } if((id == "-1" && m_notes->getRef(i, "parent").isEmpty()) || m_notes->getRef(i, "parent") == id) { if(m_notes->getType(i) == "text") { QStandardItem *noteItem = addNote(i, m_notes->getTitle(i), parentItem); create(i, noteItem); } else if(m_notes->getType(i) == "folder") { QStandardItem *folderItem = addFolder(i, m_notes->getTitle(i), parentItem); create(i, folderItem); } } } }
MDIDemo() { setOpaque (true); showInTabsButton.setButtonText ("Show with tabs"); showInTabsButton.setToggleState (false, dontSendNotification); showInTabsButton.addListener (this); addAndMakeVisible (showInTabsButton); addNoteButton.setButtonText ("Create a new note"); addNoteButton.addListener (this); addAndMakeVisible (addNoteButton); addAndMakeVisible (multiDocumentPanel); multiDocumentPanel.setBackgroundColour (Colours::transparentBlack); updateLayoutMode(); addNote ("Notes Demo", "You can drag-and-drop text files onto this page to open them as notes.."); addExistingNotes(); }
void AutomationGrid::mouseDown (const MouseEvent& e) { double beat = 1; double value = 64; if (isAddOrResizeEvent(e)) { if (getRowsColsByMousePosition (e.x, e.y, value, beat)) { AutomationEvent* draggingNote; draggingNote = new AutomationEvent (this); draggingNote->initialize (templateEvent.getController(), value, beat, templateEvent.getColour(), templateEvent.getOutlineColour()); draggingNote->setBounds (getNoteRect (draggingNote)); draggingNote->toFront (true); addNote (draggingNote); } } MidiGrid::mouseDown (e); repaint(); }
bool SheetMusicConverter::convert(const std::string &name, const SheetMusic &sheet) { output.open(name.c_str(), ios::out | ios::trunc); // MusicXML header output << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"; output << std::endl; output << "<!DOCTYPE score-partwise PUBLIC" << std::endl; output << "\"-//Recordare//DTD MusicXML 3.0 Partwise//EN\"" << std::endl; output << "\"http://www.musicxml.org/dtds/partwise.dtd\">" << std::endl; // Sheet music format open("score-partwise", "version=\"3.0\""); open("part-list"); open("score-part", "id=\"P1\""); print("part-name", ""); close(); close(); open("part", "id=\"P1\""); std::vector<Measure> measures = sheet.getAllMeasures(); for (unsigned int i = 0; i < measures.size(); i++) { addMeasure(); std::vector<Note> notes = measures[i].getAllNotes(); for (unsigned int j = 0; j < notes.size(); j++) { addNote(notes[j].getPitch(), notes[j].getstart(), notes[j].getDuration(), measures[i].getBeat()); } close(); } while (tags.size() > 0) close(); output.close(); return true; }
void Message::setNote(const std::string& type, const std::string& text) { clearNotes(); addNote(type, text); }
PitchSet::PitchSet(vector<Note*>* pitchVector) { //copy each note in from pitchVector for(int i=0; i<pitchVector->size()-1; i++){ addNote(pitchVector->at(i)); } }
void MidiStochaster::init(MidiMessageSequence const& originalTrack) { srand(time(0)); ScopedPointer<MidiMessageSequence> track (new MidiMessageSequence(originalTrack)); track->updateMatchedPairs(); int numEvents = track->getNumEvents(); if (numEvents == 0) { //No Events handling //... goodSource = false; return; } int numNotes = 0; for (int i = 0; i < numEvents; i++) { if (track->getEventPointer(i)->message.isNoteOn()) { numNotes++; } } if (numNotes == 0) { //No Notes handling //... return; } pitches = new std::vector<int>(0); MidiMessageSequence::MidiEventHolder* eventHolder = track->getEventPointer(0); int i = 0; while (!eventHolder->message.isNoteOn()) { starter.addEvent(eventHolder->message); i++; eventHolder = track->getEventPointer(i); } pitches->push_back(eventHolder->message.getNoteNumber()); lowVelocity = (int) eventHolder->message.getVelocity(); highVelocity = lowVelocity; lowNoteLength = eventHolder->noteOffObject->message.getTimeStamp() - eventHolder->message.getTimeStamp(); highNoteLength = lowNoteLength; if (numNotes == 1) { //One Note handling //... return; } lowRestLength = -1.0; highRestLength = lowRestLength; lowNegRestLength = 1.0; highNegRestLength = lowNegRestLength; numPosRest = 0; numNegRest = 0; double lastNoteEndPoint; bool brokeInner = false; for (i = i+1; i < numEvents; i++) { lastNoteEndPoint = eventHolder->noteOffObject->message.getTimeStamp(); eventHolder = track->getEventPointer(i); while(!eventHolder->message.isNoteOn()) { i++; if (i >= numEvents) { brokeInner = true; break; } eventHolder = track->getEventPointer(i); } if(brokeInner) { break; } double restLength = eventHolder->message.getTimeStamp() - lastNoteEndPoint; addRest(restLength); addNote(eventHolder, i, *track); } negRestProbability = ((double) numNegRest) / ((double) (numNegRest + numPosRest)); if (negRestProbability > .9) { if (negRestProbability == 1.0) { lowRestLength = 1; highRestLength = 1; } negRestProbability = .9; } goodSource = true; }
bool ConvertXml::endElement( const QString&, const QString&, const QString& qName) { QString Str; if (qName == "actual-notes") { stAno = stCha; } else if (qName == "alter") { stAlt = stCha; } else if (qName == "attributes") { // update this bar's attributes if (trk) { trk->bars()[bar-1].time1=stBts.toInt(); trk->bars()[bar-1].time2=stBtt.toInt(); trk->bars()[bar-1].keysig=stFif.toInt(); } } else if (qName == "backup") { tStartCur = -1; tEndCur -= stDur.toInt() * 120 / iDiv; } else if (qName == "beats") { stBts = stCha; } else if (qName == "beat-type") { stBtt = stCha; } else if (qName == "chord") { stCho = TRUE; } else if (qName == "creator") { stCrt = stCha; } else if (qName == "divisions") { stDiv = stCha; iDiv = stDiv.toInt(); if (iDiv <= 0) { qDebug() << "illegal divisions value: " << stDiv; } } else if (qName == "dot") { stDts++; } else if (qName == "duration") { stDur = stCha; } else if (qName == "encoder") { stEnc = stCha; } else if (qName == "fifths") { stFif = stCha; } else if (qName == "forward") { tStartCur = -1; tEndCur += stDur.toInt() * 120 / iDiv; } else if (qName == "fret") { stFrt = stCha; } else if (qName == "identification") { song->info["TITLE"] = stTtl; song->info["ARTIST"] = stCrt; song->info["TRANSCRIBER"] = stEnc; song->info["COMMENTS"] = ""; } else if (qName == "measure") { // forward to end of track in case of incomplete last voice int td = trk->trackDuration(); if (tEndCur < td) { tEndCur = td; x = trk->c.size(); } } else if (qName == "midi-bank") { stPmb = stCha; } else if (qName == "midi-channel") { stPmc = stCha; } else if (qName == "midi-program") { stPmp = stCha; } else if (qName == "normal-notes") { stNno = stCha; } else if (qName == "note") { return addNote(); } else if (qName == "octave") { stOct = stCha; } else if (qName == "part") { trk = NULL; } else if (qName == "part-name") { stPnm = stCha; } else if (qName == "rest") { stRst = TRUE; } else if (qName == "score-part") { bool res = addTrack(); // re-init score part specific variables initStScorePart(); return res; } else if (qName == "score-timewise") { reportError("not supported: score-timewise"); return false; } else if (qName == "staff-lines") { stPtn = stCha; if (trk) { int nStr = stPtn.toInt(); if ((nStr < 1) || (nStr > MAX_STRINGS)) nStr = MAX_STRINGS; trk->string = nStr; } } else if (qName == "staff-tuning") { if (trk) { int iPtl = stPtl.toInt(); int iPto = stPto.toInt(); // LVIFIX: Check max_strings trk->tune[iPtl - 1] = accSt.sao2Pitch(stPts, 0 /* LVIFIX */, iPto); } } else if (qName == "step") { stStp = stCha; } else if (qName == "string") { stStr = stCha; } else if (qName == "tuning-step") { stPts = stCha; } else if (qName == "tuning-octave") { stPto = stCha; } else if (qName == "type") { stTyp = stCha; } else if (qName == "work-title") { stTtl = stCha; // following elements are explicitly ignored, usually because sub- // and superelements handle all the work, sometimes because features // are not supported by KGuitar and sometimes they are // simply not necessary } else if ( qName == "accidental-mark" // not supported by KG || qName == "articulations" // LVIFIX: add more ... || qName == "work" // not supported by KG || qName == "work-number" // not supported by KG // || qName == "" ) { } else { // LVIFIX: define what to do, e.g. silently ignore unknown // elements, or report these as warning // for the time being, the last option is chosen Str = "skipping <" + qName + ">"; reportWarning(Str); // ignore } return TRUE; }
void Ticket::readFromFile(string fileName) { noteIndex = 0; string line; bool isTicket = false; int lineCount = 0; int index = 0; int noteTotal = 0; bool goodReturn = false; string tempNote; string tempDate; ifstream myFile; myFile.open(fileName); if (myFile.is_open()) { while (getline(myFile, line)) { if (line == "TICKET_START") { //checks if the file is a ticket isTicket = true; } if (line == "TICKET_END") { isTicket = false; goodReturn = true; } if (isTicket) //will only run if file is a ticket { //Checks if in a note if (line == "NOTES_START") { index = 1; } if (line == "NOTE_START") { index = 2; } if (line == "NOTE_END") { Note newNote; newNote.note = tempNote; newNote.date = tempDate; addNote(newNote); index = 1; noteTotal++; } if (line == "NOTES_END") { index = 0; } //Data for notes if (index > 0) { if (index == 3) { tempDate = line; index = 4; } if (index == 2) { tempNote = line; index = 3; } } else //Each line number is associated with a different variable, as shown below. { if (lineCount == 1) { customerName = line; } if (lineCount == 2) { ticketID = line; } if (lineCount == 3) { creationDate = line; } if (lineCount == 4) { serialNumber = line; } if (lineCount == 5) { modelNumber = line; } if (lineCount == 6) { if (line == "true") { isOpen = true; } else if (line == "false") { isOpen = false; } } } } lineCount++; } myFile.close(); } if (goodReturn) { cout << "Ticket read successfully." << endl; } else { cout << "Ticket did not read successfully." << endl; } }
void NotesContentsWidget::showContextMenu(const QPoint &point) { const QModelIndex index(m_ui->notesViewWidget->indexAt(point)); const BookmarksModel::BookmarkType type(static_cast<BookmarksModel::BookmarkType>(index.data(BookmarksModel::TypeRole).toInt())); QMenu menu(this); if (type != BookmarksModel::UrlBookmark && type != BookmarksModel::TrashBookmark) { menu.addAction(getAction(ActionsManager::PasteAction)); menu.addSeparator(); } if (type == BookmarksModel::TrashBookmark) { menu.addAction(ThemesManager::getIcon(QLatin1String("trash-empty")), tr("Empty Trash"), NotesManager::getModel(), SLOT(emptyTrash()))->setEnabled(NotesManager::getModel()->getTrashItem()->rowCount() > 0); } else if (type == BookmarksModel::UnknownBookmark) { menu.addAction(ThemesManager::getIcon(QLatin1String("inode-directory")), tr("Add Folder"), this, SLOT(addFolder())); menu.addAction(tr("Add Bookmark"), this, SLOT(addNote())); menu.addAction(tr("Add Separator"), this, SLOT(addSeparator())); } else { const bool isInTrash(index.data(BookmarksModel::IsTrashedRole).toBool()); if (type == BookmarksModel::UrlBookmark) { menu.addAction(getAction(ActionsManager::CutAction)); menu.addAction(getAction(ActionsManager::CopyAction)); menu.addAction(getAction(ActionsManager::PasteAction)); menu.addSeparator(); } menu.addAction(ThemesManager::getIcon(QLatin1String("document-open")), tr("Open source page"), this, SLOT(openUrl()))->setEnabled(type == BookmarksModel::UrlBookmark && index.data(BookmarksModel::UrlRole).toUrl().isValid()); if (type != BookmarksModel::RootBookmark) { Action *copyLinkAction(getAction(ActionsManager::CopyLinkToClipboardAction)); copyLinkAction->setEnabled(type == BookmarksModel::UrlBookmark && index.data(BookmarksModel::UrlRole).toUrl().isValid()); menu.addAction(copyLinkAction); } if (!isInTrash) { menu.addSeparator(); QMenu *addMenu(menu.addMenu(tr("Add Note"))); addMenu->addAction(ThemesManager::getIcon(QLatin1String("inode-directory")), tr("Add Folder"), this, SLOT(addFolder())); addMenu->addAction(tr("Add Note"), this, SLOT(addNote())); addMenu->addAction(tr("Add Separator"), this, SLOT(addSeparator())); } if (type != BookmarksModel::RootBookmark) { menu.addSeparator(); if (isInTrash) { menu.addAction(tr("Restore Note"), this, SLOT(restoreNote())); } else { menu.addAction(getAction(ActionsManager::DeleteAction)); } } } menu.exec(m_ui->notesViewWidget->mapToGlobal(point)); }