- bookmarkmanager: formatting code using astyle; some manual code nicenings

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2021-12-14 11:11:25 +01:00
committed by Thilo Graf
parent 62253613e1
commit 38e3181064
2 changed files with 166 additions and 184 deletions

View File

@@ -57,17 +57,15 @@
#define info_height 60 #define info_height 60
CBookmark::CBookmark(const std::string &inName, const std::string &inUrl, const std::string &inTime)
CBookmark::CBookmark(const std::string & inName, const std::string & inUrl, const std::string & inTime)
{ {
name = inName; name = inName;
url = inUrl; url = inUrl;
time = inTime; time = inTime;
} }
//------------------------------ int CBookmarkManager::addBookmark(CBookmark inBookmark)
{
int CBookmarkManager::addBookmark (CBookmark inBookmark) {
if (bookmarks.size() < MAXBOOKMARKS) if (bookmarks.size() < MAXBOOKMARKS)
{ {
bookmarks.push_back(inBookmark); bookmarks.push_back(inBookmark);
@@ -79,12 +77,13 @@ int CBookmarkManager::addBookmark (CBookmark inBookmark) {
return -1; return -1;
} }
//------------------------------------------------------------------------ inline int CBookmarkManager::createBookmark(const std::string &name, const std::string &url, const std::string &time)
inline int CBookmarkManager::createBookmark (const std::string & name, const std::string & url, const std::string & time) { {
return addBookmark(CBookmark(name, url, time)); return addBookmark(CBookmark(name, url, time));
} }
int CBookmarkManager::createBookmark (const std::string & url, const std::string & time) { int CBookmarkManager::createBookmark(const std::string &url, const std::string &time)
{
std::string bookmarkname; std::string bookmarkname;
CStringInputSMS bookmarkname_input(LOCALE_MOVIEPLAYER_BOOKMARKNAME, &bookmarkname, 25, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT1, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-_", this); CStringInputSMS bookmarkname_input(LOCALE_MOVIEPLAYER_BOOKMARKNAME, &bookmarkname, 25, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT1, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-_", this);
bookmarkname_input.exec(NULL, ""); bookmarkname_input.exec(NULL, "");
@@ -96,36 +95,36 @@ int CBookmarkManager::createBookmark (const std::string & url, const std::string
return -1; return -1;
} }
//------------------------------------------------------------------------
#if 0 #if 0
//never used // never used
void CBookmarkManager::removeBookmark (unsigned int index) { void CBookmarkManager::removeBookmark(unsigned int index)
std::vector<CBookmark>::iterator p = bookmarks.begin()+index; {
std::vector<CBookmark>::iterator p = bookmarks.begin() + index;
bookmarks.erase(p); bookmarks.erase(p);
bookmarksmodified=true; bookmarksmodified = true;
} }
//------------------------------------------------------------------------ void CBookmarkManager::renameBookmark(unsigned int index)
{
void CBookmarkManager::renameBookmark (unsigned int index) {
if (index >= bookmarks.size()) if (index >= bookmarks.size())
return; return;
CBookmark & theBookmark = bookmarks[index]; CBookmark &theBookmark = bookmarks[index];
char bookmarkname[26]; char bookmarkname[26];
strncpy (bookmarkname, theBookmark.getName(), 25); strncpy(bookmarkname, theBookmark.getName(), 25);
CStringInputSMS bookmarkname_input(LOCALE_MOVIEPLAYER_BOOKMARKNAME, bookmarkname, 25, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT1, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-_"); CStringInputSMS bookmarkname_input(LOCALE_MOVIEPLAYER_BOOKMARKNAME, bookmarkname, 25, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT1, LOCALE_MOVIEPLAYER_BOOKMARKNAME_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-_");
bookmarkname_input.exec(NULL, ""); bookmarkname_input.exec(NULL, "");
if (strcmp(theBookmark.getName(), bookmarkname) != 0) if (strcmp(theBookmark.getName(), bookmarkname) != 0)
{ {
theBookmark.setName(std::string(bookmarkname)); theBookmark.setName(std::string(bookmarkname));
bookmarksmodified=true; bookmarksmodified = true;
} }
} }
#endif #endif
//------------------------------------------------------------------------
void CBookmarkManager::readBookmarkFile() { void CBookmarkManager::readBookmarkFile()
{
if (bookmarkfile.loadConfig(BOOKMARKFILE)) if (bookmarkfile.loadConfig(BOOKMARKFILE))
{ {
bookmarksmodified = false; bookmarksmodified = false;
@@ -147,8 +146,8 @@ void CBookmarkManager::readBookmarkFile() {
} }
} }
//------------------------------------------------------------------------ void CBookmarkManager::writeBookmarkFile()
void CBookmarkManager::writeBookmarkFile() { {
printf("CBookmarkManager: Writing bookmark file\n"); printf("CBookmarkManager: Writing bookmark file\n");
@@ -167,55 +166,49 @@ void CBookmarkManager::writeBookmarkFile() {
bookmarksmodified = false; bookmarksmodified = false;
} }
//------------------------------------------------------------------------ CBookmarkManager::CBookmarkManager() : bookmarkfile('\t')
CBookmarkManager::CBookmarkManager() : bookmarkfile ('\t')
{ {
bookmarkname_entered = false; bookmarkname_entered = false;
bookmarksmodified = false; bookmarksmodified = false;
readBookmarkFile(); readBookmarkFile();
} }
//------------------------------------------------------------------------ CBookmarkManager::~CBookmarkManager()
{
CBookmarkManager::~CBookmarkManager () {
flush(); flush();
} }
//------------------------------------------------------------------------
bool CBookmarkManager::changeNotify(const neutrino_locale_t, void *) bool CBookmarkManager::changeNotify(const neutrino_locale_t, void *)
{ {
bookmarkname_entered = true; bookmarkname_entered = true;
return false; return false;
} }
//------------------------------------------------------------------------
#if 0 #if 0
//never used // never used
int CBookmarkManager::getBookmarkCount(void) const { int CBookmarkManager::getBookmarkCount(void) const
{
return bookmarks.size(); return bookmarks.size();
} }
//------------------------------------------------------------------------ int CBookmarkManager::getMaxBookmarkCount(void) const
{
int CBookmarkManager::getMaxBookmarkCount(void) const {
return MAXBOOKMARKS; return MAXBOOKMARKS;
} }
#endif #endif
//------------------------------------------------------------------------
void CBookmarkManager::flush() { void CBookmarkManager::flush()
if (bookmarksmodified) { {
if (bookmarksmodified)
{
writeBookmarkFile(); writeBookmarkFile();
} }
} }
//------------------------------------------------------------------------
#if 0 #if 0
//never used // never used
const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent) const CBookmark *CBookmarkManager::getBookmark(CMenuTarget *parent)
{ {
if (parent) if (parent)
{ {
@@ -227,26 +220,26 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
selected = 0; selected = 0;
// Max // Max
width = 90; width = 90;
footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight()+8; //initial height value for buttonbar footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight() + 8; // initial height value for buttonbar
theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
x=getScreenStartX( width ); x = getScreenStartX(width);
y=getScreenStartY( height + info_height ); y = getScreenStartY(height + info_height);
listmaxshow = (height-theight-0)/(fheight*2); listmaxshow = (height - theight - 0) / (fheight * 2);
liststart = 0; liststart = 0;
height = (g_settings.screen_EndY-g_settings.screen_StartY)-(info_height+50); height = (g_settings.screen_EndY - g_settings.screen_StartY) - (info_height + 50);
listmaxshow = (height-theight-0)/(fheight*2); listmaxshow = (height - theight - 0) / (fheight * 2);
height = theight+0+listmaxshow*fheight*2; // recalc height height = theight + 0 + listmaxshow * fheight * 2; // recalc height
if (bookmarks.size() < listmaxshow) if (bookmarks.size() < listmaxshow)
{ {
listmaxshow=bookmarks.size(); listmaxshow = bookmarks.size();
height = theight+0+listmaxshow*fheight*2; // recalc height height = theight + 0 + listmaxshow * fheight * 2; // recalc height
} }
if ((!bookmarks.empty() && selected==bookmarks.size())) if ((!bookmarks.empty() && selected == bookmarks.size()))
{ {
selected=bookmarks.size()-1; selected = bookmarks.size() - 1;
liststart = (selected/listmaxshow)*listmaxshow; liststart = (selected / listmaxshow) * listmaxshow;
} }
@@ -256,40 +249,41 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
neutrino_msg_t msg; neutrino_msg_t msg;
neutrino_msg_data_t data; neutrino_msg_data_t data;
bool loop=true; bool loop = true;
bool update=true; bool update = true;
while (loop) while (loop)
{ {
if (update) if (update)
{ {
hide(); hide();
update=false; update = false;
paint(); paint();
} }
g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd);
if ( msg <= CRCInput::RC_MaxRC ) if (msg <= CRCInput::RC_MaxRC)
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]); timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU]);
if ( ( msg == CRCInput::RC_timeout ) || if ((msg == CRCInput::RC_timeout) ||
( msg == CRCInput::RC_home) ) (msg == CRCInput::RC_home))
{ //Exit after timeout or cancel key {
// Exit after timeout or cancel key
res = -1; res = -1;
loop=false; loop = false;
} }
else if ((msg == CRCInput::RC_up) && !(bookmarks.empty())) else if ((msg == CRCInput::RC_up) && !(bookmarks.empty()))
{ {
int prevselected=selected; int prevselected = selected;
if (selected==0) if (selected == 0)
{ {
selected = bookmarks.size()-1; selected = bookmarks.size() - 1;
} }
else else
selected--; selected--;
paintItem(prevselected - liststart); paintItem(prevselected - liststart);
unsigned int oldliststart = liststart; unsigned int oldliststart = liststart;
liststart = (selected/listmaxshow)*listmaxshow; liststart = (selected / listmaxshow) * listmaxshow;
if (oldliststart!=liststart) if (oldliststart != liststart)
{ {
paint(); paint();
} }
@@ -300,12 +294,12 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
} }
else if ((msg == CRCInput::RC_down) && !(bookmarks.empty())) else if ((msg == CRCInput::RC_down) && !(bookmarks.empty()))
{ {
int prevselected=selected; int prevselected = selected;
selected = (selected+1)%bookmarks.size(); selected = (selected + 1) % bookmarks.size();
paintItem(prevselected - liststart); paintItem(prevselected - liststart);
unsigned int oldliststart = liststart; unsigned int oldliststart = liststart;
liststart = (selected/listmaxshow)*listmaxshow; liststart = (selected / listmaxshow) * listmaxshow;
if (oldliststart!=liststart) if (oldliststart != liststart)
{ {
paint(); paint();
} }
@@ -317,35 +311,34 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
else if ((msg == CRCInput::RC_ok) && !(bookmarks.empty())) else if ((msg == CRCInput::RC_ok) && !(bookmarks.empty()))
{ {
res = selected; res = selected;
loop=false; loop = false;
} }
else if ((msg == CRCInput::RC_red) && !(bookmarks.empty())) else if ((msg == CRCInput::RC_red) && !(bookmarks.empty()))
{ {
removeBookmark(selected); removeBookmark(selected);
update=true; update = true;
} }
else if ((msg==CRCInput::RC_yellow) && !(bookmarks.empty())) else if ((msg == CRCInput::RC_yellow) && !(bookmarks.empty()))
{ {
renameBookmark(selected); renameBookmark(selected);
update=true; update = true;
} }
else if ((msg==CRCInput::RC_blue)||(msg==CRCInput::RC_green)|| else if ((msg == CRCInput::RC_blue) || (msg == CRCInput::RC_green) || (CRCInput::isNumeric(msg)))
(CRCInput::isNumeric(msg)) )
{ {
//Ignore // Ignore
} }
else if (msg==CRCInput::RC_setup) else if (msg == CRCInput::RC_setup)
{ {
res=-1; res = -1;
loop=false; loop = false;
} }
else if ( msg == CRCInput::RC_help ) else if (msg == CRCInput::RC_help)
{ {
// TODO Add Help // TODO Add Help
} }
else else
{ {
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all)
{ {
loop = false; loop = false;
res = menu_return::RETURN_EXIT_ALL; res = menu_return::RETURN_EXIT_ALL;
@@ -354,16 +347,16 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent)
} }
hide(); hide();
if ((res >=0) && (((unsigned int)res) < bookmarks.size())) if ((res >= 0) && (((unsigned int)res) < bookmarks.size()))
return &bookmarks[res]; return &bookmarks[res];
else else
return NULL; return NULL;
} }
#endif #endif
//------------------------------------------------------------------------
void CBookmarkManager::paintItem(int pos) void CBookmarkManager::paintItem(int pos)
{ {
int ypos = y+ theight+0 + pos*fheight*2; int ypos = y + theight + 0 + pos * fheight * 2;
unsigned int currpos = liststart + pos; unsigned int currpos = liststart + pos;
@@ -376,40 +369,37 @@ void CBookmarkManager::paintItem(int pos)
getItemColors(color, bgcolor, i_selected, i_marked, i_switch); getItemColors(color, bgcolor, i_selected, i_marked, i_switch);
int real_width=width; int real_width = width;
if (bookmarks.size()>listmaxshow) if (bookmarks.size() > listmaxshow)
{ {
real_width-=15; //scrollbar real_width -= 15; // scrollbar
} }
frameBuffer->paintBoxRel(x,ypos, real_width, 2*fheight, bgcolor); frameBuffer->paintBoxRel(x, ypos, real_width, 2 * fheight, bgcolor);
if (currpos < bookmarks.size()) if (currpos < bookmarks.size())
{ {
CBookmark theBookmark = bookmarks[currpos]; CBookmark theBookmark = bookmarks[currpos];
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10,ypos+fheight, real_width-10, theBookmark.getName(), color, fheight); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + 10, ypos + fheight, real_width - 10, theBookmark.getName(), color, fheight);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10,ypos+2*fheight, real_width-10, theBookmark.getUrl(), color, fheight); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + 10, ypos + 2 * fheight, real_width - 10, theBookmark.getUrl(), color, fheight);
// LCD Display // LCD Display
if (i_selected) if (i_selected)
{ {
CVFD::getInstance()->showMenuText(0, theBookmark.getName(), -1, true); // UTF-8 CVFD::getInstance()->showMenuText(0, theBookmark.getName(), -1, true);
CVFD::getInstance()->showMenuText(1, theBookmark.getUrl(), -1, true); // UTF-8 CVFD::getInstance()->showMenuText(1, theBookmark.getUrl(), -1, true);
} }
} }
} }
//------------------------------------------------------------------------
void CBookmarkManager::hide() void CBookmarkManager::hide()
{ {
if (visible) if (visible)
{ {
frameBuffer->paintBackgroundBoxRel(x, y, width, height+ info_height+ 5); frameBuffer->paintBackgroundBoxRel(x, y, width, height + info_height + 5);
visible = false; visible = false;
} }
} }
//------------------------------------------------------------------------
void CBookmarkManager::paintHead() void CBookmarkManager::paintHead()
{ {
CComponentsHeader header(x, y, width, theight, LOCALE_BOOKMARKMANAGER_NAME, NEUTRINO_ICON_BOOKMARK_MANAGER, CComponentsHeader::CC_BTN_HELP); CComponentsHeader header(x, y, width, theight, LOCALE_BOOKMARKMANAGER_NAME, NEUTRINO_ICON_BOOKMARK_MANAGER, CComponentsHeader::CC_BTN_HELP);
@@ -418,31 +408,30 @@ void CBookmarkManager::paintHead()
const struct button_label BookmarkmanagerButtons[2] = const struct button_label BookmarkmanagerButtons[2] =
{ {
{ NEUTRINO_ICON_BUTTON_RED , LOCALE_BOOKMARKMANAGER_DELETE }, { NEUTRINO_ICON_BUTTON_RED, LOCALE_BOOKMARKMANAGER_DELETE },
{ NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOOKMARKMANAGER_RENAME } { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOOKMARKMANAGER_RENAME }
}; };
//------------------------------------------------------------------------
void CBookmarkManager::paintFoot() void CBookmarkManager::paintFoot()
{ {
int ButtonWidth = (width - 20) / 4; int ButtonWidth = (width - 20) / 4;
frameBuffer->paintBoxRel(x,y+height, width, footerHeight, COL_MENUFOOT_PLUS_0); frameBuffer->paintBoxRel(x, y + height, width, footerHeight, COL_MENUFOOT_PLUS_0);
frameBuffer->paintHLine(x, x+width, y, COL_MENUFOOT_PLUS_0); frameBuffer->paintHLine(x, x + width, y, COL_MENUFOOT_PLUS_0);
if (bookmarks.empty()) { if (bookmarks.empty())
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, x+width- 1* ButtonWidth + 10, y+height); {
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->RenderString(x+width-1 * ButtonWidth + 38, y+height+footerHeight - 2, ButtonWidth- 28, g_Locale->getText(LOCALE_BOOKMARKMANAGER_SELECT), COL_INFOBAR_TEXT); frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, x + width - 1 * ButtonWidth + 10, y + height);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->RenderString(x + width - 1 * ButtonWidth + 38, y + height + footerHeight - 2, ButtonWidth - 28, g_Locale->getText(LOCALE_BOOKMARKMANAGER_SELECT), COL_INFOBAR_TEXT);
} }
else else
{ {
::paintButtons(x + 10, y + height + 4, width, 2, BookmarkmanagerButtons, footerHeight, ButtonWidth); ::paintButtons(x + 10, y + height + 4, width, 2, BookmarkmanagerButtons, footerHeight, ButtonWidth);
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, x+width- 1* ButtonWidth + 10, y+height); frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, x + width - 1 * ButtonWidth + 10, y + height);
g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->RenderString(x+width-1 * ButtonWidth + 38, y+height+footerHeight - 2, ButtonWidth- 28, g_Locale->getText(LOCALE_BOOKMARKMANAGER_SELECT), COL_INFOBAR_TEXT); g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->RenderString(x + width - 1 * ButtonWidth + 38, y + height + footerHeight - 2, ButtonWidth - 28, g_Locale->getText(LOCALE_BOOKMARKMANAGER_SELECT), COL_INFOBAR_TEXT);
} }
} }
//------------------------------------------------------------------------
void CBookmarkManager::paint() void CBookmarkManager::paint()
{ {
unsigned int page_nr = (listmaxshow == 0) ? 0 : (selected / listmaxshow); unsigned int page_nr = (listmaxshow == 0) ? 0 : (selected / listmaxshow);
@@ -452,26 +441,24 @@ void CBookmarkManager::paint()
paintHead(); paintHead();
for (unsigned int count=0; count<listmaxshow; count++) for (unsigned int count = 0; count < listmaxshow; count++)
{
paintItem(count); paintItem(count);
}
if (bookmarks.size()>listmaxshow) if (bookmarks.size() > listmaxshow)
{ {
int ypos = y+ theight; int ypos = y + theight;
int sb = 2*fheight* listmaxshow; int sb = 2 * fheight * listmaxshow;
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); frameBuffer->paintBoxRel(x + width - 15, ypos, 15, sb, COL_SCROLLBAR_PLUS_0);
unsigned int tmp_max = listmaxshow; unsigned int tmp_max = listmaxshow;
if(!tmp_max) if (!tmp_max)
tmp_max = 1; tmp_max = 1;
int sbc= ((bookmarks.size()- 1)/ tmp_max)+ 1; int sbc = ((bookmarks.size() - 1) / tmp_max) + 1;
if (sbc < 1) if (sbc < 1)
sbc = 1; sbc = 1;
frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ page_nr * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); frameBuffer->paintBoxRel(x + width - 13, ypos + 2 + page_nr * (sb - 4) / sbc, 11, (sb - 4) / sbc, COL_SCROLLBAR_ACTIVE_PLUS_0);
} }
paintFoot(); paintFoot();
visible = true; visible = true;
} }

View File

@@ -47,71 +47,66 @@
class CFramebuffer; class CFramebuffer;
class CBookmark class CBookmark
{ {
private: private:
std::string name; std::string name;
std::string url; std::string url;
std::string time; std::string time;
public: public:
CBookmark(const std::string & name, const std::string & url, const std::string & time); CBookmark(const std::string &name, const std::string &url, const std::string &time);
const char *getName(void) const { return name.c_str(); }; const char *getName(void) const { return name.c_str(); };
const char *getUrl (void) const { return url .c_str(); }; const char *getUrl(void) const { return url .c_str(); };
const char *getTime(void) const { return time.c_str(); }; const char *getTime(void) const { return time.c_str(); };
inline void setName(const std::string & new_name) { name = new_name; }; inline void setName(const std::string &new_name) { name = new_name; };
inline void setUrl (const std::string & new_url ) { url = new_url ; }; inline void setUrl(const std::string &new_url) { url = new_url ; };
inline void setTime(const std::string & new_time) { time = new_time; }; inline void setTime(const std::string &new_time) { time = new_time; };
}; };
//-----------------------------------------
class CBookmarkManager : public CChangeObserver class CBookmarkManager : public CChangeObserver
{ {
private: private:
std::vector<CBookmark> bookmarks; std::vector<CBookmark> bookmarks;
CConfigFile bookmarkfile; CConfigFile bookmarkfile;
CFrameBuffer *frameBuffer; CFrameBuffer *frameBuffer;
unsigned int selected; unsigned int selected;
unsigned int liststart; unsigned int liststart;
unsigned int listmaxshow; unsigned int listmaxshow;
int fheight; // Fonthoehe Timerlist-Inhalt int fheight; // Fonthoehe Timerlist-Inhalt
int theight; // Fonthoehe Timerlist-Titel int theight; // Fonthoehe Timerlist-Titel
int footerHeight; int footerHeight;
bool visible; bool visible;
int width; int width;
int height; int height;
int x; int x;
int y; int y;
//int bookmarkCount;
bool bookmarkname_entered;
bool bookmarksmodified;
void readBookmarkFile();
void writeBookmarkFile();
CBookmark getBookmark();
int addBookmark(CBookmark inBookmark);
//int bookmarkCount; void paintItem(int pos);
bool bookmarkname_entered; void paint();
bool bookmarksmodified; void paintHead();
void readBookmarkFile(); void paintFoot();
void writeBookmarkFile(); void hide();
CBookmark getBookmark();
int addBookmark(CBookmark inBookmark);
void paintItem(int pos); public:
void paint(); CBookmarkManager();
void paintHead(); ~CBookmarkManager();
void paintFoot(); bool changeNotify(const neutrino_locale_t, void *);
void hide(); int createBookmark(const std::string &name, const std::string &url, const std::string &time);
int createBookmark(const std::string &url, const std::string &time);
void removeBookmark(unsigned int index);
void renameBookmark(unsigned int index);
int getBookmarkCount(void) const;
int getMaxBookmarkCount(void) const;
void flush();
const CBookmark *getBookmark(CMenuTarget *parent);
public:
CBookmarkManager();
~CBookmarkManager();
bool changeNotify(const neutrino_locale_t, void *);
int createBookmark(const std::string & name, const std::string & url, const std::string & time);
int createBookmark(const std::string & url, const std::string & time);
void removeBookmark(unsigned int index);
void renameBookmark(unsigned int index);
int getBookmarkCount(void) const;
int getMaxBookmarkCount(void) const;
void flush();
const CBookmark * getBookmark(CMenuTarget* parent);
}; };
#endif #endif