summaryrefslogtreecommitdiff
path: root/cad/plugins/NanoVision-1/src/ResultsWindow.h
blob: ad20cd221af012c9936fb795623828a154f85186 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
// Copyright 2007 Nanorex, Inc.  See LICENSE file for details.

#ifndef RESULTSWINDOW_H
#define RESULTSWINDOW_H

#include <QtGui>
#include <QFile>
#include <QWidget>
#include <QObject>
#include <QFileInfo>
#include <QWorkspace>
#include <QTreeWidget>
#include <QMainWindow>
#include <QDockWidget>
#include <QMessageBox>
#include <QCloseEvent>
#include <QApplication>

#include "Nanorex/Interface/NXEntityManager.h"
#include "Nanorex/Interface/NXGraphicsManager.h"
using namespace Nanorex;

#include "ui_ResultsWindow.h"
#include "DataWindow.h"
#include "ErrorDialog.h"
#include "ResultsSummaryWindow.h"
#include "InputParametersWindow.h"
#include "StructureGraphicsWindow.h"
#include "TrajectoryGraphicsWindow.h"


// forward decl
class StructureGraphicsTreeItem;

/* CLASS: ResultsWindow */
class ResultsWindow : public QWidget, private Ui_ResultsWindow {
	Q_OBJECT;
	
public:
	QWorkspace* workspace;
	QSignalMapper* windowMapper;
	NXEntityManager* entityManager;
	NXGraphicsManager* graphicsManager;
	
	ResultsWindow(NXEntityManager* entityManager,
	              NXGraphicsManager* graphicsManager,
	              QWidget* parent = 0);
	~ResultsWindow();
	
	bool loadFile(const QString &fileName);
	bool closeFile(void);
	
	QString userFriendlyCurrentFile();
	QString currentFile() { return curFile; }
	DataWindow* activeDataWindow();
	
	private slots:
		void resultsTreeItemDoubleClicked(QTreeWidgetItem* treeWidgetItem,
										  int column);
	private:
		QString curFile;
		
		QTreeWidget *resultsTree;
		QIcon resultsTreeIcon;
		QIcon nh5FileIcon;
		QIcon mmpFileIcon;
		QIcon atomIcon;
		QIcon atomSetIcon;
		QIcon inputParametersIcon;
		QIcon inputFilesIcon;
		QIcon inputFileIcon;
		QIcon resultsIcon;
		QIcon resultsTrajectoriesIcon;
		
		void setCurrentFile(const QString &fileName);
		QString strippedName(const QString &fullFileName);
		
		bool isMMPFile(std::string const& filename);
		
        void setupResultsTree(void);
		void setupSingleStructureTree(void);
		void setupSimulationResultsTree(void);
		StructureGraphicsTreeItem*
		setupMoleculeSetResultsSubtree(NXMoleculeSet *molSetPtr,
		                               QTreeWidgetItem *const molSetItem);
    // void setupMoleculeSetResultsSubtree_helper
    // 	(NXMoleculeSet *molSetPtr, QTreeWidgetItem *const molSetItem);	
};


/* CLASS: DataWindowTreeItem */
class DataWindowTreeItem : public QObject, public QTreeWidgetItem {
	
	Q_OBJECT;
	
public:
	DataWindowTreeItem(ResultsWindow* resultsWindow,
	                   QTreeWidget* treeWidget);
	DataWindowTreeItem(ResultsWindow* resultsWindow,
	                   QTreeWidgetItem* treeWidgetItem);
	virtual ~DataWindowTreeItem();
	
	virtual void showWindow() = 0;
	
public slots:
	virtual void refresh();
	
protected:
	ResultsWindow* resultsWindow;
};


/* CLASS: InputParametersTreeItem */
class InputParametersTreeItem : public DataWindowTreeItem {

	public:
		InputParametersTreeItem(ResultsWindow* resultsWindow,
								QTreeWidgetItem* treeWidgetItem);
		~InputParametersTreeItem();
		
		void showWindow();
		
	private:
		InputParametersWindow* inputParametersWindow;
};


/* CLASS: ResultsSummaryTreeItem */
class ResultsSummaryTreeItem : public QWidget, public DataWindowTreeItem {
	
	Q_OBJECT;
	
public:
	ResultsSummaryTreeItem(ResultsWindow* resultsWindow,
	                       QTreeWidgetItem* treeWidgetItem);
	~ResultsSummaryTreeItem();
	
	void showWindow();
	void setTrajectoryId(int trajectoryId) {
		this->trajectoryId = trajectoryId;
	}
	
public slots:
	void refresh();
	
private:
	int trajectoryId;
	ResultsSummaryWindow* resultsSummaryWindow;
	
	QIcon resultsSummaryIcon;
	QIcon resultsSummaryIcon2;
};


/* CLASS: StructureGraphicsTreeItem */
class StructureGraphicsTreeItem : public DataWindowTreeItem {
	
public:
	StructureGraphicsTreeItem(NXMoleculeSet *theMolSetPtr,
	                          ResultsWindow* theResultsWindow,
	                          QTreeWidgetItem* treeWidgetItem);
	StructureGraphicsTreeItem(OBMol *theMolPtr,
	                          ResultsWindow* resultsWindow,
	                          QTreeWidgetItem* treeWidgetItem);
	~StructureGraphicsTreeItem();
	
	void showWindow();
	
private:
	NXMoleculeSet *molSetPtr;
	ResultsWindow *resultsWindow;
	bool const deleteOnDestruct;
	StructureGraphicsWindow* structureWindow;
};


/* CLASS: TrajectoryGraphicsTreeItem */
class TrajectoryGraphicsTreeItem : public DataWindowTreeItem {
	
public:
	TrajectoryGraphicsTreeItem(const string& trajectoryName,
	                           ResultsWindow* theResultsWindow,
	                           QTreeWidgetItem* treeWidgetItem);
	~TrajectoryGraphicsTreeItem();
	
	void showWindow();
	
private:
	string trajectoryName;
	ResultsWindow *resultsWindow;
	TrajectoryGraphicsWindow* trajWindow;
};


#endif