forked from qt-creator/qt-creator
Implements previewing qml preview for a qmlproject
To run it requires either designpreview.apk installed on the device or apks placed in <QTCREATATORDIR>/share/qtcreator/android/qtdesignviewer/ Apk filename should follow designpreview_$ARCH.apk Task-number: QAA-512 Change-Id: Ida955b0fac519112d4623166677a7ba8e9afb1f4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
74
src/plugins/android/androidqmlpreviewworker.h
Normal file
74
src/plugins/android/androidqmlpreviewworker.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2021 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** 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 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include "androidconfigurations.h"
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
namespace Android {
|
||||
class SdkToolResult;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class UploadInfo
|
||||
{
|
||||
public:
|
||||
Utils::FilePath uploadPackage;
|
||||
Utils::FilePath projectFolder;
|
||||
};
|
||||
|
||||
class AndroidQmlPreviewWorker : public ProjectExplorer::RunWorker
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AndroidQmlPreviewWorker(ProjectExplorer::RunControl *runControl);
|
||||
|
||||
private:
|
||||
void start() override;
|
||||
void stop() override;
|
||||
|
||||
bool ensureAvdIsRunning();
|
||||
bool checkAndInstallPreviewApp();
|
||||
bool prepareUpload(UploadInfo &transfer);
|
||||
bool uploadFiles(const UploadInfo &transfer);
|
||||
|
||||
bool runPreviewApp(const UploadInfo &transfer);
|
||||
bool stopPreviewApp();
|
||||
|
||||
void startLogcat();
|
||||
void appendLogLines(const QStringList &lines);
|
||||
|
||||
Utils::FilePath createQmlrcFile(const Utils::FilePath &workFolder, const QString &basename);
|
||||
|
||||
ProjectExplorer::RunControl *m_rc = nullptr;
|
||||
AndroidConfig m_config;
|
||||
AndroidDeviceInfo m_devInfo;
|
||||
QStringList m_avdAbis;
|
||||
int m_viewerPid = -1;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
||||
Reference in New Issue
Block a user