Commit bab670af authored by hjk's avatar hjk

android: code cosmetics

Fix whitespace, capitalization, naming, comments, add 'using'
in .cpp, remove 'using' in .h, remove unneeded Q_UNUSED, add
needed Q_UNUSED, etc.

Change-Id: Ibf9ba57850cbea1e79e152ec0165c8b01fa66567
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent d215470b
......@@ -78,7 +78,8 @@ public:
unsigned partitionSize;
};
struct AndroidDeviceInfo {
struct AndroidDeviceInfo
{
QString serialNumber;
QString cpuABI;
int sdk;
......@@ -87,9 +88,8 @@ struct AndroidDeviceInfo {
class AndroidConfigurations : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(AndroidConfigurations)
public:
public:
static AndroidConfigurations &instance(QObject *parent = 0);
AndroidConfig config() const { return m_config; }
void setConfig(const AndroidConfig &config);
......
......@@ -31,7 +31,7 @@
#ifndef ANDROIDCONSTANTS_H
#define ANDROIDCONSTANTS_H
#include <QLatin1String>
#include <QtGlobal>
namespace Android {
namespace Internal {
......@@ -44,8 +44,6 @@ enum AndroidQemuStatus {
AndroidQemuUserReason
};
#define ANDROID_PREFIX "Qt4ProjectManager.AndroidRunConfiguration"
#ifdef Q_OS_WIN32
#define ANDROID_EXE_SUFFIX ".exe"
#define ANDROID_BAT_SUFFIX ".bat"
......@@ -54,8 +52,6 @@ enum AndroidQemuStatus {
#define ANDROID_BAT_SUFFIX ""
#endif
static const QLatin1String ANDROID_RC_ID_PREFIX(ANDROID_PREFIX ":");
} // namespace Internal
namespace Constants {
......@@ -68,8 +64,7 @@ const char ANDROIDQT[] = "Qt4ProjectManager.QtVersion.Android";
const char ANDROID_DEVICE_TYPE[] = "Android.Device.Type";
const char ANDROID_DEVICE_ID[] = "Android Device";
}
} // namespace Constants;
} // namespace Android
#endif // ANDROIDCONSTANTS_H
......@@ -41,6 +41,7 @@ QT_END_NAMESPACE
namespace Android {
namespace Internal {
class AndroidCreateKeystoreCertificate : public QDialog
{
Q_OBJECT
......
......@@ -191,4 +191,4 @@ QStringList AndroidDebugSupport::qtSoPaths(QtSupport::BaseQtVersion *qtVersion)
}
} // namespace Internal
} // namespace Qt4ProjectManager
} // namespace Android
......@@ -34,16 +34,12 @@
#include "androidrunconfiguration.h"
#include <QObject>
#include <QPointer>
namespace Debugger {
class DebuggerRunControl;
}
namespace Debugger { class DebuggerRunControl; }
namespace QtSupport {class BaseQtVersion; }
namespace ProjectExplorer { class RunControl; }
namespace Android {
namespace Internal {
class AndroidRunConfiguration;
......@@ -52,6 +48,7 @@ class AndroidRunner;
class AndroidDebugSupport : public QObject
{
Q_OBJECT
public:
static ProjectExplorer::RunControl *createDebugRunControl(AndroidRunConfiguration *runConfig);
......
......@@ -42,40 +42,36 @@
#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtsupportconstants.h>
using namespace Android::Internal;
using namespace ProjectExplorer;
AndroidDeployConfiguration::AndroidDeployConfiguration(ProjectExplorer::Target *parent, Core::Id id)
:DeployConfiguration(parent, id)
namespace Android {
namespace Internal {
AndroidDeployConfiguration::AndroidDeployConfiguration(Target *parent, Core::Id id)
: DeployConfiguration(parent, id)
{
setDisplayName(tr("Deploy to Android device"));
setDefaultDisplayName(displayName());
}
AndroidDeployConfiguration::~AndroidDeployConfiguration()
AndroidDeployConfiguration::AndroidDeployConfiguration(Target *parent, DeployConfiguration *source)
: DeployConfiguration(parent, source)
{
}
AndroidDeployConfiguration::AndroidDeployConfiguration(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source)
:DeployConfiguration(parent, source)
{
}
AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory(QObject *parent) :
ProjectExplorer::DeployConfigurationFactory(parent)
AndroidDeployConfigurationFactory::AndroidDeployConfigurationFactory(QObject *parent)
: DeployConfigurationFactory(parent)
{
setObjectName(QLatin1String("AndroidDeployConfigurationFactory"));
}
bool AndroidDeployConfigurationFactory::canCreate(ProjectExplorer::Target *parent, const Core::Id id) const
bool AndroidDeployConfigurationFactory::canCreate(Target *parent, const Core::Id id) const
{
return availableCreationIds(parent).contains(id);
}
ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id)
DeployConfiguration *AndroidDeployConfigurationFactory::create(Target *parent, const Core::Id id)
{
Q_UNUSED(id);
AndroidDeployConfiguration *dc = new AndroidDeployConfiguration(parent, id);
if (!dc)
return 0;
......@@ -85,17 +81,17 @@ ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::create(
return dc;
}
bool AndroidDeployConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
bool AndroidDeployConfigurationFactory::canRestore(Target *parent, const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
return canCreate(parent, idFromMap(map));
}
ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
DeployConfiguration *AndroidDeployConfigurationFactory::restore(Target *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
AndroidDeployConfiguration *dc = new AndroidDeployConfiguration(parent, ProjectExplorer::idFromMap(map));
AndroidDeployConfiguration *dc = new AndroidDeployConfiguration(parent, idFromMap(map));
if (dc->fromMap(map))
return dc;
......@@ -103,21 +99,21 @@ ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::restore
return 0;
}
bool AndroidDeployConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source) const
bool AndroidDeployConfigurationFactory::canClone(Target *parent, DeployConfiguration *source) const
{
if (!AndroidManager::supportsAndroid(parent))
return false;
return source->id() == ANDROID_DEPLOYCONFIGURATION_ID;
}
ProjectExplorer::DeployConfiguration *AndroidDeployConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source)
DeployConfiguration *AndroidDeployConfigurationFactory::clone(Target *parent, DeployConfiguration *source)
{
if (!canClone(parent, source))
return 0;
return new AndroidDeployConfiguration(parent, source);
}
QList<Core::Id> AndroidDeployConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
QList<Core::Id> AndroidDeployConfigurationFactory::availableCreationIds(Target *parent) const
{
QList<Core::Id> ids;
if (!qobject_cast<Qt4ProjectManager::Qt4Project *>(parent->project()))
......@@ -126,10 +122,9 @@ QList<Core::Id> AndroidDeployConfigurationFactory::availableCreationIds(ProjectE
if (!parent->project()->supportsProfile(parent->profile()))
return ids;
ProjectExplorer::ToolChain *tc
= ProjectExplorer::ToolChainProfileInformation::toolChain(parent->profile());
ToolChain *tc = ToolChainProfileInformation::toolChain(parent->profile());
if (!tc || tc->targetAbi().osFlavor() != ProjectExplorer::Abi::AndroidLinuxFlavor)
if (!tc || tc->targetAbi().osFlavor() != Abi::AndroidLinuxFlavor)
return ids;
if (QtSupport::QtProfileInformation::qtVersion(parent->profile())->type() != QLatin1String(Constants::ANDROIDQT))
......@@ -141,12 +136,15 @@ QList<Core::Id> AndroidDeployConfigurationFactory::availableCreationIds(ProjectE
QString AndroidDeployConfigurationFactory::displayNameForId(const Core::Id id) const
{
if (id.toString().startsWith(QLatin1String(ANDROID_DC_PREFIX)))
if (id.name().startsWith(ANDROID_DC_PREFIX))
return tr("Deploy on Android");
return QString();
}
bool AndroidDeployConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const
bool AndroidDeployConfigurationFactory::canHandle(Target *parent) const
{
return AndroidManager::supportsAndroid(parent);
}
} // namespace Internal
} // namespace Android
......@@ -28,15 +28,14 @@
**
**************************************************************************/
#ifndef QT4PROJECTMANAGER_QT4ANDROIDDEPLOYCONFIGURATION_H
#define QT4PROJECTMANAGER_QT4ANDROIDDEPLOYCONFIGURATION_H
#ifndef ANDROIDDEPLOYCONFIGURATION_H
#define ANDROIDDEPLOYCONFIGURATION_H
#include <projectexplorer/deployconfiguration.h>
namespace Android {
namespace Internal {
class Target;
const char ANDROID_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.AndroidDeployConfiguration";
const char ANDROID_DC_PREFIX[] = "Qt4ProjectManager.AndroidDeployConfiguration.";
......@@ -47,7 +46,7 @@ class AndroidDeployConfiguration : public ProjectExplorer::DeployConfiguration
public:
AndroidDeployConfiguration(ProjectExplorer::Target *parent, Core::Id id);
virtual ~AndroidDeployConfiguration();
protected:
AndroidDeployConfiguration(ProjectExplorer::Target *parent, ProjectExplorer::DeployConfiguration *source);
......@@ -78,4 +77,4 @@ private:
} // namespace Internal
} // namespace Android
#endif // QT4PROJECTMANAGER_QT4ANDROIDDEPLOYCONFIGURATION_H
#endif // ANDROIDDEPLOYCONFIGURATION_H
......@@ -77,6 +77,7 @@ bool AndroidDeployStepFactory::canCreate(BuildStepList *parent, const Core::Id i
BuildStep *AndroidDeployStepFactory::create(BuildStepList *parent, const Core::Id id)
{
Q_ASSERT(canCreate(parent, id));
Q_UNUSED(id);
return new AndroidDeployStep(parent);
}
......
......@@ -34,9 +34,7 @@
#include <projectexplorer/buildstep.h>
QT_BEGIN_NAMESPACE
namespace Ui {
class AndroidDeployStepWidget;
}
namespace Ui { class AndroidDeployStepWidget; }
QT_END_NAMESPACE
namespace Android {
......
......@@ -49,7 +49,7 @@ AndroidDevice::AndroidDevice()
}
AndroidDevice::AndroidDevice(const AndroidDevice &other)
: ProjectExplorer::IDevice(other)
: IDevice(other)
{ }
......
......@@ -32,7 +32,6 @@
#include "androiddevice.h"
#include "androidconstants.h"
#include <coreplugin/id.h>
namespace Android {
namespace Internal {
......
......@@ -39,10 +39,6 @@
#define ASSERT_STATE_GENERIC(State, expected, actual) \
AndroidGlobal::assertState<State>(expected, actual, Q_FUNC_INFO)
QT_BEGIN_NAMESPACE
class QString;
QT_END_NAMESPACE
namespace Android {
namespace Internal {
......
......@@ -40,8 +40,6 @@
namespace ProjectExplorer { class Target; }
namespace Android {
class AndroidPlugin;
namespace Internal {
class AndroidManager : public QObject
......
......@@ -36,26 +36,20 @@
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtsupportconstants.h>
#include <QCoreApplication>
using ProjectExplorer::BuildStepList;
using ProjectExplorer::BuildStep;
using namespace ProjectExplorer;
namespace Android {
namespace Internal {
AndroidPackageCreationFactory::AndroidPackageCreationFactory(QObject *parent)
: ProjectExplorer::IBuildStepFactory(parent)
: IBuildStepFactory(parent)
{
}
QList<Core::Id> AndroidPackageCreationFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
QList<Core::Id> AndroidPackageCreationFactory::availableCreationIds(BuildStepList *parent) const
{
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
if (parent->id() != Constants::BUILDSTEPS_DEPLOY)
return QList<Core::Id>();
if (!AndroidManager::supportsAndroid(parent->target()))
return QList<Core::Id>();
......@@ -71,29 +65,27 @@ QString AndroidPackageCreationFactory::displayNameForId(const Core::Id id) const
return QString();
}
bool AndroidPackageCreationFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
bool AndroidPackageCreationFactory::canCreate(BuildStepList *parent, const Core::Id id) const
{
return availableCreationIds(parent).contains(id);
}
BuildStep *AndroidPackageCreationFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
BuildStep *AndroidPackageCreationFactory::create(BuildStepList *parent, const Core::Id id)
{
Q_ASSERT(canCreate(parent, id));
Q_UNUSED(id);
return new AndroidPackageCreationStep(parent);
}
bool AndroidPackageCreationFactory::canRestore(ProjectExplorer::BuildStepList *parent,
const QVariantMap &map) const
bool AndroidPackageCreationFactory::canRestore(BuildStepList *parent, const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
return canCreate(parent, idFromMap(map));
}
BuildStep *AndroidPackageCreationFactory::restore(ProjectExplorer::BuildStepList *parent,
const QVariantMap &map)
BuildStep *AndroidPackageCreationFactory::restore(BuildStepList *parent, const QVariantMap &map)
{
Q_ASSERT(canRestore(parent, map));
AndroidPackageCreationStep *const step
= new AndroidPackageCreationStep(parent);
AndroidPackageCreationStep *const step = new AndroidPackageCreationStep(parent);
if (!step->fromMap(map)) {
delete step;
return 0;
......@@ -101,14 +93,12 @@ BuildStep *AndroidPackageCreationFactory::restore(ProjectExplorer::BuildStepList
return step;
}
bool AndroidPackageCreationFactory::canClone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *product) const
bool AndroidPackageCreationFactory::canClone(BuildStepList *parent, BuildStep *product) const
{
return canCreate(parent, product->id());
}
BuildStep *AndroidPackageCreationFactory::clone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *product)
BuildStep *AndroidPackageCreationFactory::clone(BuildStepList *parent, BuildStep *product)
{
Q_ASSERT(canClone(parent, product));
return new AndroidPackageCreationStep(parent, static_cast<AndroidPackageCreationStep *>(product));
......
......@@ -58,9 +58,6 @@
using namespace ProjectExplorer;
using namespace ProjectExplorer::Constants;
using ProjectExplorer::BuildStepList;
using ProjectExplorer::BuildStepConfigWidget;
using ProjectExplorer::Task;
namespace Android {
namespace Internal {
......@@ -127,10 +124,6 @@ AndroidPackageCreationStep::AndroidPackageCreationStep(BuildStepList *bsl,
ctor();
}
AndroidPackageCreationStep::~AndroidPackageCreationStep()
{
}
void AndroidPackageCreationStep::ctor()
{
setDefaultDisplayName(tr("Packaging for Android"));
......
......@@ -31,14 +31,14 @@
#ifndef ANDROIDPACKAGECREATIONSTEP_H
#define ANDROIDPACKAGECREATIONSTEP_H
#include "javaparser.h"
#include <projectexplorer/abi.h>
#include <projectexplorer/buildstep.h>
#include <QAbstractItemModel>
#include "javaparser.h"
QT_BEGIN_NAMESPACE
class QDateTime;
class QFile;
class QProcess;
QT_END_NAMESPACE
......@@ -53,12 +53,11 @@ class AndroidPackageCreationStep : public ProjectExplorer::BuildStep
{
Q_OBJECT
friend class AndroidPackageCreationFactory;
public:
AndroidPackageCreationStep(ProjectExplorer::BuildStepList *bsl);
~AndroidPackageCreationStep();
static bool removeDirectory(const QString &dirPath);
static void stripAndroidLibs(const QStringList &files, ProjectExplorer::Abi::Architecture architecture);
static const QLatin1String DefaultVersionNumber;
......@@ -76,8 +75,8 @@ public:
QAbstractItemModel *keystoreCertificates();
protected:
virtual bool fromMap(const QVariantMap &map);
virtual QVariantMap toMap() const;
bool fromMap(const QVariantMap &map);
QVariantMap toMap() const;
private slots:
void handleBuildStdOutOutput();
......@@ -88,6 +87,9 @@ private slots:
void setQtLibs(const QStringList &qtLibs);
void setPrebundledLibs(const QStringList &prebundledLibs);
signals:
void updateRequiredLibrariesModels();
private:
AndroidPackageCreationStep(ProjectExplorer::BuildStepList *buildConfig,
AndroidPackageCreationStep *other);
......@@ -130,8 +132,6 @@ private:
QStringList m_qtLibs;
QStringList m_availableQtLibs;
QStringList m_prebundledLibs;
signals:
void updateRequiredLibrariesModels();
};
} // namespace Internal
......
......@@ -63,9 +63,10 @@ bool checkPackageName(const QString &packageName)
}
///////////////////////////// CheckModel /////////////////////////////
CheckModel::CheckModel(QObject *parent) : QAbstractListModel(parent)
{
CheckModel::CheckModel(QObject *parent)
: QAbstractListModel(parent)
{
}
void CheckModel::setAvailableItems(const QStringList &items)
......@@ -136,11 +137,12 @@ Qt::ItemFlags CheckModel::flags(const QModelIndex &/*index*/) const
{
return Qt::ItemIsSelectable|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled;
}
///////////////////////////// CheckModel /////////////////////////////
///////////////////////////// PermissionsModel /////////////////////////////
PermissionsModel::PermissionsModel(QObject *parent):QAbstractListModel(parent)
PermissionsModel::PermissionsModel(QObject *parent)
: QAbstractListModel(parent)
{
}
......@@ -149,6 +151,7 @@ void PermissionsModel::setPermissions(const QStringList &permissions)
m_permissions = permissions;
reset();
}
const QStringList &PermissionsModel::permissions()
{
return m_permissions;
......@@ -195,10 +198,10 @@ int PermissionsModel::rowCount(const QModelIndex &parent) const
Q_UNUSED(parent)
return m_permissions.count();
}
///////////////////////////// PermissionsModel /////////////////////////////
///////////////////////////// AndroidPackageCreationWidget /////////////////////////////
AndroidPackageCreationWidget::AndroidPackageCreationWidget(AndroidPackageCreationStep *step)
: ProjectExplorer::BuildStepConfigWidget(),
m_step(step),
......@@ -215,7 +218,6 @@ AndroidPackageCreationWidget::AndroidPackageCreationWidget(AndroidPackageCreatio
connect(m_step, SIGNAL(updateRequiredLibrariesModels()), SLOT(updateRequiredLibrariesModels()));
}
void AndroidPackageCreationWidget::initGui()
{
updateAndroidProjectInfo();
......
......@@ -32,6 +32,7 @@
#define ANDROIDPACKAGECREATIONWIDGET_H
#include <projectexplorer/buildstep.h>
#include <QAbstractListModel>
#include <QStringList>
......
......@@ -39,8 +39,6 @@
#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtsupportconstants.h>
#include <QCoreApplication>
using namespace ProjectExplorer;
namespace Android {
......@@ -77,6 +75,7 @@ bool AndroidPackageInstallationFactory::canCreate(BuildStepList *parent, const C
BuildStep *AndroidPackageInstallationFactory::create(BuildStepList *parent, const Core::Id id)
{
Q_ASSERT(canCreate(parent, id));
Q_UNUSED(id);
return new AndroidPackageInstallationStep(parent);
}
......
......@@ -30,6 +30,7 @@
#ifndef ANDROIDPACKAGEINSTALLATIONFACTORY_H
#define ANDROIDPACKAGEINSTALLATIONFACTORY_H
#include <projectexplorer/buildstep.h>
namespace Android {
......
......@@ -31,30 +31,22 @@
#include "androidpackageinstallationstep.h"
#include "androidmanager.h"
#include <QFileInfo>
#include <QDir>
#include <projectexplorer/buildsteplist.h>
using namespace Android::Internal;
const Core::Id AndroidPackageInstallationStep::Id("Qt4ProjectManager.AndroidPackageInstallationStep");
const Core::Id AndroidPackageInstallationStep::Id = Core::Id("Qt4ProjectManager.AndroidPackageInstallationStep");
static inline QString stepDisplayName()
AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bsl)
: MakeStep(bsl, Id)
{
return AndroidPackageInstallationStep::tr("Copy application data");
}
AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bsl) : MakeStep(bsl, Id)
{
const QString name = stepDisplayName();
const QString name = tr("Copy application data");
setDefaultDisplayName(name);
setDisplayName(name);
}
AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bc, AndroidPackageInstallationStep *other): MakeStep(bc, other)
{ }
AndroidPackageInstallationStep::~AndroidPackageInstallationStep()
AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bc, AndroidPackageInstallationStep *other)
: MakeStep(bc, other)
{ }
bool AndroidPackageInstallationStep::init()
......
......@@ -40,15 +40,14 @@ class AndroidPackageInstallationStep : public Qt4ProjectManager::MakeStep
{
Q_OBJECT
friend class AndroidPackageInstallationFactory;
public:
explicit AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bsl);
virtual ~AndroidPackageInstallationStep();
virtual bool init();
bool init();
private:
AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bc,
AndroidPackageInstallationStep *other);
private:
static const Core::Id Id;
};
......
......@@ -54,14 +54,10 @@ namespace Android {
AndroidPlugin::AndroidPlugin()
{ }
AndroidPlugin::~AndroidPlugin()
{ }
bool AndroidPlugin::initialize(const QStringList &arguments,
QString *error_message)
bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments);
Q_UNUSED(error_message);
Q_UNUSED(errorMessage);
Internal::AndroidConfigurations::instance(this);
......
......@@ -41,9 +41,8 @@ class AndroidPlugin : public ExtensionSystem::IPlugin
public:
AndroidPlugin();
~AndroidPlugin();
bool initialize(const QStringList &arguments, QString *error_message);
bool initialize(const QStringList &arguments, QString *errorMessage);