void BCLMeasureDialog::init() { #ifdef Q_OS_MAC int btnHeight = 44; #else int btnHeight = 34; #endif QPushButton* cancelButton = this->cancelButton(); cancelButton->setText("Cancel"); cancelButton->setMinimumHeight(btnHeight); cancelButton->setDefault(true); QPushButton* okButton = this->okButton(); okButton->setText("Create Measure and \n Open for Editing"); okButton->setMinimumHeight(btnHeight); auto vLayout = new QVBoxLayout; vLayout->setContentsMargins(QMargins(0,0,0,0)); auto label = new QLabel; label->setText("Name:"); label->setObjectName("H2"); vLayout->addWidget(label); m_nameLineEdit = new QLineEdit(this); vLayout->addWidget(m_nameLineEdit); auto tempHLayout = new QHBoxLayout; label = new QLabel; label->setText("Class Name:"); label->setObjectName("H2"); tempHLayout->addWidget(label); m_classNameLabel = new QLabel(this); tempHLayout->addWidget(m_classNameLabel); tempHLayout->addStretch(); vLayout->addLayout(tempHLayout); vLayout->addSpacing(10); label = new QLabel; label->setText("Description:"); label->setObjectName("H2"); vLayout->addWidget(label); m_descriptionTextEdit = new QTextEdit(this); m_descriptionTextEdit->setAcceptRichText(false); m_descriptionTextEdit->setTabChangesFocus(true); vLayout->addWidget(m_descriptionTextEdit); vLayout->addSpacing(10); label = new QLabel; label->setText("Modeler Description:"); label->setObjectName("H2"); vLayout->addWidget(label); m_modelerDescriptionTextEdit = new QTextEdit(this); m_modelerDescriptionTextEdit->setAcceptRichText(false); m_modelerDescriptionTextEdit->setTabChangesFocus(true); vLayout->addWidget(m_modelerDescriptionTextEdit); vLayout->addSpacing(10); tempHLayout = new QHBoxLayout; vLayout->addLayout(tempHLayout); auto tempVLayout = new QVBoxLayout; label = new QLabel; label->setText("Measure Type:"); label->setObjectName("H2"); tempVLayout->addWidget(label); m_measureTypeComboBox = new QComboBox(this); m_measureTypeComboBox->addItem("OpenStudio Measure"); m_measureTypeComboBox->addItem("EnergyPlus Measure"); //m_measureTypeComboBox->addItem("Utility Measure"); // Disable for now m_measureTypeComboBox->addItem("Reporting Measure"); m_measureTypeComboBox->setCurrentIndex(0); tempVLayout->addWidget(m_measureTypeComboBox); tempVLayout->addSpacing(10); tempHLayout->addLayout(tempVLayout); tempVLayout = new QVBoxLayout; label = new QLabel; label->setText("Taxonomy:"); label->setObjectName("H2"); tempVLayout->addWidget(label); m_taxonomyFirstLevelComboBox = new QComboBox(this); std::vector<std::string> firstLevelTerms = BCLMeasure::suggestedFirstLevelTaxonomyTerms(); for (const std::string& firstLevelTerm : firstLevelTerms){ m_taxonomyFirstLevelComboBox->addItem(toQString(firstLevelTerm)); } m_taxonomySecondLevelComboBox = new QComboBox(this); auto tempHLayout2 = new QHBoxLayout; tempHLayout2->addWidget(m_taxonomyFirstLevelComboBox); tempHLayout2->addWidget(m_taxonomySecondLevelComboBox); tempVLayout->addLayout(tempHLayout2); tempVLayout->addSpacing(10); tempHLayout->addLayout(tempVLayout); tempHLayout = new QHBoxLayout; vLayout->addLayout(tempHLayout); tempVLayout = new QVBoxLayout; label = new QLabel; label->setText("Intended Software Tools:"); label->setObjectName("H2"); tempVLayout->addWidget(label); m_intendedSoftwareToolListWidget = new QListWidget(this); tempVLayout->addWidget(m_intendedSoftwareToolListWidget); QStringList intendedSoftwareTools; for (const std::string& suggestedTool : BCLMeasure::suggestedIntendedSoftwareTools()){ intendedSoftwareTools.append(toQString(suggestedTool)); } QStringListIterator it(intendedSoftwareTools); while (it.hasNext()){ QString intendedSoftwareTool = it.next(); auto listItem = new QListWidgetItem(intendedSoftwareTool, m_intendedSoftwareToolListWidget); // DLM: defaults per David if (intendedSoftwareTool == "Analysis Spreadsheet"){ listItem->setCheckState(Qt::Unchecked); }else{ listItem->setCheckState(Qt::Checked); } listItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); m_intendedSoftwareToolListWidget->addItem(listItem); } tempHLayout->addLayout(tempVLayout); tempVLayout = new QVBoxLayout; label = new QLabel; label->setText("Intended Use Cases:"); label->setObjectName("H2"); tempVLayout->addWidget(label); m_intendedUseCaseListWidget = new QListWidget(); tempVLayout->addWidget(m_intendedUseCaseListWidget); QStringList intendedUseCases; for (const std::string& suggestedUseCase : BCLMeasure::suggestedIntendedUseCases()){ intendedUseCases.append(toQString(suggestedUseCase)); } it = QStringListIterator(intendedUseCases); while (it.hasNext()){ QString intendedUseCase = it.next(); auto listItem = new QListWidgetItem(intendedUseCase, m_intendedUseCaseListWidget); // DLM: default to unchecked per David listItem->setCheckState(Qt::Unchecked); listItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); m_intendedUseCaseListWidget->addItem(listItem); } tempHLayout->addLayout(tempVLayout); QBoxLayout* upperLayout = this->upperLayout(); upperLayout->addLayout(vLayout); upperLayout->addStretch(); connect(m_nameLineEdit, &QLineEdit::textChanged, this, &BCLMeasureDialog::nameChanged); connect(m_measureTypeComboBox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this, &BCLMeasureDialog::measureTypeChanged); connect(m_taxonomyFirstLevelComboBox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this, &BCLMeasureDialog::firstLevelTaxonomyChanged); this->setWindowModality(Qt::ApplicationModal); //this->setSizeGripEnabled(true); #ifdef Q_OS_MAC setWindowFlags(Qt::FramelessWindowHint); #else setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint); #endif }
ConfigForm::ConfigForm(enviro * env, QWidget * parent) : QDialog(parent), ui(new Ui::ConfigForm) { ui->setupUi(this); theenv = env; setWindowIcon(QPixmap(qllogo_xpm)); ui->PushButtonClose->setDefault(TRUE); if ( env->isUseDefaultDB() ) { ui->CheckBoxUseDefaultDB->setChecked(TRUE); ui->LineEditSearchIn->setEnabled(FALSE); ui->PushButtonSerachIn->setEnabled(FALSE); } else { ui->CheckBoxUseDefaultDB->setChecked(FALSE); ui->LineEditSearchIn->setEnabled(TRUE); ui->PushButtonSerachIn->setEnabled(TRUE); } ui->LineEditSearchIn->setText( env->getDBToQuery() ); ui->LineEditStartIndexFrom->setText(env->getStartIndexFrom() ); ui->LineEditDBLocate->setText(env->getDatabase()); ui->ListBoxDirExclude->clear(); QStringListIterator stringIterator(env->getPrunepaths().split(",")); while( stringIterator.hasNext() ) { ui->ListBoxDirExclude->addItem(stringIterator.next().toUtf8()); } if ( ui->ListBoxDirExclude->count() > 1 ) { ui->ListBoxDirExclude->sortItems(); } ui->ListBoxFsExclude->clear(); stringIterator = QStringListIterator(env->getPrunefs().split(",")); while( stringIterator.hasNext() ) { ui->ListBoxFsExclude->addItem(stringIterator.next().toUtf8()); } if ( ui->ListBoxFsExclude->count() > 1 ) { ui->ListBoxFsExclude->sortItems(); } if ( env->isSecurity() ) { ui->CheckBoxSecurityLevel->setChecked(TRUE); } else { ui->CheckBoxSecurityLevel->setChecked(FALSE); } if ( env->isVerbose() ) { ui->CheckBoxVerbose->setChecked(TRUE); } else { ui->CheckBoxVerbose->setChecked(FALSE); } ui->PushButtonConfSave->setEnabled(FALSE); connect(ui->PushButtonClose, SIGNAL(clicked(bool)), SLOT(accept()) ); connect(ui->PushButtonSerachIn, SIGNAL(clicked(bool)), SLOT(changeSearchIn_slot()) ); connect(ui->PushButtonStartIndexFrom, SIGNAL(clicked(bool)), SLOT(changeStartIndexFrom_slot()) ); connect(ui->PushButtonDBLocate, SIGNAL(clicked(bool)), SLOT(changeDBLocate_slot()) ); connect(ui->PushButtonAddDirExclude, SIGNAL(clicked(bool)), SLOT(addDirExclude_slot()) ); connect(ui->PushButtonDeleteDirExclude, SIGNAL(clicked(bool)), SLOT(deleteDirExclude_slot()) ); connect(ui->PushButtonAddFsExclude, SIGNAL(clicked(bool)), SLOT(addFsExclude_slot()) ); connect(ui->PushButtonConfSave, SIGNAL(clicked(bool)), SLOT(save_slot()) ); connect(ui->PushButtonCreateDB, SIGNAL(clicked(bool)), SLOT(createDB_slot()) ); connect(ui->CheckBoxUseDefaultDB, SIGNAL(stateChanged(int)), SLOT(activeSaveButton_slot()) ); connect(ui->CheckBoxUseDefaultDB, SIGNAL(stateChanged(int)), SLOT(setActiveSearchIn_slot()) ); connect(ui->LineEditSearchIn, SIGNAL(textChanged(QString)), SLOT(activeSaveButton_slot()) ); connect(ui->LineEditStartIndexFrom, SIGNAL(textChanged(QString)), SLOT(activeSaveButton_slot()) ); connect(ui->CheckBoxSecurityLevel, SIGNAL(stateChanged(int)), SLOT(activeSaveButton_slot()) ); connect(ui->CheckBoxVerbose, SIGNAL(stateChanged(int)), SLOT(activeSaveButton_slot()) ); connect(ui->LineEditDBLocate, SIGNAL(textChanged(QString)), SLOT(activeSaveButton_slot()) ); connect(ui->PushButtonDeleteFsExclude, SIGNAL(clicked(bool)), SLOT(deleteFsExclude_slot()) ); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void PipelineFilterWidget::linkConditionalWidgets(QVector<FilterParameter::Pointer>& filterParameters) { // Figure out if we have any "Linked Boolean Widgets" to hook up to other widgets for (QVector<FilterParameter::Pointer>::iterator iter = filterParameters.begin(); iter != filterParameters.end(); ++iter ) { FilterParameter::Pointer filterParameter = (*iter); LinkedBooleanFilterParameter::Pointer filterParameterPtr = boost::dynamic_pointer_cast<LinkedBooleanFilterParameter>(filterParameter); if(NULL != filterParameterPtr.get() ) { QStringList linkedProps = filterParameterPtr->getConditionalProperties(); QStringListIterator iter = QStringListIterator(linkedProps); QWidget* checkboxSource = m_PropertyToWidget[filterParameterPtr->getPropertyName()]; while(iter.hasNext()) { QString propName = iter.next(); QWidget* w = m_PropertyToWidget[propName]; if(w) { connect(checkboxSource, SIGNAL(conditionalPropertyChanged(int)), w, SLOT(setLinkedConditionalState(int) ) ); LinkedBooleanWidget* lbw = qobject_cast<LinkedBooleanWidget*>(checkboxSource); if(lbw && lbw->getLinkedState() != Qt::Checked) { w->hide(); } } } LinkedBooleanWidget* boolWidget = qobject_cast<LinkedBooleanWidget*>(checkboxSource); if(boolWidget) { boolWidget->updateLinkedWidgets(); } } // Figure out if we have any Linked ComboBox Widgets to hook up to other widgets LinkedChoicesFilterParameter::Pointer optionPtr2 = boost::dynamic_pointer_cast<LinkedChoicesFilterParameter>(filterParameter); if(NULL != optionPtr2.get()) { QStringList linkedProps = optionPtr2->getLinkedProperties(); QStringListIterator iter = QStringListIterator(linkedProps); QWidget* checkboxSource = m_PropertyToWidget[optionPtr2->getPropertyName()]; while(iter.hasNext()) { QString propName = iter.next(); QWidget* w = m_PropertyToWidget[propName]; if(w) { //qDebug() << "Connecting: " << optionPtr2->getPropertyName() << " to " << propName; connect(checkboxSource, SIGNAL(conditionalPropertyChanged(int)), w, SLOT(setLinkedComboBoxState(int) ) ); ChoiceWidget* choiceWidget = qobject_cast<ChoiceWidget*>(checkboxSource); if(choiceWidget) { choiceWidget->widgetChanged(choiceWidget->getCurrentIndex(), false); } } } } } }