Skip to content
Snippets Groups Projects
Commit 2dc2a133 authored by Olivier Langella's avatar Olivier Langella
Browse files

first working progress bar

parent 4cb51818
No related branches found
No related tags found
No related merge requests found
......@@ -107,10 +107,10 @@ IdentificationGroup* Project::newIdentificationGroup() {
_identification_goup_list.push_back(_p_current_identification_group);
return _p_current_identification_group;
}
void Project::readXpipFile(QFileInfo xpip_fileinfo) {
void Project::readXpipFile(WorkMonitorInterface * p_monitor, QFileInfo xpip_fileinfo) {
qDebug() << "Project::readXpipFile begin";
XpipSaxHandler * parser = new XpipSaxHandler(this);
XpipSaxHandler * parser = new XpipSaxHandler(p_monitor, this);
QXmlSimpleReader simplereader;
simplereader.setContentHandler(parser);
......
......@@ -31,6 +31,7 @@
#include "../utils/proteinstore.h"
#include "../utils/identificationdatasourcestore.h"
#include "../utils/msrunstore.h"
#include "../utils/workmonitor.h"
#include "labeling/labelingmethod.h"
class Project;
......@@ -53,7 +54,7 @@ public:
FastaFileStore & getFastaFileStore();
IdentificationDataSourceStore & getIdentificationDataSourceStore();
const IdentificationDataSourceStore & getIdentificationDataSourceStore() const;
void readXpipFile(QFileInfo xpip_source);
void readXpipFile(WorkMonitorInterface * p_monitor, QFileInfo xpip_source);
IdentificationGroup* newIdentificationGroup();
/** @brief validate or invalidate peptides and proteins based automatic filters and manual checks
......
......@@ -40,10 +40,10 @@ XpipFile::~XpipFile()
}
ProjectSp XpipFile::getProjectSp() const {
ProjectSp XpipFile::getProjectSp(WorkMonitorInterface * p_monitor) const {
ProjectSp project_sp = Project().makeProjectSp();
project_sp.get()->readXpipFile(QFileInfo(_xpip_source.toLocalFile()));
project_sp.get()->readXpipFile(p_monitor, QFileInfo(_xpip_source.toLocalFile()));
return (project_sp);
......
......@@ -25,6 +25,7 @@
#include <QUrl>
#include <QFileInfo>
#include "../core/project.h"
#include "../utils/workmonitor.h"
class XpipFile
{
......@@ -34,7 +35,7 @@ public:
XpipFile(const XpipFile & other);
~XpipFile();
ProjectSp getProjectSp() const;
ProjectSp getProjectSp(WorkMonitorInterface * p_monitor) const;
private :
const QUrl _xpip_source;
......
......@@ -61,6 +61,7 @@ void WaitingMessageDialog::message(const QString & message) {
}
void WaitingMessageDialog::message(const QString & message, int progress_value) {
qDebug() << "WaitingMessageDialog::message " << progress_value;
ui->progress_bar->setVisible(true);
ui->progress_bar->setValue(progress_value);
ui->message_label->setText(message);
......
......@@ -126,7 +126,7 @@ void WorkerThread::doXpipFileLoad(QString filename) {
emit loadingMessage(tr("loading XPIP file"));
XpipFile xpip_file(new_xpip_file);
ProjectSp project_sp = xpip_file.getProjectSp();
ProjectSp project_sp = xpip_file.getProjectSp(_p_work_monitor);
emit projectReady(project_sp);
......
......@@ -26,9 +26,9 @@
#include "../utils/peptidestore.h"
#include "../utils/proteinstore.h"
XpipSaxHandler::XpipSaxHandler(Project * p_project):_p_project(p_project)
XpipSaxHandler::XpipSaxHandler(WorkMonitorInterface * p_monitor, Project * p_project):_p_project(p_project)
{
_p_monitor = p_monitor;
}
XpipSaxHandler::~XpipSaxHandler()
......@@ -155,8 +155,9 @@ bool XpipSaxHandler::startElement_information(QXmlAttributes attributes) {
if (attributes.value("Data_Type").simplified() == "indiv") {
_p_project->setCombineMode(false);
}
_count_protein_match = attributes.value("match_number").toUInt();
_total_protein_match = attributes.value("match_number").toUInt();
_p_monitor->setProgressMaximumValue(_total_protein_match);
qDebug() << "startElement_information end" ;
return true;
}
......@@ -312,6 +313,8 @@ bool XpipSaxHandler::endElement_identification() {
}
bool XpipSaxHandler::endElement_match() {
_count_protein_match++;
_p_monitor->message(QString("readind match %1").arg(_count_protein_match), _count_protein_match);
_current_identification_group_p->addProteinMatch(_p_protein_match);
_p_protein_match = nullptr;
return true;
......@@ -346,6 +349,7 @@ bool XpipSaxHandler::endDocument() {
}
bool XpipSaxHandler::startDocument() {
_count_protein_match=0;
return true;
}
......
......@@ -30,11 +30,12 @@
#include <pappsomspp/amino_acid/aamodification.h>
#include "../core/project.h"
#include "../core/proteinmatch.h"
#include "../utils/workmonitor.h"
class XpipSaxHandler: public QXmlDefaultHandler
{
public:
XpipSaxHandler(Project * p_project);
XpipSaxHandler(WorkMonitorInterface * p_monitor, Project * p_project);
~XpipSaxHandler();
bool startElement(const QString & namespaceURI, const QString & localName,
......@@ -74,6 +75,7 @@ private:
pappso::AaModificationP getAaModificationP(pappso::mz mass) const;
private:
WorkMonitorInterface * _p_monitor;
std::vector<QString> _tag_stack;
QString _errorStr;
QString _current_text;
......@@ -88,7 +90,8 @@ private:
FastaFileSp _current_fasta_file_sp;
QMap<QString, pappso::AaModificationP> _map_massstr_aamod;
uint _count_protein_match;
uint _count_protein_match=0;
uint _total_protein_match;
};
#endif // XTANDEMRESULTSHANDLER_H
......@@ -29,11 +29,19 @@
******************************************************************************/
#include "workmonitor.h"
#include <QDebug>
void WorkMonitor::message(const QString & message) {
emit workerMessage(message);
}
void WorkMonitor::message(const QString & message, int value) {
emit workerMessage(message,value);
qDebug() << "WorkMonitor::message " << value << " " << _max_value << " " << (value/_max_value)*100;
int percent = ((float)value/(float)_max_value)*(float)100;
if (percent != _percent) {
_percent = percent;
emit workerMessage(message,percent);
}
}
void WorkMonitor::setProgressMaximumValue(int max_value) {
_max_value = max_value;
}
......@@ -38,20 +38,24 @@ class WorkMonitorInterface
public:
virtual void message(const QString & message) = 0;
virtual void message(const QString & message, int value) = 0;
virtual void setProgressMaximumValue(int max_value) = 0;
};
class WorkMonitor: public QObject, WorkMonitorInterface
class WorkMonitor: public QObject, public WorkMonitorInterface
{
Q_OBJECT
public:
void message(const QString & message) override;
void message(const QString & message, int value) override;
void setProgressMaximumValue(int max_value) override;
signals:
void workerMessage(QString message);
void workerMessage(QString message, int value);
private :
int _max_value = 100;
int _percent = 0;
};
#endif // WORKMONITOR_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment