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

display status bar

parent ef4569e3
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,7 @@ void IdentificationGroup::updateAutomaticFilters(const AutomaticFilterParameters
if (_p_grp_experiment != nullptr) {
}
}
void IdentificationGroup::addProteinMatch(ProteinMatch * protein_match) {
_protein_match_list.push_back(protein_match);
......@@ -57,3 +57,23 @@ void IdentificationGroup::addMsRunIdSp(pappso::MsRunIdSp ms_run_sp) {
std::vector<ProteinMatch *> & IdentificationGroup::getProteinMatchList() {
return _protein_match_list;
}
size_t IdentificationGroup::countValidAndChecked()const {
size_t i=0;
for (auto & p_protein_match : _protein_match_list) {
if (p_protein_match->isValidAndChecked()) {
i++;
}
}
return i;
}
size_t IdentificationGroup::countValid()const {
size_t i=0;
for (auto & p_protein_match : _protein_match_list) {
if (p_protein_match->isValid()) {
i++;
}
}
return i;
}
......@@ -45,6 +45,10 @@ public:
void addProteinMatch(ProteinMatch * protein_match);
std::vector<ProteinMatch *> & getProteinMatchList();
void addMsRunIdSp(pappso::MsRunIdSp ms_run_sp);
size_t countValid()const;
size_t countValidAndChecked()const;
/** @brief validate or invalidate peptides and proteins based automatic filters and manual checks
......
......@@ -36,10 +36,10 @@ ProteinListWindow::ProteinListWindow(MainWindow *parent):
/*
*/
_protein_table_model_p = new ProteinTableModel(this, this);
_protein_table_model_p = new ProteinTableModel(this);
_p_proxy_model = new ProteinTableProxyModel(this, _protein_table_model_p);
_p_proxy_model = new ProteinTableProxyModel(_protein_table_model_p);
_p_proxy_model->setSourceModel(_protein_table_model_p);
_p_proxy_model->setDynamicSortFilter(true);
ui->tableView->setModel( _p_proxy_model );
......@@ -58,12 +58,14 @@ ProteinListWindow::ProteinListWindow(MainWindow *parent):
// Qt4 code
connect(ui->tableView, SIGNAL(clicked(const QModelIndex &)), _p_proxy_model, SLOT(onTableClicked(const QModelIndex &)));
connect(ui->proteinSearchEdit, SIGNAL(textChanged(QString)), _protein_table_model_p, SLOT(onProteinSearchEdit(QString)));
//connect(_protein_table_model_p, SIGNAL(layoutChanged()), this, SLOT(updateStatusBar()));
#endif
}
void ProteinListWindow::clickOnproteinMatch(ProteinMatch * p_protein_match) {
emit proteinMatchClicked(p_protein_match);
//updateStatusBar();
}
ProteinListWindow::~ProteinListWindow()
......@@ -75,8 +77,14 @@ ProteinListWindow::~ProteinListWindow()
void ProteinListWindow::setIdentificationGroup(IdentificationGroup * p_identification_group) {
_p_identification_group = p_identification_group;
_protein_table_model_p->setIdentificationGroup(p_identification_group);
_p_proxy_model->setSourceModel(_protein_table_model_p);
updateStatusBar();
}
void ProteinListWindow::updateStatusBar() {
ui->statusbar->showMessage(tr("proteins %1 valid, %2 checked, %3 displayed").arg(_p_identification_group->countValid()).arg(_p_identification_group->countValidAndChecked()).arg(_p_proxy_model->rowCount()));
}
......@@ -44,6 +44,7 @@ public:
~ProteinListWindow();
void setIdentificationGroup(IdentificationGroup * p_identification_group);
void clickOnproteinMatch(ProteinMatch * p_protein_match);
void updateStatusBar();
public slots:
//void peptideEdited(QString peptideStr);
......@@ -51,7 +52,9 @@ public slots:
// void setShape(Shape shape);
signals:
void proteinMatchClicked(ProteinMatch * p_protein_match);
private:
IdentificationGroup * _p_identification_group;
Ui::ProteinView *ui;
ProteinTableModel * _protein_table_model_p = nullptr;
ProteinTableProxyModel * _p_proxy_model = nullptr;
......
......@@ -27,7 +27,7 @@
#include <QDebug>
ProteinTableProxyModel::ProteinTableProxyModel(QObject *parent,ProteinTableModel* protein_table_model_p): QSortFilterProxyModel(parent),
ProteinTableProxyModel::ProteinTableProxyModel(ProteinTableModel* protein_table_model_p): QSortFilterProxyModel(protein_table_model_p),
m_minGravity(0.0), m_minDensity(0.0)
{
_protein_table_model_p = protein_table_model_p;
......@@ -82,8 +82,8 @@ QVariant ProteinTableProxyModel::headerData(int section, Qt::Orientation orienta
role);
}
ProteinTableModel::ProteinTableModel(QObject *parent, ProteinListWindow * p_protein_list_window)
:QAbstractTableModel(parent)
ProteinTableModel::ProteinTableModel(ProteinListWindow * p_protein_list_window)
:QAbstractTableModel(p_protein_list_window)
{
_p_protein_list_window = p_protein_list_window;
//ui->tableView->show();
......@@ -99,6 +99,7 @@ void ProteinTableModel::onProteinSearchEdit(QString protein_search_string) {
QModelIndex topLeft = createIndex(0,0);
QModelIndex bottomRight = createIndex(rowCount(),columnCount());
emit dataChanged(topLeft, bottomRight);
_p_protein_list_window->updateStatusBar();
}
void ProteinTableModel::setIdentificationGroup(IdentificationGroup * p_identification_group) {
......@@ -209,6 +210,7 @@ void ProteinTableModel::onTableClicked(const QModelIndex &index)
_p_identification_group->getProteinMatchList().at(row)->setChecked(true);
}
//emit dataChanged(index, index);
_p_protein_list_window->updateStatusBar();
}
else {
......
......@@ -35,7 +35,7 @@ class ProteinTableProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
ProteinTableProxyModel(QObject* parent,ProteinTableModel* protein_table_model_p);
ProteinTableProxyModel(ProteinTableModel* protein_table_model_p);
bool filterAcceptsRow(int source_row,
const QModelIndex &source_parent) const override;
QVariant headerData(int section, Qt::Orientation orientation,
......@@ -54,7 +54,7 @@ class ProteinTableModel: public QAbstractTableModel
{
Q_OBJECT
public:
ProteinTableModel(QObject *parent, ProteinListWindow * p_protein_list_window);
ProteinTableModel(ProteinListWindow * p_protein_list_window);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
......
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