GUI: In ProjectFileDialog; updated choice of vs configurations
This commit is contained in:
parent
5fca5830c5
commit
a68d9e75ef
|
@ -62,6 +62,8 @@ static const int numberOfBuiltinPlatforms = sizeof(builtinPlatforms) / sizeof(bu
|
|||
|
||||
QStringList ProjectFileDialog::getProjectConfigs(const QString &fileName)
|
||||
{
|
||||
if (!fileName.endsWith(".sln") && !fileName.endsWith(".vcxproj"))
|
||||
return QStringList();
|
||||
QStringList ret;
|
||||
ImportProject importer;
|
||||
Settings projSettings;
|
||||
|
@ -244,8 +246,12 @@ static void updateAddonCheckBox(QCheckBox *cb, const ProjectFile *projectFile, c
|
|||
|
||||
void ProjectFileDialog::checkAllVSConfigs()
|
||||
{
|
||||
if (mUI.mChkAllVsConfigs->isChecked())
|
||||
mUI.mListVsConfigs->selectAll();
|
||||
if (mUI.mChkAllVsConfigs->isChecked()) {
|
||||
for (int row = 0; row < mUI.mListVsConfigs->count(); ++row) {
|
||||
QListWidgetItem *item = mUI.mListVsConfigs->item(row);
|
||||
item->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
mUI.mListVsConfigs->setEnabled(!mUI.mChkAllVsConfigs->isChecked());
|
||||
}
|
||||
|
||||
|
@ -259,6 +265,14 @@ void ProjectFileDialog::loadFromProjectFile(const ProjectFile *projectFile)
|
|||
setCheckPaths(projectFile->getCheckPaths());
|
||||
setImportProject(projectFile->getImportProject());
|
||||
mUI.mChkAllVsConfigs->setChecked(projectFile->getAnalyzeAllVsConfigs());
|
||||
setProjectConfigurations(getProjectConfigs(mUI.mEditImportProject->text()));
|
||||
for (int row = 0; row < mUI.mListVsConfigs->count(); ++row) {
|
||||
QListWidgetItem *item = mUI.mListVsConfigs->item(row);
|
||||
if (projectFile->getAnalyzeAllVsConfigs() || projectFile->getVsConfigurations().contains(item->text()))
|
||||
item->setCheckState(Qt::Checked);
|
||||
else
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
mUI.mCheckHeaders->setChecked(projectFile->getCheckHeaders());
|
||||
mUI.mCheckUnusedTemplates->setChecked(projectFile->getCheckUnusedTemplates());
|
||||
mUI.mMaxCtuDepth->setValue(projectFile->getMaxCtuDepth());
|
||||
|
@ -342,17 +356,6 @@ void ProjectFileDialog::loadFromProjectFile(const ProjectFile *projectFile)
|
|||
}
|
||||
mUI.mEditTags->setText(projectFile->getTags().join(';'));
|
||||
updatePathsAndDefines();
|
||||
if (mUI.mEditImportProject->text().endsWith(".sln") || mUI.mEditImportProject->text().endsWith(".vcxproj")) {
|
||||
setVsConfigurations(getProjectConfigs(mUI.mEditImportProject->text()));
|
||||
foreach (const QString &cfg, projectFile->getVsConfigurations()) {
|
||||
QList<QListWidgetItem*> items = mUI.mListVsConfigs->findItems(cfg, Qt::MatchFlag::MatchExactly);
|
||||
items[0]->setSelected(true);
|
||||
}
|
||||
} else {
|
||||
mUI.mListVsConfigs->clear();
|
||||
mUI.mListVsConfigs->setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ProjectFileDialog::saveToProjectFile(ProjectFile *projectFile) const
|
||||
|
@ -361,6 +364,7 @@ void ProjectFileDialog::saveToProjectFile(ProjectFile *projectFile) const
|
|||
projectFile->setBuildDir(getBuildDir());
|
||||
projectFile->setImportProject(getImportProject());
|
||||
projectFile->setAnalyzeAllVsConfigs(mUI.mChkAllVsConfigs->isChecked());
|
||||
projectFile->setVSConfigurations(getProjectConfigurations());
|
||||
projectFile->setCheckHeaders(mUI.mCheckHeaders->isChecked());
|
||||
projectFile->setCheckUnusedTemplates(mUI.mCheckUnusedTemplates->isChecked());
|
||||
projectFile->setMaxCtuDepth(mUI.mMaxCtuDepth->value());
|
||||
|
@ -414,7 +418,6 @@ void ProjectFileDialog::saveToProjectFile(ProjectFile *projectFile) const
|
|||
projectFile->setClangAnalyzer(mUI.mToolClangAnalyzer->isChecked());
|
||||
projectFile->setClangTidy(mUI.mToolClangTidy->isChecked());
|
||||
projectFile->setTags(mUI.mEditTags->text().split(";", QString::SkipEmptyParts));
|
||||
projectFile->setVSConfigurations(getVsConfigurations());
|
||||
}
|
||||
|
||||
void ProjectFileDialog::ok()
|
||||
|
@ -460,6 +463,7 @@ void ProjectFileDialog::updatePathsAndDefines()
|
|||
{
|
||||
const QString &fileName = mUI.mEditImportProject->text();
|
||||
bool importProject = !fileName.isEmpty();
|
||||
bool hasConfigs = fileName.endsWith(".sln") || fileName.endsWith(".vcxproj");
|
||||
mUI.mBtnClearImportProject->setEnabled(importProject);
|
||||
mUI.mListCheckPaths->setEnabled(!importProject);
|
||||
mUI.mListIncludeDirs->setEnabled(!importProject);
|
||||
|
@ -473,9 +477,9 @@ void ProjectFileDialog::updatePathsAndDefines()
|
|||
mUI.mBtnRemoveInclude->setEnabled(!importProject);
|
||||
mUI.mBtnIncludeUp->setEnabled(!importProject);
|
||||
mUI.mBtnIncludeDown->setEnabled(!importProject);
|
||||
mUI.mChkAllVsConfigs->setEnabled(fileName.endsWith(".sln") || fileName.endsWith(".vcxproj"));
|
||||
mUI.mListVsConfigs->setEnabled(fileName.endsWith(".sln") || fileName.endsWith(".vcxproj"));
|
||||
if (!mUI.mListVsConfigs->isEnabled())
|
||||
mUI.mChkAllVsConfigs->setEnabled(hasConfigs);
|
||||
mUI.mListVsConfigs->setEnabled(hasConfigs && !mUI.mChkAllVsConfigs->isChecked());
|
||||
if (!hasConfigs)
|
||||
mUI.mListVsConfigs->clear();
|
||||
}
|
||||
|
||||
|
@ -499,24 +503,34 @@ void ProjectFileDialog::browseImportProject()
|
|||
if (!fileName.isEmpty()) {
|
||||
mUI.mEditImportProject->setText(dir.relativeFilePath(fileName));
|
||||
updatePathsAndDefines();
|
||||
setVsConfigurations(getProjectConfigs(fileName));
|
||||
mUI.mListVsConfigs->selectAll();
|
||||
setProjectConfigurations(getProjectConfigs(fileName));
|
||||
for (int row = 0; row < mUI.mListVsConfigs->count(); ++row) {
|
||||
QListWidgetItem *item = mUI.mListVsConfigs->item(row);
|
||||
item->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QStringList ProjectFileDialog::getVsConfigurations() const
|
||||
QStringList ProjectFileDialog::getProjectConfigurations() const
|
||||
{
|
||||
QStringList configs;
|
||||
foreach (QListWidgetItem *item, mUI.mListVsConfigs->selectedItems())
|
||||
for (int row = 0; row < mUI.mListVsConfigs->count(); ++row) {
|
||||
QListWidgetItem *item = mUI.mListVsConfigs->item(row);
|
||||
if (item->checkState() == Qt::Checked)
|
||||
configs << item->text();
|
||||
|
||||
}
|
||||
return configs;
|
||||
}
|
||||
|
||||
void ProjectFileDialog::setVsConfigurations(const QStringList &configs)
|
||||
void ProjectFileDialog::setProjectConfigurations(const QStringList &configs)
|
||||
{
|
||||
mUI.mListVsConfigs->clear();
|
||||
mUI.mListVsConfigs->addItems(configs);
|
||||
mUI.mListVsConfigs->setEnabled(!configs.isEmpty() && !mUI.mChkAllVsConfigs->isChecked());
|
||||
foreach (const QString &cfg, configs) {
|
||||
QListWidgetItem* item = new QListWidgetItem(cfg, mUI.mListVsConfigs);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
}
|
||||
|
||||
QString ProjectFileDialog::getImportProject() const
|
||||
|
|
|
@ -58,8 +58,8 @@ private:
|
|||
*/
|
||||
QString getRootPath() const;
|
||||
|
||||
QStringList getVsConfigurations() const;
|
||||
void setVsConfigurations(const QStringList &configs);
|
||||
QStringList getProjectConfigurations() const;
|
||||
void setProjectConfigurations(const QStringList &configs);
|
||||
|
||||
QString getImportProject() const;
|
||||
|
||||
|
|
|
@ -130,17 +130,7 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="mListVsConfigs">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListWidget" name="mListVsConfigs"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
|
Loading…
Reference in New Issue