| 2657 | } |
| 2658 | |
| 2659 | bool AppFrame::loadSession(const std::string& fileName) { |
| 2660 | bool result = wxGetApp().getSessionMgr().loadSession(fileName); |
| 2661 | |
| 2662 | int sample_rate = wxGetApp().getSampleRate(); |
| 2663 | |
| 2664 | //scan the available sample rates and see if it matches a predefined one |
| 2665 | int menuIndex = -1; |
| 2666 | for (auto discreteRate : sampleRates) { |
| 2667 | if (discreteRate == sample_rate) { |
| 2668 | menuIndex++; |
| 2669 | //activate Bandwidth Menu entry matching this predefined sample_rate. |
| 2670 | sampleRateMenuItems[wxID_BANDWIDTH_BASE + menuIndex]->Check(true); |
| 2671 | break; |
| 2672 | } |
| 2673 | } //end for |
| 2674 | //this is a manual entry |
| 2675 | if (menuIndex == -1) { |
| 2676 | manualSampleRate = sample_rate; |
| 2677 | sampleRateMenuItems[wxID_BANDWIDTH_MANUAL]->Enable(true); |
| 2678 | // Apply the manual value, activate the menu entry |
| 2679 | |
| 2680 | sampleRateMenuItems[wxID_BANDWIDTH_MANUAL]->SetItemLabel(wxString("Manual Entry : ") + frequencyToStr(sample_rate)); |
| 2681 | sampleRateMenuItems[wxID_BANDWIDTH_MANUAL]->Check(true); |
| 2682 | } |
| 2683 | |
| 2684 | deviceChanged.store(true); |
| 2685 | |
| 2686 | currentSessionFile = fileName; |
| 2687 | |
| 2688 | std::string filePart = fileName.substr(fileName.find_last_of(filePathSeparator) + 1); |
| 2689 | |
| 2690 | GetStatusBar()->SetStatusText(wxString::Format(wxT("Loaded session file: %s"), currentSessionFile.c_str())); |
| 2691 | |
| 2692 | wxString titleBar = CUBICSDR_TITLE; |
| 2693 | //append the name of the current Device, if any. |
| 2694 | if (wxGetApp().getDevice()) { |
| 2695 | titleBar += " - " + wxGetApp().getDevice()->getName(); |
| 2696 | } |
| 2697 | titleBar += ": " + filePart; |
| 2698 | SetTitle(titleBar); |
| 2699 | |
| 2700 | wxGetApp().getBookmarkMgr().updateActiveList(); |
| 2701 | |
| 2702 | return result; |
| 2703 | } |
| 2704 | |
| 2705 | FFTVisualDataThread *AppFrame::getWaterfallDataThread() { |
| 2706 | return waterfallDataThread; |
nothing calls this directly
no test coverage detected