Initial Commit
[HECS.git] / HeatingDialog.cpp
blob0541ff47a4fe7e457b1ac04751498a45c0c42893
1 /***************************************************************************
2 * *
3 * HeatingDialog.cpp Copyright (C) 2008 by Jon Rumble * * *
4 * j.w.rumble@reading.ac.uk *
5 * *
6 * *
7 * This file is part of HECS, *
8 * *
9 * HECS is free software: you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation, either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 * *
15 * HECS is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
22 ***************************************************************************/
24 #include "HeatingDialog.h"
26 HeatingDialog::HeatingDialog (QWidget *parent)
27 : QDialog(parent)
29 ui.setupUi(this);
33 void HeatingDialog::setModel(RdSap *modelIn)
35 sapModel = modelIn;
36 initVars();
40 void HeatingDialog::onBoilerFuelTypeCbxChange()
43 m_fuelFlag = ui.boilerFuelTypeCbx->currentIndex();
44 ui.boilerManufacturerCbx->clear();
46 switch (m_fuelFlag)
48 case 0:
49 ui.boilerManufacturerCbx->insertItems(
50 1,sapModel->sedbukList->getBoilerBrands(1));
51 break; // Gas
52 case 1:
53 ui.boilerManufacturerCbx->insertItems(
54 1,sapModel->sedbukList->getBoilerBrands(2));
55 break; //LPG
56 case 2:
57 ui.boilerManufacturerCbx->insertItems(
58 1,sapModel->sedbukList->getBoilerBrands(4));
59 break;
60 //Why 4 ?! Listed in spec....
61 ui.boilerManufacturerCbx->setCurrentIndex(0);
65 void HeatingDialog::onBoilerManufacturerCbxChange()
67 ui.boilerModelCbx->clear();
69 QString searchString = ui.boilerManufacturerCbx->currentText();
71 ui.boilerModelCbx->insertItems(
72 1,sapModel->sedbukList->getModelList(searchString));
76 void HeatingDialog::onBoilerModelCbxChange()
78 QString searchString = "";
79 searchString = ui.boilerModelCbx->currentText();
81 Boiler tmp;
82 tmp = sapModel->sedbukList->findBoiler(searchString);
83 QString lblTxt = QString::number(tmp.get_sapSeasonalEffcy(),'f',1) + "%";
84 ui.effcyLbl->setText(lblTxt);
85 sapModel->spaceheat->setEffcyMainHeatingSys(tmp.get_sapSeasonalEffcy());
89 void HeatingDialog::buildModelTable()
94 void HeatingDialog::initVars()
96 ui.boilerManufacturerCbx->insertItems(1,sapModel->sedbukList->getBoilerBrands(1));
98 //ui.boilerModelCbx->insertItems(1,sapModel->sedbukList->getModelList("Baxi"));
100 QObject::connect(ui.boilerFuelTypeCbx, SIGNAL(currentIndexChanged(QString)), this,SLOT(onBoilerFuelTypeCbxChange()));
102 QObject::connect(ui.boilerManufacturerCbx, SIGNAL(currentIndexChanged(QString)), this,SLOT(onBoilerManufacturerCbxChange()));
104 QObject::connect(ui.boilerModelCbx, SIGNAL(currentIndexChanged(QString)), this,SLOT(onBoilerModelCbxChange()));
106 //Populate Adress Details
107 ui.houseNumLbl->setText(sapModel->dwelling->get_houseNumber());
108 ui.addressLbl->setText(sapModel->dwelling->get_address());
109 ui.postcodeLbl->setText(sapModel->dwelling->get_postcode());
114 // END OF HeatingDialog.cpp