volumebar: formatting code using astyle; some manual code nicenings

Origin commit data
------------------
Branch: ni/coolstream
Commit: e36272f4ac
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-12-04 (Sat, 04 Dec 2021)

Origin message was:
------------------
- volumebar: formatting code using astyle; some manual code nicenings

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2021-12-04 23:22:35 +01:00
parent 0d888b0a57
commit 711f9d8ff8
2 changed files with 128 additions and 122 deletions

View File

@@ -42,7 +42,6 @@ extern CTimeOSD *FileTimeOSD;
using namespace std; using namespace std;
CVolumeBar::CVolumeBar() CVolumeBar::CVolumeBar()
{ {
initVarVolumeBar(); initVarVolumeBar();
@@ -126,9 +125,11 @@ void CVolumeBar::initVolumeBarPosition()
switch (g_settings.volume_pos) switch (g_settings.volume_pos)
{ {
case VOLUMEBAR_POS_TOP_RIGHT:{ case VOLUMEBAR_POS_TOP_RIGHT:
{
int x_corr = 0; int x_corr = 0;
if ((neutrino->getMode() != NeutrinoModes::mode_avinput) && (neutrino->getMode() != NeutrinoModes::mode_audio) && (neutrino->getMode() != NeutrinoModes::mode_pic)) { if ((neutrino->getMode() != NeutrinoModes::mode_avinput) && (neutrino->getMode() != NeutrinoModes::mode_audio) && (neutrino->getMode() != NeutrinoModes::mode_pic))
{
if ((neutrino->isMuted()) && (!g_settings.mode_clock)) if ((neutrino->isMuted()) && (!g_settings.mode_clock))
x_corr = mute_dx + h_spacer; x_corr = mute_dx + h_spacer;
if (CNeutrinoApp::getInstance()->getChannellistIsVisible() == true) if (CNeutrinoApp::getInstance()->getChannellistIsVisible() == true)
@@ -180,7 +181,8 @@ void CVolumeBar::initVolumeBarItems()
// init current icon object // init current icon object
void CVolumeBar::initVolumeBarIcon() void CVolumeBar::initVolumeBarIcon()
{ {
if (!vb_icon){ if (!vb_icon)
{
vb_icon = new CComponentsPicture(vb_icon_x, CC_CENTERED, vb_icon_w, height, NEUTRINO_ICON_VOLUME); vb_icon = new CComponentsPicture(vb_icon_x, CC_CENTERED, vb_icon_w, height, NEUTRINO_ICON_VOLUME);
// add icon to container // add icon to container
addCCItem(vb_icon); addCCItem(vb_icon);
@@ -194,7 +196,8 @@ void CVolumeBar::initVolumeBarIcon()
// create new scale // create new scale
void CVolumeBar::initVolumeBarScale() void CVolumeBar::initVolumeBarScale()
{ {
if (!vb_pb){ if (!vb_pb)
{
vb_pb = new CProgressBar(); vb_pb = new CProgressBar();
// add progressbar to container // add progressbar to container
addCCItem(vb_pb); addCCItem(vb_pb);
@@ -232,13 +235,13 @@ void CVolumeBar::paintVolumeBarDigit()
vb_digit->paint(CC_SAVE_SCREEN_NO); vb_digit->paint(CC_SAVE_SCREEN_NO);
} }
// refresh progressbar and digit // refresh progressbar and digit
void CVolumeBar::repaintVolScale() void CVolumeBar::repaintVolScale()
{ {
paintVolScale(); paintVolScale();
if (g_settings.volume_digits) { if (g_settings.volume_digits)
{
initVolumeBarDigitValue(); initVolumeBarDigitValue();
paintVolumeBarDigit(); paintVolumeBarDigit();
} }
@@ -263,9 +266,7 @@ void CVolumeBar::paint(const bool &do_save_bg)
repaintVolScale(); repaintVolScale();
} }
// CVolumeHelper ##############################################################
// CVolumeHelper ####################################################################################################
CVolumeHelper::CVolumeHelper() CVolumeHelper::CVolumeHelper()
{ {
@@ -283,11 +284,13 @@ CVolumeHelper::CVolumeHelper()
void CVolumeHelper::resetFont() void CVolumeHelper::resetFont()
{ {
if (vb_font){ if (vb_font)
{
vb_font = NULL; vb_font = NULL;
dprintf(DEBUG_INFO, "\033[33m[CVolumeHelper][%s - %d] reset vb font \033[0m\n", __func__, __LINE__); dprintf(DEBUG_INFO, "\033[33m[CVolumeHelper][%s - %d] reset vb font \033[0m\n", __func__, __LINE__);
} }
if (clock_font){ if (clock_font)
{
clock_font = NULL; clock_font = NULL;
dprintf(DEBUG_INFO, "\033[33m[CVolumeHelper][%s - %d] reset clock font \033[0m\n", __func__, __LINE__); dprintf(DEBUG_INFO, "\033[33m[CVolumeHelper][%s - %d] reset clock font \033[0m\n", __func__, __LINE__);
} }
@@ -308,7 +311,8 @@ void CVolumeHelper::Init(Font* font)
void CVolumeHelper::initInfoClock(Font *font) void CVolumeHelper::initInfoClock(Font *font)
{ {
if (font == NULL) { if (font == NULL)
{
int dx = 0; int dx = 0;
int dy = g_settings.infoClockFontSize; int dy = g_settings.infoClockFontSize;
clock_font = *CNeutrinoFonts::getInstance()->getDynFont(dx, dy, g_settings.infoClockSeconds ? "%H:%M:%S" : "%H:%M"); clock_font = *CNeutrinoFonts::getInstance()->getDynFont(dx, dy, g_settings.infoClockSeconds ? "%H:%M:%S" : "%H:%M");
@@ -330,13 +334,15 @@ void CVolumeHelper::initInfoClock(Font* font)
vol_ay = y; vol_ay = y;
mute_corrY = 0; mute_corrY = 0;
if (g_settings.mode_clock) { if (g_settings.mode_clock)
{
if (mute_dy > clock_dy) if (mute_dy > clock_dy)
clock_ay += (mute_dy - clock_dy) / 2; clock_ay += (mute_dy - clock_dy) / 2;
else else
mute_corrY = (clock_dy - mute_dy) / 2; mute_corrY = (clock_dy - mute_dy) / 2;
} }
else { else
{
if (mute_dy > vol_height) if (mute_dy > vol_height)
vol_ay += (mute_dy - vol_height) / 2; vol_ay += (mute_dy - vol_height) / 2;
else else
@@ -366,7 +372,8 @@ void CVolumeHelper::initVolBarSize()
g_settings.volume_size = max(g_settings.volume_size, icon_height); g_settings.volume_size = max(g_settings.volume_size, icon_height);
vol_height = CFrameBuffer::getInstance()->scale2Res(g_settings.volume_size); vol_height = CFrameBuffer::getInstance()->scale2Res(g_settings.volume_size);
if (g_settings.volume_digits) { if (g_settings.volume_digits)
{
CNeutrinoFonts *cnf = CNeutrinoFonts::getInstance(); CNeutrinoFonts *cnf = CNeutrinoFonts::getInstance();
cnf->setFontUseDigitHeight(true); cnf->setFontUseDigitHeight(true);
int tmp_h = vol_height; int tmp_h = vol_height;

View File

@@ -86,13 +86,12 @@ class CVolumeBar : public CComponentsForm
}; };
CVolumeBar(/*int current_volume*/); CVolumeBar(/*int current_volume*/);
// ~CVolumeBar(); inherited from CComponentsForm //~CVolumeBar(); // inherited from CComponentsForm
void repaintVolScale(); void repaintVolScale();
void paint(const bool &do_save_bg = CC_SAVE_SCREEN_YES); void paint(const bool &do_save_bg = CC_SAVE_SCREEN_YES);
}; };
class CVolumeHelper class CVolumeHelper
{ {
private: private: