File tree Expand file tree Collapse file tree 4 files changed +36
-6
lines changed Expand file tree Collapse file tree 4 files changed +36
-6
lines changed Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "file_size_in_bytes" : 4177936 ,
4
+ "data_type" : " uint8" ,
5
+ "numbers_in_line" : 2044
6
+ }
7
+ ]
Original file line number Diff line number Diff line change @@ -471,6 +471,30 @@ QStringList DavisGUI::getLinesFromFile(const QString& pathToFile) {
471
471
return str_lines;
472
472
}
473
473
474
+ bool DavisGUI::mayBeShowBIN (const QString& path) {
475
+ QFileInfo info (path);
476
+ QJsonArray bins;
477
+ if (jsn::getJsonArrayFromFile (" bin.json" , bins) == false ) {
478
+ jsn::getJsonArrayFromFile (" :/bin.json" , bins);
479
+ }
480
+ for (int i = 0 ; i < bins.size (); ++i) {
481
+ int file_size = bins[i].toObject ().value (" file_size_in_bytes" ).toInt ();
482
+ int numbers_in_line = bins[i].toObject ().value (" numbers_in_line" ).toInt ();
483
+ QString data_type = bins[i].toObject ().value (" data_type" ).toString ();
484
+ if (info.size () == file_size) {
485
+ if (data_type == " uint8" ) {
486
+ std::vector<std::vector<uint8_t >> data = dvs::readBinaryFile<uint8_t >(path.toLatin1 ().data (), numbers_in_line);
487
+ dv::show (data);
488
+ } else if (data_type == " uint16" ) {
489
+ std::vector<std::vector<uint16_t >> data = dvs::readBinaryFile<uint16_t >(path.toLatin1 ().data (), numbers_in_line);
490
+ dv::show (data);
491
+ }
492
+ return true ;
493
+ }
494
+ }
495
+ return false ;
496
+ }
497
+
474
498
void DavisGUI::setMaxStyleWindow (int animDuration) {
475
499
m_isMinStyleWindow = false ;
476
500
hideElementsDuringResize ();
@@ -956,11 +980,9 @@ void DavisGUI::visualizeFiles(const QStringList& file_list) {
956
980
return ;
957
981
}
958
982
if (suffix == " bin" ) {
959
- if (info.size () == 4177936 ) {
960
- std::vector<std::vector<uint8_t >> data = dvs::readBinaryFile<uint8_t >(filePath.toLatin1 ().data (), 2044 );
961
- dv::show (data);
962
- }
963
- return ;
983
+ if (mayBeShowBIN (filePath)) {
984
+ return ;
985
+ };
964
986
}
965
987
966
988
if (info.exists ()) {
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ QT_END_NAMESPACE
20
20
enum class Skins {DEFAULT, NEWYEAR};
21
21
22
22
23
-
24
23
class DavisGUI : public QMainWindow {
25
24
Q_OBJECT
26
25
@@ -70,6 +69,7 @@ class DavisGUI : public QMainWindow {
70
69
std::vector<std::vector<double >>& multicharts);
71
70
72
71
QStringList getLinesFromFile (const QString& pathToFile);
72
+ bool mayBeShowBIN (const QString& path);
73
73
74
74
private slots:
75
75
void showAboutWindow ();
Original file line number Diff line number Diff line change 14
14
<file>user_keys_list.json</file>
15
15
<file>res/icon/D-16x16.png</file>
16
16
<file>res/newYear.gif</file>
17
+ <file>bin.json</file>
17
18
</qresource>
18
19
</RCC>
You can’t perform that action at this time.
0 commit comments