]> Devoid-pointer.net GitWeb - anyanka.git/commitdiff
Keep entries in SingleRun sorted and present them as such
authorMichal Malý <madcatxster@devoid-pointer.net>
Sat, 2 Aug 2014 06:39:30 +0000 (08:39 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Sat, 2 Aug 2014 06:39:30 +0000 (08:39 +0200)
datamanager.cpp
sequence.cpp
sequence.h

index b364b22d04fd304b10997cfedef61a8c0a12fff9..6175aba6fb2a065063b4fb27c64cac246b2df737 100644 (file)
@@ -688,8 +688,13 @@ void DataManager::onSingleRunSelected(const QString& key)
 
   std::shared_ptr<SingleRunData> srdata = m_activeSequence->selectedRun();
   emit cleanDashboard();
-  for (const std::string& s : srdata->allKeys())
-    showOneSignal(srdata->controllerAt(s));
+  std::vector<std::string> allKeys = srdata->allKeys();
+  std::vector<std::string>::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.");
index 67da0873b0097661c2d34adb4a8228d1affbec41..06aee4420e96c4e4e2311c1ec725ec52d32afb6e 100644 (file)
@@ -43,7 +43,7 @@ int Sequence::add(const std::string name, std::shared_ptr<SingleRunData> value)
 
 std::shared_ptr<SingleRunData> Sequence::at(const std::string& key)
 {
-  std::unordered_map<std::string, std::shared_ptr<SingleRunData>>::iterator it = m_singleRuns.find(key);
+  std::map<std::string, std::shared_ptr<SingleRunData>>::iterator it = m_singleRuns.find(key);
   if (it == m_singleRuns.end())
     return nullptr;
   else
@@ -78,7 +78,7 @@ std::shared_ptr<SingleRunData> Sequence::selectedRun()
 
 bool Sequence::setSelectedRun(const std::string& key)
 {
-  std::unordered_map<std::string, std::shared_ptr<SingleRunData>>::iterator sr = m_singleRuns.find(key);
+  std::map<std::string, std::shared_ptr<SingleRunData>>::iterator sr = m_singleRuns.find(key);
   if (sr == m_singleRuns.end())
     return false;
 
index 14485785f7dce77f3c9eaf94bdcceb7194714244..e6afe06c920ac2ee4597c2d9b7ae6abe15660d23 100644 (file)
@@ -31,7 +31,7 @@
 #include <vector>
 #include <QtCore/QObject>
 
-typedef std::unordered_map<std::string, std::shared_ptr<SingleRunData>> SingleRunsMap;
+typedef std::map<std::string, std::shared_ptr<SingleRunData>> SingleRunsMap;
 
 class Sequence : public QObject
 {
@@ -55,7 +55,7 @@ public:
 
 private:
   std::string m_selectedRunKey;
-  std::unordered_map<std::string, std::shared_ptr<SingleRunData>> m_singleRuns;
+  std::map<std::string, std::shared_ptr<SingleRunData>> m_singleRuns;
 
 signals: