| 1 | /**************************************************************************** |
|---|---|
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the tools applications of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
| 21 | ** included in the packaging of this file. Please review the following |
| 22 | ** information to ensure the GNU General Public License requirements will |
| 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 24 | ** |
| 25 | ** $QT_END_LICENSE$ |
| 26 | ** |
| 27 | ****************************************************************************/ |
| 28 | |
| 29 | #include "treewalker.h" |
| 30 | #include "ui4.h" |
| 31 | |
| 32 | QT_BEGIN_NAMESPACE |
| 33 | |
| 34 | void TreeWalker::acceptUI(DomUI *ui) |
| 35 | { |
| 36 | acceptWidget(ui->elementWidget()); |
| 37 | if (const DomButtonGroups *domButtonGroups = ui->elementButtonGroups()) |
| 38 | acceptButtonGroups(domButtonGroups); |
| 39 | |
| 40 | acceptTabStops(ui->elementTabStops()); |
| 41 | } |
| 42 | |
| 43 | void TreeWalker::acceptLayoutDefault(DomLayoutDefault *layoutDefault) |
| 44 | { |
| 45 | Q_UNUSED(layoutDefault); |
| 46 | } |
| 47 | |
| 48 | void TreeWalker::acceptLayoutFunction(DomLayoutFunction *layoutFunction) |
| 49 | { |
| 50 | Q_UNUSED(layoutFunction); |
| 51 | } |
| 52 | |
| 53 | void TreeWalker::acceptTabStops(DomTabStops *tabStops) |
| 54 | { |
| 55 | Q_UNUSED(tabStops); |
| 56 | } |
| 57 | |
| 58 | void TreeWalker::acceptLayout(DomLayout *layout) |
| 59 | { |
| 60 | for (int i=0; i<layout->elementProperty().size(); ++i) |
| 61 | acceptProperty(layout->elementProperty().at(i)); |
| 62 | |
| 63 | for (int i=0; i<layout->elementItem().size(); ++i) |
| 64 | acceptLayoutItem(layout->elementItem().at(i)); |
| 65 | } |
| 66 | |
| 67 | void TreeWalker::acceptLayoutItem(DomLayoutItem *layoutItem) |
| 68 | { |
| 69 | switch (layoutItem->kind()) { |
| 70 | case DomLayoutItem::Widget: |
| 71 | acceptWidget(layoutItem->elementWidget()); |
| 72 | return; |
| 73 | case DomLayoutItem::Layout: |
| 74 | acceptLayout(layoutItem->elementLayout()); |
| 75 | return; |
| 76 | case DomLayoutItem::Spacer: |
| 77 | acceptSpacer(layoutItem->elementSpacer()); |
| 78 | return; |
| 79 | case DomLayoutItem::Unknown: |
| 80 | break; |
| 81 | } |
| 82 | |
| 83 | Q_ASSERT( 0 ); |
| 84 | } |
| 85 | |
| 86 | void TreeWalker::acceptWidget(DomWidget *widget) |
| 87 | { |
| 88 | for (int i=0; i<widget->elementAction().size(); ++i) |
| 89 | acceptAction(widget->elementAction().at(i)); |
| 90 | |
| 91 | for (int i=0; i<widget->elementActionGroup().size(); ++i) |
| 92 | acceptActionGroup(widget->elementActionGroup().at(i)); |
| 93 | |
| 94 | for (int i=0; i<widget->elementAddAction().size(); ++i) |
| 95 | acceptActionRef(widget->elementAddAction().at(i)); |
| 96 | |
| 97 | for (int i=0; i<widget->elementProperty().size(); ++i) |
| 98 | acceptProperty(widget->elementProperty().at(i)); |
| 99 | |
| 100 | |
| 101 | |
| 102 | // recurse down |
| 103 | DomWidgets childWidgets; |
| 104 | for (int i=0; i<widget->elementWidget().size(); ++i) { |
| 105 | DomWidget *child = widget->elementWidget().at(i); |
| 106 | childWidgets += child; |
| 107 | acceptWidget(child); |
| 108 | } |
| 109 | |
| 110 | if (!widget->elementLayout().isEmpty()) |
| 111 | acceptLayout(widget->elementLayout().at(0)); |
| 112 | } |
| 113 | |
| 114 | void TreeWalker::acceptSpacer(DomSpacer *spacer) |
| 115 | { |
| 116 | for (int i=0; i<spacer->elementProperty().size(); ++i) |
| 117 | acceptProperty(spacer->elementProperty().at(i)); |
| 118 | } |
| 119 | |
| 120 | void TreeWalker::acceptColor(DomColor *color) |
| 121 | { |
| 122 | Q_UNUSED(color); |
| 123 | } |
| 124 | |
| 125 | void TreeWalker::acceptColorGroup(DomColorGroup *colorGroup) |
| 126 | { |
| 127 | Q_UNUSED(colorGroup); |
| 128 | } |
| 129 | |
| 130 | void TreeWalker::acceptPalette(DomPalette *palette) |
| 131 | { |
| 132 | acceptColorGroup(palette->elementActive()); |
| 133 | acceptColorGroup(palette->elementInactive()); |
| 134 | acceptColorGroup(palette->elementDisabled()); |
| 135 | } |
| 136 | |
| 137 | void TreeWalker::acceptFont(DomFont *font) |
| 138 | { |
| 139 | Q_UNUSED(font); |
| 140 | } |
| 141 | |
| 142 | void TreeWalker::acceptPoint(DomPoint *point) |
| 143 | { |
| 144 | Q_UNUSED(point); |
| 145 | } |
| 146 | |
| 147 | void TreeWalker::acceptRect(DomRect *rect) |
| 148 | { |
| 149 | Q_UNUSED(rect); |
| 150 | } |
| 151 | |
| 152 | void TreeWalker::acceptSizePolicy(DomSizePolicy *sizePolicy) |
| 153 | { |
| 154 | Q_UNUSED(sizePolicy); |
| 155 | } |
| 156 | |
| 157 | void TreeWalker::acceptSize(DomSize *size) |
| 158 | { |
| 159 | Q_UNUSED(size); |
| 160 | } |
| 161 | |
| 162 | void TreeWalker::acceptDate(DomDate *date) |
| 163 | { |
| 164 | Q_UNUSED(date); |
| 165 | } |
| 166 | |
| 167 | void TreeWalker::acceptTime(DomTime *time) |
| 168 | { |
| 169 | Q_UNUSED(time); |
| 170 | } |
| 171 | |
| 172 | void TreeWalker::acceptDateTime(DomDateTime *dateTime) |
| 173 | { |
| 174 | Q_UNUSED(dateTime); |
| 175 | } |
| 176 | |
| 177 | void TreeWalker::acceptProperty(DomProperty *property) |
| 178 | { |
| 179 | switch (property->kind()) { |
| 180 | case DomProperty::Bool: |
| 181 | case DomProperty::Color: |
| 182 | case DomProperty::Cstring: |
| 183 | case DomProperty::Cursor: |
| 184 | case DomProperty::CursorShape: |
| 185 | case DomProperty::Enum: |
| 186 | case DomProperty::Font: |
| 187 | case DomProperty::Pixmap: |
| 188 | case DomProperty::IconSet: |
| 189 | case DomProperty::Palette: |
| 190 | case DomProperty::Point: |
| 191 | case DomProperty::PointF: |
| 192 | case DomProperty::Rect: |
| 193 | case DomProperty::RectF: |
| 194 | case DomProperty::Set: |
| 195 | case DomProperty::Locale: |
| 196 | case DomProperty::SizePolicy: |
| 197 | case DomProperty::Size: |
| 198 | case DomProperty::SizeF: |
| 199 | case DomProperty::String: |
| 200 | case DomProperty::Number: |
| 201 | case DomProperty::LongLong: |
| 202 | case DomProperty::Char: |
| 203 | case DomProperty::Date: |
| 204 | case DomProperty::Time: |
| 205 | case DomProperty::DateTime: |
| 206 | case DomProperty::Url: |
| 207 | case DomProperty::Unknown: |
| 208 | case DomProperty::StringList: |
| 209 | case DomProperty::Float: |
| 210 | case DomProperty::Double: |
| 211 | case DomProperty::UInt: |
| 212 | case DomProperty::ULongLong: |
| 213 | case DomProperty::Brush: |
| 214 | break; |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | void TreeWalker::acceptCustomWidgets(DomCustomWidgets *customWidgets) |
| 219 | { |
| 220 | for (int i=0; i<customWidgets->elementCustomWidget().size(); ++i) |
| 221 | acceptCustomWidget(customWidgets->elementCustomWidget().at(i)); |
| 222 | } |
| 223 | |
| 224 | void TreeWalker::acceptCustomWidget(DomCustomWidget *customWidget) |
| 225 | { |
| 226 | Q_UNUSED(customWidget); |
| 227 | } |
| 228 | |
| 229 | void TreeWalker::acceptAction(DomAction *action) |
| 230 | { |
| 231 | Q_UNUSED(action); |
| 232 | } |
| 233 | |
| 234 | void TreeWalker::acceptActionGroup(DomActionGroup *actionGroup) |
| 235 | { |
| 236 | for (int i=0; i<actionGroup->elementAction().size(); ++i) |
| 237 | acceptAction(actionGroup->elementAction().at(i)); |
| 238 | |
| 239 | for (int i=0; i<actionGroup->elementActionGroup().size(); ++i) |
| 240 | acceptActionGroup(actionGroup->elementActionGroup().at(i)); |
| 241 | } |
| 242 | |
| 243 | void TreeWalker::acceptActionRef(DomActionRef *actionRef) |
| 244 | { |
| 245 | Q_UNUSED(actionRef); |
| 246 | } |
| 247 | |
| 248 | void TreeWalker::acceptIncludes(DomIncludes *includes) |
| 249 | { |
| 250 | for (int i=0; i<includes->elementInclude().size(); ++i) |
| 251 | acceptInclude(includes->elementInclude().at(i)); |
| 252 | } |
| 253 | |
| 254 | void TreeWalker::acceptInclude(DomInclude *incl) |
| 255 | { |
| 256 | Q_UNUSED(incl); |
| 257 | } |
| 258 | |
| 259 | void TreeWalker::acceptConnections(DomConnections *connections) |
| 260 | { |
| 261 | for (int i=0; i<connections->elementConnection().size(); ++i) |
| 262 | acceptConnection(connections->elementConnection().at(i)); |
| 263 | } |
| 264 | |
| 265 | void TreeWalker::acceptConnection(DomConnection *connection) |
| 266 | { |
| 267 | acceptConnectionHints(connection->elementHints()); |
| 268 | } |
| 269 | |
| 270 | void TreeWalker::acceptConnectionHints(DomConnectionHints *connectionHints) |
| 271 | { |
| 272 | for (int i=0; i<connectionHints->elementHint().size(); ++i) |
| 273 | acceptConnectionHint(connectionHints->elementHint().at(i)); |
| 274 | } |
| 275 | |
| 276 | void TreeWalker::acceptConnectionHint(DomConnectionHint *connectionHint) |
| 277 | { |
| 278 | Q_UNUSED(connectionHint); |
| 279 | } |
| 280 | |
| 281 | void TreeWalker::acceptButtonGroups(const DomButtonGroups *domButtonGroups) |
| 282 | { |
| 283 | const auto &domGroups = domButtonGroups->elementButtonGroup(); |
| 284 | for (const DomButtonGroup *g : domGroups) |
| 285 | acceptButtonGroup(g); |
| 286 | } |
| 287 | |
| 288 | void TreeWalker::acceptButtonGroup(const DomButtonGroup *) |
| 289 | { |
| 290 | } |
| 291 | |
| 292 | QT_END_NAMESPACE |
| 293 |