50 this->ecoDetails->setHtml("<html><title>Eco Details</title><ul><li>not yet implemented</li></ul></html>"); |
52 this->ecoDetails->setHtml("<html><title>Eco Details</title><ul><li>not yet implemented</li></ul></html>"); |
51 |
53 |
52 this->stackedWidget->addWidget(this->ecoDetails); // associated with EEcoPage |
54 this->stackedWidget->addWidget(this->ecoDetails); // associated with EEcoPage |
53 |
55 |
54 // Nutrition page |
56 // Nutrition page |
55 // this->model = new QSqlQueryModel; |
|
56 // this->model-> |
|
57 this->stackedWidget->addWidget(ui->centralWidget); // associated with ENutritionPage |
57 this->stackedWidget->addWidget(ui->centralWidget); // associated with ENutritionPage |
58 |
58 |
59 |
|
60 setCentralWidget(stackedWidget); |
59 setCentralWidget(stackedWidget); |
61 |
|
62 |
|
63 } |
60 } |
64 |
61 |
65 MainWindow::~MainWindow() |
62 MainWindow::~MainWindow() |
66 { |
63 { |
67 delete ui; |
64 delete ui; |
144 QString selectedName = this->currentlySelectedItem(); |
141 QString selectedName = this->currentlySelectedItem(); |
145 |
142 |
146 if (selectedName.isEmpty()) { |
143 if (selectedName.isEmpty()) { |
147 QMessageBox::information(this,"warning","select an item from list." ); |
144 QMessageBox::information(this,"warning","select an item from list." ); |
148 } else { |
145 } else { |
149 // this->ecoDetails->setHtml( this->fishDb->getNutrition(selectedName)); |
146 |
150 this->fishDb->getNutrition(selectedName); |
147 QMap<Fishes::TNUTRITION, QString> nutrition (this->fishDb->getNutrition(selectedName)); |
|
148 |
|
149 const int COLUMN = 1; |
|
150 int row=0; |
|
151 |
|
152 QTableWidgetItem *newItem; |
|
153 newItem = new QTableWidgetItem(nutrition[Fishes::ECalories] ); |
|
154 this->ui->tableWidget->setItem(row++,COLUMN, newItem); |
|
155 |
|
156 newItem = new QTableWidgetItem(nutrition[Fishes::ETotalFat] ); |
|
157 this->ui->tableWidget->setItem(row++,COLUMN, newItem); |
|
158 |
|
159 newItem = new QTableWidgetItem(nutrition[Fishes::ETotalProtein] ); |
|
160 this->ui->tableWidget->setItem(row++,COLUMN, newItem); |
|
161 |
|
162 newItem = new QTableWidgetItem(nutrition[Fishes::EOmega3] ); |
|
163 this->ui->tableWidget->setItem(row++,COLUMN, newItem); |
|
164 |
|
165 newItem = new QTableWidgetItem(nutrition[Fishes::ECholesterol] ); |
|
166 this->ui->tableWidget->setItem(row++,COLUMN, newItem); |
|
167 |
|
168 newItem = new QTableWidgetItem(nutrition[Fishes::ESodium] ); |
|
169 this->ui->tableWidget->setItem(row,COLUMN, newItem); |
|
170 |
151 this->stackedWidget->setCurrentIndex(MainWindow::ENutritionPage); |
171 this->stackedWidget->setCurrentIndex(MainWindow::ENutritionPage); |
152 } |
172 } |
153 } |
173 } |
154 |
174 |
155 void MainWindow::displayList() |
175 void MainWindow::displayList() |