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()
|
CSignalBar::CSignalBar()
|
||||||
{
|
{
|
||||||
initVarSigBar();
|
initVarSigBar();
|
||||||
|
sb_name = "SIG";
|
||||||
initSBItems();
|
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();
|
initVarSigBar();
|
||||||
sb_frontend = frontend_ref;
|
sb_frontend = frontend_ref;
|
||||||
@@ -50,6 +51,7 @@ CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int
|
|||||||
y = ypos;
|
y = ypos;
|
||||||
width = w;
|
width = w;
|
||||||
height = h;
|
height = h;
|
||||||
|
sb_name = sbname;
|
||||||
|
|
||||||
initSBItems();
|
initSBItems();
|
||||||
}
|
}
|
||||||
@@ -115,7 +117,6 @@ void CSignalBar::initVarSigBar()
|
|||||||
sb_scale = NULL;
|
sb_scale = NULL;
|
||||||
sb_vlbl = NULL;
|
sb_vlbl = NULL;
|
||||||
sb_lbl = NULL;
|
sb_lbl = NULL;
|
||||||
sb_name = "SIG";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSignalBar::initSBarScale()
|
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()
|
void CSignalNoiseRatioBar::Refresh()
|
||||||
{
|
{
|
||||||
//get current value from frontend
|
//get current value from frontend
|
||||||
|
@@ -31,8 +31,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// #include <global.h>
|
|
||||||
// #include <neutrino.h>
|
|
||||||
#include <gui/components/cc_frm.h>
|
#include <gui/components/cc_frm.h>
|
||||||
#include <gui/components/cc_item_progressbar.h>
|
#include <gui/components/cc_item_progressbar.h>
|
||||||
#include <gui/components/cc_item_text.h>
|
#include <gui/components/cc_item_text.h>
|
||||||
@@ -116,7 +115,7 @@ class CSignalBar : public CComponentsForm
|
|||||||
public:
|
public:
|
||||||
CSignalBar();
|
CSignalBar();
|
||||||
///basic component class constructor for signal.
|
///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
|
///assigns the current used frontend, simplified a tuner object, see frontend_c.h
|
||||||
virtual void setFrontEnd(CFrontend *frontend_ref){sb_frontend = frontend_ref;};
|
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().
|
///refresh current item properties, use this before paintScale().
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
protected:
|
|
||||||
///initialize all needed basic attributes and objects
|
|
||||||
void initVarSnrBar();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSignalNoiseRatioBar();
|
CSignalNoiseRatioBar(){};
|
||||||
///basic component class constructor for signal noise ratio.
|
///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.
|
/// 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:
|
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
|
class CSampleClass
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user