From: Michal MalĂ˝ Date: Sat, 2 Aug 2014 06:39:30 +0000 (+0200) Subject: Keep entries in SingleRun sorted and present them as such X-Git-Tag: 0.3c~1 X-Git-Url: https://gitweb.devoid-pointer.net/?a=commitdiff_plain;h=c4e9005d52e4d449638fc83199e7e075f25b7630;p=anyanka.git Keep entries in SingleRun sorted and present them as such --- diff --git a/datamanager.cpp b/datamanager.cpp index b364b22..6175aba 100644 --- a/datamanager.cpp +++ b/datamanager.cpp @@ -688,8 +688,13 @@ void DataManager::onSingleRunSelected(const QString& key) std::shared_ptr srdata = m_activeSequence->selectedRun(); emit cleanDashboard(); - for (const std::string& s : srdata->allKeys()) - showOneSignal(srdata->controllerAt(s)); + std::vector allKeys = srdata->allKeys(); + std::vector::const_reverse_iterator rit = allKeys.crbegin(); + qDebug() << QString::fromStdString(*rit); + while (rit != allKeys.crend()) { + showOneSignal(srdata->controllerAt(*rit)); + rit++; + } emit setSingleRunInfo(srdata->methodName(), srdata->operatorName(), srdata->sampleInfo(), srdata->date().toString() +" "+ srdata->time().toString()); Logger::log(Logger::Level::DEBUG, ME_SENDER_STR, "Single run changed."); diff --git a/sequence.cpp b/sequence.cpp index 67da087..06aee44 100644 --- a/sequence.cpp +++ b/sequence.cpp @@ -43,7 +43,7 @@ int Sequence::add(const std::string name, std::shared_ptr value) std::shared_ptr Sequence::at(const std::string& key) { - std::unordered_map>::iterator it = m_singleRuns.find(key); + std::map>::iterator it = m_singleRuns.find(key); if (it == m_singleRuns.end()) return nullptr; else @@ -78,7 +78,7 @@ std::shared_ptr Sequence::selectedRun() bool Sequence::setSelectedRun(const std::string& key) { - std::unordered_map>::iterator sr = m_singleRuns.find(key); + std::map>::iterator sr = m_singleRuns.find(key); if (sr == m_singleRuns.end()) return false; diff --git a/sequence.h b/sequence.h index 1448578..e6afe06 100644 --- a/sequence.h +++ b/sequence.h @@ -31,7 +31,7 @@ #include #include -typedef std::unordered_map> SingleRunsMap; +typedef std::map> SingleRunsMap; class Sequence : public QObject { @@ -55,7 +55,7 @@ public: private: std::string m_selectedRunKey; - std::unordered_map> m_singleRuns; + std::map> m_singleRuns; signals: