| 1023 | } |
| 1024 | |
| 1025 | void 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 | |
| 1066 | void MainWindow::onVdcDatabaseSelected(const QItemSelection &, const QItemSelection &) { |
| 1067 | QItemSelectionModel *select = ui->ddcTable->selectionModel(); |
nothing calls this directly
no test coverage detected