GUI: only show a library once in the projectfiledialog
This commit is contained in:
parent
33e6c1bf53
commit
f991c8fd02
|
@ -47,6 +47,7 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
||||||
const QString applicationFilePath = QCoreApplication::applicationFilePath();
|
const QString applicationFilePath = QCoreApplication::applicationFilePath();
|
||||||
const QString appPath = QFileInfo(applicationFilePath).canonicalPath();
|
const QString appPath = QFileInfo(applicationFilePath).canonicalPath();
|
||||||
const QString searchPaths[] = { ":/cfg", appPath, appPath + "/cfg", inf.canonicalPath() };
|
const QString searchPaths[] = { ":/cfg", appPath, appPath + "/cfg", inf.canonicalPath() };
|
||||||
|
QStringList libs;
|
||||||
for (int i = 0; i < sizeof(searchPaths) / sizeof(searchPaths[0]); i++) {
|
for (int i = 0; i < sizeof(searchPaths) / sizeof(searchPaths[0]); i++) {
|
||||||
QDir dir(searchPaths[i]);
|
QDir dir(searchPaths[i]);
|
||||||
dir.setSorting(QDir::Name);
|
dir.setSorting(QDir::Name);
|
||||||
|
@ -57,12 +58,17 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
||||||
library.chop(4);
|
library.chop(4);
|
||||||
if (library.compare("std", Qt::CaseInsensitive) == 0)
|
if (library.compare("std", Qt::CaseInsensitive) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
if (libs.indexOf(library) == -1)
|
||||||
|
libs << library;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qSort(libs);
|
||||||
|
foreach(const QString library, libs) {
|
||||||
QCheckBox *checkbox = new QCheckBox(this);
|
QCheckBox *checkbox = new QCheckBox(this);
|
||||||
checkbox->setText(library);
|
checkbox->setText(library);
|
||||||
mUI.librariesLayout->addWidget(checkbox);
|
mUI.librariesLayout->addWidget(checkbox);
|
||||||
mLibraryCheckboxes << checkbox;
|
mLibraryCheckboxes << checkbox;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
|
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||||
connect(mUI.mBtnAddInclude, SIGNAL(clicked()), this, SLOT(AddIncludeDir()));
|
connect(mUI.mBtnAddInclude, SIGNAL(clicked()), this, SLOT(AddIncludeDir()));
|
||||||
|
|
Loading…
Reference in New Issue