mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-07-09 18:45:22 +02:00
Formatted the entire codebase and added a CI check for formatting
This commit is contained in:
@ -49,10 +49,22 @@ void MainWindow::init() {
|
||||
// Load menu elements
|
||||
gui::menu.order.clear();
|
||||
for (auto& elem : menuElements) {
|
||||
if (!elem.contains("name")) { spdlog::error("Menu element is missing name key"); continue; }
|
||||
if (!elem["name"].is_string()) { spdlog::error("Menu element name isn't a string"); continue; }
|
||||
if (!elem.contains("open")) { spdlog::error("Menu element is missing open key"); continue; }
|
||||
if (!elem["open"].is_boolean()) { spdlog::error("Menu element name isn't a string"); continue; }
|
||||
if (!elem.contains("name")) {
|
||||
spdlog::error("Menu element is missing name key");
|
||||
continue;
|
||||
}
|
||||
if (!elem["name"].is_string()) {
|
||||
spdlog::error("Menu element name isn't a string");
|
||||
continue;
|
||||
}
|
||||
if (!elem.contains("open")) {
|
||||
spdlog::error("Menu element is missing open key");
|
||||
continue;
|
||||
}
|
||||
if (!elem["open"].is_boolean()) {
|
||||
spdlog::error("Menu element name isn't a string");
|
||||
continue;
|
||||
}
|
||||
Menu::MenuOption_t opt;
|
||||
opt.name = elem["name"];
|
||||
opt.open = elem["open"];
|
||||
@ -66,15 +78,15 @@ void MainWindow::init() {
|
||||
gui::menu.registerEntry("Theme", thememenu::draw, NULL);
|
||||
gui::menu.registerEntry("VFO Color", vfo_color_menu::draw, NULL);
|
||||
gui::menu.registerEntry("Module Manager", module_manager_menu::draw, NULL);
|
||||
|
||||
|
||||
gui::freqSelect.init();
|
||||
|
||||
// Set default values for waterfall in case no source init's it
|
||||
gui::waterfall.setBandwidth(8000000);
|
||||
gui::waterfall.setViewBandwidth(8000000);
|
||||
|
||||
fft_in = (fftwf_complex*) fftwf_malloc(sizeof(fftwf_complex) * fftSize);
|
||||
fft_out = (fftwf_complex*) fftwf_malloc(sizeof(fftwf_complex) * fftSize);
|
||||
|
||||
fft_in = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * fftSize);
|
||||
fft_out = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * fftSize);
|
||||
fftwPlan = fftwf_plan_dft_1d(fftSize, fft_in, fft_out, FFTW_FORWARD, FFTW_ESTIMATE);
|
||||
|
||||
sigpath::signalPath.init(8000000, 20, fftSize, &dummyStream, (dsp::complex_t*)fft_in, fftHandler, this);
|
||||
@ -88,7 +100,7 @@ void MainWindow::init() {
|
||||
|
||||
// Load modules from /module directory
|
||||
if (std::filesystem::is_directory(modulesDir)) {
|
||||
for (const auto & file : std::filesystem::directory_iterator(modulesDir)) {
|
||||
for (const auto& file : std::filesystem::directory_iterator(modulesDir)) {
|
||||
std::string path = file.path().generic_string();
|
||||
if (file.path().extension().generic_string() != SDRPP_MOD_EXTENTSION) {
|
||||
continue;
|
||||
@ -130,7 +142,7 @@ void MainWindow::init() {
|
||||
LoadingScreen::show("Loading color maps");
|
||||
spdlog::info("Loading color maps");
|
||||
if (std::filesystem::is_directory(resourcesDir + "/colormaps")) {
|
||||
for (const auto & file : std::filesystem::directory_iterator(resourcesDir + "/colormaps")) {
|
||||
for (const auto& file : std::filesystem::directory_iterator(resourcesDir + "/colormaps")) {
|
||||
std::string path = file.path().generic_string();
|
||||
LoadingScreen::show("Loading " + path);
|
||||
spdlog::info("Loading {0}", path);
|
||||
@ -196,11 +208,11 @@ void MainWindow::init() {
|
||||
float finalBwHalf = gui::waterfall.getBandwidth() / 2.0;
|
||||
for (auto& [_name, _vfo] : gui::waterfall.vfos) {
|
||||
if (_vfo->lowerOffset < -finalBwHalf) {
|
||||
sigpath::vfoManager.setCenterOffset(_name, (_vfo->bandwidth/2)-finalBwHalf);
|
||||
sigpath::vfoManager.setCenterOffset(_name, (_vfo->bandwidth / 2) - finalBwHalf);
|
||||
continue;
|
||||
}
|
||||
if (_vfo->upperOffset > finalBwHalf) {
|
||||
sigpath::vfoManager.setCenterOffset(_name, finalBwHalf-(_vfo->bandwidth/2));
|
||||
sigpath::vfoManager.setCenterOffset(_name, finalBwHalf - (_vfo->bandwidth / 2));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -224,8 +236,8 @@ void MainWindow::fftHandler(dsp::complex_t* samples, int count, void* ctx) {
|
||||
|
||||
// Zero out the rest of the samples
|
||||
if (count < _this->fftSize) {
|
||||
memset(&_this->fft_in[count], 0, (_this->fftSize-count) * sizeof(dsp::complex_t));
|
||||
}
|
||||
memset(&_this->fft_in[count], 0, (_this->fftSize - count) * sizeof(dsp::complex_t));
|
||||
}
|
||||
|
||||
// Execute FFT
|
||||
fftwf_execute(_this->fftwPlan);
|
||||
@ -258,14 +270,12 @@ void MainWindow::vfoAddedHandler(VFOManager::VFO* vfo, void* ctx) {
|
||||
double viewBW = gui::waterfall.getViewBandwidth();
|
||||
double viewOffset = gui::waterfall.getViewOffset();
|
||||
|
||||
double viewLower = viewOffset - (viewBW/2.0);
|
||||
double viewUpper = viewOffset + (viewBW/2.0);
|
||||
double viewLower = viewOffset - (viewBW / 2.0);
|
||||
double viewUpper = viewOffset + (viewBW / 2.0);
|
||||
|
||||
double newOffset = std::clamp<double>(offset, viewLower, viewUpper);
|
||||
|
||||
sigpath::vfoManager.setCenterOffset(name, _this->initComplete ? newOffset : offset);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::draw() {
|
||||
@ -289,7 +299,7 @@ void MainWindow::draw() {
|
||||
core::configManager.release(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sigpath::vfoManager.updateFromWaterfall(&gui::waterfall);
|
||||
|
||||
// Handle selection of another VFO
|
||||
@ -415,7 +425,7 @@ void MainWindow::draw() {
|
||||
|
||||
int snrWidth = std::min<int>(300, ImGui::GetWindowSize().x - ImGui::GetCursorPosX() - 87);
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetWindowSize().x - (snrWidth+87));
|
||||
ImGui::SetCursorPosX(ImGui::GetWindowSize().x - (snrWidth + 87));
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5);
|
||||
ImGui::SetNextItemWidth(snrWidth);
|
||||
ImGui::SNRMeter((vfo != NULL) ? gui::waterfall.selectedVFOSNR : 0);
|
||||
@ -456,7 +466,7 @@ void MainWindow::draw() {
|
||||
else {
|
||||
ImGui::SetMouseCursor(ImGuiMouseCursor_Arrow);
|
||||
}
|
||||
if(!down && grabbingMenu) {
|
||||
if (!down && grabbingMenu) {
|
||||
grabbingMenu = false;
|
||||
menuWidth = newWidth;
|
||||
core::configManager.acquire();
|
||||
@ -494,13 +504,13 @@ void MainWindow::draw() {
|
||||
core::configManager.release(true);
|
||||
}
|
||||
if (startedWithMenuClosed) {
|
||||
startedWithMenuClosed = false;
|
||||
startedWithMenuClosed = false;
|
||||
}
|
||||
else {
|
||||
firstMenuRender = false;
|
||||
}
|
||||
|
||||
if(ImGui::CollapsingHeader("Debug")) {
|
||||
if (ImGui::CollapsingHeader("Debug")) {
|
||||
ImGui::Text("Frame time: %.3f ms/frame", 1000.0 / ImGui::GetIO().Framerate);
|
||||
ImGui::Text("Framerate: %.1f FPS", ImGui::GetIO().Framerate);
|
||||
ImGui::Text("Center Frequency: %.0f Hz", gui::waterfall.getCenterFrequency());
|
||||
@ -511,7 +521,7 @@ void MainWindow::draw() {
|
||||
ImGui::Checkbox("Bypass buffering", &sigpath::signalPath.inputBuffer.bypass);
|
||||
|
||||
ImGui::Text("Buffering: %d", (sigpath::signalPath.inputBuffer.writeCur - sigpath::signalPath.inputBuffer.readCur + 32) % 32);
|
||||
|
||||
|
||||
if (ImGui::Button("Test Bug")) {
|
||||
spdlog::error("Will this make the software crash?");
|
||||
}
|
||||
@ -543,7 +553,7 @@ void MainWindow::draw() {
|
||||
|
||||
ImGui::BeginChild("Waterfall");
|
||||
|
||||
gui::waterfall.draw();
|
||||
gui::waterfall.draw();
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
@ -589,7 +599,7 @@ void MainWindow::draw() {
|
||||
core::configManager.release(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ImGui::NextColumn();
|
||||
ImGui::BeginChild("WaterfallControls");
|
||||
|
||||
@ -598,7 +608,7 @@ void MainWindow::draw() {
|
||||
ImGui::SetCursorPosX((ImGui::GetWindowSize().x / 2.0) - 10);
|
||||
if (ImGui::VSliderFloat("##_7_", ImVec2(20.0, 150.0), &bw, 1.0, 0.0, "")) {
|
||||
double factor = (double)bw * (double)bw;
|
||||
|
||||
|
||||
// Map 0.0 -> 1.0 to 1000.0 -> bandwidth
|
||||
double wfBw = gui::waterfall.getBandwidth();
|
||||
double delta = wfBw - 1000.0;
|
||||
@ -687,7 +697,7 @@ void MainWindow::setFFTSize(int size) {
|
||||
fftwf_destroy_plan(fftwPlan);
|
||||
fftwf_free(fft_in);
|
||||
fftwf_free(fft_out);
|
||||
|
||||
|
||||
fft_in = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * fftSize);
|
||||
fft_out = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * fftSize);
|
||||
fftwPlan = fftwf_plan_dft_1d(fftSize, fft_in, fft_out, FFTW_FORWARD, FFTW_ESTIMATE);
|
||||
|
Reference in New Issue
Block a user