ui: Added status checkbox for disabling Source Groups to project setup
This commit is contained in:
@@ -324,7 +324,13 @@ void QtProjectWizzard::updateSourceGroupList()
|
||||
|
||||
for (const std::shared_ptr<SourceGroupSettings>& group : m_allSourceGroupSettings)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(QString::fromStdString(group->getName()));
|
||||
QString name = QString::fromStdString(group->getName());
|
||||
if (group->getStatus() == SOURCE_GROUP_STATUS_DISABLED)
|
||||
{
|
||||
name = "(" + name + ")";
|
||||
}
|
||||
|
||||
QListWidgetItem *item = new QListWidgetItem(name);
|
||||
m_sourceGroupList->addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContentSourceGroupData.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
|
||||
@@ -12,43 +13,45 @@ QtProjectWizzardContentSourceGroupData::QtProjectWizzardContentSourceGroupData(
|
||||
: QtProjectWizzardContent(window)
|
||||
, m_settings(settings)
|
||||
, m_name(nullptr)
|
||||
, m_status(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSourceGroupData::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
}
|
||||
|
||||
QLabel* nameLabel = createFormLabel("Source Group Name");
|
||||
m_name = new QLineEdit();
|
||||
m_name->setObjectName("name");
|
||||
m_name->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||
connect(m_name, &QLineEdit::textEdited, this, &QtProjectWizzardContentSourceGroupData::editedName);
|
||||
|
||||
layout->addWidget(nameLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(createFormLabel("Source Group Name"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_name, row, QtProjectWizzardWindow::BACK_COL);
|
||||
layout->setRowMinimumHeight(row, 30);
|
||||
row++;
|
||||
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
m_status = new QCheckBox("active");
|
||||
connect(m_status, &QCheckBox::toggled, this, &QtProjectWizzardContentSourceGroupData::changedStatus);
|
||||
layout->addWidget(createFormLabel("Status"), row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_status, row, QtProjectWizzardWindow::BACK_COL);
|
||||
|
||||
addHelpButton("Status", "<p>Only source files of active Source Groups will be processed during indexing. "
|
||||
"Inactive Source Groups will be ignored or cleared from the index.</p><p>Use this setting to temporarily "
|
||||
"remove files from your project (e.g. tests).</p>", layout, row);
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSourceGroupData::load()
|
||||
{
|
||||
m_name->setText(QString::fromStdString(m_settings->getName()));
|
||||
|
||||
m_status->setChecked(m_settings->getStatus() == SOURCE_GROUP_STATUS_ENABLED);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSourceGroupData::save()
|
||||
{
|
||||
m_settings->setName(m_name->text().toStdString());
|
||||
|
||||
m_settings->setStatus(m_status->isChecked() ? SOURCE_GROUP_STATUS_ENABLED : SOURCE_GROUP_STATUS_DISABLED);
|
||||
}
|
||||
|
||||
bool QtProjectWizzardContentSourceGroupData::check()
|
||||
@@ -66,5 +69,17 @@ bool QtProjectWizzardContentSourceGroupData::check()
|
||||
|
||||
void QtProjectWizzardContentSourceGroupData::editedName(QString name)
|
||||
{
|
||||
if (!m_status->isChecked())
|
||||
{
|
||||
name = "(" + name + ")";
|
||||
}
|
||||
|
||||
emit nameUpdated(name);
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSourceGroupData::changedStatus(bool checked)
|
||||
{
|
||||
emit statusUpdated(m_status->isChecked() ? SOURCE_GROUP_STATUS_ENABLED : SOURCE_GROUP_STATUS_DISABLED);
|
||||
|
||||
editedName(m_name->text());
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
#define QT_PROJECT_WIZZARD_CONTENT_SOURCE_GROUP_DATA_H
|
||||
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
#include "settings/SourceGroupStatusType.h"
|
||||
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class SourceGroupSettings;
|
||||
|
||||
@@ -25,14 +27,17 @@ public:
|
||||
|
||||
signals:
|
||||
void nameUpdated(QString);
|
||||
void statusUpdated(SourceGroupStatusType);
|
||||
|
||||
private slots:
|
||||
void editedName(QString name);
|
||||
void changedStatus(bool checked);
|
||||
|
||||
private:
|
||||
std::shared_ptr<SourceGroupSettings> m_settings;
|
||||
|
||||
QLineEdit* m_name;
|
||||
QCheckBox* m_status;
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_SOURCE_GROUP_DATA_H
|
||||
|
||||
Reference in New Issue
Block a user