From 27137ec9d29c36df8117869773203b243849896c Mon Sep 17 00:00:00 2001 From: BossCode45 Date: Fri, 26 May 2023 21:46:19 +1200 Subject: feat: Made keybinds work (I hope) Note: the config file reloading keybinds isn't quite working, though, need to ungrab the keys --- config.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'config.cpp') diff --git a/config.cpp b/config.cpp index 101af24..6d8215c 100644 --- a/config.cpp +++ b/config.cpp @@ -1,5 +1,6 @@ #include "config.h" #include "commands.h" +#include "error.h" #include @@ -66,6 +67,7 @@ const void Config::focChange(const CommandArg* argv) } const void Config::reload(const CommandArg* argv) { + // Note: this is kinda broken cos it doesn't ungrab keys, i'll do that later. cout << "Reloading config" << endl; reloadFile(); } @@ -116,14 +118,14 @@ Config::Config(CommandsModule& commandsModule) commandsModule.addCommand("addworkspace", &Config::addWorkspaceCmd, 2, addWorkspaceArgs, this); } -void Config::reloadFile() +Err Config::reloadFile() { if(!loaded) - return; - loadFromFile(file); + return {CFG_ERR_NON_FATAL, "Not loaded config yet"}; + return loadFromFile(file); } -void Config::loadFromFile(string path) +Err Config::loadFromFile(string path) { file = path; //Set defaults @@ -152,6 +154,7 @@ void Config::loadFromFile(string path) line++; } loaded = true; + return {NOERR, ""}; } Config::~Config() -- cgit v1.2.3