imgresources.qrc
DEFINES += _HPCS_LITTLE_ENDIAN
+
+CONFIG(release)
+{
+ DEFINES += NDEBUG
+}
}
QString absPath = path.absoluteFilePath(s);
- qDebug() << absPath << absPath.toStdString().c_str();
HPCS_RetCode iret = hpcs_read_file(absPath.toStdString().c_str(), mdata);
if (iret == HPCS_OK)
DataManager::DataManager(QObject* parent) :
QObject(parent),
m_sequenceRejected(false),
+ m_exportRawDataDialog(DataFileExporter::supportedFormats()),
m_graphToImageExportDialog(ImageDrawer::supportedImageFormats())
{
m_sequences.push_back(std::make_pair<const QString, std::shared_ptr<Sequence>>("Single runs", std::shared_ptr<Sequence>(new Sequence())));
void DataManager::processDataExport(GeneratorFunc genfunc)
{
+ QMetaObject::Connection c1, c2;
DataFileExporter exporter(this);
- ExportRawDataDialog dlg(DataFileExporter::supportedFormats());
DataFileExporter::WriteList writeList;
std::shared_ptr<SingleRunData> sr = m_activeSequence->selectedRun();
int ret = 1;
- connect(&dlg, SIGNAL(fileNameChanged(QString)), &exporter, SLOT(guessFormatFromSuffix(QString)));
- connect(&exporter, SIGNAL(formatChanged(int)), &dlg, SLOT(onFormatChanged(int)));
+ m_exportRawDataDialog.removeAllSignals();
+ c1 = connect(&m_exportRawDataDialog, SIGNAL(fileNameChanged(QString)), &exporter, SLOT(guessFormatFromSuffix(QString)));
+ c2 = connect(&exporter, SIGNAL(formatChanged(int)), &m_exportRawDataDialog, SLOT(onFormatChanged(int)));
for (const std::string& s : sr->allKeys())
- dlg.addAvailableSignal(QString::fromStdString(s));
+ m_exportRawDataDialog.addAvailableSignal(QString::fromStdString(s));
do {
- int dret = dlg.exec();
+ int dret = m_exportRawDataDialog.exec();
if (dret == QDialog::Rejected)
ret = 0;
- else if (dret == QDialog::Accepted && !dlg.isSignalSelected()) {
+ else if (dret == QDialog::Accepted && !m_exportRawDataDialog.isSignalSelected()) {
QMessageBox::information(nullptr, S_RES_DATAEXPORT, "No signals selected");
- } else if (dret == QDialog::Accepted && dlg.isSignalSelected()) {
- std::vector<std::string> selKeys = dlg.selectedSignalKeys();
+ } else if (dret == QDialog::Accepted && m_exportRawDataDialog.isSignalSelected()) {
+ std::vector<std::string> selKeys = m_exportRawDataDialog.selectedSignalKeys();
DataFileExporter::ReturnCode exRet;
/* Generate data to export */
genfunc(writeList, sr, selKeys);
- exRet = exporter.exportData(writeList, dlg.destination(), dlg.format());
+ exRet = exporter.exportData(writeList, m_exportRawDataDialog.destination(), m_exportRawDataDialog.format());
switch (exRet) {
case DataFileExporter::ReturnCode::SUCCESS:
ret = 0;
}
}
} while (ret == 1);
+
+ disconnect(c1);
+ disconnect(c2);
}
Signal::Resource DataManager::resourceFromFiletype(HPCS_FileType filetype)
std::vector<NameSequencePair> m_sequences;
DataFilesLoader m_dfl;
+ ExportRawDataDialog m_exportRawDataDialog;
ExportGraphToImageDialog m_graphToImageExportDialog;
static const QString ME_SENDER_STR;
ExportRawDataDialog::ExportRawDataDialog(const QStringList& supportedFormats, QWidget* parent) :
QDialog(parent),
+ m_lastPath(""),
m_supportedFormats(supportedFormats),
ui(new Ui::ExportRawDataDialog)
{
{
QCheckBox* cbox = new QCheckBox(name, this);
m_signalCheckboxes.push_back(cbox);
- ui->form_availSigs->addWidget(cbox);
+ ui->form_availSigs->addRow(cbox);
}
QString ExportRawDataDialog::destination() const
return false;
}
+void ExportRawDataDialog::removeAllSignals()
+{
+ QLayoutItem* item;
+ while ((item = ui->form_availSigs->takeAt(0)) != nullptr) {
+ delete item->widget();
+ delete item;
+ }
+ m_signalCheckboxes.clear();
+}
+
std::vector<std::string> ExportRawDataDialog::selectedSignalKeys() const
{
std::vector<std::string> kl;
QString destination() const;
int format() const;
bool isSignalSelected() const;
+ void removeAllSignals();
std::vector<std::string> selectedSignalKeys() const;
int signalsCount() const { return m_signalCheckboxes.size(); }
private:
+ QString m_lastPath;
std::vector<QCheckBox*> m_signalCheckboxes;
QStringList m_supportedFormats;
Ui::ExportRawDataDialog* ui;
+/*
+ Copyright (c) 2013 Michal Malý <madcatxster@prifuk.cz>
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
#include "failedfilesdialog.h"
#include "ui_failedfilesdialog.h"
#include <QIcon>
+/*
+ Copyright (c) 2013 Michal Malý <madcatxster@prifuk.cz>
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
#ifndef FAILEDFILESDIALOG_H
#define FAILEDFILESDIALOG_H
return m_values.at(idx).first;
}
-/*QString Signal::uidString() const
-{
- return resourceToString() + QString::number(m_wavelengthAbs) + QString::number(m_wavelengthRef);
-}*/
-
double Signal::valueAt(const size_t idx) const
{
if (idx >= m_values.size())
Integrator::ReturnCode ret;
std::shared_ptr<IntegratedPeak> peak;
- qDebug() << __QFUNC__ << fromX << fromY << toX << toY;
+ //qDebug() << __QFUNC__ << fromX << fromY << toX << toY;
fromIdx = relToIdx(fromX);
toIdx = relToIdx(toX);
fromY = peak->fromY();
toY = peak->toY();
break;
+ default:
+ return PeakDrawData();
}
//qDebug() << __QFUNC__ << beforeFromY << fromY
p.begin(target);
switch (axis) {
- case SignalController::Axis::TIME:
- relMin = m_relXMin; relMax = m_relXMax;
- tickDrawFunc = std::bind(&SignalDrawer::renderTimeScaleTick, this, &p, std::placeholders::_1, std::placeholders::_2);
- textDrawFunc = std::bind(&SignalDrawer::renderTimeScaleText, this, &p, std::placeholders::_1, std::placeholders::_2);
- p.drawLine(SCALE_MARGIN_VALUE, m_gHeight + 1, m_gWidth + SCALE_MARGIN_VALUE, m_gHeight + 1);
- break;
- case SignalController::Axis::VALUE:
- relMin = m_relYMin; relMax = m_relYMax;
- tickDrawFunc = std::bind(&SignalDrawer::renderValueScaleTick, this, &p, std::placeholders::_1, std::placeholders::_2);
- textDrawFunc = std::bind(&SignalDrawer::renderValueScaleText, this, &p, std::placeholders::_1, std::placeholders::_2);
- p.drawLine(SCALE_MARGIN_VALUE - 1, 0, SCALE_MARGIN_VALUE - 1, m_gHeight);
- break;
+ case SignalController::Axis::TIME:
+ relMin = m_relXMin; relMax = m_relXMax;
+ tickDrawFunc = std::bind(&SignalDrawer::renderTimeScaleTick, this, &p, std::placeholders::_1, std::placeholders::_2);
+ textDrawFunc = std::bind(&SignalDrawer::renderTimeScaleText, this, &p, std::placeholders::_1, std::placeholders::_2);
+ p.drawLine(SCALE_MARGIN_VALUE, m_gHeight + 1, m_gWidth + SCALE_MARGIN_VALUE, m_gHeight + 1);
+ break;
+ case SignalController::Axis::VALUE:
+ relMin = m_relYMin; relMax = m_relYMax;
+ tickDrawFunc = std::bind(&SignalDrawer::renderValueScaleTick, this, &p, std::placeholders::_1, std::placeholders::_2);
+ textDrawFunc = std::bind(&SignalDrawer::renderValueScaleText, this, &p, std::placeholders::_1, std::placeholders::_2);
+ p.drawLine(SCALE_MARGIN_VALUE - 1, 0, SCALE_MARGIN_VALUE - 1, m_gHeight);
+ break;
+ default:
+ return false;
}
RulerDrawData rd = m_controller->getRulerDrawData(relMin, relMax, axis);
p.end();
if (peakReg.intersects(m_xAxisLabelRect)) {
- qDebug() << "x inters";
+ //qDebug() << "x inters";
drawAxisLabel(SignalController::Axis::TIME, target);
peakReg += m_xAxisLabelRect;
}
if (peakReg.intersects(m_yAxisLabelRect)) {
- qDebug() << "y inters";
+ //qDebug() << "y inters";
drawAxisLabel(SignalController::Axis::VALUE, target);
peakReg += m_yAxisLabelRect;
}
double SignalDrawer::linesIntersection(const double k1, const double q1, const double k2, const double q2)
{
double ret = (q1 - q2) / (k2 - k1);
- qDebug() << __QFUNC__ << ret;
return ret;
}
int SignalDrawer::relToXPix(const double rel)
{
const double ret = m_gWidth / (m_relXMax - m_relXMin) * (rel - m_relXMin) + SCALE_MARGIN_VALUE;
- //qDebug() << __QFUNC__ << ret;
return ret;
}
int SignalDrawer::relToYPix(const double rel)
{
const double ret = m_gHeight - (m_gHeight / (m_relYMax - m_relYMin) * (rel - m_relYMin));
- //qDebug() << __QFUNC__ << ret;
return ret;
}
if (pix < SCALE_MARGIN_VALUE)
return m_relXMin;
ret = ((pix - SCALE_MARGIN_VALUE) * (m_relXMax - m_relXMin) / m_gWidth) + m_relXMin;
- //qDebug() << __QFUNC__ << ret;
return ret;
}
}
f.write(bytes.data(), bytes.size());
- qDebug() << val;
+ //qDebug() << val;
f.close();
cit->second->userDataSaved();
++cit;