FileListModel::FileListModel(void)
:
+ m_blockUpdates(false),
m_fileIcon(":/icons/page_white_cd.png")
{
}
{
QFileInfo fileInfo(filePath);
const QString key = MAKE_KEY(fileInfo.canonicalFilePath());
+ const bool flag = (!m_blockUpdates);
if(!m_fileStore.contains(key))
{
- beginInsertRows(QModelIndex(), m_fileList.count(), m_fileList.count());
+ if(flag) beginInsertRows(QModelIndex(), m_fileList.count(), m_fileList.count());
m_fileStore.insert(key, AudioFileModel(fileInfo.canonicalFilePath(), fileInfo.baseName()));
m_fileList.append(key);
- endInsertRows();
+ if(flag) endInsertRows();
+ emit rowAppended();
}
}
void FileListModel::addFile(const AudioFileModel &file)
{
const QString key = MAKE_KEY(file.filePath());
+ const bool flag = (!m_blockUpdates);
if(!m_fileStore.contains(key))
{
- beginInsertRows(QModelIndex(), m_fileList.count(), m_fileList.count());
+ if(flag) beginInsertRows(QModelIndex(), m_fileList.count(), m_fileList.count());
m_fileStore.insert(key, file);
m_fileList.append(key);
- endInsertRows();
+ if(flag) endInsertRows();
+ emit rowAppended();
}
}
{
if(index.row() >= 0 && index.row() < m_fileList.count())
{
- return m_fileList.at(index.row());
+ return m_fileStore.value(m_fileList.at(index.row()));
}
else
{