From 74b87d9c5280e9416a45499ebc1418af71228734 Mon Sep 17 00:00:00 2001 From: Atul R Date: Thu, 6 Jun 2019 16:51:24 +0200 Subject: [PATCH] convert some logs to spdlog --- config/deps.gypi | 1 + package.json | 1 + src/cpp/core/FlexLayout/flexlayout.cpp | 5 +- src/cpp/core/YogaWidget/yogawidget.cpp | 211 +++++++++++++------------ 4 files changed, 116 insertions(+), 102 deletions(-) diff --git a/config/deps.gypi b/config/deps.gypi index 383a0baae..0370389ec 100644 --- a/config/deps.gypi +++ b/config/deps.gypi @@ -2,6 +2,7 @@ "includes": [], "target_defaults": { "include_dirs": ['../deps/'], + "cflags": ['-DSPDLOG_COMPILED_LIB'], "sources": [ "../deps/yoga/Yoga.cpp", "../deps/yoga/YGValue.cpp", diff --git a/package.json b/package.json index 67d9d86ab..b56840f12 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ }, "scripts": { "build:addon": "node-gyp -j 8 build", + "rebuild:addon": "node-gyp -j 8 build", "build:lib": "rm -rf ./dist/ && tsc", "dev": "yarn build:lib && qode dist/demo.js" }, diff --git a/src/cpp/core/FlexLayout/flexlayout.cpp b/src/cpp/core/FlexLayout/flexlayout.cpp index de8ee7a36..46587db04 100644 --- a/src/cpp/core/FlexLayout/flexlayout.cpp +++ b/src/cpp/core/FlexLayout/flexlayout.cpp @@ -1,6 +1,7 @@ #include "flexlayout.h" #include #include +#include "spdlog/spdlog.h" FlexLayout::NodeContext *FlexLayout::getNodeContext(YGNodeRef node) const { @@ -46,7 +47,7 @@ QSize FlexLayout::sizeHint() const{ } void FlexLayout::addItem(QLayoutItem * item){ - qDebug() <<"Unsupported method addItem. item:"<(item)); } QLayoutItem *FlexLayout::itemAt(int index) const @@ -85,7 +86,7 @@ int FlexLayout::count() const void FlexLayout::addWidget(QWidget* childWidget, YGNodeRef childNode) { if(!this->node){ - qDebug()<<"Flex layout's parent yoga node not set yet. Set it using setFlexNode. Child widget will not be added to Flex Layout"; + spdlog::warn("Flex layout's parent yoga node not set yet. Set it using setFlexNode. Child widget will not be added to Flex Layout"); return; } uint count = YGNodeGetChildCount(this->node); diff --git a/src/cpp/core/YogaWidget/yogawidget.cpp b/src/cpp/core/YogaWidget/yogawidget.cpp index c0612120e..412328139 100644 --- a/src/cpp/core/YogaWidget/yogawidget.cpp +++ b/src/cpp/core/YogaWidget/yogawidget.cpp @@ -1,140 +1,151 @@ #include "yogawidget.h" +#include "spdlog/spdlog.h" -void YogaWidget::setYDisplay(QString display){ +void YogaWidget::setYDisplay(QString rawValue){ try { - int value = NodeStyle::NodeDisplay.at(display.toStdString()); + std::string rawDisplay = rawValue.toStdString(); + int value = NodeStyle::NodeDisplay.at(rawDisplay); YGNodeStyleSetDisplay(this->getFlexNode(),static_cast(value)); - this->_yDisplay = display; - qDebug()<<"Value set display "<_yDisplay = rawValue; + spdlog::info("Value set display {}", rawDisplay); }catch(...){ - qDebug()<<"Error: display "<getFlexNode(),static_cast(value)); - this->_yAlignItems = alignItems; - qDebug()<<"Value set alignItems "<_yAlignItems = rawValue; + spdlog::info("Value set alignItems {}", rawAlignItems); }catch(...){ - qDebug()<<"Error: alignItems: "<getFlexNode(),static_cast(value)); - this->_yAlignContent = alignContent; - qDebug()<<"Value set alignContent "<_yAlignContent = rawValue; + qDebug()<<"Value set alignContent "<getFlexNode(),static_cast(value)); - this->_yAlignSelf = alignSelf; - qDebug()<<"Value set alignSelf "<_yAlignSelf = rawValue; + qDebug()<<"Value set alignSelf "<getFlexNode(),static_cast(value)); - this->_yJustifyContent = justifyContent; - qDebug()<<"Value set justifyContent "<_yJustifyContent = rawValue; + qDebug()<<"Value set justifyContent "<getFlexNode(),static_cast(value)); - this->_yDirection = direction; - qDebug()<<"Value set direction "<_yDirection = rawValue; + qDebug()<<"Value set direction "<getFlexNode(),static_cast(value)); - this->_yFlexDirection = flexDirection; - qDebug()<<"Value set flexDirection "<_yFlexDirection = rawValue; + qDebug()<<"Value set flexDirection "<getFlexNode(),static_cast(value)); - this->_yOverflow = overflow; - qDebug()<<"Value set overflow "<_yOverflow = rawValue; + qDebug()<<"Value set overflow "<getFlexNode(),static_cast(value)); - this->_yPosition = position; - qDebug()<<"Value set positionType "<_yPosition = rawValue; + qDebug()<<"Value set positionType "<getFlexNode(),static_cast(value)); - this->_yFlexWrap = flexWrap; - qDebug()<<"Value set flexWrap "<_yFlexWrap = rawValue; + qDebug()<<"Value set flexWrap "<getFlexNode(),flex); - this->_yFlex = flex; - qDebug()<<"Value set flex "<getFlexNode(),rawValue); + this->_yFlex = rawValue; + qDebug()<<"Value set flex "<getFlexNode(),flexGrow); - this->_yFlexGrow = flexGrow; - qDebug()<<"Value set flexGrow "<getFlexNode(),rawValue); + this->_yFlexGrow = rawValue; + qDebug()<<"Value set flexGrow "<getFlexNode(),flexShrink); - this->_yFlexShrink = flexShrink; - qDebug()<<"Value set flexShrink "<getFlexNode(),rawValue); + this->_yFlexShrink = rawValue; + qDebug()<<"Value set flexShrink "<getFlexNode(),aspectRatio); - this->_yAspectRatio = aspectRatio; - qDebug()<<"Value set aspectRatio "<getFlexNode(),rawValue); + this->_yAspectRatio = rawValue; + qDebug()<<"Value set aspectRatio "<getFlexNode(),YGEdgeTop,measurement.value); this->_yTop = rawValue; }catch(...){ - qDebug()<<"Error: top: "<getFlexNode(),YGEdgeRight,measurement.value); this->_yRight = rawValue; }catch(...){ - qDebug()<<"Error: right: "<getFlexNode(),YGEdgeBottom,measurement.value); this->_yBottom = rawValue; }catch(...){ - qDebug()<<"Error: bottom: "<getFlexNode(),YGEdgeLeft,measurement.value); this->_yLeft = rawValue; }catch(...){ - qDebug()<<"Error: left: "<_yFlexBasis = rawValue; }catch(...){ - qDebug()<<"Error: flexBasis: "<getFlexNode(), measurement.value); this->_yMinWidth = rawValue; }catch(...){ - qDebug()<<"Error: minWidth: "<getFlexNode(), measurement.value); this->_yMinHeight = rawValue; }catch(...){ - qDebug()<<"Error: minHeight: "<getFlexNode(), measurement.value); this->_yMaxWidth = rawValue; }catch(...){ - qDebug()<<"Error: maxWidth: "<getFlexNode(), measurement.value); this->_yMaxHeight = rawValue; }catch(...){ - qDebug()<<"Error: maxHeight: "<getFlexNode(),YGEdgeTop, measurement.value); this->_yPaddingTop = rawValue; }catch(...){ - qDebug()<<"Error: paddingTop: "<getFlexNode(),YGEdgeRight, measurement.value); this->_yPaddingRight = rawValue; }catch(...){ - qDebug()<<"Error: paddingRight: "<getFlexNode(),YGEdgeBottom, measurement.value); this->_yPaddingBottom = rawValue; }catch(...){ - qDebug()<<"Error: paddingBottom: "<getFlexNode(), YGEdgeLeft, measurement.value); this->_yPaddingLeft = rawValue; }catch(...){ - qDebug()<<"Error: paddingLeft: "<getFlexNode(),YGEdgeHorizontal, measurement.value); this->_yPaddingHorizontal = rawValue; }catch(...){ - qDebug()<<"Error: paddingHorizontal: "<getFlexNode(),YGEdgeVertical, measurement.value); this->_yPaddingVertical = rawValue; }catch(...){ - qDebug()<<"Error: paddingVertical: "<getFlexNode(),YGEdgeAll, measurement.value); this->_yPadding = rawValue; }catch(...){ - qDebug()<<"Error: padding: "<getFlexNode(),YGEdgeTop, measurement.value); this->_yMarginTop = rawValue; }catch(...){ - qDebug()<<"Error: marginTop: "<getFlexNode(),YGEdgeRight, measurement.value); this->_yMarginRight = rawValue; }catch(...){ - qDebug()<<"Error: marginRight: "<getFlexNode(),YGEdgeBottom, measurement.value); this->_yMarginBottom = rawValue; }catch(...){ - qDebug()<<"Error: marginBottom: "<getFlexNode(), YGEdgeLeft, measurement.value); this->_yMarginLeft = rawValue; }catch(...){ - qDebug()<<"Error: marginLeft: "<getFlexNode(),YGEdgeHorizontal, measurement.value); this->_yMarginHorizontal = rawValue; }catch(...){ - qDebug()<<"Error: marginHorizontal: "<getFlexNode(),YGEdgeVertical, measurement.value); this->_yMarginVertical = rawValue; }catch(...){ - qDebug()<<"Error: marginVertical: "<getFlexNode(),YGEdgeAll, measurement.value); this->_yMargin = rawValue; }catch(...){ - qDebug()<<"Error: margin: "<getFlexNode(),YGEdgeTop, rawValue); this->_yBorderTop = rawValue; }catch(...){ - qDebug()<<"Error: borderTop: "<getFlexNode(),YGEdgeRight, rawValue); this->_yBorderRight = rawValue; }catch(...){ - qDebug()<<"Error: borderRight: "<getFlexNode(),YGEdgeBottom, rawValue); this->_yBorderBottom = rawValue; }catch(...){ - qDebug()<<"Error: borderBottom: "<getFlexNode(), YGEdgeLeft, rawValue); this->_yBorderLeft = rawValue; }catch(...){ - qDebug()<<"Error: borderLeft: "<getFlexNode(),YGEdgeHorizontal, rawValue); this->_yBorderHorizontal = rawValue; }catch(...){ - qDebug()<<"Error: borderHorizontal: "<getFlexNode(),YGEdgeVertical, rawValue); this->_yBorderVertical = rawValue; }catch(...){ - qDebug()<<"Error: borderVertical: "<getFlexNode(), YGEdgeAll, rawValue); this->_yBorder = rawValue; }catch(...){ - qDebug()<<"Error: border: "<