- buildinfo: 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:26 +01:00
committed by Thilo Graf
parent 38e3181064
commit 359463a1fa
2 changed files with 53 additions and 47 deletions

View File

@@ -23,7 +23,6 @@
Boston, MA 02110-1301, USA.
*/
#include <global.h>
#include <neutrino.h>
@@ -58,7 +57,6 @@ void CBuildInfo::initVarBuildInfo()
shadow = CC_SHADOW_ON;
}
int CBuildInfo::exec(CMenuTarget *parent, const string & /*actionKey*/)
{
int res = menu_return::RETURN_REPAINT;
@@ -67,7 +65,8 @@ int CBuildInfo::exec(CMenuTarget* parent, const string & /*actionKey*/)
parent->hide();
// exit if no informations available
if (!GetData()){
if (!GetData())
{
return res;
}
@@ -77,7 +76,6 @@ int CBuildInfo::exec(CMenuTarget* parent, const string & /*actionKey*/)
if (!is_painted)
paint();
neutrino_msg_t msg;
while (1)
{
@@ -85,30 +83,34 @@ int CBuildInfo::exec(CMenuTarget* parent, const string & /*actionKey*/)
uint64_t timeoutEnd = CRCInput::calcTimeoutEnd_MS(100);
g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd);
if(msg == CRCInput::RC_setup) {
if (msg == CRCInput::RC_setup)
{
res = menu_return::RETURN_EXIT_ALL;
break;
}
else if (CNeutrinoApp::getInstance()->listModeKey(msg)) {
else if (CNeutrinoApp::getInstance()->listModeKey(msg))
{
g_RCInput->postMsg(msg, 0);
res = menu_return::RETURN_EXIT_ALL;
break;
}
else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_page_up)) {
else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_page_up))
{
Scroll(false);
}
else if ((msg == CRCInput::RC_down) || (msg == CRCInput::RC_page_down)) {
else if ((msg == CRCInput::RC_down) || (msg == CRCInput::RC_page_down))
{
Scroll(true);
}
else if (msg <= CRCInput::RC_MaxRC){
else if (msg <= CRCInput::RC_MaxRC)
{
break;
}
if ( msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout){
if (msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout)
{
CNeutrinoApp::getInstance()->handleMsg(msg, data);
}
}
// hide window
@@ -121,7 +123,8 @@ void CBuildInfo::Scroll(bool scrollDown)
{
CTextBox *ctb = static_cast<CComponentsExtTextForm *>(ccw_body->getCCItem(3))->getTextObject()->getCTextBoxObject();
ctb->enableBackgroundPaint(true); // FIXME: behavior of CTextBox scroll is broken with disabled background paint
if (ctb) {
if (ctb)
{
if (scrollDown)
ctb->scrollPageDown(1);
else
@@ -160,7 +163,8 @@ bool CBuildInfo::GetData()
cxxflags = trim(cxxflags);
// Remove double spaces
size_t pos = cxxflags.find(" ");
while (pos != string::npos) {
while (pos != string::npos)
{
cxxflags.erase(pos, 1);
pos = cxxflags.find(" ", pos);
}
@@ -175,7 +179,8 @@ bool CBuildInfo::GetData()
v_info.push_back(creator);
#endif
if (v_info.empty()){
if (v_info.empty())
{
DisplayInfoMessage("No Informations available. Please report!");
return false;
}
@@ -199,7 +204,8 @@ void CBuildInfo::InitInfoItems()
int y_info = OFFSET_INNER_MID;
// init info texts
for(size_t i=0; i<v_info.size(); i++){
for (size_t i = 0; i < v_info.size(); i++)
{
h_info = v_info[i].type_id != BI_TYPE_ID_USED_CXXFLAGS ? font->getHeight() * 2 + OFFSET_INNER_MID : ccw_body->getHeight() - y_info;
CComponentsExtTextForm *info = new CComponentsExtTextForm(OFFSET_INNER_MID, y_info, w_info, h_info, g_Locale->getText(v_info[i].caption), v_info[i].info_text, NULL, ccw_body);
info->setLabelAndTextFont(font);
@@ -216,7 +222,8 @@ void CBuildInfo::InitInfoItems()
// Use parameter 'type_info' to get specific information.
build_info_t CBuildInfo::getInfo(const info_type_id_t &type_id)
{
for(size_t i=0; i<v_info.size(); i++){
for (size_t i = 0; i < v_info.size(); i++)
{
if (v_info[i].type_id == type_id)
return v_info[i];
}

View File

@@ -23,7 +23,6 @@
Boston, MA 02110-1301, USA.
*/
#ifndef __buildinfo__
#define __buildinfo__
@@ -74,7 +73,7 @@ class CBuildInfo : public CMenuTarget, public CComponentsWindow
CBuildInfo(bool show = false);
///assigns text Font type
// assigns text Font type
void setFontType(Font *font_text);
build_info_t getInfo(const info_type_id_t &type_id);
void hide();