2016-09-14 19:46:57 -04:00
|
|
|
#include "BookmarkMgr.h"
|
2016-09-14 22:10:27 -04:00
|
|
|
#include "CubicSDR.h"
|
|
|
|
#include "DataTree.h"
|
2016-09-14 19:46:57 -04:00
|
|
|
|
|
|
|
|
|
|
|
void BookmarkMgr::saveToFile(std::string bookmarkFn) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BookmarkMgr::loadFromFile(std::string bookmarkFn) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-09-14 22:10:27 -04:00
|
|
|
void BookmarkMgr::addBookmark(std::string group, DemodulatorInstance *demod, std::string folder) {
|
2016-09-14 19:46:57 -04:00
|
|
|
std::lock_guard < std::mutex > lock(busy_lock);
|
2016-09-14 22:10:27 -04:00
|
|
|
|
|
|
|
BookmarkEntry *be = new BookmarkEntry;
|
|
|
|
|
|
|
|
be->bandwidth = demod->getBandwidth();
|
|
|
|
be->type = demod->getDemodulatorType();
|
|
|
|
be->label = demod->getLabel();
|
|
|
|
be->frequency = demod->getFrequency();
|
|
|
|
be->folder = folder;
|
|
|
|
|
|
|
|
wxGetApp().getDemodMgr().saveInstance(be->node, demod);
|
|
|
|
|
|
|
|
bmData[group].insert(be);
|
|
|
|
}
|
2016-09-14 19:46:57 -04:00
|
|
|
|
2016-09-14 22:10:27 -04:00
|
|
|
void BookmarkMgr::removeBookmark(std::string group, BookmarkEntry *be) {
|
|
|
|
std::lock_guard < std::mutex > lockData(busy_lock);
|
|
|
|
std::lock_guard < std::mutex > lockEnt(be->busy_lock);
|
|
|
|
|
|
|
|
bmData[group].erase(be);
|
2016-09-14 19:46:57 -04:00
|
|
|
}
|
|
|
|
|
2016-09-14 22:10:27 -04:00
|
|
|
|
2016-09-14 19:46:57 -04:00
|
|
|
BookmarkList BookmarkMgr::getBookmarks(std::string group, std::string folder) {
|
|
|
|
std::lock_guard < std::mutex > lock(busy_lock);
|
|
|
|
|
|
|
|
BookmarkList results;
|
|
|
|
|
2016-09-14 22:10:27 -04:00
|
|
|
if (folder != "") {
|
|
|
|
for (auto be_i : bmData[group]) {
|
|
|
|
results.push_back(be_i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (auto be_i : bmData[group]) {
|
|
|
|
if (be_i->folder != folder) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
results.push_back(be_i);
|
|
|
|
}
|
|
|
|
}
|
2016-09-14 19:46:57 -04:00
|
|
|
|
|
|
|
return results;
|
|
|
|
}
|
2016-09-22 20:40:07 -04:00
|
|
|
|
|
|
|
void BookmarkMgr::updateActiveList() {
|
|
|
|
BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView();
|
|
|
|
|
|
|
|
if (bmv) {
|
|
|
|
bmv->updateActiveList();
|
|
|
|
}
|
|
|
|
}
|