2013-04-25 16:02:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-04-25 16:02:17 +02:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
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.
|
2013-04-25 16:02:17 +02: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.
|
2013-04-25 16:02:17 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "iosdevicefactory.h"
|
|
|
|
|
#include "iosdevice.h"
|
|
|
|
|
|
|
|
|
|
#include "iosconstants.h"
|
|
|
|
|
|
2016-11-12 04:16:59 +01:00
|
|
|
#include <utils/icon.h>
|
|
|
|
|
|
|
|
|
|
#include <QIcon>
|
|
|
|
|
|
2013-04-25 16:02:17 +02:00
|
|
|
namespace Ios {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
IosDeviceFactory::IosDeviceFactory()
|
2018-10-04 19:08:16 +02:00
|
|
|
: ProjectExplorer::IDeviceFactory(Constants::IOS_DEVICE_ID)
|
2013-04-25 16:02:17 +02:00
|
|
|
{
|
|
|
|
|
setObjectName(QLatin1String("IosDeviceFactory"));
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-04 19:08:16 +02:00
|
|
|
QString IosDeviceFactory::displayName() const
|
2013-04-25 16:02:17 +02:00
|
|
|
{
|
2018-10-04 19:08:16 +02:00
|
|
|
return IosDevice::name();
|
2013-04-25 16:02:17 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-04 19:08:16 +02:00
|
|
|
QIcon IosDeviceFactory::icon() const
|
2013-04-25 16:02:17 +02:00
|
|
|
{
|
2016-11-12 04:16:59 +01:00
|
|
|
using namespace Utils;
|
|
|
|
|
static const QIcon icon =
|
|
|
|
|
Icon::combinedIcon({Icon({{":/ios/images/iosdevicesmall.png",
|
|
|
|
|
Theme::PanelTextColorDark}}, Icon::Tint),
|
|
|
|
|
Icon({{":/ios/images/iosdevice.png",
|
|
|
|
|
Theme::IconsBaseColor}})});
|
|
|
|
|
return icon;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-25 16:02:17 +02:00
|
|
|
bool IosDeviceFactory::canCreate() const
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-04 19:08:16 +02:00
|
|
|
ProjectExplorer::IDevice::Ptr IosDeviceFactory::create() const
|
2013-04-25 16:02:17 +02:00
|
|
|
{
|
|
|
|
|
return ProjectExplorer::IDevice::Ptr();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IosDeviceFactory::canRestore(const QVariantMap &map) const
|
|
|
|
|
{
|
2014-02-25 22:20:16 +01:00
|
|
|
QVariantMap vMap = map.value(QLatin1String(Constants::EXTRA_INFO_KEY)).toMap();
|
|
|
|
|
if (vMap.isEmpty()
|
|
|
|
|
|| vMap.value(QLatin1String("deviceName")).toString() == QLatin1String("*unknown*"))
|
|
|
|
|
return false; // transient device (probably generated during an activation)
|
|
|
|
|
return true;
|
2013-04-25 16:02:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::IDevice::Ptr IosDeviceFactory::restore(const QVariantMap &map) const
|
|
|
|
|
{
|
|
|
|
|
IosDevice *newDev = new IosDevice;
|
|
|
|
|
newDev->fromMap(map);
|
|
|
|
|
// updating the active ones should be enough...
|
|
|
|
|
//IosDeviceManager::instance()->updateInfo(newDev->uniqueDeviceID());
|
|
|
|
|
return ProjectExplorer::IDevice::Ptr(newDev);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Ios
|