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

Add lock axis through boxes option

parent 78221120
......@@ -1150,7 +1150,8 @@ ProjectWindow::doExportXicAreaToCsv(QString filename,
{
qDebug() << "Export Xic to csv";
showWaitingMessage("Export All XIC area to CSV");
emit operateWriteXicAreaInCsv(filename, xic_boxs);
QString project_name = getProjectSP()->getProjectName();
emit operateWriteXicAreaInCsv(filename, project_name, xic_boxs);
}
void
ProjectWindow::doExportXicAreaToCsvFinished()
......
......@@ -119,6 +119,7 @@ class ProjectWindow : public QMainWindow
void bestMsRunFound(MsRunSp msrun_sp);
void operateMassChroqExportDialog();
void operateWriteXicAreaInCsv(QString filename,
QString project_name,
std::vector<XicBox *> xic_boxs);
protected:
......
......@@ -923,10 +923,10 @@ WorkerThread::doCheckMsrunFilePath(ProjectSp msp_project)
void
WorkerThread::doWriteXicAreaInCsv(QString filename,
QString project_name,
std::vector<XicBox *> xic_boxs)
{
CalcWriterInterface *p_writer = nullptr;
emit loadingMessage(tr("writing TSV files, please wait"));
QSettings settings;
QString xic_export_file =
......@@ -934,18 +934,18 @@ WorkerThread::doWriteXicAreaInCsv(QString filename,
p_writer = new TsvDirectoryWriter(filename);
if(xic_export_file == "both")
{
XicAreaSheet(p_writer, xic_boxs);
XicAreaSheet(p_writer, project_name, xic_boxs);
bool all_data = true;
XicAreaSheet(p_writer, xic_boxs, all_data);
XicAreaSheet(p_writer, project_name, xic_boxs, all_data);
}
else if(xic_export_file == "all")
{
bool all_data = true;
XicAreaSheet(p_writer, xic_boxs, all_data);
XicAreaSheet(p_writer, project_name, xic_boxs, all_data);
}
else // xic_export_file == "area"
{
XicAreaSheet(p_writer, xic_boxs);
XicAreaSheet(p_writer, project_name, xic_boxs);
}
p_writer->close();
emit exportXicToCsvFinished();
......
......@@ -90,7 +90,9 @@ class WorkerThread : public QObject
void doFindBestMsrunForAlignment(ProjectSp project_sp,
MsRunAlignmentGroupSp alignment_group);
void doCheckMsrunFilePath(ProjectSp project_sp);
void doWriteXicAreaInCsv(QString filename, std::vector<XicBox *> xic_boxs);
void doWriteXicAreaInCsv(QString filename,
QString project_name,
std::vector<XicBox *> xic_boxs);
signals:
void loadingMessage(QString message);
......
......@@ -181,6 +181,20 @@ XicBox::XicBox(XicWindow *parent) : QWidget(parent), ui(new Ui::XicBox)
&XicWindow::rtUnitChangeNeeded,
this,
&XicBox::onRtUnitChanged);
/** @brief Handle axis size to move simultaneously in boxs
*/
connect(ui->xic_widget->getRtAxisP(),
qOverload<const QCPRange &>(&QCPAxis::rangeChanged),
this,
&XicBox::doGetNewRtRange);
connect(ui->xic_widget->getIntensityAxisP(),
qOverload<const QCPRange &>(&QCPAxis::rangeChanged),
this,
&XicBox::doGetNewIntensityRange);
connect(
this, &XicBox::fitAxisRangeInXics, _p_xic_window, &XicWindow::doFitAllAxis);
#else
// Qt4 code
#endif
......@@ -205,6 +219,25 @@ XicBox::~XicBox()
_xic_thread.wait();
}
void
XicBox::rescaleXicWidget(QString axis_name, QCPRange new_range)
{
ui->xic_widget->rescaleOneRange(axis_name, new_range);
}
void
XicBox::doGetNewRtRange(QCPRange new_range)
{
emit fitAxisRangeInXics("xAxis", new_range);
}
void
XicBox::doGetNewIntensityRange(QCPRange new_range)
{
emit fitAxisRangeInXics("yAxis", new_range);
}
void
XicBox::onXicWidgetClick(double rt [[maybe_unused]],
double intensity [[maybe_unused]])
......
......@@ -71,6 +71,8 @@ class XicBox : public QWidget
std::vector<XicBoxNaturalIsotope> getNaturalIsotopList() const;
MsRunSp getMsRunSp();
void rescaleXicWidget(QString axis_name, QCPRange intensity_range);
signals:
void loadXic(MsRunSp p_msrun,
std::vector<pappso::pappso_double> mz_list,
......@@ -80,6 +82,8 @@ class XicBox : public QWidget
unsigned int charge,
pappso::PrecisionPtr precision,
double minimum_isotope_pattern_ratio);
void fitAxisRangeInXics(QString axis_name, QCPRange new_range);
private slots:
void remove();
void reExtractXic();
......@@ -93,6 +97,8 @@ class XicBox : public QWidget
void onRtUnitChanged();
void onXicWidgetClick(double rt, double intensity);
void onIsotopicDistributionClick();
void doGetNewRtRange(QCPRange new_range);
void doGetNewIntensityRange(QCPRange new_range);
private:
void drawObservedAreaBars(
......
......@@ -214,17 +214,33 @@ XicWindow::doExportXicToCsv()
emit operateXicAreaToCsv(filename, xic_boxs);
}
void XicWindow::doChangeLockXaxisRule()
void
XicWindow::doChangeLockXaxisRule()
{
if(m_lockXaxis)
{
ui->toolButton->setIcon(QIcon(":/icons/resources/icons/apache/firefox/unlock_icon.svg"));
m_lockXaxis = false;
}
{
ui->toolButton->setIcon(
QIcon(":/icons/resources/icons/apache/firefox/unlock_icon.svg"));
m_lockXaxis = false;
}
else
{
ui->toolButton->setIcon(QIcon(":/icons/resources/icons/apache/firefox/lock_icon.svg"));
m_lockXaxis = true;
{
ui->toolButton->setIcon(
QIcon(":/icons/resources/icons/apache/firefox/lock_icon.svg"));
m_lockXaxis = true;
}
}
}
void
XicWindow::doFitAllAxis(QString axis_name, QCPRange new_range)
{
if(m_lockXaxis)
{
for(int i = 0; i < ui->verticalLayout->layout()->count(); i++)
{
XicBox *p_xic =
dynamic_cast<XicBox *>(ui->verticalLayout->itemAt(i)->widget());
p_xic->rescaleXicWidget(axis_name, new_range);
}
}
}
......@@ -36,6 +36,7 @@
#include "../../core/peptideevidence.h"
#include "xic_widgets/zivydialog.h"
#include <qcustomplot.h>
class ProjectWindow;
......@@ -76,7 +77,8 @@ class XicWindow : public QMainWindow
void doXicExtractionMethodChanged(pappso::XicExtractMethod xic_method);
void doExportXicToCsv();
void doChangeLockXaxisRule();
void doFitAllAxis(QString axis_name, QCPRange new_range);
signals:
void reExtractXicNeeded();
void rtUnitChangeNeeded();
......
......@@ -31,6 +31,7 @@
#include "xicareasheet.h"
XicAreaSheet::XicAreaSheet(CalcWriterInterface *p_writer,
QString project_name,
const std::vector<XicBox *> xic_boxs,
bool all_data)
{
......@@ -43,7 +44,7 @@ XicAreaSheet::XicAreaSheet(CalcWriterInterface *p_writer,
mp_writer->setCurrentOdsTableSettings(table_settings);
if(all_data)
{
mp_writer->writeSheet("xic_all_data");
mp_writer->writeSheet(QString("%1_xic_all_data").arg(project_name));
writeHeadersAllData();
for(XicBox *xic : mp_xicBoxList)
{
......@@ -52,7 +53,7 @@ XicAreaSheet::XicAreaSheet(CalcWriterInterface *p_writer,
}
else
{
mp_writer->writeSheet("xic_area");
mp_writer->writeSheet(QString("%1_xic_are").arg(project_name));
writeHeaders();
for(XicBox *xic : mp_xicBoxList)
{
......
......@@ -37,6 +37,7 @@ class XicAreaSheet
{
public:
XicAreaSheet(CalcWriterInterface *p_writer,
QString project_name,
const std::vector<XicBox *> xic_boxs,
bool all_data = false);
......
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