Commit 608d1057b63274b61ceacbe2984184ff85f84bad

Authored by Tunde
1 parent e544b45a

removed remainder of tabs in both files, added qfatal to redBlock functiono and …

…changed for loop to foreach loop
openbr/plugins/gallery.cpp
@@ -1037,62 +1037,61 @@ class topPredictionsGallery : public Gallery @@ -1037,62 +1037,61 @@ class topPredictionsGallery : public Gallery
1037 1037
1038 ~topPredictionsGallery() 1038 ~topPredictionsGallery()
1039 { 1039 {
1040 - QString result = QString("# of attributes: %1").arg(QString::number(attributes.count())); 1040 + QString result = QString("# of attributes: %1").arg(QString::number(attributes.count()));
1041 QtUtils::writeFile(file.name, result); 1041 QtUtils::writeFile(file.name, result);
1042 if (!attributes.isEmpty()) 1042 if (!attributes.isEmpty())
1043 - {  
1044 - QMapIterator <float, QString> it(attributes);  
1045 - it.toBack();  
1046 - if (out_count > 1)  
1047 - {  
1048 - if (attributes.count() < out_count)  
1049 - out_count = attributes.count();  
1050 -  
1051 - for (int i = 0; i < out_count; i++)  
1052 - {  
1053 - it.previous();  
1054 - result = QString("%1) %2 : %3").arg(QString::number(i + 1), it.value(), QString::number((float)it.key()));  
1055 - QtUtils::writeFile(file.name, result);  
1056 - }  
1057 - }  
1058 - else  
1059 - {  
1060 - int count = 0;  
1061 - it.toBack();  
1062 - while (it.hasPrevious())  
1063 - {  
1064 - it.previous();  
1065 - if (it.key() >= out_count)  
1066 - {  
1067 - result = QString("%1) %2 : %3").arg(QString::number(count + 1), it.value(), QString::number((float)it.key()));  
1068 - QtUtils::writeFile(file.name, result);  
1069 - count++;  
1070 - }  
1071 - }  
1072 - }  
1073 - } 1043 + {
  1044 + QMapIterator <float, QString> it(attributes);
  1045 + it.toBack();
  1046 + if (out_count > 1)
  1047 + {
  1048 + if (attributes.count() < out_count)
  1049 + out_count = attributes.count();
  1050 +
  1051 + for (int i = 0; i < out_count; i++)
  1052 + {
  1053 + it.previous();
  1054 + result = QString("%1) %2 : %3").arg(QString::number(i + 1), it.value(), QString::number((float)it.key()));
  1055 + QtUtils::writeFile(file.name, result);
  1056 + }
  1057 + }
  1058 + else
  1059 + {
  1060 + int count = 0;
  1061 + it.toBack();
  1062 + while (it.hasPrevious())
  1063 + {
  1064 + it.previous();
  1065 + if (it.key() >= out_count)
  1066 + {
  1067 + result = QString("%1) %2 : %3").arg(QString::number(count + 1), it.value(), QString::number((float)it.key()));
  1068 + QtUtils::writeFile(file.name, result);
  1069 + count++;
  1070 + }
  1071 + }
  1072 + }
  1073 + }
1074 } 1074 }
1075 1075
1076 //Pure virtial function so needs an implementation 1076 //Pure virtial function so needs an implementation
1077 TemplateList readBlock(bool *done) 1077 TemplateList readBlock(bool *done)
1078 { 1078 {
1079 - *done = true;  
1080 - return TemplateList() << file; 1079 + (void) done;
  1080 + qFatal("Unsupported.");
  1081 + return TemplateList();
1081 } 1082 }
1082 1083
1083 void write(const Template &t) 1084 void write(const Template &t)
1084 { 1085 {
1085 - QList<QString> keys = t.file.localKeys();  
1086 - for (int i = 0; i < keys.count(); i++)  
1087 - {  
1088 - QString key = keys.at(i);  
1089 - if (key.startsWith("predicted_"))  
1090 - {  
1091 - float val = t.file.get<float>(key);  
1092 - attributes.insert(val, key); //use float as key to keep in order  
1093 - }  
1094 -  
1095 - } 1086 + QList<QString> keys = t.file.localKeys();
  1087 + foreach (const QString &key, keys)
  1088 + {
  1089 + if (key.startsWith("predicted_"))
  1090 + {
  1091 + float val = t.file.get<float>(key);
  1092 + attributes.insert(val, key); //use float as key to keep in order
  1093 + }
  1094 + }
1096 } 1095 }
1097 }; 1096 };
1098 1097
share/openbr/openbr.bib
@@ -402,7 +402,7 @@ @@ -402,7 +402,7 @@
402 } 402 }
403 403
404 @misc{baba1472, 404 @misc{baba1472,
405 - Author = {Babatunde Ogunfemi},  
406 - Howpublished = {https://github.com/baba1472},  
407 - Title = {ogunfemi.b at gmail.com}} 405 + Author = {Babatunde Ogunfemi},
  406 + Howpublished = {https://github.com/baba1472},
  407 + Title = {ogunfemi.b at gmail.com}}
408 408