\n";
@@ -811,8 +1014,8 @@ void cMainWindow::exportToHTML() {
out << results->columnCount();
out << "\">\n";
- out << "" << spectradetails[i].getTheoreticalSpectrum().getCoverageBySeries().c_str();
- out << "
" << spectradetails[i].getDetailsAsHTMLString().c_str() << "
\n";
+ out << "" << spectradetails[spectrumindex].getTheoreticalSpectrum().getCoverageBySeries().c_str();
+ out << "
" << spectradetails[spectrumindex].getDetailsAsHTMLString().c_str() << "
\n";
out << "
\n";
@@ -853,7 +1056,7 @@ void cMainWindow::showHTMLDocumentation() {
#if OS_TYPE == WIN
QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/html/userguide.html").absoluteFilePath()));
#else
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(linuxinstalldir + "docs/html/userguide.html").absoluteFilePath()));
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/html/userguide.html").absoluteFilePath()));
#endif
}
@@ -862,7 +1065,7 @@ void cMainWindow::showPDFManual() {
#if OS_TYPE == WIN
QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo("docs/refman.pdf").absoluteFilePath()));
#else
- QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(linuxinstalldir + "docs/refman.pdf").absoluteFilePath()));
+ QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(installdir + "docs/refman.pdf").absoluteFilePath()));
#endif
}
@@ -989,6 +1192,15 @@ void cMainWindow::openResultsFile() {
parameters.load(infile);
parameterswidget->setAndRestoreParameters(parameters);
+ if (parameters.mode == dereplication) {
+ actionShowIsomers->setEnabled(false);
+ rowsfilterwidget->setEnabled(false);
+ }
+ else {
+ actionShowIsomers->setEnabled(true);
+ rowsfilterwidget->setEnabled(true);
+ }
+
// load theoretical spectra
infile.read((char *)&size, sizeof(int));
@@ -1039,6 +1251,13 @@ void cMainWindow::insertSequence(int peptidetypeindex, QString sequence) {
void cMainWindow::quitApplication() {
+ QMessageBox::StandardButton reply;
+ reply = QMessageBox::question(this, appname, "Quit ?", QMessageBox::Yes|QMessageBox::No);
+
+ if (reply != QMessageBox::Yes) {
+ return;
+ }
+
emit stopComputation();
quitapp = true;
@@ -1048,6 +1267,54 @@ void cMainWindow::quitApplication() {
}
+void cMainWindow::filterResults() {
+ Qt::CaseSensitivity casesensitive = rowsfiltercasesensitive->isChecked()?Qt::CaseSensitive:Qt::CaseInsensitive;
+ QString str = rowsfilterline->text();
+ int rowcount = results->rowCount();
+ bool match;
+ int i, j;
+
+ QProgressDialog progress("Updating the report...", /*"Cancel"*/0, 0, rowcount, this);
+ cEventFilter filter;
+ progress.installEventFilter(&filter);
+ progress.setMinimumDuration(0);
+ progress.setWindowModality(Qt::WindowModal);
+
+ for (i = 0; i < rowcount; i++) {
+ match = false;
+ for (j = 0; j < results->columnCount(); j++) {
+ if (results->item(i, j)->text().contains(str, casesensitive)) {
+ match = true;
+ break;
+ }
+ }
+ results->setRowHidden(i, !match);
+ progress.setValue(i);
+ }
+
+ progress.setValue(rowcount);
+}
+
+
+void cMainWindow::resetFilter() {
+ rowsfilterline->setText("");
+ int rowcount = results->rowCount();
+
+ QProgressDialog progress("Updating the report...", /*"Cancel"*/0, 0, rowcount, this);
+ cEventFilter filter;
+ progress.installEventFilter(&filter);
+ progress.setMinimumDuration(0);
+ progress.setWindowModality(Qt::WindowModal);
+
+ for (int i = 0; i < rowcount; i++) {
+ results->setRowHidden(i, false);
+ progress.setValue(i);
+ }
+
+ progress.setValue(rowcount);
+}
+
+
/*
void cMainWindow::showContextMenu(const QPoint &pt) {
QMenu *menu = logWindow->createStandardContextMenu();
@@ -1057,45 +1324,3 @@ void cMainWindow::showContextMenu(const QPoint &pt) {
}
*/
-
-cMainWindow::~cMainWindow() {
- deleteResults();
-
- delete menuBar;
-
- delete menuFile;
- delete menuSearch;
- delete menuTools;
- delete menuView;
- delete menuHelp;
-
- delete actionOpenResults;
- delete actionSaveResults;
- delete actionExportToCsv;
- delete actionExportToHTML;
- delete actionQuit;
- delete actionProperties;
- delete actionRun;
- delete actionBricksDatabase;
- delete actionSequenceDatabase;
- delete actionModifications;
- delete actionDrawPeptide;
- delete actionGraph;
- delete actionLog;
- delete actionHTMLDocumentation;
- delete actionPDFManual;
- delete actionAbout;
-
- delete results;
- delete logWindow;
- delete splitter;
-
- delete about;
- delete graph;
- delete bricksdatabasewidget;
- delete sequencedatabasewidget;
- delete modificationswidget;
- delete drawpeptidewidget;
- delete parameterswidget;
-}
-
diff --git a/CycloBranch/gui/cMainWindow.h b/CycloBranch/gui/cMainWindow.h
index d95dcd3..259d309 100644
--- a/CycloBranch/gui/cMainWindow.h
+++ b/CycloBranch/gui/cMainWindow.h
@@ -53,6 +53,15 @@ class cMainWindow : public QMainWindow
~cMainWindow();
+protected:
+
+ /**
+ \brief Handle a key press event.
+ \param event pointer to QKeyEvent
+ */
+ void keyPressEvent(QKeyEvent *event);
+
+
private:
// main menu
@@ -71,6 +80,7 @@ class cMainWindow : public QMainWindow
QToolBar* toolbarTools;
QToolBar* toolbarView;
QToolBar* toolbarHelp;
+ QToolBar* toolbarFilter;
// subitems in the menu
QAction* actionOpenResults;
@@ -85,12 +95,20 @@ class cMainWindow : public QMainWindow
QAction* actionSequenceDatabase;
QAction* actionModifications;
QAction *actionDrawPeptide;
+ QAction* actionShowIsomers;
QAction* actionGraph;
QAction* actionLog;
QAction* actionHTMLDocumentation;
QAction* actionPDFManual;
QAction* actionAbout;
+ QWidget* rowsfilterwidget;
+ QHBoxLayout* rowsfilterhbox;
+ QLineEdit* rowsfilterline;
+ QCheckBox* rowsfiltercasesensitive;
+ QPushButton* rowsfilterbutton;
+ QPushButton* rowsfilterclearbutton;
+
QTableWidget* results;
cTheoreticalSpectrumList theoreticalspectrumlist;
vector