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

button to get SVG file

parent acc0528f
No related branches found
No related tags found
No related merge requests found
......@@ -319,6 +319,13 @@
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>get SVG</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
......@@ -387,8 +394,8 @@
<slot>doMsmsPrecisionValueChanged(double)</slot>
<hints>
<hint type="sourcelabel">
<x>767</x>
<y>350</y>
<x>804</x>
<y>325</y>
</hint>
<hint type="destinationlabel">
<x>870</x>
......@@ -403,8 +410,8 @@
<slot>doMsmsPrecisionUnitChanged(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>680</x>
<y>355</y>
<x>716</x>
<y>324</y>
</hint>
<hint type="destinationlabel">
<x>873</x>
......@@ -412,11 +419,28 @@
</hint>
</hints>
</connection>
<connection>
<sender>pushButton_2</sender>
<signal>clicked()</signal>
<receiver>PeptideDetailView</receiver>
<slot>doSaveSvg()</slot>
<hints>
<hint type="sourcelabel">
<x>729</x>
<y>348</y>
</hint>
<hint type="destinationlabel">
<x>866</x>
<y>334</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>chooseDefaultMzDataDir()</slot>
<slot>openInPeptideViewer()</slot>
<slot>doMsmsPrecisionValueChanged(double)</slot>
<slot>doMsmsPrecisionUnitChanged(QString)</slot>
<slot>doSaveSvg()</slot>
</slots>
</ui>
......@@ -23,6 +23,7 @@
#include "peptidewindow.h"
#include "../project_view/projectwindow.h"
#include "../../config.h"
#include "ui_peptide_detail_view.h"
#include <pappsomspp/exception/exceptionnotfound.h>
#include <pappsomspp/spectrum/qualifiedspectrum.h>
......@@ -31,6 +32,8 @@
#include <QSettings>
#include <QDebug>
#include <QProcess>
#include <QSvgGenerator>
#include <QMessageBox>
void SpectrumSpLoaderThread::doLoadSpectrumSp (PeptideMatch * p_peptide_match) {
......@@ -229,7 +232,7 @@ void PeptideWindow::setPeptideMatch(PeptideMatch * p_peptide_match) {
void PeptideWindow::doMsmsPrecisionUnitChanged(QString unit) {
qDebug() << "PeptideWindow::doMsmsPrecisionUnitChanged begin " << unit;
qDebug() << "PeptideWindow::doMsmsPrecisionUnitChanged begin " << unit;
QSettings settings;
pappso::mz precision = ui->precision_spinbox->value();
......@@ -242,8 +245,8 @@ void PeptideWindow::doMsmsPrecisionUnitChanged(QString unit) {
ui->spectrumWidget->setPrecision(_p_precision);
settings.setValue("peptideview/precision_unit", unit);
qDebug() << "PeptideWindow::doMsmsPrecisionUnitChanged end " << unit;
qDebug() << "PeptideWindow::doMsmsPrecisionUnitChanged end " << unit;
}
void PeptideWindow::doMsmsPrecisionValueChanged(double precision_value) {
......@@ -262,3 +265,41 @@ void PeptideWindow::doMsmsPrecisionValueChanged(double precision_value) {
settings.setValue("peptideview/precision_value", precision);
}
void PeptideWindow::doSaveSvg() {
try {
QSettings settings;
QString default_location = settings.value("path/export_svg", "").toString();
QString filename = QFileDialog::getSaveFileName(this, tr("Save SVG file"),
QString("%1/untitled.svg").arg(default_location),
tr("Scalable Vector Graphic (*.svg)"));
if (filename.isEmpty()) {
return;
}
settings.setValue("path/export_svg", QFileInfo(filename).absolutePath());
QSvgGenerator generator;
//generator.setOutputDevice(&buffer);
generator.setFileName(filename);
generator.setSize(QSize(1200, 500));
generator.setViewBox(QRect(0, 0, 1200, 500));
generator.setTitle(tr("%1 SVG spectrum generator").arg(SOFTWARE_NAME));
generator.setDescription(tr("This is an annotated SVG spectrum"));
QPainter painter;
painter.begin(&generator);
ui->spectrumWidget->paint(painter);
painter.end();
//emit operateXpipFile(filename);
}
catch (pappso::PappsoException & error) {
QMessageBox::warning(this,
tr("Error trying to save spectrum to SVG file :"), error.qwhat());
}
}
......@@ -78,6 +78,7 @@ protected slots:
void doSpectrumSpReady(pappso::SpectrumSp spectrum_sp, QString error);
void doMsmsPrecisionValueChanged(double precision_value);
void doMsmsPrecisionUnitChanged(QString unit);
void doSaveSvg();
void chooseDefaultMzDataDir();
void openInPeptideViewer();
protected :
......
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