- move oled data to one single place in data/oled

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2020-06-21 17:39:51 +02:00
committed by Thilo Graf
parent e947d53eba
commit 3e6bab00d8
58 changed files with 53 additions and 92 deletions

View File

@@ -371,9 +371,6 @@ data/icons/headers/Makefile
data/icons/hints/Makefile data/icons/hints/Makefile
data/icons/locale/Makefile data/icons/locale/Makefile
data/icons/movieplayer/Makefile data/icons/movieplayer/Makefile
data/icons/oled/Makefile
data/icons/oled/clock/Makefile
data/icons/oled/weather/Makefile
data/icons/radar/Makefile data/icons/radar/Makefile
data/icons/slider/Makefile data/icons/slider/Makefile
data/icons/status/Makefile data/icons/status/Makefile
@@ -391,7 +388,12 @@ data/lcd/clock/Makefile
data/lcd/icons/Makefile data/lcd/icons/Makefile
data/license/Makefile data/license/Makefile
data/locale/Makefile data/locale/Makefile
data/othemes/Makefile data/oled/Makefile
data/oled/fonts/Makefile
data/oled/icons/Makefile
data/oled/icons/clock/Makefile
data/oled/icons/weather/Makefile
data/oled/themes/Makefile
data/pictures/Makefile data/pictures/Makefile
data/pictures/backgrounds/Makefile data/pictures/backgrounds/Makefile
data/pictures/screensaver/Makefile data/pictures/screensaver/Makefile

View File

@@ -19,7 +19,7 @@ SUBDIRS = \
if ENABLE_GRAPHLCD if ENABLE_GRAPHLCD
SUBDIRS += \ SUBDIRS += \
othemes oled
endif endif
if BOXTYPE_TRIPLE if BOXTYPE_TRIPLE

View File

@@ -21,12 +21,6 @@ if BOXMODEL_CS_HD2
install_DATA += UnDotum.ttf install_DATA += UnDotum.ttf
endif endif
if ENABLE_GRAPHLCD
install_DATA += \
led.ttf \
lcd.ttf
endif
install-data-hook: install-data-hook:
cd $(DESTDIR)$(FONTDIR); \ cd $(DESTDIR)$(FONTDIR); \
mv $(neutrino_ttf) neutrino.ttf; \ mv $(neutrino_ttf) neutrino.ttf; \

View File

@@ -11,10 +11,5 @@ SUBDIRS = \
various \ various \
weather weather
if ENABLE_GRAPHLCD
SUBDIRS += \
oled
endif
install-data-hook: install-data-hook:
$(INSTALL) -d $(DESTDIR)/$(ICONSDIR)/logo $(INSTALL) -d $(DESTDIR)/$(ICONSDIR)/logo

View File

@@ -839,7 +839,7 @@ glcd.align_left links
glcd.align_none keine glcd.align_none keine
glcd.align_right rechts glcd.align_right rechts
glcd.align_start Sendungsstart ausrichten glcd.align_start Sendungsstart ausrichten
glcd.align_time Zeit ausrichten glcd.align_time Uhrzeit ausrichten
glcd.bar_width Fortschrittsbalken-Weite glcd.bar_width Fortschrittsbalken-Weite
glcd.bar_x_position Fortschrittsbalken x-Position glcd.bar_x_position Fortschrittsbalken x-Position
glcd.bar_y_position Fortschrittsbalken y-Position glcd.bar_y_position Fortschrittsbalken y-Position

4
data/oled/Makefile.am Normal file
View File

@@ -0,0 +1,4 @@
SUBDIRS = \
fonts \
icons \
themes

View File

@@ -0,0 +1,6 @@
installdir = $(FONTDIR)/oled
install_DATA = \
led.ttf \
lcd.ttf \
terminator.ttf

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 601 KiB

After

Width:  |  Height:  |  Size: 601 KiB

View File

Before

Width:  |  Height:  |  Size: 451 KiB

After

Width:  |  Height:  |  Size: 451 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 478 B

After

Width:  |  Height:  |  Size: 478 B

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 601 KiB

After

Width:  |  Height:  |  Size: 601 KiB

View File

Before

Width:  |  Height:  |  Size: 601 KiB

After

Width:  |  Height:  |  Size: 601 KiB

View File

Before

Width:  |  Height:  |  Size: 601 KiB

After

Width:  |  Height:  |  Size: 601 KiB

View File

Before

Width:  |  Height:  |  Size: 601 KiB

After

Width:  |  Height:  |  Size: 601 KiB

View File

Before

Width:  |  Height:  |  Size: 451 KiB

After

Width:  |  Height:  |  Size: 451 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -1,4 +1,4 @@
installdir = $(THEMESDIR) installdir = $(THEMESDIR)/oled
install_DATA = \ install_DATA = \
advanced.otheme \ advanced.otheme \

View File

@@ -11,7 +11,7 @@ glcd_color_bg_blue=0
glcd_color_bar_red=0 glcd_color_bar_red=0
glcd_color_bar_green=0 glcd_color_bar_green=0
glcd_color_bar_blue=100 glcd_color_bar_blue=100
glcd_font=/usr/share/fonts/neutrino.ttf glcd_font=/share/fonts/neutrino.ttf
glcd_background=/share/tuxbox/neutrino/icons/oled/advanced.png glcd_background=/share/tuxbox/neutrino/icons/oled/advanced.png
glcd_align_channel=2 glcd_align_channel=2
glcd_align_epg=2 glcd_align_epg=2

View File

@@ -11,7 +11,7 @@ glcd_color_bg_blue=0
glcd_color_bar_red=0 glcd_color_bar_red=0
glcd_color_bar_green=0 glcd_color_bar_green=0
glcd_color_bar_blue=100 glcd_color_bar_blue=100
glcd_font=/usr/share/fonts/neutrino.ttf glcd_font=/share/fonts/neutrino.ttf
glcd_background= glcd_background=
glcd_align_channel=2 glcd_align_channel=2
glcd_align_epg=2 glcd_align_epg=2

View File

@@ -11,7 +11,7 @@ glcd_color_bg_blue=0
glcd_color_bar_red=0 glcd_color_bar_red=0
glcd_color_bar_green=0 glcd_color_bar_green=0
glcd_color_bar_blue=100 glcd_color_bar_blue=100
glcd_font=/usr/share/fonts/neutrino.ttf glcd_font=/share/fonts/neutrino.ttf
glcd_background=/share/tuxbox/neutrino/icons/oled/easy.png glcd_background=/share/tuxbox/neutrino/icons/oled/easy.png
glcd_align_channel=2 glcd_align_channel=2
glcd_align_epg=2 glcd_align_epg=2

View File

@@ -11,7 +11,7 @@ glcd_color_bg_blue=0
glcd_color_bar_red=0 glcd_color_bar_red=0
glcd_color_bar_green=0 glcd_color_bar_green=0
glcd_color_bar_blue=100 glcd_color_bar_blue=100
glcd_font=/usr/share/fonts/neutrino.ttf glcd_font=/share/fonts/neutrino.ttf
glcd_background=/share/tuxbox/neutrino/icons/oled/medium.png glcd_background=/share/tuxbox/neutrino/icons/oled/medium.png
glcd_align_channel=2 glcd_align_channel=2
glcd_align_epg=2 glcd_align_epg=2

View File

@@ -11,7 +11,7 @@ glcd_color_bg_blue=0
glcd_color_bar_red=0 glcd_color_bar_red=0
glcd_color_bar_green=0 glcd_color_bar_green=0
glcd_color_bar_blue=100 glcd_color_bar_blue=100
glcd_font=/usr/share/fonts/neutrino.ttf glcd_font=/share/fonts/neutrino.ttf
glcd_background=/share/tuxbox/neutrino/icons/oled/simple.png glcd_background=/share/tuxbox/neutrino/icons/oled/simple.png
glcd_align_channel=2 glcd_align_channel=2
glcd_align_epg=2 glcd_align_epg=2

View File

@@ -11,7 +11,7 @@ glcd_color_bg_blue=0
glcd_color_bar_red=0 glcd_color_bar_red=0
glcd_color_bar_green=0 glcd_color_bar_green=0
glcd_color_bar_blue=100 glcd_color_bar_blue=100
glcd_font=/usr/share/fonts/neutrino.ttf glcd_font=/share/fonts/neutrino.ttf
glcd_background=/share/tuxbox/neutrino/icons/oled/weather.png glcd_background=/share/tuxbox/neutrino/icons/oled/weather.png
glcd_align_channel=2 glcd_align_channel=2
glcd_align_epg=2 glcd_align_epg=2

View File

@@ -320,7 +320,7 @@ void cGLCD::Exec()
g_PicViewer->getSize(Logo.c_str(), &icon_start_width, &icon_start_height); g_PicViewer->getSize(Logo.c_str(), &icon_start_width, &icon_start_height);
if (g_settings.glcd_show_logo && percent_logo && if (g_settings.glcd_show_logo && percent_logo &&
showImage(channel_id, Channel, 0, t.glcd_channel_x_position, t.glcd_channel_y_position, percent_logo * bitmap->Height()/100, true, false)) { showImage(channel_id, Channel, t.glcd_channel_x_position, t.glcd_channel_y_position, bitmap->Width() - 4, percent_logo * bitmap->Height()/100, true, false)) {
doScrollChannel = false; doScrollChannel = false;
scrollChannelSkip = 0; scrollChannelSkip = 0;
} else if (percent_logo && icon_start_width && icon_start_height && } else if (percent_logo && icon_start_width && icon_start_height &&
@@ -634,8 +634,8 @@ void cGLCD::updateFonts()
if (!fonts_initialized || (fontsize_smalltext_new != fontsize_smalltext)) { if (!fonts_initialized || (fontsize_smalltext_new != fontsize_smalltext)) {
fontsize_smalltext = fontsize_smalltext_new; fontsize_smalltext = fontsize_smalltext_new;
if (!font_smalltext.LoadFT2(/*t.glcd_font*/FONTDIR "/lcd.ttf", "UTF-8", fontsize_smalltext)) { if (!font_smalltext.LoadFT2(FONTDIR "/oled/terminator.ttf", "UTF-8", fontsize_smalltext)) {
t.glcd_font = FONTDIR "/lcd.ttf"; t.glcd_font = FONTDIR "/neutrino.ttf";
font_smalltext.LoadFT2(t.glcd_font, "UTF-8", fontsize_smalltext); font_smalltext.LoadFT2(t.glcd_font, "UTF-8", fontsize_smalltext);
} }
} }

View File

@@ -1,5 +1,5 @@
/* /*
simple clock - DBoxII-Project lcd clock - DBoxII-Project
Copyright (C) 2018 redblue Copyright (C) 2018 redblue
@@ -31,7 +31,7 @@
static bool fonts_initialized = false; static bool fonts_initialized = false;
GLCD::cFont font_time_standby_second; GLCD::cFont lcd_font_time_standby;
void InitLcdClock(void) void InitLcdClock(void)
{ {
@@ -47,9 +47,8 @@ void LcdClockUpdateFonts(void)
int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100; int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100;
if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) { if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) {
fontsize_time_standby = fontsize_time_standby_new; fontsize_time_standby = fontsize_time_standby_new;
if (!font_time_standby_second.LoadFT2(/*t.glcd_font*/FONTDIR "/lcd.ttf", "UTF-8", fontsize_time_standby)) { if (!lcd_font_time_standby.LoadFT2(FONTDIR "/oled/lcd.ttf", "UTF-8", fontsize_time_standby)) {
t.glcd_font = FONTDIR "/lcd.ttf"; lcd_font_time_standby.LoadFT2(FONTDIR "/neutrino.ttf", "UTF-8", fontsize_time_standby);
font_time_standby_second.LoadFT2(t.glcd_font, "UTF-8", fontsize_time_standby);
} }
} }
fonts_initialized = true; fonts_initialized = true;
@@ -57,18 +56,19 @@ void LcdClockUpdateFonts(void)
void RenderLcdClock(std::string Time, int x, int y) void RenderLcdClock(std::string Time, int x, int y)
{ {
(void) x;
cGLCD *cglcd = cGLCD::getInstance(); cGLCD *cglcd = cGLCD::getInstance();
SNeutrinoGlcdTheme &t = g_settings.glcd_theme; SNeutrinoGlcdTheme &t = g_settings.glcd_theme;
LcdClockUpdateFonts(); LcdClockUpdateFonts();
cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - font_time_standby_second.Width(Time))/2), cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - lcd_font_time_standby.Width(Time))/2),
y, cglcd->bitmap->Width() - 1, Time, y, cglcd->bitmap->Width() - 1, Time,
&font_time_standby_second, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent); &lcd_font_time_standby, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent);
} }
void ShowLcdClock(std::string Time) void ShowLcdClock(std::string Time)
{ {
cGLCD *cglcd = cGLCD::getInstance(); cGLCD *cglcd = cGLCD::getInstance();
SNeutrinoGlcdTheme &t = g_settings.glcd_theme; SNeutrinoGlcdTheme &t = g_settings.glcd_theme;
int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - font_time_standby_second.Height(Time)) / 2; int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - lcd_font_time_standby.Height(Time)) / 2;
RenderLcdClock(Time, 255, y); RenderLcdClock(Time, 255, y);
} }

View File

@@ -1,5 +1,5 @@
/* /*
simple clock - DBoxII-Project led clock - DBoxII-Project
Copyright (C) 2018 redblue Copyright (C) 2018 redblue
@@ -31,7 +31,7 @@
static bool fonts_initialized = false; static bool fonts_initialized = false;
GLCD::cFont second_font_time_standby; GLCD::cFont led_font_time_standby;
void InitLedClock(void) void InitLedClock(void)
{ {
@@ -47,9 +47,8 @@ void LedClockUpdateFonts(void)
int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100; int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100;
if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) { if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) {
fontsize_time_standby = fontsize_time_standby_new; fontsize_time_standby = fontsize_time_standby_new;
if (!second_font_time_standby.LoadFT2(/*t.glcd_font*/FONTDIR "/led.ttf", "UTF-8", fontsize_time_standby)) { if (!led_font_time_standby.LoadFT2(FONTDIR "/oled/led.ttf", "UTF-8", fontsize_time_standby)) {
t.glcd_font = FONTDIR "/led.ttf"; led_font_time_standby.LoadFT2(FONTDIR "/neutrino.ttf", "UTF-8", fontsize_time_standby);
second_font_time_standby.LoadFT2(t.glcd_font, "UTF-8", fontsize_time_standby);
} }
} }
fonts_initialized = true; fonts_initialized = true;
@@ -57,18 +56,19 @@ void LedClockUpdateFonts(void)
void RenderLedClock(std::string Time, int x, int y) void RenderLedClock(std::string Time, int x, int y)
{ {
(void) x;
cGLCD *cglcd = cGLCD::getInstance(); cGLCD *cglcd = cGLCD::getInstance();
SNeutrinoGlcdTheme &t = g_settings.glcd_theme; SNeutrinoGlcdTheme &t = g_settings.glcd_theme;
LedClockUpdateFonts(); LedClockUpdateFonts();
cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - second_font_time_standby.Width(Time))/2), cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - led_font_time_standby.Width(Time))/2),
y, cglcd->bitmap->Width() - 1, Time, y, cglcd->bitmap->Width() - 1, Time,
&second_font_time_standby, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent); &led_font_time_standby, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent);
} }
void ShowLedClock(std::string Time) void ShowLedClock(std::string Time)
{ {
cGLCD *cglcd = cGLCD::getInstance(); cGLCD *cglcd = cGLCD::getInstance();
SNeutrinoGlcdTheme &t = g_settings.glcd_theme; SNeutrinoGlcdTheme &t = g_settings.glcd_theme;
int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - second_font_time_standby.Height(Time)) / 2; int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - led_font_time_standby.Height(Time)) / 2;
RenderLedClock(Time, 255, y); RenderLedClock(Time, 255, y);
} }

View File

@@ -51,7 +51,6 @@
#include "glcdthemes.h" #include "glcdthemes.h"
#define USERDIR "/var" THEMESDIR
#define FILE_SUFFIX ".otheme" #define FILE_SUFFIX ".otheme"
static SNeutrinoGlcdTheme &t = g_settings.glcd_theme; static SNeutrinoGlcdTheme &t = g_settings.glcd_theme;
@@ -93,10 +92,10 @@ int CGLCDThemes::exec(CMenuTarget* parent, const std::string & actionKey)
if ( strstr(themeFile.c_str(), "{U}") != 0 ) if ( strstr(themeFile.c_str(), "{U}") != 0 )
{ {
themeFile.erase(0, 3); themeFile.erase(0, 3);
readFile(((std::string)THEMESDIR_VAR + "/" + themeFile + FILE_SUFFIX).c_str()); readFile(((std::string)THEMESDIR_VAR + "/oled/" + themeFile + FILE_SUFFIX).c_str());
} }
else else
readFile(((std::string)THEMESDIR + "/" + themeFile + FILE_SUFFIX).c_str()); readFile(((std::string)THEMESDIR + "/oled" + themeFile + FILE_SUFFIX).c_str());
g_settings.glcd_theme_name = themeFile; g_settings.glcd_theme_name = themeFile;
} }
OnAfterSelectTheme(); OnAfterSelectTheme();
@@ -118,7 +117,7 @@ void CGLCDThemes::initThemesMenu(CMenuWidget &themes)
{ {
struct dirent **themelist; struct dirent **themelist;
int n; int n;
const char *pfade[] = {THEMESDIR, THEMESDIR_VAR}; const char *pfade[] = {THEMESDIR "/oled", THEMESDIR_VAR "/oled"};
bool hasCVSThemes, hasUserThemes; bool hasCVSThemes, hasUserThemes;
hasCVSThemes = hasUserThemes = false; hasCVSThemes = hasUserThemes = false;
std::string userThemeFile = ""; std::string userThemeFile = "";
@@ -176,8 +175,6 @@ void CGLCDThemes::initThemesMenu(CMenuWidget &themes)
int CGLCDThemes::Show() int CGLCDThemes::Show()
{ {
move_userDir();
std::string file_name = ""; std::string file_name = "";
CMenuWidget themes (LOCALE_COLORMENU_MENUCOLORS, NEUTRINO_ICON_SETTINGS, width); CMenuWidget themes (LOCALE_COLORMENU_MENUCOLORS, NEUTRINO_ICON_SETTINGS, width);
@@ -197,22 +194,22 @@ int CGLCDThemes::Show()
CKeyboardInput nameInput(LOCALE_COLORTHEMEMENU_NAME, &file_name); CKeyboardInput nameInput(LOCALE_COLORTHEMEMENU_NAME, &file_name);
CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, &nameInput, NULL, CRCInput::RC_green); CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, &nameInput, NULL, CRCInput::RC_green);
if (!CFileHelpers::createDir(THEMESDIR_VAR)) { if (!CFileHelpers::createDir(THEMESDIR_VAR "/oled")) {
printf("[neutrino glcd theme] error creating %s\n", THEMESDIR_VAR); printf("[neutrino glcd theme] error creating %s\n", THEMESDIR_VAR "/oled");
} }
if (access(THEMESDIR_VAR, F_OK) == 0 ) { if (access(THEMESDIR_VAR "/oled", F_OK) == 0 ) {
themes.addItem(GenericMenuSeparatorLine); themes.addItem(GenericMenuSeparatorLine);
themes.addItem(m1); themes.addItem(m1);
} else { } else {
delete m1; delete m1;
printf("[neutrino glcd theme] error accessing %s\n", THEMESDIR_VAR); printf("[neutrino glcd theme] error accessing %s\n", THEMESDIR_VAR "/oled");
} }
int res = themes.exec(NULL, ""); int res = themes.exec(NULL, "");
if (!file_name.empty()) { if (!file_name.empty()) {
saveFile(((std::string)THEMESDIR_VAR + "/" + file_name + FILE_SUFFIX).c_str()); saveFile(((std::string)THEMESDIR_VAR + "/oled/" + file_name + FILE_SUFFIX).c_str());
} }
if (hasThemeChanged) { if (hasThemeChanged) {
@@ -265,7 +262,7 @@ void CGLCDThemes::saveFile(const char *themename)
bool CGLCDThemes::applyDefaultTheme() bool CGLCDThemes::applyDefaultTheme()
{ {
g_settings.glcd_theme_name = DEFAULT_OLED_THEME; g_settings.glcd_theme_name = DEFAULT_OLED_THEME;
std::string default_theme = THEMESDIR "/" + g_settings.glcd_theme_name + ".otheme"; std::string default_theme = THEMESDIR "/oled/" + g_settings.glcd_theme_name + ".otheme";
if(themefile.loadConfig(default_theme)){ if(themefile.loadConfig(default_theme)){
getTheme(themefile); getTheme(themefile);
return true; return true;
@@ -428,42 +425,6 @@ void CGLCDThemes::getTheme(CConfigFile &configfile)
applyDefaultTheme(); applyDefaultTheme();
} }
void CGLCDThemes::move_userDir()
{
if (access(USERDIR, F_OK) == 0)
{
if (!CFileHelpers::createDir(THEMESDIR_VAR))
{
printf("[neutrino glcd theme] error creating %s\n", THEMESDIR_VAR);
return;
}
struct dirent **themelist;
int n = scandir(USERDIR, &themelist, 0, alphasort);
if (n < 0)
{
perror("loading glcd 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 gcdl theme] moving %s to %s\n", dest, target);
rename(dest, target);
free(themelist[count]);
}
free(themelist);
}
printf("[neutrino gcld theme] removing %s\n", USERDIR);
remove(USERDIR);
}
}
void CGLCDThemes::markSelectedTheme(CMenuWidget *w) void CGLCDThemes::markSelectedTheme(CMenuWidget *w)
{ {
for (int i = 0; i < w->getItemsCount(); i++){ for (int i = 0; i < w->getItemsCount(); i++){

View File

@@ -48,7 +48,6 @@ class CGLCDThemes : public CMenuTarget, CColorSetupNotifier, public sigc::tracka
void saveFile(const char *themename); void saveFile(const char *themename);
void initThemesMenu(CMenuWidget &); void initThemesMenu(CMenuWidget &);
void rememberOldTheme(bool remember); void rememberOldTheme(bool remember);
void move_userDir();
bool applyDefaultTheme(); bool applyDefaultTheme();
///signal after select theme is completed ///signal after select theme is completed
sigc::signal<void> OnAfterSelectTheme; sigc::signal<void> OnAfterSelectTheme;