2016-01-15 14:57:40 +01:00
|
|
|
/****************************************************************************
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
|
|
|
|
** Contact: https://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
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2014-07-04 14:28:55 +02:00
|
|
|
#include "android_global.h"
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
#include <projectexplorer/runconfiguration.h>
|
2016-10-10 15:38:50 +03:00
|
|
|
#include <qtsupport/qtoutputformatter.h>
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2016-10-10 15:38:50 +03:00
|
|
|
#include <QMenu>
|
|
|
|
|
|
|
|
|
|
class QToolButton;
|
2012-04-18 20:30:57 +03:00
|
|
|
namespace Android {
|
|
|
|
|
|
2016-10-10 15:38:50 +03:00
|
|
|
class AndroidOutputFormatter : public QtSupport::QtOutputFormatter
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
enum LogLevel {
|
|
|
|
|
None = 0,
|
|
|
|
|
Verbose = 1,
|
|
|
|
|
Info = 1 << 1,
|
|
|
|
|
Debug = 1 << 2,
|
|
|
|
|
Warning = 1 << 3,
|
|
|
|
|
Error = 1 << 4,
|
|
|
|
|
Fatal = 1 << 5,
|
|
|
|
|
All = Verbose | Info | Debug | Warning | Error | Fatal,
|
|
|
|
|
SkipFiltering = ~All
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit AndroidOutputFormatter(ProjectExplorer::Project *project);
|
|
|
|
|
~AndroidOutputFormatter();
|
|
|
|
|
|
|
|
|
|
// OutputFormatter interface
|
|
|
|
|
QList<QWidget*> toolbarWidgets() const override;
|
|
|
|
|
void appendMessage(const QString &text, Utils::OutputFormat format) override;
|
|
|
|
|
void clear() override;
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void appendPid(qint64 pid, const QString &name);
|
|
|
|
|
void removePid(qint64 pid);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
struct CachedLine {
|
|
|
|
|
qint64 pid;
|
|
|
|
|
LogLevel level;
|
|
|
|
|
QString content;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void updateLogMenu(LogLevel set = None, LogLevel reset = None);
|
|
|
|
|
void filterMessage(const CachedLine &line);
|
|
|
|
|
|
|
|
|
|
void applyFilter();
|
|
|
|
|
void addLogAction(LogLevel level, QMenu *logsMenu, const QString &name) {
|
|
|
|
|
auto action = logsMenu->addAction(name);
|
|
|
|
|
m_logLevels.push_back(qMakePair(level, action));
|
|
|
|
|
action->setCheckable(true);
|
|
|
|
|
connect(action, &QAction::triggered, this, [level, this](bool checked) {
|
|
|
|
|
updateLogMenu(checked ? level : None , checked ? None : level);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
int m_logLevelFlags = All;
|
|
|
|
|
QVector<QPair<LogLevel, QAction*>> m_logLevels;
|
|
|
|
|
QHash<qint64, QAction*> m_pids;
|
|
|
|
|
QScopedPointer<QToolButton> m_filtersButton;
|
|
|
|
|
QMenu *m_appsMenu;
|
|
|
|
|
QList<CachedLine> m_cachedLines;
|
|
|
|
|
};
|
|
|
|
|
|
2014-07-04 14:28:55 +02:00
|
|
|
class ANDROID_EXPORT AndroidRunConfiguration : public ProjectExplorer::RunConfiguration
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2014-07-04 14:28:55 +02:00
|
|
|
AndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2015-11-13 11:06:27 +01:00
|
|
|
QWidget *createConfigurationWidget() override;
|
|
|
|
|
Utils::OutputFormatter *createOutputFormatter() const override;
|
2012-04-18 20:30:57 +03:00
|
|
|
const QString remoteChannel() const;
|
|
|
|
|
|
|
|
|
|
protected:
|
2012-04-24 15:49:09 +02:00
|
|
|
AndroidRunConfiguration(ProjectExplorer::Target *parent, AndroidRunConfiguration *source);
|
2012-04-18 20:30:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Android
|