Load media on start
Previously loaded media were loaded again by starting the Biotracker in old Biotracker. This behaviour has been ported to new Biotracker.
Instead of manually concatenating and splitting a string with all the filenames in the case of an ImageStream you can directly store an std::vector<std::string> in the settings. This is how it was done in the old codebase. The code is simpler and also doesn't break if there's a ";" in a filename.
You can see the old implementation here: https://maserati.mi.fu-berlin.de/redmine/projects/biotracker/repository/revisions/master/entry/source/gui/BioTracker.cpp#L250 https://maserati.mi.fu-berlin.de/redmine/projects/biotracker/repository/revisions/master/entry/source/gui/BioTracker.cpp#L389
Trying to read a std::vector<std::string> directly from settings, similar to https://maserati.mi.fu-berlin.de/redmine/projects/biotracker/repository/revisions/master/entry/source/gui/BioTracker.cpp#L389, results in following compiler error:
http://pastebin.com/ZkgHJcPw
Correspoding code:
...
boost::optional<std::vector<std::string>> filenamesStrOpt = m_settings.maybeGetValueOfParam<std::vector<std::string>>
(PictureParam::PICTURE_FILES);
if (!filenamesStrOpt) {
m_settings.setParam<uint8_t>(GuiParam::MEDIA_TYPE, static_cast<uint8_t>(GuiParam::MediaType::NoMedia));
return;
}
std::vector<boost::filesystem::path> filenames;
for (std::string filenameStr : *filenamesStrOpt) {
filenames.push_back(boost::filesystem::path(filenameStr));
}
try {
loadPictures(std::move(filenames));
} catch (file_not_found e) {
m_settings.setParam<uint8_t>(GuiParam::MEDIA_TYPE, static_cast<uint8_t>(GuiParam::MediaType::NoMedia));
Q_EMIT notifyGUI(e.what(), MessageType::FAIL);
}
...
I don't know what this mean, maybe a deserializer is missing.
Likely obsolete or requiring major rework in the Biotracker3. @hmoenck? Is that feature still wanted?
@walachey Yup, the new tree structure is somewhat more complex than the old vector structure. I was striving to serialize these to/from CSV manually. This is only halfway done yet.