Skip to content

Commit

Permalink
- Test setUIType work WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Gleb Aronsky <[email protected]>
  • Loading branch information
Gleb Aronsky committed Nov 14, 2014
1 parent 0e6cc37 commit 2c8454d
Show file tree
Hide file tree
Showing 12 changed files with 186 additions and 102 deletions.
2 changes: 1 addition & 1 deletion configurator/ConfigSchemaHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ const char* CConfigSchemaHelper::printQML(const char* comp, int nIdx) const
if (pSchema != NULL)
{
//pSchema->loadXMLFromEnvXml(CConfigSchemaHelper::getConstEnvPropertyTree());
pSchema->getQML(strQML, nIdx);
pSchema->getQML2(strQML, nIdx);
return strQML.str();
}
}
Expand Down
16 changes: 8 additions & 8 deletions configurator/QMLMarkup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static const char* QML_FLICKABLE_HEIGHT("\n\
contentHeight: ");

static const char* QML_FLICKABLE_END("\n\
}\n");
} // QML_FLICKABLE_END\n");

static const char* QML_SCROLL_BAR_TRANSITIONS("\n\
states: State {\n\
Expand Down Expand Up @@ -130,7 +130,7 @@ static const char* QML_TAB_VIEW_HEIGHT("\
implicitHeight: ");

static const char* QML_TAB_VIEW_END("\
}\n");
} // QML_TAB_VIEW_END");


static const char* QML_TAB_VIEW_STYLE("\
Expand Down Expand Up @@ -163,7 +163,7 @@ static const char* QML_TAB_TITLE_BEGIN("\
title: \"");
static const char* QML_TAB_TITLE_END("\"\n");
static const char* QML_TAB_END("\
}\n");
} // QML_TAB_END\n");

static const char* QML_TAB_TEXT_STYLE("\
\n\
Expand Down Expand Up @@ -198,7 +198,7 @@ static const char* QML_ROW_BEGIN("\
Row {\n");

static const char* QML_ROW_END("\n\
}\n");
} // QML_ROW_END\n");

static const char* QML_RECTANGLE_LIGHT_STEEEL_BLUE_BEGIN("\
Rectangle {\n\
Expand Down Expand Up @@ -235,7 +235,7 @@ static const char* QML_TEXT_END("\"\n\
}\n\
width: childrenRect.width\n\
height: childrenRect.height\n\
}\n");
} // QML_TEXT_END\n");

static const char* QML_TEXT_BEGIN_2("\
Text {\n\
Expand All @@ -249,7 +249,7 @@ static const char* QML_TEXT_BEGIN_2("\
text: ");

static const char* QML_TEXT_END_2("\n\
}\n");
} // QML_TEXT_END_2 \n");

static const char* QML_TEXT_FIELD_PLACE_HOLDER_TEXT_BEGIN("\n\
placeholderText: ");
Expand Down Expand Up @@ -278,7 +278,7 @@ static const char* QML_TEXT_FIELD_ID_BEGIN("\
static const char* QML_TEXT_FIELD_ID_END("\n");

static const char* QML_TEXT_FIELD_END("\n\
}\n");
} // QML_TEXT_FIELD_END\n");

static const char* QML_LIST_MODEL_BEGIN("\
model: ListModel {\n");
Expand Down Expand Up @@ -319,7 +319,7 @@ static const char* QML_GRID_LAYOUT_BEGIN_1("\
flow: GridLayout.LeftToRight\n");

static const char* QML_GRID_LAYOUT_END("\
}\n");
} // QML_GRID_LAYOUT_END");

static const char* QML_TOOLTIP_TEXT_BEGIN("\
\n\
Expand Down
74 changes: 71 additions & 3 deletions configurator/SchemaAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,61 @@ void CAttribute::getQML(StringBuffer &strQML, int idx) const

#endif // _USE_OLD_GET_QML_

void CAttribute::getQML2(StringBuffer &strQML, int idx) const
{

if (this->getUIType() == QML_UI_TEXT_FIELD)
{

strQML.append(QML_ROW_BEGIN).append(QML_RECTANGLE_DEFAULT_COLOR_SCHEME_1_BEGIN);
DEBUG_MARK_QML;

strQML.append(QML_TEXT_BEGIN_2).append("\" ").append(this->getTitle()).append("\"").append(QML_TEXT_END_2);
DEBUG_MARK_QML;

strQML.append(QML_RECTANGLE_LIGHT_STEEEL_BLUE_END);
DEBUG_MARK_QML;

strQML.append(QML_TEXT_FIELD_BEGIN);

StringBuffer strTextArea("textarea");
CQMLMarkupHelper::getRandomID(&strTextArea);

strQML.append(QML_APP_DATA_GET_VALUE_BEGIN).append(this->getEnvXPath()).append(QML_APP_DATA_GET_VALUE_END);

strQML.append(QML_ON_ACCEPTED);
strQML.append(QML_APP_DATA_SET_VALUE_BEGIN).append(this->getEnvXPath()).append("\", ").append(strTextArea.str()).append(QML_APP_DATA_SET_VALUE_END);

strQML.append(QML_TEXT_FIELD_ID_BEGIN).append(strTextArea).append(QML_TEXT_FIELD_ID_END);
DEBUG_MARK_QML;

strQML.append(QML_TEXT_FIELD_PLACE_HOLDER_TEXT_BEGIN);
strQML.append("\"").append(this->getDefault()).append("\"");
strQML.append(QML_TEXT_FIELD_PLACE_HOLDER_TEXT_END);
DEBUG_MARK_QML;

if (this->getAnnotation()->getAppInfo() != NULL) // check for tooltip
{
CQMLMarkupHelper::getToolTipQML(strQML, this->getAnnotation()->getAppInfo()->getToolTip(), strTextArea.str());
}

strQML.append(QML_TEXT_FIELD_END);
DEBUG_MARK_QML;

strQML.append(QML_ROW_END);
DEBUG_MARK_QML;
}
else if (this->getUIType() == QML_UI_TABLE_CONTENTS)
{
CQMLMarkupHelper::getTableViewColumn(strQML, this->getTitle(), this->getEnvXPath());
DEBUG_MARK_QML;
}
else
{
assert(!"Why here");
}
}

void CAttribute::populateEnvXPath(StringBuffer strXPath, unsigned int index)
{
assert(this->getName() != NULL);
Expand Down Expand Up @@ -1075,10 +1130,23 @@ void CAttributeArray::getQML(StringBuffer &strQML, int idx) const

#endif //_USE_OLD_GET_QML_


void CAttributeArray::getQML2(StringBuffer &strQML, int idx = -1) const
void CAttributeArray::getQML2(StringBuffer &strQML, int idx) const
{

if (this->getUIType() == QML_UI_TEXT_FIELD)
{
//strQML.append(QML_TABLE_VIEW_BEGIN);
//DEBUG_MARK_QML;
}
for (int i = 0; i < this->length(); i++)
{
(this->item(i)).setUIType(this->getUIType());
(this->item(i)).getQML2(strQML,idx);
}
if (this->getUIType() == QML_UI_TEXT_FIELD)
{
//strQML.append(QML_TABLE_VIEW_END);
//DEBUG_MARK_QML;
}
}

void CAttributeArray::populateEnvXPath(StringBuffer strXPath, unsigned int index)
Expand Down
2 changes: 1 addition & 1 deletion configurator/SchemaCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "jregexp.hpp"
#include <cstring>

CXSDNodeBase::CXSDNodeBase(CXSDNodeBase* pParentNode, NODE_TYPES eNodeType) : m_pParentNode(pParentNode), m_eNodeType(eNodeType)
CXSDNodeBase::CXSDNodeBase(CXSDNodeBase* pParentNode, NODE_TYPES eNodeType) : m_pParentNode(pParentNode), m_eNodeType(eNodeType), m_eUIType(QML_UI_UNKNOWN)
{
assert(eNodeType != XSD_ERROR);

Expand Down
16 changes: 11 additions & 5 deletions configurator/SchemaCommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@
}
#define LAST_ONLY -1
#define LAST_AND_FIRST -2
#define QUICK_QML_ARRAY2(X) for (int idx=0; idx < this->length(); idx++) \
/*#define QUICK_QML_ARRAY2(X) for (int idx=0; idx < this->length(); idx++) \
{ \
(this->item(idx)).getQML(X, idx == this->length()-1 && idx == 0 ? LAST_AND_FIRST : (idx == this->length()-1 ? LAST_ONLY : idx)); \
}*/

#define QUICK_QML_ARRAY2(X) for (int idx=0; idx < this->length(); idx++) \
{ \
(this->item(idx)).getQML2(X, idx == this->length()-1 && idx == 0 ? LAST_AND_FIRST : (idx == this->length()-1 ? LAST_ONLY : idx)); \
}

#define QUICK_QML_ARRAY3(X) for (int idx=0; idx < this->length(); idx++) \
Expand Down Expand Up @@ -163,9 +168,11 @@ enum QML_UI_TYPE
QML_UI_TEXT_FIELD,
QML_UI_DROP_DOWN,
QML_UI_TABLE,
QML_UI_TABLE_CONTENTS,
QML_UI_TAB,
QML_UI_TAB_CONTENTS,
QML_UI_LABEL
QML_UI_LABEL,
QML_UI_EMPTY
};

static const char* DEFAULT_SCHEMA_DIRECTORY("/opt/HPCCSystems/componentfiles/configxml/");
Expand Down Expand Up @@ -503,11 +510,10 @@ class CXSDNodeBase

virtual void setUIType(QML_UI_TYPE eUI_Type)
{
m_eUIType = eUIType;
assert(m_eUIType == QML_UI_UNKNOWN);
m_eUIType = eUI_Type;
}



static void addEntryHandler(CXSDNodeHandler &Handler)
{
s_callBackEntryHandlersArray.append(Handler);
Expand Down
53 changes: 1 addition & 52 deletions configurator/SchemaComplexType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ const CXSDNodeBase* CComplexType::getNodeByTypeAndNameAscending(NODE_TYPES eNode
{
pMatchingNode = m_pSequence->getNodeByTypeAndNameAscending(eNodeType, pName);
}
if (pMatchingNode != NULL && m_pElementArray != NULL)
{
pMatchingNode = m_pElementArray->getNodeByTypeAndNameAscending(eNodeType, pName);
}
//if (pMatchingNode != NULL && )

return pMatchingNode;
}
Expand All @@ -58,10 +53,6 @@ const CXSDNodeBase* CComplexType::getNodeByTypeAndNameDescending(NODE_TYPES eNod
{
pMatchingNode = m_pSequence->getNodeByTypeAndNameDescending(eNodeType, pName);
}
if (pMatchingNode == NULL && m_pElementArray != NULL)
{
pMatchingNode = m_pSequence->getNodeByTypeAndNameDescending(eNodeType, pName);
}
if (pMatchingNode == NULL && m_pChoice != NULL)
{
pMatchingNode = m_pSequence->getNodeByTypeAndNameDescending(eNodeType, pName);
Expand Down Expand Up @@ -99,11 +90,6 @@ void CComplexType::dump(std::ostream& cout, unsigned int offset) const
m_pChoice->dump(cout, offset);
}

if (m_pElementArray != NULL)
{
m_pElementArray->dump(cout, offset);
}

if (m_pAttributeGroupArray != NULL)
{
m_pAttributeGroupArray->dump(cout, offset);
Expand Down Expand Up @@ -148,14 +134,6 @@ void CComplexType::getDocumentation(StringBuffer &strDoc) const
m_pChoice->getDocumentation(strDoc);
}

if (m_pElementArray != NULL)
{
strDoc.append(DM_SECT3_BEGIN);
DEBUG_MARK_STRDOC;
m_pElementArray->getDocumentation(strDoc);
strDoc.append(DM_SECT3_END);
}

if (m_pAttributeGroupArray != NULL)
{
m_pAttributeGroupArray->getDocumentation(strDoc);
Expand Down Expand Up @@ -184,11 +162,6 @@ void CComplexType::getDojoJS(StringBuffer &strJS) const
m_pChoice->getDojoJS(strJS);
}

if (m_pElementArray != NULL)
{
m_pElementArray->getDojoJS(strJS);
}

if (m_pAttributeGroupArray != NULL)
{
m_pAttributeGroupArray->getDojoJS(strJS);
Expand Down Expand Up @@ -221,11 +194,6 @@ void CComplexType::getQML(StringBuffer &strQML, int idx) const
m_pChoice->getQML(strQML);
}

if (m_pElementArray != NULL)
{
m_pElementArray->getQML(strQML);
}

/*if (m_pAttributeGroupArray != NULL)
{
m_pAttributeGroupArray->getQML(strQML);
Expand Down Expand Up @@ -253,7 +221,7 @@ void CComplexType::getQML2(StringBuffer &strQML, int idx) const
if (m_pAttributeArray != NULL)
{
DEBUG_MARK_QML;
m_pAttributeArray->setUIType(QML_UI_TAB);
m_pAttributeArray->setUIType(this->getUIType());
m_pAttributeArray->getQML2(strQML);
DEBUG_MARK_QML;
}
Expand All @@ -263,11 +231,6 @@ void CComplexType::getQML2(StringBuffer &strQML, int idx) const
m_pChoice->getQML2(strQML);
}

if (m_pElementArray != NULL)
{
m_pElementArray->getQML2(strQML);
}

if (m_pAttributeGroupArray != NULL)
{
m_pAttributeGroupArray->getQML2(strQML);
Expand Down Expand Up @@ -298,11 +261,6 @@ void CComplexType::populateEnvXPath(StringBuffer strXPath, unsigned int index)
m_pChoice->populateEnvXPath(strXPath, index);
}

if (m_pElementArray != NULL)
{
m_pElementArray->populateEnvXPath(strXPath, index);
}

if (m_pAttributeGroupArray != NULL)
{
m_pAttributeGroupArray->populateEnvXPath(strXPath, index);
Expand Down Expand Up @@ -331,11 +289,6 @@ void CComplexType::loadXMLFromEnvXml(const IPropertyTree *pEnvTree)
m_pChoice->loadXMLFromEnvXml(pEnvTree);
}

if (m_pElementArray != NULL)
{
m_pElementArray->loadXMLFromEnvXml(pEnvTree);
}

if (m_pAttributeGroupArray != NULL)
{
m_pAttributeGroupArray->loadXMLFromEnvXml(pEnvTree);
Expand All @@ -358,10 +311,6 @@ const char* CComplexType::getXML(const char* /*pComponent*/)
{
m_strXML.append(m_pChoice->getXML(NULL));
}
if (m_pElementArray != NULL)
{
m_strXML.append(m_pElementArray->getXML(NULL));
}
}

return m_strXML.str();
Expand Down
Loading

0 comments on commit 2c8454d

Please sign in to comment.