QmlTest.qml 30.9 KB
Newer Older
1 2 3
import QtQuick                  2.11
import QtQuick.Controls         2.4
import QtQuick.Controls.Styles  1.4
4
import QtQuick.Layouts          1.11
Don Gagne's avatar
Don Gagne committed
5

6 7 8
import QGroundControl.Palette       1.0
import QGroundControl.Controls      1.0
import QGroundControl.ScreenTools   1.0
Don Gagne's avatar
Don Gagne committed
9 10

Rectangle {
11
    id: _root
12 13 14
    anchors.fill:       parent
    anchors.margins:    ScreenTools.defaultFontPixelWidth
    color:              "white"
15

16 17 18 19 20 21 22 23 24 25 26 27 28
    property var palette:           QGCPalette { colorGroupEnabled: true }
    property var enabledPalette:    QGCPalette { colorGroupEnabled: true }
    property var disabledPalette:   QGCPalette { colorGroupEnabled: false }

    function exportPaletteColors(pal) {
        var objToExport = {}
        for(var clrName in pal) {
            if(pal[clrName].r !== undefined) {
                objToExport[clrName] = pal[clrName].toString();
            }
        }
        return objToExport;
    }
29

30 31 32 33 34
    function fillPalette(pal, colorsObj) {
        for(var clrName in colorsObj) {
            pal[clrName] = colorsObj[clrName];
        }
    }
Don Gagne's avatar
Don Gagne committed
35

36 37 38
    function exportTheme() {
        var themeObj = {"light": {}, "dark":{}}
        var oldTheme = palette.globalTheme;
Don Gagne's avatar
Don Gagne committed
39

40 41 42 43 44 45 46 47 48 49
        palette.globalTheme = QGCPalette.Light
        palette.colorGroupEnabled = true
        themeObj.light["enabled"] = exportPaletteColors(palette);
        palette.colorGroupEnabled = false
        themeObj.light["disabled"] = exportPaletteColors(palette);
        palette.globalTheme = QGCPalette.Dark
        palette.colorGroupEnabled = true
        themeObj.dark["enabled"] = exportPaletteColors(palette);
        palette.colorGroupEnabled = false
        themeObj.dark["disabled"] = exportPaletteColors(palette);
50

51 52
        palette.globalTheme = oldTheme;
        palette.colorGroupEnabled = true;
53

54
        var jsonString = JSON.stringify(themeObj, null, 4);
55

56 57
        themeImportExportEdit.text = jsonString
    }
58

59 60 61 62 63 64 65 66 67
    function exportThemeCPP() {
        var palToExport = ""
        for(var i = 0; i < palette.colors.length; i++) {
            var cs = palette.colors[i]
            var csc = cs + 'Colors'
            palToExport += 'DECLARE_QGC_COLOR(' + cs + ', \"' + palette[csc][1] + '\", \"' + palette[csc][0] + '\", \"' + palette[csc][3] + '\", \"' + palette[csc][2] + '\")\n'
        }
        themeImportExportEdit.text = palToExport
    }
68

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
    function exportThemePlugin() {
        var palToExport = ""
        for(var i = 0; i < palette.colors.length; i++) {
            var cs = palette.colors[i]
            var csc = cs + 'Colors'
            if(i > 0) {
                palToExport += '\nelse '
            }
            palToExport +=
            'if (colorName == QStringLiteral(\"' + cs + '\")) {\n' +
            '    colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled]   = QColor(\"' + palette[csc][2] + '\");\n' +
            '    colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupDisabled]  = QColor(\"' + palette[csc][3] + '\");\n' +
            '    colorInfo[QGCPalette::Light][QGCPalette::ColorGroupEnabled]  = QColor(\"' + palette[csc][0] + '\");\n' +
            '    colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor(\"' + palette[csc][1] + '\");\n' +
            '}'
        }
        themeImportExportEdit.text = palToExport
    }
87

88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
    function importTheme(jsonStr) {
        var jsonObj = JSON.parse(jsonStr)
        var themeObj = {"light": {}, "dark":{}}
        var oldTheme = palette.globalTheme;

        palette.globalTheme = QGCPalette.Light
        palette.colorGroupEnabled = true
        fillPalette(palette, jsonObj.light.enabled)
        palette.colorGroupEnabled = false
        fillPalette(palette, jsonObj.light.disabled);
        palette.globalTheme = QGCPalette.Dark
        palette.colorGroupEnabled = true
        fillPalette(palette, jsonObj.dark.enabled);
        palette.colorGroupEnabled = false
        fillPalette(palette, jsonObj.dark.disabled);

        palette.globalTheme = oldTheme;
        palette.colorGroupEnabled = true;

        paletteImportExportPopup.close()
    }
109

110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
    //-------------------------------------------------------------------------
    //-- Export/Import
    Popup {
        id:             paletteImportExportPopup
        width:          impCol.width  + (ScreenTools.defaultFontPixelWidth  * 4)
        height:         impCol.height + (ScreenTools.defaultFontPixelHeight * 2)
        modal:          true
        focus:          true
        parent:         Overlay.overlay
        closePolicy:    Popup.CloseOnEscape | Popup.CloseOnPressOutside
        x:              Math.round((mainWindow.width  - width)  * 0.5)
        y:              Math.round((mainWindow.height - height) * 0.5)
        onVisibleChanged: {
            if(visible) {
                exportTheme()
                _jsonButton.checked = true
            }
        }
        background: Rectangle {
            anchors.fill:   parent
            color:          palette.window
            radius:         ScreenTools.defaultFontPixelHeight * 0.5
            border.width:   1
            border.color:   palette.text
        }
        Column {
            id:             impCol
            spacing:        ScreenTools.defaultFontPixelHeight
            anchors.centerIn: parent
            Row {
                id:         exportFormats
                spacing:    ScreenTools.defaultFontPixelWidth  * 2
                anchors.horizontalCenter: parent.horizontalCenter
                QGCRadioButton {
                    id:     _jsonButton
                    text:   "Json"
                    onClicked: exportTheme()
147
                }
148 149 150
                QGCRadioButton {
                    text: "QGC"
                    onClicked: exportThemeCPP()
151
                }
152 153 154
                QGCRadioButton {
                    text: "Custom Plugin"
                    onClicked: exportThemePlugin()
155
                }
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
            }
            Rectangle {
                width:              flick.width  + (ScreenTools.defaultFontPixelWidth  * 2)
                height:             flick.height + (ScreenTools.defaultFontPixelHeight * 2)
                color:              "white"
                anchors.margins:    10
                Flickable {
                    id:             flick
                    clip:           true
                    width:          mainWindow.width  * 0.666
                    height:         mainWindow.height * 0.666
                    contentWidth:   themeImportExportEdit.paintedWidth
                    contentHeight:  themeImportExportEdit.paintedHeight
                    anchors.centerIn: parent
                    flickableDirection: Flickable.VerticalFlick

                    function ensureVisible(r)
                    {
                       if (contentX >= r.x)
                           contentX = r.x;
                       else if (contentX+width <= r.x+r.width)
                           contentX = r.x+r.width-width;
                       if (contentY >= r.y)
                           contentY = r.y;
                       else if (contentY+height <= r.y+r.height)
                           contentY = r.y+r.height-height;
182
                    }
183 184 185 186 187 188 189 190

                    TextEdit {
                       id:          themeImportExportEdit
                       width:       flick.width
                       focus:       true
                       font.family: ScreenTools.fixedFontFamily
                       font.pointSize: ScreenTools.defaultFontPointSize
                       onCursorRectangleChanged: flick.ensureVisible(cursorRectangle)
191
                    }
192 193 194 195 196 197 198 199 200 201 202
                }
            }
            Row {
                spacing:    ScreenTools.defaultFontPixelWidth  * 2
                anchors.horizontalCenter: parent.horizontalCenter
                QGCButton {
                    id:         importButton
                    text:       "Import (Json Only)"
                    enabled:    themeImportExportEdit.text[0] === "{" && _jsonButton.checked
                    onClicked: {
                        importTheme(themeImportExportEdit.text);
203 204
                    }
                }
205 206 207 208 209
                QGCButton {
                    text:       "Close"
                    onClicked: {
                        paletteImportExportPopup.close()
                    }
210
                }
211 212 213
            }
        }
    }
214

215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
    //-------------------------------------------------------------------------
    //-- Header
    Rectangle {
        id:         _header
        width:      parent.width
        height:     themeChoice.height * 2
        color:      palette.window
        anchors.top: parent.top
        Row {
            id:         themeChoice
            spacing:    20
            anchors.centerIn: parent
            QGCLabel {
                text:   qsTr("Window Color")
                anchors.verticalCenter: parent.verticalCenter
            }
            QGCButton {
                text:   qsTr("Import/Export")
                anchors.verticalCenter: parent.verticalCenter
                onClicked: paletteImportExportPopup.open()
            }
            Row {
                spacing:         20
                anchors.verticalCenter: parent.verticalCenter
                QGCRadioButton {
                    text:       qsTr("Light")
                    checked:    _root.palette.globalTheme === QGCPalette.Light
                    onClicked: {
                        _root.palette.globalTheme = QGCPalette.Light
244
                    }
245 246 247 248 249 250
                }
                QGCRadioButton {
                    text:       qsTr("Dark")
                    checked:    _root.palette.globalTheme === QGCPalette.Dark
                    onClicked: {
                        _root.palette.globalTheme = QGCPalette.Dark
Don Gagne's avatar
Don Gagne committed
251 252
                    }
                }
Gus Grubba's avatar
Gus Grubba committed
253
            }
254 255 256 257 258 259 260 261 262 263 264 265 266
        }
    }
    //-------------------------------------------------------------------------
    //-- Main Contents
    QGCFlickable {
        anchors.top:            _header.bottom
        anchors.bottom:         parent.bottom
        width:                  parent.width
        contentWidth:           _rootCol.width
        contentHeight:          _rootCol.height
        clip:                   true
        Column {
            id:         _rootCol
267 268
            Row {
                spacing: 30
269 270 271 272 273
                // Edit theme GroupBox
                GroupBox {
                    title: "Preview and edit theme"
                Column {
                    id: editRoot
274
                    spacing: 5
275
                    property size cellSize: "90x25"
Gus Grubba's avatar
Gus Grubba committed
276

277 278
                    // Header row
                    Row {
Gus Grubba's avatar
Gus Grubba committed
279
                        Text {
280 281 282 283 284 285
                            width: editRoot.cellSize.width * 2
                            height: editRoot.cellSize.height
                            text: ""
                        }
                        Text {
                            width: editRoot.cellSize.width; height: editRoot.cellSize.height
Gus Grubba's avatar
Gus Grubba committed
286
                            color: "black"
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
                            horizontalAlignment: Text.AlignLeft
                            text: qsTr("Enabled")
                        }
                        Text {
                            width: editRoot.cellSize.width; height: editRoot.cellSize.height
                            color: "black"
                            horizontalAlignment: Text.AlignHCenter
                            text: qsTr("Value")
                        }
                        Text {
                            width: editRoot.cellSize.width; height: editRoot.cellSize.height
                            color: "black"
                            horizontalAlignment: Text.AlignHCenter
                            text: qsTr("Disabled")
                        }
                        Text {
                            width: editRoot.cellSize.width; height: editRoot.cellSize.height
                            color: "black"
                            horizontalAlignment: Text.AlignHCenter
                            text: qsTr("Value")
Gus Grubba's avatar
Gus Grubba committed
307
                        }
308
                    }
Gus Grubba's avatar
Gus Grubba committed
309

310 311 312 313 314 315 316
                    // Populate the model with all color names in the global palette
                    Component.onCompleted: {
                        for(var colorNameStr in palette) {
                            if(palette[colorNameStr].r !== undefined) {
                                paletteColorList.append({ colorName: colorNameStr });
                            }
                        }
317 318
                    }

319 320
                    ListModel {
                        id: paletteColorList
321 322
                    }

323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
                    // Reproduce all the models
                    Repeater {
                        model: paletteColorList
                        delegate: Row {
                            spacing: 5
                            Text {
                                width: editRoot.cellSize.width * 2
                                height: editRoot.cellSize.height
                                horizontalAlignment: Text.AlignRight
                                verticalAlignment: Text.AlignVCenter
                                color: "black"
                                text: colorName
                            }
                            ClickableColor {
                                id: enabledColorPicker
                                color: enabledPalette[colorName]
                                onColorSelected: enabledPalette[colorName] = color
                            }
                            TextField {
                                id: enabledTextField
                                width: editRoot.cellSize.width; height: editRoot.cellSize.height
                                inputMask: "\\#>HHHHHHhh;"
                                horizontalAlignment: Text.AlignLeft
                                text: enabledPalette[colorName]
                                onEditingFinished: enabledPalette[colorName] = text
                            }
                            ClickableColor {
                                id: disabledColorPicker
                                color: disabledPalette[colorName]
                                onColorSelected: disabledPalette[colorName] = color
                            }
                            TextField {
                                width: editRoot.cellSize.width; height: editRoot.cellSize.height
                                inputMask: enabledTextField.inputMask
                                horizontalAlignment: Text.AlignLeft
                                text: disabledPalette[colorName]
                                onEditingFinished: disabledPalette[colorName] = text
                            }
                        }
362
                    }
363 364
                } // Column
                } // GroupBox { title: "Preview and edit theme"
365 366

                // QGC controls preview
367
                GroupBox { title: "Controls preview"
368 369
                Column {
                    id: ctlPrevColumn
370 371
                    property real _colWidth: ScreenTools.defaultFontPointSize * 18
                    property real _height: _colWidth*0.15
372 373 374 375 376 377 378 379 380 381
                    property color _bkColor: qgcPal.window
                    spacing: 10
                    width: previewGrid.width
                    Grid {
                        id: previewGrid
                        columns: 3
                        spacing: 10

                        // Header row
                        Text {
382
                            width: ctlPrevColumn._colWidth
383 384 385 386 387 388
                            height: ctlPrevColumn._height
                            color: "black"
                            horizontalAlignment: Text.AlignHCenter
                            text: qsTr("QGC name")
                        }
                        Text {
389
                            width: ctlPrevColumn._colWidth
390 391 392 393 394 395
                            height: ctlPrevColumn._height
                            color: "black"
                            horizontalAlignment: Text.AlignHCenter
                            text: qsTr("Enabled")
                        }
                        Text {
396
                            width: ctlPrevColumn._colWidth
397 398 399 400 401 402 403 404 405 406 407 408
                            height: ctlPrevColumn._height
                            color: "black"
                            horizontalAlignment: Text.AlignHCenter
                            text: qsTr("Disabled")
                        }

                        // QGCLabel
                        Loader {
                            sourceComponent: ctlRowHeader
                            property string text: "QGCLabel"
                        }
                        Rectangle {
409
                            width: ctlPrevColumn._colWidth
410 411 412 413 414 415 416 417 418
                            height: ctlPrevColumn._height
                            color: ctlPrevColumn._bkColor
                            QGCLabel {
                                anchors.fill: parent
                                anchors.margins: 5
                                text: qsTr("Label")
                            }
                        }
                        Rectangle {
419
                            width: ctlPrevColumn._colWidth
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435
                            height: ctlPrevColumn._height
                            color: ctlPrevColumn._bkColor
                            QGCLabel {
                                anchors.fill: parent
                                anchors.margins: 5
                                text: qsTr("Label")
                                enabled: false
                            }
                        }

                        // QGCButton
                        Loader {
                            sourceComponent: ctlRowHeader
                            property string text: "QGCButton"
                        }
                        QGCButton {
436
                            width: ctlPrevColumn._colWidth
437 438 439 440
                            height: ctlPrevColumn._height
                            text: qsTr("Button")
                        }
                        QGCButton {
441
                            width: ctlPrevColumn._colWidth
442 443 444 445 446 447 448 449 450 451 452
                            height: ctlPrevColumn._height
                            text: qsTr("Button")
                            enabled: false
                        }

                        // QGCButton - primary
                        Loader {
                            sourceComponent: ctlRowHeader
                            property string text: "QGCButton(primary)"
                        }
                        QGCButton {
453
                            width: ctlPrevColumn._colWidth
454 455 456 457 458
                            height: ctlPrevColumn._height
                            primary: true
                            text: qsTr("Button")
                        }
                        QGCButton {
Gus Grubba's avatar
Gus Grubba committed
459
                            width:  ctlPrevColumn._colWidth
460
                            height: ctlPrevColumn._height
Gus Grubba's avatar
Gus Grubba committed
461
                            text:   qsTr("Button")
462 463 464 465 466 467 468 469 470 471
                            primary: true
                            enabled: false
                        }

                        // QGCHoverButton
                        Loader {
                            sourceComponent: ctlRowHeader
                            property string text: "QGCHoverButton"
                        }
                        QGCHoverButton {
Gus Grubba's avatar
Gus Grubba committed
472
                            width:  ctlPrevColumn._colWidth
473
                            height: ctlPrevColumn._height * 2
Gus Grubba's avatar
Gus Grubba committed
474
                            text:   qsTr("Hover Button")
475 476 477 478
                            radius: ScreenTools.defaultFontPointSize
                            imageSource: "/qmlimages/Gears.svg"
                        }
                        QGCHoverButton {
Gus Grubba's avatar
Gus Grubba committed
479
                            width:  ctlPrevColumn._colWidth
480
                            height: ctlPrevColumn._height * 2
Gus Grubba's avatar
Gus Grubba committed
481
                            text:   qsTr("Hover Button")
482 483 484 485 486 487 488 489 490 491 492 493
                            radius: ScreenTools.defaultFontPointSize
                            imageSource: "/qmlimages/Gears.svg"
                            enabled: false
                        }

                        // QGCButton - menu
                        Loader {
                            sourceComponent: ctlRowHeader
                            property string text: "QGCButton(menu)"
                        }
                        Menu {
                            id: buttonMenu
494
                            QGCMenuItem {
495 496
                                text: qsTr("Item 1")
                            }
497
                            QGCMenuItem {
498 499
                                text: qsTr("Item 2")
                            }
500
                            QGCMenuItem {
501 502 503 504
                                text: qsTr("Item 3")
                            }
                        }
                        QGCButton {
505
                            width: ctlPrevColumn._colWidth
506 507
                            height: ctlPrevColumn._height
                            text: qsTr("Button")
508
                            onClicked: buttonMenu.popup()
509 510
                        }
                        QGCButton {
511
                            width: ctlPrevColumn._colWidth
512 513 514
                            height: ctlPrevColumn._height
                            text: qsTr("Button")
                            enabled: false
515
                            onClicked: buttonMenu.popup()
516 517 518 519 520 521 522 523
                        }

                        // QGCRadioButton
                        Loader {
                            sourceComponent: ctlRowHeader
                            property string text: "QGCRadioButton"
                        }
                        Rectangle {
524
                            width: ctlPrevColumn._colWidth
525 526 527 528 529 530 531 532 533
                            height: ctlPrevColumn._height
                            color: ctlPrevColumn._bkColor
                            QGCRadioButton {
                                anchors.fill: parent
                                anchors.margins: 5
                                text: qsTr("Radio")
                            }
                        }
                        Rectangle {
534
                            width: ctlPrevColumn._colWidth
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550
                            height: ctlPrevColumn._height
                            color: ctlPrevColumn._bkColor
                            QGCRadioButton {
                                anchors.fill: parent
                                anchors.margins: 5
                                text: qsTr("Radio")
                                enabled: false
                            }
                        }

                        // QGCCheckBox
                        Loader {
                            sourceComponent: ctlRowHeader
                            property string text: "QGCCheckBox"
                        }
                        Rectangle {
551
                            width: ctlPrevColumn._colWidth
552 553 554 555 556 557 558 559 560
                            height: ctlPrevColumn._height
                            color: ctlPrevColumn._bkColor
                            QGCCheckBox {
                                anchors.fill: parent
                                anchors.margins: 5
                                text: qsTr("Check Box")
                            }
                        }
                        Rectangle {
561
                            width: ctlPrevColumn._colWidth
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577
                            height: ctlPrevColumn._height
                            color: ctlPrevColumn._bkColor
                            QGCCheckBox {
                                anchors.fill: parent
                                anchors.margins: 5
                                text: qsTr("Check Box")
                                enabled: false
                            }
                        }

                        // QGCTextField
                        Loader {
                            sourceComponent: ctlRowHeader
                            property string text: "QGCTextField"
                        }
                        QGCTextField {
578
                            width: ctlPrevColumn._colWidth
579 580 581 582
                            height: ctlPrevColumn._height
                            text: "QGCTextField"
                        }
                        QGCTextField {
583
                            width: ctlPrevColumn._colWidth
584 585 586 587 588 589 590 591 592 593 594
                            height: ctlPrevColumn._height
                            text: "QGCTextField"
                            enabled: false
                        }

                        // QGCComboBox
                        Loader {
                            sourceComponent: ctlRowHeader
                            property string text: "QGCComboBox"
                        }
                        QGCComboBox {
595
                            width: ctlPrevColumn._colWidth
596 597 598 599
                            height: ctlPrevColumn._height
                            model: [ qsTr("Item 1"), qsTr("Item 2"), qsTr("Item 3") ]
                        }
                        QGCComboBox {
600
                            width: ctlPrevColumn._colWidth
601 602 603 604 605 606 607 608 609 610 611
                            height: ctlPrevColumn._height
                            model: [ qsTr("Item 1"), qsTr("Item 2"), qsTr("Item 3") ]
                            enabled: false
                        }

                        // SubMenuButton
                        Loader {
                            sourceComponent: ctlRowHeader
                            property string text: "SubMenuButton"
                        }
                        SubMenuButton {
612 613
                            width: ctlPrevColumn._colWidth
                            height: ctlPrevColumn._colWidth/3
614 615 616
                            text: qsTr("SUB MENU")
                        }
                        SubMenuButton {
617 618
                            width: ctlPrevColumn._colWidth
                            height: ctlPrevColumn._colWidth/3
619 620 621 622 623 624 625 626 627 628
                            text: qsTr("SUB MENU")
                            enabled: false
                        }
                    }
                    Rectangle {
                        width:  previewGrid.width
                        height: 60
                        radius: 3
                        color:  palette.alertBackground
                        border.color: palette.alertBorder
Gus Grubba's avatar
Gus Grubba committed
629
                        border.width: 1
630 631 632
                        anchors.horizontalCenter: parent.horizontalCenter
                        Label {
                            text: "Alert Message"
Gus Grubba's avatar
Gus Grubba committed
633
                            color: palette.alertText
634 635 636
                            anchors.centerIn: parent
                        }
                    }
637 638
                } // Column
                } // GroupBox { title: "Controls preview"
639
            }
640 641 642 643

            Item{
                height: 10;
                width:  1;
644
            }
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660

            Row {
                spacing: 10
                anchors.horizontalCenter: parent.horizontalCenter
                Loader {
                    property color backgroundColor: qgcPal.window
                    sourceComponent: arbBox
                }
                Loader {
                    property color backgroundColor: qgcPal.windowShade
                    sourceComponent: arbBox
                }
                Loader {
                    property color backgroundColor: qgcPal.windowShadeDark
                    sourceComponent: arbBox
                }
661
            }
662

663 664
        }

Don Gagne's avatar
Don Gagne committed
665
    }
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749

    Component {
        id: ctlRowHeader
        Rectangle {
            width:  ctlPrevColumn._colWidth
            height: ctlPrevColumn._height
            color:  "white"
            Text {
                color:  "black"
                text:   parent.parent.text
                anchors.fill: parent
                horizontalAlignment: Text.AlignRight
                verticalAlignment: Text.AlignVCenter
            }
        }
    }

    Component {
        id: arbBox
        Rectangle {
            width:  arbGrid.width  * 1.5
            height: arbGrid.height * 1.5
            color:  backgroundColor
            border.color: qgcPal.text
            border.width: 1
            anchors.horizontalCenter: parent.horizontalCenter
            GridLayout {
                id: arbGrid
                columns: 4
                rowSpacing: 10
                anchors.centerIn: parent
                QGCColoredImage {
                    color:                      qgcPal.colorGreen
                    width:                      ScreenTools.defaultFontPixelWidth * 2
                    height:                     width
                    sourceSize.height:          width
                    mipmap:                     true
                    fillMode:                   Image.PreserveAspectFit
                    source:                     "/qmlimages/Gears.svg"
                }
                Label { text: "colorGreen"; color: qgcPal.colorGreen; }
                QGCColoredImage {
                    color:                      qgcPal.colorOrange
                    width:                      ScreenTools.defaultFontPixelWidth * 2
                    height:                     width
                    sourceSize.height:          width
                    mipmap:                     true
                    fillMode:                   Image.PreserveAspectFit
                    source:                     "/qmlimages/Gears.svg"
                }
                Label { text: "colorOrange"; color: qgcPal.colorOrange; }
                QGCColoredImage {
                    color:                      qgcPal.colorRed
                    width:                      ScreenTools.defaultFontPixelWidth * 2
                    height:                     width
                    sourceSize.height:          width
                    mipmap:                     true
                    fillMode:                   Image.PreserveAspectFit
                    source:                     "/qmlimages/Gears.svg"
                }
                Label { text: "colorRed"; color: qgcPal.colorRed; }
                QGCColoredImage {
                    color:                      qgcPal.colorGrey
                    width:                      ScreenTools.defaultFontPixelWidth * 2
                    height:                     width
                    sourceSize.height:          width
                    mipmap:                     true
                    fillMode:                   Image.PreserveAspectFit
                    source:                     "/qmlimages/Gears.svg"
                }
                Label { text: "colorGrey"; color: qgcPal.colorGrey;  }
                QGCColoredImage {
                    color:                      qgcPal.colorBlue
                    width:                      ScreenTools.defaultFontPixelWidth * 2
                    height:                     width
                    sourceSize.height:          width
                    mipmap:                     true
                    fillMode:                   Image.PreserveAspectFit
                    source:                     "/qmlimages/Gears.svg"
                }
                Label { text: "colorBlue"; color: qgcPal.colorBlue; }
            }
        }
    }
Don Gagne's avatar
Don Gagne committed
750
}