diff --git a/configure.ac b/configure.ac index 60700a361..bed886f51 100644 --- a/configure.ac +++ b/configure.ac @@ -371,9 +371,6 @@ data/icons/headers/Makefile data/icons/hints/Makefile data/icons/locale/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/slider/Makefile data/icons/status/Makefile @@ -391,7 +388,12 @@ data/lcd/clock/Makefile data/lcd/icons/Makefile data/license/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/backgrounds/Makefile data/pictures/screensaver/Makefile diff --git a/data/Makefile.am b/data/Makefile.am index 36fe57242..01135696d 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -19,7 +19,7 @@ SUBDIRS = \ if ENABLE_GRAPHLCD SUBDIRS += \ - othemes + oled endif if BOXTYPE_TRIPLE diff --git a/data/fonts/Makefile.am b/data/fonts/Makefile.am index 35117c7bf..0c183df60 100644 --- a/data/fonts/Makefile.am +++ b/data/fonts/Makefile.am @@ -21,12 +21,6 @@ if BOXMODEL_CS_HD2 install_DATA += UnDotum.ttf endif -if ENABLE_GRAPHLCD -install_DATA += \ - led.ttf \ - lcd.ttf -endif - install-data-hook: cd $(DESTDIR)$(FONTDIR); \ mv $(neutrino_ttf) neutrino.ttf; \ diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index 0ebc9d3f7..b73f283c1 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -11,10 +11,5 @@ SUBDIRS = \ various \ weather -if ENABLE_GRAPHLCD -SUBDIRS += \ - oled -endif - install-data-hook: $(INSTALL) -d $(DESTDIR)/$(ICONSDIR)/logo diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index c1e435ed3..e07f309cb 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -839,7 +839,7 @@ glcd.align_left links glcd.align_none keine glcd.align_right rechts glcd.align_start Sendungsstart ausrichten -glcd.align_time Zeit ausrichten +glcd.align_time Uhrzeit ausrichten glcd.bar_width Fortschrittsbalken-Weite glcd.bar_x_position Fortschrittsbalken x-Position glcd.bar_y_position Fortschrittsbalken y-Position diff --git a/data/oled/Makefile.am b/data/oled/Makefile.am new file mode 100644 index 000000000..a61aed689 --- /dev/null +++ b/data/oled/Makefile.am @@ -0,0 +1,4 @@ +SUBDIRS = \ + fonts \ + icons \ + themes diff --git a/data/oled/fonts/Makefile.am b/data/oled/fonts/Makefile.am new file mode 100644 index 000000000..2a7ce62ad --- /dev/null +++ b/data/oled/fonts/Makefile.am @@ -0,0 +1,6 @@ +installdir = $(FONTDIR)/oled + +install_DATA = \ + led.ttf \ + lcd.ttf \ + terminator.ttf diff --git a/data/fonts/lcd.ttf b/data/oled/fonts/lcd.ttf similarity index 100% rename from data/fonts/lcd.ttf rename to data/oled/fonts/lcd.ttf diff --git a/data/fonts/led.ttf b/data/oled/fonts/led.ttf similarity index 100% rename from data/fonts/led.ttf rename to data/oled/fonts/led.ttf diff --git a/data/oled/fonts/terminator.ttf b/data/oled/fonts/terminator.ttf new file mode 100644 index 000000000..7f75c9173 Binary files /dev/null and b/data/oled/fonts/terminator.ttf differ diff --git a/data/icons/oled/Makefile.am b/data/oled/icons/Makefile.am similarity index 100% rename from data/icons/oled/Makefile.am rename to data/oled/icons/Makefile.am diff --git a/data/icons/oled/advanced.png b/data/oled/icons/advanced.png similarity index 100% rename from data/icons/oled/advanced.png rename to data/oled/icons/advanced.png diff --git a/data/icons/oled/blank.png b/data/oled/icons/blank.png similarity index 100% rename from data/icons/oled/blank.png rename to data/oled/icons/blank.png diff --git a/data/icons/oled/clock/Makefile.am b/data/oled/icons/clock/Makefile.am similarity index 100% rename from data/icons/oled/clock/Makefile.am rename to data/oled/icons/clock/Makefile.am diff --git a/data/icons/oled/clock/analog_clock.png b/data/oled/icons/clock/analog_clock.png similarity index 100% rename from data/icons/oled/clock/analog_clock.png rename to data/oled/icons/clock/analog_clock.png diff --git a/data/icons/oled/clock/analog_hour.png b/data/oled/icons/clock/analog_hour.png similarity index 100% rename from data/icons/oled/clock/analog_hour.png rename to data/oled/icons/clock/analog_hour.png diff --git a/data/icons/oled/clock/analog_min.png b/data/oled/icons/clock/analog_min.png similarity index 100% rename from data/icons/oled/clock/analog_min.png rename to data/oled/icons/clock/analog_min.png diff --git a/data/icons/oled/clock/time_dots.png b/data/oled/icons/clock/time_dots.png similarity index 100% rename from data/icons/oled/clock/time_dots.png rename to data/oled/icons/clock/time_dots.png diff --git a/data/icons/oled/clock/time_eight.png b/data/oled/icons/clock/time_eight.png similarity index 100% rename from data/icons/oled/clock/time_eight.png rename to data/oled/icons/clock/time_eight.png diff --git a/data/icons/oled/clock/time_five.png b/data/oled/icons/clock/time_five.png similarity index 100% rename from data/icons/oled/clock/time_five.png rename to data/oled/icons/clock/time_five.png diff --git a/data/icons/oled/clock/time_four.png b/data/oled/icons/clock/time_four.png similarity index 100% rename from data/icons/oled/clock/time_four.png rename to data/oled/icons/clock/time_four.png diff --git a/data/icons/oled/clock/time_nine.png b/data/oled/icons/clock/time_nine.png similarity index 100% rename from data/icons/oled/clock/time_nine.png rename to data/oled/icons/clock/time_nine.png diff --git a/data/icons/oled/clock/time_one.png b/data/oled/icons/clock/time_one.png similarity index 100% rename from data/icons/oled/clock/time_one.png rename to data/oled/icons/clock/time_one.png diff --git a/data/icons/oled/clock/time_seven.png b/data/oled/icons/clock/time_seven.png similarity index 100% rename from data/icons/oled/clock/time_seven.png rename to data/oled/icons/clock/time_seven.png diff --git a/data/icons/oled/clock/time_six.png b/data/oled/icons/clock/time_six.png similarity index 100% rename from data/icons/oled/clock/time_six.png rename to data/oled/icons/clock/time_six.png diff --git a/data/icons/oled/clock/time_three.png b/data/oled/icons/clock/time_three.png similarity index 100% rename from data/icons/oled/clock/time_three.png rename to data/oled/icons/clock/time_three.png diff --git a/data/icons/oled/clock/time_two.png b/data/oled/icons/clock/time_two.png similarity index 100% rename from data/icons/oled/clock/time_two.png rename to data/oled/icons/clock/time_two.png diff --git a/data/icons/oled/clock/time_zero.png b/data/oled/icons/clock/time_zero.png similarity index 100% rename from data/icons/oled/clock/time_zero.png rename to data/oled/icons/clock/time_zero.png diff --git a/data/icons/oled/easy.png b/data/oled/icons/easy.png similarity index 100% rename from data/icons/oled/easy.png rename to data/oled/icons/easy.png diff --git a/data/icons/oled/medium.png b/data/oled/icons/medium.png similarity index 100% rename from data/icons/oled/medium.png rename to data/oled/icons/medium.png diff --git a/data/icons/oled/simple.png b/data/oled/icons/simple.png similarity index 100% rename from data/icons/oled/simple.png rename to data/oled/icons/simple.png diff --git a/data/icons/oled/standby.png b/data/oled/icons/standby.png similarity index 100% rename from data/icons/oled/standby.png rename to data/oled/icons/standby.png diff --git a/data/icons/oled/weather.png b/data/oled/icons/weather.png similarity index 100% rename from data/icons/oled/weather.png rename to data/oled/icons/weather.png diff --git a/data/icons/oled/weather/Makefile.am b/data/oled/icons/weather/Makefile.am similarity index 100% rename from data/icons/oled/weather/Makefile.am rename to data/oled/icons/weather/Makefile.am diff --git a/data/icons/oled/weather/clear-day.png b/data/oled/icons/weather/clear-day.png similarity index 100% rename from data/icons/oled/weather/clear-day.png rename to data/oled/icons/weather/clear-day.png diff --git a/data/icons/oled/weather/clear-night.png b/data/oled/icons/weather/clear-night.png similarity index 100% rename from data/icons/oled/weather/clear-night.png rename to data/oled/icons/weather/clear-night.png diff --git a/data/icons/oled/weather/cloudy.png b/data/oled/icons/weather/cloudy.png similarity index 100% rename from data/icons/oled/weather/cloudy.png rename to data/oled/icons/weather/cloudy.png diff --git a/data/icons/oled/weather/fog.png b/data/oled/icons/weather/fog.png similarity index 100% rename from data/icons/oled/weather/fog.png rename to data/oled/icons/weather/fog.png diff --git a/data/icons/oled/weather/hail.png b/data/oled/icons/weather/hail.png similarity index 100% rename from data/icons/oled/weather/hail.png rename to data/oled/icons/weather/hail.png diff --git a/data/icons/oled/weather/partly-cloudy-day.png b/data/oled/icons/weather/partly-cloudy-day.png similarity index 100% rename from data/icons/oled/weather/partly-cloudy-day.png rename to data/oled/icons/weather/partly-cloudy-day.png diff --git a/data/icons/oled/weather/partly-cloudy-night.png b/data/oled/icons/weather/partly-cloudy-night.png similarity index 100% rename from data/icons/oled/weather/partly-cloudy-night.png rename to data/oled/icons/weather/partly-cloudy-night.png diff --git a/data/icons/oled/weather/rain.png b/data/oled/icons/weather/rain.png similarity index 100% rename from data/icons/oled/weather/rain.png rename to data/oled/icons/weather/rain.png diff --git a/data/icons/oled/weather/sleet.png b/data/oled/icons/weather/sleet.png similarity index 100% rename from data/icons/oled/weather/sleet.png rename to data/oled/icons/weather/sleet.png diff --git a/data/icons/oled/weather/snow.png b/data/oled/icons/weather/snow.png similarity index 100% rename from data/icons/oled/weather/snow.png rename to data/oled/icons/weather/snow.png diff --git a/data/icons/oled/weather/thunderstorm.png b/data/oled/icons/weather/thunderstorm.png similarity index 100% rename from data/icons/oled/weather/thunderstorm.png rename to data/oled/icons/weather/thunderstorm.png diff --git a/data/icons/oled/weather/wind.png b/data/oled/icons/weather/wind.png similarity index 100% rename from data/icons/oled/weather/wind.png rename to data/oled/icons/weather/wind.png diff --git a/data/othemes/Makefile.am b/data/oled/themes/Makefile.am similarity index 79% rename from data/othemes/Makefile.am rename to data/oled/themes/Makefile.am index 655c7d8c9..f39a3ccb9 100644 --- a/data/othemes/Makefile.am +++ b/data/oled/themes/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(THEMESDIR) +installdir = $(THEMESDIR)/oled install_DATA = \ advanced.otheme \ diff --git a/data/othemes/advanced.otheme b/data/oled/themes/advanced.otheme similarity index 97% rename from data/othemes/advanced.otheme rename to data/oled/themes/advanced.otheme index a0033ad4e..bb37f365b 100644 --- a/data/othemes/advanced.otheme +++ b/data/oled/themes/advanced.otheme @@ -11,7 +11,7 @@ glcd_color_bg_blue=0 glcd_color_bar_red=0 glcd_color_bar_green=0 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_align_channel=2 glcd_align_epg=2 diff --git a/data/othemes/default.otheme b/data/oled/themes/default.otheme similarity index 97% rename from data/othemes/default.otheme rename to data/oled/themes/default.otheme index c859a3be4..8628c2d03 100644 --- a/data/othemes/default.otheme +++ b/data/oled/themes/default.otheme @@ -11,7 +11,7 @@ glcd_color_bg_blue=0 glcd_color_bar_red=0 glcd_color_bar_green=0 glcd_color_bar_blue=100 -glcd_font=/usr/share/fonts/neutrino.ttf +glcd_font=/share/fonts/neutrino.ttf glcd_background= glcd_align_channel=2 glcd_align_epg=2 diff --git a/data/othemes/easy.otheme b/data/oled/themes/easy.otheme similarity index 97% rename from data/othemes/easy.otheme rename to data/oled/themes/easy.otheme index f92e4aeae..186820de8 100644 --- a/data/othemes/easy.otheme +++ b/data/oled/themes/easy.otheme @@ -11,7 +11,7 @@ glcd_color_bg_blue=0 glcd_color_bar_red=0 glcd_color_bar_green=0 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_align_channel=2 glcd_align_epg=2 diff --git a/data/othemes/medium.otheme b/data/oled/themes/medium.otheme similarity index 98% rename from data/othemes/medium.otheme rename to data/oled/themes/medium.otheme index a803ac883..29303ba84 100644 --- a/data/othemes/medium.otheme +++ b/data/oled/themes/medium.otheme @@ -11,7 +11,7 @@ glcd_color_bg_blue=0 glcd_color_bar_red=0 glcd_color_bar_green=0 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_align_channel=2 glcd_align_epg=2 diff --git a/data/othemes/simple.otheme b/data/oled/themes/simple.otheme similarity index 97% rename from data/othemes/simple.otheme rename to data/oled/themes/simple.otheme index 2836d53b9..dbfcc55ae 100644 --- a/data/othemes/simple.otheme +++ b/data/oled/themes/simple.otheme @@ -11,7 +11,7 @@ glcd_color_bg_blue=0 glcd_color_bar_red=0 glcd_color_bar_green=0 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_align_channel=2 glcd_align_epg=2 diff --git a/data/othemes/weather.otheme b/data/oled/themes/weather.otheme similarity index 98% rename from data/othemes/weather.otheme rename to data/oled/themes/weather.otheme index 216f12207..2786fec70 100644 --- a/data/othemes/weather.otheme +++ b/data/oled/themes/weather.otheme @@ -11,7 +11,7 @@ glcd_color_bg_blue=0 glcd_color_bar_red=0 glcd_color_bar_green=0 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_align_channel=2 glcd_align_epg=2 diff --git a/src/driver/glcd.cpp b/src/driver/glcd.cpp index 8e7ef9dbc..a4b731311 100644 --- a/src/driver/glcd.cpp +++ b/src/driver/glcd.cpp @@ -320,7 +320,7 @@ void cGLCD::Exec() g_PicViewer->getSize(Logo.c_str(), &icon_start_width, &icon_start_height); 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; scrollChannelSkip = 0; } 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)) { fontsize_smalltext = fontsize_smalltext_new; - if (!font_smalltext.LoadFT2(/*t.glcd_font*/FONTDIR "/lcd.ttf", "UTF-8", fontsize_smalltext)) { - t.glcd_font = FONTDIR "/lcd.ttf"; + if (!font_smalltext.LoadFT2(FONTDIR "/oled/terminator.ttf", "UTF-8", fontsize_smalltext)) { + t.glcd_font = FONTDIR "/neutrino.ttf"; font_smalltext.LoadFT2(t.glcd_font, "UTF-8", fontsize_smalltext); } } diff --git a/src/driver/lcdclock.cpp b/src/driver/lcdclock.cpp index d75380680..3e2106834 100644 --- a/src/driver/lcdclock.cpp +++ b/src/driver/lcdclock.cpp @@ -1,5 +1,5 @@ /* - simple clock - DBoxII-Project + lcd clock - DBoxII-Project Copyright (C) 2018 redblue @@ -31,7 +31,7 @@ static bool fonts_initialized = false; -GLCD::cFont font_time_standby_second; +GLCD::cFont lcd_font_time_standby; void InitLcdClock(void) { @@ -47,9 +47,8 @@ void LcdClockUpdateFonts(void) int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100; if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) { fontsize_time_standby = fontsize_time_standby_new; - if (!font_time_standby_second.LoadFT2(/*t.glcd_font*/FONTDIR "/lcd.ttf", "UTF-8", fontsize_time_standby)) { - t.glcd_font = FONTDIR "/lcd.ttf"; - font_time_standby_second.LoadFT2(t.glcd_font, "UTF-8", fontsize_time_standby); + if (!lcd_font_time_standby.LoadFT2(FONTDIR "/oled/lcd.ttf", "UTF-8", fontsize_time_standby)) { + lcd_font_time_standby.LoadFT2(FONTDIR "/neutrino.ttf", "UTF-8", fontsize_time_standby); } } fonts_initialized = true; @@ -57,18 +56,19 @@ void LcdClockUpdateFonts(void) void RenderLcdClock(std::string Time, int x, int y) { + (void) x; cGLCD *cglcd = cGLCD::getInstance(); SNeutrinoGlcdTheme &t = g_settings.glcd_theme; 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, - &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) { cGLCD *cglcd = cGLCD::getInstance(); 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); } diff --git a/src/driver/ledclock.cpp b/src/driver/ledclock.cpp index 908194929..b18489c65 100644 --- a/src/driver/ledclock.cpp +++ b/src/driver/ledclock.cpp @@ -1,5 +1,5 @@ /* - simple clock - DBoxII-Project + led clock - DBoxII-Project Copyright (C) 2018 redblue @@ -31,7 +31,7 @@ static bool fonts_initialized = false; -GLCD::cFont second_font_time_standby; +GLCD::cFont led_font_time_standby; void InitLedClock(void) { @@ -47,9 +47,8 @@ void LedClockUpdateFonts(void) int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100; if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) { fontsize_time_standby = fontsize_time_standby_new; - if (!second_font_time_standby.LoadFT2(/*t.glcd_font*/FONTDIR "/led.ttf", "UTF-8", fontsize_time_standby)) { - t.glcd_font = FONTDIR "/led.ttf"; - second_font_time_standby.LoadFT2(t.glcd_font, "UTF-8", fontsize_time_standby); + if (!led_font_time_standby.LoadFT2(FONTDIR "/oled/led.ttf", "UTF-8", fontsize_time_standby)) { + led_font_time_standby.LoadFT2(FONTDIR "/neutrino.ttf", "UTF-8", fontsize_time_standby); } } fonts_initialized = true; @@ -57,18 +56,19 @@ void LedClockUpdateFonts(void) void RenderLedClock(std::string Time, int x, int y) { + (void) x; cGLCD *cglcd = cGLCD::getInstance(); SNeutrinoGlcdTheme &t = g_settings.glcd_theme; 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, - &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) { cGLCD *cglcd = cGLCD::getInstance(); 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); } diff --git a/src/gui/glcdthemes.cpp b/src/gui/glcdthemes.cpp index ffa30a2b7..0a2e4fdc4 100644 --- a/src/gui/glcdthemes.cpp +++ b/src/gui/glcdthemes.cpp @@ -51,7 +51,6 @@ #include "glcdthemes.h" -#define USERDIR "/var" THEMESDIR #define FILE_SUFFIX ".otheme" 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 ) { 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 - 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; } OnAfterSelectTheme(); @@ -118,7 +117,7 @@ void CGLCDThemes::initThemesMenu(CMenuWidget &themes) { struct dirent **themelist; int n; - const char *pfade[] = {THEMESDIR, THEMESDIR_VAR}; + const char *pfade[] = {THEMESDIR "/oled", THEMESDIR_VAR "/oled"}; bool hasCVSThemes, hasUserThemes; hasCVSThemes = hasUserThemes = false; std::string userThemeFile = ""; @@ -176,8 +175,6 @@ void CGLCDThemes::initThemesMenu(CMenuWidget &themes) int CGLCDThemes::Show() { - move_userDir(); - std::string file_name = ""; CMenuWidget themes (LOCALE_COLORMENU_MENUCOLORS, NEUTRINO_ICON_SETTINGS, width); @@ -197,22 +194,22 @@ int CGLCDThemes::Show() 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 glcd theme] error creating %s\n", THEMESDIR_VAR); + if (!CFileHelpers::createDir(THEMESDIR_VAR "/oled")) { + 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(m1); } else { 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, ""); 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) { @@ -265,7 +262,7 @@ void CGLCDThemes::saveFile(const char *themename) bool CGLCDThemes::applyDefaultTheme() { 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)){ getTheme(themefile); return true; @@ -428,42 +425,6 @@ void CGLCDThemes::getTheme(CConfigFile &configfile) 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) { for (int i = 0; i < w->getItemsCount(); i++){ diff --git a/src/gui/glcdthemes.h b/src/gui/glcdthemes.h index f1421b7ff..12049bfa8 100644 --- a/src/gui/glcdthemes.h +++ b/src/gui/glcdthemes.h @@ -48,7 +48,6 @@ class CGLCDThemes : public CMenuTarget, CColorSetupNotifier, public sigc::tracka void saveFile(const char *themename); void initThemesMenu(CMenuWidget &); void rememberOldTheme(bool remember); - void move_userDir(); bool applyDefaultTheme(); ///signal after select theme is completed sigc::signal OnAfterSelectTheme;