iOS: Tr::tr

Change-Id: I547af218546927622414999e5b9019ab62916e7e
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2022-12-20 13:39:23 +01:00
parent 8f2d48e8a3
commit 6a1a6d85b8
45 changed files with 365 additions and 1328 deletions

View File

@@ -3,6 +3,7 @@
#include "createsimulatordialog.h"
#include "iostr.h"
#include "simulatorcontrol.h"
#include <utils/algorithm.h>
@@ -22,7 +23,7 @@ CreateSimulatorDialog::CreateSimulatorDialog(QWidget *parent)
: QDialog(parent)
{
resize(320, 160);
setWindowTitle(tr("Create Simulator"));
setWindowTitle(Tr::tr("Create Simulator"));
m_nameEdit = new QLineEdit(this);
m_deviceTypeCombo = new QComboBox(this);
@@ -35,9 +36,9 @@ CreateSimulatorDialog::CreateSimulatorDialog(QWidget *parent)
Column {
Form {
tr("Simulator name:"), m_nameEdit, br,
tr("Device type:"), m_deviceTypeCombo, br,
tr("OS version:"), m_runtimeCombo, br,
Tr::tr("Simulator name:"), m_nameEdit, br,
Tr::tr("Device type:"), m_deviceTypeCombo, br,
Tr::tr("OS version:"), m_runtimeCombo, br,
},
buttonBox
}.attachTo(this);
@@ -110,7 +111,7 @@ DeviceTypeInfo CreateSimulatorDialog::deviceType() const
void CreateSimulatorDialog::populateDeviceTypes(const QList<DeviceTypeInfo> &deviceTypes)
{
m_deviceTypeCombo->clear();
m_deviceTypeCombo->addItem(tr("None"));
m_deviceTypeCombo->addItem(Tr::tr("None"));
if (deviceTypes.isEmpty())
return;
@@ -146,7 +147,7 @@ void CreateSimulatorDialog::populateDeviceTypes(const QList<DeviceTypeInfo> &dev
void CreateSimulatorDialog::populateRuntimes(const DeviceTypeInfo &deviceType)
{
m_runtimeCombo->clear();
m_runtimeCombo->addItem(tr("None"));
m_runtimeCombo->addItem(Tr::tr("None"));
if (deviceType.name.isEmpty())
return;

View File

@@ -23,8 +23,6 @@ class RuntimeInfo;
*/
class CreateSimulatorDialog : public QDialog
{
Q_OBJECT
public:
explicit CreateSimulatorDialog(QWidget *parent = nullptr);
~CreateSimulatorDialog() override;

View File

@@ -5,6 +5,7 @@
#include "iosconfigurations.h"
#include "iosconstants.h"
#include "iostr.h"
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/namedwidget.h>
@@ -82,7 +83,7 @@ private:
IosSigningSettingsWidget::IosSigningSettingsWidget(BuildConfiguration *buildConfiguration,
BoolAspect *autoManagedSigning,
StringAspect *signingIdentifier)
: NamedWidget(IosQmakeBuildConfiguration::tr("iOS Settings"))
: NamedWidget(Tr::tr("iOS Settings"))
, m_autoManagedSigning(autoManagedSigning)
, m_signingIdentifier(signingIdentifier)
, m_isDevice(DeviceTypeKitAspect::deviceTypeId(buildConfiguration->kit())
@@ -96,7 +97,7 @@ IosSigningSettingsWidget::IosSigningSettingsWidget(BuildConfiguration *buildConf
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
m_qmakeDefaults->setSizePolicy(sizePolicy);
m_qmakeDefaults->setText(IosQmakeBuildConfiguration::tr("Reset"));
m_qmakeDefaults->setText(Tr::tr("Reset"));
m_qmakeDefaults->setEnabled(m_isDevice);
m_signEntityCombo = new QComboBox(container);
@@ -111,7 +112,7 @@ IosSigningSettingsWidget::IosSigningSettingsWidget(BuildConfiguration *buildConf
sizePolicy2.setVerticalStretch(0);
m_autoSignCheckbox->setSizePolicy(sizePolicy2);
m_autoSignCheckbox->setChecked(true);
m_autoSignCheckbox->setText(IosQmakeBuildConfiguration::tr("Automatically manage signing"));
m_autoSignCheckbox->setText(Tr::tr("Automatically manage signing"));
m_autoSignCheckbox->setChecked(m_autoManagedSigning->value());
m_autoSignCheckbox->setEnabled(m_isDevice);
@@ -121,7 +122,7 @@ IosSigningSettingsWidget::IosSigningSettingsWidget(BuildConfiguration *buildConf
m_warningLabel = new Utils::InfoLabel({}, Utils::InfoLabel::Warning, container);
m_signEntityLabel->setText(IosQmakeBuildConfiguration::tr("Development team:"));
m_signEntityLabel->setText(Tr::tr("Development team:"));
connect(m_qmakeDefaults, &QPushButton::clicked, this, &IosSigningSettingsWidget::onReset);
@@ -216,8 +217,8 @@ void IosSigningSettingsWidget::onReset()
void IosSigningSettingsWidget::configureSigningUi(bool autoManageSigning)
{
m_signEntityLabel->setText(autoManageSigning
? IosQmakeBuildConfiguration::tr("Development team:")
: IosQmakeBuildConfiguration::tr("Provisioning profile:"));
? Tr::tr("Development team:")
: Tr::tr("Provisioning profile:"));
if (autoManageSigning)
populateDevelopmentTeams();
else
@@ -242,7 +243,7 @@ void IosSigningSettingsWidget::populateDevelopmentTeams()
QSignalBlocker blocker(m_signEntityCombo);
// Populate Team id's
m_signEntityCombo->clear();
m_signEntityCombo->addItem(IosQmakeBuildConfiguration::tr("Default"));
m_signEntityCombo->addItem(Tr::tr("Default"));
const auto teams = IosConfigurations::developmentTeams();
for (auto team : teams) {
m_signEntityCombo->addItem(team->displayName());
@@ -271,7 +272,7 @@ void IosSigningSettingsWidget::populateProvisioningProfiles()
m_signEntityCombo->setItemData(index, profile->details(), Qt::ToolTipRole);
}
} else {
m_signEntityCombo->addItem(IosQmakeBuildConfiguration::tr("None"));
m_signEntityCombo->addItem(Tr::tr("None"));
}
}
// Maintain previous selection.
@@ -302,12 +303,11 @@ void IosSigningSettingsWidget::updateInfoText()
if (identifier.isEmpty()) {
// No signing entity selection.
if (configuringTeams)
addMessage(IosQmakeBuildConfiguration::tr("Development team is not selected."));
addMessage(Tr::tr("Development team is not selected."));
else
addMessage(IosQmakeBuildConfiguration::tr("Provisioning profile is not selected."));
addMessage(Tr::tr("Provisioning profile is not selected."));
addMessage(IosQmakeBuildConfiguration::tr(
"Using default development team and provisioning profile."));
addMessage(Tr::tr("Using default development team and provisioning profile."));
} else {
if (!configuringTeams) {
ProvisioningProfilePtr profile = IosConfigurations::provisioningProfile(identifier);
@@ -315,17 +315,15 @@ void IosSigningSettingsWidget::updateInfoText()
auto team = profile->developmentTeam();
if (team) {
// Display corresponding team information.
addMessage(IosQmakeBuildConfiguration::tr("Development team: %1 (%2)")
addMessage(Tr::tr("Development team: %1 (%2)")
.arg(team->displayName())
.arg(team->identifier()));
addMessage(IosQmakeBuildConfiguration::tr(
"Settings defined here override the QMake environment."));
addMessage(Tr::tr("Settings defined here override the QMake environment."));
} else {
qCDebug(iosSettingsLog) << "Development team not found for profile" << profile;
}
} else {
addMessage(IosQmakeBuildConfiguration::tr(
"Settings defined here override the QMake environment."));
addMessage(Tr::tr("Settings defined here override the QMake environment."));
}
}
@@ -341,24 +339,23 @@ void IosSigningSettingsWidget::updateWarningText()
QString warningText;
bool configuringTeams = m_autoSignCheckbox->isChecked();
if (m_signEntityCombo->count() < 2) {
warningText = IosQmakeBuildConfiguration::tr("%1 not configured. Use Xcode and Apple "
"developer account to configure the "
"provisioning profiles and teams.")
warningText = Tr::tr("%1 not configured. Use Xcode and Apple "
"developer account to configure the "
"provisioning profiles and teams.")
.arg(configuringTeams
? IosQmakeBuildConfiguration::tr("Development teams")
: IosQmakeBuildConfiguration::tr("Provisioning profiles"));
? Tr::tr("Development teams")
: Tr::tr("Provisioning profiles"));
} else {
QString identifier = selectedIdentifier();
if (configuringTeams) {
auto team = IosConfigurations::developmentTeam(identifier);
if (team && !team->hasProvisioningProfile())
warningText = IosQmakeBuildConfiguration::tr(
"No provisioning profile found for the selected team.");
warningText = Tr::tr("No provisioning profile found for the selected team.");
} else {
auto profile = IosConfigurations::provisioningProfile(identifier);
if (profile && QDateTime::currentDateTimeUtc() > profile->expirationDate()) {
warningText
= IosQmakeBuildConfiguration::tr(
= Tr::tr(
"Provisioning profile expired. Expiration date: %1")
.arg(QLocale::system().toString(profile->expirationDate().toLocalTime(),
QLocale::LongFormat));

View File

@@ -2,17 +2,13 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "qmakeprojectmanager/qmakebuildconfiguration.h"
#include <qmakeprojectmanager/qmakebuildconfiguration.h>
#include <cmakeprojectmanager/cmakebuildconfiguration.h>
#include <utils/aspects.h>
namespace Ios {
namespace Internal {
namespace Ios::Internal {
class IosQmakeBuildConfiguration : public QmakeProjectManager::QmakeBuildConfiguration
{
Q_OBJECT
public:
IosQmakeBuildConfiguration(ProjectExplorer::Target *target, Utils::Id id);
@@ -34,8 +30,6 @@ public:
class IosCMakeBuildConfiguration : public CMakeProjectManager::CMakeBuildConfiguration
{
Q_OBJECT
public:
IosCMakeBuildConfiguration(ProjectExplorer::Target *target, Utils::Id id);
@@ -55,5 +49,4 @@ public:
IosCMakeBuildConfigurationFactory();
};
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -2,7 +2,9 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "iosbuildstep.h"
#include "iosconstants.h"
#include "iostr.h"
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildconfiguration.h>
@@ -17,7 +19,7 @@
#include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <utils/fileutils.h>
#include <utils/filepath.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
@@ -31,8 +33,7 @@ using namespace Core;
using namespace ProjectExplorer;
using namespace Utils;
namespace Ios {
namespace Internal {
namespace Ios::Internal {
const char IOS_BUILD_STEP_ID[] = "Ios.IosBuildStep";
const char BUILD_USE_DEFAULT_ARGS_KEY[] = "Ios.IosBuildStep.XcodeArgumentsUseDefault";
@@ -41,10 +42,8 @@ const char CLEAN_KEY[] = "Ios.IosBuildStep.Clean";
class IosBuildStep final : public AbstractProcessStep
{
Q_DECLARE_TR_FUNCTIONS(Ios::Internal::IosBuildStep)
public:
IosBuildStep(BuildStepList *stepList, Utils::Id id);
IosBuildStep(BuildStepList *stepList, Id id);
private:
QWidget *createConfigWidget() final;
@@ -69,17 +68,17 @@ QWidget *IosBuildStep::createConfigWidget()
{
auto widget = new QWidget;
auto buildArgumentsLabel = new QLabel(tr("Base arguments:"), widget);
auto buildArgumentsLabel = new QLabel(Tr::tr("Base arguments:"), widget);
auto buildArgumentsTextEdit = new QPlainTextEdit(widget);
buildArgumentsTextEdit->setPlainText(ProcessArgs::joinArgs(baseArguments()));
auto resetDefaultsButton = new QPushButton(widget);
resetDefaultsButton->setLayoutDirection(Qt::RightToLeft);
resetDefaultsButton->setText(tr("Reset Defaults"));
resetDefaultsButton->setText(Tr::tr("Reset Defaults"));
resetDefaultsButton->setEnabled(!m_useDefaultArguments);
auto extraArgumentsLabel = new QLabel(tr("Extra arguments:"), widget);
auto extraArgumentsLabel = new QLabel(Tr::tr("Extra arguments:"), widget);
auto extraArgumentsLineEdit = new QLineEdit(widget);
extraArgumentsLineEdit->setText(ProcessArgs::joinArgs(m_extraArguments));
@@ -91,7 +90,7 @@ QWidget *IosBuildStep::createConfigWidget()
gridLayout->addWidget(extraArgumentsLabel, 2, 0, 1, 1);
gridLayout->addWidget(extraArgumentsLineEdit, 2, 1, 1, 1);
setDisplayName(tr("iOS build", "iOS BuildStep display name."));
setDisplayName(Tr::tr("iOS build", "iOS BuildStep display name."));
auto updateDetails = [this] {
ProcessParameters param;
@@ -255,8 +254,7 @@ IosBuildStepFactory::IosBuildStepFactory()
Constants::IOS_SIMULATOR_TYPE});
setSupportedStepLists({ProjectExplorer::Constants::BUILDSTEPS_CLEAN,
ProjectExplorer::Constants::BUILDSTEPS_BUILD});
setDisplayName(IosBuildStep::tr("xcodebuild"));
setDisplayName(Tr::tr("xcodebuild"));
}
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -5,8 +5,7 @@
#include <projectexplorer/buildstep.h>
namespace Ios {
namespace Internal {
namespace Ios::Internal {
class IosBuildStepFactory final : public ProjectExplorer::BuildStepFactory
{
@@ -14,5 +13,4 @@ public:
IosBuildStepFactory();
};
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -2,11 +2,13 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "iosconfigurations.h"
#include "iosconstants.h"
#include "iosdevice.h"
#include "iossimulator.h"
#include "simulatorcontrol.h"
#include "iosprobe.h"
#include "iossimulator.h"
#include "iostr.h"
#include "simulatorcontrol.h"
#include <coreplugin/icore.h>
@@ -283,7 +285,7 @@ void IosConfigurations::updateAutomaticKitList()
const auto init = [&](Kit *k) {
k->setAutoDetected(true);
const QString baseDisplayName = isSimulatorDeviceId(pDeviceType)
? tr("%1 Simulator").arg(qtVersion->unexpandedDisplayName())
? Tr::tr("%1 Simulator").arg(qtVersion->unexpandedDisplayName())
: qtVersion->unexpandedDisplayName();
k->setUnexpandedDisplayName(baseDisplayName);
setupKit(k, pDeviceType, platformToolchains, debuggerId, sdk.path, qtVersion);
@@ -616,8 +618,8 @@ QString DevelopmentTeam::displayName() const
QString DevelopmentTeam::details() const
{
return tr("%1 - Free Provisioning Team : %2")
.arg(m_identifier).arg(m_freeTeam ? tr("Yes") : tr("No"));
return Tr::tr("%1 - Free Provisioning Team : %2")
.arg(m_identifier).arg(m_freeTeam ? Tr::tr("Yes") : Tr::tr("No"));
}
QDebug &operator<<(QDebug &stream, DevelopmentTeamPtr team)
@@ -641,7 +643,7 @@ QString ProvisioningProfile::displayName() const
QString ProvisioningProfile::details() const
{
return tr("Team: %1\nApp ID: %2\nExpiration date: %3").arg(m_team->identifier()).arg(m_appID)
return Tr::tr("Team: %1\nApp ID: %2\nExpiration date: %3").arg(m_team->identifier()).arg(m_appID)
.arg(QLocale::system().toString(m_expirationDate.toLocalTime(), QLocale::ShortFormat));
}

View File

@@ -5,7 +5,8 @@
#include <projectexplorer/abi.h>
#include <projectexplorer/toolchain.h>
#include <utils/fileutils.h>
#include <utils/filepath.h>
#include <QDateTime>
#include <QObject>
@@ -20,14 +21,12 @@ class QSettings;
class QFileSystemWatcher;
QT_END_NAMESPACE
namespace Ios {
namespace Internal {
namespace Ios::Internal {
class DevelopmentTeam;
class ProvisioningProfile
{
Q_DECLARE_TR_FUNCTIONS(ProvisioningProfile)
public:
std::shared_ptr<DevelopmentTeam> developmentTeam() { return m_team; }
QString identifier() const;
@@ -50,7 +49,6 @@ using ProvisioningProfiles = QList<ProvisioningProfilePtr>;
class DevelopmentTeam
{
Q_DECLARE_TR_FUNCTIONS(DevelopmentTeam)
public:
QString identifier() const;
QString displayName() const;
@@ -121,7 +119,8 @@ private:
ProvisioningProfiles m_provisioningProfiles;
DevelopmentTeams m_developerTeams;
};
QDebug &operator<<(QDebug &stream, std::shared_ptr<ProvisioningProfile> profile);
QDebug &operator<<(QDebug &stream, std::shared_ptr<DevelopmentTeam> team);
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -3,13 +3,12 @@
#include "iosdeploystep.h"
#include "iosbuildstep.h"
#include "iosconfigurations.h"
#include "iosconstants.h"
#include "iosdevice.h"
#include "iosrunconfiguration.h"
#include "iossimulator.h"
#include "iostoolhandler.h"
#include "iostr.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/projectexplorerconstants.h>
@@ -21,20 +20,16 @@
#include <utils/temporaryfile.h>
#include <QDir>
#include <QFile>
#include <QSettings>
using namespace ProjectExplorer;
using namespace Utils;
namespace Ios {
namespace Internal {
namespace Ios::Internal {
class IosDeployStep final : public BuildStep
{
Q_DECLARE_TR_FUNCTIONS(Ios::Internal::IosDeployStep)
public:
enum TransferStatus {
NoTransfer,
@@ -92,7 +87,7 @@ void IosDeployStep::updateDisplayNames()
{
IDevice::ConstPtr dev = DeviceKitAspect::device(kit());
const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName();
setDisplayName(tr("Deploy to %1").arg(devName));
setDisplayName(Tr::tr("Deploy to %1").arg(devName));
}
bool IosDeployStep::init()
@@ -109,7 +104,7 @@ bool IosDeployStep::init()
} else if (iossimulator()) {
m_deviceType = runConfig->deviceType();
} else {
emit addOutput(tr("Error: no device available, deploy failed."),
emit addOutput(Tr::tr("Error: no device available, deploy failed."),
OutputFormat::ErrorMessage);
return false;
}
@@ -121,14 +116,14 @@ void IosDeployStep::doRun()
QTC_CHECK(m_transferStatus == NoTransfer);
if (m_device.isNull()) {
TaskHub::addTask(
DeploymentTask(Task::Error, tr("Deployment failed. No iOS device found.")));
DeploymentTask(Task::Error, Tr::tr("Deployment failed. No iOS device found.")));
emit finished(!iossimulator().isNull());
cleanup();
return;
}
m_toolHandler = new IosToolHandler(m_deviceType, this);
m_transferStatus = TransferInProgress;
emit progress(0, tr("Transferring application"));
emit progress(0, Tr::tr("Transferring application"));
connect(m_toolHandler, &IosToolHandler::isTransferringApp,
this, &IosDeployStep::handleIsTransferringApp);
connect(m_toolHandler, &IosToolHandler::didTransferApp,
@@ -176,7 +171,7 @@ void IosDeployStep::handleDidTransferApp(IosToolHandler *handler, const QString
m_transferStatus = TransferFailed;
if (!m_expectFail)
TaskHub::addTask(DeploymentTask(Task::Error,
tr("Deployment failed. The settings in the Devices window of Xcode might be incorrect.")));
Tr::tr("Deployment failed. The settings in the Devices window of Xcode might be incorrect.")));
}
emit finished(status == IosToolHandler::Success);
}
@@ -186,7 +181,7 @@ void IosDeployStep::handleFinished(IosToolHandler *handler)
switch (m_transferStatus) {
case TransferInProgress:
m_transferStatus = TransferFailed;
TaskHub::addTask(DeploymentTask(Task::Error, tr("Deployment failed.")));
TaskHub::addTask(DeploymentTask(Task::Error, Tr::tr("Deployment failed.")));
emit finished(false);
break;
case NoTransfer:
@@ -203,7 +198,7 @@ void IosDeployStep::handleErrorMsg(IosToolHandler *handler, const QString &msg)
{
Q_UNUSED(handler)
if (msg.contains(QLatin1String("AMDeviceInstallApplication returned -402653103")))
TaskHub::addTask(DeploymentTask(Task::Warning, tr("The Info.plist might be incorrect.")));
TaskHub::addTask(DeploymentTask(Task::Warning, Tr::tr("The Info.plist might be incorrect.")));
emit addOutput(msg, OutputFormat::ErrorMessage);
}
@@ -269,7 +264,7 @@ void IosDeployStep::checkProvisioningProfile()
QString provisioningProfile = provisionPlist.value(QLatin1String("Name")).toString();
QString provisioningUid = provisionPlist.value(QLatin1String("UUID")).toString();
CompileTask task(Task::Warning,
tr("The provisioning profile \"%1\" (%2) used to sign the application "
Tr::tr("The provisioning profile \"%1\" (%2) used to sign the application "
"does not cover the device %3 (%4). Deployment to it will fail.")
.arg(provisioningProfile, provisioningUid, device->displayName(),
targetId));
@@ -291,11 +286,10 @@ IosSimulator::ConstPtr IosDeployStep::iossimulator() const
IosDeployStepFactory::IosDeployStepFactory()
{
registerStep<IosDeployStep>(Constants::IOS_DEPLOY_STEP_ID);
setDisplayName(IosDeployStep::tr("Deploy to iOS device"));
setDisplayName(Tr::tr("Deploy to iOS device"));
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
setSupportedDeviceTypes({Constants::IOS_DEVICE_TYPE, Constants::IOS_SIMULATOR_TYPE});
setRepeatable(false);
}
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -5,8 +5,7 @@
#include <projectexplorer/buildstep.h>
namespace Ios {
namespace Internal {
namespace Ios::Internal {
class IosDeployStepFactory final : public ProjectExplorer::BuildStepFactory
{
@@ -14,5 +13,4 @@ public:
IosDeployStepFactory();
};
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -2,14 +2,19 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "iosdevice.h"
#include "iosconfigurations.h"
#include "iosconstants.h"
#include "iossimulator.h"
#include "iostoolhandler.h"
#include "iostr.h"
#include <coreplugin/helpmanager.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/devicesupport/idevicewidget.h>
#include <projectexplorer/kitinformation.h>
#include <utils/portlist.h>
#include <QFormLayout>
@@ -38,9 +43,6 @@
using namespace ProjectExplorer;
static const char kDeviceName[] = "deviceName";
static const char kUniqueDeviceId[] = "uniqueDeviceId";
namespace {
static Q_LOGGING_CATEGORY(detectLog, "qtc.ios.deviceDetect", QtWarningMsg)
}
@@ -68,8 +70,10 @@ static QString CFStringRef2QString(CFStringRef s)
}
#endif
namespace Ios {
namespace Internal {
namespace Ios::Internal {
const char kDeviceName[] = "deviceName";
const char kUniqueDeviceId[] = "uniqueDeviceId";
class IosDeviceInfoWidget : public IDeviceWidget
{
@@ -84,7 +88,7 @@ IosDevice::IosDevice(CtorHelper)
{
setType(Constants::IOS_DEVICE_TYPE);
setDefaultDisplayName(IosDevice::name());
setDisplayType(tr("iOS"));
setDisplayType(Tr::tr("iOS"));
setMachineType(IDevice::Hardware);
setOsType(Utils::OsTypeMac);
setDeviceState(DeviceDisconnected);
@@ -160,7 +164,7 @@ QString IosDevice::uniqueInternalDeviceId() const
QString IosDevice::name()
{
return QCoreApplication::translate("Ios::Internal::IosDevice", "iOS Device");
return Tr::tr("iOS Device");
}
QString IosDevice::osVersion() const
@@ -195,15 +199,15 @@ IosDeviceManager::TranslationMap IosDeviceManager::translationMap()
if (translationMap)
return *translationMap;
TranslationMap &tMap = *new TranslationMap;
tMap[kDeviceName] = tr("Device name");
tMap[kDeviceName] = Tr::tr("Device name");
//: Whether the device is in developer mode.
tMap[QLatin1String("developerStatus")] = tr("Developer status");
tMap[QLatin1String("deviceConnected")] = tr("Connected");
tMap[QLatin1String("YES")] = tr("yes");
tMap[QLatin1String("NO")] = tr("no");
tMap[QLatin1String("YES")] = tr("yes");
tMap[QLatin1String("*unknown*")] = tr("unknown");
tMap[QLatin1String("osVersion")] = tr("OS version");
tMap[QLatin1String("developerStatus")] = Tr::tr("Developer status");
tMap[QLatin1String("deviceConnected")] = Tr::tr("Connected");
tMap[QLatin1String("YES")] = Tr::tr("yes");
tMap[QLatin1String("NO")] = Tr::tr("no");
tMap[QLatin1String("YES")] = Tr::tr("yes");
tMap[QLatin1String("*unknown*")] = Tr::tr("unknown");
tMap[QLatin1String("osVersion")] = Tr::tr("OS version");
translationMap = &tMap;
return tMap;
}
@@ -307,8 +311,8 @@ void IosDeviceManager::deviceInfo(IosToolHandler *, const QString &uid,
if (devStatus == QLatin1String("*off*")) {
if (!shouldIgnore && !IosConfigurations::ignoreAllDevices()) {
QMessageBox mBox;
mBox.setText(tr("An iOS device in user mode has been detected."));
mBox.setInformativeText(tr("Do you want to see how to set it up for development?"));
mBox.setText(Tr::tr("An iOS device in user mode has been detected."));
mBox.setInformativeText(Tr::tr("Do you want to see how to set it up for development?"));
mBox.setStandardButtons(QMessageBox::NoAll | QMessageBox::No | QMessageBox::Yes);
mBox.setDefaultButton(QMessageBox::Yes);
int ret = mBox.exec();
@@ -493,7 +497,6 @@ void IosDeviceManager::monitorAvailableDevices()
#endif
}
IosDeviceManager::IosDeviceManager(QObject *parent) :
QObject(parent)
{
@@ -563,11 +566,10 @@ IosDeviceInfoWidget::IosDeviceInfoWidget(const IDevice::Ptr &device)
formLayout->setContentsMargins(0, 0, 0, 0);
setLayout(formLayout);
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
formLayout->addRow(IosDevice::tr("Device name:"), new QLabel(iosDevice->deviceName()));
formLayout->addRow(IosDevice::tr("Identifier:"), new QLabel(iosDevice->uniqueInternalDeviceId()));
formLayout->addRow(IosDevice::tr("OS Version:"), new QLabel(iosDevice->osVersion()));
formLayout->addRow(IosDevice::tr("CPU Architecture:"), new QLabel(iosDevice->cpuArchitecture()));
formLayout->addRow(Tr::tr("Device name:"), new QLabel(iosDevice->deviceName()));
formLayout->addRow(Tr::tr("Identifier:"), new QLabel(iosDevice->uniqueInternalDeviceId()));
formLayout->addRow(Tr::tr("OS Version:"), new QLabel(iosDevice->osVersion()));
formLayout->addRow(Tr::tr("CPU Architecture:"), new QLabel(iosDevice->cpuArchitecture()));
}
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -22,8 +22,6 @@ class IosDeviceManager;
class IosDevice final : public ProjectExplorer::IDevice
{
Q_DECLARE_TR_FUNCTIONS(Ios::Internal::IosDevice)
public:
using Dict = QMap<QString, QString>;
using ConstPtr = QSharedPointer<const IosDevice>;
@@ -69,7 +67,6 @@ public:
class IosDeviceManager : public QObject
{
Q_OBJECT
public:
using TranslationMap = QHash<QString, QString>;
@@ -85,6 +82,7 @@ public:
const Ios::IosToolHandler::Dict &info);
void infoGathererFinished(Ios::IosToolHandler *gatherer);
void monitorAvailableDevices();
private:
void updateUserModeDevices();
IosDeviceManager(QObject *parent = nullptr);

View File

@@ -6,6 +6,7 @@
#include "iosconstants.h"
#include "iosconfigurations.h"
#include "iosrunconfiguration.h"
#include "iostr.h"
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/target.h>
@@ -34,13 +35,39 @@ using namespace Core;
using namespace ProjectExplorer;
using namespace Utils;
namespace Ios {
namespace Internal {
namespace Ios::Internal {
static const char USE_DEFAULT_ARGS_PARTIAL_KEY[] = ".ArgumentsUseDefault";
static const char COMMAND_PARTIAL_KEY[] = ".Command";
static const char ARGUMENTS_PARTIAL_KEY[] = ".Arguments";
static const char CLEAN_PARTIAL_KEY[] = ".Clean";
const char USE_DEFAULT_ARGS_PARTIAL_KEY[] = ".ArgumentsUseDefault";
const char COMMAND_PARTIAL_KEY[] = ".Command";
const char ARGUMENTS_PARTIAL_KEY[] = ".Arguments";
const char CLEAN_PARTIAL_KEY[] = ".Clean";
class IosDsymBuildStep : public AbstractProcessStep
{
public:
IosDsymBuildStep(BuildStepList *parent, Id id);
QWidget *createConfigWidget() override;
void setArguments(const QStringList &args);
QStringList arguments() const;
QStringList defaultArguments() const;
FilePath defaultCommand() const;
FilePath command() const;
void setCommand(const FilePath &command);
bool isDefault() const;
private:
void setupOutputFormatter(OutputFormatter *formatter) override;
QVariantMap toMap() const override;
bool fromMap(const QVariantMap &map) override;
QStringList defaultCleanCmdList() const;
QStringList defaultCmdList() const;
QStringList m_arguments;
FilePath m_command;
bool m_clean;
};
IosDsymBuildStep::IosDsymBuildStep(BuildStepList *parent, Id id) :
AbstractProcessStep(parent, id),
@@ -180,12 +207,11 @@ QStringList IosDsymBuildStep::arguments() const
return m_arguments;
}
QWidget *IosDsymBuildStep::createConfigWidget()
{
auto widget = new QWidget;
auto commandLabel = new QLabel(tr("Command:"), widget);
auto commandLabel = new QLabel(Tr::tr("Command:"), widget);
auto commandLineEdit = new QLineEdit(widget);
commandLineEdit->setText(command().toString());
@@ -193,9 +219,9 @@ QWidget *IosDsymBuildStep::createConfigWidget()
auto argumentsTextEdit = new QPlainTextEdit(widget);
argumentsTextEdit->setPlainText(Utils::ProcessArgs::joinArgs(arguments()));
auto argumentsLabel = new QLabel(tr("Arguments:"), widget);
auto argumentsLabel = new QLabel(Tr::tr("Arguments:"), widget);
auto resetDefaultsButton = new QPushButton(tr("Reset to Default"), widget);
auto resetDefaultsButton = new QPushButton(Tr::tr("Reset to Default"), widget);
resetDefaultsButton->setLayoutDirection(Qt::RightToLeft);
resetDefaultsButton->setEnabled(!isDefault());
@@ -248,9 +274,7 @@ QWidget *IosDsymBuildStep::createConfigWidget()
return widget;
}
//
// IosDsymBuildStepFactory
//
IosDsymBuildStepFactory::IosDsymBuildStepFactory()
{
@@ -260,5 +284,4 @@ IosDsymBuildStepFactory::IosDsymBuildStepFactory()
setDisplayName("dsymutil");
}
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -5,37 +5,7 @@
#include <projectexplorer/abstractprocessstep.h>
namespace Ios {
namespace Internal {
class IosDsymBuildStep : public ProjectExplorer::AbstractProcessStep
{
Q_OBJECT
public:
IosDsymBuildStep(ProjectExplorer::BuildStepList *parent, Utils::Id id);
QWidget *createConfigWidget() override;
void setArguments(const QStringList &args);
QStringList arguments() const;
QStringList defaultArguments() const;
Utils::FilePath defaultCommand() const;
Utils::FilePath command() const;
void setCommand(const Utils::FilePath &command);
bool isDefault() const;
private:
void setupOutputFormatter(Utils::OutputFormatter *formatter) override;
QVariantMap toMap() const override;
bool fromMap(const QVariantMap &map) override;
QStringList defaultCleanCmdList() const;
QStringList defaultCmdList() const;
QStringList m_arguments;
Utils::FilePath m_command;
bool m_clean;
};
namespace Ios::Internal {
class IosDsymBuildStepFactory : public ProjectExplorer::BuildStepFactory
{
@@ -43,5 +13,4 @@ public:
explicit IosDsymBuildStepFactory();
};
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -15,6 +15,7 @@
#include "iossettingspage.h"
#include "iossimulator.h"
#include "iostoolhandler.h"
#include "iostr.h"
#include "iosrunconfiguration.h"
#include <projectexplorer/deployconfiguration.h>
@@ -36,7 +37,7 @@ public:
setConfigBaseId("Qt4ProjectManager.IosDeployConfiguration");
addSupportedTargetDeviceType(Constants::IOS_DEVICE_TYPE);
addSupportedTargetDeviceType(Constants::IOS_SIMULATOR_TYPE);
setDefaultDisplayName(QCoreApplication::translate("Ios::Internal", "Deploy on iOS"));
setDefaultDisplayName(Tr::tr("Deploy on iOS"));
addInitialStep(Constants::IOS_DEPLOY_STEP_ID);
}
};

View File

@@ -6,9 +6,7 @@
#include <utils/algorithm.h>
#include <utils/qtcprocess.h>
#include <QDir>
#include <QFileInfo>
#include <QFileInfoList>
#include <QLoggingCategory>
static Q_LOGGING_CATEGORY(probeLog, "qtc.ios.probe", QtWarningMsg)

View File

@@ -60,4 +60,5 @@ private:
QMap<QString, XcodePlatform> m_platforms;
QStringList m_developerPaths;
};
} // namespace Ios

View File

@@ -2,12 +2,14 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "iosqtversion.h"
#include "iosconstants.h"
#include "iosconfigurations.h"
#include "iostr.h"
#include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
#include <qtsupport/qtversionmanager.h>
@@ -15,9 +17,26 @@
#include <projectexplorer/kit.h>
#include <projectexplorer/projectexplorer.h>
using namespace Ios::Internal;
using namespace ProjectExplorer;
namespace Ios::Internal {
class IosQtVersion : public QtSupport::QtVersion
{
public:
IosQtVersion();
bool isValid() const override;
QString invalidReason() const override;
Abis detectQtAbis() const override;
QSet<Utils::Id> availableFeatures() const override;
QSet<Utils::Id> targetDeviceTypes() const override;
QString description() const override;
};
IosQtVersion::IosQtVersion() = default;
bool IosQtVersion::isValid() const
@@ -33,7 +52,7 @@ QString IosQtVersion::invalidReason() const
{
QString tmp = QtVersion::invalidReason();
if (tmp.isEmpty() && qtAbis().isEmpty())
return tr("Failed to detect the ABIs used by the Qt version.");
return Tr::tr("Failed to detect the ABIs used by the Qt version.");
return tmp;
}
@@ -53,7 +72,7 @@ Abis IosQtVersion::detectQtAbis() const
QString IosQtVersion::description() const
{
//: Qt Version is meant for Ios
return tr("iOS");
return Tr::tr("iOS");
}
QSet<Utils::Id> IosQtVersion::availableFeatures() const
@@ -83,3 +102,5 @@ IosQtVersionFactory::IosQtVersionFactory()
return setup.platforms.contains("ios");
});
}
} // Ios::Internal

View File

@@ -3,31 +3,9 @@
#pragma once
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtversionfactory.h>
#include <QCoreApplication>
namespace Ios {
namespace Internal {
class IosQtVersion : public QtSupport::QtVersion
{
Q_DECLARE_TR_FUNCTIONS(Ios::Internal::IosQtVersion)
public:
IosQtVersion();
bool isValid() const override;
QString invalidReason() const override;
ProjectExplorer::Abis detectQtAbis() const override;
QSet<Utils::Id> availableFeatures() const override;
QSet<Utils::Id> targetDeviceTypes() const override;
QString description() const override;
};
namespace Ios::Internal {
class IosQtVersionFactory : public QtSupport::QtVersionFactory
{
@@ -35,5 +13,4 @@ public:
IosQtVersionFactory();
};
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -2,8 +2,10 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "iosrunconfiguration.h"
#include "iosconstants.h"
#include "iosdevice.h"
#include "iostr.h"
#include "simulatorcontrol.h"
#include <projectexplorer/buildconfiguration.h>
@@ -18,7 +20,7 @@
#include <projectexplorer/target.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/filepath.h>
#include <utils/qtcprocess.h>
#include <utils/qtcassert.h>
#include <utils/layoutbuilder.h>
@@ -38,7 +40,7 @@ using namespace Utils;
namespace Ios::Internal {
static const QLatin1String deviceTypeKey("Ios.device_type");
const QLatin1String deviceTypeKey("Ios.device_type");
static QString displayName(const SimulatorInfo &device)
{
@@ -66,8 +68,8 @@ IosRunConfiguration::IosRunConfiguration(Target *target, Id id)
setUpdater([this, target, executableAspect] {
IDevice::ConstPtr dev = DeviceKitAspect::device(target->kit());
const QString devName = dev.isNull() ? IosDevice::name() : dev->displayName();
setDefaultDisplayName(tr("Run on %1").arg(devName));
setDisplayName(tr("Run %1 on %2").arg(applicationName()).arg(devName));
setDefaultDisplayName(Tr::tr("Run on %1").arg(devName));
setDisplayName(Tr::tr("Run %1 on %2").arg(applicationName()).arg(devName));
executableAspect->setExecutable(localExecutable());
@@ -227,7 +229,7 @@ QString IosRunConfiguration::disabledReason() const
{
Utils::Id devType = DeviceTypeKitAspect::deviceTypeId(kit());
if (devType != Constants::IOS_DEVICE_TYPE && devType != Constants::IOS_SIMULATOR_TYPE)
return tr("Kit has incorrect device type for running on iOS devices.");
return Tr::tr("Kit has incorrect device type for running on iOS devices.");
IDevice::ConstPtr dev = DeviceKitAspect::device(kit());
QString validDevName;
bool hasConncetedDev = false;
@@ -248,27 +250,27 @@ QString IosRunConfiguration::disabledReason() const
if (dev.isNull()) {
if (!validDevName.isEmpty())
return tr("No device chosen. Select %1.").arg(validDevName); // should not happen
return Tr::tr("No device chosen. Select %1.").arg(validDevName); // should not happen
else if (hasConncetedDev)
return tr("No device chosen. Enable developer mode on a device."); // should not happen
return Tr::tr("No device chosen. Enable developer mode on a device."); // should not happen
else
return tr("No device available.");
return Tr::tr("No device available.");
} else {
switch (dev->deviceState()) {
case IDevice::DeviceReadyToUse:
break;
case IDevice::DeviceConnected:
return tr("To use this device you need to enable developer mode on it.");
return Tr::tr("To use this device you need to enable developer mode on it.");
case IDevice::DeviceDisconnected:
case IDevice::DeviceStateUnknown:
if (!validDevName.isEmpty())
return tr("%1 is not connected. Select %2?")
return Tr::tr("%1 is not connected. Select %2?")
.arg(dev->displayName(), validDevName);
else if (hasConncetedDev)
return tr("%1 is not connected. Enable developer mode on a device?")
return Tr::tr("%1 is not connected. Enable developer mode on a device?")
.arg(dev->displayName());
else
return tr("%1 is not connected.").arg(dev->displayName());
return Tr::tr("%1 is not connected.").arg(dev->displayName());
}
}
return RunConfiguration::disabledReason();
@@ -327,7 +329,7 @@ void IosDeviceTypeAspect::addToLayout(LayoutBuilder &builder)
m_deviceTypeComboBox = new QComboBox;
m_deviceTypeComboBox->setModel(&m_deviceTypeModel);
m_deviceTypeLabel = new QLabel(IosRunConfiguration::tr("Device type:"));
m_deviceTypeLabel = new QLabel(Tr::tr("Device type:"));
builder.addItems({m_deviceTypeLabel, m_deviceTypeComboBox});

View File

@@ -14,8 +14,7 @@
#include <QComboBox>
#include <QStandardItemModel>
namespace Ios {
namespace Internal {
namespace Ios::Internal {
class IosRunConfiguration;
@@ -61,7 +60,7 @@ private:
class IosRunConfiguration : public ProjectExplorer::RunConfiguration
{
Q_OBJECT
Q_OBJECT // FIXME: Used in IosDsymBuildStep
public:
IosRunConfiguration(ProjectExplorer::Target *target, Utils::Id id);
@@ -84,5 +83,4 @@ public:
IosRunConfigurationFactory();
};
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -9,6 +9,7 @@
#include "iosrunconfiguration.h"
#include "iossimulator.h"
#include "iostoolhandler.h"
#include "iostr.h"
#include <debugger/debuggerconstants.h>
#include <debugger/debuggerkitinformation.h>
@@ -73,8 +74,6 @@ static void stopRunningRunControl(RunControl *runControl)
class IosRunner : public RunWorker
{
Q_DECLARE_TR_FUNCTIONS(Ios::Internal::IosRunner)
public:
IosRunner(RunControl *runControl);
~IosRunner() override;
@@ -194,7 +193,8 @@ void IosRunner::start()
m_cleanExit = false;
m_qmlServerPort = Port();
if (!QFileInfo::exists(m_bundleDir)) {
TaskHub::addTask(DeploymentTask(Task::Warning, tr("Could not find %1.").arg(m_bundleDir)));
TaskHub::addTask(DeploymentTask(Task::Warning,
Tr::tr("Could not find %1.").arg(m_bundleDir)));
reportFailure();
return;
}
@@ -275,7 +275,7 @@ void IosRunner::handleGotServerPorts(IosToolHandler *handler, const QString &bun
if (prerequisiteOk)
reportStarted();
else
reportFailure(tr("Could not get necessary ports for the debugger connection."));
reportFailure(Tr::tr("Could not get necessary ports for the debugger connection."));
}
void IosRunner::handleGotInferiorPid(IosToolHandler *handler, const QString &bundlePath,
@@ -293,7 +293,7 @@ void IosRunner::handleGotInferiorPid(IosToolHandler *handler, const QString &bun
if (m_pid > 0) {
prerequisiteOk = true;
} else {
reportFailure(tr("Could not get inferior PID."));
reportFailure(Tr::tr("Could not get inferior PID."));
return;
}
@@ -303,7 +303,7 @@ void IosRunner::handleGotInferiorPid(IosToolHandler *handler, const QString &bun
if (prerequisiteOk)
reportStarted();
else
reportFailure(tr("Could not get necessary ports for the debugger connection."));
reportFailure(Tr::tr("Could not get necessary ports for the debugger connection."));
}
void IosRunner::handleAppOutput(IosToolHandler *handler, const QString &output)
@@ -324,10 +324,10 @@ void IosRunner::handleErrorMsg(IosToolHandler *handler, const QString &msg)
QString res(msg);
QString lockedErr ="Unexpected reply: ELocked (454c6f636b6564) vs OK (4f4b)";
if (msg.contains("AMDeviceStartService returned -402653150")) {
TaskHub::addTask(DeploymentTask(Task::Warning, tr("Run failed. "
TaskHub::addTask(DeploymentTask(Task::Warning, Tr::tr("Run failed. "
"The settings in the Organizer window of Xcode might be incorrect.")));
} else if (res.contains(lockedErr)) {
QString message = tr("The device is locked, please unlock.");
QString message = Tr::tr("The device is locked, please unlock.");
TaskHub::addTask(DeploymentTask(Task::Error, message));
res.replace(lockedErr, message);
}
@@ -350,9 +350,9 @@ void IosRunner::handleFinished(IosToolHandler *handler)
{
if (m_toolHandler == handler) {
if (m_cleanExit)
appendMessage(tr("Run ended."), NormalMessageFormat);
appendMessage(Tr::tr("Run ended."), NormalMessageFormat);
else
appendMessage(tr("Run ended with error."), ErrorMessageFormat);
appendMessage(Tr::tr("Run ended with error."), ErrorMessageFormat);
m_toolHandler = nullptr;
}
handler->deleteLater();
@@ -385,13 +385,12 @@ Port IosRunner::qmlServerPort() const
class IosRunSupport : public IosRunner
{
Q_DECLARE_TR_FUNCTIONS(Ios::Internal::IosRunSupport)
public:
explicit IosRunSupport(RunControl *runControl);
~IosRunSupport() override;
void didStartApp(IosToolHandler::OpStatus status);
private:
void start() override;
};
@@ -412,7 +411,7 @@ IosRunSupport::~IosRunSupport()
void IosRunSupport::start()
{
appendMessage(tr("Starting remote process."), NormalMessageFormat);
appendMessage(Tr::tr("Starting remote process."), NormalMessageFormat);
IosRunner::start();
}
@@ -422,7 +421,6 @@ void IosRunSupport::start()
class IosQmlProfilerSupport : public RunWorker
{
Q_DECLARE_TR_FUNCTIONS(Ios::Internal::IosQmlProfilerSupport)
public:
IosQmlProfilerSupport(RunControl *runControl);
@@ -462,7 +460,7 @@ void IosQmlProfilerSupport::start()
if (qmlPort.isValid())
reportStarted();
else
reportFailure(tr("Could not get necessary ports for the profiler connection."));
reportFailure(Tr::tr("Could not get necessary ports for the profiler connection."));
}
//
@@ -471,8 +469,6 @@ void IosQmlProfilerSupport::start()
class IosDebugSupport : public DebuggerRunTool
{
Q_DECLARE_TR_FUNCTIONS(Ios::Internal::IosDebugSupport)
public:
IosDebugSupport(RunControl *runControl);
@@ -498,7 +494,7 @@ IosDebugSupport::IosDebugSupport(RunControl *runControl)
void IosDebugSupport::start()
{
if (!m_runner->isAppRunning()) {
reportFailure(tr("Application not running."));
reportFailure(Tr::tr("Application not running."));
return;
}
@@ -520,9 +516,9 @@ void IosDebugSupport::start()
if (deviceSdk.isEmpty()) {
TaskHub::addTask(DeploymentTask(
Task::Warning,
tr("Could not find device specific debug symbols at %1. "
"Debugging initialization will be slow until you open the Organizer window of "
"Xcode with the device connected to have the symbols generated.")
Tr::tr("Could not find device specific debug symbols at %1. "
"Debugging initialization will be slow until you open the Organizer window of "
"Xcode with the device connected to have the symbols generated.")
.arg(symbolsPathCandidates.constFirst().toUserOutput())));
}
setDeviceSymbolsRoot(deviceSdk.toString());
@@ -553,8 +549,8 @@ void IosDebugSupport::start()
if (dsymPath.exists()
&& dsymPath.lastModified() < data->localExecutable.lastModified()) {
TaskHub::addTask(DeploymentTask(Task::Warning,
tr("The dSYM %1 seems to be outdated, it might confuse the debugger.")
.arg(dsymPath.toUserOutput())));
Tr::tr("The dSYM %1 seems to be outdated, it might confuse the debugger.")
.arg(dsymPath.toUserOutput())));
}
}

View File

@@ -3,23 +3,20 @@
#include "iossettingspage.h"
#include "iossettingswidget.h"
#include "iosconstants.h"
#include "iossettingswidget.h"
#include "iostr.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <QCoreApplication>
namespace Ios {
namespace Internal {
namespace Ios::Internal {
IosSettingsPage::IosSettingsPage()
{
setId(Constants::IOS_SETTINGS_ID);
setDisplayName(IosSettingsWidget::tr("iOS"));
setDisplayName(Tr::tr("iOS"));
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
setWidgetCreator([] { return new IosSettingsWidget; });
}
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -5,8 +5,7 @@
#include <coreplugin/dialogs/ioptionspage.h>
namespace Ios {
namespace Internal {
namespace Ios::Internal {
class IosSettingsPage final : public Core::IOptionsPage
{
@@ -14,5 +13,4 @@ public:
IosSettingsPage();
};
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -5,8 +5,8 @@
#include "createsimulatordialog.h"
#include "iosconfigurations.h"
#include "iosconfigurations.h"
#include "iostr.h"
#include "simulatorcontrol.h"
#include "simulatorinfomodel.h"
#include "simulatoroperationdialog.h"
@@ -16,7 +16,6 @@
#include <utils/pathchooser.h>
#include <utils/runextensions.h>
#include <QApplication>
#include <QCheckBox>
#include <QDateTime>
#include <QGroupBox>
@@ -29,11 +28,11 @@
#include <QSortFilterProxyModel>
#include <QTreeView>
static const int simStartWarnCount = 4;
using namespace std::placeholders;
namespace Ios::Internal {
using namespace std::placeholders;
const int simStartWarnCount = 4;
static SimulatorInfoList selectedSimulators(const QTreeView *deviceTreeView)
{
@@ -53,29 +52,29 @@ static void onSimOperation(const SimulatorInfo &simInfo, SimulatorOperationDialo
IosSettingsWidget::IosSettingsWidget()
{
resize(622, 456);
setWindowTitle(tr("iOS Configuration"));
setWindowTitle(Tr::tr("iOS Configuration"));
m_deviceAskCheckBox = new QCheckBox(tr("Ask about devices not in developer mode"));
m_deviceAskCheckBox = new QCheckBox(Tr::tr("Ask about devices not in developer mode"));
m_deviceAskCheckBox->setChecked(!IosConfigurations::ignoreAllDevices());
m_renameButton = new QPushButton(tr("Rename"));
m_renameButton = new QPushButton(Tr::tr("Rename"));
m_renameButton->setEnabled(false);
m_renameButton->setToolTip(tr("Rename a simulator device."));
m_renameButton->setToolTip(Tr::tr("Rename a simulator device."));
m_deleteButton = new QPushButton(tr("Delete"));
m_deleteButton = new QPushButton(Tr::tr("Delete"));
m_deleteButton->setEnabled(false);
m_deleteButton->setToolTip(tr("Delete simulator devices."));
m_deleteButton->setToolTip(Tr::tr("Delete simulator devices."));
m_resetButton = new QPushButton(tr("Reset"));
m_resetButton = new QPushButton(Tr::tr("Reset"));
m_resetButton->setEnabled(false);
m_resetButton->setToolTip(tr("Reset contents and settings of simulator devices."));
m_resetButton->setToolTip(Tr::tr("Reset contents and settings of simulator devices."));
auto createButton = new QPushButton(tr("Create"));
createButton->setToolTip(tr("Create a new simulator device."));
auto createButton = new QPushButton(Tr::tr("Create"));
createButton->setToolTip(Tr::tr("Create a new simulator device."));
m_startButton = new QPushButton(tr("Start"));
m_startButton = new QPushButton(Tr::tr("Start"));
m_startButton->setEnabled(false);
m_startButton->setToolTip(tr("Start simulator devices."));
m_startButton->setToolTip(Tr::tr("Start simulator devices."));
auto proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel(new SimulatorInfoModel(this));
@@ -92,17 +91,17 @@ IosSettingsWidget::IosSettingsWidget()
m_pathWidget->setExpectedKind(Utils::PathChooser::ExistingDirectory);
m_pathWidget->lineEdit()->setReadOnly(true);
m_pathWidget->setFilePath(IosConfigurations::screenshotDir());
m_pathWidget->addButton(tr("Screenshot"), this,
std::bind(&IosSettingsWidget::onScreenshot, this));
m_pathWidget->addButton(Tr::tr("Screenshot"), this,
std::bind(&IosSettingsWidget::onScreenshot, this));
using namespace Utils::Layouting;
Column {
Group {
title(tr("Devices")),
title(Tr::tr("Devices")),
Row { m_deviceAskCheckBox }
},
Group {
title(tr("Simulator")),
title(Tr::tr("Simulator")),
Column {
Row {
m_deviceView,
@@ -117,7 +116,7 @@ IosSettingsWidget::IosSettingsWidget()
},
},
hr,
Row { tr("Screenshot directory:"), m_pathWidget }
Row { Tr::tr("Screenshot directory:"), m_pathWidget }
}
}
}.attachTo(this);
@@ -151,10 +150,11 @@ void IosSettingsWidget::onStart()
return;
if (simulatorInfoList.count() > simStartWarnCount) {
const QString message = tr("You are trying to launch %n simulators simultaneously. This "
"will take significant system resources. Do you really want to "
"continue?", "", simulatorInfoList.count());
const int buttonCode = QMessageBox::warning(this, tr("Simulator Start"), message,
const QString message =
Tr::tr("You are trying to launch %n simulators simultaneously. This "
"will take significant system resources. Do you really want to "
"continue?", "", simulatorInfoList.count());
const int buttonCode = QMessageBox::warning(this, Tr::tr("Simulator Start"), message,
QMessageBox::Ok | QMessageBox::Abort,
QMessageBox::Abort);
@@ -164,19 +164,19 @@ void IosSettingsWidget::onStart()
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
statusDialog->addMessage(tr("Starting %n simulator device(s)...", "", simulatorInfoList.count()),
statusDialog->addMessage(Tr::tr("Starting %n simulator device(s)...", "", simulatorInfoList.count()),
Utils::NormalMessageFormat);
QList<QFuture<void>> futureList;
for (const SimulatorInfo &info : simulatorInfoList) {
if (!info.isShutdown()) {
statusDialog->addMessage(tr("Cannot start simulator (%1, %2) in current state: %3")
statusDialog->addMessage(Tr::tr("Cannot start simulator (%1, %2) in current state: %3")
.arg(info.name).arg(info.runtimeName).arg(info.state),
Utils::StdErrFormat);
} else {
futureList << QFuture<void>(Utils::onResultReady(
SimulatorControl::startSimulator(info.identifier),
std::bind(onSimOperation, info, statusDialog, tr("simulator start"), _1)));
std::bind(onSimOperation, info, statusDialog, Tr::tr("simulator start"), _1)));
}
}
@@ -192,14 +192,14 @@ void IosSettingsWidget::onCreate()
{
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
statusDialog->addMessage(tr("Creating simulator device..."), Utils::NormalMessageFormat);
statusDialog->addMessage(Tr::tr("Creating simulator device..."), Utils::NormalMessageFormat);
const auto onSimulatorCreate = [statusDialog](const QString &name,
const SimulatorControl::ResponseData &response) {
if (response.success) {
statusDialog->addMessage(tr("Simulator device (%1) created.\nUDID: %2")
statusDialog->addMessage(Tr::tr("Simulator device (%1) created.\nUDID: %2")
.arg(name).arg(response.simUdid), Utils::StdOutFormat);
} else {
statusDialog->addMessage(tr("Simulator device (%1) creation failed.\nError: %2").
statusDialog->addMessage(Tr::tr("Simulator device (%1) creation failed.\nError: %2").
arg(name).arg(response.commandOutput),
Utils::StdErrFormat);
}
@@ -227,8 +227,8 @@ void IosSettingsWidget::onReset()
if (simulatorInfoList.isEmpty())
return;
const int userInput = QMessageBox::question(this, tr("Reset"),
tr("Do you really want to reset the contents and settings"
const int userInput = QMessageBox::question(this, Tr::tr("Reset"),
Tr::tr("Do you really want to reset the contents and settings"
" of the %n selected device(s)?", "",
simulatorInfoList.count()));
if (userInput == QMessageBox::No)
@@ -236,13 +236,14 @@ void IosSettingsWidget::onReset()
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
statusDialog->addMessage(tr("Resetting contents and settings..."), Utils::NormalMessageFormat);
statusDialog->addMessage(Tr::tr("Resetting contents and settings..."),
Utils::NormalMessageFormat);
QList<QFuture<void>> futureList;
for (const SimulatorInfo &info : simulatorInfoList) {
futureList << QFuture<void>(Utils::onResultReady(
SimulatorControl::resetSimulator(info.identifier),
std::bind(onSimOperation, info, statusDialog, tr("simulator reset"), _1)));
std::bind(onSimOperation, info, statusDialog, Tr::tr("simulator reset"), _1)));
}
statusDialog->addFutures(futureList);
@@ -260,17 +261,17 @@ void IosSettingsWidget::onRename()
return;
const SimulatorInfo &simInfo = simulatorInfoList.at(0);
const QString newName = QInputDialog::getText(this, tr("Rename %1").arg(simInfo.name),
tr("Enter new name:"));
const QString newName = QInputDialog::getText(this, Tr::tr("Rename %1").arg(simInfo.name),
Tr::tr("Enter new name:"));
if (newName.isEmpty())
return;
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
statusDialog->addMessage(tr("Renaming simulator device..."), Utils::NormalMessageFormat);
statusDialog->addMessage(Tr::tr("Renaming simulator device..."), Utils::NormalMessageFormat);
QFuture<void> f = QFuture<void>(Utils::onResultReady(
SimulatorControl::renameSimulator(simInfo.identifier, newName),
std::bind(onSimOperation, simInfo, statusDialog, tr("simulator rename"), _1)));
std::bind(onSimOperation, simInfo, statusDialog, Tr::tr("simulator rename"), _1)));
statusDialog->addFutures({f});
statusDialog->exec(); // Modal dialog returns only when all the operations are done or cancelled.
}
@@ -285,21 +286,22 @@ void IosSettingsWidget::onDelete()
if (simulatorInfoList.isEmpty())
return;
const int userInput = QMessageBox::question(this, tr("Delete Device"),
tr("Do you really want to delete the %n selected "
"device(s)?", "", simulatorInfoList.count()));
const int userInput =
QMessageBox::question(this, Tr::tr("Delete Device"),
Tr::tr("Do you really want to delete the %n selected "
"device(s)?", "", simulatorInfoList.count()));
if (userInput == QMessageBox::No)
return;
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
statusDialog->addMessage(tr("Deleting %n simulator device(s)...", "", simulatorInfoList.count()),
statusDialog->addMessage(Tr::tr("Deleting %n simulator device(s)...", "", simulatorInfoList.count()),
Utils::NormalMessageFormat);
QList<QFuture<void>> futureList;
for (const SimulatorInfo &info : simulatorInfoList) {
futureList << QFuture<void>(Utils::onResultReady(
SimulatorControl::deleteSimulator(info.identifier),
std::bind(onSimOperation, info, statusDialog, tr("simulator delete"), _1)));
std::bind(onSimOperation, info, statusDialog, Tr::tr("simulator delete"), _1)));
}
statusDialog->addFutures(futureList);
@@ -324,13 +326,13 @@ void IosSettingsWidget::onScreenshot()
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);
statusDialog->setAttribute(Qt::WA_DeleteOnClose);
statusDialog->addMessage(tr("Capturing screenshots from %n device(s)...", "",
simulatorInfoList.count()), Utils::NormalMessageFormat);
statusDialog->addMessage(Tr::tr("Capturing screenshots from %n device(s)...", "",
simulatorInfoList.count()), Utils::NormalMessageFormat);
QList<QFuture<void>> futureList;
for (const SimulatorInfo &info : simulatorInfoList) {
futureList << QFuture<void>(Utils::onResultReady(
SimulatorControl::takeSceenshot(info.identifier, generatePath(info)),
std::bind(onSimOperation, info, statusDialog, tr("simulator screenshot"), _1)));
std::bind(onSimOperation, info, statusDialog, Tr::tr("simulator screenshot"), _1)));
}
statusDialog->addFutures(futureList);

View File

@@ -3,12 +3,8 @@
#pragma once
#include "iosconfigurations.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <QCoreApplication>
QT_BEGIN_NAMESPACE
class QCheckBox;
class QPushButton;
@@ -21,8 +17,6 @@ namespace Ios::Internal {
class IosSettingsWidget final : public Core::IOptionsPageWidget
{
Q_DECLARE_TR_FUNCTIONS(Ios::Internal::IosSettingsWidget)
public:
IosSettingsWidget();
~IosSettingsWidget() final;

View File

@@ -3,23 +3,22 @@
#include "iossimulator.h"
#include "iosconstants.h"
#include "iostoolhandler.h"
#include "iostr.h"
#include <projectexplorer/kitinformation.h>
#include <utils/port.h>
#include <utils/qtcprocess.h>
#include <QCoreApplication>
#include <QMapIterator>
using namespace ProjectExplorer;
namespace Ios {
namespace Internal {
namespace Ios::Internal {
static const QLatin1String iosDeviceTypeDisplayNameKey = QLatin1String("displayName");
static const QLatin1String iosDeviceTypeTypeKey = QLatin1String("type");
static const QLatin1String iosDeviceTypeIdentifierKey = QLatin1String("identifier");
const QLatin1String iosDeviceTypeDisplayNameKey("displayName");
const QLatin1String iosDeviceTypeTypeKey("type");
const QLatin1String iosDeviceTypeIdentifierKey("identifier");
IosSimulator::IosSimulator(Utils::Id id)
: m_lastPort(Constants::IOS_SIMULATOR_PORT_START)
@@ -28,8 +27,8 @@ IosSimulator::IosSimulator(Utils::Id id)
setType(Constants::IOS_SIMULATOR_TYPE);
setMachineType(IDevice::Emulator);
setOsType(Utils::OsTypeMac);
setDefaultDisplayName(tr("iOS Simulator"));
setDisplayType(tr("iOS Simulator"));
setDefaultDisplayName(Tr::tr("iOS Simulator"));
setDisplayType(Tr::tr("iOS Simulator"));
setDeviceState(DeviceReadyToUse);
}
@@ -209,13 +208,12 @@ QDebug operator <<(QDebug debug, const IosDeviceType &deviceType)
// Factory
IosSimulatorFactory::IosSimulatorFactory()
: ProjectExplorer::IDeviceFactory(Constants::IOS_SIMULATOR_TYPE)
: IDeviceFactory(Constants::IOS_SIMULATOR_TYPE)
{
setDisplayName(IosSimulator::tr("iOS Simulator"));
setDisplayName(Tr::tr("iOS Simulator"));
setCombinedIcon(":/ios/images/iosdevicesmall.png",
":/ios/images/iosdevice.png");
setConstructionFunction([] { return ProjectExplorer::IDevice::Ptr(new IosSimulator()); });
setConstructionFunction([] { return IDevice::Ptr(new IosSimulator()); });
}
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -10,8 +10,7 @@
#include <QDebug>
namespace Ios {
namespace Internal {
namespace Ios::Internal {
class IosConfigurations;
class IosSimulatorFactory;
@@ -42,8 +41,6 @@ QDebug operator <<(QDebug debug, const IosDeviceType &deviceType);
class IosSimulator final : public ProjectExplorer::IDevice
{
Q_DECLARE_TR_FUNCTIONS(Ios::Internal::IosSimulator)
public:
using ConstPtr = QSharedPointer<const IosSimulator>;
using Ptr = QSharedPointer<IosSimulator>;
@@ -69,7 +66,6 @@ public:
IosSimulatorFactory();
};
} // namespace Internal
} // namespace Ios
} // Ios::Internal
Q_DECLARE_METATYPE(Ios::Internal::IosDeviceType)

View File

@@ -2,23 +2,23 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "iostoolhandler.h"
#include "iosconfigurations.h"
#include "iosconstants.h"
#include "iossimulator.h"
#include "iostr.h"
#include "simulatorcontrol.h"
#include <coreplugin/icore.h>
#include <debugger/debuggerconstants.h>
#include <utils/fileutils.h>
#include <utils/filepath.h>
#include <utils/futuresynchronizer.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/runextensions.h>
#include <utils/temporarydirectory.h>
#include <QCoreApplication>
#include <QDir>
#include <QFileInfo>
#include <QFutureWatcher>
@@ -373,7 +373,7 @@ void IosToolHandlerPrivate::toolExited(int code)
void IosDeviceToolHandlerPrivate::subprocessError(QProcess::ProcessError error)
{
if (state != Stopped)
errorMsg(IosToolHandler::tr("iOS tool error %1").arg(error));
errorMsg(Tr::tr("iOS tool error %1").arg(error));
stop(-1);
if (error == QProcess::FailedToStart) {
qCDebug(toolHandlerLog) << "IosToolHandler::finished(" << this << ")";
@@ -807,7 +807,7 @@ void IosSimulatorToolHandlerPrivate::requestTransferApp(const QString &appBundle
if (response.success) {
installAppOnSimulator();
} else {
errorMsg(IosToolHandler::tr("Application install on simulator failed. Simulator not running."));
errorMsg(Tr::tr("Application install on simulator failed. Simulator not running."));
didTransferApp(m_bundlePath, m_deviceId, IosToolHandler::Failure);
emit q->finished(q);
}
@@ -833,7 +833,7 @@ void IosSimulatorToolHandlerPrivate::requestRunApp(const QString &appBundlePath,
Utils::FilePath appBundle = Utils::FilePath::fromString(m_bundlePath);
if (!appBundle.exists()) {
errorMsg(IosToolHandler::tr("Application launch on simulator failed. Invalid bundle path %1")
errorMsg(Tr::tr("Application launch on simulator failed. Invalid bundle path %1")
.arg(m_bundlePath));
didStartApp(m_bundlePath, m_deviceId, Ios::IosToolHandler::Failure);
return;
@@ -845,7 +845,7 @@ void IosSimulatorToolHandlerPrivate::requestRunApp(const QString &appBundlePath,
if (response.success) {
launchAppOnSimulator(extraArgs);
} else {
errorMsg(IosToolHandler::tr("Application launch on simulator failed. Simulator not running."));
errorMsg(Tr::tr("Application launch on simulator failed. Simulator not running."));
didStartApp(m_bundlePath, m_deviceId, Ios::IosToolHandler::Failure);
}
};
@@ -896,7 +896,7 @@ void IosSimulatorToolHandlerPrivate::installAppOnSimulator()
isTransferringApp(m_bundlePath, m_deviceId, 100, 100, "");
didTransferApp(m_bundlePath, m_deviceId, IosToolHandler::Success);
} else {
errorMsg(IosToolHandler::tr("Application install on simulator failed. %1")
errorMsg(Tr::tr("Application install on simulator failed. %1")
.arg(response.commandOutput));
didTransferApp(m_bundlePath, m_deviceId, IosToolHandler::Failure);
}
@@ -925,12 +925,12 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
captureConsole = stdoutFile->open() && stderrFile->open();
if (!captureConsole)
errorMsg(IosToolHandler::tr("Cannot capture console output from %1. "
"Error redirecting output to %2.*")
errorMsg(Tr::tr("Cannot capture console output from %1. "
"Error redirecting output to %2.*")
.arg(bundleId).arg(fileTemplate));
} else {
errorMsg(IosToolHandler::tr("Cannot capture console output from %1. "
"Install Xcode 8 or later.").arg(bundleId));
errorMsg(Tr::tr("Cannot capture console output from %1. "
"Install Xcode 8 or later.").arg(bundleId));
}
auto monitorPid = [this](QFutureInterface<void> &fi, qint64 pid) {
@@ -961,8 +961,8 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
stdoutFile, stderrFile));
} else {
m_pid = -1;
errorMsg(IosToolHandler::tr("Application launch on simulator failed. %1")
.arg(response.commandOutput));
errorMsg(Tr::tr("Application launch on simulator failed. %1")
.arg(response.commandOutput));
didStartApp(m_bundlePath, m_deviceId, Ios::IosToolHandler::Failure);
stop(-1);
emit q->finished(q);
@@ -984,8 +984,8 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
bool IosSimulatorToolHandlerPrivate::isResponseValid(const SimulatorControl::ResponseData &responseData)
{
if (responseData.simUdid.compare(m_deviceId) != 0) {
errorMsg(IosToolHandler::tr("Invalid simulator response. Device Id mismatch. "
"Device Id = %1 Response Id = %2")
errorMsg(Tr::tr("Invalid simulator response. Device Id mismatch. "
"Device Id = %1 Response Id = %2")
.arg(responseData.simUdid)
.arg(m_deviceId));
emit q->finished(q);

View File

@@ -28,8 +28,7 @@ namespace {
static Q_LOGGING_CATEGORY(simulatorLog, "qtc.ios.simulator", QtWarningMsg)
}
namespace Ios {
namespace Internal {
namespace Ios::Internal {
const int simulatorStartTimeout = 60000;
@@ -584,5 +583,4 @@ bool SimulatorInfo::operator==(const SimulatorInfo &other) const
&& runtimeName == other.runtimeName;
}
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -1,21 +1,22 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <utils/fileutils.h>
#include <utils/filepath.h>
#include <QObject>
#include <QFuture>
#include <QDebug>
#include <memory>
namespace Ios {
namespace Internal {
namespace Ios::Internal {
class SimulatorControlPrivate;
class SimulatorEntity {
class SimulatorEntity
{
public:
QString name;
QString identifier;
@@ -40,7 +41,8 @@ public:
QString runtimeName;
};
class RuntimeInfo : public SimulatorEntity{
class RuntimeInfo : public SimulatorEntity
{
public:
QString version;
QString build;
@@ -91,8 +93,7 @@ public:
static QFuture<ResponseData> takeSceenshot(const QString &simUdid, const QString &filePath);
};
} // namespace Internal
} // namespace Ios
} // Ios::Internal
Q_DECLARE_METATYPE(Ios::Internal::DeviceTypeInfo)
Q_DECLARE_METATYPE(Ios::Internal::RuntimeInfo)

View File

@@ -3,13 +3,14 @@
#include "simulatorinfomodel.h"
#include "iostr.h"
#include <utils/algorithm.h>
#include <utils/runextensions.h>
#include <QTimer>
namespace Ios {
namespace Internal {
namespace Ios::Internal {
using namespace std::placeholders;
@@ -17,7 +18,7 @@ const int colCount = 3;
const int nameCol = 0;
const int runtimeCol = 1;
const int stateCol = 2;
static const int deviceUpdateInterval = 1000; // Update simulator state every 1 sec.
const int deviceUpdateInterval = 1000; // Update simulator state every 1 sec.
SimulatorInfoModel::SimulatorInfoModel(QObject *parent) :
QAbstractItemModel(parent)
@@ -50,7 +51,7 @@ QVariant SimulatorInfoModel::data(const QModelIndex &index, int role) const
return "";
}
} else if (role == Qt::ToolTipRole) {
return tr("UDID: %1").arg(simInfo.identifier);
return Tr::tr("UDID: %1").arg(simInfo.identifier);
} else if (role == Qt::UserRole) {
return QVariant::fromValue<SimulatorInfo>(simInfo);
}
@@ -79,13 +80,13 @@ QVariant SimulatorInfoModel::headerData(int section, Qt::Orientation orientation
if (role == Qt::DisplayRole) {
switch (section) {
case nameCol:
return tr("Simulator Name");
return Tr::tr("Simulator Name");
case runtimeCol:
return tr("Runtime");
return Tr::tr("Runtime");
case stateCol:
return tr("Current State");
return Tr::tr("Current State");
default:
return "";
return {};
}
}
@@ -140,5 +141,4 @@ void SimulatorInfoModel::populateSimulators(const SimulatorInfoList &simulatorLi
}
}
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -9,16 +9,12 @@
#include <QAbstractListModel>
namespace Ios {
namespace Internal {
namespace Ios::Internal {
using SimulatorInfoList = QList<SimulatorInfo>;
class SimulatorInfoModel : public QAbstractItemModel
{
Q_OBJECT
public:
SimulatorInfoModel(QObject *parent = nullptr);
@@ -34,10 +30,8 @@ private:
void requestSimulatorInfo();
void populateSimulators(const SimulatorInfoList &simulatorList);
private:
Utils::FutureSynchronizer m_fetchFuture;
SimulatorInfoList m_simList;
};
} // namespace Internal
} // namespace Ios
} // Ios::Internal

View File

@@ -3,11 +3,12 @@
#include "simulatoroperationdialog.h"
#include "iostr.h"
#include <utils/layoutbuilder.h>
#include <utils/outputformatter.h>
#include <utils/qtcassert.h>
#include <QApplication>
#include <QDialogButtonBox>
#include <QFutureWatcher>
#include <QLoggingCategory>
@@ -15,19 +16,17 @@
#include <QProgressBar>
#include <QPushButton>
namespace {
Q_LOGGING_CATEGORY(iosCommon, "qtc.ios.common", QtWarningMsg)
}
namespace Ios::Internal {
static Q_LOGGING_CATEGORY(iosCommon, "qtc.ios.common", QtWarningMsg)
SimulatorOperationDialog::SimulatorOperationDialog(QWidget *parent) :
// TODO: Maximize buttong only because of QTBUG-41932
QDialog(parent,Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint)
{
resize(580, 320);
setModal(true);
setWindowTitle(tr("Simulator Operation Status"));
setWindowTitle(Tr::tr("Simulator Operation Status"));
auto messageEdit = new QPlainTextEdit;
messageEdit->setReadOnly(true);
@@ -100,13 +99,13 @@ void SimulatorOperationDialog::addMessage(const SimulatorInfo &siminfo,
{
QTC_CHECK(siminfo.identifier == response.simUdid);
if (response.success) {
addMessage(tr("%1, %2\nOperation %3 completed successfully.").arg(siminfo.name)
addMessage(Tr::tr("%1, %2\nOperation %3 completed successfully.").arg(siminfo.name)
.arg(siminfo.runtimeName).arg(context), Utils::StdOutFormat);
} else {
QString erroMsg = response.commandOutput.trimmed();
QString message = tr("%1, %2\nOperation %3 failed.\nUDID: %4\nError: %5").arg(siminfo.name)
QString message = Tr::tr("%1, %2\nOperation %3 failed.\nUDID: %4\nError: %5").arg(siminfo.name)
.arg(siminfo.runtimeName).arg(context).arg(siminfo.identifier)
.arg(erroMsg.isEmpty() ? tr("Unknown") : erroMsg);
.arg(erroMsg.isEmpty() ? Tr::tr("Unknown") : erroMsg);
addMessage(message, Utils::StdErrFormat);
qCDebug(iosCommon) << message;
}
@@ -118,7 +117,7 @@ void SimulatorOperationDialog::updateInputs()
m_buttonBox->button(QDialogButtonBox::Cancel)->setEnabled(!enableOk);
m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enableOk);
if (enableOk) {
addMessage(tr("Done."), Utils::NormalMessageFormat);
addMessage(Tr::tr("Done."), Utils::NormalMessageFormat);
m_progressBar->setMaximum(1); // Stop progress bar.
}
}

View File

@@ -22,7 +22,7 @@ namespace Ios::Internal {
class SimulatorOperationDialog : public QDialog
{
Q_OBJECT
public:
explicit SimulatorOperationDialog(QWidget *parent = nullptr);
~SimulatorOperationDialog() override;