QString RecipeFormatter::getTextFormat() { QString ret = ""; QString tmp = ""; if( rec == 0 ) return ""; Style* style = rec->style(); ret += QString("%1 - %2 (%3%4)\n").arg( rec->name()) .arg( style ? style->name() : tr("unknown style")) .arg( style ? style->categoryNumber() : tr("N/A")) .arg( style ? style->styleLetter() : ""); ret += getTextSeparator(); ret += buildStatTableTxt(); if((tmp = buildFermentableTableTxt()) != "") { ret += "\n" + tr("Fermentables") + "\n"; ret += getTextSeparator(); ret += tmp; } if((tmp = buildHopsTableTxt()) != "") { ret += "\n" + tr("Hops") + "\n"; ret += getTextSeparator(); ret += tmp; } if((tmp = buildMiscTableTxt()) != "") { ret += "\n" + tr("Miscs") + "\n"; ret += getTextSeparator(); ret += tmp; } if((tmp = buildYeastTableTxt()) != "") { ret += "\n" + tr("Yeasts") + "\n"; ret += getTextSeparator(); ret += tmp; } if((tmp = buildMashTableTxt()) != "") { ret += "\n" + tr("Mash") + "\n"; ret += getTextSeparator(); ret += tmp; } if( (tmp = rec->notes()) != "" ) { ret += "\n" + tr("Notes") + "\n"; ret += getTextSeparator(); ret += tmp; } if((tmp = buildInstructionTableTxt()) != "") { ret += "\n" + tr("Instructions") + "\n"; ret += getTextSeparator(); ret += tmp; } return ret; }
void StyleEditor::showChanges(QMetaProperty* metaProp) { bool updateAll = false; QString propName; QVariant val; Style *s = obsStyle; if( s == 0 ) { clear(); return; } if( metaProp == 0 ) updateAll = true; else { propName = metaProp->name(); val = metaProp->read(s); } if( updateAll ) { lineEdit_name->setText(s->name()); lineEdit_category->setText(s->category()); lineEdit_categoryNumber->setText(s->categoryNumber()); lineEdit_styleLetter->setText(s->styleLetter()); lineEdit_styleGuide->setText(s->styleGuide()); comboBox_type->setCurrentIndex(s->type()); lineEdit_ogMin->setText(s); lineEdit_ogMax->setText(s); lineEdit_fgMin->setText(s); lineEdit_fgMax->setText(s); lineEdit_ibuMin->setText(s); lineEdit_ibuMax->setText(s); lineEdit_colorMin->setText(s); lineEdit_colorMax->setText(s); lineEdit_carbMin->setText(s); lineEdit_carbMax->setText(s); lineEdit_abvMin->setText(s); lineEdit_abvMax->setText(s); textEdit_profile->setText(s->profile()); textEdit_ingredients->setText(s->ingredients()); textEdit_examples->setText(s->examples()); textEdit_notes->setText(s->notes()); return; } if( propName == "name" ) lineEdit_name->setText(val.toString()); else if( propName == "category" ) lineEdit_category->setText(val.toString()); else if( propName == "categoryNumber" ) lineEdit_categoryNumber->setText(val.toString()); else if( propName == "styleLetter" ) lineEdit_styleLetter->setText(val.toString()); else if( propName == "styleGuide" ) lineEdit_styleGuide->setText(val.toString()); else if( propName == "type" ) comboBox_type->setCurrentIndex(val.toInt()); else if( propName == "ogMin" ) lineEdit_ogMin->setText(val); else if( propName == "ogMax" ) lineEdit_ogMax->setText(val); else if( propName == "fgMin" ) lineEdit_fgMin->setText(val); else if( propName == "fgMax" ) lineEdit_fgMax->setText(val); else if( propName == "ibuMin" ) lineEdit_ibuMin->setText(val); else if( propName == "ibuMax" ) lineEdit_ibuMax->setText(val); else if( propName == "colorMin_srm" ) lineEdit_colorMin->setText(val); else if( propName == "colorMax_srm" ) lineEdit_colorMax->setText(val); else if( propName == "carbMin_vol" ) lineEdit_carbMin->setText(val); else if( propName == "carbMax_vol" ) lineEdit_carbMax->setText(val); else if( propName == "abvMin_pct" ) lineEdit_abvMin->setText(val); else if( propName == "abvMax_pct" ) lineEdit_abvMax->setText(val); else if( propName == "profile" ) textEdit_profile->setText(val.toString()); else if( propName == "ingredients" ) textEdit_ingredients->setText(val.toString()); else if( propName == "examples" ) textEdit_examples->setText(val.toString()); else if( propName == "notes" ) textEdit_notes->setText(val.toString()); }