| 1 |
import QtQuick 2.0 |
| 2 |
|
| 3 |
Rectangle { |
| 4 |
width: 1024 |
| 5 |
height: 768 |
| 6 |
color: "black" |
| 7 |
|
| 8 |
// only show the UI on the main window |
| 9 |
property double __uiOpacity: __shouldShowUi ? 1.0 : 0.0 |
| 10 |
property bool __uiVisible: true |
| 11 |
readonly property bool __shouldShowUi: (isMainWindow && _application.showUI) |
| 12 |
readonly property bool isMainWindow: (_windowNumber === 0) |
| 13 |
|
| 14 |
Component.onCompleted: { |
| 15 |
// synchronize insitial state of this |
| 16 |
__uiVisible = __shouldShowUi; |
| 17 |
} |
| 18 |
|
| 19 |
Behavior on __uiOpacity { |
| 20 |
SequentialAnimation { |
| 21 |
ScriptAction { script: if (_application.showUI) __uiVisible = true; } |
| 22 |
NumberAnimation { duration: 400 } |
| 23 |
ScriptAction { script: if (!_application.showUI) __uiVisible = false; } |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
Image { |
| 28 |
opacity: __uiOpacity * 0.5 |
| 29 |
source: "qrc:///images/checkerboard" |
| 30 |
fillMode: Image.Tile |
| 31 |
anchors.fill: parent |
| 32 |
visible: __uiVisible |
| 33 |
} |
| 34 |
|
| 35 |
Repeater { |
| 36 |
model: _application.activeCanvases |
| 37 |
|
| 38 |
// we use a loader to only create canvases on the correct window |
| 39 |
// by driving the 'active' property |
| 40 |
delegate: Loader { |
| 41 |
id: canvasLoader |
| 42 |
sourceComponent: canvasFrame |
| 43 |
active: modelData.windowIndex === _windowNumber |
| 44 |
|
| 45 |
Binding { |
| 46 |
target: canvasLoader.item |
| 47 |
property: "canvas" |
| 48 |
value: model.modelData |
| 49 |
} |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
Component { |
| 54 |
id: canvasFrame |
| 55 |
CanvasFrame { |
| 56 |
showUi: __uiVisible |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
VerticalTabPanel { |
| 61 |
anchors.fill: parent |
| 62 |
tabs: [browsePanel, configPanel, snapshotsPanel] |
| 63 |
titles: ["Connect", "Load / Save", "Snapshots"] |
| 64 |
visible: __uiVisible |
| 65 |
opacity: __uiOpacity |
| 66 |
} |
| 67 |
|
| 68 |
Component { |
| 69 |
id: browsePanel |
| 70 |
BrowsePanel { } |
| 71 |
} |
| 72 |
|
| 73 |
Component { |
| 74 |
id: configPanel |
| 75 |
LoadSavePanel { } |
| 76 |
} |
| 77 |
|
| 78 |
Component { |
| 79 |
id: snapshotsPanel |
| 80 |
SnapshotsPanel { } |
| 81 |
} |
| 82 |
|
| 83 |
GetStarted { |
| 84 |
visible: isMainWindow |
| 85 |
anchors.centerIn: parent |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
} |