2012-04-18 20:30:57 +03:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 BogDan Vatra <bog_dan_ro@yahoo.com>
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2012-04-18 20:30:57 +03:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
#include "androidruncontrol.h"
|
|
|
|
|
|
|
|
|
|
#include "androidglobal.h"
|
|
|
|
|
#include "androidrunconfiguration.h"
|
|
|
|
|
#include "androidrunner.h"
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
|
2012-08-09 01:56:51 +02:00
|
|
|
using namespace ProjectExplorer;
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
namespace Android {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
AndroidRunControl::AndroidRunControl(AndroidRunConfiguration *rc)
|
2015-06-29 10:36:29 +03:00
|
|
|
: RunControl(rc, ProjectExplorer::Constants::NORMAL_RUN_MODE)
|
|
|
|
|
, m_runner(new AndroidRunner(this, rc, ProjectExplorer::Constants::NORMAL_RUN_MODE))
|
2012-04-18 20:30:57 +03:00
|
|
|
, m_running(false)
|
|
|
|
|
{
|
2014-05-27 18:50:55 +02:00
|
|
|
setIcon(QLatin1String(ProjectExplorer::Constants::ICON_RUN_SMALL));
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AndroidRunControl::~AndroidRunControl()
|
|
|
|
|
{
|
|
|
|
|
stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidRunControl::start()
|
|
|
|
|
{
|
|
|
|
|
m_running = true;
|
|
|
|
|
emit started();
|
|
|
|
|
disconnect(m_runner, 0, this, 0);
|
|
|
|
|
|
2015-06-12 15:36:04 +02:00
|
|
|
connect(m_runner, SIGNAL(remoteErrorOutput(QString)),
|
|
|
|
|
SLOT(handleRemoteErrorOutput(QString)));
|
|
|
|
|
connect(m_runner, SIGNAL(remoteOutput(QString)),
|
|
|
|
|
SLOT(handleRemoteOutput(QString)));
|
2012-07-26 14:53:45 +02:00
|
|
|
connect(m_runner, SIGNAL(remoteProcessFinished(QString)),
|
|
|
|
|
SLOT(handleRemoteProcessFinished(QString)));
|
2012-09-28 16:13:16 +02:00
|
|
|
appendMessage(tr("Starting remote process."), Utils::NormalMessageFormat);
|
2012-04-18 20:30:57 +03:00
|
|
|
m_runner->start();
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-09 01:56:51 +02:00
|
|
|
RunControl::StopResult AndroidRunControl::stop()
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2012-12-18 14:25:07 +02:00
|
|
|
m_runner->stop();
|
2012-04-18 20:30:57 +03:00
|
|
|
return StoppedSynchronously;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AndroidRunControl::handleRemoteProcessFinished(const QString &error)
|
|
|
|
|
{
|
|
|
|
|
appendMessage(error, Utils::ErrorMessageFormat);
|
|
|
|
|
disconnect(m_runner, 0, this, 0);
|
|
|
|
|
m_running = false;
|
|
|
|
|
emit finished();
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-12 15:36:04 +02:00
|
|
|
void AndroidRunControl::handleRemoteOutput(const QString &output)
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2015-06-12 15:36:04 +02:00
|
|
|
appendMessage(output, Utils::StdOutFormatSameLine);
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
2015-06-12 15:36:04 +02:00
|
|
|
void AndroidRunControl::handleRemoteErrorOutput(const QString &output)
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2015-06-12 15:36:04 +02:00
|
|
|
appendMessage(output, Utils::StdErrFormatSameLine);
|
2012-04-18 20:30:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AndroidRunControl::isRunning() const
|
|
|
|
|
{
|
|
|
|
|
return m_running;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString AndroidRunControl::displayName() const
|
|
|
|
|
{
|
|
|
|
|
return m_runner->displayName();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
2013-10-16 11:02:37 +02:00
|
|
|
} // namespace Android
|