mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-03 10:51:05 +02:00
Conflicts:
configure.ac
data/icons/buttons/0.png
data/icons/buttons/1.png
data/icons/buttons/2.png
data/icons/buttons/3.png
data/icons/buttons/4.png
data/icons/buttons/5.png
data/icons/buttons/6.png
data/icons/buttons/7.png
data/icons/buttons/8.png
data/icons/buttons/9.png
data/icons/buttons/blau.png
data/icons/buttons/btn_backward.png
data/icons/buttons/btn_forward.png
data/icons/buttons/btn_pause.png
data/icons/buttons/btn_play.png
data/icons/buttons/btn_record_active.png
data/icons/buttons/btn_record_inactive.png
data/icons/buttons/btn_stop.png
data/icons/buttons/down.png
data/icons/buttons/gelb.png
data/icons/buttons/gruen.png
data/icons/buttons/help.png
data/icons/buttons/help_small.png
data/icons/buttons/home.png
data/icons/buttons/info.png
data/icons/buttons/info_small.png
data/icons/buttons/left.png
data/icons/buttons/menu.png
data/icons/buttons/menu_small.png
data/icons/buttons/mute_small.png
data/icons/buttons/mute_zap_gray.png
data/icons/buttons/mute_zap_green.png
data/icons/buttons/ok.png
data/icons/buttons/power.png
data/icons/buttons/right.png
data/icons/buttons/rot.png
data/icons/buttons/up.png
data/icons/filetypes/movie.png
data/icons/filetypes/mp3.png
data/icons/headers/audio.png
data/icons/headers/bookmarkmanager.png
data/icons/headers/colors.png
data/icons/headers/error.png
data/icons/headers/features.png
data/icons/headers/games.png
data/icons/headers/icon_blue.png
data/icons/headers/icon_green.png
data/icons/headers/icon_red.png
data/icons/headers/icon_yellow.png
data/icons/headers/information.png
data/icons/headers/keybinding.png
data/icons/headers/language.png
data/icons/headers/lcd.png
data/icons/headers/mainmenue.png
data/icons/headers/multimedia.png
data/icons/headers/network.png
data/icons/headers/personalize.png
data/icons/headers/shell.png
data/icons/headers/softupdate.png
data/icons/headers/streaming.png
data/icons/headers/timer.png
data/icons/headers/upnp.png
data/icons/headers/video.png
data/icons/movieplayer/mp_b-skip.png
data/icons/movieplayer/mp_f-skip.png
data/icons/movieplayer/mp_pause.png
data/icons/movieplayer/mp_play.png
data/icons/movieplayer/mp_play_repeat_all.png
data/icons/movieplayer/mp_play_repeat_track.png
data/icons/status/ca/biss_green.png
data/icons/status/ca/biss_white.png
data/icons/status/ca/biss_yellow.png
data/icons/status/ca/conax_green.png
data/icons/status/ca/conax_white.png
data/icons/status/ca/conax_yellow.png
data/icons/status/ca/cw_green.png
data/icons/status/ca/cw_white.png
data/icons/status/ca/cw_yellow.png
data/icons/status/ca/d_green.png
data/icons/status/ca/d_white.png
data/icons/status/ca/d_yellow.png
data/icons/status/ca/ird_green.png
data/icons/status/ca/ird_white.png
data/icons/status/ca/ird_yellow.png
data/icons/status/ca/nagra_green.png
data/icons/status/ca/nagra_white.png
data/icons/status/ca/nagra_yellow.png
data/icons/status/ca/nds_green.png
data/icons/status/ca/nds_white.png
data/icons/status/ca/nds_yellow.png
data/icons/status/ca/powervu_green.png
data/icons/status/ca/powervu_white.png
data/icons/status/ca/powervu_yellow.png
data/icons/status/ca/seca_green.png
data/icons/status/ca/seca_white.png
data/icons/status/ca/seca_yellow.png
data/icons/status/ca/via_green.png
data/icons/status/ca/via_white.png
data/icons/status/ca/via_yellow.png
data/icons/status/ca/x_green.png
data/icons/status/ca/x_white.png
data/icons/status/ca/x_yellow.png
data/icons/status/channel/16_9.png
data/icons/status/channel/16_9_gray.png
data/icons/status/channel/ca2.png
data/icons/status/channel/ca2_gray.png
data/icons/status/channel/dd.png
data/icons/status/channel/dd_avail.png
data/icons/status/channel/dd_gray.png
data/icons/status/channel/radiotextget.png
data/icons/status/channel/radiotextoff.png
data/icons/status/channel/radiotextwait.png
data/icons/status/channel/res_000.png
data/icons/status/channel/res_1080.png
data/icons/status/channel/res_1280.png
data/icons/status/channel/res_1440.png
data/icons/status/channel/res_1920.png
data/icons/status/channel/res_288.png
data/icons/status/channel/res_352.png
data/icons/status/channel/res_382.png
data/icons/status/channel/res_480.png
data/icons/status/channel/res_528.png
data/icons/status/channel/res_544.png
data/icons/status/channel/res_576.png
data/icons/status/channel/res_704.png
data/icons/status/channel/res_720.png
data/icons/status/channel/res_hd.png
data/icons/status/channel/res_sd.png
data/icons/status/channel/subt.png
data/icons/status/channel/subt_gray.png
data/icons/status/channel/tuner_1.png
data/icons/status/channel/tuner_2.png
data/icons/status/channel/tuner_3.png
data/icons/status/channel/tuner_4.png
data/icons/status/channel/vtxt.png
data/icons/status/channel/vtxt_gray.png
data/icons/status/various/ats.png
data/icons/status/various/ats_gray.png
data/icons/status/various/ca.png
data/icons/status/various/lock.png
data/icons/status/various/mounted.png
data/icons/status/various/mute.png
data/icons/status/various/not_mounted.png
data/icons/status/various/pip.png
data/icons/status/various/rec_event_marker.png
data/icons/status/various/rec_gray.png
data/icons/status/various/zap.png
data/locale/Makefile.am
data/locale/english.locale
data/pictures/backgrounds/1280x720/start.jpg
src/driver/fb_accel_sti.cpp
src/gui/Makefile.am
src/gui/dboxinfo.cpp
src/gui/infoviewer_bb.cpp
src/gui/movieplayer.cpp
src/gui/osd_setup.cpp
src/gui/streaminfo2.cpp
src/gui/themes.cpp
src/neutrino.cpp
src/system/flashtool.cpp
src/system/settings.cpp
src/system/settings.h
Origin commit data
------------------
Commit: 4121099dcf
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-10-18 (Wed, 18 Oct 2017)
492 lines
21 KiB
C++
492 lines
21 KiB
C++
/*
|
|
$port: themes.cpp,v 1.16 2010/09/05 21:27:44 tuxbox-cvs Exp $
|
|
|
|
Neutrino-GUI - DBoxII-Project
|
|
|
|
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, write to the Free Software
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
Copyright (C) 2007, 2008, 2009 (flasher) Frank Liebelt
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include <config.h>
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <dirent.h>
|
|
#include <errno.h>
|
|
#include <sys/wait.h>
|
|
#include <global.h>
|
|
#include <neutrino.h>
|
|
#include "widget/menue.h"
|
|
#include <system/helpers.h>
|
|
#include <system/setting_helpers.h>
|
|
#include <gui/widget/stringinput.h>
|
|
#include <gui/widget/stringinput_ext.h>
|
|
#include <gui/widget/keyboard_input.h>
|
|
#include <gui/widget/msgbox.h>
|
|
#include <driver/screen_max.h>
|
|
|
|
#include <sys/stat.h>
|
|
#include <sys/time.h>
|
|
|
|
#include "themes.h"
|
|
|
|
#define USERDIR "/var" THEMESDIR
|
|
#define FILE_PREFIX ".theme"
|
|
static SNeutrinoTheme &t = g_settings.theme;
|
|
CThemes::CThemes()
|
|
: themefile('\t')
|
|
{
|
|
width = 40;
|
|
notifier = NULL;
|
|
hasThemeChanged = false;
|
|
}
|
|
|
|
int CThemes::exec(CMenuTarget* parent, const std::string & actionKey)
|
|
{
|
|
int res = menu_return::RETURN_REPAINT;
|
|
|
|
if( !actionKey.empty() )
|
|
{
|
|
if (actionKey=="theme_neutrino")
|
|
{
|
|
setupDefaultColors();
|
|
notifier = new CColorSetupNotifier();
|
|
notifier->changeNotify(NONEXISTANT_LOCALE, NULL);
|
|
delete notifier;
|
|
}
|
|
else
|
|
{
|
|
std::string themeFile = actionKey;
|
|
if ( strstr(themeFile.c_str(), "{U}") != 0 )
|
|
{
|
|
themeFile.erase(0, 3);
|
|
readFile(((std::string)THEMESDIR_VAR + "/" + themeFile + FILE_PREFIX).c_str());
|
|
}
|
|
else
|
|
readFile(((std::string)THEMESDIR + "/" + themeFile + FILE_PREFIX).c_str());
|
|
}
|
|
return res;
|
|
}
|
|
|
|
|
|
if (parent)
|
|
parent->hide();
|
|
|
|
if ( !hasThemeChanged )
|
|
rememberOldTheme( true );
|
|
|
|
return Show();
|
|
}
|
|
|
|
void CThemes::readThemes(CMenuWidget &themes)
|
|
{
|
|
struct dirent **themelist;
|
|
int n;
|
|
const char *pfade[] = {THEMESDIR, THEMESDIR_VAR};
|
|
bool hasCVSThemes, hasUserThemes;
|
|
hasCVSThemes = hasUserThemes = false;
|
|
std::string userThemeFile = "";
|
|
CMenuForwarder* oj;
|
|
|
|
for(int p = 0;p < 2;p++)
|
|
{
|
|
n = scandir(pfade[p], &themelist, 0, alphasort);
|
|
if(n < 0)
|
|
perror("loading themes: scandir");
|
|
else
|
|
{
|
|
for(int count=0;count<n;count++)
|
|
{
|
|
char *file = themelist[count]->d_name;
|
|
char *pos = strstr(file, ".theme");
|
|
if(pos != NULL)
|
|
{
|
|
if ( p == 0 && hasCVSThemes == false ) {
|
|
themes.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORTHEMEMENU_SELECT2));
|
|
hasCVSThemes = true;
|
|
} else if ( p == 1 && hasUserThemes == false ) {
|
|
themes.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORTHEMEMENU_SELECT1));
|
|
hasUserThemes = true;
|
|
}
|
|
*pos = '\0';
|
|
if ( p == 1 ) {
|
|
userThemeFile = "{U}" + (std::string)file;
|
|
oj = new CMenuForwarder(file, true, "", this, userThemeFile.c_str());
|
|
} else
|
|
oj = new CMenuForwarder(file, true, "", this, file);
|
|
themes.addItem( oj );
|
|
}
|
|
free(themelist[count]);
|
|
}
|
|
free(themelist);
|
|
}
|
|
}
|
|
}
|
|
|
|
int CThemes::Show()
|
|
{
|
|
move_userDir();
|
|
|
|
std::string file_name = "";
|
|
|
|
CMenuWidget themes (LOCALE_COLORMENU_MENUCOLORS, NEUTRINO_ICON_SETTINGS, width);
|
|
sigc::slot0<void> slot_repaint = sigc::mem_fun(themes, &CMenuWidget::hide); //we want to clean screen before repaint after changed Option
|
|
themes.OnBeforePaint.connect(slot_repaint);
|
|
|
|
themes.addIntroItems(LOCALE_COLORTHEMEMENU_HEAD2);
|
|
|
|
//set default theme
|
|
themes.addItem(new CMenuForwarder(LOCALE_COLORTHEMEMENU_NEUTRINO_THEME, true, NULL, this, "theme_neutrino", CRCInput::RC_red));
|
|
|
|
readThemes(themes);
|
|
|
|
CKeyboardInput nameInput(LOCALE_COLORTHEMEMENU_NAME, &file_name);
|
|
CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, &nameInput, NULL, CRCInput::RC_green);
|
|
|
|
if (!CFileHelpers::createDir(THEMESDIR_VAR)) {
|
|
printf("[neutrino theme] error creating %s\n", THEMESDIR_VAR);
|
|
}
|
|
|
|
if (access(THEMESDIR_VAR, F_OK) == 0 ) {
|
|
themes.addItem(GenericMenuSeparatorLine);
|
|
themes.addItem(m1);
|
|
} else {
|
|
delete m1;
|
|
printf("[neutrino theme] error accessing %s\n", THEMESDIR_VAR);
|
|
}
|
|
|
|
int res = themes.exec(NULL, "");
|
|
|
|
if (!file_name.empty()) {
|
|
saveFile(((std::string)THEMESDIR_VAR + "/" + file_name + FILE_PREFIX).c_str());
|
|
}
|
|
|
|
if (hasThemeChanged) {
|
|
if (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_COLORTHEMEMENU_QUESTION, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_SETTINGS) != CMsgBox::mbrYes)
|
|
rememberOldTheme( false );
|
|
else
|
|
hasThemeChanged = false;
|
|
}
|
|
return res;
|
|
}
|
|
|
|
void CThemes::rememberOldTheme(bool remember)
|
|
{
|
|
if ( remember ) {
|
|
oldTheme = t;
|
|
} else {
|
|
t = oldTheme;
|
|
|
|
notifier = new CColorSetupNotifier;
|
|
notifier->changeNotify(NONEXISTANT_LOCALE, NULL);
|
|
hasThemeChanged = false;
|
|
delete notifier;
|
|
}
|
|
}
|
|
|
|
void CThemes::readFile(const char *themename)
|
|
{
|
|
if(themefile.loadConfig(themename))
|
|
{
|
|
getTheme(themefile);
|
|
|
|
notifier = new CColorSetupNotifier;
|
|
notifier->changeNotify(NONEXISTANT_LOCALE, NULL);
|
|
hasThemeChanged = true;
|
|
delete notifier;
|
|
}
|
|
else
|
|
printf("[neutrino theme] %s not found\n", themename);
|
|
}
|
|
|
|
void CThemes::saveFile(const char *themename)
|
|
{
|
|
setTheme(themefile);
|
|
|
|
if (themefile.getModifiedFlag()){
|
|
printf("[neutrino theme] save theme into %s\n", themename);
|
|
if (!themefile.saveConfig(themename))
|
|
printf("[neutrino theme] %s write error\n", themename);
|
|
}
|
|
}
|
|
|
|
// setup default Colors
|
|
void CThemes::setupDefaultColors()
|
|
{
|
|
CConfigFile empty(':');
|
|
getTheme(empty);
|
|
}
|
|
|
|
void CThemes::setTheme(CConfigFile &configfile)
|
|
{
|
|
configfile.setInt32( "menu_Head_alpha", t.menu_Head_alpha );
|
|
configfile.setInt32( "menu_Head_red", t.menu_Head_red );
|
|
configfile.setInt32( "menu_Head_green", t.menu_Head_green );
|
|
configfile.setInt32( "menu_Head_blue", t.menu_Head_blue );
|
|
configfile.setInt32( "menu_Head_Text_alpha", t.menu_Head_Text_alpha );
|
|
configfile.setInt32( "menu_Head_Text_red", t.menu_Head_Text_red );
|
|
configfile.setInt32( "menu_Head_Text_green", t.menu_Head_Text_green );
|
|
configfile.setInt32( "menu_Head_Text_blue", t.menu_Head_Text_blue );
|
|
|
|
configfile.setInt32( "menu_Head_gradient" , t.menu_Head_gradient);
|
|
configfile.setInt32( "menu_Head_gradient_direction" , t.menu_Head_gradient_direction);
|
|
configfile.setInt32( "menu_Separator_gradient_enable" , t.menu_Separator_gradient_enable);
|
|
|
|
configfile.setInt32( "menu_Content_alpha", t.menu_Content_alpha );
|
|
configfile.setInt32( "menu_Content_red", t.menu_Content_red );
|
|
configfile.setInt32( "menu_Content_green", t.menu_Content_green );
|
|
configfile.setInt32( "menu_Content_blue", t.menu_Content_blue );
|
|
configfile.setInt32( "menu_Content_Text_alpha", t.menu_Content_Text_alpha );
|
|
configfile.setInt32( "menu_Content_Text_red", t.menu_Content_Text_red );
|
|
configfile.setInt32( "menu_Content_Text_green", t.menu_Content_Text_green );
|
|
configfile.setInt32( "menu_Content_Text_blue", t.menu_Content_Text_blue );
|
|
configfile.setInt32( "menu_Content_Selected_alpha", t.menu_Content_Selected_alpha );
|
|
configfile.setInt32( "menu_Content_Selected_red", t.menu_Content_Selected_red );
|
|
configfile.setInt32( "menu_Content_Selected_green", t.menu_Content_Selected_green );
|
|
configfile.setInt32( "menu_Content_Selected_blue", t.menu_Content_Selected_blue );
|
|
configfile.setInt32( "menu_Content_Selected_Text_alpha", t.menu_Content_Selected_Text_alpha );
|
|
configfile.setInt32( "menu_Content_Selected_Text_red", t.menu_Content_Selected_Text_red );
|
|
configfile.setInt32( "menu_Content_Selected_Text_green", t.menu_Content_Selected_Text_green );
|
|
configfile.setInt32( "menu_Content_Selected_Text_blue", t.menu_Content_Selected_Text_blue );
|
|
configfile.setInt32( "menu_Content_inactive_alpha", t.menu_Content_inactive_alpha );
|
|
configfile.setInt32( "menu_Content_inactive_red", t.menu_Content_inactive_red );
|
|
configfile.setInt32( "menu_Content_inactive_green", t.menu_Content_inactive_green );
|
|
configfile.setInt32( "menu_Content_inactive_blue", t.menu_Content_inactive_blue );
|
|
configfile.setInt32( "menu_Content_inactive_Text_alpha", t.menu_Content_inactive_Text_alpha );
|
|
configfile.setInt32( "menu_Content_inactive_Text_red", t.menu_Content_inactive_Text_red );
|
|
configfile.setInt32( "menu_Content_inactive_Text_green", t.menu_Content_inactive_Text_green );
|
|
configfile.setInt32( "menu_Content_inactive_Text_blue", t.menu_Content_inactive_Text_blue );
|
|
configfile.setInt32( "menu_Foot_alpha", t.menu_Foot_alpha );
|
|
configfile.setInt32( "menu_Foot_red", t.menu_Foot_red );
|
|
configfile.setInt32( "menu_Foot_green", t.menu_Foot_green );
|
|
configfile.setInt32( "menu_Foot_blue", t.menu_Foot_blue );
|
|
configfile.setInt32( "menu_Foot_Text_alpha", t.menu_Foot_Text_alpha );
|
|
configfile.setInt32( "menu_Foot_Text_red", t.menu_Foot_Text_red );
|
|
configfile.setInt32( "menu_Foot_Text_green", t.menu_Foot_Text_green );
|
|
configfile.setInt32( "menu_Foot_Text_blue", t.menu_Foot_Text_blue );
|
|
|
|
configfile.setInt32( "menu_Hint_gradient" , t.menu_Hint_gradient);
|
|
configfile.setInt32( "menu_Hint_gradient_direction" , t.menu_Hint_gradient_direction);
|
|
configfile.setInt32( "menu_ButtonBar_gradient" , t.menu_ButtonBar_gradient);
|
|
configfile.setInt32( "menu_ButtonBar_gradient_direction" , t.menu_ButtonBar_gradient_direction);
|
|
|
|
configfile.setInt32( "infobar_alpha", t.infobar_alpha );
|
|
configfile.setInt32( "infobar_red", t.infobar_red );
|
|
configfile.setInt32( "infobar_green", t.infobar_green );
|
|
configfile.setInt32( "infobar_blue", t.infobar_blue );
|
|
configfile.setInt32( "infobar_casystem_alpha", t.infobar_casystem_alpha );
|
|
configfile.setInt32( "infobar_casystem_red", t.infobar_casystem_red );
|
|
configfile.setInt32( "infobar_casystem_green", t.infobar_casystem_green );
|
|
configfile.setInt32( "infobar_casystem_blue", t.infobar_casystem_blue );
|
|
configfile.setInt32( "infobar_Text_alpha", t.infobar_Text_alpha );
|
|
configfile.setInt32( "infobar_Text_red", t.infobar_Text_red );
|
|
configfile.setInt32( "infobar_Text_green", t.infobar_Text_green );
|
|
configfile.setInt32( "infobar_Text_blue", t.infobar_Text_blue );
|
|
|
|
configfile.setInt32( "infobar_gradient_top", t.infobar_gradient_top );
|
|
configfile.setInt32( "infobar_gradient_top_direction", t.infobar_gradient_top_direction );
|
|
configfile.setInt32( "infobar_gradient_body", t.infobar_gradient_body );
|
|
configfile.setInt32( "infobar_gradient_body_direction", t.infobar_gradient_body_direction );
|
|
configfile.setInt32( "infobar_gradient_bottom", t.infobar_gradient_bottom );
|
|
configfile.setInt32( "infobar_gradient_bottom_direction", t.infobar_gradient_bottom_direction );
|
|
|
|
configfile.setInt32( "colored_events_alpha", t.colored_events_alpha );
|
|
configfile.setInt32( "colored_events_red", t.colored_events_red );
|
|
configfile.setInt32( "colored_events_green", t.colored_events_green );
|
|
configfile.setInt32( "colored_events_blue", t.colored_events_blue );
|
|
configfile.setInt32( "colored_events_channellist", t.colored_events_channellist );
|
|
configfile.setInt32( "colored_events_infobar", t.colored_events_infobar );
|
|
|
|
configfile.setInt32( "clock_Digit_alpha", t.clock_Digit_alpha );
|
|
configfile.setInt32( "clock_Digit_red", t.clock_Digit_red );
|
|
configfile.setInt32( "clock_Digit_green", t.clock_Digit_green );
|
|
configfile.setInt32( "clock_Digit_blue", t.clock_Digit_blue );
|
|
|
|
configfile.setInt32( "progressbar_design", t.progressbar_design);
|
|
configfile.setInt32( "progressbar_design_channellist", t.progressbar_design_channellist);
|
|
configfile.setInt32( "progressbar_gradient", t.progressbar_gradient);
|
|
configfile.setInt32( "progressbar_timescale_red", t.progressbar_timescale_red);
|
|
configfile.setInt32( "progressbar_timescale_green", t.progressbar_timescale_green);
|
|
configfile.setInt32( "progressbar_timescale_yellow", t.progressbar_timescale_yellow);
|
|
configfile.setInt32( "progressbar_timescale_invert", t.progressbar_timescale_invert);
|
|
|
|
configfile.setInt32( "shadow_alpha", t.shadow_alpha );
|
|
configfile.setInt32( "shadow_red", t.shadow_red );
|
|
configfile.setInt32( "shadow_green", t.shadow_green );
|
|
configfile.setInt32( "shadow_blue", t.shadow_blue );
|
|
|
|
//NI
|
|
configfile.setInt32( "progressbar_active_red", t.progressbar_active_red );
|
|
configfile.setInt32( "progressbar_active_green", t.progressbar_active_green );
|
|
configfile.setInt32( "progressbar_active_blue", t.progressbar_active_blue );
|
|
configfile.setInt32( "progressbar_passive_red", t.progressbar_passive_red );
|
|
configfile.setInt32( "progressbar_passive_green", t.progressbar_passive_green );
|
|
configfile.setInt32( "progressbar_passive_blue", t.progressbar_passive_blue );
|
|
}
|
|
|
|
void CThemes::getTheme(CConfigFile &configfile)
|
|
{
|
|
t.menu_Head_alpha = configfile.getInt32( "menu_Head_alpha", 10 );
|
|
t.menu_Head_red = configfile.getInt32( "menu_Head_red", 0 );
|
|
t.menu_Head_green = configfile.getInt32( "menu_Head_green", 0 );
|
|
t.menu_Head_blue = configfile.getInt32( "menu_Head_blue", 0 );
|
|
t.menu_Head_Text_alpha = configfile.getInt32( "menu_Head_Text_alpha", 0 );
|
|
t.menu_Head_Text_red = configfile.getInt32( "menu_Head_Text_red", 99 );
|
|
t.menu_Head_Text_green = configfile.getInt32( "menu_Head_Text_green", 43 );
|
|
t.menu_Head_Text_blue = configfile.getInt32( "menu_Head_Text_blue", 7 );
|
|
|
|
t.menu_Head_gradient = configfile.getInt32("menu_Head_gradient", CC_COLGRAD_OFF); /* no bling */
|
|
t.menu_Head_gradient_direction = configfile.getInt32( "menu_Head_gradient_direction", CFrameBuffer::gradientVertical);
|
|
t.menu_Separator_gradient_enable = configfile.getInt32( "menu_Separator_gradient_enable", 0);
|
|
|
|
t.menu_Content_alpha = configfile.getInt32( "menu_Content_alpha", 10 );
|
|
t.menu_Content_red = configfile.getInt32( "menu_Content_red", 13 );
|
|
t.menu_Content_green = configfile.getInt32( "menu_Content_green", 13 );
|
|
t.menu_Content_blue = configfile.getInt32( "menu_Content_blue", 13 );
|
|
t.menu_Content_Text_alpha = configfile.getInt32( "menu_Content_Text_alpha", 0 );
|
|
t.menu_Content_Text_red = configfile.getInt32( "menu_Content_Text_red", 98 );
|
|
t.menu_Content_Text_green = configfile.getInt32( "menu_Content_Text_green", 98 );
|
|
t.menu_Content_Text_blue = configfile.getInt32( "menu_Content_Text_blue", 98 );
|
|
t.menu_Content_Selected_alpha = configfile.getInt32( "menu_Content_Selected_alpha", 10 );
|
|
t.menu_Content_Selected_red = configfile.getInt32( "menu_Content_Selected_red", 99 );
|
|
t.menu_Content_Selected_green = configfile.getInt32( "menu_Content_Selected_green", 43 );
|
|
t.menu_Content_Selected_blue = configfile.getInt32( "menu_Content_Selected_blue", 7 );
|
|
t.menu_Content_Selected_Text_alpha = configfile.getInt32( "menu_Content_Selected_Text_alpha", 0 );
|
|
t.menu_Content_Selected_Text_red = configfile.getInt32( "menu_Content_Selected_Text_red", 0 );
|
|
t.menu_Content_Selected_Text_green = configfile.getInt32( "menu_Content_Selected_Text_green", 0 );
|
|
t.menu_Content_Selected_Text_blue = configfile.getInt32( "menu_Content_Selected_Text_blue", 0 );
|
|
t.menu_Content_inactive_alpha = configfile.getInt32( "menu_Content_inactive_alpha", 10 );
|
|
t.menu_Content_inactive_red = configfile.getInt32( "menu_Content_inactive_red", 13 );
|
|
t.menu_Content_inactive_green = configfile.getInt32( "menu_Content_inactive_green", 13 );
|
|
t.menu_Content_inactive_blue = configfile.getInt32( "menu_Content_inactive_blue", 13 );
|
|
t.menu_Content_inactive_Text_alpha = configfile.getInt32( "menu_Content_inactive_Text_alpha", 0 );
|
|
t.menu_Content_inactive_Text_red = configfile.getInt32( "menu_Content_inactive_Text_red", 62 );
|
|
t.menu_Content_inactive_Text_green = configfile.getInt32( "menu_Content_inactive_Text_green", 62 );
|
|
t.menu_Content_inactive_Text_blue = configfile.getInt32( "menu_Content_inactive_Text_blue", 62 );
|
|
|
|
t.menu_Hint_gradient = configfile.getInt32( "menu_Hint_gradient", CC_COLGRAD_OFF);
|
|
t.menu_Hint_gradient_direction = configfile.getInt32( "menu_Hint_gradient_direction", CFrameBuffer::gradientVertical);
|
|
t.menu_ButtonBar_gradient = configfile.getInt32( "menu_ButtonBar_gradient", CC_COLGRAD_OFF);
|
|
t.menu_ButtonBar_gradient_direction = configfile.getInt32( "menu_ButtonBar_gradient_direction", CFrameBuffer::gradientVertical);
|
|
|
|
t.infobar_alpha = configfile.getInt32( "infobar_alpha", 10 );
|
|
t.infobar_red = configfile.getInt32( "infobar_red", 13 );
|
|
t.infobar_green = configfile.getInt32( "infobar_green", 13 );
|
|
t.infobar_blue = configfile.getInt32( "infobar_blue", 13 );
|
|
|
|
//t.menu_Foot default historically depends on t.infobar
|
|
t.menu_Foot_alpha = configfile.getInt32( "menu_Foot_alpha", 10 );
|
|
t.menu_Foot_red = configfile.getInt32( "menu_Foot_red", 0 );
|
|
t.menu_Foot_green = configfile.getInt32( "menu_Foot_green", 0 );
|
|
t.menu_Foot_blue = configfile.getInt32( "menu_Foot_blue", 0 );
|
|
|
|
t.infobar_gradient_top = configfile.getInt32( "infobar_gradient_top", CC_COLGRAD_OFF );
|
|
t.infobar_gradient_top_direction = configfile.getInt32( "infobar_gradient_top_direction", CFrameBuffer::gradientVertical );
|
|
t.infobar_gradient_body = configfile.getInt32( "infobar_gradient_body", CC_COLGRAD_OFF);
|
|
t.infobar_gradient_body_direction = configfile.getInt32( "infobar_gradient_body_direction", CFrameBuffer::gradientVertical );
|
|
t.infobar_gradient_bottom = configfile.getInt32( "infobar_gradient_bottom", CC_COLGRAD_OFF );
|
|
t.infobar_gradient_bottom_direction = configfile.getInt32( "infobar_gradient_bottom_direction", CFrameBuffer::gradientVertical );
|
|
|
|
t.infobar_casystem_alpha = configfile.getInt32( "infobar_casystem_alpha", 10 );
|
|
t.infobar_casystem_red = configfile.getInt32( "infobar_casystem_red", 13 );
|
|
t.infobar_casystem_green = configfile.getInt32( "infobar_casystem_green", 13 );
|
|
t.infobar_casystem_blue = configfile.getInt32( "infobar_casystem_blue", 13 );
|
|
t.infobar_Text_alpha = configfile.getInt32( "infobar_Text_alpha", 0 );
|
|
t.infobar_Text_red = configfile.getInt32( "infobar_Text_red", 98 );
|
|
t.infobar_Text_green = configfile.getInt32( "infobar_Text_green", 98 );
|
|
t.infobar_Text_blue = configfile.getInt32( "infobar_Text_blue", 98 );
|
|
|
|
//t.menu_Foot_Text default historically depends on t.infobar_Text
|
|
t.menu_Foot_Text_alpha = configfile.getInt32( "menu_Foot_Text_alpha", 0 );
|
|
t.menu_Foot_Text_red = configfile.getInt32( "menu_Foot_Text_red", 98 );
|
|
t.menu_Foot_Text_green = configfile.getInt32( "menu_Foot_Text_green", 98 );
|
|
t.menu_Foot_Text_blue = configfile.getInt32( "menu_Foot_Text_blue", 98 );
|
|
|
|
t.colored_events_alpha = configfile.getInt32( "colored_events_alpha", 0 );
|
|
t.colored_events_red = configfile.getInt32( "colored_events_red", 99 );
|
|
t.colored_events_green = configfile.getInt32( "colored_events_green", 43 );
|
|
t.colored_events_blue = configfile.getInt32( "colored_events_blue", 7 );
|
|
t.colored_events_channellist = configfile.getInt32( "colored_events_channellist", 1 );
|
|
|
|
t.colored_events_infobar = configfile.getInt32( "colored_events_infobar", 1 );
|
|
t.clock_Digit_alpha = configfile.getInt32( "clock_Digit_alpha", 0 );
|
|
t.clock_Digit_red = configfile.getInt32( "clock_Digit_red", 62 );
|
|
t.clock_Digit_green = configfile.getInt32( "clock_Digit_green", 62 );
|
|
t.clock_Digit_blue = configfile.getInt32( "clock_Digit_blue", 62 );
|
|
|
|
t.progressbar_design = configfile.getInt32("progressbar_design", CProgressBar::PB_MONO);
|
|
t.progressbar_design_channellist = configfile.getInt32("progressbar_design_channellist", t.progressbar_design);
|
|
t.progressbar_gradient = configfile.getInt32("progressbar_gradient", 1);
|
|
t.progressbar_timescale_red = configfile.getInt32("progressbar_timescale_red", 0);
|
|
t.progressbar_timescale_green = configfile.getInt32("progressbar_timescale_green", 100);
|
|
t.progressbar_timescale_yellow = configfile.getInt32("progressbar_timescale_yellow", 70);
|
|
t.progressbar_timescale_invert = configfile.getInt32("progressbar_timescale_invert", 0);
|
|
|
|
t.shadow_alpha = configfile.getInt32( "shadow_alpha", 25 );
|
|
t.shadow_red = configfile.getInt32( "shadow_red", 0 );
|
|
t.shadow_green = configfile.getInt32( "shadow_green", 0 );
|
|
t.shadow_blue = configfile.getInt32( "shadow_blue", 0 );
|
|
|
|
//NI
|
|
t.progressbar_active_red = configfile.getInt32( "progressbar_active_red", 62 );
|
|
t.progressbar_active_green = configfile.getInt32( "progressbar_active_green", 62 );
|
|
t.progressbar_active_blue = configfile.getInt32( "progressbar_active_blue", 62 );
|
|
t.progressbar_passive_red = configfile.getInt32( "progressbar_passive_red", 26 );
|
|
t.progressbar_passive_green = configfile.getInt32( "progressbar_passive_green", 26 );
|
|
t.progressbar_passive_blue = configfile.getInt32( "progressbar_passive_blue", 26 );
|
|
}
|
|
|
|
void CThemes::move_userDir()
|
|
{
|
|
if (access(USERDIR, F_OK) == 0)
|
|
{
|
|
if (!CFileHelpers::createDir(THEMESDIR_VAR))
|
|
{
|
|
printf("[neutrino theme] error creating %s\n", THEMESDIR_VAR);
|
|
return;
|
|
}
|
|
struct dirent **themelist;
|
|
int n = scandir(USERDIR, &themelist, 0, alphasort);
|
|
if (n < 0)
|
|
{
|
|
perror("loading themes: scandir");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
for (int count = 0; count < n; count++)
|
|
{
|
|
const char *file = themelist[count]->d_name;
|
|
if (strcmp(file, ".") == 0 || strcmp(file, "..") == 0)
|
|
continue;
|
|
const char *dest = ((std::string)USERDIR + "/" + file).c_str();
|
|
const char *target = ((std::string)THEMESDIR_VAR + "/" + file).c_str();
|
|
printf("[neutrino theme] moving %s to %s\n", dest, target);
|
|
rename(dest, target);
|
|
}
|
|
}
|
|
printf("[neutrino theme] removing %s\n", USERDIR);
|
|
remove(USERDIR);
|
|
}
|
|
}
|