| 123 | } |
| 124 | |
| 125 | ProjectFileDialog::ProjectFileDialog(ProjectFile *projectFile, bool premium, QWidget *parent) |
| 126 | : QDialog(parent) |
| 127 | , mUI(new Ui::ProjectFile) |
| 128 | , mProjectFile(projectFile) |
| 129 | , mPremium(premium) |
| 130 | { |
| 131 | mUI->setupUi(this); |
| 132 | |
| 133 | mUI->mToolClangAnalyzer->hide(); |
| 134 | |
| 135 | const QFileInfo inf(projectFile->getFilename()); |
| 136 | QString filename = inf.fileName(); |
| 137 | QString title = tr("Project file: %1").arg(filename); |
| 138 | setWindowTitle(title); |
| 139 | loadSettings(); |
| 140 | |
| 141 | QStringList libs; |
| 142 | // Search the std.cfg first since other libraries could depend on it |
| 143 | QString stdLibraryFilename; |
| 144 | for (const QString &sp : projectFile->getSearchPaths("cfg")) { |
| 145 | QDir dir(sp); |
| 146 | dir.setSorting(QDir::Name); |
| 147 | dir.setNameFilters(QStringList("*.cfg")); |
| 148 | dir.setFilter(QDir::Files | QDir::NoDotAndDotDot); |
| 149 | for (const QFileInfo& item : dir.entryInfoList()) { |
| 150 | QString library = item.fileName(); |
| 151 | if (library.compare("std.cfg", Qt::CaseInsensitive) != 0) |
| 152 | continue; |
| 153 | Library lib; |
| 154 | const QString fullfilename = sp + "/" + library; |
| 155 | const Library::Error err = lib.load(nullptr, fullfilename.toLatin1()); |
| 156 | if (err.errorcode != Library::ErrorCode::OK) |
| 157 | continue; |
| 158 | // Working std.cfg found |
| 159 | stdLibraryFilename = fullfilename; |
| 160 | break; |
| 161 | } |
| 162 | if (!stdLibraryFilename.isEmpty()) |
| 163 | break; |
| 164 | } |
| 165 | // Search other libraries |
| 166 | for (const QString &sp : projectFile->getSearchPaths("cfg")) { |
| 167 | QDir dir(sp); |
| 168 | dir.setSorting(QDir::Name); |
| 169 | dir.setNameFilters(QStringList("*.cfg")); |
| 170 | dir.setFilter(QDir::Files | QDir::NoDotAndDotDot); |
| 171 | for (const QFileInfo& item : dir.entryInfoList()) { |
| 172 | QString library = item.fileName(); |
| 173 | { |
| 174 | Library lib; |
| 175 | const QString fullfilename = sp + "/" + library; |
| 176 | Library::Error err = lib.load(nullptr, fullfilename.toLatin1()); |
| 177 | if (err.errorcode != Library::ErrorCode::OK) { |
| 178 | // Some libraries depend on std.cfg so load it first and test again |
| 179 | lib.load(nullptr, stdLibraryFilename.toLatin1()); |
| 180 | err = lib.load(nullptr, fullfilename.toLatin1()); |
| 181 | } |
| 182 | if (err.errorcode != Library::ErrorCode::OK) |
nothing calls this directly
no test coverage detected