MCPcopy Create free account
hub / github.com/baldurk/renderdoc / changeCurrentDir

Method changeCurrentDir

qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp:673–726  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

671}
672
673void VirtualFileDialog::changeCurrentDir(const QModelIndex &index, bool recordHistory)
674{
675 // shouldn't happen, but sanity check
676 if(!index.isValid())
677 return;
678
679 // ignore changes to current dir
680 if(currentDir() == index)
681 return;
682
683 if(recordHistory)
684 {
685 // erase the history we backed up over
686 while(m_History.count() > m_HistoryIndex + 1)
687 m_History.pop_back();
688
689 // add new history
690 m_History.push_back(index);
691 m_HistoryIndex = m_History.count() - 1;
692 }
693
694 ui->back->setEnabled(m_HistoryIndex > 0);
695 ui->forward->setEnabled(m_HistoryIndex < m_History.count() - 1);
696
697 QModelIndex fileIndex = m_FileProxy->mapFromSource(index);
698 QModelIndex dirIndex = m_DirProxy->mapFromSource(index);
699
700 // set file list to this dir
701 ui->fileList->setRootIndex(fileIndex);
702
703 // update location text
704 ui->location->setText(m_FileProxy->data(fileIndex, RemoteFileModel::FilePathRole).toString());
705
706 // enable up button if we're not at a root
707 bool isRoot = m_FileProxy->data(fileIndex, RemoteFileModel::FileIsRootRole).toBool();
708 ui->upFolder->setEnabled(!isRoot);
709
710 // expand the directory list so this directory is visible
711 QModelIndex parent = m_DirProxy->parent(dirIndex);
712 while(parent.isValid())
713 {
714 ui->dirList->expand(parent);
715 parent = m_DirProxy->parent(parent);
716 }
717
718 // select this directory
719 ui->dirList->selectionModel()->setCurrentIndex(dirIndex, QItemSelectionModel::ClearAndSelect);
720
721 // if it was access denied, show an error now
722 if(m_FileProxy->data(fileIndex, RemoteFileModel::FileIsAccessDeniedRole).toBool())
723 {
724 accessDenied(ui->location->text());
725 }
726}
727
728void VirtualFileDialog::on_dirList_clicked(const QModelIndex &index)
729{

Callers

nothing calls this directly

Calls 11

setRootIndexMethod · 0.80
isValidMethod · 0.45
countMethod · 0.45
pop_backMethod · 0.45
push_backMethod · 0.45
mapFromSourceMethod · 0.45
setTextMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
parentMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected