| 1 | #include "DetectorTableModel.h" |
| 2 | |
| 3 | DetectorTableModel::DetectorTableModel(QObject* parent) : QAbstractTableModel(parent) |
| 4 | { |
| 5 | detectors.clear(); |
| 6 | |
| 7 | /*-----------------------------------------------------*\ |
| 8 | | Read the detector list from the settings manager | |
| 9 | \*-----------------------------------------------------*/ |
| 10 | json settings = ResourceManager::get()->GetSettingsManager()->GetSettings("Detectors"); |
| 11 | |
| 12 | if(settings.contains("detectors")) |
| 13 | { |
| 14 | for(json::const_iterator it = settings["detectors"].begin(); it != settings["detectors"].end(); it++) |
| 15 | { |
| 16 | DetectorTableValue new_entry; |
| 17 | |
| 18 | new_entry.key = it.key(); |
| 19 | new_entry.value = it.value(); |
| 20 | |
| 21 | detectors.push_back(new_entry); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | /*-----------------------------------------------------*\ |
| 26 | | If settings contains the detectors list, fill in rows | |
| 27 | \*-----------------------------------------------------*/ |
| 28 | beginInsertRows(QModelIndex(), 0, detectors.size()); |
| 29 | endInsertRows(); |
| 30 | } |
| 31 | |
| 32 | int DetectorTableModel::columnCount(const QModelIndex&) const |
| 33 | { |
nothing calls this directly
no test coverage detected