mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
CSignalBar/CSignalNoiseRatioBar: reduce code, clean ups
Some var inits can be reduced, because of inheritance.
This commit is contained in:
@@ -39,10 +39,11 @@ using namespace std;
|
||||
CSignalBar::CSignalBar()
|
||||
{
|
||||
initVarSigBar();
|
||||
sb_name = "SIG";
|
||||
initSBItems();
|
||||
}
|
||||
|
||||
CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref)
|
||||
CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const string& sbname)
|
||||
{
|
||||
initVarSigBar();
|
||||
sb_frontend = frontend_ref;
|
||||
@@ -50,6 +51,7 @@ CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int
|
||||
y = ypos;
|
||||
width = w;
|
||||
height = h;
|
||||
sb_name = sbname;
|
||||
|
||||
initSBItems();
|
||||
}
|
||||
@@ -115,7 +117,6 @@ void CSignalBar::initVarSigBar()
|
||||
sb_scale = NULL;
|
||||
sb_vlbl = NULL;
|
||||
sb_lbl = NULL;
|
||||
sb_name = "SIG";
|
||||
}
|
||||
|
||||
void CSignalBar::initSBarScale()
|
||||
@@ -245,36 +246,6 @@ void CSignalBar::paint(bool do_save_bg)
|
||||
|
||||
|
||||
//*******************************************************************************************************************************
|
||||
CSignalNoiseRatioBar::CSignalNoiseRatioBar()
|
||||
{
|
||||
initVarSnrBar();
|
||||
#if 0 // called from base (CSignalBar) ctor
|
||||
initSBItems();
|
||||
#endif
|
||||
}
|
||||
|
||||
CSignalNoiseRatioBar::CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref)
|
||||
{
|
||||
initVarSnrBar();
|
||||
sb_frontend = frontend_ref;
|
||||
x = xpos;
|
||||
y = ypos;
|
||||
width = w;
|
||||
height = h;
|
||||
|
||||
#if 0 // called from base (CSignalBar) ctor
|
||||
initSBItems();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSignalNoiseRatioBar::initVarSnrBar()
|
||||
{
|
||||
#if 0 // called from base (CSignalBar) ctor
|
||||
initVarSigBar();
|
||||
#endif
|
||||
sb_name = "SNR";
|
||||
}
|
||||
|
||||
void CSignalNoiseRatioBar::Refresh()
|
||||
{
|
||||
//get current value from frontend
|
||||
|
@@ -31,8 +31,7 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
// #include <global.h>
|
||||
// #include <neutrino.h>
|
||||
|
||||
#include <gui/components/cc_frm.h>
|
||||
#include <gui/components/cc_item_progressbar.h>
|
||||
#include <gui/components/cc_item_text.h>
|
||||
@@ -116,7 +115,7 @@ class CSignalBar : public CComponentsForm
|
||||
public:
|
||||
CSignalBar();
|
||||
///basic component class constructor for signal.
|
||||
CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref);
|
||||
CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& sb_name = "SIG");
|
||||
|
||||
///assigns the current used frontend, simplified a tuner object, see frontend_c.h
|
||||
virtual void setFrontEnd(CFrontend *frontend_ref){sb_frontend = frontend_ref;};
|
||||
@@ -155,14 +154,11 @@ class CSignalNoiseRatioBar : public CSignalBar
|
||||
///refresh current item properties, use this before paintScale().
|
||||
void Refresh();
|
||||
|
||||
protected:
|
||||
///initialize all needed basic attributes and objects
|
||||
void initVarSnrBar();
|
||||
|
||||
public:
|
||||
CSignalNoiseRatioBar();
|
||||
CSignalNoiseRatioBar(){};
|
||||
///basic component class constructor for signal noise ratio.
|
||||
CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref);
|
||||
CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref)
|
||||
: CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR"){};
|
||||
};
|
||||
|
||||
/// Class CSignalBox() provides CSignalBar(), CSignalNoiseRatioBar() scales at once.
|
||||
@@ -172,7 +168,7 @@ additional of CSignalBar()- and CSignalNoiseRatioBar()-objects.
|
||||
|
||||
|
||||
To add a signalbox object to your code add this to a header file:
|
||||
#include <gui/widget/signalbars.h>
|
||||
#include <gui/components/cc_frm_signalbars.h>
|
||||
|
||||
class CSampleClass
|
||||
{
|
||||
|
Reference in New Issue
Block a user