#include "simulationresults.h"
#include "simulationgraphicview.h"



typedef QList<QGraphicsItem*> GraphicsItemList;

/////////////////////////////////////////////////////////////////////////////////////////////////
SimulationResults::SimulationResults(QWidget *parent)
: QDialog(parent)
{
	ui.setupUi(this);

	connect(ui.okBtn, SIGNAL(clicked(bool)), this, SLOT(accept()));
}

SimulationResults::~SimulationResults()
{
}

void SimulationResults::setGraphics(SimulationGraphicList graphs)
{
	int count = 0;
	for(SimulationGraphicList::iterator it = graphs.begin(); it != graphs.end(); it++) {
		SimulationGraphic *graph = *it;

		count++;

		SimulationGraphicCurveList lines = graph->curves();

		QString title = graph->title();

		if(title.isEmpty()) {
			title = QString(tr("Graph %1").arg(count));
		}

		SimulationGraphicView *graphView = new SimulationGraphicView(ui.graphsTab);
		ui.graphsTab->addTab(graphView, title);

		if(count == 1) {
			ui.graphsTab->removeTab(0);
		}

		graphView->setGraphic(graph);
	}
}

