mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 15:02:56 +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/backgrounds/Makefile
|
||||
data/pictures/screensaver/Makefile
|
||||
data/policy/Makefile
|
||||
data/scripts/Makefile
|
||||
data/themes/Makefile
|
||||
data/themes/Grey-Blue/Makefile
|
||||
|
@@ -8,6 +8,7 @@ SUBDIRS = \
|
||||
locale \
|
||||
neutrino-scripts \
|
||||
pictures \
|
||||
policy \
|
||||
scripts \
|
||||
themes \
|
||||
y-web
|
||||
|
@@ -828,6 +828,7 @@ imageinfo.image Image:
|
||||
imageinfo.kernel Kernel:
|
||||
imageinfo.license Lizenz
|
||||
imageinfo.os System:
|
||||
imageinfo.policy Datenschutz
|
||||
imageinfo.vcs Git:
|
||||
imageinfo.version Version:
|
||||
imdb.api_key IMDb API Schlüssel
|
||||
|
@@ -827,6 +827,7 @@ imageinfo.image Image:
|
||||
imageinfo.kernel Kernel:
|
||||
imageinfo.license License
|
||||
imageinfo.os System:
|
||||
imageinfo.policy Privacy Policy
|
||||
imageinfo.vcs Git:
|
||||
imageinfo.version Version:
|
||||
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 <gui/buildinfo.h>
|
||||
#define LICENSEDIR DATADIR "/neutrino/license/"
|
||||
#define POLICY_DIR DATADIR "/neutrino/policy/"
|
||||
#ifdef ENABLE_LUA
|
||||
#include <gui/lua/lua_api_version.h>
|
||||
#endif
|
||||
@@ -67,13 +68,15 @@ void CImageInfo::Init(void)
|
||||
cc_tv = NULL;
|
||||
cc_lic = NULL;
|
||||
cc_sub_caption = NULL;
|
||||
b_info = NULL;
|
||||
btn_red = NULL;
|
||||
btn_green = NULL;
|
||||
item_offset = OFFSET_INNER_MID;
|
||||
item_font = NULL;
|
||||
item_height = 0;
|
||||
y_tmp = 0;
|
||||
license_txt = "";
|
||||
policy_txt = "";
|
||||
InitBuildInfos();
|
||||
v_info.clear();
|
||||
}
|
||||
|
||||
@@ -95,9 +98,8 @@ void CImageInfo::Clean()
|
||||
cc_tv = NULL;
|
||||
cc_lic = NULL;
|
||||
cc_sub_caption = NULL;
|
||||
delete b_info;
|
||||
b_info = 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();
|
||||
|
||||
//fill manifest texts
|
||||
license_txt = getLicenseText();
|
||||
policy_txt = getPolicyText();
|
||||
|
||||
//init window object, add cc-items and paint all
|
||||
ShowWindow();
|
||||
bool fadeout = false;
|
||||
@@ -134,39 +140,21 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &)
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if(msg == CRCInput::RC_setup) {
|
||||
res = menu_return::RETURN_EXIT_ALL;
|
||||
fadeout = true;
|
||||
}
|
||||
else if (msg == CRCInput::RC_red){
|
||||
// init temporarly vars
|
||||
neutrino_locale_t info_cap , new_btn_cap;
|
||||
info_cap = new_btn_cap = NONEXISTANT_LOCALE;
|
||||
string info_txt = "";
|
||||
neutrino_locale_t btn_cap = btn_red->getCaptionLocale();
|
||||
|
||||
//toggle caption and info contents
|
||||
if (btn_cap == LOCALE_BUILDINFO_MENU){
|
||||
info_cap = LOCALE_BUILDINFO_MENU;
|
||||
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";
|
||||
else if (msg == btn_red->getButtonDirectKey()/* CRCInput::RC_red*/){
|
||||
//toggle and assign caption and info contents
|
||||
if (btn_red->getCaptionLocale() == LOCALE_IMAGEINFO_LICENSE){
|
||||
cc_sub_caption->setText(LOCALE_IMAGEINFO_LICENSE, CTextBox::AUTO_WIDTH, item_font);
|
||||
InitInfoText(license_txt);
|
||||
btn_red->setCaption(LOCALE_BUILDINFO_MENU);
|
||||
}else{
|
||||
cc_sub_caption->setText(LOCALE_BUILDINFO_MENU, CTextBox::AUTO_WIDTH, item_font);
|
||||
InitInfoText(build_info_txt);
|
||||
btn_red->setCaption(LOCALE_IMAGEINFO_LICENSE);
|
||||
}
|
||||
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
|
||||
cc_sub_caption->hide();
|
||||
cc_sub_caption->paint();
|
||||
@@ -174,6 +162,13 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &)
|
||||
btn_red->kill();
|
||||
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)) {
|
||||
postmsg = msg;
|
||||
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){
|
||||
CNeutrinoApp::getInstance()->handleMsg( msg, data );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT);
|
||||
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
|
||||
btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, h_footer-h_footer/4, LOCALE_BUILDINFO_MENU, footer, false , true, false, footer->getColorBody(), btn_col);
|
||||
|
||||
button_label_cc btn;
|
||||
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->setButtonTextColor(COL_MENUFOOT_TEXT);
|
||||
btn_red->setColBodyGradient(CC_COLGRAD_OFF);
|
||||
|
||||
btn_green = footer->getButtonLabel(1);
|
||||
// btn_green->allowPaint(!policy_txt.empty());
|
||||
}
|
||||
|
||||
//prepare minitv
|
||||
@@ -224,11 +236,8 @@ void CImageInfo::ShowWindow()
|
||||
//prepare infos
|
||||
InitInfos();
|
||||
|
||||
//prepare build infos
|
||||
InitBuildInfos();
|
||||
|
||||
//prepare info text
|
||||
InitInfoText(getLicenseText());
|
||||
InitInfoText(license_txt);
|
||||
|
||||
//paint window
|
||||
cc_win->StartFadeIn();
|
||||
@@ -260,8 +269,12 @@ void CImageInfo::InitMinitv()
|
||||
//prepare distribution infos
|
||||
void CImageInfo::InitBuildInfos()
|
||||
{
|
||||
if (b_info == NULL)
|
||||
b_info = new CBuildInfo();
|
||||
CBuildInfo b_info;
|
||||
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
|
||||
@@ -416,25 +429,36 @@ void CImageInfo::InitInfos()
|
||||
}
|
||||
}
|
||||
|
||||
//get license
|
||||
string CImageInfo::getLicenseText()
|
||||
string CImageInfo::getManifest(const std::string& directory, const std::string& language, const std::string& manifest_type)
|
||||
{
|
||||
string file = LICENSEDIR;
|
||||
file += g_settings.language;
|
||||
file += ".license";
|
||||
string file = directory;
|
||||
file += language;
|
||||
file += "." + manifest_type;
|
||||
|
||||
string res = CComponentsText::getTextFromFile(file);
|
||||
|
||||
//assign default text, if language file is not available
|
||||
if(res.empty()){
|
||||
file = LICENSEDIR;
|
||||
file += "english.license";
|
||||
file = directory;
|
||||
file += "english." + manifest_type;
|
||||
res = CComponentsText::getTextFromFile(file);
|
||||
}
|
||||
|
||||
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
|
||||
void CImageInfo::InitInfoText(const std::string& text)
|
||||
{
|
||||
|
@@ -33,7 +33,6 @@
|
||||
|
||||
#include <gui/widget/menue.h>
|
||||
#include <gui/components/cc.h>
|
||||
#include <gui/buildinfo.h>
|
||||
#include <configfile.h>
|
||||
|
||||
typedef struct image_info_t
|
||||
@@ -47,7 +46,7 @@ class CImageInfo : public CMenuTarget
|
||||
{
|
||||
private:
|
||||
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;
|
||||
int item_height;
|
||||
int y_tmp;
|
||||
@@ -61,6 +60,7 @@ class CImageInfo : public CMenuTarget
|
||||
void InitBuildInfos();
|
||||
void InitInfoText(const std::string& text);
|
||||
std::string getLicenseText();
|
||||
std::string getPolicyText();
|
||||
void ShowWindow();
|
||||
void ScrollLic(bool scrollDown);
|
||||
std::string getYWebVersion();
|
||||
@@ -69,9 +69,8 @@ class CImageInfo : public CMenuTarget
|
||||
CComponentsForm *cc_info;
|
||||
CComponentsPIP *cc_tv;
|
||||
CComponentsInfoBox *cc_lic;
|
||||
CBuildInfo *b_info;
|
||||
CConfigFile config;
|
||||
CComponentsButtonRed *btn_red;
|
||||
CComponentsButton *btn_red, *btn_green;
|
||||
CComponentsLabel *cc_sub_caption;
|
||||
|
||||
public:
|
||||
@@ -81,6 +80,7 @@ class CImageInfo : public CMenuTarget
|
||||
|
||||
void hide();
|
||||
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
|
||||
|
@@ -855,6 +855,7 @@ typedef enum
|
||||
LOCALE_IMAGEINFO_KERNEL,
|
||||
LOCALE_IMAGEINFO_LICENSE,
|
||||
LOCALE_IMAGEINFO_OS,
|
||||
LOCALE_IMAGEINFO_POLICY,
|
||||
LOCALE_IMAGEINFO_VCS,
|
||||
LOCALE_IMAGEINFO_VERSION,
|
||||
LOCALE_IMDB_API_KEY,
|
||||
|
@@ -855,6 +855,7 @@ const char * locale_real_names[] =
|
||||
"imageinfo.kernel",
|
||||
"imageinfo.license",
|
||||
"imageinfo.os",
|
||||
"imageinfo.policy",
|
||||
"imageinfo.vcs",
|
||||
"imageinfo.version",
|
||||
"imdb.api_key",
|
||||
|
Reference in New Issue
Block a user