/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt for Device Creation. ** ** $QT_BEGIN_LICENSE:GPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 or (at your option) any later version ** approved by the KDE Free Qt Foundation. The licenses are as published by ** the Free Software Foundation and appearing in the file LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ import QtQuick 2.0 import AutomationHelper 1.0 Item { property var visibleItem property var demoHeader property var launcherHeader property var visibleItemName: visibleItem ? visibleItem.objectName : 0 property bool demoModeSeleted: globalSettings.demoModeSelected property bool demoIsRunning: false property int demoInitialStartTime: 2000 // How fast demo starts after turning the demo on property int demoIdleStartTime: 2 * 60 * 1000 // How fast demo starts after idle property int demoStepDuration: 2000 property int applicationWaitDuration: 1000 property int verticalFlickVelocity: 1000 property int horizontalFlickVelocity: 1000 onDemoModeSeletedChanged: { if (demoModeSeleted) { demoStartCounter.interval = demoInitialStartTime demoStartCounter.start() } else { demoStartCounter.stop() stopDemos() } } /* Start the demo sequence. First demo to start depends on the current screen. */ function startDemos() { console.log("Start automatic demo mode") if (visibleItemName === "settingsView") { settingsDemoAnimation.start() } else if ((visibleItemName === "launchScreen") || (visibleItemName === "detailView")) { switchToSettingScreenAnimation.start() } else { exitFromRunningDemoAnimation.start() } demoIsRunning = true } /* Stop all currently running demos */ function stopDemos() { console.log("Stop automatic demo mode") switchToSettingScreenAnimation.stop() settingsDemoAnimation.stop() gridViewDemoAnimation.stop() graphicsEffectsDemoAnimation.stop() qtChartsDemoAnimation.stop() switchToDetailViewAnimation.stop() detailViewDemoAnimation.stop() eBikeViewDemoAnimation.stop() demoIsRunning = false // Restart demo after idle time if (demoModeSeleted) { demoStartCounter.interval = demoIdleStartTime demoStartCounter.restart() } } Timer { id: demoStartCounter repeat: false onTriggered: startDemos() } /* Cet index of with \a title from the \a applicationList */ function applicationIndex(applicationList, title) { var i var applicationListModel = applicationList.model // count and get() do not work on QAbstractItemModel, rowCount and query must be used for (i=0; i