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

peptide list view menu modified to export as ODS file

parent e71475d8
No related branches found
No related tags found
No related merge requests found
......@@ -35,31 +35,6 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayoutcb">
<item>
<widget class="QCheckBox" name="hideNotValidCheckBox">
<property name="text">
<string>show only valid peptides</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hideNotCheckedCheckBox">
<property name="text">
<string>show only checked peptides</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hideNotGroupedCheckBox">
<property name="text">
<string>show only grouped peptides</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableView" name="tableView"/>
</item>
......@@ -125,8 +100,53 @@
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuExport">
<property name="title">
<string>e&amp;xport</string>
</property>
<addaction name="actionAs_ODS_file"/>
</widget>
<widget class="QMenu" name="menuShow_only">
<property name="title">
<string>s&amp;how only</string>
</property>
<addaction name="actionValid_peptides"/>
<addaction name="actionChecked_peptides"/>
<addaction name="actionGrouped_peptides"/>
</widget>
<addaction name="menuExport"/>
<addaction name="menuShow_only"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionAs_ODS_file">
<property name="text">
<string>&amp;as ODS file</string>
</property>
</action>
<action name="actionValid_peptides">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;valid peptides</string>
</property>
</action>
<action name="actionChecked_peptides">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;checked peptides</string>
</property>
</action>
<action name="actionGrouped_peptides">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;grouped peptides</string>
</property>
</action>
</widget>
<resources/>
<connections>
......@@ -211,50 +231,66 @@
</hints>
</connection>
<connection>
<sender>hideNotGroupedCheckBox</sender>
<sender>actionAs_ODS_file</sender>
<signal>triggered()</signal>
<receiver>PeptideView</receiver>
<slot>doExportAsOdsFile()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>412</x>
<y>201</y>
</hint>
</hints>
</connection>
<connection>
<sender>actionValid_peptides</sender>
<signal>toggled(bool)</signal>
<receiver>PeptideView</receiver>
<slot>doNotGroupedHide(bool)</slot>
<slot>doNotValidHide(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>815</x>
<y>112</y>
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>1079</x>
<y>360</y>
<x>412</x>
<y>201</y>
</hint>
</hints>
</connection>
<connection>
<sender>hideNotCheckedCheckBox</sender>
<sender>actionChecked_peptides</sender>
<signal>toggled(bool)</signal>
<receiver>PeptideView</receiver>
<slot>doNotCheckedHide(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>612</x>
<y>112</y>
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>920</x>
<y>269</y>
<x>412</x>
<y>201</y>
</hint>
</hints>
</connection>
<connection>
<sender>hideNotValidCheckBox</sender>
<sender>actionGrouped_peptides</sender>
<signal>toggled(bool)</signal>
<receiver>PeptideView</receiver>
<slot>doNotValidHide(bool)</slot>
<slot>doNotGroupedHide(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>409</x>
<y>112</y>
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>839</x>
<y>171</y>
<x>412</x>
<y>201</y>
</hint>
</hints>
</connection>
......@@ -268,5 +304,6 @@
<slot>doMsrunFileSearch(QString)</slot>
<slot>doScanNumberSearch(int)</slot>
<slot>doModificationSearch(QString)</slot>
<slot>doExportAsOdsFile()</slot>
</slots>
</ui>
......@@ -23,6 +23,8 @@
******************************************************************************/
#include <QSettings>
#include <odsstream/odsdocwriter.h>
#include <odsstream/qtablewriter.h>
#include "peptidelistwindow.h"
#include "../project_view/projectwindow.h"
......@@ -47,7 +49,9 @@ PeptideListQactionColumn::PeptideListQactionColumn(PeptideListWindow *parent,
#if QT_VERSION >= 0x050000
// Qt5 code
connect(this, &PeptideListQactionColumn::toggled, this,
connect(this,
&PeptideListQactionColumn::toggled,
this,
&PeptideListQactionColumn::doToggled);
#else
// Qt4 code
......@@ -96,19 +100,19 @@ PeptideListWindow::PeptideListWindow(ProjectWindow *parent)
bool hide = settings.value("peptideview/hidenotvalid", "true").toBool();
if(hide)
{
ui->hideNotValidCheckBox->setCheckState(Qt::Checked);
ui->actionValid_peptides->setChecked(Qt::Checked);
}
_p_proxy_model->hideNotValid(hide);
hide = settings.value("peptideview/hidenotchecked", "false").toBool();
if(hide)
{
ui->hideNotCheckedCheckBox->setCheckState(Qt::Checked);
ui->actionChecked_peptides->setChecked(Qt::Checked);
}
_p_proxy_model->hideNotChecked(hide);
hide = settings.value("peptideview/hidenotgrouped", "false").toBool();
if(hide)
{
ui->hideNotGroupedCheckBox->setCheckState(Qt::Checked);
ui->actionGrouped_peptides->setChecked(Qt::Checked);
}
_p_proxy_model->hideNotGrouped(hide);
......@@ -119,30 +123,47 @@ PeptideListWindow::PeptideListWindow(ProjectWindow *parent)
#if QT_VERSION >= 0x050000
// Qt5 code
connect(_project_window, &ProjectWindow::identificationGroupGrouped, this,
connect(_project_window,
&ProjectWindow::identificationGroupGrouped,
this,
&PeptideListWindow::doIdentificationGroupGrouped);
connect(this, &PeptideListWindow::peptideDataChanged, _peptide_table_model_p,
connect(this,
&PeptideListWindow::peptideDataChanged,
_peptide_table_model_p,
&PeptideTableModel::onPeptideDataChanged);
connect(ui->tableView, &QTableView::clicked, _p_proxy_model,
connect(ui->tableView,
&QTableView::clicked,
_p_proxy_model,
&PeptideTableProxyModel::onTableClicked);
connect(_peptide_table_model_p, &PeptideTableModel::layoutChanged, this,
connect(_peptide_table_model_p,
&PeptideTableModel::layoutChanged,
this,
&PeptideListWindow::updateStatusBar);
connect(ui->centralwidget, &QWidget::customContextMenuRequested, this,
connect(ui->centralwidget,
&QWidget::customContextMenuRequested,
this,
&PeptideListWindow::showContextMenu);
#else
// Qt4 code
connect(_project_window,
SIGNAL(identificationGroupGrouped(IdentificationGroup *)), this,
SIGNAL(identificationGroupGrouped(IdentificationGroup *)),
this,
SLOT(doIdentificationGroupGrouped(IdentificationGroup *)));
connect(this, SIGNAL(peptideDataChanged()), _peptide_table_model_p,
connect(this,
SIGNAL(peptideDataChanged()),
_peptide_table_model_p,
SLOT(onPeptideDataChanged()));
connect(ui->tableView, SIGNAL(clicked(const QModelIndex &)), _p_proxy_model,
connect(ui->tableView,
SIGNAL(clicked(const QModelIndex &)),
_p_proxy_model,
SLOT(onTableClicked(const QModelIndex &)));
connect(_peptide_table_model_p, SIGNAL(layoutChanged()), this,
connect(_peptide_table_model_p,
SIGNAL(layoutChanged()),
this,
SLOT(updateStatusBar()));
/*
......@@ -417,3 +438,32 @@ PeptideListWindow::getPeptideListColumnDisplay(PeptideListColumn column) const
{
return _p_proxy_model->getPeptideListColumnDisplay(column);
}
void
PeptideListWindow::doExportAsOdsFile()
{
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
QSettings settings;
QString default_location = settings.value("path/export_ods", "").toString();
QString filename;
filename = QFileDialog::getSaveFileName(
this,
tr("Save ODS file"),
QString("%1/untitled.ods").arg(default_location),
tr("Open Document Spreadsheet (*.ods)"));
CalcWriterInterface *p_writer = new OdsDocWriter(filename);
const QAbstractProxyModel *p_table_model = _p_proxy_model;
QtableWriter table_writer(p_writer, p_table_model);
// table_writer.setFormatPercentForColumn(
// _peptide_table_model_p->index(0, (int)ProteinListColumn::coverage));
table_writer.writeSheet("protein list");
p_writer->close();
delete p_writer;
}
......@@ -84,6 +84,7 @@ class PeptideListWindow : public QMainWindow
protected slots:
void showContextMenu(const QPoint &pos);
void doExportAsOdsFile();
signals:
void identificationGroupEdited(IdentificationGroup *p_identification_group);
......
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