void QvisAppearanceWindow::UpdateWindowSensitivity() { AppearanceAttributes *atts = (AppearanceAttributes *)subject; bool val = !atts->GetUseSystemDefault(); backgroundColorButton->setEnabled(val); backgroundColorLabel->setEnabled(val); foregroundColorButton->setEnabled(val); foregroundColorLabel->setEnabled(val); fontName->setEnabled(val); fontLabel->setEnabled(val); styleComboBox->setEnabled(val); styleLabel->setEnabled(val); orientationComboBox->setEnabled(val); orientationLabel->setEnabled(val); }
void QvisAppearanceWindow::UpdateWindow(bool doAll) { AppearanceAttributes *atts = (AppearanceAttributes *)subject; int j; for(int i = 0; i < atts->NumAttributes(); ++i) { if(!doAll) { if(!atts->IsSelected(i)) continue; } switch(i) { case AppearanceAttributes::ID_useSystemDefault: { // new scope bool val = atts->GetUseSystemDefault(); useSysDefaultCheckBox->blockSignals(true); if(val) useSysDefaultCheckBox->setCheckState(Qt::Checked); else useSysDefaultCheckBox->setCheckState(Qt::Unchecked); useSysDefaultCheckBox->blockSignals(false); } break; case AppearanceAttributes::ID_background: { // new scope QColor bg; if(atts->GetUseSystemDefault()) bg = QColor(atts->GetDefaultBackground().c_str()); else bg = QColor(atts->GetBackground().c_str()); backgroundColorButton->blockSignals(true); backgroundColorButton->setButtonColor(bg); backgroundColorButton->blockSignals(false); } break; case AppearanceAttributes::ID_foreground: { // new scope QColor fg; if(atts->GetUseSystemDefault()) fg = QColor(atts->GetDefaultForeground().c_str()); else fg = QColor(atts->GetForeground().c_str()); foregroundColorButton->blockSignals(true); foregroundColorButton->setButtonColor(fg); foregroundColorButton->blockSignals(false); } break; case AppearanceAttributes::ID_fontName: fontName->blockSignals(true); if(atts->GetUseSystemDefault()) fontName->setText(atts->GetDefaultFontName().c_str()); else fontName->setText(atts->GetFontName().c_str()); fontName->blockSignals(false); break; case AppearanceAttributes::ID_style: { // new scope std::string styleName; if(atts->GetUseSystemDefault()) styleName = atts->GetDefaultStyle(); else styleName = atts->GetStyle(); for(j = 0; j < numStyleNames; ++j) { if(styleName == styleNames[j]) { styleComboBox->blockSignals(true); styleComboBox->setCurrentIndex(j); styleComboBox->blockSignals(false); break; } } } break; case AppearanceAttributes::ID_orientation: orientationComboBox->blockSignals(true); if(atts->GetOrientation() == 0) orientationComboBox->setCurrentIndex(0); else orientationComboBox->setCurrentIndex(1); orientationComboBox->blockSignals(false); break; } } UpdateWindowSensitivity(); }