MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / determineVdcSelection

Method determineVdcSelection

src/MainWindow.cpp:1025–1064  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1023}
1024
1025void MainWindow::determineVdcSelection()
1026{
1027 ui->ddc_files->clearCurrentFile();
1028 ui->ddcTabs->setCurrentIndex(0);
1029
1030 // File does not exist anymore
1031 if (!QFile(_currentVdc).exists())
1032 {
1033 ui->ddc_files->setCurrentDirectory(AppConfig::instance().getVdcPath());
1034 }
1035 // File is from database
1036 else if (_currentVdc == AppConfig::instance().getPath("temp.vdc"))
1037 {
1038 QString lastId = AppConfig::instance().get<QString>(AppConfig::VdcLastDatabaseId);
1039 ui->ddcTabs->setCurrentIndex(1);
1040
1041 if (lastId.isEmpty())
1042 {
1043 return;
1044 }
1045
1046 VdcDatabaseModel* model = static_cast<VdcDatabaseModel*>(ui->ddcTable->model());
1047 if (model == nullptr)
1048 {
1049 return;
1050 }
1051
1052 QModelIndex lastIndex = model->findFirstById(lastId);
1053 if(lastIndex.isValid())
1054 {
1055 ui->ddcTable->selectRow(lastIndex.row());
1056 ui->ddcTable->scrollTo(lastIndex);
1057 }
1058 }
1059 // External file
1060 else
1061 {
1062 ui->ddc_files->setCurrentFile(_currentVdc);
1063 }
1064}
1065
1066void MainWindow::onVdcDatabaseSelected(const QItemSelection &, const QItemSelection &) {
1067 QItemSelectionModel *select = ui->ddcTable->selectionModel();

Callers

nothing calls this directly

Calls 7

clearCurrentFileMethod · 0.80
setCurrentDirectoryMethod · 0.80
findFirstByIdMethod · 0.80
setCurrentFileMethod · 0.80
existsMethod · 0.45
getPathMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected