mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
gui/components: CSignalBox: allow for horizontal arrangement; add methods to retrieve current value
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -257,9 +257,10 @@ void CSignalNoiseRatioBar::Refresh()
|
|||||||
|
|
||||||
|
|
||||||
//**********************************************************************************************************************
|
//**********************************************************************************************************************
|
||||||
CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref)
|
CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const bool vert)
|
||||||
{
|
{
|
||||||
initVarSigBox();
|
initVarSigBox();
|
||||||
|
vertical = vert;
|
||||||
|
|
||||||
sbx_frontend = frontend_ref;
|
sbx_frontend = frontend_ref;
|
||||||
x = xpos;
|
x = xpos;
|
||||||
@@ -267,14 +268,19 @@ CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int
|
|||||||
width = w;
|
width = w;
|
||||||
height = h;
|
height = h;
|
||||||
|
|
||||||
|
if (vertical) {
|
||||||
sbx_bar_height = height/2;
|
sbx_bar_height = height/2;
|
||||||
sbx_bar_width = width-2*corner_rad;
|
sbx_bar_width = width-2*corner_rad;
|
||||||
|
} else {
|
||||||
|
sbx_bar_height = height;
|
||||||
|
sbx_bar_width = width/2-2*corner_rad;
|
||||||
|
}
|
||||||
|
|
||||||
sbar = new CSignalBar(sbx_bar_x, 0, sbx_bar_width, sbx_bar_height, sbx_frontend);
|
sbar = new CSignalBar(sbx_bar_x, 0, sbx_bar_width, sbx_bar_height, sbx_frontend);
|
||||||
sbar->doPaintBg(false);
|
sbar->doPaintBg(false);
|
||||||
addCCItem(sbar);
|
addCCItem(sbar);
|
||||||
|
|
||||||
snrbar = new CSignalNoiseRatioBar(sbx_bar_x, CC_APPEND, sbx_bar_width, sbx_bar_height, sbx_frontend);
|
snrbar = new CSignalNoiseRatioBar(vertical ? sbx_bar_x : CC_APPEND, vertical ? CC_APPEND : 0, sbx_bar_width, sbx_bar_height, sbx_frontend);
|
||||||
snrbar->doPaintBg(false);
|
snrbar->doPaintBg(false);
|
||||||
addCCItem(snrbar);
|
addCCItem(snrbar);
|
||||||
|
|
||||||
@@ -293,6 +299,7 @@ void CSignalBox::initVarSigBox()
|
|||||||
sbx_bar_x = corner_rad;
|
sbx_bar_x = corner_rad;
|
||||||
sbx_caption_color = COL_INFOBAR_TEXT;
|
sbx_caption_color = COL_INFOBAR_TEXT;
|
||||||
sbx_scale_w_percent = 60;
|
sbx_scale_w_percent = 60;
|
||||||
|
vertical = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSignalBox::initSignalItems()
|
void CSignalBox::initSignalItems()
|
||||||
@@ -314,7 +321,7 @@ void CSignalBox::initSignalItems()
|
|||||||
sbar->setScaleHeight(scale_h);
|
sbar->setScaleHeight(scale_h);
|
||||||
sbar->setScaleWidth(sbx_scale_w_percent);
|
sbar->setScaleWidth(sbx_scale_w_percent);
|
||||||
|
|
||||||
snrbar->setDimensionsAll(sbar_x, CC_APPEND, sbar_w, sbar_h);
|
snrbar->setDimensionsAll(vertical ? sbar_x : CC_APPEND, vertical ? CC_APPEND : fr_thickness, sbar_w, sbar_h);
|
||||||
snrbar->setFrontEnd(sbx_frontend);
|
snrbar->setFrontEnd(sbx_frontend);
|
||||||
snrbar->setCorner(0);
|
snrbar->setCorner(0);
|
||||||
snrbar->setScaleHeight(scale_h);
|
snrbar->setScaleHeight(scale_h);
|
||||||
|
@@ -139,6 +139,9 @@ class CSignalBar : public CComponentsForm
|
|||||||
|
|
||||||
///paint this items
|
///paint this items
|
||||||
virtual void paint(bool do_save_bg);
|
virtual void paint(bool do_save_bg);
|
||||||
|
|
||||||
|
//returns the current signal value
|
||||||
|
uint16_t getValue(void) { return sb_signal; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Sub class of CSignalBar()
|
/// Sub class of CSignalBar()
|
||||||
@@ -256,6 +259,9 @@ class CSignalBox : public CComponentsForm
|
|||||||
///allowed width of scale bar from full width in %, rest used by caption, default value = 60% of width, use setScaleWidth() to set this value
|
///allowed width of scale bar from full width in %, rest used by caption, default value = 60% of width, use setScaleWidth() to set this value
|
||||||
short sbx_scale_w_percent;
|
short sbx_scale_w_percent;
|
||||||
|
|
||||||
|
// true if vertical arrangement, false if horizontal
|
||||||
|
bool vertical;
|
||||||
|
|
||||||
///initialize all needed basic attributes and objects
|
///initialize all needed basic attributes and objects
|
||||||
void initVarSigBox();
|
void initVarSigBox();
|
||||||
///initialize general properties of signal items
|
///initialize general properties of signal items
|
||||||
@@ -266,7 +272,7 @@ class CSignalBox : public CComponentsForm
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
///class constructor for signal noise ratio.
|
///class constructor for signal noise ratio.
|
||||||
CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref);
|
CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const bool vertical = true);
|
||||||
|
|
||||||
///returns the signal object, type = CSignalBar*
|
///returns the signal object, type = CSignalBar*
|
||||||
CSignalBar* getScaleObject(){return sbar;};
|
CSignalBar* getScaleObject(){return sbar;};
|
||||||
@@ -283,6 +289,14 @@ class CSignalBox : public CComponentsForm
|
|||||||
|
|
||||||
///paint items
|
///paint items
|
||||||
void paint(bool do_save_bg);
|
void paint(bool do_save_bg);
|
||||||
|
|
||||||
|
///return current signal value
|
||||||
|
uint16_t getSignalValue(void) { return sbar->getValue();}
|
||||||
|
|
||||||
|
///return current snr value
|
||||||
|
uint16_t getSNRValue(void) { return snrbar->getValue();}
|
||||||
|
|
||||||
|
///return current snr value
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user