mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
Imageinfo: prepare functionality to show privacy policy
Note: Contents of policy files are not available with this commit. This should be done related to own conditions by provider himself. Providers are required by law to do this for their users as well. Files must be installed in: installdir = $(DATADIR)/neutrino/policy Providers should modify their buildsystem to install these files. Filename sheme is <locale>.policy. eg 'english.policy' If you want to add a policy file, take a look into sample file locale.policy.sample
This commit is contained in:
@@ -337,6 +337,7 @@ data/neutrino-scripts/Makefile
|
|||||||
data/pictures/Makefile
|
data/pictures/Makefile
|
||||||
data/pictures/backgrounds/Makefile
|
data/pictures/backgrounds/Makefile
|
||||||
data/pictures/screensaver/Makefile
|
data/pictures/screensaver/Makefile
|
||||||
|
data/policy/Makefile
|
||||||
data/scripts/Makefile
|
data/scripts/Makefile
|
||||||
data/themes/Makefile
|
data/themes/Makefile
|
||||||
data/themes/Grey-Blue/Makefile
|
data/themes/Grey-Blue/Makefile
|
||||||
|
@@ -8,6 +8,7 @@ SUBDIRS = \
|
|||||||
locale \
|
locale \
|
||||||
neutrino-scripts \
|
neutrino-scripts \
|
||||||
pictures \
|
pictures \
|
||||||
|
policy \
|
||||||
scripts \
|
scripts \
|
||||||
themes \
|
themes \
|
||||||
y-web
|
y-web
|
||||||
|
@@ -828,6 +828,7 @@ imageinfo.image Image:
|
|||||||
imageinfo.kernel Kernel:
|
imageinfo.kernel Kernel:
|
||||||
imageinfo.license Lizenz
|
imageinfo.license Lizenz
|
||||||
imageinfo.os System:
|
imageinfo.os System:
|
||||||
|
imageinfo.policy Datenschutz
|
||||||
imageinfo.vcs Git:
|
imageinfo.vcs Git:
|
||||||
imageinfo.version Version:
|
imageinfo.version Version:
|
||||||
imdb.api_key IMDb API Schlüssel
|
imdb.api_key IMDb API Schlüssel
|
||||||
|
@@ -827,6 +827,7 @@ imageinfo.image Image:
|
|||||||
imageinfo.kernel Kernel:
|
imageinfo.kernel Kernel:
|
||||||
imageinfo.license License
|
imageinfo.license License
|
||||||
imageinfo.os System:
|
imageinfo.os System:
|
||||||
|
imageinfo.policy Privacy Policy
|
||||||
imageinfo.vcs Git:
|
imageinfo.vcs Git:
|
||||||
imageinfo.version Version:
|
imageinfo.version Version:
|
||||||
imdb.api_key IMDb API-Key
|
imdb.api_key IMDb API-Key
|
||||||
|
4
data/policy/Makefile.am
Normal file
4
data/policy/Makefile.am
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
installdir = $(DATADIR)/neutrino/policy
|
||||||
|
|
||||||
|
install_DATA = \
|
||||||
|
locale.policy.sample
|
6
data/policy/locale.policy.sample
Normal file
6
data/policy/locale.policy.sample
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Please modify content of this file and rename sample file.
|
||||||
|
Filename sheme is <locale>.policy. eg 'english.policy'
|
||||||
|
|
||||||
|
Files must be installed in:
|
||||||
|
|
||||||
|
$(DATADIR)/neutrino/policy
|
@@ -41,6 +41,7 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include <gui/buildinfo.h>
|
#include <gui/buildinfo.h>
|
||||||
#define LICENSEDIR DATADIR "/neutrino/license/"
|
#define LICENSEDIR DATADIR "/neutrino/license/"
|
||||||
|
#define POLICY_DIR DATADIR "/neutrino/policy/"
|
||||||
#ifdef ENABLE_LUA
|
#ifdef ENABLE_LUA
|
||||||
#include <gui/lua/lua_api_version.h>
|
#include <gui/lua/lua_api_version.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -67,13 +68,15 @@ void CImageInfo::Init(void)
|
|||||||
cc_tv = NULL;
|
cc_tv = NULL;
|
||||||
cc_lic = NULL;
|
cc_lic = NULL;
|
||||||
cc_sub_caption = NULL;
|
cc_sub_caption = NULL;
|
||||||
b_info = NULL;
|
|
||||||
btn_red = NULL;
|
btn_red = NULL;
|
||||||
|
btn_green = NULL;
|
||||||
item_offset = OFFSET_INNER_MID;
|
item_offset = OFFSET_INNER_MID;
|
||||||
item_font = NULL;
|
item_font = NULL;
|
||||||
item_height = 0;
|
item_height = 0;
|
||||||
y_tmp = 0;
|
y_tmp = 0;
|
||||||
license_txt = "";
|
license_txt = "";
|
||||||
|
policy_txt = "";
|
||||||
|
InitBuildInfos();
|
||||||
v_info.clear();
|
v_info.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,9 +98,8 @@ void CImageInfo::Clean()
|
|||||||
cc_tv = NULL;
|
cc_tv = NULL;
|
||||||
cc_lic = NULL;
|
cc_lic = NULL;
|
||||||
cc_sub_caption = NULL;
|
cc_sub_caption = NULL;
|
||||||
delete b_info;
|
|
||||||
b_info = NULL;
|
|
||||||
btn_red = NULL;
|
btn_red = NULL;
|
||||||
|
btn_green = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +112,10 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &)
|
|||||||
//clean up before, because we could have a current instance with already initialized contents
|
//clean up before, because we could have a current instance with already initialized contents
|
||||||
Clean();
|
Clean();
|
||||||
|
|
||||||
|
//fill manifest texts
|
||||||
|
license_txt = getLicenseText();
|
||||||
|
policy_txt = getPolicyText();
|
||||||
|
|
||||||
//init window object, add cc-items and paint all
|
//init window object, add cc-items and paint all
|
||||||
ShowWindow();
|
ShowWindow();
|
||||||
bool fadeout = false;
|
bool fadeout = false;
|
||||||
@@ -134,39 +140,21 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &)
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg == CRCInput::RC_setup) {
|
if(msg == CRCInput::RC_setup) {
|
||||||
res = menu_return::RETURN_EXIT_ALL;
|
res = menu_return::RETURN_EXIT_ALL;
|
||||||
fadeout = true;
|
fadeout = true;
|
||||||
}
|
}
|
||||||
else if (msg == CRCInput::RC_red){
|
else if (msg == btn_red->getButtonDirectKey()/* CRCInput::RC_red*/){
|
||||||
// init temporarly vars
|
//toggle and assign caption and info contents
|
||||||
neutrino_locale_t info_cap , new_btn_cap;
|
if (btn_red->getCaptionLocale() == LOCALE_IMAGEINFO_LICENSE){
|
||||||
info_cap = new_btn_cap = NONEXISTANT_LOCALE;
|
cc_sub_caption->setText(LOCALE_IMAGEINFO_LICENSE, CTextBox::AUTO_WIDTH, item_font);
|
||||||
string info_txt = "";
|
InitInfoText(license_txt);
|
||||||
neutrino_locale_t btn_cap = btn_red->getCaptionLocale();
|
btn_red->setCaption(LOCALE_BUILDINFO_MENU);
|
||||||
|
}else{
|
||||||
//toggle caption and info contents
|
cc_sub_caption->setText(LOCALE_BUILDINFO_MENU, CTextBox::AUTO_WIDTH, item_font);
|
||||||
if (btn_cap == LOCALE_BUILDINFO_MENU){
|
InitInfoText(build_info_txt);
|
||||||
info_cap = LOCALE_BUILDINFO_MENU;
|
btn_red->setCaption(LOCALE_IMAGEINFO_LICENSE);
|
||||||
for (uint i=0; i<CBuildInfo::BI_TYPE_IDS; i++){
|
|
||||||
info_txt += g_Locale->getText(b_info->getInfo(i).caption);
|
|
||||||
info_txt += "\n";
|
|
||||||
info_txt += b_info->getInfo(i).info_text + "\n\n";
|
|
||||||
}
|
}
|
||||||
new_btn_cap = LOCALE_IMAGEINFO_LICENSE;
|
|
||||||
}
|
|
||||||
if (btn_cap == LOCALE_IMAGEINFO_LICENSE){
|
|
||||||
info_cap = LOCALE_IMAGEINFO_LICENSE;
|
|
||||||
info_txt = getLicenseText();
|
|
||||||
new_btn_cap = LOCALE_BUILDINFO_MENU;
|
|
||||||
}
|
|
||||||
|
|
||||||
//assign new caption and info contents
|
|
||||||
cc_sub_caption->setText(info_cap, CTextBox::AUTO_WIDTH, item_font);
|
|
||||||
InitInfoText(info_txt);
|
|
||||||
btn_red->setCaption(new_btn_cap);
|
|
||||||
|
|
||||||
//paint items
|
//paint items
|
||||||
cc_sub_caption->hide();
|
cc_sub_caption->hide();
|
||||||
cc_sub_caption->paint();
|
cc_sub_caption->paint();
|
||||||
@@ -174,6 +162,13 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &)
|
|||||||
btn_red->kill();
|
btn_red->kill();
|
||||||
btn_red->paint(false);
|
btn_red->paint(false);
|
||||||
}
|
}
|
||||||
|
else if (msg == btn_green->getButtonDirectKey()/* CRCInput::RC_green*/){
|
||||||
|
cc_sub_caption->setText(LOCALE_IMAGEINFO_POLICY, CTextBox::AUTO_WIDTH, item_font);
|
||||||
|
InitInfoText(policy_txt);
|
||||||
|
cc_sub_caption->hide();
|
||||||
|
cc_sub_caption->paint();
|
||||||
|
cc_lic->paint(false);
|
||||||
|
}
|
||||||
else if (CNeutrinoApp::getInstance()->listModeKey(msg)) {
|
else if (CNeutrinoApp::getInstance()->listModeKey(msg)) {
|
||||||
postmsg = msg;
|
postmsg = msg;
|
||||||
res = menu_return::RETURN_EXIT_ALL;
|
res = menu_return::RETURN_EXIT_ALL;
|
||||||
@@ -192,7 +187,6 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &)
|
|||||||
if ( msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout){
|
if ( msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout){
|
||||||
CNeutrinoApp::getInstance()->handleMsg( msg, data );
|
CNeutrinoApp::getInstance()->handleMsg( msg, data );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (postmsg)
|
if (postmsg)
|
||||||
@@ -210,12 +204,30 @@ void CImageInfo::ShowWindow()
|
|||||||
cc_win = new CComponentsWindowMax(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO, 0, CC_SHADOW_ON);
|
cc_win = new CComponentsWindowMax(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO, 0, CC_SHADOW_ON);
|
||||||
cc_win->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT);
|
cc_win->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT);
|
||||||
footer = cc_win->getFooterObject();
|
footer = cc_win->getFooterObject();
|
||||||
int h_footer = footer->getHeight();
|
|
||||||
fb_pixel_t btn_col = /*g_settings.theme.Button_gradient ? COL_BUTTON_BODY :*/ footer->getColorBody(); //TODO: Button_gradient option
|
button_label_cc btn;
|
||||||
btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, h_footer-h_footer/4, LOCALE_BUILDINFO_MENU, footer, false , true, false, footer->getColorBody(), btn_col);
|
vector<button_label_cc> v_buttons;
|
||||||
|
|
||||||
|
btn.button = NEUTRINO_ICON_BUTTON_RED;
|
||||||
|
btn.locale = LOCALE_BUILDINFO_MENU;
|
||||||
|
btn.directKeys.push_back(CRCInput::RC_red);
|
||||||
|
v_buttons.push_back(btn);
|
||||||
|
|
||||||
|
btn.button = !policy_txt.empty() ? NEUTRINO_ICON_BUTTON_GREEN : NEUTRINO_ICON_BUTTON_DUMMY;
|
||||||
|
btn.locale = LOCALE_IMAGEINFO_POLICY;
|
||||||
|
btn.directKeys.clear();
|
||||||
|
btn.directKeys.push_back(!policy_txt.empty() ? CRCInput::RC_green : RC_NOKEY);
|
||||||
|
v_buttons.push_back(btn);
|
||||||
|
|
||||||
|
footer->setButtonLabels(v_buttons, 0, footer->getWidth()/v_buttons.size());
|
||||||
|
|
||||||
|
btn_red = footer->getButtonLabel(0);
|
||||||
btn_red->doPaintBg(false);
|
btn_red->doPaintBg(false);
|
||||||
btn_red->setButtonTextColor(COL_MENUFOOT_TEXT);
|
btn_red->setButtonTextColor(COL_MENUFOOT_TEXT);
|
||||||
btn_red->setColBodyGradient(CC_COLGRAD_OFF);
|
btn_red->setColBodyGradient(CC_COLGRAD_OFF);
|
||||||
|
|
||||||
|
btn_green = footer->getButtonLabel(1);
|
||||||
|
// btn_green->allowPaint(!policy_txt.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
//prepare minitv
|
//prepare minitv
|
||||||
@@ -224,11 +236,8 @@ void CImageInfo::ShowWindow()
|
|||||||
//prepare infos
|
//prepare infos
|
||||||
InitInfos();
|
InitInfos();
|
||||||
|
|
||||||
//prepare build infos
|
|
||||||
InitBuildInfos();
|
|
||||||
|
|
||||||
//prepare info text
|
//prepare info text
|
||||||
InitInfoText(getLicenseText());
|
InitInfoText(license_txt);
|
||||||
|
|
||||||
//paint window
|
//paint window
|
||||||
cc_win->StartFadeIn();
|
cc_win->StartFadeIn();
|
||||||
@@ -260,8 +269,12 @@ void CImageInfo::InitMinitv()
|
|||||||
//prepare distribution infos
|
//prepare distribution infos
|
||||||
void CImageInfo::InitBuildInfos()
|
void CImageInfo::InitBuildInfos()
|
||||||
{
|
{
|
||||||
if (b_info == NULL)
|
CBuildInfo b_info;
|
||||||
b_info = new CBuildInfo();
|
for (uint i=0; i<CBuildInfo::BI_TYPE_IDS; i++){
|
||||||
|
build_info_txt += g_Locale->getText(b_info.getInfo(i).caption);
|
||||||
|
build_info_txt += "\n";
|
||||||
|
build_info_txt += b_info.getInfo(i).info_text + "\n\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//collect required data from environment
|
//collect required data from environment
|
||||||
@@ -416,25 +429,36 @@ void CImageInfo::InitInfos()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//get license
|
string CImageInfo::getManifest(const std::string& directory, const std::string& language, const std::string& manifest_type)
|
||||||
string CImageInfo::getLicenseText()
|
|
||||||
{
|
{
|
||||||
string file = LICENSEDIR;
|
string file = directory;
|
||||||
file += g_settings.language;
|
file += language;
|
||||||
file += ".license";
|
file += "." + manifest_type;
|
||||||
|
|
||||||
string res = CComponentsText::getTextFromFile(file);
|
string res = CComponentsText::getTextFromFile(file);
|
||||||
|
|
||||||
//assign default text, if language file is not available
|
//assign default text, if language file is not available
|
||||||
if(res.empty()){
|
if(res.empty()){
|
||||||
file = LICENSEDIR;
|
file = directory;
|
||||||
file += "english.license";
|
file += "english." + manifest_type;
|
||||||
res = CComponentsText::getTextFromFile(file);
|
res = CComponentsText::getTextFromFile(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//get license
|
||||||
|
string CImageInfo::getLicenseText()
|
||||||
|
{
|
||||||
|
return getManifest(LICENSEDIR, g_settings.language, "license");
|
||||||
|
}
|
||||||
|
|
||||||
|
//get policy
|
||||||
|
string CImageInfo::getPolicyText()
|
||||||
|
{
|
||||||
|
return getManifest(POLICY_DIR, g_settings.language, "policy");
|
||||||
|
}
|
||||||
|
|
||||||
//prepare info text
|
//prepare info text
|
||||||
void CImageInfo::InitInfoText(const std::string& text)
|
void CImageInfo::InitInfoText(const std::string& text)
|
||||||
{
|
{
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include <gui/widget/menue.h>
|
#include <gui/widget/menue.h>
|
||||||
#include <gui/components/cc.h>
|
#include <gui/components/cc.h>
|
||||||
#include <gui/buildinfo.h>
|
|
||||||
#include <configfile.h>
|
#include <configfile.h>
|
||||||
|
|
||||||
typedef struct image_info_t
|
typedef struct image_info_t
|
||||||
@@ -47,7 +46,7 @@ class CImageInfo : public CMenuTarget
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int item_offset; //distance between items and to boarder
|
int item_offset; //distance between items and to boarder
|
||||||
std::string license_txt;
|
std::string license_txt, policy_txt, build_info_txt;
|
||||||
Font* item_font;
|
Font* item_font;
|
||||||
int item_height;
|
int item_height;
|
||||||
int y_tmp;
|
int y_tmp;
|
||||||
@@ -61,6 +60,7 @@ class CImageInfo : public CMenuTarget
|
|||||||
void InitBuildInfos();
|
void InitBuildInfos();
|
||||||
void InitInfoText(const std::string& text);
|
void InitInfoText(const std::string& text);
|
||||||
std::string getLicenseText();
|
std::string getLicenseText();
|
||||||
|
std::string getPolicyText();
|
||||||
void ShowWindow();
|
void ShowWindow();
|
||||||
void ScrollLic(bool scrollDown);
|
void ScrollLic(bool scrollDown);
|
||||||
std::string getYWebVersion();
|
std::string getYWebVersion();
|
||||||
@@ -69,9 +69,8 @@ class CImageInfo : public CMenuTarget
|
|||||||
CComponentsForm *cc_info;
|
CComponentsForm *cc_info;
|
||||||
CComponentsPIP *cc_tv;
|
CComponentsPIP *cc_tv;
|
||||||
CComponentsInfoBox *cc_lic;
|
CComponentsInfoBox *cc_lic;
|
||||||
CBuildInfo *b_info;
|
|
||||||
CConfigFile config;
|
CConfigFile config;
|
||||||
CComponentsButtonRed *btn_red;
|
CComponentsButton *btn_red, *btn_green;
|
||||||
CComponentsLabel *cc_sub_caption;
|
CComponentsLabel *cc_sub_caption;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -81,6 +80,7 @@ class CImageInfo : public CMenuTarget
|
|||||||
|
|
||||||
void hide();
|
void hide();
|
||||||
int exec(CMenuTarget* parent, const std::string & actionKey);
|
int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||||
|
static std::string getManifest(const std::string& directory, const std::string& language, const std::string& manifest_type);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -855,6 +855,7 @@ typedef enum
|
|||||||
LOCALE_IMAGEINFO_KERNEL,
|
LOCALE_IMAGEINFO_KERNEL,
|
||||||
LOCALE_IMAGEINFO_LICENSE,
|
LOCALE_IMAGEINFO_LICENSE,
|
||||||
LOCALE_IMAGEINFO_OS,
|
LOCALE_IMAGEINFO_OS,
|
||||||
|
LOCALE_IMAGEINFO_POLICY,
|
||||||
LOCALE_IMAGEINFO_VCS,
|
LOCALE_IMAGEINFO_VCS,
|
||||||
LOCALE_IMAGEINFO_VERSION,
|
LOCALE_IMAGEINFO_VERSION,
|
||||||
LOCALE_IMDB_API_KEY,
|
LOCALE_IMDB_API_KEY,
|
||||||
|
@@ -855,6 +855,7 @@ const char * locale_real_names[] =
|
|||||||
"imageinfo.kernel",
|
"imageinfo.kernel",
|
||||||
"imageinfo.license",
|
"imageinfo.license",
|
||||||
"imageinfo.os",
|
"imageinfo.os",
|
||||||
|
"imageinfo.policy",
|
||||||
"imageinfo.vcs",
|
"imageinfo.vcs",
|
||||||
"imageinfo.version",
|
"imageinfo.version",
|
||||||
"imdb.api_key",
|
"imdb.api_key",
|
||||||
|
Reference in New Issue
Block a user