Origin commit data
------------------
Commit: c7fa4276e5
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-12-28 (Wed, 28 Dec 2016)
This commit is contained in:
vanhofen
2016-12-28 20:24:39 +01:00
4 changed files with 34 additions and 43 deletions

View File

@@ -107,22 +107,22 @@ void CComponentsTimer::initThread()
void CComponentsTimer::stopThread()
{
//ensure disconnecting possible slots
while (!sl_stop_timer.empty())
sl_stop_timer.disconnect();
if(tm_thread) {
int thres = pthread_cancel(tm_thread);
if (thres != 0)
dprintf(DEBUG_NORMAL,"\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_cancel\033[0m\n", __func__, __LINE__);
dprintf(DEBUG_NORMAL,"\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_cancel, [%d]\033[0m\n", __func__, __LINE__, thres);
thres = pthread_join(tm_thread, NULL);
if (thres != 0)
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_join\033[0m\n", __func__, __LINE__);
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_join, [%d]\033[0m\n", __func__, __LINE__, thres);
if (thres == 0){
if (thres == 0)
tm_thread = 0;
//ensure disconnect of unused slot
while (!sl_stop_timer.empty())
sl_stop_timer.disconnect();
}
}
}

View File

@@ -81,8 +81,6 @@ CMsgBox::CMsgBox( const char* Text,
void CMsgBox::init(const int& Height, const int& ShowButtons, const msg_result_t& Default_result)
{
dprintf(DEBUG_NORMAL, "[CMsgBox] [%s - %d] \n", __func__, __LINE__);
initTimeOut();
//enable footer and add its height

View File

@@ -47,36 +47,14 @@
CStringInput::CStringInput(const neutrino_locale_t Name, std::string* Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
{
title = g_Locale->getText(Name);
valueString = Value;
lower_bound = -1;
upper_bound = -1;
size = Size;
hint_1 = Hint_1;
hint_2 = Hint_2;
validchars = Valid_Chars;
iconfile = Icon ? Icon : "";
observ = Observ;
init();
name = Name;
init(g_Locale->getText(name), Value, Size, Hint_1, Hint_2, Valid_Chars, Observ, Icon);
}
CStringInput::CStringInput(const std::string &Name, std::string *Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
{
title = Name;
valueString = Value;
lower_bound = -1;
upper_bound = -1;
size = Size;
hint_1 = Hint_1;
hint_2 = Hint_2;
validchars = Valid_Chars;
iconfile = Icon ? Icon : "";
observ = Observ;
init();
name = NONEXISTANT_LOCALE;
init(Name, Value, Size, Hint_1, Hint_2, Valid_Chars, Observ, Icon);
}
CStringInput::~CStringInput()
@@ -97,10 +75,23 @@ const struct button_label CStringInputSMSButtons[CStringInputSMSButtonsCount] =
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_STRINGINPUT_CLEAR }
};
void CStringInput::init()
void CStringInput::init(const std::string &Name, std::string *Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon)
{
frameBuffer = CFrameBuffer::getInstance();
head = Name;
valueString = Value;
lower_bound = -1;
upper_bound = -1;
size = Size;
hint_1 = Hint_1;
hint_2 = Hint_2;
validchars = Valid_Chars;
iconfile = Icon ? Icon : "";
observ = Observ;
#ifdef DEBUG_STRINGINPUT
printf("HEAD: %s (len: %d)\n", head, strlen(head));
#endif
@@ -113,7 +104,7 @@ void CStringInput::init()
width = std::max(size*input_w + 2*offset, (int) frameBuffer->getScreenWidth() / 100 * 45);
int tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(title);
int tmp_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(head);
if (!(iconfile.empty()))
{
@@ -494,8 +485,9 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
}
else if ( (msg==CRCInput::RC_home) || (msg==CRCInput::RC_timeout) )
{
string tmp_name = name == NONEXISTANT_LOCALE ? head : g_Locale->getText(name);
if ((trim (*valueString) != trim(oldval)) &&
(ShowMsg(title, LOCALE_MESSAGEBOX_DISCARD, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbCancel) == CMsgBox::mbrCancel)) {
(ShowMsg(tmp_name, LOCALE_MESSAGEBOX_DISCARD, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbCancel) == CMsgBox::mbrCancel)) {
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
continue;
}
@@ -540,7 +532,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & )
if ( (observ) && (msg==CRCInput::RC_ok) )
{
observ->changeNotify(title, (void *) valueString->c_str());
observ->changeNotify(name, (void *) valueString->c_str());
}
return res;
}
@@ -561,7 +553,7 @@ void CStringInput::paint(bool sms)
frameBuffer->paintBoxRel(x + OFFSET_SHADOW, y + OFFSET_SHADOW, width, height, COL_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_ALL); //round
frameBuffer->paintBoxRel(x, y + hheight, width, bheight, COL_MENUCONTENT_PLUS_0, sms ? 0 : RADIUS_LARGE, CORNER_BOTTOM);
CComponentsHeader header(x, y, width, hheight, title, iconfile);
CComponentsHeader header(x, y, width, hheight, head, iconfile);
header.paint(CC_SAVE_SCREEN_NO);
int tmp_y = y+ hheight+ offset+ input_h+ offset;
@@ -859,7 +851,7 @@ int CPINInput::exec( CMenuTarget* parent, const std::string & )
if ( (observ) && (msg==CRCInput::RC_ok) )
{
observ->changeNotify(title, (void *) valueString->c_str());
observ->changeNotify(name, (void *) valueString->c_str());
}
return res;

View File

@@ -53,7 +53,8 @@ class CStringInput : public CMenuTarget
uint32_t smstimer;
std::string title;
std::string head;
neutrino_locale_t name;
neutrino_locale_t hint_1, hint_2;
std::string iconfile;
const char * validchars;
@@ -63,7 +64,7 @@ class CStringInput : public CMenuTarget
bool force_saveScreen;
fb_pixel_t *pixBuf;
virtual void init();
virtual void init(const std::string &Name, std::string *Value, int Size, const neutrino_locale_t Hint_1, const neutrino_locale_t Hint_2, const char * const Valid_Chars, CChangeObserver* Observ, const char * const Icon);
virtual void paint(bool sms = false);
virtual void paintChar(int pos, char c);