Commit fcd1a198 authored by Renne Thomas's avatar Renne Thomas
Browse files

Indentation

parent 9b8a6069
/*******************************************************************************
* Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
* Copyright (c) 2019 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
*
* This file is part of XTPcpp.
*
......@@ -18,7 +18,7 @@
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
* Thomas Renne <thomas.renne@u-psud.fr>. - initial API and
*implementation
******************************************************************************/
......@@ -30,19 +30,15 @@
#include <odsstream/odsdocwriter.h>
#include <odsstream/qtablewriter.h>
MsIdentificationListQactionColumn::MsIdentificationListQactionColumn(MsIdentificationListWindow *parent,
msIdentificationListColumn column)
MsIdentificationListQactionColumn::MsIdentificationListQactionColumn(
MsIdentificationListWindow *parent, msIdentificationListColumn column)
: QAction(parent)
{
this->setText(MsIdentificationTableModel::getTitle(column));
this->setCheckable(true);
// evalue_action.setChecked(_display_evalue);
// connect(p_action, SIGNAL(toggled(bool)), this,
// SLOT(showEvalueColumn(bool)));
m_column = column;
m_column = column;
m_msid_list_window = parent;
#if QT_VERSION >= 0x050000
......@@ -60,8 +56,8 @@ MsIdentificationListQactionColumn::MsIdentificationListQactionColumn(MsIdentific
MsIdentificationListQactionColumn::~MsIdentificationListQactionColumn()
{
// if (_p_ms_data_file != nullptr) delete _p_ms_data_file;
qDebug() << "MsIdentificationListQactionColumn::~MsIdentificationListQactionColumn begin ";
qDebug() << "MsIdentificationListQactionColumn::~"
"MsIdentificationListQactionColumn begin ";
}
void
MsIdentificationListQactionColumn::doToggled(bool toggled)
......@@ -84,15 +80,16 @@ MsIdentificationListWindow::MsIdentificationListWindow(ProjectWindow *parent)
m_msid_table_model_p = new MsIdentificationTableModel(this);
m_proxy_model = new MsIdentificationTableProxyModel(this, m_msid_table_model_p);
m_proxy_model =
new MsIdentificationTableProxyModel(this, m_msid_table_model_p);
m_proxy_model->setSourceModel(m_msid_table_model_p);
m_proxy_model->setDynamicSortFilter(true);
ui->tableView->setModel(m_proxy_model);
ui->tableView->setSortingEnabled(true);
ui->tableView->setAlternatingRowColors(true);
connect(ui->centralwidget,
connect(ui->centralwidget,
&QWidget::customContextMenuRequested,
this,
&MsIdentificationListWindow::showContextMenu);
......@@ -128,28 +125,24 @@ MsIdentificationListWindow::resizeColumnsToContents()
MsIdentificationListWindow::~MsIdentificationListWindow()
{
// if (_p_ms_data_file != nullptr) delete _p_ms_data_file;
// delete ui;
// if(_p_context_menu != nullptr)
// {
// delete _p_context_menu;
// }
}
void
MsIdentificationListWindow::setIdentificationDataSourceSpList(std::vector<IdentificationDataSourceSp>& identificationDataSourceSpList)
MsIdentificationListWindow::setIdentificationDataSourceSpList(
std::vector<IdentificationDataSourceSp> &identificationDataSourceSpList)
{
qDebug() << "MsIdentificationListWindow::setIdentificationGroup begin ";
m_msid_table_model_p->setIdentificationDataSourceSpList(identificationDataSourceSpList);
m_msid_table_model_p->setIdentificationDataSourceSpList(
identificationDataSourceSpList);
qDebug() << "MsIdentificationListWindow::setIdentificationGroup end";
}
void
MsIdentificationListWindow::setMsIdentificationListColumnDisplay(msIdentificationListColumn column,
bool toggled)
MsIdentificationListWindow::setMsIdentificationListColumnDisplay(
msIdentificationListColumn column, bool toggled)
{
m_proxy_model->setMsIdentificationListColumnDisplay(column, toggled);
}
/*******************************************************************************
* Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
* Copyright (c) 2019 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
*
* This file is part of XTPcpp.
*
......@@ -18,7 +18,7 @@
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
* Thomas Renne <thomas.renne@u-psud.fr>. - initial API and
*implementation
******************************************************************************/
......@@ -45,7 +45,7 @@ class MsIdentificationListQactionColumn : public QAction
Q_OBJECT
public:
explicit MsIdentificationListQactionColumn(MsIdentificationListWindow *parent,
msIdentificationListColumn column);
msIdentificationListColumn column);
~MsIdentificationListQactionColumn();
public slots:
......@@ -66,17 +66,19 @@ class MsIdentificationListWindow : public QMainWindow
public:
explicit MsIdentificationListWindow(ProjectWindow *parent = 0);
~MsIdentificationListWindow();
void setIdentificationDataSourceSpList(std::vector<IdentificationDataSourceSp>& identificationDataSourceSpList);
void setMsIdentificationListColumnDisplay(msIdentificationListColumn column, bool toggled);
void setIdentificationDataSourceSpList(
std::vector<IdentificationDataSourceSp> &identificationDataSourceSpList);
void setMsIdentificationListColumnDisplay(msIdentificationListColumn column,
bool toggled);
void resizeColumnsToContents();
protected slots:
void showContextMenu(const QPoint &);
private:
Ui::MsIdentificationView *ui;
MsIdentificationTableModel *m_msid_table_model_p = nullptr;
MsIdentificationTableProxyModel *m_proxy_model = nullptr;
MsIdentificationTableProxyModel *m_proxy_model = nullptr;
ProjectWindow *m_project_window;
QMenu *_p_context_menu = nullptr;
bool _display_evalue = true;
......
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>.
* Copyright (c) 2019 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
......@@ -18,7 +18,7 @@
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and
* Thomas Renne <thomas.renne@u-psud.fr>. - initial API and
*implementation
******************************************************************************/
......@@ -29,7 +29,8 @@
#include "msidentificationlistwindow.h"
#include "../../../utils/identificationdatasourcestore.h"
MsIdentificationTableModel::MsIdentificationTableModel(MsIdentificationListWindow *ms_id_list_window)
MsIdentificationTableModel::MsIdentificationTableModel(
MsIdentificationListWindow *ms_id_list_window)
: QAbstractTableModel(ms_id_list_window)
{
m_ms_id_list_window = ms_id_list_window;
......@@ -37,16 +38,13 @@ MsIdentificationTableModel::MsIdentificationTableModel(MsIdentificationListWindo
void
MsIdentificationTableModel::setIdentificationDataSourceSpList(
std::vector<IdentificationDataSourceSp>& identificationDataSourceSpList)
std::vector<IdentificationDataSourceSp> &identificationDataSourceSpList)
{
qDebug() << " identificationDataSourceSpList.size()=" << identificationDataSourceSpList.size();
qDebug() << " identificationDataSourceSpList.size()="
<< identificationDataSourceSpList.size();
beginResetModel();
m_identificationDataSourceSpList = identificationDataSourceSpList;
// emit headerDataChanged(Qt::Horizontal, 0,11);
// refresh();
qDebug() ;
endResetModel();
m_ms_id_list_window->resizeColumnsToContents();
......@@ -59,7 +57,8 @@ MsIdentificationTableModel::rowCount(const QModelIndex &parent) const
// qDebug() << "MsIdentificationTableModel::rowCount begin ";
if(m_identificationDataSourceSpList.size() != 0)
{
// qDebug() << "MsIdentificationTableModel::rowCount(const QModelIndex &parent ) "
// qDebug() << "MsIdentificationTableModel::rowCount(const QModelIndex
// &parent ) "
// << _p_identification_group->getProteinMatchList().size();
return (int)m_identificationDataSourceSpList.size();
}
......@@ -103,9 +102,6 @@ MsIdentificationTableModel::getTitle(std::int8_t column)
case(std::int8_t)msIdentificationListColumn::mzML:
return "mzML";
break;
// case(std::int8_t)msIdentificationListColumn::test:
// return "Test";
// break;
}
return "";
}
......@@ -134,8 +130,8 @@ MsIdentificationTableModel::getDescription(std::int8_t column)
QVariant
MsIdentificationTableModel::headerData(int section,
Qt::Orientation orientation,
int role) const
Qt::Orientation orientation,
int role) const
{
if(orientation == Qt::Horizontal)
{
......@@ -150,7 +146,7 @@ MsIdentificationTableModel::headerData(int section,
break;
case Qt::SizeHintRole:
qDebug() << section;
return QSize(getColumnWidth(section),40);
return QSize(getColumnWidth(section), 40);
break;
}
}
......@@ -167,7 +163,7 @@ MsIdentificationTableModel::getColumnWidth(int column)
return 300;
break;
case(int)msIdentificationListColumn::id_file:
return 300;
return 500;
break;
case(int)msIdentificationListColumn::mzML:
return 300;
......@@ -192,29 +188,26 @@ MsIdentificationTableModel::data(const QModelIndex &index, int role) const
{
case Qt::SizeHintRole:
qDebug() << MsIdentificationTableModel::getColumnWidth(col);
return QSize(MsIdentificationTableModel::getColumnWidth(col), 30);
break;
case Qt::DisplayRole:
switch(col)
{
case(std::int8_t)msIdentificationListColumn::run_id:
return QVariant(m_identificationDataSourceSpList
.at(row)
->getSampleName());
return QVariant(
m_identificationDataSourceSpList.at(row)->getSampleName());
}
if(col == (std::int8_t)msIdentificationListColumn::id_file)
{
return QVariant(m_identificationDataSourceSpList
.at(row)
->getResourceName());
return QVariant(
m_identificationDataSourceSpList.at(row)->getResourceName());
}
if(col == (std::int8_t)msIdentificationListColumn::mzML)
{
return QVariant(m_identificationDataSourceSpList
.at(row)
->getXmlId());
return QVariant(
m_identificationDataSourceSpList.at(row)->getXmlId());
}
return QVariant();
}
......
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>.
* Copyright (c) 2019 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
......@@ -18,18 +18,18 @@
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and
* Thomas Renne <thomas.renne@u-psud.fr>. - initial API and
*implementation
******************************************************************************/
#pragma once
#include <QAbstractTableModel>
//#include <core/identificationgroup.h>
#include "../../../core/project.h"
/** \def msIdentificationListColumn list of available fields to display in protein list
/** \def msIdentificationListColumn list of available fields to display in ms
* Identification list
*
*/
......@@ -61,10 +61,12 @@ class MsIdentificationTableModel : public QAbstractTableModel
static const QString getDescription(msIdentificationListColumn column);
static const QString getTitle(std::int8_t column);
static const QString getDescription(std::int8_t column);
static msIdentificationListColumn getMsIdentificationListColumn(std::int8_t column);
static msIdentificationListColumn
getMsIdentificationListColumn(std::int8_t column);
void setIdentificationDataSourceSpList(std::vector<IdentificationDataSourceSp>& identificationDataSourceSpList);
void setIdentificationDataSourceSpList(
std::vector<IdentificationDataSourceSp> &identificationDataSourceSpList);
public slots:
void onMsIdentificationDataChanged();
......
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>.
* Copyright (c) 2019 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
......@@ -18,7 +18,7 @@
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and
* Thomas Renne <thomas.renne@u-psud.fr>. - initial API and
*implementation
******************************************************************************/
......@@ -37,33 +37,32 @@ MsIdentificationTableProxyModel::MsIdentificationTableProxyModel(
: QSortFilterProxyModel(msid_table_model_p)
{
m_msid_table_model_p = msid_table_model_p;
m_msid_list_window = msid_list_window;
m_msid_list_window = msid_list_window;
m_column_display.resize(30);
qDebug() << "Test creation data";
QSettings settings;
for(std::size_t i = 0; i < m_column_display.size(); i++)
{
m_column_display[i] =
settings
.value(QString("msid_list_columns/%1")
.arg(m_msid_table_model_p->getTitle((msIdentificationListColumn)i)),
"true")
.toBool();
m_column_display[i] = settings
.value(QString("msid_list_columns/%1")
.arg(m_msid_table_model_p->getTitle(
(msIdentificationListColumn)i)),
"true")
.toBool();
}
m_percent_delegate =
new PercentItemDelegate(m_msid_list_window->ui->tableView);
new PercentItemDelegate(m_msid_list_window->ui->tableView);
}
MsIdentificationTableProxyModel::~MsIdentificationTableProxyModel()
{
// delete _percent_delegate;
}
bool
MsIdentificationTableProxyModel::lessThan(const QModelIndex &left,
const QModelIndex &right) const
const QModelIndex &right) const
{
QVariant leftData = sourceModel()->data(left);
QVariant rightData = sourceModel()->data(right);
......@@ -91,8 +90,8 @@ MsIdentificationTableProxyModel::data(const QModelIndex &index, int role) const
QVariant
MsIdentificationTableProxyModel::headerData(int section,
Qt::Orientation orientation,
int role) const
Qt::Orientation orientation,
int role) const
{
int col = mapToSource(index(0, section)).column();
......@@ -101,8 +100,8 @@ MsIdentificationTableProxyModel::headerData(int section,
void
MsIdentificationTableProxyModel::setMsIdentificationListColumnDisplay(msIdentificationListColumn column,
bool toggled)
MsIdentificationTableProxyModel::setMsIdentificationListColumnDisplay(
msIdentificationListColumn column, bool toggled)
{
qDebug() << toggled;
beginResetModel();
......@@ -113,5 +112,4 @@ MsIdentificationTableProxyModel::setMsIdentificationListColumnDisplay(msIdentifi
m_column_display[(std::int8_t)column] = toggled;
endResetModel();
}
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>.
* Copyright (c) 2019 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
......@@ -18,7 +18,7 @@
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and
* Thomas Renne <thomas.renne@u-psud.fr>. - initial API and
*implementation
******************************************************************************/
......@@ -38,19 +38,21 @@ class MsIdentificationTableProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
MsIdentificationTableProxyModel(MsIdentificationListWindow *m_msid_list_window,
MsIdentificationTableModel *m_msid_table_model_p);
MsIdentificationTableProxyModel(
MsIdentificationListWindow *m_msid_list_window,
MsIdentificationTableModel *m_msid_table_model_p);
virtual ~MsIdentificationTableProxyModel();
QVariant headerData(int section, Qt::Orientation orientation,
int role) const override;
QVariant
headerData(int section, Qt::Orientation orientation, int role) const override;
QVariant data(const QModelIndex &index,
int role = Qt::DisplayRole) const override;
bool lessThan(const QModelIndex &left,
const QModelIndex &right) const override;
void setMsIdentificationListColumnDisplay(msIdentificationListColumn column, bool toggled);
void setMsIdentificationListColumnDisplay(msIdentificationListColumn column,
bool toggled);
private:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment