Don't reimplement the clear() method

Much easier and clearer.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-01-29 14:00:19 -08:00
parent 4e40872fc0
commit cd992bd14a
3 changed files with 2 additions and 12 deletions

View file

@ -79,13 +79,6 @@ void DiveComputerList::addDC(const QString &m, uint32_t d, const QString &n, con
dcMap.insert(m, newNode); dcMap.insert(m, newNode);
} }
void DiveComputerList::rmDC(const QString &m, uint32_t d)
{
const DiveComputerNode *existNode = this->getExact(m, d);
dcMap.remove(m, *existNode);
}
extern "C" void create_device_node(const char *model, uint32_t deviceid, const char *serial, const char *firmware, const char *nickname) extern "C" void create_device_node(const char *model, uint32_t deviceid, const char *serial, const char *firmware, const char *nickname)
{ {
dcList.addDC(model, deviceid, nickname, serial, firmware); dcList.addDC(model, deviceid, nickname, serial, firmware);

View file

@ -26,7 +26,6 @@ public:
const DiveComputerNode *getExact(const QString &m, uint32_t d); const DiveComputerNode *getExact(const QString &m, uint32_t d);
const DiveComputerNode *get(const QString &m); const DiveComputerNode *get(const QString &m);
void addDC(const QString &m, uint32_t d, const QString &n = QString(), const QString &s = QString(), const QString &f = QString()); void addDC(const QString &m, uint32_t d, const QString &n = QString(), const QString &s = QString(), const QString &f = QString());
void rmDC(const QString &m, uint32_t d);
DiveComputerNode matchDC(const QString &m, uint32_t d); DiveComputerNode matchDC(const QString &m, uint32_t d);
DiveComputerNode matchModel(const QString &m); DiveComputerNode matchModel(const QString &m);
QMultiMap<QString, DiveComputerNode> dcMap; QMultiMap<QString, DiveComputerNode> dcMap;
@ -35,4 +34,4 @@ public:
extern DiveComputerList dcList; extern DiveComputerList dcList;
#endif #endif

View file

@ -300,9 +300,7 @@ void MainWindow::closeCurrentFile()
clear_events(); clear_events();
QList<DiveComputerNode> values = dcList.dcMap.values(); dcList.dcMap.clear();
for (int i = 0; i < values.size(); i++)
dcList.rmDC(values.at(i).model, values.at(i).deviceId);
} }
void MainWindow::on_actionClose_triggered() void MainWindow::on_actionClose_triggered()