add device gui for yamahaAmp

This commit is contained in:
KlausMu 2024-04-23 15:12:25 +02:00 committed by Klaus Musch
parent 749f13417e
commit 17ee1f06d0
3 changed files with 53 additions and 1 deletions

View file

@ -0,0 +1,46 @@
#include <lvgl.h>
#include "applicationInternal/gui/guiBase.h"
#include "applicationInternal/gui/guiRegistry.h"
#include "applicationInternal/commandHandler.h"
#include "devices/AVreceiver/device_yamahaAmp/device_yamahaAmp.h"
#include "devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.h"
static void button_clicked_event_cb(lv_event_t* e) {
int user_data = (intptr_t)(e->user_data);
if (user_data == 0) {
executeCommand(YAMAHA_STANDARD);
}
}
void create_tab_content_yamahaAmp(lv_obj_t* tab) {
// Add content to the sceneSelection tab
lv_obj_set_layout(tab, LV_LAYOUT_FLEX);
lv_obj_set_flex_flow(tab, LV_FLEX_FLOW_COLUMN);
lv_obj_set_scrollbar_mode(tab, LV_SCROLLBAR_MODE_ACTIVE);
// -- create a button for "standard" ----------------------------------------
lv_obj_t* button = lv_btn_create(tab);
lv_obj_set_size(button, 80, 40);
lv_obj_set_style_radius(button, 10, LV_PART_MAIN);
lv_obj_set_style_bg_color(button, color_primary, LV_PART_MAIN);
lv_obj_add_event_cb(button, button_clicked_event_cb, LV_EVENT_CLICKED, (void *)(intptr_t) 0);
lv_obj_t* label = lv_label_create(button);
lv_label_set_text(label, "Standard");
lv_obj_center(label);
}
void notify_tab_before_delete_yamahaAmp(void) {
// remember to set all pointers to lvgl objects to NULL if they might be accessed from outside.
// They must check if object is NULL and must not use it if so
}
void register_gui_yamahaAmp(void){
register_gui(std::string(tabName_yamahaAmp), & create_tab_content_yamahaAmp, & notify_tab_before_delete_yamahaAmp);
}

View file

@ -0,0 +1,4 @@
#pragma once
const char * const tabName_yamahaAmp = "Yamaha Amp";
void register_gui_yamahaAmp(void);

View file

@ -31,6 +31,7 @@
#include "guis/gui_irReceiver.h" #include "guis/gui_irReceiver.h"
#include "guis/gui_settings.h" #include "guis/gui_settings.h"
#include "guis/gui_numpad.h" #include "guis/gui_numpad.h"
#include "devices/AVreceiver/device_yamahaAmp/gui_yamahaAmp.h"
#include "devices/mediaPlayer/device_appleTV/gui_appleTV.h" #include "devices/mediaPlayer/device_appleTV/gui_appleTV.h"
#include "devices/misc/device_smarthome/gui_smarthome.h" #include "devices/misc/device_smarthome/gui_smarthome.h"
#include "applicationInternal/keys.h" #include "applicationInternal/keys.h"
@ -110,9 +111,10 @@ int main(int argc, char *argv[]) {
register_gui_appleTV(); register_gui_appleTV();
register_gui_numpad(); register_gui_numpad();
register_gui_smarthome(); register_gui_smarthome();
register_gui_yamahaAmp();
// Only show these GUIs in the main gui list. If you don't set this explicitely, by default all registered guis are shown. // Only show these GUIs in the main gui list. If you don't set this explicitely, by default all registered guis are shown.
#if (USE_SCENE_SPECIFIC_GUI_LIST != 0) #if (USE_SCENE_SPECIFIC_GUI_LIST != 0)
main_gui_list = {tabName_sceneSelection, tabName_smarthome, tabName_settings, tabName_irReceiver}; main_gui_list = {tabName_yamahaAmp, tabName_sceneSelection, tabName_smarthome, tabName_settings, tabName_irReceiver};
#endif #endif
// register the scenes and their key_commands_* // register the scenes and their key_commands_*