mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 07:51:11 +02:00
epg_banner: outsource class for rate banners
For global use.
Origin commit data
------------------
Branch: ni/coolstream
Commit: 7e7ddaa0f3
Author: Thilo Graf <dbt@novatux.de>
Date: 2020-03-03 (Tue, 03 Mar 2020)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -91,6 +91,7 @@ libneutrino_gui_a_SOURCES = \
|
|||||||
plugins_hide.cpp \
|
plugins_hide.cpp \
|
||||||
proxyserver_setup.cpp \
|
proxyserver_setup.cpp \
|
||||||
radiotext_window.cpp \
|
radiotext_window.cpp \
|
||||||
|
rate_banner.cpp \
|
||||||
rc_lock.cpp \
|
rc_lock.cpp \
|
||||||
record_setup.cpp \
|
record_setup.cpp \
|
||||||
scan.cpp \
|
scan.cpp \
|
||||||
|
@@ -26,9 +26,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <gui/adzap.h>
|
#include <unistd.h>
|
||||||
#include <gui/epgview.h>
|
#include "adzap.h"
|
||||||
#include <gui/eventlist.h>
|
#include "epgview.h"
|
||||||
|
#include "eventlist.h"
|
||||||
|
#include "rate_banner.h"
|
||||||
|
|
||||||
#include <gui/widget/buttons.h>
|
#include <gui/widget/buttons.h>
|
||||||
#include <gui/widget/hintbox.h>
|
#include <gui/widget/hintbox.h>
|
||||||
@@ -36,7 +38,7 @@
|
|||||||
#include <gui/widget/msgbox.h>
|
#include <gui/widget/msgbox.h>
|
||||||
#include <gui/widget/mountchooser.h>
|
#include <gui/widget/mountchooser.h>
|
||||||
|
|
||||||
#include <gui/timerlist.h>
|
#include "timerlist.h"
|
||||||
#include <zapit/zapit.h>
|
#include <zapit/zapit.h>
|
||||||
#include <system/helpers.h>
|
#include <system/helpers.h>
|
||||||
|
|
||||||
|
@@ -40,12 +40,12 @@
|
|||||||
#include <driver/movieinfo.h>
|
#include <driver/movieinfo.h>
|
||||||
#include "widget/menue.h"
|
#include "widget/menue.h"
|
||||||
#include "widget/navibar.h"
|
#include "widget/navibar.h"
|
||||||
#include "gui/components/cc.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class CFrameBuffer;
|
class CFrameBuffer;
|
||||||
//class CEPGRateBanner;
|
|
||||||
class CEpgData
|
class CEpgData
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -128,41 +128,4 @@ class CEPGDataHandler : public CMenuTarget
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
#endif //__epgview__
|
||||||
class CEPGRateBanner : public CComponentsIconForm
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
void init(const std::string& quote_icon, const std::string& quote_icon_bg, const size_t& quote, const size_t& quote_max, const std::string& provider_logo)
|
|
||||||
{
|
|
||||||
cc_item_type.name = "epg_rate_banner";
|
|
||||||
append_x_offset = 5;
|
|
||||||
paint_bg = false;
|
|
||||||
addIcons(provider_logo);
|
|
||||||
addIcons(quote_icon, quote);
|
|
||||||
addIcons(quote_icon_bg, quote_max - quote);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
CEPGRateBanner( const int &x_pos,
|
|
||||||
const int &y_pos,
|
|
||||||
const size_t& quote,
|
|
||||||
const size_t& quote_max = 10,
|
|
||||||
const std::string& provider_logo = "",
|
|
||||||
const std::string& quote_icon = NEUTRINO_ICON_STAR_ON,
|
|
||||||
const std::string& quote_icon_bg = NEUTRINO_ICON_STAR_OFF,
|
|
||||||
int shadow_mode = CC_SHADOW_OFF,
|
|
||||||
fb_pixel_t color_frame = COL_FRAME_PLUS_0,
|
|
||||||
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,
|
|
||||||
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0,
|
|
||||||
CComponentsForm *parent = NULL)
|
|
||||||
:CComponentsIconForm(x_pos, y_pos, 0, 0, std::vector<std::string>(), parent, shadow_mode, color_frame, color_body, color_shadow)
|
|
||||||
{
|
|
||||||
init(quote_icon, quote_icon_bg, quote, quote_max, provider_logo);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
86
src/gui/rate_banner.cpp
Normal file
86
src/gui/rate_banner.cpp
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
Based up Neutrino-GUI - Tuxbox-Project
|
||||||
|
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||||
|
|
||||||
|
Class for rate banner.
|
||||||
|
Copyright (C) 2020, Thilo Graf 'dbt'
|
||||||
|
|
||||||
|
License: GPL
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "rate_banner.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
CRateBanner::CRateBanner( const int &x_pos,
|
||||||
|
const int &y_pos,
|
||||||
|
const float& quote,
|
||||||
|
const float& quote_max,
|
||||||
|
const std::string& provider_logo,
|
||||||
|
const std::string& quote_icon,
|
||||||
|
const std::string& quote_icon_bg,
|
||||||
|
int shadow_mode,
|
||||||
|
fb_pixel_t color_frame,
|
||||||
|
fb_pixel_t color_body,
|
||||||
|
fb_pixel_t color_shadow,
|
||||||
|
CComponentsForm *parent)
|
||||||
|
:CComponentsIconForm(x_pos, y_pos, 0, 0, std::vector<std::string>(), parent, shadow_mode, color_frame, color_body, color_shadow)
|
||||||
|
{
|
||||||
|
init(quote_icon, quote_icon_bg, quote, quote_max, provider_logo);
|
||||||
|
}
|
||||||
|
|
||||||
|
CRateBanner::~CRateBanner()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRateBanner::init(const std::string& quote_icon, const std::string& quote_icon_bg, const float& quote, const float& quote_max, const std::string& provider_logo)
|
||||||
|
{
|
||||||
|
cc_item_type.name = "rate_banner";
|
||||||
|
append_x_offset = OFFSET_INNER_SMALL;
|
||||||
|
paint_bg = false;
|
||||||
|
rat_prov_logo = provider_logo;
|
||||||
|
rat_icon = quote_icon;
|
||||||
|
rat_icon_bg = quote_icon_bg;
|
||||||
|
rate = quote;
|
||||||
|
rat_max = quote_max;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRateBanner::paint(const bool &do_save_bg)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
addIcon(rat_prov_logo);
|
||||||
|
addIcons(rat_icon, rat_max);
|
||||||
|
paintForm(do_save_bg);
|
||||||
|
|
||||||
|
int x_base = getCCItem(rat_icon)->getRealXPos();
|
||||||
|
float w_rate_space = static_cast<float>(width - (getCCItem(rat_prov_logo) ? getCCItem(rat_prov_logo)->getWidth() - append_x_offset : 0));
|
||||||
|
float w_rate_size = w_rate_space / rat_max * rate;
|
||||||
|
int w_tmp = static_cast<int>(round(w_rate_size)) - append_x_offset;
|
||||||
|
fb_pixel_t* pixbuf = getScreen(x_base, y, w_tmp, height);
|
||||||
|
|
||||||
|
removeAllIcons();
|
||||||
|
addIcon(rat_prov_logo);
|
||||||
|
addIcons(rat_icon_bg, rat_max);
|
||||||
|
|
||||||
|
paintCCItems();
|
||||||
|
frameBuffer->RestoreScreen(x_base, y, w_tmp, height, pixbuf);
|
||||||
|
delete[] pixbuf;
|
||||||
|
pixbuf = NULL;
|
||||||
|
}
|
65
src/gui/rate_banner.h
Normal file
65
src/gui/rate_banner.h
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
Based up Neutrino-GUI - Tuxbox-Project
|
||||||
|
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||||
|
|
||||||
|
Class for rate banner.
|
||||||
|
Copyright (C) 2020, Thilo Graf 'dbt'
|
||||||
|
|
||||||
|
License: GPL
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __RATE_BANNER_H__
|
||||||
|
#define __RATE_BANNER_H__
|
||||||
|
|
||||||
|
|
||||||
|
#include "components/cc.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
class CRateBanner : public CComponentsIconForm
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::string rat_icon, rat_icon_bg, rat_prov_logo;
|
||||||
|
float rate, rat_max;
|
||||||
|
|
||||||
|
void init( const std::string& quote_icon,
|
||||||
|
const std::string& quote_icon_bg,
|
||||||
|
const float& quote,
|
||||||
|
const float& quote_max,
|
||||||
|
const std::string& provider_logo);
|
||||||
|
|
||||||
|
public:
|
||||||
|
CRateBanner( const int &x_pos,
|
||||||
|
const int &y_pos,
|
||||||
|
const float& quote,
|
||||||
|
const float& quote_max = 10,
|
||||||
|
const std::string& provider_logo = "",
|
||||||
|
const std::string& quote_icon = NEUTRINO_ICON_STAR_ON,
|
||||||
|
const std::string& quote_icon_bg = NEUTRINO_ICON_STAR_OFF,
|
||||||
|
int shadow_mode = CC_SHADOW_OFF,
|
||||||
|
fb_pixel_t color_frame = COL_FRAME_PLUS_0,
|
||||||
|
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,
|
||||||
|
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0,
|
||||||
|
CComponentsForm *parent = NULL);
|
||||||
|
|
||||||
|
virtual ~CRateBanner();
|
||||||
|
|
||||||
|
void paint(const bool &do_save_bg = CC_SAVE_SCREEN_YES);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //__RATE_BANNER_H__
|
Reference in New Issue
Block a user