Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PAPPSO
xtpcpp
Commits
d28717ed
Commit
d28717ed
authored
Nov 22, 2019
by
Renne Thomas
Browse files
Add MsRunStatisticsHandler with override bug
parent
216961a1
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/gui/lists/ms_identification_run_list_view/ms_identification_worker/msidlistworkerstatus.cpp
View file @
d28717ed
...
...
@@ -22,14 +22,34 @@
*implementation
******************************************************************************/
#include <tuple>
#include "msidlistworkerstatus.h"
#include <pappsomspp/pappsoexception.h>
#include <pappsomspp/exception/exceptionnotfound.h>
#include <unistd.h>
#include "msidlistworkerthread.h"
#include <gui/lists/ms_identification_run_list_view/msidentificationtablemodel.h>
MsRunStatisticsHandler
::
MsRunStatisticsHandler
()
:
pappso
::
SpectrumCollectionHandlerInterface
()
{
qDebug
()
<<
"OOOOOO test"
;
}
bool
MsRunStatisticsHandler
::
shouldStop
()
{
qDebug
()
<<
"RRRRRR test"
;
QMutexLocker
locker
(
&
m_mutex
);
return
true
;
}
void
MsRunStatisticsHandler
::
requireStop
(
bool
stop
)
{
QMutexLocker
locker
(
&
m_mutex
);
m_stopRequired
=
stop
;
}
MsIdListWorkerStatus
::
MsIdListWorkerStatus
(
MsIdListWorkerThread
*
worker
)
{
connect
(
this
,
...
...
@@ -41,10 +61,16 @@ MsIdListWorkerStatus::MsIdListWorkerStatus(MsIdListWorkerThread *worker)
&
MsIdListWorkerThread
::
MsNumberComputing
,
this
,
&
MsIdListWorkerStatus
::
setRunningIdData
);
mpa_currentHandler
=
nullptr
;
}
MsIdListWorkerStatus
::~
MsIdListWorkerStatus
()
{
if
(
mpa_currentHandler
!=
nullptr
)
{
delete
mpa_currentHandler
;
}
}
WorkerStatus
...
...
@@ -66,8 +92,19 @@ MsIdListWorkerStatus::getStatus(
}
else
{
qDebug
();
if
(
mpa_currentHandler
!=
nullptr
)
{
qDebug
();
delete
mpa_currentHandler
;
}
qDebug
();
mpa_currentHandler
=
new
MsRunStatisticsHandler
();
qDebug
()
<<
"DDDDDDDDDDDDDD"
<<
mpa_currentHandler
->
shouldStop
();
emit
computeMsNumber
(
identificationDataSource
);
m_list_idSources
.
push_back
(
identificationDataSource
);
return
WorkerStatus
::
Waiting
;
}
return
WorkerStatus
::
Waiting
;
...
...
src/gui/lists/ms_identification_run_list_view/ms_identification_worker/msidlistworkerstatus.h
View file @
d28717ed
...
...
@@ -28,6 +28,36 @@
#include "core/msrun.h"
#include "core/identification_sources/identificationdatasource.h"
class
MsRunStatisticsHandler
:
public
pappso
::
SpectrumCollectionHandlerInterface
{
public:
MsRunStatisticsHandler
()
;
virtual
~
MsRunStatisticsHandler
()
{};
virtual
void
setQualifiedMassSpectrum
(
const
pappso
::
QualifiedMassSpectrum
&
qspectrum
)
override
;
virtual
bool
needPeakList
()
const
override
;
unsigned
long
getMsLevelCount
(
unsigned
int
ms_level
)
const
;
pappso
::
pappso_double
getMsLevelTic
(
unsigned
int
ms_level
)
const
;
unsigned
long
getTotalCount
()
const
;
virtual
bool
shouldStop
()
override
;
void
requireStop
(
bool
stop
);
private:
std
::
vector
<
unsigned
long
>
_count_ms_level_spectrum
;
std
::
vector
<
pappso
::
pappso_double
>
_tic_ms_level_spectrum
;
QMutex
m_mutex
;
bool
m_stopRequired
=
true
;
};
class
MsIdentificationTableModel
;
enum
class
WorkerStatus
:
std
::
int8_t
...
...
@@ -61,4 +91,5 @@ class MsIdListWorkerStatus : public QObject
private:
std
::
vector
<
IdentificationDataSourceSp
>
m_list_idSources
;
pappso
::
SpectrumCollectionHandlerInterface
*
mpa_currentHandler
=
nullptr
;
};
src/gui/lists/ms_identification_run_list_view/ms_identification_worker/msidlistworkerthread.cpp
View file @
d28717ed
...
...
@@ -30,6 +30,7 @@
#include "msidlistworkerthread.h"
#include <pappsomspp/pappsoexception.h>
#include <pappsomspp/exception/exceptionnotfound.h>
#include "msidlistworkerstatus.h"
MsIdListWorkerThread
::
MsIdListWorkerThread
()
{
...
...
@@ -43,12 +44,15 @@ void
MsIdListWorkerThread
::
doComputeMsNumber
(
IdentificationDataSourceSp
identificationDataSource
)
{
emit
MsNumberComputing
(
identificationDataSource
);
// while(currentHandler->get(). == false)
// {
emit
MsNumberComputing
(
identificationDataSource
);
if
(
identificationDataSource
->
getMsRunSp
()
->
findMsRunFile
())
{
identificationDataSource
->
getMsRunSp
()
->
checkMsRunStatistics
();
}
identificationDataSource
->
getMsRunSp
()
->
freeMsRunReaderSp
();
emit
MsNumberComputed
();
if
(
identificationDataSource
->
getMsRunSp
()
->
findMsRunFile
())
{
identificationDataSource
->
getMsRunSp
()
->
checkMsRunStatistics
();
}
identificationDataSource
->
getMsRunSp
()
->
freeMsRunReaderSp
();
emit
MsNumberComputed
();
// }
}
src/gui/lists/ms_identification_run_list_view/msidentificationtablemodel.cpp
View file @
d28717ed
...
...
@@ -29,6 +29,7 @@
#include "msidentificationlistwindow.h"
#include "ms_identification_worker/msidlistworkerthread.h"
#include "../../../utils/identificationdatasourcestore.h"
#include <QSvgRenderer>
MsIdentificationTableModel
::
MsIdentificationTableModel
(
MsIdentificationListWindow
*
ms_id_list_window
)
...
...
@@ -40,7 +41,11 @@ MsIdentificationTableModel::MsIdentificationTableModel(
p_worker
->
moveToThread
(
&
m_ms_id_list_thread
);
m_ms_id_list_thread
.
start
();
msp_workerStatus
=
std
::
make_shared
<
MsIdListWorkerStatus
>
(
p_worker
);
mp_movie
=
new
QMovie
(
"/home/trenne/Documents/graph/iconWait.gif"
);
mp_movie
->
start
();
mp_movie
->
setScaledSize
(
QSize
(
20
,
20
));
connect
(
p_worker
,
&
MsIdListWorkerThread
::
MsNumberComputed
,
this
,
...
...
@@ -49,12 +54,17 @@ MsIdentificationTableModel::MsIdentificationTableModel(
&
MsIdentificationTableModel
::
ComputeMsNumber
,
p_worker
,
&
MsIdListWorkerThread
::
doComputeMsNumber
);
connect
(
mp_movie
,
&
QMovie
::
frameChanged
,
this
,
&
MsIdentificationTableModel
::
onMsIdentificationDataChanged
);
}
MsIdentificationTableModel
::~
MsIdentificationTableModel
()
{
m_ms_id_list_thread
.
quit
();
m_ms_id_list_thread
.
wait
();
delete
mp_movie
;
}
void
...
...
@@ -347,7 +357,7 @@ MsIdentificationTableModel::data(const QModelIndex &index, int role) const
if
(
temp
==
WorkerStatus
::
Running
)
{
return
QVariant
(
"
Running
"
);
return
QVariant
(
""
);
}
else
if
(
temp
==
WorkerStatus
::
Waiting
)
{
...
...
@@ -377,12 +387,16 @@ MsIdentificationTableModel::data(const QModelIndex &index, int role) const
if
(
temp
==
WorkerStatus
::
Running
)
{
return
QVariant
(
"
Running
"
);
return
QVariant
(
""
);
}
else
else
if
(
temp
==
WorkerStatus
::
Waiting
)
{
return
QVariant
(
"Wait"
);
}
else
{
return
QVariant
(
"Error"
);
}
}
else
{
...
...
@@ -404,10 +418,48 @@ MsIdentificationTableModel::data(const QModelIndex &index, int role) const
->
getFileName
());
}
return
QVariant
();
case
Qt
::
DecorationRole
:
if
(
col
==
(
std
::
int8_t
)
msIdentificationListColumn
::
nb_ms_1
)
{
QVariant
nb_ms1
=
m_identificationDataSourceSpList
.
at
(
row
)
->
getMsRunSp
()
->
getMsRunStatistics
(
MsRunStatistics
::
total_spectra_ms1
);
if
(
nb_ms1
.
isNull
())
{
WorkerStatus
temp
=
msp_workerStatus
.
get
()
->
getStatus
(
m_identificationDataSourceSpList
.
at
(
row
));
if
(
temp
==
WorkerStatus
::
Running
)
{
return
mp_movie
->
currentImage
();
}
}
}
if
(
col
==
(
std
::
int8_t
)
msIdentificationListColumn
::
nb_ms_2
)
{
QVariant
nb_ms1
=
m_identificationDataSourceSpList
.
at
(
row
)
->
getMsRunSp
()
->
getMsRunStatistics
(
MsRunStatistics
::
total_spectra_ms2
);
if
(
nb_ms1
.
isNull
())
{
WorkerStatus
temp
=
msp_workerStatus
.
get
()
->
getStatus
(
m_identificationDataSourceSpList
.
at
(
row
));
if
(
temp
==
WorkerStatus
::
Running
)
{
return
mp_movie
->
currentImage
();
}
}
}
return
QVariant
();
}
return
QVariant
();
}
void
MsIdentificationTableModel
::
onMsIdentificationDataChanged
()
{
...
...
src/gui/lists/ms_identification_run_list_view/msidentificationtablemodel.h
View file @
d28717ed
...
...
@@ -28,6 +28,7 @@
#include <QThread>
#include <memory>
#include "ms_identification_worker/msidlistworkerstatus.h"
#include <QMovie>
/** \def msIdentificationListColumn list of available fields to display in ms
...
...
@@ -67,7 +68,9 @@ class MsIdentificationTableModel : public QAbstractTableModel
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
int
role
)
const
override
;
virtual
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
override
;
void
paint
(
QPainter
*
painter
,
IdentificationDataSourceSp
identificationDataSource
,
const
QModelIndex
&
index
)
const
;
static
const
QString
getTitle
(
msIdentificationListColumn
column
);
static
const
QString
getDescription
(
msIdentificationListColumn
column
);
static
const
QString
getTitle
(
std
::
int8_t
column
);
...
...
@@ -97,4 +100,5 @@ class MsIdentificationTableModel : public QAbstractTableModel
MsIdentificationListWindow
*
m_ms_id_list_window
;
QThread
m_ms_id_list_thread
;
std
::
shared_ptr
<
MsIdListWorkerStatus
>
msp_workerStatus
=
nullptr
;
QMovie
*
mp_movie
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment