Push before merge

This commit is contained in:
Ryzerth
2020-09-06 15:39:09 +02:00
parent 7190acfe9e
commit c0825dbeeb
35 changed files with 90 additions and 57 deletions

View File

@@ -6,6 +6,7 @@ namespace config {
bool autoSaveRunning = false;
std::string _path;
std::thread _workerThread;
std::string rootDir;
void _autoSaveWorker() {
while (autoSaveRunning) {
@@ -50,4 +51,12 @@ namespace config {
autoSaveRunning = false;
_workerThread.join();
}
void setRootDirectory(std::string dir) {
rootDir = dir;
}
std::string getRootDirectory() {
return rootDir;
}
};

View File

@@ -14,6 +14,8 @@ namespace config {
void load(std::string path);
void startAutoSave();
void stopAutoSave();
void setRootDirectory(std::string dir);
std::string getRootDirectory();
extern bool configModified;
extern json config;

View File

@@ -9,9 +9,9 @@ namespace icons {
ImTextureID STOP;
ImTextureID MENU;
GLuint loadTexture(char* path) {
GLuint loadTexture(std::string path) {
int w,h,n;
stbi_uc* data = stbi_load(path, &w, &h, &n, NULL);
stbi_uc* data = stbi_load(path.c_str(), &w, &h, &n, NULL);
GLuint texId;
glGenTextures(1, &texId);
glBindTexture(GL_TEXTURE_2D, texId);
@@ -24,9 +24,9 @@ namespace icons {
}
void load() {
LOGO = (ImTextureID)loadTexture("res/icons/sdrpp.png");
PLAY = (ImTextureID)loadTexture("res/icons/play.png");
STOP = (ImTextureID)loadTexture("res/icons/stop.png");
MENU = (ImTextureID)loadTexture("res/icons/menu.png");
LOGO = (ImTextureID)loadTexture(config::getRootDirectory() + "/res/icons/sdrpp.png");
PLAY = (ImTextureID)loadTexture(config::getRootDirectory() + "/res/icons/play.png");
STOP = (ImTextureID)loadTexture(config::getRootDirectory() + "/res/icons/stop.png");
MENU = (ImTextureID)loadTexture(config::getRootDirectory() + "/res/icons/menu.png");
}
}

View File

@@ -2,6 +2,7 @@
#include <imgui/imgui.h>
#include <stdint.h>
#include <GL/glew.h>
#include <config.h>
namespace icons {
extern ImTextureID LOGO;

View File

@@ -11,6 +11,8 @@ namespace io {
public:
SoapyWrapper() {
SoapySDR::registerLogHandler(_logHandler);
SoapySDR::Device::make("");
output.init(64000);
currentGains = new float[1];
refresh();

View File

@@ -44,9 +44,15 @@ int main() {
spdlog::info("SDR++ v" VERSION_STR);
#ifdef _WIN32
config::setRootDirectory(".");
#else
config::setRootDirectory("/etc/sdrpp");
#endif
// Load config
spdlog::info("Loading config");
config::load("config.json");
config::load(config::getRootDirectory() + "/config.json");
config::startAutoSave();
// Setup window
@@ -80,7 +86,7 @@ int main() {
// Load app icon
GLFWimage icons[10];
icons[0].pixels = stbi_load("res/icons/sdrpp.png", &icons[0].width, &icons[0].height, 0, 4);
icons[0].pixels = stbi_load((config::getRootDirectory() + "/res/icons/sdrpp.png").c_str(), &icons[0].width, &icons[0].height, 0, 4);
icons[1].pixels = (unsigned char*)malloc(16 * 16 * 4); icons[1].width = icons[1].height = 16;
icons[2].pixels = (unsigned char*)malloc(24 * 24 * 4); icons[2].width = icons[2].height = 24;
icons[3].pixels = (unsigned char*)malloc(32 * 32 * 4); icons[3].width = icons[3].height = 32;
@@ -127,10 +133,10 @@ int main() {
icons::load();
spdlog::info("Loading band plans");
bandplan::loadFromDir("bandplans");
bandplan::loadFromDir(config::getRootDirectory() + "/bandplans");
spdlog::info("Loading band plans color table");
bandplan::loadColorTable("band_colors.json");
bandplan::loadColorTable(config::getRootDirectory() + "/band_colors.json");
windowInit();

View File

@@ -170,9 +170,9 @@ void windowInit() {
spdlog::info("Loading modules");
mod::initAPI(&wtf);
mod::loadFromList("module_list.json");
mod::loadFromList(config::getRootDirectory() + "/module_list.json");
bigFont = ImGui::GetIO().Fonts->AddFontFromFileTTF("res/fonts/Roboto-Medium.ttf", 128.0f);
bigFont = ImGui::GetIO().Fonts->AddFontFromFileTTF((config::getRootDirectory() + "/res/fonts/Roboto-Medium.ttf").c_str(), 128.0f);
// Load last source configuration
uint64_t frequency = config::config["frequency"];
@@ -214,13 +214,10 @@ void windowInit() {
// Finish the recorder module
// Add squelsh
// Bandwidth ajustment
// DSB / CW and RAW modes;
// CW and RAW modes;
// Bring VFO to a visible place when changing sample rate if it's smaller
// Have a proper root directory
// Fix issue of source name not set when source was not selected manually
// Generate entire source config before saving a source property
// ^ same for audio devices
// Have a proper root directory
// And a module add/remove/change order menu
// get rid of watchers and use if() instead