Smarter method to edit file informartion of files in the list
This commit is contained in:
parent
07c793d6ec
commit
5ac1c127f1
@ -391,9 +391,8 @@ void MainWindow::editMetaButtonClicked(void)
|
||||
sourceFileView->selectRow(index.row());
|
||||
}
|
||||
|
||||
AudioFileModel file = m_fileListModel->getFile(index);
|
||||
AudioFileModel &file = (*m_fileListModel)[index];
|
||||
iResult = metaInfoDialog->exec(file, index.row() > 0, index.row() < m_fileListModel->rowCount() - 1);
|
||||
m_fileListModel->setFile(index, file);
|
||||
|
||||
if(!iResult) break;
|
||||
}
|
||||
|
@ -204,6 +204,11 @@ AudioFileModel FileListModel::getFile(const QModelIndex &index)
|
||||
}
|
||||
}
|
||||
|
||||
AudioFileModel &FileListModel::operator[] (const QModelIndex &index)
|
||||
{
|
||||
return m_fileList[index.row()];
|
||||
}
|
||||
|
||||
bool FileListModel::setFile(const QModelIndex &index, const AudioFileModel &audioFile)
|
||||
{
|
||||
if(index.row() >= 0 && index.row() < m_fileList.count())
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
bool moveFile(const QModelIndex &index, int delta);
|
||||
AudioFileModel getFile(const QModelIndex &index);
|
||||
bool setFile(const QModelIndex &index, const AudioFileModel &audioFile);
|
||||
AudioFileModel &operator[] (const QModelIndex &index);
|
||||
|
||||
public slots:
|
||||
void addFile(const QString &filePath);
|
||||
|
Loading…
Reference in New Issue
Block a user