obsolete Hash Methods

This commit is contained in:
LoudSnorer 2023-02-18 08:58:47 -05:00
parent cf4b86b99a
commit 6466a8ddad
2 changed files with 40 additions and 14 deletions

View File

@ -7,6 +7,9 @@
* License. See the file COPYING in the main directory of the source code * License. See the file COPYING in the main directory of the source code
* for more details. */ * for more details. */
#define TEST_MACROS_ENABLEDoff
#include <test_macros.h>
#include <QApplication> #include <QApplication>
#include <QString> #include <QString>
#include <QDateTime> #include <QDateTime>
@ -987,7 +990,11 @@ bool PRS1Loader::CreateMachineFromProperties(QString propertyfile)
static QString relativePath(const QString & inpath) static QString relativePath(const QString & inpath)
{ {
QStringList pathlist = QDir::toNativeSeparators(inpath).split(QDir::separator(), QString::SkipEmptyParts); #if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
QStringList pathlist = QDir::toNativeSeparators(inpath).split(QDir::separator(), Qt::SkipEmptyParts);
#else
QStringList pathlist = QDir::toNativeSeparators(inpath).split(QDir::separator(), QString::SkipEmptyParts);
#endif
QString relative = pathlist.mid(pathlist.size()-3).join(QDir::separator()); QString relative = pathlist.mid(pathlist.size()-3).join(QDir::separator());
return relative; return relative;
} }
@ -1367,8 +1374,15 @@ void PRS1Import::CreateEventChannels(const PRS1DataChunk* chunk)
// Generate the list of channels created by non-slice events for this device. // Generate the list of channels created by non-slice events for this device.
// We can't just use the full list of non-slice events, since on some devices // We can't just use the full list of non-slice events, since on some devices
// PS is generated by slice events (EPAP/IPAP average). // PS is generated by slice events (EPAP/IPAP average).
// TODO: convert supported to QSet and clean this up. // Duplicates need to be removed. QSet does the removal.
QSet<PRS1ParsedEventType> supportedNonSliceEvents = QSet<PRS1ParsedEventType>::fromList(QList<PRS1ParsedEventType>::fromVector(supported)); #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
// convert QVvector to QList then to QSet
QSet<PRS1ParsedEventType> supportedNonSliceEvents = QSet<PRS1ParsedEventType>::fromList( QList<PRS1ParsedEventType>::fromVector( supported ) );
#else
// release 5.14 supports the direct conversion.
QSet<PRS1ParsedEventType> supportedNonSliceEvents(supported.begin(),supported.end() ) ;
#endif
supportedNonSliceEvents.intersect(PRS1NonSliceChannels); supportedNonSliceEvents.intersect(PRS1NonSliceChannels);
QSet<ChannelID> supportedNonSliceChannels; QSet<ChannelID> supportedNonSliceChannels;
for (auto & e : supportedNonSliceEvents) { for (auto & e : supportedNonSliceEvents) {

View File

@ -7,6 +7,9 @@
* License. See the file COPYING in the main directory of the source code * License. See the file COPYING in the main directory of the source code
* for more details. */ * for more details. */
#define TEST_MACROS_ENABLED
#include <test_macros.h>
#include <QApplication> #include <QApplication>
#include <QString> #include <QString>
#include <QDateTime> #include <QDateTime>
@ -31,6 +34,15 @@
#endif #endif
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
#define QTCOMBINE insert
//idmap.insert(hash);
#else
#define QTCOMBINE unite
//idmap.unite(hash);
#endif
ChannelID RMS9_EPR, RMS9_EPRLevel, RMS9_Mode, RMS9_SmartStart, RMS9_HumidStatus, RMS9_HumidLevel, ChannelID RMS9_EPR, RMS9_EPRLevel, RMS9_Mode, RMS9_SmartStart, RMS9_HumidStatus, RMS9_HumidLevel,
RMS9_PtAccess, RMS9_Mask, RMS9_ABFilter, RMS9_ClimateControl, RMS9_TubeType, RMAS11_SmartStop, RMS9_PtAccess, RMS9_Mask, RMS9_ABFilter, RMS9_ClimateControl, RMS9_TubeType, RMAS11_SmartStop,
RMS9_Temp, RMS9_TempEnable, RMS9_RampEnable, RMAS1x_Comfort, RMAS11_PtView; RMS9_Temp, RMS9_TempEnable, RMS9_RampEnable, RMAS1x_Comfort, RMAS11_PtView;
@ -1891,7 +1903,7 @@ bool parseIdentFile( QString path, MachineInfo * info, QHash<QString, QString> &
while (!f.atEnd()) { while (!f.atEnd()) {
QString line = f.readLine().trimmed(); QString line = f.readLine().trimmed();
QHash<QString, QString> hash = parseIdentLine( line, info ); QHash<QString, QString> hash = parseIdentLine( line, info );
idmap.unite(hash); idmap.QTCOMBINE(hash);
} }
f.close(); f.close();
@ -1906,19 +1918,19 @@ void scanProductObject( QJsonObject product, MachineInfo *info, QHash<QString, Q
info->serial = product["SerialNumber"].toString(); info->serial = product["SerialNumber"].toString();
hash1["SerialNumber"] = product["SerialNumber"].toString(); hash1["SerialNumber"] = product["SerialNumber"].toString();
if (idmap) if (idmap)
idmap->unite(hash1); idmap->QTCOMBINE(hash1);
} }
if (product.contains("ProductCode")) { if (product.contains("ProductCode")) {
info->modelnumber = product["ProductCode"].toString(); info->modelnumber = product["ProductCode"].toString();
hash2["ProductCode"] = info->modelnumber; hash2["ProductCode"] = info->modelnumber;
if (idmap) if (idmap)
idmap->unite(hash2); idmap->QTCOMBINE(hash2);
} }
if (product.contains("ProductName")) { if (product.contains("ProductName")) {
info->model = product["ProductName"].toString(); info->model = product["ProductName"].toString();
hash3["ProductName"] = info->model; hash3["ProductName"] = info->model;
if (idmap) if (idmap)
idmap->unite(hash3); idmap->QTCOMBINE(hash3);
int idx = info->model.indexOf("11"); int idx = info->model.indexOf("11");
info->series = info->model.left(idx+2); info->series = info->model.left(idx+2);
} }