| 804 | } |
| 805 | |
| 806 | void MainWindow::analyzeFiles() |
| 807 | { |
| 808 | Settings::terminate(false); |
| 809 | |
| 810 | QStringList selected = selectFilesToAnalyze(QFileDialog::ExistingFiles); |
| 811 | |
| 812 | const QString file0 = (!selected.empty() ? selected[0].toLower() : QString()); |
| 813 | if (file0.endsWith(".sln") |
| 814 | || file0.endsWith(".slnx") |
| 815 | || file0.endsWith(".vcxproj") |
| 816 | || file0.endsWith(compile_commands_json) |
| 817 | || file0.endsWith(".bpr")) { |
| 818 | ImportProject p; |
| 819 | p.import(selected[0].toStdString()); |
| 820 | |
| 821 | if (file0.endsWith(".sln") || file0.endsWith(".slnx")) { |
| 822 | QStringList configs; |
| 823 | for (auto it = p.fileSettings.cbegin(); it != p.fileSettings.cend(); ++it) { |
| 824 | const QString cfg(QString::fromStdString(it->cfg)); |
| 825 | if (!configs.contains(cfg)) |
| 826 | configs.push_back(cfg); |
| 827 | } |
| 828 | configs.sort(); |
| 829 | |
| 830 | bool ok = false; |
| 831 | const QString cfg = QInputDialog::getItem(this, tr("Select configuration"), tr("Select the configuration that will be analyzed"), configs, 0, false, &ok); |
| 832 | if (!ok) |
| 833 | return; |
| 834 | p.ignoreOtherConfigs(cfg.toStdString()); |
| 835 | } |
| 836 | |
| 837 | doAnalyzeProject(p); // TODO: avoid copy |
| 838 | return; |
| 839 | } |
| 840 | |
| 841 | doAnalyzeFiles(selected); |
| 842 | } |
| 843 | |
| 844 | void MainWindow::analyzeDirectory() |
| 845 | { |