MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / ProjectFileDialog

Method ProjectFileDialog

gui/projectfiledialog.cpp:125–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125ProjectFileDialog::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)

Callers

nothing calls this directly

Calls 9

isEmptyMethod · 0.80
setFlagsMethod · 0.80
addItemMethod · 0.80
loadFromFileMethod · 0.80
getSearchPathsMethod · 0.45
compareMethod · 0.45
loadMethod · 0.45
clearMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected