From 22158b9e170b7cfa24a4a3d33fe57dcad7cfab62 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 25 May 2016 23:15:37 +0200 Subject: [PATCH] move FLAGDIR definition to global.h; ... ... use CTouchFileNotifier to handle .hddpower flagfile Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0cdacc196ed0516ac411ecbe6c3f58657bb155ec Author: vanhofen Date: 2016-05-25 (Wed, 25 May 2016) Origin message was: ------------------ - move FLAGDIR definition to global.h; ... ... use CTouchFileNotifier to handle .hddpower flagfile ------------------ This commit was generated by Migit --- src/gui/hdd_menu.cpp | 9 ++++----- src/gui/lcd4l_setup.cpp | 6 ++---- src/gui/ni_menu.cpp | 10 +--------- src/gui/ni_menu.h | 1 - 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index cebd4f1ec..f83812966 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -45,7 +45,6 @@ #include "hdd_menu.h" #include //NI -#include //NI #include #include #include @@ -736,10 +735,10 @@ _show_menu: hddmenu->addItem(new CMenuSeparator()); if (cs_get_revision() < 8) { //NI HDD power (HD1/BSE only) - int flag_hddpower = file_exists(FLAG_DIR ".hddpower"); - - CNITouchFileNotifier * hddpowerNotifier = new CNITouchFileNotifier("hddpower"); - mc = new CMenuOptionChooser(LOCALE_HDD_POWER, &flag_hddpower, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, hddpowerNotifier, CRCInput::RC_yellow); + const char *flag_hddpower = FLAGDIR "/.hddpower"; + int fake_hddpower = file_exists(flag_hddpower); + CTouchFileNotifier * hddpowerNotifier = new CTouchFileNotifier(flag_hddpower); + mc = new CMenuOptionChooser(LOCALE_HDD_POWER, &fake_hddpower, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, hddpowerNotifier, CRCInput::RC_yellow); mc->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, LOCALE_MENU_HINT_HDD_POWER); hddmenu->addItem(mc); hddmenu->addItem(new CMenuSeparator()); diff --git a/src/gui/lcd4l_setup.cpp b/src/gui/lcd4l_setup.cpp index df28b42ce..b3dbc4d28 100644 --- a/src/gui/lcd4l_setup.cpp +++ b/src/gui/lcd4l_setup.cpp @@ -56,8 +56,6 @@ #include "gui/lcd4l.h" extern CLCD4l *LCD4l; -#define FLAG_DIR "/var/etc/" - const CMenuOptionChooser::keyval LCD4L_SUPPORT_OPTIONS[] = { { 0, LOCALE_LCD4L_SUPPORT_OFF }, @@ -146,14 +144,14 @@ int CLCD4lSetup::show() mc->setHint(NEUTRINO_ICON_HINT_LCD4L, LOCALE_MENU_HINT_LCD4L_SKIN); lcd4lSetup->addItem(mc); - const char *flag_lcd4l_weather = FLAG_DIR ".lcd-weather"; + const char *flag_lcd4l_weather = FLAGDIR "/.lcd-weather"; int fake_lcd4l_weather = file_exists(flag_lcd4l_weather); CTouchFileNotifier * lcd_weather = new CTouchFileNotifier(flag_lcd4l_weather); mc = new CMenuOptionChooser(LOCALE_LCD4L_WEATHER, &fake_lcd4l_weather, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, (file_exists("/share/lcd/scripts/weather")), lcd_weather, CRCInput::convertDigitToKey(shortcut++)); mc->setHint(NEUTRINO_ICON_HINT_LCD4L, LOCALE_MENU_HINT_LCD4L_WEATHER); lcd4lSetup->addItem(mc); - const char *flag_lcd4l_clock_a = FLAG_DIR ".lcd-clock_a"; + const char *flag_lcd4l_clock_a = FLAGDIR "/.lcd-clock_a"; int fake_lcd4l_clock_a = file_exists(flag_lcd4l_clock_a); CTouchFileNotifier * lcd_clock_a = new CTouchFileNotifier(flag_lcd4l_clock_a); mc = new CMenuOptionChooser(LOCALE_LCD4L_CLOCK_A, &fake_lcd4l_clock_a, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, lcd_clock_a, CRCInput::convertDigitToKey(shortcut++)); diff --git a/src/gui/ni_menu.cpp b/src/gui/ni_menu.cpp index 32b881bd9..a9c832a5c 100644 --- a/src/gui/ni_menu.cpp +++ b/src/gui/ni_menu.cpp @@ -200,7 +200,7 @@ bool CNITouchFileNotifier::changeNotify(const neutrino_locale_t, void * data) { std::ostringstream buf; - buf << FLAG_DIR << "." << filename; + buf << FLAGDIR << "/." << filename; std::string flag = buf.str(); if ((*(int *)data) != 0) @@ -251,10 +251,6 @@ bool CNITouchFileNotifier::changeNotify(const neutrino_locale_t, void * data) sleep(1); delete hintbox; } - else if (strstr(filename, "hddpower")) - { - // do nothing - } else { buf.str(""); @@ -308,10 +304,6 @@ bool CNITouchFileNotifier::changeNotify(const neutrino_locale_t, void * data) sleep(1); delete hintbox; } - else if (strstr(filename, "hddpower")) - { - // do nothing - } else { buf << "service " << filename << " stop"; diff --git a/src/gui/ni_menu.h b/src/gui/ni_menu.h index 34a498081..c010dbca0 100644 --- a/src/gui/ni_menu.h +++ b/src/gui/ni_menu.h @@ -29,7 +29,6 @@ #define SCRIPT_DIR "/etc/init.d/" #define EMU_DIR "/var/bin/" -#define FLAG_DIR "/var/etc/" #define EMU_START_SCRIPT SCRIPT_DIR "emu" using namespace std;