mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 17:31:11 +02:00
Merge branch 'pu/fb-setmode' of https://github.com/tuxbox-neutrino/gui-neutrino into ni/tuxbox
Origin commit data
------------------
Commit: db2a8c021b
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-02-26 (Sun, 26 Feb 2017)
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, 700, 500, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO)
|
||||
CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, 90/*%*/, 90/*%*/, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO)
|
||||
{
|
||||
initVarBuildInfo();
|
||||
if (show)
|
||||
|
@@ -169,9 +169,13 @@ void CComponentsWindow::initWindowSize()
|
||||
if (cc_parent)
|
||||
return;
|
||||
|
||||
if (width > 0 && width <= 100) //percentage conversion TODO: behavior inside parent
|
||||
width = frameBuffer->getScreenWidth()*width/100;
|
||||
if (width == 0 || (unsigned)width > frameBuffer->getScreenWidth())
|
||||
width = frameBuffer->getScreenWidth();
|
||||
|
||||
if (height > 0 && height <= 100) //percentage conversion TODO: behavior inside parent
|
||||
height = frameBuffer->getScreenHeight()*height/100;
|
||||
if (height == 0 || (unsigned)height > frameBuffer->getScreenHeight())
|
||||
height = frameBuffer->getScreenHeight();
|
||||
}
|
||||
|
@@ -128,10 +128,47 @@ class CComponentsWindow : public CComponentsForm
|
||||
{
|
||||
CC_WINDOW_ITEM_HEADER = 0
|
||||
};
|
||||
///simple constructor for CComponentsWindow, this shows a window over full screen
|
||||
|
||||
enum
|
||||
{
|
||||
CC_WINDOW_LEFT_SIDEBAR = 1,
|
||||
CC_WINDOW_RIGHT_SIDEBAR = 2
|
||||
};
|
||||
|
||||
/**simple constructor for CComponentsWindow, this shows a window over full screen
|
||||
* @param[in] parent
|
||||
* @li optional: expects type CComponentsForm * as possible parent object, default = NULL
|
||||
*/
|
||||
CComponentsWindow(CComponentsForm *parent = NULL);
|
||||
|
||||
///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window
|
||||
/**
|
||||
* advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window
|
||||
* @param[in] x_pos
|
||||
* @li expects type const &int, defines x position on screen
|
||||
* @param[in] y_pos
|
||||
* @li expects type const &int, defines y position on screen
|
||||
* @param[in] w
|
||||
* @li expects type const &int, width of window, Note: value = 0 uses full screen, value > 0 to 100 interpreted as percent value of screen, value > 100 use native lines count on screen
|
||||
* @param[in] h
|
||||
* @li expects type const &int, height of window, Note: value = 0 uses full screen, value > 0 to 100 interpreted as percent value of screen, value > 100 use native lines count on screen
|
||||
* @param[in] caption
|
||||
* @li optional: expects type const std::string&, defines title of window header
|
||||
* @param[in] iconname
|
||||
* @li optional: expects type const std::string&, defines icon name of window header
|
||||
* @param[in] parent
|
||||
* @li optional: expects type CComponentsForm * as possible parent object, default = NULL
|
||||
* @param[in] shadow_mode
|
||||
* @li optional: expects type int as mode, default = CC_SHADOW_OFF
|
||||
* possible values are
|
||||
* CC_SHADOW_ON = (CC_SHADOW_RIGHT | CC_SHADOW_BOTTOM | CC_SHADOW_CORNER_BOTTOM_LEFT | CC_SHADOW_CORNER_BOTTOM_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT)
|
||||
* @see cc_types.h
|
||||
* @param[in] color_frame
|
||||
* @li optional: expects type fb_pixel_t, defines frame color, default = COL_FRAME_PLUS_0
|
||||
* @param[in] color_body
|
||||
* @li optional: expects type fb_pixel_t, defines color color, default = COL_MENUCONTENT_PLUS_0
|
||||
* @param[in] color_shadow
|
||||
* @li optional: expects type fb_pixel_t, defines shadow color, default = COL_SHADOW_PLUS_0
|
||||
*/
|
||||
CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
const std::string& caption = "",
|
||||
const std::string& iconname = "",
|
||||
@@ -141,7 +178,12 @@ class CComponentsWindow : public CComponentsForm
|
||||
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0);
|
||||
|
||||
///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption from locales, x_pos or y_pos = 0 will center window
|
||||
/**
|
||||
* advanced constructor for CComponentsWindow, provides parameters for the most required properties
|
||||
* @param[in] locale_text
|
||||
* @li optional: expects type neutrino_locale_t, defines title of window header
|
||||
* @see for other parameters take a look to CComponentsWindow base class above
|
||||
*/
|
||||
CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
|
||||
neutrino_locale_t locale_text = NONEXISTANT_LOCALE,
|
||||
const std::string& iconname = "",
|
||||
@@ -151,90 +193,249 @@ class CComponentsWindow : public CComponentsForm
|
||||
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0);
|
||||
|
||||
///add item to body object, also usable is addCCItem() to add items to the windo object
|
||||
/**
|
||||
* Add an item to body object, also usable is addCCItem() to add items to the window object
|
||||
* @param[in] cc_Item
|
||||
* @li expects type CComponentsItem* , defines a cc item
|
||||
* @return Returns item ID
|
||||
* @see Take a look to cc_types.h for possible types.
|
||||
*/
|
||||
int addWindowItem(CComponentsItem* cc_Item);
|
||||
|
||||
///allow/disallow paint a footer, default true, see also ccw_show_footer, showHeader()
|
||||
void showFooter(bool show = true){ccw_show_footer = show; initCCWItems();};
|
||||
///allow/disallow paint a header, default true, see also ccw_show_header, showFooter()
|
||||
void showHeader(bool show = true){ccw_show_header = show; initCCWItems();};
|
||||
/**
|
||||
* enable/disable paint of footer, default true
|
||||
* @param[in] show
|
||||
* @li expects type bool, default = true
|
||||
* @see ccw_show_footer, showHeader()
|
||||
*/
|
||||
void showFooter(bool show = true){ccw_show_footer = show; initCCWItems();}
|
||||
|
||||
enum
|
||||
{
|
||||
CC_WINDOW_LEFT_SIDEBAR = 1,
|
||||
CC_WINDOW_RIGHT_SIDEBAR = 2
|
||||
};
|
||||
///allow/disallow paint a sidebar, default are enabled
|
||||
/**
|
||||
* enable/disable paint of header, default true
|
||||
* @param[in] show
|
||||
* @li expects type bool, default = true
|
||||
* @see ccw_show_header, showFooter()
|
||||
*/
|
||||
void showHeader(bool show = true){ccw_show_header = show; initCCWItems();}
|
||||
|
||||
/**
|
||||
* enable/disable paint of sidebar,
|
||||
* @param[in] show
|
||||
* @li optional: expects type const int&, default = enabled
|
||||
*/
|
||||
void enableSidebar(const int& sidbar_type = CC_WINDOW_LEFT_SIDEBAR | CC_WINDOW_RIGHT_SIDEBAR);
|
||||
|
||||
///set caption in header with string, see also getHeaderObject()
|
||||
/**
|
||||
* sets title text in header
|
||||
* @param[in] text
|
||||
* @li expects type const std::string&, defines title of window header
|
||||
* @param[in] align_mode
|
||||
* @li optional: expects type const int&, defines allignment of title text
|
||||
* @see CTextBox for alignment modes
|
||||
*/
|
||||
void setWindowCaption(const std::string& text, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK){ccw_caption = text; ccw_align_mode = align_mode;}
|
||||
///set header text color
|
||||
void setWindowHeaderTextColor(const fb_pixel_t& color){ccw_col_head_text = color;}
|
||||
///set background to header
|
||||
void setWindowHeaderColor(const fb_pixel_t& color){ccw_col_head = color;}
|
||||
///set caption in header from locales, see also getHeaderObject()
|
||||
|
||||
/**
|
||||
* sets title text in header
|
||||
* @param[in] text
|
||||
* @li expects type neutrino_locale_t
|
||||
* @param[in] align_mode
|
||||
* @li optional: expects type const int&, defines allignment of title text
|
||||
* @see CTextBox for alignment modes
|
||||
*/
|
||||
void setWindowCaption(neutrino_locale_t locale_text, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK);
|
||||
///set caption alignment, see CTextBox for possible modes
|
||||
|
||||
/**
|
||||
* Sets header text color
|
||||
* @param[in] const fb_pixel_t&
|
||||
* @li expects type const fb_pixel_t&
|
||||
*/
|
||||
void setWindowHeaderTextColor(const fb_pixel_t& color){ccw_col_head_text = color;}
|
||||
|
||||
/**
|
||||
* Sets header background color
|
||||
* @param[in] const fb_pixel_t&
|
||||
* @li expects type const fb_pixel_t&
|
||||
*/
|
||||
void setWindowHeaderColor(const fb_pixel_t& color){ccw_col_head = color;}
|
||||
|
||||
/**
|
||||
* sets title text alignment
|
||||
* @param[in] align_mode
|
||||
* @li expects type const int&
|
||||
* @see CTextBox for alignment modes
|
||||
*/
|
||||
void setWindowCaptionAlignment(const int& align_mode){ccw_align_mode = align_mode;};
|
||||
|
||||
///set icon name in header, see also getHeaderObject()
|
||||
/**
|
||||
* Sets icon name of window header.
|
||||
* @param[in] iconname
|
||||
* @li expects type const std::string&
|
||||
*/
|
||||
void setWindowIcon(const std::string& iconname){ccw_icon_name = iconname; initHeader();};
|
||||
|
||||
///set default header icon buttons, see also getHeaderObject()
|
||||
void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;};
|
||||
/**
|
||||
* Sets context buttons in window header.
|
||||
* @param[in] buttons
|
||||
* @li expects type const int&
|
||||
* @note possible types are:
|
||||
* CC_BTN_HELP,
|
||||
CC_BTN_INFO,
|
||||
CC_BTN_MENU,
|
||||
CC_BTN_EXIT,
|
||||
CC_BTN_MUTE_ZAP_ACTIVE,
|
||||
CC_BTN_MUTE_ZAP_INACTIVE,
|
||||
CC_BTN_OKAY,
|
||||
CC_BTN_MUTE,
|
||||
CC_BTN_UP,
|
||||
CC_BTN_DOWN,
|
||||
CC_BTN_LEFT,
|
||||
CC_BTN_RIGHT,
|
||||
CC_BTN_FORWARD,
|
||||
CC_BTN_BACKWARD,
|
||||
CC_BTN_PAUSE,
|
||||
CC_BTN_PLAY,
|
||||
CC_BTN_RECORD_ACTIVE,
|
||||
CC_BTN_RECORD_INACTIVE,
|
||||
CC_BTN_RECORD_STOP,
|
||||
* @see cc_frm_header.h for current types
|
||||
*/
|
||||
void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;}
|
||||
|
||||
///returns a pointer to the internal header object, use this to get access to header properities
|
||||
CComponentsHeader* getHeaderObject(){return ccw_head;};
|
||||
/**
|
||||
* Gets a pointer to the internal header object, use this to get direct access to header properities
|
||||
* @return CComponentsHeader*
|
||||
*/
|
||||
CComponentsHeader* getHeaderObject(){return ccw_head;}
|
||||
|
||||
///returns a pointer to the internal body object, use this to get access to body properities
|
||||
CComponentsForm* getBodyObject(){return ccw_body;};
|
||||
///returns a pointer to the internal footer object, use this to get access to footer properities
|
||||
CComponentsFooter* getFooterObject(){return ccw_footer;};
|
||||
/**
|
||||
* Gets a pointer to the internal body object, use this to get access to body properities
|
||||
* @return CComponentsForm*
|
||||
*/
|
||||
CComponentsForm* getBodyObject(){return ccw_body;}
|
||||
|
||||
///set background to footer
|
||||
/**
|
||||
* Gets a pointer to the internal footer object, use this to get access to footer properities
|
||||
* @return CComponentsFooter*
|
||||
*/
|
||||
CComponentsFooter* getFooterObject(){return ccw_footer;}
|
||||
|
||||
/**
|
||||
* Sets footer background color
|
||||
* @param[in] color
|
||||
* @li expects type const fb_pixel_t&
|
||||
*/
|
||||
void setWindowFooterColor(const fb_pixel_t& color){ccw_col_footer = color;}
|
||||
///set font for footer buttons
|
||||
|
||||
/**
|
||||
* Sets font for footer buttons
|
||||
* @param[in] font_type
|
||||
* @li expects type Font*
|
||||
*/
|
||||
void setWindowFooterFont(Font* font_type){ccw_button_font = font_type;}
|
||||
|
||||
///returns a pointer to the internal left side bar object, use this to get access to left sidebar properities
|
||||
CComponentsFrmChain* getLeftSidebarObject(){return ccw_left_sidebar;};
|
||||
///returns a pointer to the internal right side bar object, use this to get access to right sidebar properities
|
||||
CComponentsFrmChain* getRightSidebarObject(){return ccw_right_sidebar;};
|
||||
///sets width of sidebars
|
||||
void setWidthSidebar(const int& sidebar_width){ccw_w_sidebar = sidebar_width; initCCWItems();};
|
||||
/**
|
||||
* Gets a pointer to the internal left side bar object, use this to get access to left sidebar properities
|
||||
* @return CComponentsFrmChain*
|
||||
*/
|
||||
CComponentsFrmChain* getLeftSidebarObject(){return ccw_left_sidebar;}
|
||||
|
||||
///sets current page, NOTE: this is simliar with setCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object
|
||||
/**
|
||||
* Gets a pointer to the internal right side bar object, use this to get access to right sidebar properities
|
||||
* @return CComponentsFrmChain*
|
||||
*/
|
||||
CComponentsFrmChain* getRightSidebarObject(){return ccw_right_sidebar;}
|
||||
|
||||
/**
|
||||
* Sets width of sidebars
|
||||
* @param[in] sidebar_width
|
||||
* @li expects type const int&
|
||||
*/
|
||||
void setWidthSidebar(const int& sidebar_width){ccw_w_sidebar = sidebar_width; initCCWItems();}
|
||||
|
||||
/**
|
||||
* Sets current page number
|
||||
* @param[in] sidebar_width
|
||||
* @li expects type const int&
|
||||
* @note This is simliar to setCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object.
|
||||
*/
|
||||
void setCurrentPage(const u_int8_t& current_page);
|
||||
///get current page, NOTE: this is simliar with getCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object
|
||||
|
||||
/**
|
||||
* Gets current page number
|
||||
* @return CComponentsFrmChain*
|
||||
* @note This simliar to getCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object
|
||||
*/
|
||||
u_int8_t getCurrentPage();
|
||||
|
||||
///paint window body items, this paints only the current page, body = page, current page is definied in body object, see setCurrentPage()
|
||||
/**
|
||||
* Paints window body items, this paints only the current page, body = page, current page is definied in body object, see setCurrentPage()
|
||||
* @param[in] do_save_bg
|
||||
* @li optional: expects type bool, default = CC_SAVE_SCREEN_NO (false), sets background save mode
|
||||
*/
|
||||
void paintCurPage(bool do_save_bg = CC_SAVE_SCREEN_NO);
|
||||
///paint defined page of body, parameter number 0...n
|
||||
|
||||
/**
|
||||
* Paints defined page of body, parameter number 0...n
|
||||
* @param[in] page_number
|
||||
* @li expects type const u_int8_t& as page number
|
||||
* @param[in] do_save_bg
|
||||
* @li optional: expects type bool, default = CC_SAVE_SCREEN_NO (false), sets background save mode
|
||||
*/
|
||||
void paintPage(const u_int8_t& page_number, bool do_save_bg = CC_SAVE_SCREEN_NO);
|
||||
///enable/disable page scroll, parameter1 default enabled for up/down keys, only for body!
|
||||
|
||||
/**
|
||||
* enable/disable page scroll
|
||||
* @param[in] mode
|
||||
* @li optional: expects type const int&, default enabled for up/down keys, only for body!
|
||||
*/
|
||||
void enablePageScroll(const int& mode = PG_SCROLL_M_UP_DOWN_KEY);
|
||||
|
||||
///set width of body scrollbar
|
||||
/**
|
||||
* Sets width of body scrollbar
|
||||
* @param[in] crollbar_width
|
||||
* @li expects type const int&
|
||||
*/
|
||||
void setScrollBarWidth(const int& scrollbar_width);
|
||||
|
||||
///refresh position and dimension and reinitialize elemenatary properties
|
||||
/**
|
||||
* Reinit position and dimensions and reinitialize mostly elemenatary properties
|
||||
*/
|
||||
void Refresh(){initCCWItems();};
|
||||
|
||||
///paint all window items, this overwriting paint() from CComponentsForm
|
||||
/**
|
||||
* Paint window
|
||||
* @param[in] do_save_bg
|
||||
* @li optional: expects type bool, sets background save mode
|
||||
*/
|
||||
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
|
||||
///adds additional exec key to current collection, default exit keys are CRCInput::RC_home and CRCInput::RC_setup
|
||||
/**
|
||||
* Adds an additional exec key to current collection, default exit keys are CRCInput::RC_home and CRCInput::RC_setup
|
||||
* @param[in] key
|
||||
* @li expects type const neutrino_msg_t&
|
||||
* @see river/rcinput.h for possible keys
|
||||
*/
|
||||
virtual void addExitKey(const neutrino_msg_t& key){getBodyObject()->addExitKey(key);}
|
||||
///remove all current exec keys from current collection, NOTE: use addExitKey() if new exec key is required
|
||||
|
||||
/**
|
||||
* Removes all current exec keys from current collection.
|
||||
* @note use addExitKey() if new exec key is required
|
||||
*/
|
||||
virtual void removeExitKeys(){getBodyObject()->removeExitKeys();}
|
||||
};
|
||||
|
||||
class CComponentsWindowMax : public CComponentsWindow
|
||||
{
|
||||
public:
|
||||
///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, this shows a centered window based up current screen settings
|
||||
/**
|
||||
* Simple constructor for CComponentsWindow, this shows only a centered window based up current screen settings
|
||||
* @see for other parameters take a look to CComponentsWindow base class above
|
||||
* @param[in] caption
|
||||
* @li expects type const std::string&, defines title of window header
|
||||
* @see for other parameters take a look to CComponentsWindow base class above
|
||||
*/
|
||||
CComponentsWindowMax( const std::string& caption, const std::string& iconname = "",
|
||||
CComponentsForm *parent = NULL,
|
||||
int shadow_mode = CC_SHADOW_OFF,
|
||||
@@ -242,7 +443,13 @@ class CComponentsWindowMax : public CComponentsWindow
|
||||
fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_SHADOW_PLUS_0);
|
||||
|
||||
///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, this shows a centered window based up current screen settings
|
||||
/**
|
||||
* Simple constructor for CComponentsWindow, this shows only a centered window based up current screen settings
|
||||
* @see for other parameters take a look to CComponentsWindow base class above
|
||||
* @param[in] locale_text
|
||||
* @li expects type neutrino_locale_t, defines title of window header
|
||||
* @see for other parameters take a look to CComponentsWindow base class above
|
||||
*/
|
||||
CComponentsWindowMax( neutrino_locale_t locale_caption, const std::string& iconname = "",
|
||||
CComponentsForm *parent = NULL,
|
||||
int shadow_mode = CC_SHADOW_OFF,
|
||||
|
@@ -2851,7 +2851,7 @@ void CMovieBrowser::updateDir(void)
|
||||
void CMovieBrowser::loadAllTsFileNamesFromStorage(void)
|
||||
{
|
||||
//TRACE("[mb]->loadAllTsFileNamesFromStorage \n");
|
||||
int i,size;
|
||||
size_t i,size;
|
||||
|
||||
m_movieSelectionHandler = NULL;
|
||||
m_dirNames.clear();
|
||||
@@ -2862,9 +2862,11 @@ void CMovieBrowser::loadAllTsFileNamesFromStorage(void)
|
||||
size = m_dir.size();
|
||||
for (i=0; i < size;i++)
|
||||
{
|
||||
if (*m_dir[i].used == true)
|
||||
if (*m_dir[i].used == true){
|
||||
OnLoadDir(i+1, size, m_dir[i].name);
|
||||
loadTsFileNamesFromDir(m_dir[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("[mb] Dir%d, Files:%d\n", (int)m_dirNames.size(), (int)m_vMovieInfo.size());
|
||||
}
|
||||
@@ -2982,7 +2984,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname)
|
||||
} else {
|
||||
result |= addFile(flist[i], dirItNr);
|
||||
}
|
||||
OnLoadFile(i, flist.size(), g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES));
|
||||
OnLoadFile(i, flist.size(), dirname );
|
||||
}
|
||||
//result = true;
|
||||
}
|
||||
@@ -3221,7 +3223,7 @@ void CMovieBrowser::loadMovies(bool doRefresh)
|
||||
{
|
||||
TRACE("[mb] loadMovies: \n");
|
||||
|
||||
CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_HEAD, 500, 150, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile);
|
||||
CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, 50/*%*/, 25/*%*/, NULL, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile, &OnLoadDir);
|
||||
loadBox.enableShadow();
|
||||
loadBox.paint();
|
||||
|
||||
|
@@ -365,6 +365,7 @@ class CMovieBrowser : public CMenuTarget
|
||||
bool supportedExtension(CFile &file);
|
||||
bool addFile(CFile &file, int dirItNr);
|
||||
sigc::signal<void, size_t, size_t, std::string> OnLoadFile;
|
||||
sigc::signal<void, size_t, size_t, std::string> OnLoadDir;
|
||||
};
|
||||
|
||||
// I tried a lot to use the menu.cpp as ListBox selection, and I got three solution which are all garbage.
|
||||
|
@@ -50,6 +50,7 @@
|
||||
#include <xmlinterface.h>
|
||||
|
||||
#include <gui/widget/msgbox.h>
|
||||
#include <gui/widget/progresswindow.h>
|
||||
#include <gui/scan.h>
|
||||
#include <gui/scan_setup.h>
|
||||
#include <zapit/zapit.h>
|
||||
@@ -836,6 +837,53 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else if (actionKey == "progress_window"){
|
||||
//classical
|
||||
CProgressWindow pw0("Progress Single Test");
|
||||
pw0.paint();
|
||||
size_t max = 3;
|
||||
for(size_t i = 0; i< max; i++){
|
||||
pw0.showStatus(i, max, to_string(i));
|
||||
sleep(1);
|
||||
}
|
||||
pw0.hide();
|
||||
|
||||
CProgressWindow pw1("Progress Local/Global Test");
|
||||
pw1.paint();
|
||||
for(size_t i = 0; i< max; i++){
|
||||
pw1.showGlobalStatus(i, max, to_string(i));
|
||||
for(size_t j = 0; j< max; j++){
|
||||
pw1.showLocalStatus(j, max, to_string(j));
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
pw1.hide();
|
||||
|
||||
//with signals
|
||||
sigc::signal<void, size_t, size_t, std::string> OnProgress0, OnProgress1;
|
||||
CProgressWindow pw2("Progress Single Test -> single Signal", 700, 200, &OnProgress0);
|
||||
pw2.paint();
|
||||
|
||||
for(size_t i = 0; i< max; i++){
|
||||
OnProgress0(i, max, to_string(i));
|
||||
sleep(1);
|
||||
}
|
||||
pw2.hide();
|
||||
|
||||
CProgressWindow pw3("Progress Single Test -> dub Signal", 700, 200, NULL, &OnProgress0, &OnProgress1);
|
||||
pw3.paint();
|
||||
|
||||
for(size_t i = 0; i< max; i++){
|
||||
OnProgress1(i, max, to_string(i));
|
||||
for(size_t j = 0; j< max; j++){
|
||||
OnProgress0(j, max, to_string(j));
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
pw3.hide();
|
||||
|
||||
return menu_return::RETURN_REPAINT;
|
||||
}
|
||||
else if (actionKey == "hintbox_test")
|
||||
{
|
||||
ShowHint("Testmenu: Hintbox popup test", "Test for HintBox,\nPlease press any key or wait some seconds! ...", 700, 10, NULL, NEUTRINO_ICON_HINT_IMAGEINFO, CComponentsHeader::CC_BTN_EXIT);
|
||||
@@ -1080,6 +1128,7 @@ int CTestMenu::showTestMenu()
|
||||
void CTestMenu::showCCTests(CMenuWidget *widget)
|
||||
{
|
||||
widget->addIntroItems();
|
||||
widget->addItem(new CMenuForwarder("Progress Window", true, NULL, this, "progress_window"));
|
||||
widget->addItem(new CMenuForwarder("Running Clock", true, NULL, this, "running_clock"));
|
||||
widget->addItem(new CMenuForwarder("Clock", true, NULL, this, "clock"));
|
||||
widget->addItem(new CMenuForwarder("Button", true, NULL, this, "button"));
|
||||
|
@@ -67,7 +67,7 @@ CHintBox::CHintBox( const neutrino_locale_t Caption,
|
||||
const char * const Picon,
|
||||
const int& header_buttons,
|
||||
const int& text_mode,
|
||||
const int& indent): CComponentsWindow( 0, 0, width,
|
||||
const int& indent): CComponentsWindow( 0, 0, Width,
|
||||
HINTBOX_MIN_HEIGHT,
|
||||
Caption,
|
||||
string(Icon == NULL ? "" : Icon),
|
||||
@@ -84,7 +84,7 @@ CHintBox::CHintBox( const char * const Caption,
|
||||
const char * const Picon,
|
||||
const int& header_buttons,
|
||||
const int& text_mode,
|
||||
const int& indent):CComponentsWindow( 0, 0, width,
|
||||
const int& indent):CComponentsWindow( 0, 0, Width,
|
||||
HINTBOX_MIN_HEIGHT,
|
||||
Caption,
|
||||
string(Icon == NULL ? "" : Icon),
|
||||
@@ -101,7 +101,7 @@ CHintBox::CHintBox( const neutrino_locale_t Caption,
|
||||
const char * const Picon,
|
||||
const int& header_buttons,
|
||||
const int& text_mode,
|
||||
const int& indent):CComponentsWindow( 0, 0, width,
|
||||
const int& indent):CComponentsWindow( 0, 0, Width,
|
||||
HINTBOX_MIN_HEIGHT,
|
||||
Caption,
|
||||
string(Icon == NULL ? "" : Icon),
|
||||
@@ -118,7 +118,7 @@ CHintBox::CHintBox( const char * const Caption,
|
||||
const char * const Picon,
|
||||
const int& header_buttons,
|
||||
const int& text_mode,
|
||||
const int& indent):CComponentsWindow( 0, 0, width,
|
||||
const int& indent):CComponentsWindow( 0, 0, Width,
|
||||
HINTBOX_MIN_HEIGHT,
|
||||
Caption,
|
||||
string(Icon == NULL ? "" : Icon),
|
||||
|
@@ -32,14 +32,15 @@
|
||||
|
||||
#include <gui/components/cc.h>
|
||||
|
||||
#define HINTBOX_MIN_WIDTH 320
|
||||
#define HINTBOX_MIN_HEIGHT 125
|
||||
#define HINTBOX_MAX_HEIGHT 520
|
||||
#define HINTBOX_MIN_WIDTH CFrameBuffer::getInstance()->scale2Res(320)
|
||||
#define HINTBOX_MIN_HEIGHT CFrameBuffer::getInstance()->scale2Res(125)
|
||||
#define HINTBOX_MAX_HEIGHT CFrameBuffer::getInstance()->scale2Res(520)
|
||||
|
||||
#define HINTBOX_DEFAULT_TIMEOUT g_settings.timing[SNeutrinoSettings::TIMING_POPUP_MESSAGES]
|
||||
#define NO_TIMEOUT 0
|
||||
#define DEFAULT_TIMEOUT -1
|
||||
//frame around hint container as indent
|
||||
#define W_FRAME std::max(HINTBOX_MIN_WIDTH, HINTBOX_MIN_HEIGHT) * 2/100
|
||||
#define W_FRAME OFFSET_INNER_MID
|
||||
//frame color around hint/message box
|
||||
#define HINTBOX_DEFAULT_FRAME_COLOR COL_FRAME
|
||||
#define TIMEOUT_BAR_HEIGHT OFFSET_SHADOW/2
|
||||
|
@@ -57,8 +57,19 @@ CProgressWindow::CProgressWindow(const neutrino_locale_t title,
|
||||
Init(statusSignal, localSignal, globalSignal);
|
||||
}
|
||||
|
||||
CProgressWindow::CProgressWindow(const std::string &title,
|
||||
const int &dx,
|
||||
const int &dy,
|
||||
signal<void, size_t, size_t, string> *statusSignal,
|
||||
signal<void, size_t, size_t, string> *localSignal,
|
||||
signal<void, size_t, size_t, string> *globalSignal)
|
||||
: CComponentsWindow(0, 0, dx, dy, title, NEUTRINO_ICON_INFO, NULL, CC_SHADOW_ON)
|
||||
{
|
||||
Init(statusSignal, localSignal, globalSignal);
|
||||
}
|
||||
|
||||
void CProgressWindow::Init( signal<void, size_t, size_t, string> *statusSignal,
|
||||
signal<void,size_t, size_t, string> *localSignal,
|
||||
signal<void, size_t, size_t, string> *localSignal,
|
||||
signal<void, size_t, size_t, string> *globalSignal)
|
||||
{
|
||||
if (statusSignal)
|
||||
@@ -68,112 +79,75 @@ void CProgressWindow::Init( signal<void, size_t, size_t, string> *statusSignal,
|
||||
if (globalSignal)
|
||||
*globalSignal->connect(mem_fun(*this, &CProgressWindow::showGlobalStatus));
|
||||
|
||||
global_progress = local_progress = 100;
|
||||
global_progress = local_progress = 0;
|
||||
|
||||
showFooter(false);
|
||||
shadow = true;
|
||||
|
||||
int x_item = 10;
|
||||
int y_item = 10;
|
||||
|
||||
int w_item = width-2*x_item;
|
||||
int h_item = 14;
|
||||
int h_pbar = 20;
|
||||
w_bar_frame = 0;
|
||||
|
||||
//create status text object
|
||||
status_txt = new CComponentsLabel();
|
||||
int h_txt = max(g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(), h_item);
|
||||
status_txt->setDimensionsAll(x_item, y_item, w_item, h_txt);
|
||||
status_txt->setDimensionsAll(OFFSET_INNER_MID, OFFSET_INNER_MID, width-2*OFFSET_INNER_MID, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight());
|
||||
status_txt->setColorBody(col_body);
|
||||
status_txt->doPaintTextBoxBg(true);
|
||||
status_txt->doPaintBg(false);
|
||||
addWindowItem(status_txt);
|
||||
y_item += h_txt + 10;
|
||||
|
||||
//create local_bar object
|
||||
local_bar = new CProgressBar();
|
||||
local_bar->allowPaint(false);
|
||||
local_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar);
|
||||
local_bar->setColorBody(col_body);
|
||||
local_bar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0);
|
||||
local_bar->setFrameThickness(w_bar_frame);
|
||||
local_bar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0);
|
||||
addWindowItem(local_bar);
|
||||
y_item += 2*h_pbar;
|
||||
local_bar = getProgressItem();
|
||||
|
||||
//create global_bar object
|
||||
global_bar = new CProgressBar();
|
||||
global_bar->allowPaint(false);
|
||||
global_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar);
|
||||
global_bar->setColorBody(col_body);
|
||||
global_bar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0);
|
||||
global_bar->setFrameThickness(w_bar_frame);
|
||||
global_bar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0);
|
||||
addWindowItem(global_bar);
|
||||
y_item += 2*h_pbar;
|
||||
global_bar = getProgressItem();
|
||||
|
||||
//set window height
|
||||
h_height = ccw_head->getHeight();
|
||||
height = max(height, y_item + h_height);
|
||||
ccw_body->setHeight((OFFSET_INNER_MID + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight())*ccw_body->size());
|
||||
|
||||
height = max(height, ccw_body->getHeight() + h_height);
|
||||
|
||||
//set position on screen
|
||||
setCenterPos();
|
||||
}
|
||||
|
||||
void CProgressWindow::setTitle(const neutrino_locale_t title)
|
||||
CProgressBar* CProgressWindow::getProgressItem()
|
||||
{
|
||||
setWindowCaption(title);
|
||||
|
||||
#ifdef VFD_UPDATE
|
||||
CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD
|
||||
#endif // VFD_UPDATE
|
||||
}
|
||||
|
||||
void CProgressWindow::setTitle(const string & title)
|
||||
{
|
||||
setWindowCaption(title);
|
||||
|
||||
#ifdef VFD_UPDATE
|
||||
CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD
|
||||
#endif // VFD_UPDATE
|
||||
}
|
||||
|
||||
//if header is disabled we need new position for body items
|
||||
void CProgressWindow::fitItems()
|
||||
{
|
||||
if (ccw_show_header)
|
||||
return;
|
||||
|
||||
for(size_t i=0; i<ccw_body->size() ;i++){
|
||||
int y_item = ccw_body->getCCItem(i)->getYPos() + h_height - 10;
|
||||
ccw_body->getCCItem(i)->setYPos(y_item);
|
||||
CProgressBar *pBar = new CProgressBar();
|
||||
pBar->allowPaint(false);
|
||||
int y_tmp = 0;
|
||||
for(size_t i = 0; i< ccw_body->size(); i++){
|
||||
y_tmp += ccw_body->getCCItem(i)->getHeight();
|
||||
y_tmp += OFFSET_INNER_MID;
|
||||
}
|
||||
pBar->setDimensionsAll(OFFSET_INNER_MID, y_tmp, width-2*OFFSET_INNER_MID, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight());
|
||||
pBar->setColorBody(col_body);
|
||||
pBar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0);
|
||||
pBar->setFrameThickness(1);
|
||||
pBar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0);
|
||||
addWindowItem(pBar);
|
||||
|
||||
return pBar;
|
||||
}
|
||||
|
||||
void CProgressWindow::initStatus(const unsigned int prog, const unsigned int max, const string &statusText, CProgressBar *pBar)
|
||||
{
|
||||
pBar->allowPaint(true);
|
||||
pBar->setValues(prog, (int)max);
|
||||
if (!statusText.empty())
|
||||
showStatusMessageUTF(statusText);
|
||||
pBar->paint(false);
|
||||
}
|
||||
|
||||
void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max, const string &statusText)
|
||||
{
|
||||
if (global_progress == prog)
|
||||
return;
|
||||
|
||||
if (!global_bar->isPainted()){
|
||||
int g_height = global_bar->getHeight();
|
||||
global_bar->setYPos(local_bar->getYPos() + g_height/2);
|
||||
global_bar->setHeight(g_height + g_height/2);
|
||||
}
|
||||
|
||||
showGlobalStatus(prog, max, statusText);
|
||||
showLocalStatus(prog, max, statusText);
|
||||
}
|
||||
|
||||
void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned int max, const string &statusText)
|
||||
{
|
||||
if (global_progress == prog)
|
||||
if (!local_bar->isPainted())
|
||||
showLocalStatus(0, 0, statusText); // ensure first paint of local bar on painted global bar at same time
|
||||
if (global_progress == prog && global_bar->isPainted())
|
||||
return;
|
||||
|
||||
global_bar->allowPaint(true);
|
||||
global_progress = prog;
|
||||
global_bar->setValues(prog, (int)max);
|
||||
if (!statusText.empty())
|
||||
showStatusMessageUTF(statusText);
|
||||
global_bar->paint(false);
|
||||
initStatus(prog, max, statusText, global_bar);
|
||||
|
||||
#ifdef VFD_UPDATE
|
||||
CVFD::getInstance()->showProgressBar2(-1,NULL,global_progress);
|
||||
@@ -182,15 +156,10 @@ void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned i
|
||||
|
||||
void CProgressWindow::showLocalStatus(const unsigned int prog, const unsigned int max, const string &statusText)
|
||||
{
|
||||
if (local_progress == prog)
|
||||
if (local_progress == prog && local_bar->isPainted())
|
||||
return;
|
||||
|
||||
local_bar->allowPaint(true);
|
||||
local_progress = prog;
|
||||
local_bar->setValues(prog, (int)max);
|
||||
if (!statusText.empty())
|
||||
showStatusMessageUTF(statusText);
|
||||
local_bar->paint(false);
|
||||
initStatus(prog, max, statusText, local_bar);
|
||||
|
||||
#ifdef VFD_UPDATE
|
||||
CVFD::getInstance()->showProgressBar2(local_progress);
|
||||
@@ -240,3 +209,33 @@ void CProgressWindow::paint(bool do_save_bg)
|
||||
fitItems();
|
||||
CComponentsWindow::paint(do_save_bg);
|
||||
}
|
||||
|
||||
void CProgressWindow::setTitle(const neutrino_locale_t title)
|
||||
{
|
||||
setWindowCaption(title);
|
||||
|
||||
#ifdef VFD_UPDATE
|
||||
CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD
|
||||
#endif // VFD_UPDATE
|
||||
}
|
||||
|
||||
void CProgressWindow::setTitle(const string & title)
|
||||
{
|
||||
setWindowCaption(title);
|
||||
|
||||
#ifdef VFD_UPDATE
|
||||
CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD
|
||||
#endif // VFD_UPDATE
|
||||
}
|
||||
|
||||
//if header is disabled we need new position for body items
|
||||
void CProgressWindow::fitItems()
|
||||
{
|
||||
if (ccw_show_header)
|
||||
return;
|
||||
|
||||
for(size_t i=0; i<ccw_body->size() ;i++){
|
||||
int y_item = ccw_body->getCCItem(i)->getYPos() + h_height - OFFSET_INNER_MID;
|
||||
ccw_body->getCCItem(i)->setYPos(y_item);
|
||||
}
|
||||
}
|
@@ -28,6 +28,9 @@
|
||||
#include <gui/components/cc.h>
|
||||
#include "menue.h"
|
||||
|
||||
#define PW_MIN_WIDTH 50 //%
|
||||
#define PW_MIN_HEIGHT 25 //%
|
||||
|
||||
class CProgressWindow : public CComponentsWindow, public CMenuTarget
|
||||
{
|
||||
private:
|
||||
@@ -36,11 +39,13 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
|
||||
|
||||
unsigned int global_progress;
|
||||
unsigned int local_progress;
|
||||
int w_bar_frame;
|
||||
int h_height;
|
||||
void Init( sigc::signal<void, size_t, size_t, std::string> *statusSignal,
|
||||
sigc::signal<void,size_t, size_t, std::string> *localSignal,
|
||||
sigc::signal<void, size_t, size_t, std::string> *globalSignal);
|
||||
|
||||
CProgressBar* getProgressItem();
|
||||
void initStatus(const unsigned int prog, const unsigned int max, const std::string &statusText, CProgressBar *pBar);
|
||||
void fitItems();
|
||||
|
||||
public:
|
||||
@@ -131,8 +136,8 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
|
||||
* Don't use status_Signal at same time with localSignal and globalSignal. In This case please set status_Signal = NULL
|
||||
*/
|
||||
CProgressWindow(CComponentsForm *parent = NULL,
|
||||
const int &dx = 700,
|
||||
const int &dy = 200,
|
||||
const int &dx = PW_MIN_WIDTH,
|
||||
const int &dy = PW_MIN_HEIGHT,
|
||||
sigc::signal<void, size_t, size_t, std::string> *status_Signal = NULL,
|
||||
sigc::signal<void,size_t, size_t, std::string> *localSignal = NULL,
|
||||
sigc::signal<void, size_t, size_t, std::string> *globalSignal = NULL);
|
||||
@@ -144,8 +149,21 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget
|
||||
* @see For other arguments and examples, see related constructor(s)
|
||||
*/
|
||||
CProgressWindow(const neutrino_locale_t title,
|
||||
const int &dx = 700,
|
||||
const int &dy = 200,
|
||||
const int &dx = PW_MIN_WIDTH,
|
||||
const int &dy = PW_MIN_HEIGHT,
|
||||
sigc::signal<void, size_t, size_t, std::string> *status_Signal = NULL,
|
||||
sigc::signal<void,size_t, size_t, std::string> *localSignal = NULL,
|
||||
sigc::signal<void, size_t, size_t, std::string> *globalSignal = NULL);
|
||||
|
||||
/**CProgressWindow Constructor
|
||||
* @param[in] title
|
||||
* @li expects type std::string as window title
|
||||
*
|
||||
* @see For other arguments and examples, see related constructor(s)
|
||||
*/
|
||||
CProgressWindow(const std::string &title,
|
||||
const int &dx = PW_MIN_WIDTH,
|
||||
const int &dy = PW_MIN_HEIGHT,
|
||||
sigc::signal<void, size_t, size_t, std::string> *status_Signal = NULL,
|
||||
sigc::signal<void,size_t, size_t, std::string> *localSignal = NULL,
|
||||
sigc::signal<void, size_t, size_t, std::string> *globalSignal = NULL);
|
||||
|
@@ -68,14 +68,14 @@
|
||||
#endif
|
||||
#include <sstream>
|
||||
|
||||
#define SCROLL_FRAME_WIDTH 10
|
||||
#define SCROLL_MARKER_BORDER 2
|
||||
#define SCROLL_FRAME_WIDTH SCROLLBAR_WIDTH
|
||||
#define SCROLL_MARKER_BORDER OFFSET_INNER_MIN
|
||||
|
||||
#define MAX_WINDOW_WIDTH (g_settings.screen_EndX - g_settings.screen_StartX - 40)
|
||||
#define MAX_WINDOW_HEIGHT (g_settings.screen_EndY - g_settings.screen_StartY - 40)
|
||||
#define MAX_WINDOW_WIDTH (g_settings.screen_EndX - g_settings.screen_StartX - CFrameBuffer::getInstance()->scale2Res(40))
|
||||
#define MAX_WINDOW_HEIGHT (g_settings.screen_EndY - g_settings.screen_StartY - CFrameBuffer::getInstance()->scale2Res(40))
|
||||
|
||||
#define MIN_WINDOW_WIDTH ((g_settings.screen_EndX - g_settings.screen_StartX)>>1)
|
||||
#define MIN_WINDOW_HEIGHT 40
|
||||
#define MIN_WINDOW_HEIGHT CFrameBuffer::getInstance()->scale2Res(40)
|
||||
|
||||
CTextBox::CTextBox(const char * text, Font* font_text, const int pmode,
|
||||
const CBox* position, CFBWindow::color_t textBackgroundColor)
|
||||
|
Reference in New Issue
Block a user