[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenonbeta/krecipes
From: Jason Kivlighn <confederacy2 () excite ! com>
Date: 2004-05-17 23:02:56
Message-ID: 20040517230256.62A3E9020 () office ! kde ! org
[Download RAW message or body]
CVS commit by jkivlighn:
-Fix bug so that all tabs in the diet helper dialog are reloaded in reload()
-When reloading diet helper dialog, remember all user input
-Little TODO update
M +5 -3 TODO 1.31
M +15 -0 src/datablocks/constraintlist.cpp 1.2
M +3 -0 src/datablocks/constraintlist.h 1.3
M +39 -1 src/dialogs/dietwizarddialog.cpp 1.48
--- kdenonbeta/krecipes/TODO #1.30:1.31
@@ -1,8 +1,10 @@
jkivlighn:
+Just some ideas that popped into my mind...
-*Allow putting ingredients into groups with headers - i.e. Pie Crust and Filling
-*Give option to import recipe formats by pasting the recipe text into a
-widget
+ *Allow putting ingredients into groups with headers - i.e. Pie Crust and \
Filling + *Give option to import recipe formats by pasting the recipe text \
into a widget + *Allow saving and loading diet info from a file (or just store \
it in the database?) + *Instead of saving "servings" of a recipe, change it to \
"yield" and allow a unit ( i.e. 5 servings, 2 dozen )
uga:
--- kdenonbeta/krecipes/src/datablocks/constraintlist.cpp #1.1:1.2
@@ -10,4 +10,6 @@
#include "constraintlist.h"
+#include "ingredientproperty.h"
+
ConstraintList::ConstraintList()
{
@@ -51,4 +53,17 @@ return(list.find(it));
}
+Constraint* ConstraintList::findByPty( IngredientProperty *pty )
+{
+ for (Constraint* ct=getFirst();ct; ct=getNext())
+ {
+ if ( ct->id == pty->id )
+ return ct;
+ }
+
+ return 0;
+}
+
+
+
Constraint* ConstraintList::at(int pos)
{
--- kdenonbeta/krecipes/src/datablocks/constraintlist.h #1.2:1.3
@@ -19,4 +19,6 @@
*/
+class IngredientProperty;
+
class Constraint{
public:
@@ -62,4 +64,5 @@ public:
void append(Constraint *constraint);
int find(Constraint* it);
+ Constraint* findByPty( IngredientProperty *pty );
Constraint* at(int pos);
private:
--- kdenonbeta/krecipes/src/dialogs/dietwizarddialog.cpp #1.47:1.48
@@ -105,5 +105,5 @@ database->loadCategories(&categoriesList
database->loadProperties(&propertyList); // Loads the properties of all the \
ingredients int pgcount=0;
-for (MealInput *tab=(MealInput *) \
(mealTabs->page(pgcount));pgcount<mealTabs->count(); pgcount++) +for (MealInput \
*tab=(MealInput *) (mealTabs->page(pgcount));pgcount<mealTabs->count(); pgcount++, \
tab=(MealInput *) (mealTabs->page(pgcount))) \
tab->reload(categoriesList,propertyList);
@@ -265,4 +265,11 @@ private:
public:
+ void setConstraint( const Constraint &constraint )
+ {
+ delete ctStored;
+ ctStored = new Constraint( constraint );
+
+ setOn( ctStored->enabled );
+ }
double maxVal(){return ctStored->max;}
double minVal(){return ctStored->min;}
@@ -534,4 +541,29 @@ return categoryFiltering;
void DishInput::reload(ElementList *categoryList, IngredientPropertyList \
*propertyList) {
+ //store existing values
+ConstraintList saveConstraints;
+Constraint constraint;
+ for (ConstraintsListItem \
*it=(ConstraintsListItem*)(constraintsView->firstChild());it;it=(ConstraintsListItem*)(it->nextSibling()))
+ {
+ constraint.id=it->propertyId();
+ constraint.min=it->minVal();
+ constraint.max=it->maxVal();
+ constraint.enabled=it->isOn();
+ constraint.name=it->text(1);
+ saveConstraints.add(constraint);
+ }
+
+ElementList saveEnabledCategories;
+Element category;
+for (CategoriesListItem \
*it=(CategoriesListItem*)(categoriesView->firstChild());it;it=(CategoriesListItem*)(it->nextSibling()))
+{
+ if ( it->isOn())
+ {
+ category.id=it->categoryId();
+ category.name=it->categoryName();
+ saveEnabledCategories.add(category);
+ }
+}
+
categoriesView->clear();
constraintsView->clear();
@@ -542,4 +574,8 @@ for (IngredientProperty *pty=propertyLis
ConstraintsListItem *it=new ConstraintsListItem(constraintsView,pty);
constraintsView->insertItem(it);
+
+Constraint *constraint = saveConstraints.findByPty( pty );
+if ( constraint )
+ it->setConstraint( *constraint );
}
@@ -549,4 +585,6 @@ for ( ElementList::const_iterator cat_it
CategoriesListItem *it=new CategoriesListItem(categoriesView,*cat_it);
categoriesView->insertItem(it);
+if ( saveEnabledCategories.contains( *cat_it ) )
+ it->setOn( true );
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic