Commit 8c0ef4b3 authored by Gerrit Erichsen's avatar Gerrit Erichsen
Browse files

Added TableModels to GUI

parent bfba2cd2
......@@ -590,6 +590,8 @@ void CharLGui::initDataModels()
m_modelConventional = new ConventionalTableModel(this);
m_modelStorage = new StorageTableModel(this);
m_modelWind = new WindTableModel(this);
m_modelBiomass = new BiomassTableModel(this);
m_modelCSP = new CSPTableModel(this);
m_modelWindData = new DataTableModel(m_preferences, DataTableModel::Wind, this);
m_modelSolarData = new DataTableModel(m_preferences, DataTableModel::Solar, this);
m_modelTemperatureData = new DataTableModel(m_preferences, DataTableModel::Temperature, this);
......@@ -620,6 +622,12 @@ void CharLGui::initDataModels()
m_modelSelectWind = new SelectorListModel(this);
m_modelSelectWind->setModel(m_modelWind);
m_modelSelectBiomass = new SelectorListModel(this);
m_modelSelectBiomass->setModel(m_modelBiomass);
m_modelSelectCSP = new SelectorListModel(this);
m_modelSelectCSP->setModel(m_modelCSP);
m_modelSelectWindData = new SelectorListModel(this);
m_modelSelectWindData->setModel(m_modelWindData);
......@@ -644,7 +652,7 @@ void CharLGui::initWidgets()
m_mainTabWidget = new QTabWidget(this);
m_plantWidget = new PlantWidget(m_modelConventional, m_modelStorage, m_modelWind, m_modelSolar,
m_modelSelectModulePV, this);
m_modelBiomass, m_modelCSP, m_modelSelectModulePV, this);
m_plantWidget->setObjectName("PlantWidget");
m_dataWidget = new DataWidget(m_modelWindData, m_modelSolarData, m_modelTemperatureData,
......
......@@ -39,6 +39,8 @@
#include "Models/PhotovoltaicTableModel.h"
#include "Models/LocationsTableModel.h"
#include "Models/NodesTableModel.h"
#include "Models/BiomassTableModel.h"
#include "Models/CSPTableModel.h"
#include "Preferences.h"
#include "CharLAlgorithm.h"
......@@ -106,6 +108,8 @@ private:
StorageTableModel * m_modelStorage;
WindTableModel * m_modelWind;
SolarTableModel * m_modelSolar;
BiomassTableModel * m_modelBiomass;
CSPTableModel * m_modelCSP;
DataTableModel * m_modelWindData;
DataTableModel * m_modelSolarData;
DataTableModel * m_modelTemperatureData;
......@@ -122,6 +126,8 @@ private:
SelectorListModel * m_modelSelectStorage;
SelectorListModel * m_modelSelectPV;
SelectorListModel * m_modelSelectWind;
SelectorListModel * m_modelSelectBiomass;
SelectorListModel * m_modelSelectCSP;
SelectorListModel * m_modelSelectWindData;
SelectorListModel * m_modelSelectSolarData;
SelectorListModel * m_modelSelectTemperatureData;
......
......@@ -5,11 +5,16 @@
#include <QHeaderView>
#include <QStyledItemDelegate>
PlantWidget::PlantWidget(ConventionalTableModel * cModel, StorageTableModel * stModel, WindTableModel * wModel, SolarTableModel * soModel, SelectorListModel * pvModules, QWidget *parent) : QWidget(parent),
PlantWidget::PlantWidget(ConventionalTableModel * cModel, StorageTableModel * stModel,
WindTableModel * wModel, SolarTableModel * soModel,
BiomassTableModel * bModel, CSPTableModel * cspModel,
SelectorListModel * pvModules, QWidget *parent) : QWidget(parent),
m_modelConventional(cModel),
m_modelStorage(stModel),
m_modelWind(wModel),
m_modelSolar(soModel)
m_modelPV(soModel),
m_modelBiomass(bModel),
m_modelCSP(cspModel)
{
QVBoxLayout * mainLayout = new QVBoxLayout();
......@@ -19,6 +24,11 @@ PlantWidget::PlantWidget(ConventionalTableModel * cModel, StorageTableModel * st
m_btnSwitchDisplayMode = new QPushButton("Switch to Economics", this);
m_btnSwitchDisplayMode->setCheckable(true);
QPixmap plusPix(":/buttons/icons/plusAdd.png");
QIcon plusIcon(plusPix);
QPixmap minusPix(":/buttons/icons/minusRemove.png");
QIcon minusIcon(minusPix);
QLabel * labelConventional = new QLabel("Conventional Power Plants");
labelConventional->setFont(fontLabel);
labelConventional->setAlignment(Qt::AlignLeft);
......@@ -43,7 +53,7 @@ PlantWidget::PlantWidget(ConventionalTableModel * cModel, StorageTableModel * st
m_viewStorage->setObjectName("StorageTableView");
m_viewStorage->horizontalHeader()->setItemDelegate(headerDelegate);
QLabel * labelWind = new QLabel("Wind Turbines");
QLabel * labelWind = new QLabel("Wind Parks");
labelWind->setFont(fontLabel);
labelWind->setAlignment(Qt::AlignLeft);
m_viewWind = new QTableView(this);
......@@ -54,68 +64,140 @@ PlantWidget::PlantWidget(ConventionalTableModel * cModel, StorageTableModel * st
m_viewWind->resizeColumnsToContents();
m_viewWind->setObjectName("WindTableView");
QLabel * labelSolar = new QLabel("PV Modules");
QLabel * labelSolar = new QLabel("PV Parks");
labelSolar->setFont(fontLabel);
labelSolar->setAlignment(Qt::AlignLeft);
m_viewSolar = new QTableView(this);
m_delegateSolar = new SolarTableDelegate(pvModules, m_viewSolar);
m_viewSolar->setModel(m_modelSolar);
m_viewSolar->horizontalHeader()->setStretchLastSection(true);
m_viewSolar->setItemDelegate(m_delegateSolar);
m_viewSolar->resizeColumnsToContents();
m_viewSolar->setObjectName("SolarTableView");
m_viewPV = new QTableView(this);
m_delegatePV = new SolarTableDelegate(pvModules, m_viewPV);
m_viewPV->setModel(m_modelPV);
m_viewPV->horizontalHeader()->setStretchLastSection(true);
m_viewPV->setItemDelegate(m_delegatePV);
m_viewPV->resizeColumnsToContents();
m_viewPV->setObjectName("PVTableView");
QLabel * labelBiomass = new QLabel("Biomass Plants");
labelBiomass->setFont(fontLabel);
labelBiomass->setAlignment(Qt::AlignLeft);
m_viewBiomass = new QTableView(this);
m_delegateBiomass = new PlantTableDelegate("Efficiency Power Block", m_viewBiomass);
m_viewBiomass->setModel(m_modelBiomass);
m_viewBiomass->horizontalHeader()->setStretchLastSection(true);
m_viewBiomass->setItemDelegate(m_delegateBiomass);
m_viewBiomass->resizeColumnsToContents();
m_viewBiomass->setObjectName("BiomassTableView");
QLabel * labelCSP = new QLabel("CSP Plants");
labelCSP->setFont(fontLabel);
labelCSP->setAlignment(Qt::AlignLeft);
m_viewCSP = new QTableView(this);
m_delegateCSP = new CSPTableDelegate(m_viewCSP);
m_viewCSP->setModel(m_modelCSP);
m_viewCSP->horizontalHeader()->setStretchLastSection(true);
m_viewCSP->setItemDelegate(m_delegateCSP);
m_viewCSP->resizeColumnsToContents();
m_viewCSP->setObjectName("CSPTableView");
QHBoxLayout * buttonLayoutConventional = new QHBoxLayout;
QSpacerItem * buttonSpaceConventional = new QSpacerItem(100, 1, QSizePolicy::Expanding);
m_btnNewItemConventional = new QPushButton("New Item");
m_btnNewItemConventional->setMaximumWidth(150);
m_btnRemoveItemConventional = new QPushButton("Remove Item");
m_btnRemoveItemConventional->setMaximumWidth(150);
m_btnNewItemConventional = new QPushButton(this);
m_btnNewItemConventional->setIcon(plusIcon);
m_btnNewItemConventional->setIconSize(QSize(16,16));
m_btnNewItemConventional->setFlat(true);
m_btnRemoveItemConventional = new QPushButton(this);
m_btnRemoveItemConventional->setIcon(minusIcon);
m_btnRemoveItemConventional->setIconSize(QSize(16,16));
m_btnRemoveItemConventional->setFlat(true);
buttonLayoutConventional->addSpacerItem(buttonSpaceConventional);
buttonLayoutConventional->addWidget(m_btnNewItemConventional, 0, Qt::AlignRight);
buttonLayoutConventional->addWidget(m_btnRemoveItemConventional, 0, Qt::AlignRight);
QHBoxLayout * buttonLayoutStorage = new QHBoxLayout;
QSpacerItem * buttonSpaceStorage = new QSpacerItem(100, 1, QSizePolicy::Expanding);
m_btnNewItemStorage = new QPushButton("New Item");
m_btnNewItemStorage->setMaximumWidth(150);
m_btnRemoveItemStorage = new QPushButton("Remove Item");
m_btnRemoveItemStorage->setMaximumWidth(150);
m_btnNewItemStorage = new QPushButton(this);
m_btnNewItemStorage->setIcon(plusIcon);
m_btnNewItemStorage->setIconSize(QSize(16,16));
m_btnNewItemStorage->setFlat(true);
m_btnRemoveItemStorage = new QPushButton(this);
m_btnRemoveItemStorage->setIcon(minusIcon);
m_btnRemoveItemStorage->setIconSize(QSize(16,16));
m_btnRemoveItemStorage->setFlat(true);
buttonLayoutStorage->addSpacerItem(buttonSpaceStorage);
buttonLayoutStorage->addWidget(m_btnNewItemStorage, 0, Qt::AlignRight);
buttonLayoutStorage->addWidget(m_btnRemoveItemStorage, 0, Qt::AlignRight);
QHBoxLayout * buttonLayoutWind = new QHBoxLayout;
QSpacerItem * buttonSpaceWind = new QSpacerItem(100, 1, QSizePolicy::Expanding);
m_btnNewItemWind = new QPushButton("New Item");
m_btnNewItemWind->setMaximumWidth(150);
m_btnRemoveItemWind = new QPushButton("Remove Item");
m_btnRemoveItemWind->setMaximumWidth(150);
m_btnNewItemWind = new QPushButton(this);
m_btnNewItemWind->setIcon(plusIcon);
m_btnNewItemWind->setIconSize(QSize(16,16));
m_btnNewItemWind->setFlat(true);
m_btnRemoveItemWind = new QPushButton(this);
m_btnRemoveItemWind->setIcon(minusIcon);
m_btnRemoveItemWind->setIconSize(QSize(16,16));
m_btnRemoveItemWind->setFlat(true);
buttonLayoutWind->addSpacerItem(buttonSpaceWind);
buttonLayoutWind->addWidget(m_btnNewItemWind, 0, Qt::AlignRight);
buttonLayoutWind->addWidget(m_btnRemoveItemWind, 0, Qt::AlignRight);
QHBoxLayout * buttonLayoutSolar = new QHBoxLayout;
QSpacerItem * buttonSpaceSolar = new QSpacerItem(100, 1, QSizePolicy::Expanding);
m_btnNewItemSolar = new QPushButton("New Item");
m_btnNewItemSolar->setMaximumWidth(150);
m_btnRemoveItemSolar = new QPushButton("Remove Item");
m_btnRemoveItemSolar->setMaximumWidth(150);
m_btnNewItemSolar = new QPushButton(this);
m_btnNewItemSolar->setIcon(plusIcon);
m_btnNewItemSolar->setIconSize(QSize(16,16));
m_btnNewItemSolar->setFlat(true);
m_btnRemoveItemSolar = new QPushButton(this);
m_btnRemoveItemSolar->setIcon(minusIcon);
m_btnRemoveItemSolar->setIconSize(QSize(16,16));
m_btnRemoveItemSolar->setFlat(true);
buttonLayoutSolar->addSpacerItem(buttonSpaceSolar);
buttonLayoutSolar->addWidget(m_btnNewItemSolar, 0, Qt::AlignRight);
buttonLayoutSolar->addWidget(m_btnRemoveItemSolar, 0, Qt::AlignRight);
QHBoxLayout * buttonLayoutBiomass = new QHBoxLayout;
QSpacerItem * buttonSpaceBiomass = new QSpacerItem(100, 1, QSizePolicy::Expanding);
m_btnNewItemBiomass = new QPushButton(this);
m_btnNewItemBiomass->setIcon(plusIcon);
m_btnNewItemBiomass->setIconSize(QSize(16,16));
m_btnNewItemBiomass->setFlat(true);
m_btnRemoveItemBiomass = new QPushButton(this);
m_btnRemoveItemBiomass->setIcon(minusIcon);
m_btnRemoveItemBiomass->setIconSize(QSize(16,16));
m_btnRemoveItemBiomass->setFlat(true);
buttonLayoutBiomass->addSpacerItem(buttonSpaceBiomass);
buttonLayoutBiomass->addWidget(m_btnNewItemBiomass, 0, Qt::AlignRight);
buttonLayoutBiomass->addWidget(m_btnRemoveItemBiomass, 0, Qt::AlignRight);
QHBoxLayout * buttonLayoutCSP = new QHBoxLayout;
QSpacerItem * buttonSpaceCSP = new QSpacerItem(100, 1, QSizePolicy::Expanding);
m_btnNewItemCSP = new QPushButton(this);
m_btnNewItemCSP->setIcon(plusIcon);
m_btnNewItemCSP->setIconSize(QSize(16,16));
m_btnNewItemCSP->setFlat(true);
m_btnRemoveItemCSP = new QPushButton(this);
m_btnRemoveItemCSP->setIcon(minusIcon);
m_btnRemoveItemCSP->setIconSize(QSize(16,16));
m_btnRemoveItemCSP->setFlat(true);
buttonLayoutCSP->addSpacerItem(buttonSpaceCSP);
buttonLayoutCSP->addWidget(m_btnNewItemCSP, 0, Qt::AlignRight);
buttonLayoutCSP->addWidget(m_btnRemoveItemCSP, 0, Qt::AlignRight);
QHBoxLayout * renewableLayout = new QHBoxLayout();
QVBoxLayout * windLayout = new QVBoxLayout();
QVBoxLayout * solarLayout = new QVBoxLayout();
windLayout->addWidget(labelWind);
windLayout->addWidget(m_viewWind);
windLayout->addLayout(buttonLayoutWind);
solarLayout->addWidget(labelSolar);
solarLayout->addWidget(m_viewSolar);
solarLayout->addLayout(buttonLayoutSolar);
renewableLayout->addLayout(windLayout);
renewableLayout->addLayout(solarLayout);
QVBoxLayout * bottomLeftLayout = new QVBoxLayout();
QVBoxLayout * bottomRightLayout = new QVBoxLayout();
bottomLeftLayout->addWidget(labelWind);
bottomLeftLayout->addWidget(m_viewWind);
bottomLeftLayout->addLayout(buttonLayoutWind);
bottomLeftLayout->addWidget(labelBiomass);
bottomLeftLayout->addWidget(m_viewBiomass);
bottomLeftLayout->addLayout(buttonLayoutBiomass);
bottomRightLayout->addWidget(labelSolar);
bottomRightLayout->addWidget(m_viewPV);
bottomRightLayout->addLayout(buttonLayoutSolar);
bottomRightLayout->addWidget(labelCSP);
bottomRightLayout->addWidget(m_viewCSP);
bottomRightLayout->addLayout(buttonLayoutCSP);
renewableLayout->addLayout(bottomLeftLayout);
renewableLayout->addLayout(bottomRightLayout);
mainLayout->addWidget(m_btnSwitchDisplayMode, 0, Qt::AlignLeft);
......@@ -129,28 +211,38 @@ PlantWidget::PlantWidget(ConventionalTableModel * cModel, StorageTableModel * st
mainLayout->addLayout(renewableLayout);
connect(m_btnSwitchDisplayMode, SIGNAL(clicked(bool)),
this, SLOT(onDisplayModeToggled(bool)));
connect(m_btnSwitchDisplayMode, &QPushButton::clicked,
this, &PlantWidget::onDisplayModeToggled);
connect(m_btnNewItemConventional, &QPushButton::released,
this, &PlantWidget::onNewConventionalItemClicked);
connect(m_btnRemoveItemConventional, &QPushButton::released,
this, &PlantWidget::onRemoveConventionalItemClicked);
connect(m_btnNewItemStorage, &QPushButton::released,
this, &PlantWidget::onNewStorageItemClicked);
connect(m_btnRemoveItemStorage, &QPushButton::released,
this, &PlantWidget::onRemoveStorageItemClicked);
connect(m_btnNewItemConventional, SIGNAL(clicked(bool)),
this, SLOT(onNewConventionalItemClicked(bool)));
connect(m_btnRemoveItemConventional, SIGNAL(clicked(bool)),
this, SLOT(onRemoveConventionalItemClicked(bool)));
connect(m_btnNewItemWind, &QPushButton::released,
this, &PlantWidget::onNewWindItemClicked);
connect(m_btnRemoveItemWind, &QPushButton::released,
this, &PlantWidget::onRemoveWindItemClicked);
connect(m_btnNewItemStorage, SIGNAL(clicked(bool)),
this, SLOT(onNewStorageItemClicked(bool)));
connect(m_btnRemoveItemStorage, SIGNAL(clicked(bool)),
this, SLOT(onRemoveStorageItemClicked(bool)));
connect(m_btnNewItemSolar, &QPushButton::released,
this, &PlantWidget::onNewSolarItemClicked);
connect(m_btnRemoveItemSolar, &QPushButton::released,
this, &PlantWidget::onRemoveSolarItemClicked);
connect(m_btnNewItemWind, SIGNAL(clicked(bool)),
this, SLOT(onNewWindItemClicked(bool)));
connect(m_btnRemoveItemWind, SIGNAL(clicked(bool)),
this, SLOT(onRemoveWindItemClicked(bool)));
connect(m_btnNewItemBiomass, &QPushButton::released,
this, &PlantWidget::onNewBiomassItemClicked);
connect(m_btnRemoveItemBiomass, &QPushButton::released,
this, &PlantWidget::onRemoveBiomassItemClicked);
connect(m_btnNewItemSolar, SIGNAL(clicked(bool)),
this, SLOT(onNewSolarItemClicked(bool)));
connect(m_btnRemoveItemSolar, SIGNAL(clicked(bool)),
this, SLOT(onRemoveSolarItemClicked(bool)));
connect(m_btnNewItemCSP, &QPushButton::released,
this, &PlantWidget::onNewCSPItemClicked);
connect(m_btnRemoveItemCSP, &QPushButton::released,
this, &PlantWidget::onRemoveCSPItemClicked);
this->setMinimumWidth(600);
this->setMinimumHeight(338);
......@@ -176,8 +268,18 @@ QString PlantWidget::copyFromTable(QString tableName)
}
else if (tableName == "SolarTableView")
{
QItemSelectionModel * selModel = m_viewSolar->selectionModel();
return m_modelSolar->copyText(selModel->selectedIndexes());
QItemSelectionModel * selModel = m_viewPV->selectionModel();
return m_modelPV->copyText(selModel->selectedIndexes());
}
else if (tableName == "BiomassTableView")
{
QItemSelectionModel * selModel = m_viewBiomass->selectionModel();
return m_modelBiomass->copyText(selModel->selectedIndexes());
}
else if (tableName == "CSPTableView")
{
QItemSelectionModel * selModel = m_viewCSP->selectionModel();
return m_modelCSP->copyText(selModel->selectedIndexes());
}
return "";
}
......@@ -198,7 +300,15 @@ void PlantWidget::pasteToTable(QString pasteText, QString tableName)
}
else if (tableName == "SolarTableView")
{
m_modelSolar->pasteText(m_viewSolar->currentIndex(), pasteText);
m_modelPV->pasteText(m_viewPV->currentIndex(), pasteText);
}
else if (tableName == "BiomassTableView")
{
m_modelBiomass->pasteText(m_viewBiomass->currentIndex(), pasteText);
}
else if (tableName == "CSPTableView")
{
m_modelCSP->pasteText(m_viewCSP->currentIndex(), pasteText);
}
}
......@@ -208,18 +318,18 @@ void PlantWidget::onDisplayModeToggled(bool checkState)
m_modelConventional->showEconomics(checkState);
m_modelStorage->showEconomics(checkState);
m_modelWind->showEconomics(checkState);
m_modelSolar->showEconomics(checkState);
m_modelPV->showEconomics(checkState);
m_modelBiomass->showEconomics(checkState);
m_modelCSP->showEconomics(checkState);
}
void PlantWidget::onNewConventionalItemClicked(bool clicked)
void PlantWidget::onNewConventionalItemClicked()
{
Q_UNUSED(clicked);
m_modelConventional->addItem(ConventionalTableItem());
}
void PlantWidget::onRemoveConventionalItemClicked(bool clicked)
void PlantWidget::onRemoveConventionalItemClicked()
{
Q_UNUSED(clicked);
QModelIndex index = m_viewConventional->currentIndex();
if (index != QModelIndex())
{
......@@ -227,15 +337,13 @@ void PlantWidget::onRemoveConventionalItemClicked(bool clicked)
}
}
void PlantWidget::onNewStorageItemClicked(bool clicked)
void PlantWidget::onNewStorageItemClicked()
{
Q_UNUSED(clicked);
m_modelStorage->addItem(StorageTableItem());
}
void PlantWidget::onRemoveStorageItemClicked(bool clicked)
void PlantWidget::onRemoveStorageItemClicked()
{
Q_UNUSED(clicked);
QModelIndex index = m_viewStorage->currentIndex();
if (index != QModelIndex())
{
......@@ -243,15 +351,13 @@ void PlantWidget::onRemoveStorageItemClicked(bool clicked)
}
}
void PlantWidget::onNewWindItemClicked(bool clicked)
void PlantWidget::onNewWindItemClicked()
{
Q_UNUSED(clicked);
m_modelWind->addItem(WindTableItem());
}
void PlantWidget::onRemoveWindItemClicked(bool clicked)
void PlantWidget::onRemoveWindItemClicked()
{
Q_UNUSED(clicked);
QModelIndex index = m_viewWind->currentIndex();
if (index != QModelIndex())
{
......@@ -259,19 +365,45 @@ void PlantWidget::onRemoveWindItemClicked(bool clicked)
}
}
void PlantWidget::onNewSolarItemClicked(bool clicked)
void PlantWidget::onNewSolarItemClicked()
{
m_modelPV->addItem(SolarTableItem());
}
void PlantWidget::onRemoveSolarItemClicked()
{
QModelIndex index = m_viewPV->currentIndex();
if (index != QModelIndex())
{
m_modelPV->removeItem(index);
}
}
void PlantWidget::onNewBiomassItemClicked()
{
m_modelBiomass->addItem(BiomassTableItem());
}
void PlantWidget::onRemoveBiomassItemClicked()
{
QModelIndex index = m_viewBiomass->currentIndex();
if (index != QModelIndex())
{
m_modelBiomass->removeItem(index);
}
}
void PlantWidget::onNewCSPItemClicked()
{
Q_UNUSED(clicked);
m_modelSolar->addItem(SolarTableItem());
m_modelCSP->addItem(CSPTableItem());
}
void PlantWidget::onRemoveSolarItemClicked(bool clicked)
void PlantWidget::onRemoveCSPItemClicked()
{
Q_UNUSED(clicked);
QModelIndex index = m_viewSolar->currentIndex();
QModelIndex index = m_viewCSP->currentIndex();
if (index != QModelIndex())
{
m_modelSolar->removeItem(index);
m_modelCSP->removeItem(index);
}
}
......@@ -280,6 +412,21 @@ void PlantWidget::disableAll()
m_viewConventional->setEnabled(false);
m_btnNewItemConventional->setEnabled(false);
m_btnRemoveItemConventional->setEnabled(false);
m_viewStorage->setEnabled(false);
m_btnNewItemStorage->setEnabled(false);
m_btnRemoveItemStorage->setEnabled(false);
m_viewWind->setEnabled(false);
m_btnNewItemWind->setEnabled(false);
m_btnRemoveItemWind->setEnabled(false);
m_viewPV->setEnabled(false);
m_btnNewItemSolar->setEnabled(false);
m_btnRemoveItemSolar->setEnabled(false);
m_viewBiomass->setEnabled(false);
m_btnNewItemBiomass->setEnabled(false);
m_btnRemoveItemBiomass->setEnabled(false);
m_viewCSP->setEnabled(false);
m_btnNewItemCSP->setEnabled(false);
m_btnRemoveItemCSP->setEnabled(false);
}
void PlantWidget::enableAll()
......@@ -287,5 +434,20 @@ void PlantWidget::enableAll()
m_viewConventional->setEnabled(true);
m_btnNewItemConventional->setEnabled(true);
m_btnRemoveItemConventional->setEnabled(true);
m_viewStorage->setEnabled(true);
m_btnNewItemStorage->setEnabled(true);
m_btnRemoveItemStorage->setEnabled(true);
m_viewWind->setEnabled(true);
m_btnNewItemWind->setEnabled(true);
m_btnRemoveItemWind->setEnabled(true);
m_viewPV->setEnabled(true);
m_btnNewItemSolar->setEnabled(true);
m_btnRemoveItemSolar->setEnabled(true);
m_viewBiomass->setEnabled(true);
m_btnNewItemBiomass->setEnabled(true);
m_btnRemoveItemBiomass->setEnabled(true);
m_viewCSP->setEnabled(true);
m_btnNewItemCSP->setEnabled(true);
m_btnRemoveItemCSP->setEnabled(true);
}
......@@ -28,13 +28,22 @@
#include "../Models/StorageTableModel.h"
#include "../Models/WindTableModel.h"
#include "../Models/SolarTableModel.h"
#include "../Models/BiomassTableModel.h"
#include "../Models/CSPTableModel.h"
#include "../Models/SelectorListModel.h"
class PlantWidget : public QWidget
{
Q_OBJECT
public:
explicit PlantWidget(ConventionalTableModel * cModel, StorageTableModel * stModel, WindTableModel * wModel, SolarTableModel * soModel, SelectorListModel * pvModules, QWidget * parent = 0);
explicit PlantWidget(ConventionalTableModel * cModel,
StorageTableModel * stModel,
WindTableModel * wModel,
SolarTableModel * soModel,
BiomassTableModel * bModel,
CSPTableModel * cspModel,
SelectorListModel * pvModules,
QWidget * parent = nullptr);
QString copyFromTable(QString tableName);
void pasteToTable(QString pasteText, QString tableName);
......@@ -43,14 +52,18 @@ signals:
public slots:
void onDisplayModeToggled(bool checkState);
void onNewConventionalItemClicked(bool clicked);
void onRemoveConventionalItemClicked(bool clicked);
void onNewStorageItemClicked(bool clicked);
void onRemoveStorageItemClicked(bool clicked);
void onNewWindItemClicked(bool clicked);
void onRemoveWindItemClicked(bool clicked);
void onNewSolarItemClicked(bool clicked);
void onRemoveSolarItemClicked(bool clicked);
void onNewConventionalItemClicked();
void onRemoveConventionalItemClicked();
void onNewStorageItemClicked();
void onRemoveStorageItemClicked();
void onNewWindItemClicked();
void onRemoveWindItemClicked();
void onNewSolarItemClicked();
void onRemoveSolarItemClicked();
void onNewBiomassItemClicked();
void onRemoveBiomassItemClicked();
void onNewCSPItemClicked();
void onRemoveCSPItemClicked();
void disableAll();
void enableAll();
......@@ -67,9 +80,17 @@ private:
WindTableModel * m_modelWind;
PlantTableDelegate * m_delegateWind;
QTableView * m_viewSolar;
SolarTableModel * m_modelSolar;
SolarTableDelegate * m_delegateSolar;
QTableView * m_viewPV;
SolarTableModel * m_modelPV;
SolarTableDelegate * m_delegatePV;
QTableView * m_viewBiomass;
BiomassTableModel * m_modelBiomass;
PlantTableDelegate * m_delegateBiomass;
QTableView * m_viewCSP;
CSPTableModel * m_modelCSP;
CSPTableDelegate * m_delegateCSP;
QPushButton * m_btnSwitchDisplayMode;
......@@ -84,6 +105,12 @@ private:
QPushButton * m_btnNewItemSolar;
QPushButton * m_btnRemoveItemSolar;
QPushButton * m_btnNewItemBiomass;
QPushButton * m_btnRemoveItemBiomass;