summaryrefslogtreecommitdiff
path: root/cad/plugins/NanoVision-1/src/InputParametersWindow.cpp
blob: 39a4eb17e5686931a39d5542c2d8626382c36c93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2007 Nanorex, Inc.  See LICENSE file for details.

#include "InputParametersWindow.h"


/* CONSTRUCTOR */
InputParametersWindow::InputParametersWindow(const QString& filename,
											 NXProperties* properties,
											 QWidget *parent)
		: DataWindow(parent), Ui_InputParametersWindow() {
	
	setupUi(this);
	QString title = tr("Input Parameters - %1").arg(filename);
	setWindowTitle(title);
	setWindowFlags(Qt::Dialog | Qt::Tool);
	
	if (properties == NULL) {
		textEdit->insertHtml(tr("<i><b>Input Parameters</b><br>No input parameters found.</i>"));
		
	} else {
		QString html =
			QString("<i><b>Input Parameters</b></i><br><table border=0 cellspacing=0 cellpadding=0>");
		vector<string> keys = properties->getPropertyKeys();
		vector<string>::iterator iter = keys.begin();
		string key, value, units;
		while (iter != keys.end()) {
			key = *iter;
			value = properties->getProperty(*iter);
			formatParameter(key, value, units);
			html.append
				(tr("<tr><td align=right><b>%1: </b></td>%2 %3</tr>")
					.arg(key.c_str()).arg(value.c_str()).arg(units.c_str()));
			iter++;
		}
		html.append("</table>");
		textEdit->setHtml(html);
	}
}


/* DESTRUCTOR */
InputParametersWindow::~InputParametersWindow() {
}