#include "datamanager.h"
#include "imagedrawer.h"
#include "logger.h"
-#include "gui/exportgraphtoimagedialog.h"
-#include "gui/exportrawdatadialog.h"
#include <QtWidgets/QMessageBox>
#include <QDebug>
m_sequences.push_back(std::make_pair<const QString, std::shared_ptr<Sequence>>("Single runs", std::shared_ptr<Sequence>(new Sequence())));
m_seqSelModel.setSequences(&m_sequences);
m_sigNameCodec = QTextCodec::codecForName("ISO-8859-1");
+
+ m_oldExportToImageParams = ExportGraphToImageDialog::Parameters();
}
void DataManager::saveUserDataOnExit()
void DataManager::onExportGraphToImage()
{
- ExportGraphToImageDialog dlg(ImageDrawer::supportedImageFormats());
+ ExportGraphToImageDialog dlg(ImageDrawer::supportedImageFormats(), m_oldExportToImageParams);
std::shared_ptr<SingleRunData> sr;
int ret = 1;
} else
break;
} while (ret == 1);
+
+ m_oldExportToImageParams = dlg.parameters();
}
void DataManager::onExportPeaks()
#include "datafileexporter.h"
#include "datafilesloader.h"
+#include "gui/exportgraphtoimagedialog.h"
+#include "gui/exportrawdatadialog.h"
#include "gui/signalview.h"
#include "sequence.h"
#include "sequenceselectormodel.h"
std::vector<NameSequencePair> m_sequences;
DataFilesLoader m_dfl;
+ ExportGraphToImageDialog::Parameters m_oldExportToImageParams;
+
static const QString ME_SENDER_STR;
static const char UNIT_KILOVOLTS_TEXT[];
static const char UNIT_MICROAMPERES_TEXT[];
/* Public functions */
-ExportGraphToImageDialog::ExportGraphToImageDialog(QList<QByteArray> formats, QWidget *parent) :
+ExportGraphToImageDialog::ExportGraphToImageDialog(QList<QByteArray> formats, Parameters params, QWidget *parent) :
QDialog(parent),
m_curKey(""),
ui(new Ui::ExportGraphToImageDialog)
connect(ui->qpb_ok, SIGNAL(clicked()), this, SLOT(checkAndAccept()));
connect(ui->qcbox_signal, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeBounds(QString)));
connect(ui->qle_destPath, SIGNAL(textChanged(QString)), this, SLOT(onFileNameChanged(QString)));
+
+ ui->qle_width->setText(QString::number(params.width));
+ ui->qle_height->setText(QString::number(params.height));
+ ui->qcbox_outputFormat->setCurrentIndex(params.formatIdx);
+ ui->qck_includeInteg->setChecked(params.includePeaks);
}
void ExportGraphToImageDialog::addSignal(const double fromX, const double fromY, const double toX, const double toY, const std::string& key)
return h;
}
+ExportGraphToImageDialog::Parameters ExportGraphToImageDialog::parameters() const
+{
+ return Parameters(imageWidth(), imageHeight(), ui->qcbox_outputFormat->currentIndex(), ui->qck_includeInteg->isChecked());
+}
+
QString ExportGraphToImageDialog::path() const
{
return ui->qle_destPath->text();
typedef std::tuple<double, double, double, double> Bounds;
public:
- explicit ExportGraphToImageDialog(QList<QByteArray> formats, QWidget* parent = nullptr);
+ struct Parameters {
+ Parameters() : width(1000), height(1000), formatIdx(0), includePeaks(false) {}
+ Parameters(const int width, const int height, const int formatIdx, const bool includePeaks) :
+ width(width), height(height), formatIdx(formatIdx), includePeaks(includePeaks) {}
+
+ int width;
+ int height;
+ int formatIdx;
+ bool includePeaks;
+ };
+
+ explicit ExportGraphToImageDialog(QList<QByteArray> formats, Parameters params = Parameters(), QWidget* parent = nullptr);
~ExportGraphToImageDialog();
void addSignal(const double fromX, const double fromY, const double toX, const double toY, const std::string& key);
double fromX() const;
QString imageFormat() const;
int imageHeight() const;
bool includePeaks() const;
+ Parameters parameters() const;
QString path() const;
QString selectedSignal() const;
double toX() const;