CBuildinfo: Don't load graphical related objects if not needed.

Objects are only required in show mode. HasData() is renamed because of for more
plausibility.


Origin commit data
------------------
Commit: 9678adc401
Author: Thilo Graf <dbt@novatux.de>
Date: 2017-08-02 (Wed, 02 Aug 2017)
This commit is contained in:
2017-08-02 08:59:56 +02:00
parent bf44d9e7f9
commit 48e09d97b1
2 changed files with 8 additions and 9 deletions

View File

@@ -35,13 +35,13 @@
using namespace std; using namespace std;
CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, CCW_PERCENT 90, CCW_PERCENT 90, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO) CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, CCW_PERCENT 85, CCW_PERCENT 85, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO)
{ {
initVarBuildInfo(); initVarBuildInfo();
if (show) if (show)
exec(NULL, ""); exec(NULL, "");
else else
InitInfoItems(); GetData();
} }
//init all var members //init all var members
@@ -52,7 +52,6 @@ void CBuildInfo::initVarBuildInfo()
font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]; font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT];
setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT);
shadow = CC_SHADOW_ON; shadow = CC_SHADOW_ON;
} }
@@ -64,13 +63,13 @@ int CBuildInfo::exec(CMenuTarget* parent, const string & /*actionKey*/)
if (parent) if (parent)
parent->hide(); parent->hide();
InitInfoItems();
//exit if no informations available //exit if no informations available
if (!HasData()){ if (!GetData()){
return res; return res;
} }
InitInfoItems();
//paint window //paint window
if (!is_painted) if (!is_painted)
paint(); paint();
@@ -117,7 +116,7 @@ void CBuildInfo::setFontType(Font* font_text)
InitInfoItems(); InitInfoItems();
} }
bool CBuildInfo::HasData() bool CBuildInfo::GetData()
{ {
v_info.clear(); v_info.clear();
@@ -166,7 +165,7 @@ bool CBuildInfo::HasData()
void CBuildInfo::InitInfoItems() void CBuildInfo::InitInfoItems()
{ {
//get and checkup required informations //get and checkup required informations
if (!HasData()) if (!GetData())
return; return;
//ensure a clean body //ensure a clean body

View File

@@ -52,7 +52,7 @@ class CBuildInfo : public CMenuTarget, public CComponentsWindow
void initVarBuildInfo(); void initVarBuildInfo();
void InitInfoItems(); void InitInfoItems();
bool HasData(); bool GetData();
public: public:
//type_id's for infos //type_id's for infos