mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
glcd: re-add driver selection
Origin commit data
------------------
Branch: ni/coolstream
Commit: 8605be5228
Author: vanhofen <vanhofen@gmx.de>
Date: 2020-06-22 (Mon, 22 Jun 2020)
Origin message was:
------------------
- glcd: re-add driver selection
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -786,7 +786,11 @@ void cGLCD::Run(void)
|
||||
break;
|
||||
|
||||
int warmUp = 10;
|
||||
lcd = GLCD::CreateDriver(GLCD::Config.driverConfigs[0].id, &GLCD::Config.driverConfigs[0]);
|
||||
|
||||
if ((g_settings.glcd_selected_config < 0) || (g_settings.glcd_selected_config > GetConfigSize() - 1))
|
||||
g_settings.glcd_selected_config = 0;
|
||||
|
||||
lcd = GLCD::CreateDriver(GLCD::Config.driverConfigs[g_settings.glcd_selected_config].id, &GLCD::Config.driverConfigs[g_settings.glcd_selected_config]);
|
||||
if (!lcd) {
|
||||
#ifdef GLCD_DEBUG
|
||||
fprintf(stderr, "CreateDriver failed.\n");
|
||||
@@ -1705,3 +1709,14 @@ int cGLCD::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t /* data */)
|
||||
return messages_return::unhandled;
|
||||
}
|
||||
|
||||
int cGLCD::GetConfigSize()
|
||||
{
|
||||
return (int) GLCD::Config.driverConfigs.size();
|
||||
}
|
||||
|
||||
std::string cGLCD::GetConfigName(int driver)
|
||||
{
|
||||
if ((driver < 0) || (driver > GetConfigSize() - 1))
|
||||
driver = 0;
|
||||
return GLCD::Config.driverConfigs[driver].name;
|
||||
}
|
||||
|
@@ -226,6 +226,8 @@ class cGLCD
|
||||
static void Blit();
|
||||
static void SetBrightness(unsigned int b);
|
||||
static void TogglePower();
|
||||
int GetConfigSize();
|
||||
std::string GetConfigName(int);
|
||||
bool dumpBuffer(fb_pixel_t *s, int format, const char *filename);
|
||||
void UpdateBrightness();
|
||||
int handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data);
|
||||
|
@@ -161,7 +161,6 @@ int GLCD_Menu::exec(CMenuTarget* parent, const std::string & actionKey)
|
||||
cglcd->Rescan();
|
||||
return res;
|
||||
}
|
||||
#if 0
|
||||
if(actionKey == "select_driver") {
|
||||
if(parent)
|
||||
parent->hide();
|
||||
@@ -169,7 +168,6 @@ int GLCD_Menu::exec(CMenuTarget* parent, const std::string & actionKey)
|
||||
cglcd->Exit();
|
||||
return menu_return::RETURN_EXIT;
|
||||
}
|
||||
#endif
|
||||
if(actionKey == "select_font") {
|
||||
CFileBrowser fileBrowser;
|
||||
CFileFilter fileFilter;
|
||||
@@ -303,6 +301,8 @@ void GLCD_Menu::GLCD_Menu_Settings()
|
||||
|
||||
m.addItem(new CMenuOptionChooser(LOCALE_GLCD_ENABLE, &g_settings.glcd_enable,
|
||||
OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::RC_red));
|
||||
m.addItem(new CMenuForwarder(LOCALE_GLCD_DISPLAY, (cGLCD::getInstance()->GetConfigSize() > 1),
|
||||
cGLCD::getInstance()->GetConfigName(g_settings.glcd_selected_config).c_str(), this, "select_driver"));
|
||||
m.addItem(GenericMenuSeparatorLine);
|
||||
|
||||
int shortcut = 1;
|
||||
@@ -518,3 +518,34 @@ void GLCD_Menu::GLCD_Theme_Position_Settings()
|
||||
cGLCD::getInstance()->StandbyMode(false);
|
||||
m.hide();
|
||||
}
|
||||
|
||||
void GLCD_Menu::GLCD_Menu_Select_Driver()
|
||||
{
|
||||
int select = 0;
|
||||
|
||||
if (cGLCD::getInstance()->GetConfigSize() > 1)
|
||||
{
|
||||
CMenuWidget *m = new CMenuWidget(LOCALE_GLCD_HEAD, NEUTRINO_ICON_SETTINGS);
|
||||
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
|
||||
|
||||
// we don't show introitems, so we add a separator for a smoother view
|
||||
m->addItem(GenericMenuSeparator);
|
||||
|
||||
CMenuForwarder* mf;
|
||||
for (int i = 0; i < cGLCD::getInstance()->GetConfigSize(); i++)
|
||||
{
|
||||
mf = new CMenuForwarder(cGLCD::getInstance()->GetConfigName(i), true, NULL, selector,to_string(i).c_str());
|
||||
m->addItem(mf);
|
||||
}
|
||||
|
||||
m->enableSaveScreen();
|
||||
m->exec(NULL, "");
|
||||
|
||||
if (!m->gotAction())
|
||||
return;
|
||||
|
||||
delete selector;
|
||||
m->hide();
|
||||
}
|
||||
g_settings.glcd_selected_config = select;
|
||||
}
|
||||
|
@@ -38,6 +38,7 @@ class GLCD_Menu : public CMenuTarget, public CChangeObserver
|
||||
int width;
|
||||
int selected;
|
||||
SNeutrinoGlcdTheme oldTheme;
|
||||
void GLCD_Menu_Select_Driver();
|
||||
public:
|
||||
GLCD_Menu();
|
||||
void hide();
|
||||
|
Reference in New Issue
Block a user