move FLAGDIR definition to global.h; ...

... use CTouchFileNotifier to handle .hddpower flagfile


Origin commit data
------------------
Branch: ni/coolstream
Commit: 0cdacc196e
Author: vanhofen <vanhofen@gmx.de>
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
This commit is contained in:
vanhofen
2016-05-25 23:15:37 +02:00
parent 35fbab6f4c
commit 22158b9e17
4 changed files with 7 additions and 19 deletions

View File

@@ -45,7 +45,6 @@
#include "hdd_menu.h"
#include <cs_api.h> //NI
#include <gui/ni_menu.h> //NI
#include <gui/widget/icons.h>
#include <gui/widget/stringinput.h>
#include <gui/widget/messagebox.h>
@@ -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());

View File

@@ -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++));

View File

@@ -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";

View File

@@ -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;