Esempio n. 1
0
void Chunk::emitAdds()
{
    for(const auto & n : _notes)
    {
        emit noteAdded(this,n.first);
    }
}
Esempio n. 2
0
QUuid ContextModel::createNote( QUuid pUuid )
{
	BaseListModel		*Parent = ( mCurrentGroup.isNull() ? mRootItem : mNodeMap.value( mCurrentGroup )->children() );

	if( !Parent )
	{
		return( QUuid() );
	}

	NoteModel			*Note = new NoteModel( Parent );

	if( !Note )
	{
		return( QUuid() );
	}

	QUuid				 NoteId = ( pUuid.isNull() ? QUuid::createUuid() : pUuid );

	int					 NoteIdx = Parent->rowCount();

	beginInsertRows( createIndex( Parent->row(), 0, Parent ), NoteIdx, NoteIdx );

	Parent->appendChild( Note );

	mNoteMap.insert( NoteId, Note );

	endInsertRows();

	emit layoutChanged();

	emit noteAdded( NoteId );

	return( NoteId );
}
Esempio n. 3
0
void Cache::softLoad() {
    clearNotes();
    clearSearches();
    qDebug() << "Notes size: " << notes->size();

    for(int i=0;i<notes->size();i++){
        Note note = notes->at(i);
        if (m_sel_notebook) {
            if (note.notebookGuid == m_sel_notebook->guid){
                NoteWrapper* noteWrapper = new NoteWrapper(note);
                noteAdded(noteWrapper);
            }
        } else {
            NoteWrapper* noteWrapper = new NoteWrapper(note);
            noteAdded(noteWrapper);
        }
    }
}
Esempio n. 4
0
void FileStorage::putToCache(const NoteListItem &note)
{
    ensureChachePopulated();
    bool isModify = cache.contains(note.id);
    cache.insert(note.id, note);
    if (isModify) {
        emit noteModified(note);
    } else {
        emit noteAdded(note);
    }
}
Esempio n. 5
0
void Cache::load(){
    tags = DatabaseManager::instance()->getTags();
    notebooks = DatabaseManager::instance()->getNotebooks();
    notes = DatabaseManager::instance()->getNotes();
    searches = DatabaseManager::instance()->getSavedSearches();
    clearNotes();
    clearSearches();
    qDebug() << "Notes size: " << notes->size();

    for(int i=0;i<notes->size();i++){
        Note note = notes->at(i);
        if (m_sel_notebook) {
            if (note.notebookGuid == m_sel_notebook->guid){
                NoteWrapper* noteWrapper = new NoteWrapper(note);
                noteAdded(noteWrapper);
            }
        } else {
            NoteWrapper* noteWrapper = new NoteWrapper(note);
            noteAdded(noteWrapper);
        }
    }
}
Esempio n. 6
0
void Chunk::addNote(const ChunkNote &note)
{
    if(_lower_octave == -1 or note.octave() < _lower_octave) _lower_octave = note.octave();
    if(_upper_octave == -1 or note.octave() > _upper_octave) _upper_octave = note.octave();

    Range * range = 0;

    if(_scene != 0)
    {
        range = _scene->mark_view(note);
    }

    _notes.insert(std::make_pair(note,range));

    emit(noteAdded(this,note));

}
Esempio n. 7
0
void XmlNotes::insertID(const QString &id)
{
    notesID << id;
    emit noteAdded(id);
}
Esempio n. 8
0
void Cache::fireNoteAdded(NoteWrapper *note) {
    noteAdded(note);
}