parameterMainWindow.cpp 16.4 KB
Newer Older
Edlira Nano's avatar
Edlira Nano committed
1
#include <QMenuBar>
Edlira Nano's avatar
Edlira Nano committed
2
3
4
5
6
#include <QFileDialog>
#include <QMessageBox>
#include <QDockWidget>
#include <QApplication>
#include <QCloseEvent>
7
#include <QScrollArea>
8
9
#include <QDialog>
#include <QTextEdit>
Edlira Nano's avatar
Edlira Nano committed
10

11
#include "parameterMainWindow.h"
12
#include "quantificationwidget/masschroqml_selection_widget.h"
13
#include "quantificationwidget/xicSelectionWidget.h"
14
#include "quantificationwidget/peptideSelectionWidget.h"
15
16
17
18
#include "quantificationwidget/filterBackgroundWidget.h"
#include "quantificationwidget/filterSpikeWidget.h"
#include "quantificationwidget/detectionZivyWidget.h"
#include "engine/masschroq_gui_engin.h"
19
#include "quantificationwidget/msrun_selection_widget.h"
Benoit Valot's avatar
Benoit Valot committed
20
21
#include "alignementwidget/obiwarp_alignment_widget.h"
#include "alignementwidget/ms2_alignment_widget.h"
Olivier Langella's avatar
Olivier Langella committed
22
#include "../lib/consoleout.h"
Benoit Valot's avatar
Benoit Valot committed
23
#include "dom_methods/masschroqDomDocument.h"
24
#include "logQIODevice.h"
25

26
ParameterMainWindow::ParameterMainWindow(QWidget *parent) :
27
		QMainWindow(parent) {
Olivier Langella's avatar
Olivier Langella committed
28
	QFileInfo mcq_icon;
29
	mcq_icon.setFile(MASSCHROQ_ICON);
Olivier Langella's avatar
Olivier Langella committed
30
	if (mcq_icon.exists()) {
31
32
33
34
35
36
37
38
		setWindowIcon(QIcon(mcq_icon.filePath()));
	} else {
		QString mcq_icon_current(QApplication::applicationDirPath());
		mcq_icon_current.append("/").append(mcq_icon.fileName());
		mcq_icon.setFile(mcq_icon_current);
		if (mcq_icon.exists()) {
			setWindowIcon(QIcon(mcq_icon.filePath()));
		}
Olivier Langella's avatar
Olivier Langella committed
39
	}
40

41
	dock = 0;
42
	_dockLog = 0;
43
	_plot_area = 0;
Benoit Valot's avatar
Benoit Valot committed
44
45
	_plot_area_aligned = 0;
	_logQTextEdit = 0;
46
47
48
49
50
51

	//Add menus and Actions
	LoadFileMenus();

	QTextEdit * welcomeMessage = new QTextEdit(this);
	QString message;
52
	message.append("<p><b>Welcome to the MassChroq Studio application</b></p>");
Benoit Valot's avatar
Benoit Valot committed
53
54
	message.append(
			"<p>This application helps you to test parameters before starting masschroq analysis</p>");
55
	message.append("<p>Please select one of the workspace to evaluate :");
Benoit Valot's avatar
Benoit Valot committed
56
57
	message.append(
			"<ul><li>Quantification (file->workspace->quantification)</li>");
58
59
60
61
	message.append("<li>Alignment (file->workspace->Alignment)</li></ul></p>");
	welcomeMessage->setReadOnly(true);
	welcomeMessage->setText(message);
	this->setCentralWidget(welcomeMessage);
62

Benoit Valot's avatar
Benoit Valot committed
63
64
	this->setAttribute(Qt::WA_AlwaysShowToolTips, true);

65
	setWindowTitle(tr("MassChroQ Studio"));
Edlira Nano's avatar
Edlira Nano committed
66
67
68
69
	// cannot resize the main window to less than 200x200
	setMinimumSize(200, 200);
	// size at creation is 480x320
	resize(480, 320);
Edlira Nano's avatar
Edlira Nano committed
70
71
}

Benoit Valot's avatar
Benoit Valot committed
72
73
void ParameterMainWindow::ResetWorkspace() {
	qDebug() << "ResetWorkspace begin";
74
75
	//Remove older menu
	menuBar()->clear();
Benoit Valot's avatar
Benoit Valot committed
76
77
78
	if (_plot_area != 0) {
		delete (_plot_area);
		_plot_area = 0;
Benoit Valot's avatar
Benoit Valot committed
79
	}
Benoit Valot's avatar
Benoit Valot committed
80
81
82
	if (_plot_area_aligned != 0) {
		delete (_plot_area_aligned);
		_plot_area_aligned = 0;
83
	}
Olivier Langella's avatar
Olivier Langella committed
84
	qDebug() << "ResetWorkspace end";
Edlira Nano's avatar
Edlira Nano committed
85
}
Benoit Valot's avatar
Benoit Valot committed
86
87
void ParameterMainWindow::LoadFileMenus() {
	qDebug() << "LoadFileMenus begin";
88
89
	QMenu * _fileMenu = menuBar()->addMenu(tr("&File"));

90
	QMenu * _workscapeMenu = _fileMenu->addMenu(tr("&Workspace"));
Edlira Nano's avatar
Edlira Nano committed
91

92
93
	QAction * _quantiAct = new QAction(tr("&Quantification"), this);
	_quantiAct->setShortcut(tr("Ctrl+Q"));
Benoit Valot's avatar
Benoit Valot committed
94
95
96
97

	_quantiAct->setToolTip(tr("Load quantification workspace"));
	connect(_quantiAct, SIGNAL(triggered()), this,
			SLOT(LoadQuantificationWorkspace()));
98
	_workscapeMenu->addAction(_quantiAct);
Edlira Nano's avatar
Edlira Nano committed
99

100
101
	QAction * _alignAct = new QAction(tr("&Alignment"), this);
	_alignAct->setShortcut(tr("Ctrl+A"));
Benoit Valot's avatar
Benoit Valot committed
102
103
104
	_alignAct->setToolTip(tr("Load quantification workspace"));
	connect(_alignAct, SIGNAL(triggered()), this,
			SLOT(LoadAlignmentWorkspace()));
105
	_workscapeMenu->addAction(_alignAct);
Edlira Nano's avatar
Edlira Nano committed
106

107
108
109
110
	//_fileMenu->addAction(_loadMsrunAct);
	_fileMenu->addSeparator();
	QAction * _quitAct = new QAction(tr("&Quit"), this);
	_quitAct->setShortcuts(QKeySequence::Quit);
Benoit Valot's avatar
Benoit Valot committed
111
	_quitAct->setToolTip(tr("Quit MassChroQ GUI"));
112
113
	connect(_quitAct, SIGNAL(triggered()), this, SLOT(close()));
	_fileMenu->addAction(_quitAct);
Edlira Nano's avatar
Edlira Nano committed
114

Olivier Langella's avatar
Olivier Langella committed
115
	qDebug() << "LoadFileMenus end";
116
}
117

118
void ParameterMainWindow::LoadQuantificationWorkspace() {
Benoit Valot's avatar
Benoit Valot committed
119
	qDebug() << "Load quantification Workspace";
120
121
	this->ResetWorkspace();
	this->LoadFileMenus();
Benoit Valot's avatar
Benoit Valot committed
122
123
	qDebug() << "Load quantification Workspace 1";

124
125
126
	QMenu * _toolsMenu = menuBar()->addMenu(tr("&Tools"));
	QAction * extractionXicAct = new QAction(tr("&MsRun data (mzXML or mzML)"),
			this);
Benoit Valot's avatar
Benoit Valot committed
127
	extractionXicAct->setToolTip(tr("Select MsRun data mode to extracted XIC"));
128
129
130
	connect(extractionXicAct, SIGNAL(triggered()), this,
			SLOT(extractXicWidget()));
	_toolsMenu->addAction(extractionXicAct);
Edlira Nano's avatar
Edlira Nano committed
131

132
133
	QAction * masschroqmlXicAct = new QAction(tr("&Peptide data (masschroqML)"),
			this);
Benoit Valot's avatar
Benoit Valot committed
134
	masschroqmlXicAct->setToolTip(
135
136
137
138
			tr("Select MassChroqML resources and extracted XIC from peptide"));
	connect(masschroqmlXicAct, SIGNAL(triggered()), this,
			SLOT(masschroqmlXicWidget()));
	_toolsMenu->addAction(masschroqmlXicAct);
139

140
	_toolsMenu->addSeparator();
141

142
	QMenu * _filtersMenu = _toolsMenu->addMenu(tr("&Filter XIC"));
143

144
145
	QAction * _filterBackgroundAct = new QAction(tr("&Background filter"),
			this);
Benoit Valot's avatar
Benoit Valot committed
146
	_filterBackgroundAct->setToolTip(
147
148
149
			tr("Apply a backround noise removal filter to the XIC"));
	connect(_filterBackgroundAct, SIGNAL(triggered()), this,
			SLOT(filterBackgroundWidget()));
150
	_filtersMenu->addAction(_filterBackgroundAct);
Edlira Nano's avatar
Edlira Nano committed
151

152
	QAction *_filterSpikeAct = new QAction(tr("&Spike filter"), this);
Benoit Valot's avatar
Benoit Valot committed
153
	_filterSpikeAct->setToolTip(tr("Apply a spike removal filter to the XIC"));
154
155
	connect(_filterSpikeAct, SIGNAL(triggered()), this,
			SLOT(filterSpikeWidget()));
156
157
158
	_filtersMenu->addAction(_filterSpikeAct);

	_toolsMenu->addSeparator();
159

160
161
162
	QMenu * _detectionsMenu = _toolsMenu->addMenu(tr("&Detect peaks"));

	QAction * _detectionZivyAct = new QAction(tr("&Zivy peak detection"), this);
Benoit Valot's avatar
Benoit Valot committed
163
	_detectionZivyAct->setToolTip(
164
165
166
			tr("Detect peaks on XIC with the Zivy method"));
	connect(_detectionZivyAct, SIGNAL(triggered()), this,
			SLOT(detectionZivyWidget()));
167
168
	_detectionsMenu->addAction(_detectionZivyAct);

Benoit Valot's avatar
Benoit Valot committed
169
170
171
172
173
174
175
	_toolsMenu->addSeparator();

	QAction * _exportAct = new QAction(tr("&Export method"), this);
	connect(_exportAct, SIGNAL(triggered()), this,
			SLOT(exportXmlQuantificationMethod()));
	_toolsMenu->addAction(_exportAct);

176
	QMenu * _helpMenu = menuBar()->addMenu(tr("&Help"));
177

178
	QAction * _aboutAct = new QAction(tr("&About"), this);
Benoit Valot's avatar
Benoit Valot committed
179
	_aboutAct->setToolTip(tr("About MassChroQ GUI"));
Edlira Nano's avatar
Edlira Nano committed
180
	connect(_aboutAct, SIGNAL(triggered()), this, SLOT(about()));
181
182
	_helpMenu->addAction(_aboutAct);

Benoit Valot's avatar
Benoit Valot committed
183
184
185
186
	qDebug() << "Load quantification Workspace 2";

	qDebug() << "QCoreApplication argc "
			<< QCoreApplication::instance()->argc();
187
188
189
	// Central Widget
	_plot_area = new Plot(this);
	this->setCentralWidget(_plot_area);
Olivier Langella's avatar
Olivier Langella committed
190
	qDebug() << "setCentralWidget after";
Benoit Valot's avatar
Benoit Valot committed
191
192

	qDebug() << "Load quantification Workspace 3";
193
194
	//Add dock
	this->extractXicWidget();
Olivier Langella's avatar
Olivier Langella committed
195
	qDebug() << "LoadQuantificationWorkspace end";
196
	this->addLogWidget();
Benoit Valot's avatar
Benoit Valot committed
197

198
}
199

Benoit Valot's avatar
Benoit Valot committed
200
201
void ParameterMainWindow::LoadAlignmentWorkspace() {
	qDebug() << "Load Alignement Workspace";
Benoit Valot's avatar
Benoit Valot committed
202
203
204
205
206
207
	this->ResetWorkspace();
	this->LoadFileMenus();

	QMenu * _toolsMenu = menuBar()->addMenu(tr("&Tools"));
	QAction * obiwarpAct = new QAction(tr("&Obiwarp alignment (MS data)"),
			this);
Benoit Valot's avatar
Benoit Valot committed
208
	obiwarpAct->setToolTip(
Benoit Valot's avatar
Benoit Valot committed
209
210
211
212
213
			tr("Select MsRun resources and aligned run based on MS data"));
	connect(obiwarpAct, SIGNAL(triggered()), this,
			SLOT(obiwarpAlignmentWidget()));
	_toolsMenu->addAction(obiwarpAct);

Benoit Valot's avatar
Benoit Valot committed
214
215
216
217
218
	QAction * ms2Act = new QAction(tr("&MS2 alignment (MS/MS data)"), this);
	ms2Act->setToolTip(
			tr(
					"Select MassChroqML resources and aligned run based on MS/MS data"));
	connect(ms2Act, SIGNAL(triggered()), this, SLOT(ms2AlignmentWidget()));
Benoit Valot's avatar
Benoit Valot committed
219
220
	_toolsMenu->addAction(ms2Act);

Benoit Valot's avatar
Benoit Valot committed
221
222
223
224
225
226
227
228
229
230
231
232
233
234
	_toolsMenu->addSeparator();

	QAction * _exportAct = new QAction(tr("&Export method"), this);
	connect(_exportAct, SIGNAL(triggered()), this,
			SLOT(exportXmlALignmentMethod()));
	_toolsMenu->addAction(_exportAct);

	QMenu * _helpMenu = menuBar()->addMenu(tr("&Help"));

	QAction * _aboutAct = new QAction(tr("&About"), this);
	_aboutAct->setToolTip(tr("About MassChroQ GUI"));
	connect(_aboutAct, SIGNAL(triggered()), this, SLOT(about()));
	_helpMenu->addAction(_aboutAct);

Benoit Valot's avatar
Benoit Valot committed
235
236
237
238
239
	// Central Widget
	_plot_area_aligned = new PlotAligned(this);
	this->setCentralWidget(_plot_area_aligned);

	this->ms2AlignmentWidget();
Benoit Valot's avatar
Benoit Valot committed
240
	qDebug() << "Load Alignement Workspace end";
241
	this->addLogWidget();
Edlira Nano's avatar
Edlira Nano committed
242
243
}

244
void ParameterMainWindow::closeEvent(QCloseEvent * event) {
Edlira Nano's avatar
Edlira Nano committed
245
	if (maybeSave()) {
Edlira Nano's avatar
Edlira Nano committed
246
		event->accept();
247
	} else {
Edlira Nano's avatar
Edlira Nano committed
248
249
		event->ignore();
	}
Edlira Nano's avatar
Edlira Nano committed
250
251
}

252
bool ParameterMainWindow::maybeSave() {
Edlira Nano's avatar
Edlira Nano committed
253
254
	QMessageBox::StandardButton ret;
	ret = QMessageBox::warning(this, tr("MassChroQ GUI"),
Benoit Valot's avatar
Benoit Valot committed
255
256
257
258
			tr("Do you want to quit MassChroQ Gui?"),
			QMessageBox::Ok | QMessageBox::Cancel);
	if (ret == QMessageBox::Ok)
		return true;
Edlira Nano's avatar
Edlira Nano committed
259
260
	else if (ret == QMessageBox::Cancel)
		return false;
Benoit Valot's avatar
Benoit Valot committed
261
262
	else
		return true;
Edlira Nano's avatar
Edlira Nano committed
263
264
}

265
void ParameterMainWindow::extractXicWidget() {
Olivier Langella's avatar
Olivier Langella committed
266
	qDebug() << "New extract xic widget";
267
	this->resetDockTools();
268

269
270
271
272
	//Test msRun selection
	MsrunSelectionWidget * select = new MsrunSelectionWidget(dockwidget);
	connect(select, SIGNAL(resetData()), _plot_area, SLOT(clearPlot()));
	vbox->addWidget(select);
273

274
275
276
277
278
279
280
281
282
283
	TreatmentBoxXicExtract * treat =
			MasschroqGuiEngin::getInstance()->getChain().addNewTreatmentBoxXicExtract();
	connect(treat, SIGNAL(createdXic(const TreatmentBoxXicExtract *)),
			_plot_area, SLOT(viewNewPlot(const TreatmentBoxXicExtract *)));
	connect(treat, SIGNAL(onDelete(TreatmentBox *)), _plot_area,
			SLOT(remove(TreatmentBox *)));
	XicSelectionWidget * xic = new XicSelectionWidget(treat, dockwidget);
	vbox->addWidget(xic);
	vbox->addStretch(0);
}
284

285
void ParameterMainWindow::masschroqmlXicWidget() {
Olivier Langella's avatar
Olivier Langella committed
286
	qDebug() << "New masschroqml xic widget";
287
	this->resetDockTools();
288

289
290
291
292
	MasschroqmlSelectionWidget * select = new MasschroqmlSelectionWidget(
			dockwidget);
	connect(select, SIGNAL(resetData()), _plot_area, SLOT(clearPlot()));
	vbox->addWidget(select);
Edlira Nano's avatar
Edlira Nano committed
293

294
295
296
297
298
299
300
301
	TreatmentBoxXicExtract * treat =
			MasschroqGuiEngin::getInstance()->getChain().addNewTreatmentBoxXicExtract();
	connect(treat, SIGNAL(createdXic(const TreatmentBoxXicExtract *)),
			_plot_area, SLOT(viewNewPlot(const TreatmentBoxXicExtract *)));
	connect(treat, SIGNAL(onDelete(TreatmentBox *)), _plot_area,
			SLOT(remove(TreatmentBox *)));
	PeptideSelectionWidget * xic = new PeptideSelectionWidget(treat,
			dockwidget);
Benoit Valot's avatar
Benoit Valot committed
302
303
	connect(select, SIGNAL(updateMsRunData()), xic, SLOT(updatePeptideList()));
	connect(select, SIGNAL(resetData()), xic, SLOT(clearPeptideList()));
304
305
	vbox->addWidget(xic);
	vbox->addStretch(0);
Edlira Nano's avatar
Edlira Nano committed
306
307
308

}

Benoit Valot's avatar
Benoit Valot committed
309
310
void ParameterMainWindow::addLogWidget() {
	qDebug() << "addLogWidget begin";
311
	if (_logQTextEdit == 0) {
Olivier Langella's avatar
Olivier Langella committed
312
313
		_logQTextEdit = new QTextEdit(this);
		_logQTextEdit->setReadOnly(true);
314
315
316
		LogQIODevice * logQIODevice = new LogQIODevice();
		ConsoleOut::setCout(new QTextStream(logQIODevice));
		ConsoleOut::setCerr(new QTextStream(logQIODevice));
Olivier Langella's avatar
Olivier Langella committed
317
		connect(logQIODevice, SIGNAL(appendLogString(QString)), this, SLOT(appendLogString(QString)));
318
319
320
	}
	if (_dockLog == 0) {
		_dockLog = new QDockWidget(tr("Log"), this);
Benoit Valot's avatar
Benoit Valot committed
321
322
323
		_dockLog->setFeatures(
				QDockWidget::DockWidgetMovable
						| QDockWidget::DockWidgetFloatable);
324
325
		_dockLog->setWidget(_logQTextEdit);
		addDockWidget(Qt::BottomDockWidgetArea, _dockLog);
Benoit Valot's avatar
Benoit Valot committed
326
		mcqout() << "Initialising logger" << endl;
327
328
	}

Benoit Valot's avatar
Benoit Valot committed
329
	qDebug() << "addLogWidget end";
330
331
}

Olivier Langella's avatar
Olivier Langella committed
332

333
void ParameterMainWindow::resetDockTools() {
334
335
336
	if (dock != 0) {
		delete (dock);
		dock = 0;
337
338
339
	}
	MasschroqGuiEngin::getInstance()->getChain().removedAll();
	dock = new QDockWidget(tr("Tools"), this);
Benoit Valot's avatar
Benoit Valot committed
340
341
342
	dock->setFeatures(
			QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
	QScrollArea * scrollArea = new QScrollArea();
343

344
	vbox = new QVBoxLayout;
345
	vbox->setSizeConstraint(QLayout::SetMinAndMaxSize);
346
347
	dockwidget = new QWidget();
	dockwidget->setLayout(vbox);
348
349
350
351

	scrollArea->setWidget(dockwidget);
	scrollArea->setWidgetResizable(true);
	dock->setWidget(scrollArea);
Edlira Nano's avatar
Edlira Nano committed
352
	addDockWidget(Qt::LeftDockWidgetArea, dock);
353
	qDebug() << "New Dock";
Edlira Nano's avatar
Edlira Nano committed
354
355
}

356
void ParameterMainWindow::filterBackgroundWidget() {
357
358
	TreatmentBoxXicFilter * treat =
			MasschroqGuiEngin::getInstance()->getChain().addNewTreatmentBoxXicFilter();
359
360
	connect(treat, SIGNAL(changedXic(const TreatmentBoxXicFilter *)),
			_plot_area,
361
362
363
			SLOT(updatedCurrentPlot(const TreatmentBoxXicFilter *)));
	connect(treat, SIGNAL(onDelete(TreatmentBox *)), _plot_area,
			SLOT(remove(TreatmentBox *)));
364
365
366
	FilterBackgroundWidget * backgroundFilter = new FilterBackgroundWidget(
			treat, dockwidget);
	vbox->removeItem(vbox->itemAt(vbox->count() - 1));
367
368
	vbox->addWidget(backgroundFilter);
	vbox->addStretch(0);
Edlira Nano's avatar
Edlira Nano committed
369
370
}

371
void ParameterMainWindow::filterSpikeWidget() {
372
373
	TreatmentBoxXicFilter * treat =
			MasschroqGuiEngin::getInstance()->getChain().addNewTreatmentBoxXicFilter();
374
375
	connect(treat, SIGNAL(changedXic(const TreatmentBoxXicFilter *)),
			_plot_area,
376
377
378
379
			SLOT(updatedCurrentPlot(const TreatmentBoxXicFilter *)));
	connect(treat, SIGNAL(onDelete(TreatmentBox *)), _plot_area,
			SLOT(remove(TreatmentBox *)));
	FilterSpikeWidget * spikeFilter = new FilterSpikeWidget(treat, dockwidget);
380
	vbox->removeItem(vbox->itemAt(vbox->count() - 1));
381
382
	vbox->addWidget(spikeFilter);
	vbox->addStretch(0);
Edlira Nano's avatar
Edlira Nano committed
383
384
}

385
void ParameterMainWindow::detectionZivyWidget() {
386
387
	TreatmentBoxXicDetect * treat =
			MasschroqGuiEngin::getInstance()->getChain().addNewTreatmentBoxXicDetect();
388
389
	connect(treat, SIGNAL(detectedPeaks(const TreatmentBoxXicDetect *)),
			_plot_area, SLOT(updatedPeaks(const TreatmentBoxXicDetect *)));
390
391
	connect(treat, SIGNAL(onDelete(TreatmentBox *)), _plot_area,
			SLOT(remove(TreatmentBox *)));
392
393
394
	DetectionZivyWidget * detectionZivy = new DetectionZivyWidget(treat,
			dockwidget);
	vbox->removeItem(vbox->itemAt(vbox->count() - 1));
395
396
	vbox->addWidget(detectionZivy);
	vbox->addStretch(0);
Edlira Nano's avatar
Edlira Nano committed
397
}
Edlira Nano's avatar
Edlira Nano committed
398

Benoit Valot's avatar
Benoit Valot committed
399
void ParameterMainWindow::obiwarpAlignmentWidget() {
400
	qDebug() << "New Obiwarp widget" << endl;
Benoit Valot's avatar
Benoit Valot committed
401
402
	this->resetDockTools();
	ObiwarpAlignmentWidget * obiwarp = new ObiwarpAlignmentWidget(dockwidget);
403
404
	connect(obiwarp, SIGNAL(newAlignmentCurve()), _plot_area_aligned,
			SLOT(clearPlot()));
Benoit Valot's avatar
Benoit Valot committed
405
	connect(obiwarp, SIGNAL(finishAlignment(const Msrun *)), _plot_area_aligned,
406
			SLOT(viewAlignedMsRun(const Msrun *)));
Benoit Valot's avatar
Benoit Valot committed
407
	vbox->addWidget(obiwarp);
408
	vbox->addStretch(1);
Benoit Valot's avatar
Benoit Valot committed
409
410
}

Benoit Valot's avatar
Benoit Valot committed
411
void ParameterMainWindow::ms2AlignmentWidget() {
Olivier Langella's avatar
Olivier Langella committed
412
	qDebug() << "ParameterMainWindow::ms2AlignmentWidget begin" << endl;
Benoit Valot's avatar
Benoit Valot committed
413
414
	this->resetDockTools();
	Ms2AlignmentWidget * ms2 = new Ms2AlignmentWidget(dockwidget);
415
416
	connect(ms2, SIGNAL(newAlignmentCurve()), _plot_area_aligned,
			SLOT(clearPlot()));
Benoit Valot's avatar
Benoit Valot committed
417
	connect(ms2, SIGNAL(finishAlignment(const Msrun *)), _plot_area_aligned,
418
			SLOT(viewAlignedMsRun(const Msrun *)));
Benoit Valot's avatar
Benoit Valot committed
419
420
421
	connect(ms2, SIGNAL(finishMonitorAlignment(const MonitorAlignmentPlot *)),
			_plot_area_aligned,
			SLOT(viewAlignedMS2Peaks(const MonitorAlignmentPlot *)));
Benoit Valot's avatar
Benoit Valot committed
422
	vbox->addWidget(ms2);
423
	vbox->addStretch(1);
Olivier Langella's avatar
Olivier Langella committed
424
    qDebug() << "ParameterMainWindow::ms2AlignmentWidget end" << endl;
Benoit Valot's avatar
Benoit Valot committed
425
426
}

427
void ParameterMainWindow::about() {
Edlira Nano's avatar
Edlira Nano committed
428
	QMessageBox::about(this, tr("About MassChroQ"),
429
			tr("This is <b>MassChroQ Studio</b> version %1").arg(MASSCHROQ_VERSION));
430
}
Benoit Valot's avatar
Benoit Valot committed
431
432
433
434
435
436
437
438
439
440
441
442

void ParameterMainWindow::exportXmlQuantificationMethod() {
	qDebug() << "Export quantification xml method";
	MasschroqDomDocument *dom = new MasschroqDomDocument();
	try {
		dom->newQuantificationMethod();
		for (int i = 0; i < (vbox->count()-1); i++) {
			QWidget * temp = vbox->itemAt(i)->widget();
			MasschroQWidget * quant = (MasschroQWidget *) temp;
			quant->writeElement(dom);
		}
		dom->verifyQuantificationMethod();
443
444
445
446
447
448
449
450
451
452
453
		//VIew xml on QDialog
		QDialog*  dialog = new QDialog(this);
		dialog->setModal(true);
		dialog->setWindowTitle(tr("Quantification Method on XML"));
		QVBoxLayout * item = new QVBoxLayout();
		QTextEdit * edit = new QTextEdit(dialog);
		edit->setText(dom->getXMLString());
		item->addWidget(edit);
		dialog->setLayout(item);
		dialog->setMinimumSize(400,350);
		dialog->show();
Benoit Valot's avatar
Benoit Valot committed
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
	} catch (mcqError & error) {
		QMessageBox::warning(this,
				tr("Oops! an error occurred in MassChroQ. Dont Panic :"),
				error.qwhat());
	}
	delete (dom);
}

void ParameterMainWindow::exportXmlALignmentMethod() {
	qDebug() << "Export alignment xml method";
	MasschroqDomDocument *dom = new MasschroqDomDocument();
	try {
		dom->newAlignementMethod();
		QWidget * temp = vbox->itemAt(0)->widget();
		MasschroQWidget * align = (MasschroQWidget *) temp;
		align->writeElement(dom);
470
471
472
473
474
475
476
477
478
479
480
		//VIew xml on QDialog
		QDialog*  dialog = new QDialog(this);
		dialog->setModal(true);
		dialog->setWindowTitle(tr("Alignment Method on XML"));
		QVBoxLayout * item = new QVBoxLayout();
		QTextEdit * edit = new QTextEdit(dialog);
		edit->setText(dom->getXMLString());
		item->addWidget(edit);
		dialog->setLayout(item);
		dialog->setMinimumSize(450,200);
		dialog->show();
Benoit Valot's avatar
Benoit Valot committed
481
482
483
484
485
486
487
	} catch (mcqError & error) {
		QMessageBox::warning(this,
				tr("Oops! an error occurred in MassChroQ. Dont Panic :"),
				error.qwhat());
	}
	delete (dom);
}
Olivier Langella's avatar
Olivier Langella committed
488
489
490
491
492
493


void ParameterMainWindow::appendLogString(QString log)
{
    _logQTextEdit->moveCursor(QTextCursor::End);
    _logQTextEdit->insertPlainText(log);
Olivier Langella's avatar
Olivier Langella committed
494
}