upnpbrowser: formatting code using astyle; some manual code nicenings

Origin commit data
------------------
Commit: b5bc4c68b6
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-12-04 (Sat, 04 Dec 2021)

Origin message was:
------------------
- upnpbrowser: formatting code using astyle; some manual code nicenings
This commit is contained in:
vanhofen
2021-12-04 23:22:35 +01:00
parent d8f44f1bee
commit db9a15f583
2 changed files with 25 additions and 28 deletions

View File

@@ -44,6 +44,7 @@
#include <gui/audiomute.h> #include <gui/audiomute.h>
#include <gui/color.h> #include <gui/color.h>
#include <gui/infoicons.h>
#include <gui/movieplayer.h> #include <gui/movieplayer.h>
#include <gui/components/cc.h> #include <gui/components/cc.h>
#include <gui/widget/msgbox.h> #include <gui/widget/msgbox.h>
@@ -58,9 +59,6 @@
extern cVideo *videoDecoder; extern cVideo *videoDecoder;
extern CPictureViewer *g_PicViewer; extern CPictureViewer *g_PicViewer;
//NI InfoIcons
#include <gui/infoicons.h>
const struct button_label RescanButton = {NEUTRINO_ICON_BUTTON_BLUE, LOCALE_UPNPBROWSER_RESCAN}; const struct button_label RescanButton = {NEUTRINO_ICON_BUTTON_BLUE, LOCALE_UPNPBROWSER_RESCAN};
const struct button_label BrowseButtons[] = const struct button_label BrowseButtons[] =
{ {
@@ -91,14 +89,14 @@ void CUpnpBrowserGui::Init()
{ {
font_item = SNeutrinoSettings::FONT_TYPE_MENU; font_item = SNeutrinoSettings::FONT_TYPE_MENU;
topbox.enableFrame(true, 1); //NI topbox.enableFrame(true, 1);
topbox.setCorner(RADIUS_LARGE); topbox.setCorner(RADIUS_LARGE);
topbox.setColorAll(COL_FRAME_PLUS_0, COL_MENUHEAD_PLUS_0, COL_SHADOW_PLUS_0, COL_MENUHEAD_TEXT); topbox.setColorAll(COL_FRAME_PLUS_0, COL_MENUHEAD_PLUS_0, COL_SHADOW_PLUS_0, COL_MENUHEAD_TEXT);
topbox.setTextFont(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]); topbox.setTextFont(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]);
topbox.enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_SHADOW_PLUS_0, g_settings.theme.menu_Head_gradient_direction); topbox.enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_SHADOW_PLUS_0, g_settings.theme.menu_Head_gradient_direction);
topbox.enableShadow(CC_SHADOW_ON); topbox.enableShadow(CC_SHADOW_ON);
infobox.enableFrame(true, 1); //NI infobox.enableFrame(true, 1);
infobox.setCorner(RADIUS_LARGE); infobox.setCorner(RADIUS_LARGE);
infobox.setColorAll(topbox.getColorFrame(), COL_MENUCONTENTDARK_PLUS_0); infobox.setColorAll(topbox.getColorFrame(), COL_MENUCONTENTDARK_PLUS_0);
infobox.setTextColor(COL_MENUCONTENTDARK_TEXT); infobox.setTextColor(COL_MENUCONTENTDARK_TEXT);
@@ -106,7 +104,7 @@ void CUpnpBrowserGui::Init()
infobox.enableColBodyGradient(g_settings.theme.menu_Hint_gradient, COL_SHADOW_PLUS_0, g_settings.theme.menu_Hint_gradient_direction); infobox.enableColBodyGradient(g_settings.theme.menu_Hint_gradient, COL_SHADOW_PLUS_0, g_settings.theme.menu_Hint_gradient_direction);
infobox.enableShadow(CC_SHADOW_ON); infobox.enableShadow(CC_SHADOW_ON);
timebox.enableFrame(true, 1); //NI timebox.enableFrame(true, 1);
timebox.setCorner(RADIUS_LARGE); timebox.setCorner(RADIUS_LARGE);
timebox.setColorAll(infobox.getColorFrame(), infobox.getColorBody()); timebox.setColorAll(infobox.getColorFrame(), infobox.getColorBody());
timebox.setTextColor(infobox.getTextColor()); timebox.setTextColor(infobox.getTextColor());
@@ -256,7 +254,7 @@ void CUpnpBrowserGui::splitProtocol(std::string &protocol, std::string &prot, st
} }
} }
} }
//printf("%s -> %s - %s - %s - %s\n", protocol.c_str(), prot.c_str(), network.c_str(), mime.c_str(), additional.c_str()); //printf("%s -> %s - %s - %s - %s\n", protocol.c_str(), prot.c_str(), network.c_str(), mime.c_str(), additional.c_str());
} }
bool CUpnpBrowserGui::discoverDevices() bool CUpnpBrowserGui::discoverDevices()
@@ -264,7 +262,7 @@ bool CUpnpBrowserGui::discoverDevices()
if (!m_devices.empty()) if (!m_devices.empty())
return true; return true;
CHintBox hintbox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_UPNPBROWSER_SCANNING)); // UTF-8 CHintBox hintbox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_UPNPBROWSER_SCANNING));
hintbox.paint(); hintbox.paint();
try try
@@ -542,7 +540,7 @@ void CUpnpBrowserGui::selectDevice()
return; return;
CAudioMute::getInstance()->enableMuteIcon(false); CAudioMute::getInstance()->enableMuteIcon(false);
CInfoIcons::getInstance()->enableInfoIcons(false); //NI InfoIcons CInfoIcons::getInstance()->enableInfoIcons(false);
while (loop) while (loop)
{ {
@@ -606,7 +604,6 @@ void CUpnpBrowserGui::selectDevice()
{ {
CNeutrinoApp::getInstance()->handleMsg(msg, data); CNeutrinoApp::getInstance()->handleMsg(msg, data);
} }
else if (msg > CRCInput::RC_MaxRC)
#endif #endif
else else
{ {
@@ -616,7 +613,7 @@ void CUpnpBrowserGui::selectDevice()
} }
} }
CAudioMute::getInstance()->enableMuteIcon(true); CAudioMute::getInstance()->enableMuteIcon(true);
CInfoIcons::getInstance()->enableInfoIcons(true); //NI InfoIcons CInfoIcons::getInstance()->enableInfoIcons(true);
} }
void CUpnpBrowserGui::playnext(void) void CUpnpBrowserGui::playnext(void)
@@ -711,7 +708,7 @@ void CUpnpBrowserGui::playnext(void)
m_frameBuffer->Clear(); m_frameBuffer->Clear();
} }
bool CUpnpBrowserGui::getItems(std::string id, unsigned int index, std::vector<UPnPEntry>*&entries, unsigned int &total) bool CUpnpBrowserGui::getItems(std::string id, unsigned int index, std::vector<UPnPEntry> *&entries, unsigned int &total)
{ {
bool tfound = false; bool tfound = false;
bool rfound = false; bool rfound = false;
@@ -757,7 +754,7 @@ bool CUpnpBrowserGui::getItems(std::string id, unsigned int index, std::vector<U
return true; return true;
} }
bool CUpnpBrowserGui::updateItemSelection(std::string id, std::vector<UPnPEntry>*&entries, int newpos, unsigned int &selected, unsigned int &liststart) bool CUpnpBrowserGui::updateItemSelection(std::string id, std::vector<UPnPEntry> *&entries, int newpos, unsigned int &selected, unsigned int &liststart)
{ {
if ((int) selected != newpos) if ((int) selected != newpos)
{ {
@@ -1085,7 +1082,7 @@ void CUpnpBrowserGui::paintDevices()
// Head // Head
CComponentsHeader header(m_x, m_header_y, m_width, m_header_height, LOCALE_UPNPBROWSER_HEAD, NEUTRINO_ICON_UPNP); CComponentsHeader header(m_x, m_header_y, m_width, m_header_height, LOCALE_UPNPBROWSER_HEAD, NEUTRINO_ICON_UPNP);
header.enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true); header.enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true);
if (CNeutrinoApp::getInstance()->isMuted()) //TODO: consider mute mode on runtime if (CNeutrinoApp::getInstance()->isMuted()) // TODO: consider mute mode on runtime
header.addContextButton(NEUTRINO_ICON_BUTTON_MUTE_SMALL); header.addContextButton(NEUTRINO_ICON_BUTTON_MUTE_SMALL);
else else
header.removeContextButtons(); header.removeContextButtons();
@@ -1213,7 +1210,7 @@ void CUpnpBrowserGui::paintItemInfo(UPnPEntry *entry)
} }
tmp += "\n"; tmp += "\n";
//third line // third line
if (!entry->isdir && preferred != -1) if (!entry->isdir && preferred != -1)
tmp += "URL: " + entry->resources[preferred].url; tmp += "URL: " + entry->resources[preferred].url;
@@ -1252,7 +1249,7 @@ void CUpnpBrowserGui::paintItems(std::vector<UPnPEntry> *entry, unsigned int sel
{ {
printf("CUpnpBrowserGui::paintItem:s selected %d max %d offset %d\n", selected, max, offset); printf("CUpnpBrowserGui::paintItem:s selected %d max %d offset %d\n", selected, max, offset);
//block infoclock // block infoclock
CInfoClock::getInstance()->block(); CInfoClock::getInstance()->block();
// LCD // LCD
@@ -1271,7 +1268,7 @@ void CUpnpBrowserGui::paintItems(std::vector<UPnPEntry> *entry, unsigned int sel
for (unsigned int count = 0; count < m_listmaxshow; count++) for (unsigned int count = 0; count < m_listmaxshow; count++)
paintItem(entry, count, selected); paintItem(entry, count, selected);
//scrollbar // scrollbar
int total_pages; int total_pages;
int current_page; int current_page;
getScrollBarData(&total_pages, &current_page, max + offset, m_listmaxshow, selected + offset); getScrollBarData(&total_pages, &current_page, max + offset, m_listmaxshow, selected + offset);
@@ -1382,7 +1379,7 @@ void CUpnpBrowserGui::updateTimes(const bool force)
void CUpnpBrowserGui::updateMode() void CUpnpBrowserGui::updateMode()
{ {
/* switch back to mode_upnp if audio has stopped automatically */ // switch back to mode_upnp if audio has stopped automatically
if ((CAudioPlayer::getInstance()->getState() == CBaseDec::STOP) && (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_audio)) if ((CAudioPlayer::getInstance()->getState() == CBaseDec::STOP) && (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_audio))
{ {
CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoModes::mode_upnp | NeutrinoModes::norezap); CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoModes::mode_upnp | NeutrinoModes::norezap);

View File

@@ -116,8 +116,8 @@ class CUpnpBrowserGui : public CMenuTarget, public CListHelpers
void paintDeviceInfo(); void paintDeviceInfo();
void playnext(); void playnext();
bool getItems(std::string id, unsigned int index, std::vector<UPnPEntry>*&entries, unsigned int &total); bool getItems(std::string id, unsigned int index, std::vector<UPnPEntry> *&entries, unsigned int &total);
bool updateItemSelection(std::string id, std::vector<UPnPEntry>*&entries, int newpos, unsigned int &selected, unsigned int &liststart); bool updateItemSelection(std::string id, std::vector<UPnPEntry> *&entries, int newpos, unsigned int &selected, unsigned int &liststart);
bool selectItem(std::string); bool selectItem(std::string);
void paintItems(std::vector<UPnPEntry> *entry, unsigned int selected, unsigned int max, unsigned int offset); void paintItems(std::vector<UPnPEntry> *entry, unsigned int selected, unsigned int max, unsigned int offset);
void paintItem(std::vector<UPnPEntry> *entry, unsigned int pos, unsigned int selected); void paintItem(std::vector<UPnPEntry> *entry, unsigned int pos, unsigned int selected);