diff --git a/gui/projectfile.ui b/gui/projectfile.ui
index 8d6f9100a..6d73e49a3 100644
--- a/gui/projectfile.ui
+++ b/gui/projectfile.ui
@@ -59,7 +59,7 @@
-
-
+
-
@@ -67,34 +67,6 @@
- -
-
-
- gtk
-
-
-
- -
-
-
- posix
-
-
-
- -
-
-
- qt
-
-
-
- -
-
-
- windows
-
-
-
-
diff --git a/gui/projectfiledialog.cpp b/gui/projectfiledialog.cpp
index 15fbf28ae..bde3aee19 100644
--- a/gui/projectfiledialog.cpp
+++ b/gui/projectfiledialog.cpp
@@ -33,12 +33,33 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
{
mUI.setupUi(this);
- QFileInfo inf(path);
+ const QFileInfo inf(path);
QString filename = inf.fileName();
QString title = tr("Project file: %1").arg(filename);
setWindowTitle(title);
LoadSettings();
+ // Checkboxes for the libraries..
+ const QString applicationFilePath = QCoreApplication::applicationFilePath();
+ const QString appPath = QFileInfo(applicationFilePath).canonicalPath();
+ const QString searchPaths[] = { appPath, appPath + "/cfg", inf.canonicalPath() };
+ for (int i = 0; i < 3; i++) {
+ QDir dir(searchPaths[i]);
+ dir.setSorting(QDir::Name);
+ dir.setNameFilters(QStringList("*.cfg"));
+ dir.setFilter(QDir::Files | QDir::NoDotAndDotDot);
+ foreach(QFileInfo item, dir.entryInfoList()) {
+ QString library = item.fileName();
+ library.chop(4);
+ if (library.compare("std", Qt::CaseInsensitive) == 0)
+ continue;
+ QCheckBox *checkbox = new QCheckBox(this);
+ checkbox->setText(library);
+ mUI.librariesLayout->addWidget(checkbox);
+ mLibraryCheckboxes << checkbox;
+ }
+ }
+
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
connect(mUI.mBtnAddInclude, SIGNAL(clicked()), this, SLOT(AddIncludeDir()));
connect(mUI.mBtnAddPath, SIGNAL(clicked()), this, SLOT(AddPath()));
@@ -163,10 +184,9 @@ QStringList ProjectFileDialog::GetExcludedPaths() const
QStringList ProjectFileDialog::GetLibraries() const
{
QStringList libraries;
- const QCheckBox *c[] = { mUI.mChkboxGtk, mUI.mChkboxPosix, mUI.mChkboxQt, mUI.mChkboxWindows };
- for (unsigned int i = 0; i < sizeof(c) / sizeof(c[0]); i++) {
- if (c[i]->isChecked())
- libraries << c[i]->text();
+ for (int i = 0; i < mLibraryCheckboxes.size(); i++) {
+ if (mLibraryCheckboxes[i]->isChecked())
+ libraries << mLibraryCheckboxes[i]->text();
}
return libraries;
}
@@ -214,9 +234,10 @@ void ProjectFileDialog::SetExcludedPaths(const QStringList &paths)
void ProjectFileDialog::SetLibraries(const QStringList &libraries)
{
- QCheckBox *c[] = { mUI.mChkboxGtk, mUI.mChkboxPosix, mUI.mChkboxQt, mUI.mChkboxWindows };
- for (unsigned int i = 0; i < sizeof(c) / sizeof(c[0]); i++)
- c[i]->setChecked(libraries.contains(c[i]->text()));
+ for (int i = 0; i < mLibraryCheckboxes.size(); i++) {
+ QCheckBox *checkbox = mLibraryCheckboxes[i];
+ checkbox->setChecked(libraries.contains(checkbox->text()));
+ }
}
void ProjectFileDialog::AddIncludeDir()
diff --git a/gui/projectfiledialog.h b/gui/projectfiledialog.h
index e760e51e9..a4852a82e 100644
--- a/gui/projectfiledialog.h
+++ b/gui/projectfiledialog.h
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
#include "ui_projectfile.h"
@@ -206,6 +207,9 @@ private:
* @brief Projectfile path.
*/
QString mFilePath;
+
+ /** @brief Library checkboxes */
+ QList mLibraryCheckboxes;
};
/// @}