From fc685daa4fa438278c6fc45f3f7d9a6185811f21 Mon Sep 17 00:00:00 2001 From: Olivier Langella <Olivier.Langella@moulon.inra.fr> Date: Wed, 19 Apr 2017 23:30:55 +0200 Subject: [PATCH] spectrum zoomer and mz position enabled --- src/CMakeLists.txt | 2 ++ src/gui/peptide_detail_view/peptidewindow.cpp | 26 ++++++++++++++++--- src/gui/peptide_detail_view/peptidewindow.h | 4 +++ .../spectrum_widget/overlaywidget.cpp | 11 +++++--- 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cd161d71..ed180bf2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -90,6 +90,7 @@ SET(XTPCPP_SRCS ./gui/load_results_dialog/loadresultsdialog.cpp ./gui/mainwindow.cpp ./gui/peptide_detail_view/peptidewindow.cpp + ./gui/peptide_detail_view/spectrum_widget/overlaywidget.cpp ./gui/peptide_detail_view/spectrum_widget/qspectrumwidget.cpp ./gui/peptide_list_view/peptidelistwindow.cpp ./gui/peptide_list_view/peptidetablemodel.cpp @@ -122,6 +123,7 @@ SET(XTPCPP_MOC_HDRS ./gui/load_results_dialog/loadresultsdialog.h ./gui/mainwindow.h ./gui/peptide_detail_view/peptidewindow.h + ./gui/peptide_detail_view/spectrum_widget/overlaywidget.h ./gui/peptide_detail_view/spectrum_widget/qspectrumwidget.h ./gui/peptide_list_view/peptidelistwindow.h ./gui/peptide_list_view/peptidetablemodel.h diff --git a/src/gui/peptide_detail_view/peptidewindow.cpp b/src/gui/peptide_detail_view/peptidewindow.cpp index 63d79472..be1c0ee7 100644 --- a/src/gui/peptide_detail_view/peptidewindow.cpp +++ b/src/gui/peptide_detail_view/peptidewindow.cpp @@ -53,6 +53,8 @@ PeptideWindow::PeptideWindow(ProjectWindow *parent): qDebug() << "PeptideWindow::PeptideWindow begin"; _p_project_window = parent; ui->setupUi(this); + + _p_spectrum_overlay = new LoadingOverlay(ui->spectrumWidget); /* */ SpectrumSpLoaderThread * worker = new SpectrumSpLoaderThread; @@ -86,7 +88,7 @@ PeptideWindow::PeptideWindow(ProjectWindow *parent): connect (this, SIGNAL(loadSpectrumSp(PeptideMatch *)), worker,SLOT(doLoadSpectrumSp(PeptideMatch *))); connect (worker, SIGNAL(spectrumSpReady(pappso::SpectrumSp, QString)), this,SLOT(doSpectrumSpReady(pappso::SpectrumSp, QString))); - + connect (_p_spectrum_overlay,SIGNAL(mzChanged(double)), this, SLOT(setMz(double))); //connect(_protein_table_model_p, SIGNAL(layoutChanged()), this, SLOT(updateStatusBar())); #endif @@ -95,10 +97,14 @@ PeptideWindow::PeptideWindow(ProjectWindow *parent): PeptideWindow::~PeptideWindow() { + delete _p_spectrum_overlay; delete ui; } +void PeptideWindow::setMz(double mz) { +} + void PeptideWindow::doIdentificationGroupGrouped(IdentificationGroup * p_identification_group) { updateDisplay(); } @@ -130,8 +136,8 @@ void PeptideWindow::chooseDefaultMzDataDir() { QString default_location = settings.value("path/mzdatadir", "").toString(); QString filename = QFileDialog::getExistingDirectory(this, - tr("Choose default mz data directory"), default_location, - QFileDialog::ShowDirsOnly); + tr("Choose default mz data directory"), default_location, + QFileDialog::ShowDirsOnly); if (filename.isEmpty()) { return; @@ -139,16 +145,24 @@ void PeptideWindow::chooseDefaultMzDataDir() { QString path = QFileInfo(filename).absoluteFilePath(); settings.setValue("path/mzdatadir", path); ui->mz_data_dir_label->setText(path); + + + qDebug() << "PeptideWindow::chooseDefaultMzDataDir begin"; + _p_spectrum_overlay->displayLoadingMessage(); + ui->file_not_found->setVisible(false); + ui->spectrumWidget->setVisible(true); emit loadSpectrumSp(_p_peptide_match); ui->statusbar->showMessage(tr("loading spectrum")); + } void PeptideWindow::doSpectrumSpReady(SpectrumSp spectrum_sp, QString error) { qDebug() << "PeptideWindow::doSpectrumSpReady begin"; + _p_spectrum_overlay->hideLoadingMessage(); if (!error.isEmpty()) { //not found - + ui->statusbar->showMessage(tr("spectrum not found")); QSettings settings; QString path = settings.value("path/mzdatadir", "").toString(); @@ -178,6 +192,10 @@ void PeptideWindow::setPeptideMatch(PeptideMatch * p_peptide_match) { qDebug() << "PeptideWindow::setPeptideMatch emit loadSpectrumSp(_p_peptide_match)"; emit loadSpectrumSp(_p_peptide_match); + + _p_spectrum_overlay->displayLoadingMessage(); + ui->file_not_found->setVisible(false); + ui->spectrumWidget->setVisible(true); ui->statusbar->showMessage(tr("loading spectrum")); pappso::PeptideSp peptide = _p_peptide_match->getPeptideXtpSp(); diff --git a/src/gui/peptide_detail_view/peptidewindow.h b/src/gui/peptide_detail_view/peptidewindow.h index c6985977..a3ab9eba 100644 --- a/src/gui/peptide_detail_view/peptidewindow.h +++ b/src/gui/peptide_detail_view/peptidewindow.h @@ -30,6 +30,7 @@ #include <pappsomspp/spectrum/spectrum.h> #include "../../core/peptidematch.h" #include "../../core/identificationgroup.h" +#include "spectrum_widget/overlaywidget.h" class ProjectWindow; @@ -68,6 +69,7 @@ public: public slots: void doIdentificationGroupGrouped(IdentificationGroup * p_identification_group); + void setMz(double); signals: void loadSpectrumSp(PeptideMatch * p_peptide_match); @@ -86,6 +88,8 @@ private: ProjectWindow * _p_project_window; PeptideMatch * _p_peptide_match = nullptr; pappso::PrecisionP _p_precision; + + LoadingOverlay * _p_spectrum_overlay; }; diff --git a/src/gui/peptide_detail_view/spectrum_widget/overlaywidget.cpp b/src/gui/peptide_detail_view/spectrum_widget/overlaywidget.cpp index edb9a03b..2ee85c70 100644 --- a/src/gui/peptide_detail_view/spectrum_widget/overlaywidget.cpp +++ b/src/gui/peptide_detail_view/spectrum_widget/overlaywidget.cpp @@ -45,8 +45,13 @@ void LoadingOverlay::paintEvent(QPaintEvent *) { painter.begin(this); painter.setRenderHint(QPainter::Antialiasing); - paintLoadingMessage(painter); - paintUserSelectedZone(painter); + qDebug() << "LoadingOverlay::paintEvent _is_loading="<< _is_loading; + if (_is_loading) { + paintLoadingMessage(painter); + } + else { + paintUserSelectedZone(painter); + } painter.end(); } void LoadingOverlay::mousePressEvent(QMouseEvent * event) { @@ -80,7 +85,7 @@ void LoadingOverlay::mouseReleaseEvent(QMouseEvent * event) { pappso_double max_intensity = _p_spectrum_widget->getSpectrumPainter().getIntensityFromLocalPosY(_second_point.second); _p_spectrum_widget->getSpectrumPainter().setMinMz(min); _p_spectrum_widget->getSpectrumPainter().setMaxMz(max); - _p_spectrum_widget->getSpectrumPainter().setMaxIntensity(max_intensity); + _p_spectrum_widget->getSpectrumPainter().setMaxIntensity(max_intensity); } else { _p_spectrum_widget->getSpectrumPainter().setMaxMz(0); -- GitLab