* Add toggle_visible action * Add set_visible and set_invisible actions * Rename toggle_visible method to match `action_toggle_visible` -> `action_toggle_visibility` Matches with `EVENT_TOGGLE_VISIBILITY` * Update CHANGELOG * Revert #2320 IPC commands IPC commands are no longer necessary now that the actions are implemented. Changed some method permissions as well to reflect this. * Add logging and change action names - `module_toggle` - `module_show` - `module_hide` Delineate common actions to all modules with a `module_` prefix (for future actions too) * Update documentation
This commit is contained in:
parent
dcd33057fd
commit
06932007a0
7 changed files with 53 additions and 46 deletions
src/components
|
@ -528,26 +528,6 @@ bool controller::forward_action(const actions_util::action& action_triple) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void controller::switch_module_visibility(string module_name_raw, int visible) {
|
||||
for (auto&& mod : m_modules) {
|
||||
if (mod->name_raw() != module_name_raw)
|
||||
continue;
|
||||
|
||||
if (visible == 0) {
|
||||
mod->set_visible(false);
|
||||
} else if (visible == 1) {
|
||||
mod->set_visible(true);
|
||||
} else if (visible == 2) {
|
||||
mod->set_visible(!mod->visible());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.err("controller: Module '%s' not found for visibility change (state=%s)", module_name_raw,
|
||||
visible ? "shown" : "hidden");
|
||||
}
|
||||
|
||||
/**
|
||||
* Process stored input data
|
||||
*/
|
||||
|
@ -839,10 +819,6 @@ bool controller::on(const signals::ipc::command& evt) {
|
|||
return false;
|
||||
}
|
||||
|
||||
string hide_module{"hide."};
|
||||
string show_module{"show."};
|
||||
string toggle_module{"toggle."};
|
||||
|
||||
if (command == "quit") {
|
||||
enqueue(make_quit_evt(false));
|
||||
} else if (command == "restart") {
|
||||
|
@ -853,12 +829,6 @@ bool controller::on(const signals::ipc::command& evt) {
|
|||
m_bar->show();
|
||||
} else if (command == "toggle") {
|
||||
m_bar->toggle();
|
||||
} else if (command.find(hide_module) == 0) {
|
||||
switch_module_visibility(command.substr(hide_module.length()), 0);
|
||||
} else if (command.find(show_module) == 0) {
|
||||
switch_module_visibility(command.substr(show_module.length()), 1);
|
||||
} else if (command.find(toggle_module) == 0) {
|
||||
switch_module_visibility(command.substr(toggle_module.length()), 2);
|
||||
} else {
|
||||
m_log.warn("\"%s\" is not a valid ipc command", command);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue