unix {
QMAKE_CXXFLAGS += -std=c++11 -Wall -Wextra
# You may want to adjust these paths based on the location of libHPCS on your system
- INCLUDEPATH += $$PWD/libHPCS/include
- LIBS += -L$$PWD/libHPCS/build -lHPCS
+ #INCLUDEPATH += $$PWD/libHPCS/include
+ INCLUDEPATH += /home/madcat/Devel/C/libHPCS/include
+ LIBS += -L/home/madcat/Devel/C/libHPCS/build -lHPCS
}
win32 {
# Add project root directory to work around VC11 include path scheme
jsonserializable.cpp \
gui/failedfilesdialog.cpp \
helpers.cpp \
- usersettings.cpp
+ usersettings.cpp \
+ methodinfo.cpp \
+ gui/methodinfolistingwidget.cpp \
+ methodinfolistingtablemodel.cpp \
+ gui/methodinfodialog.cpp
HEADERS += \
datafilesloader.h \
jsonserializable.h \
helpers.h \
gui/failedfilesdialog.h \
- usersettings.h
+ usersettings.h \
+ methodinfo.h \
+ gui/methodinfolistingwidget.h \
+ methodinfolistingtablemodel.h \
+ gui/methodinfodialog.h
FORMS += \
gui/mainwindow.ui \
gui/aboutanyanka.ui \
gui/exportrawdatadialog.ui \
gui/exportgraphtoimagedialog.ui \
- gui/failedfilesdialog.ui
+ gui/failedfilesdialog.ui \
+ gui/methodinfolistingwidget.ui \
+ gui/methodinfodialog.ui
RESOURCES += \
imgresources.qrc
#include "logger.h"
#include "gui/failedfilesdialog.h"
-DataFilesLoader::DataFilesLoader(QObject *parent) :
- QObject(parent)
+const QStringList DataFilesLoader::m_supportedMeasurementFileTypes = QStringList() << "*.ch";
+const QStringList DataFilesLoader::m_supportedMethodInfoFileTypes = QStringList() << "*.mth";
+
+DataFilesLoader::ReturnCode DataFilesLoader::loadSingleRun(const QDir& path, std::vector<struct HPCS_MeasuredData* >& measuredData, std::vector<std::pair<const QString, HPCS_MethodInfo*> >& methodInfo)
{
- m_supportedFileTypes << "*.ch";
+ QDir _path(path);
+
+ if (!loadMeasuredData(_path, measuredData))
+ return ReturnCode::E_FAILED;
+
+ if (!_path.cd("./ACQ.M"))
+ return ReturnCode::W_LIMITED;
+ if (!loadMethodInfo(_path, methodInfo))
+ return ReturnCode::W_LIMITED;
+
+ return ReturnCode::SUCCESS;
}
-DataFilesLoader::ReturnCode DataFilesLoader::loadSingleRun(const QDir& path, std::vector<struct HPCS_MeasuredData* >& loadedData)
+void DataFilesLoader::displayFailedFiles(std::vector<std::pair<const QString, const QString> >& failedFiles)
{
- std::vector<CQStringPair> failedFiles;
+ if (failedFiles.size() > 0)
+ FailedFilesDialog::exec(failedFiles);
+}
- for (const QString& s : path.entryList(m_supportedFileTypes, QDir::Files | QDir::NoDotAndDotDot)) {
- struct HPCS_MeasuredData* mdata = hpcs_alloc();
- if (mdata == nullptr) {
- return ReturnCode::E_FATAL;
- break;
- }
+bool DataFilesLoader::loadMeasuredData(const QDir path, std::vector<HPCS_MeasuredData* >& measuredData)
+{
+ std::vector<std::pair<const QString, const QString>> failedFiles;
+ for (const QString s : path.entryList(m_supportedMeasurementFileTypes)) {
+ struct HPCS_MeasuredData* mdata;
+ HPCS_RetCode ret;
QString absPath = path.absoluteFilePath(s);
- HPCS_RetCode iret = hpcs_read_file(absPath.toStdString().c_str(), mdata);
- if (iret == HPCS_OK)
- loadedData.push_back(mdata);
- else {
- QString errDesc = hpcs_error_to_string(iret);
- Logger::log(Logger::Level::DEBUG, ME_SENDER_STR, "Error reading file '" + s + "'" + errDesc);
- failedFiles.push_back(CQStringPair(s, errDesc));
-
- hpcs_free(mdata);
+ mdata = hpcs_alloc_mdata();
+ ret = hpcs_read_mdata(absPath.toLocal8Bit(), mdata);
+ if (ret != HPCS_OK) {
+ logFailedFile(s, hpcs_error_to_string(ret), failedFiles);
+ continue;
}
+
+ measuredData.push_back(mdata);
}
- if (failedFiles.size() > 0) {
- Logger::log(Logger::Level::DEBUG, ME_SENDER_STR, "Failed files count: " + QString::number(failedFiles.size()));
- FailedFilesDialog::exec(failedFiles);
+ displayFailedFiles(failedFiles);
+ if (measuredData.size() < 1)
+ return false;
+ return true;
+}
+
+bool DataFilesLoader::loadMethodInfo(const QDir path, std::vector<std::pair<const QString, HPCS_MethodInfo* >>& methodInfo)
+{
+ std::vector<std::pair<const QString, const QString>> failedFiles;
+
+ for (const QString s : path.entryList(m_supportedMethodInfoFileTypes)) {
+ struct HPCS_MethodInfo* minfo;
+ HPCS_RetCode ret;
+ QString absPath = path.absoluteFilePath(s);
+
+ minfo = hpcs_alloc_minfo();
+ ret = hpcs_read_minfo(absPath.toUtf8(), minfo);
+ if (ret != HPCS_OK) {
+ logFailedFile(s, hpcs_error_to_string(ret), failedFiles);
+ continue;
+ }
+
+ methodInfo.push_back(std::pair<const QString, struct HPCS_MethodInfo* >(s, minfo));
}
- if (loadedData.size() == 0)
- return ReturnCode::E_NO_FILES;
- Logger::log(Logger::Level::DEBUG, ME_SENDER_STR, QString::number(loadedData.size()) + " files were found and successfully parsed");
+ displayFailedFiles(failedFiles);
+ if (methodInfo.size() < 1)
+ return false;
+ return true;
+}
- return ReturnCode::SUCCESS;
+void DataFilesLoader::logFailedFile(const QString file, const char* msg, std::vector<std::pair<const QString, const QString>>& failedFiles)
+{
+ const QString errMsg = QString::fromUtf8(msg);
+ Logger::log(Logger::Level::DEBUG, ME_SENDER_STR, QString("Error reading file '%1' (%2)").arg(file).arg(errMsg));
+ failedFiles.push_back(std::pair<const QString, const QString>(file, errMsg));
}
Q_OBJECT
public:
enum class ReturnCode {
- SUCCESS,
- E_NO_FILES,
- E_FATAL
+ SUCCESS, /* All files loaded successfully */
+ E_FAILED, /* Measurement data could not have been loaded */
+ W_LIMITED /* Some non-essential data could not have been loaded */
};
- explicit DataFilesLoader(QObject* parent = nullptr);
- ReturnCode loadSingleRun(const QDir& path, std::vector<struct HPCS_MeasuredData* >& loadedData);
+ ReturnCode loadSingleRun(const QDir& path, std::vector<struct HPCS_MeasuredData* >& measuredData,
+ std::vector<std::pair<const QString, struct HPCS_MethodInfo* >>& methodInfo);
private:
- QStringList m_supportedFileTypes;
+ void displayFailedFiles(std::vector<std::pair<const QString, const QString>>& failedFiles);
+ bool loadMeasuredData(const QDir path, std::vector<struct HPCS_MeasuredData* >& measuredData);
+ bool loadMethodInfo(const QDir path, std::vector<std::pair<const QString, struct HPCS_MethodInfo* >>& methodInfo);
+ void logFailedFile(const QString file, const char* msg, std::vector<std::pair<const QString, const QString>>& failedFiles);
+
+ static const QStringList m_supportedMeasurementFileTypes;
+ static const QStringList m_supportedMethodInfoFileTypes;
signals:
#include "datamanager.h"
#include "imagedrawer.h"
#include "logger.h"
+#include "methodinfolistingtablemodel.h"
+#include "gui/methodinfodialog.h"
#include <QtWidgets/QMessageBox>
-const char DataManager::UNIT_DEGREES_CELSIUS_TEXT[] = {static_cast<char>(0xB0), 0x43, 0x00};
+const char DataManager::UNIT_DEGREES_CELSIUS_TEXT[] = {static_cast<char>(0xC2), static_cast<char>(0xB0), 0x43, 0x00};
const char DataManager::UNIT_KILOVOLTS_TEXT[] = {0x4B, 0x56, 0x00};
const char DataManager::UNIT_KILOVOLTS_ALT1_TEXT[] = {0x6B, 0x56, 0x00};
const char DataManager::UNIT_MICROAMPERES_TEXT[] = {static_cast<char>(0xB5), 0x41, 0x00};
std::shared_ptr<SingleRunData> DataManager::loadSingleRun(QDir& dir)
{
std::vector<struct HPCS_MeasuredData* > measuredData;
+ std::vector<std::pair<const QString, struct HPCS_MethodInfo* >> methodInfo;
std::shared_ptr<SingleRunData> singleRun;
SignalsMap sigs;
SignalControllersMap ctrls;
LocalLoggerPtr llog = Logger::createLocalLog();
llog->setPrintLevel(Logger::Level::WARNING);
- ret = m_dfl.loadSingleRun(dir, measuredData);
- if (ret == DataFilesLoader::ReturnCode::E_NO_FILES) {
+ ret = m_dfl.loadSingleRun(dir, measuredData, methodInfo);
+ switch (ret) {
+ case DataFilesLoader::ReturnCode::E_FAILED:
QMessageBox::warning(nullptr, "Data loading", "Directory '" + dir.path() + "' does not seem to contain ChemStation run data.");
return nullptr;
+ break;
+ case DataFilesLoader::ReturnCode::W_LIMITED:
+ QMessageBox::warning(nullptr, "Data loading", "Some files could not have been loaded");
+ break;
+ default:
+ break;
}
- if (ret != DataFilesLoader::ReturnCode::SUCCESS)
- return nullptr;
QStringList operatorNames;
QStringList methodNames;
eqp = equipmentFromFiletype(md->file_type);
} catch (std::invalid_argument& ia) {
llog->log(Logger::ERROR, ME_SENDER_STR, ia.what());
- hpcs_free(md);
+ hpcs_free_mdata(md);
continue;
}
try {
res = resourceFromFiletype(md->file_type);
} catch (std::invalid_argument& ia) {
llog->log(Logger::ERROR, ME_SENDER_STR, ia.what());
- hpcs_free(md);
+ hpcs_free_mdata(md);
continue;
}
yu = yunitFromUnitStr(md->y_units);
} catch (std::invalid_argument& ia) {
llog->log(Logger::ERROR, ME_SENDER_STR, QString("Invalid units ") + ia.what());
- hpcs_free(md);
+ hpcs_free_mdata(md);
continue;
}
samplingRate = md->sampling_rate;
sigs[_s->descriptiveName().toStdString()] = _s;
ctrls[_s->descriptiveName().toStdString()] = _c;
- hpcs_free(md);
+ hpcs_free_mdata(md);
}
/* We must have same number of signals and controllers */
}
}
+ /* Now deal with the method information */
+ MethodInfoList methodInfoList;
+ for (std::pair<const QString, struct HPCS_MethodInfo* >& p : methodInfo) {
+ MethodParametersList mpList;
+ struct HPCS_MethodInfo* minfo = p.second;
+
+ for (size_t idx = 0; idx < minfo->count; idx++) {
+ struct HPCS_MethodInfoBlock* b = &minfo->blocks[idx];
+
+ mpList.push_back(MethodParameter(QString::fromUtf8(b->name), QString::fromUtf8(b->value)));
+ }
+ hpcs_free_minfo(minfo);
+ methodInfoList.push_back(MethodInfo(p.first, mpList));
+ }
+
singleRun = std::shared_ptr<SingleRunData>(new SingleRunData(methodNames.at(0), operatorNames.at(0), sampleInfos.at(0), dates.at(0), times.at(0), sigs, ctrls,
- dir.dirName(), dir.absolutePath(), this));
+ dir.dirName(), dir.absolutePath(), methodInfoList,this));
singleRun->readUserDataFromJSON();
Logger::log(Logger::DEBUG, ME_SENDER_STR, "Single run successfully parsed");
emit setActiveSingleRunKey(m_activeSequence->selectedRunKey());
}
+void DataManager::onShowMethodInfoClicked()
+{
+ MethodInfoDialog miWidget;
+ std::shared_ptr<SingleRunData> sr;
+ if (m_activeSequence == nullptr)
+ return;
+
+ sr = m_activeSequence->selectedRun();
+
+ const MethodInfoList& mil = sr->methodInfoList();
+ for (const MethodInfo& mi : mil) {
+ MethodInfoListingWidget* listingWidget = new MethodInfoListingWidget(&miWidget);
+ if (listingWidget == nullptr)
+ continue;
+ MethodInfoListingTableModel* model = new MethodInfoListingTableModel(listingWidget);
+ if (model == nullptr)
+ continue;
+
+ Logger::log(Logger::Level::DEBUG, ME_SENDER_STR, mi.filename());
+ std::vector<MethodInfoListingTableModel::ModelItem> model_data;
+ for (MethodParameter p : mi.parameters()) {
+ MethodInfoListingTableModel::ModelItem model_item(p.name, p.value);
+ model_data.push_back(model_item);
+ Logger::log(Logger::Level::DEBUG, ME_SENDER_STR, QString("Name %1, Value %2").arg(model_item.name()).arg(model_item.value()));
+ }
+
+ model->set(model_data);
+ listingWidget->setTableModel(model);
+ miWidget.addTab(listingWidget, mi.filename());
+ }
+
+ Logger::log(Logger::Level::DEBUG, ME_SENDER_STR, QString("Show method info: %1").arg(QString::fromStdString(m_activeSequence->selectedRunKey())));
+ miWidget.exec();
+}
+
void DataManager::onSingleRunClose(const QString& key)
{
std::string stdKey = key.toStdString();
void onSaveAllChanges();
void onSequenceClose(const QString& key);
void onSequenceSelected(const QString& key);
+ void onShowMethodInfoClicked();
void onSingleRunClose(const QString& key);
void onSingleRunSelected(const QString& key);
+
};
#endif // DATAMANAGER_H
/* RUN/SEQ cboxes*/
connect(ui->qcbox_sequence, SIGNAL(activated(QString)), this, SLOT(onSequenceSelected(QString)));
connect(ui->qcbox_singleRun, SIGNAL(activated(QString)), this, SLOT(onSingleRunSelected(QString)));
+ /* Method info */
+ connect(ui->qpb_showMethodInfo, SIGNAL(clicked()), this, SLOT(onShowMethodInfoClicked()));
}
/* Public slots */
emit sequenceSelected(str);
}
+void MainWindow::onShowMethodInfoClicked()
+{
+ emit showMethodInfoClicked();
+}
+
void MainWindow::onSingleRunSelected(const QString &str)
{
emit singleRunSelected(str);
void onSaveChanges() { emit saveChanges(); }
void onSaveAllChanges() { emit saveAllChanges(); }
void onSequenceSelected(const QString& str);
+ void onShowMethodInfoClicked();
void onSingleRunSelected(const QString& str);
void onSWFullSizeToggle();
void onZoomSelected();
void saveAllChanges();
void sequenceClose(const QString& str);
void sequenceSelected(const QString& str);
+ void showMethodInfoClicked();
void singleRunClose(const QString& key);
void singleRunSelected(const QString& str);
void zoomMode();
</property>
</widget>
</item>
+ <item row="1" column="3">
+ <widget class="QLabel" name="ql_dateTime">
+ <property name="text">
+ <string>Date/Time:</string>
+ </property>
+ </widget>
+ </item>
<item row="1" column="2">
<widget class="QLineEdit" name="qle_sampleInfo">
<property name="sizePolicy">
</property>
</widget>
</item>
- <item row="1" column="3">
- <widget class="QLabel" name="ql_dateTime">
- <property name="text">
- <string>Date/Time:</string>
- </property>
- </widget>
- </item>
<item row="1" column="4">
<widget class="QLineEdit" name="qle_dateTime">
<property name="alignment">
</property>
</widget>
</item>
+ <item row="2" column="4">
+ <widget class="QPushButton" name="qpb_showMethodInfo">
+ <property name="text">
+ <string>Show method info</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
<rect>
<x>0</x>
<y>0</y>
- <width>782</width>
- <height>309</height>
+ <width>780</width>
+ <height>292</height>
</rect>
</property>
<property name="sizePolicy">
<x>0</x>
<y>0</y>
<width>800</width>
- <height>25</height>
+ <height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuData">
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
- <string>Help</string>
+ <string>He&lp</string>
</property>
<addaction name="actionAbout"/>
</widget>
<widget class="QMenu" name="menuExport">
<property name="title">
- <string>Export</string>
+ <string>E&xport</string>
</property>
<addaction name="actionRaw_values"/>
<addaction name="actionIntegration_results"/>
</widget>
<action name="actionLoad_single_run">
<property name="text">
- <string>Load single run</string>
+ <string>&Load single run</string>
</property>
</action>
<action name="actionLoad_sequence">
<property name="text">
- <string>Load sequence</string>
+ <string>L&oad sequence</string>
</property>
</action>
<action name="actionAbout">
<property name="text">
- <string>About</string>
+ <string>&About</string>
</property>
</action>
<action name="actionRaw_values">
<property name="text">
- <string>Raw data</string>
+ <string>&Raw data</string>
</property>
</action>
<action name="actionIntegration_results">
<property name="text">
- <string>Integration results</string>
+ <string>&Integration results</string>
</property>
</action>
<action name="actionGraph_as_image">
<property name="text">
- <string>Graph as image</string>
+ <string>&Graph as image</string>
</property>
</action>
<action name="actionSave_changes">
<property name="text">
- <string>Save changes</string>
+ <string>&Save changes</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</action>
<action name="actionSave_all_changes">
<property name="text">
- <string>Save all changes</string>
+ <string>Sa&ve all changes</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+S</string>
</action>
<action name="actionClose_single_run">
<property name="text">
- <string>Close single run</string>
+ <string>&Close single run</string>
</property>
</action>
<action name="actionClose_sequence">
<property name="text">
- <string>Close sequence</string>
+ <string>Clos&e sequence</string>
</property>
</action>
</widget>
--- /dev/null
+#include "methodinfodialog.h"
+#include "ui_methodinfodialog.h"
+#include <QTabWidget>
+
+MethodInfoDialog::MethodInfoDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::MethodInfoDialog)
+{
+ ui->setupUi(this);
+ ui->verticalLayout->addWidget(&m_tabs);
+}
+
+MethodInfoDialog::~MethodInfoDialog()
+{
+ for (int idx = 0; idx < m_tabs.count(); idx++)
+ m_tabs.removeTab(0);
+
+ for (MethodInfoListingWidget* w : m_listWidgets)
+ delete w;
+
+ delete ui;
+}
+
+void MethodInfoDialog::addTab(MethodInfoListingWidget* w, const QString& label)
+{
+ m_listWidgets.push_back(w);
+ m_tabs.addTab(w, label);
+}
--- /dev/null
+#ifndef METHODINFODIALOG_H
+#define METHODINFODIALOG_H
+
+#include "methodinfolistingwidget.h"
+#include <QTabWidget>
+#include <QDialog>
+
+namespace Ui {
+class MethodInfoDialog;
+}
+
+class MethodInfoDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit MethodInfoDialog(QWidget* parent = nullptr);
+ ~MethodInfoDialog();
+
+ void addTab(MethodInfoListingWidget* w, const QString& label);
+
+private:
+ std::vector<MethodInfoListingWidget*> m_listWidgets;
+ QTabWidget m_tabs;
+ Ui::MethodInfoDialog *ui;
+};
+
+#endif // METHODINFOWIDGET_H
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MethodInfoDialog</class>
+ <widget class="QWidget" name="MethodInfoDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>295</width>
+ <height>348</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null
+#include "methodinfolistingwidget.h"
+#include "ui_methodinfolistingwidget.h"
+
+MethodInfoListingWidget::MethodInfoListingWidget(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::MethodInfoListingWidget)
+{
+ ui->setupUi(this);
+}
+
+MethodInfoListingWidget::~MethodInfoListingWidget()
+{
+ delete ui;
+ delete m_model;
+}
+
+void MethodInfoListingWidget::setTableModel(MethodInfoListingTableModel* model)
+{
+ m_model = model;
+ ui->qtabv_list->setModel(model);
+}
--- /dev/null
+#ifndef METHODINFOLISTINGWIDGET_H
+#define METHODINFOLISTINGWIDGET_H
+
+#include "methodinfolistingtablemodel.h"
+#include <QWidget>
+
+namespace Ui {
+class MethodInfoListingWidget;
+}
+
+class MethodInfoListingWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MethodInfoListingWidget(QWidget* parent = nullptr);
+ ~MethodInfoListingWidget();
+ void setTableModel(MethodInfoListingTableModel* model);
+
+private:
+ Ui::MethodInfoListingWidget* ui;
+ MethodInfoListingTableModel* m_model;
+};
+
+#endif // METHODINFOLISTINGWIDGET_H
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MethodInfoListingWidget</class>
+ <widget class="QWidget" name="MethodInfoListingWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTableView" name="qtabv_list">
+ <property name="editTriggers">
+ <set>QAbstractItemView::NoEditTriggers</set>
+ </property>
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <attribute name="verticalHeaderVisible">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
QObject::connect(mWin.get(), SIGNAL(loadSequence(QString)), dMgr.get(), SLOT(onLoadSequence(QString)));
QObject::connect(mWin.get(), SIGNAL(sequenceSelected(QString)), dMgr.get(), SLOT(onSequenceSelected(QString)));
QObject::connect(mWin.get(), SIGNAL(sequenceClose(QString)), dMgr.get(), SLOT(onSequenceClose(QString)));
+ QObject::connect(mWin.get(), SIGNAL(showMethodInfoClicked()), dMgr.get(), SLOT(onShowMethodInfoClicked()));
QObject::connect(mWin.get(), SIGNAL(singleRunClose(QString)), dMgr.get(), SLOT(onSingleRunClose(QString)));
QObject::connect(mWin.get(), SIGNAL(singleRunSelected(QString)), dMgr.get(), SLOT(onSingleRunSelected(QString)));
--- /dev/null
+#include "methodinfo.h"
+
+MethodInfo::MethodInfo(const QString& filename, const MethodParametersList& params) :
+ m_filename(filename),
+ m_params(params)
+{}
+
--- /dev/null
+#ifndef METHODINFO_H
+#define METHODINFO_H
+
+#include <QString>
+
+struct MethodParameter {
+ MethodParameter(const QString& _name, const QString& _value) :
+ name(_name),
+ value(_value)
+ {}
+
+ const QString name;
+ const QString value;
+};
+
+typedef std::vector<MethodParameter> MethodParametersList;
+
+class MethodInfo
+{
+public:
+ explicit MethodInfo(const QString& filename, const MethodParametersList& params);
+ inline QString filename() const { return m_filename; }
+ inline MethodParametersList parameters() const { return m_params; }
+
+private:
+ const QString m_filename;
+ const MethodParametersList m_params;
+
+};
+
+#endif // METHODINFO_H
--- /dev/null
+#include "methodinfolistingtablemodel.h"
+
+MethodInfoListingTableModel::MethodInfoListingTableModel(QObject* parent) : QAbstractTableModel(parent)
+{}
+
+MethodInfoListingTableModel::~MethodInfoListingTableModel()
+{}
+
+int MethodInfoListingTableModel::columnCount(const QModelIndex& parent) const
+{
+ Q_UNUSED(parent);
+
+ if (m_data.size() < 1)
+ return 0;
+ return 2;
+}
+
+QVariant MethodInfoListingTableModel::data(const QModelIndex& index, int role) const
+{
+ if (m_data.size() < 1)
+ return QVariant();
+ if (index.column() > 1 || index.column() < 0)
+ return QVariant();
+ if (index.row() >= m_data.size() || index.row() < 0)
+ return QVariant();
+
+ switch (role) {
+ case Qt::DisplayRole:
+ {
+ const ModelItem& mi = m_data[index.row()];
+ switch (index.column()) {
+ case 0:
+ return mi.name();
+ case 1:
+ return mi.value();
+ default:
+ return QVariant();
+ }
+ }
+ break;
+ case Qt::TextAlignmentRole:
+ return Qt::AlignRight + Qt::AlignVCenter;
+ default:
+ return QVariant();
+ }
+}
+
+QVariant MethodInfoListingTableModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
+ switch (section) {
+ case 0:
+ return QString("Name");
+ case 1:
+ return QString("Value");
+ default:
+ return QVariant();
+ }
+ }
+ return QVariant();
+}
+
+int MethodInfoListingTableModel::rowCount(const QModelIndex& parent) const
+{
+ return m_data.size();
+}
+
+void MethodInfoListingTableModel::set(const std::vector<ModelItem>& data)
+{
+ beginResetModel();
+ m_data = data;
+ endResetModel();
+}
--- /dev/null
+#ifndef MODELINFOLISTINGTABLEMODEL_H
+#define MODELINFOLISTINGTABLEMODEL_H
+
+#include <QAbstractTableModel>
+
+class MethodInfoListingTableModel : public QAbstractTableModel
+{
+ Q_OBJECT
+public:
+ class ModelItem {
+ public:
+ ModelItem(const QString& name, const QString& value) :
+ m_name(name),
+ m_value(value) {}
+ QString name() const { return m_name; }
+ QString value() const { return m_value; }
+
+ private:
+ QString m_name;
+ QString m_value;
+ };
+
+ MethodInfoListingTableModel(QObject* parent = nullptr);
+ ~MethodInfoListingTableModel();
+ int columnCount(const QModelIndex& parent) const;
+ QVariant data(const QModelIndex& index, int role) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ int rowCount(const QModelIndex& parent) const;
+ void set(const std::vector<ModelItem>& data);
+
+private:
+ std::vector<ModelItem> m_data;
+};
+
+#endif // MODELINFOLISTINGTABLEMODEL_H
SingleRunData::SingleRunData(const QString& methodName, const QString& operatorName, const QString& sampleInfo, const QDate date, const QTime time,
SignalsMap& sigs, SignalControllersMap& ctrls,
- const QString& dirname, const QString& absPath, QObject *parent) :
+ const QString& dirname, const QString& absPath, MethodInfoList& methodInfoList, QObject *parent) :
QObject(parent),
m_absPath(absPath),
m_date(date),
m_dirName(dirname),
+ m_methodInfoList(methodInfoList),
m_methodName(methodName),
m_operatorName(operatorName),
m_sampleInfo(sampleInfo),
#ifndef SINGLERUNDATA_H
#define SINGLERUNDATA_H
+#include "methodinfo.h"
#include "signalcontroller.h"
#include <memory>
#include <QtCore/QDate>
#include <QtCore/QObject>
#include <QtCore/QTime>
+typedef std::vector<MethodInfo> MethodInfoList;
typedef std::map<std::string, std::shared_ptr<SignalController>> SignalControllersMap;
typedef std::map<std::string, std::shared_ptr<Signal>> SignalsMap;
public:
explicit SingleRunData(const QString& methodName, const QString& operatorName, const QString& sampleInfo, const QDate date, const QTime time,
SignalsMap& sigs, SignalControllersMap& ctrls,
- const QString& dirname, const QString& absPath, QObject* parent = nullptr);
+ const QString& dirname, const QString& absPath,
+ MethodInfoList& methodInfoList, QObject* parent = nullptr);
QString absPath() const { return m_absPath; }
const SignalControllersMap& allControllers() const { return m_ctrls; }
std::vector<std::string> allKeys() const;
QDate date() const { return m_date; }
QString dirName() const { return m_dirName; }
SignalControllersMap::iterator ctrls_end() { return m_ctrls.end(); }
+ const MethodInfoList& methodInfoList() const { return m_methodInfoList; }
QString methodName() const { return m_methodName; }
QString operatorName() const { return m_operatorName; }
void readUserDataFromJSON();
const QString m_absPath;
const QDate m_date;
const QString m_dirName;
+ const MethodInfoList m_methodInfoList;
const QString m_methodName;
const QString m_operatorName;
const QString m_sampleInfo;