~ubuntu-sdk-team/qtcreator-plugin-remotelinux/trunk

« back to all changes in this revision

Viewing changes to src/qnx/blackberryruntimeconfiguration.cpp

  • Committer: CI bot
  • Author(s): Benjamin Zeller
  • Date: 2014-06-16 10:28:43 UTC
  • mfrom: (4.2.4 remotelinux)
  • Revision ID: ps-jenkins@lists.canonical.com-20140616102843-8juvmjvzwlzsboyw
Migrating to Qt5.3 and QtC 3.1 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************************
 
2
**
 
3
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
 
4
**
 
5
** Contact: BlackBerry (qt@blackberry.com)
 
6
** Contact: KDAB (info@kdab.com)
 
7
**
 
8
** This file is part of Qt Creator.
 
9
**
 
10
** Commercial License Usage
 
11
** Licensees holding valid commercial Qt licenses may use this file in
 
12
** accordance with the commercial license agreement provided with the
 
13
** Software or, alternatively, in accordance with the terms contained in
 
14
** a written agreement between you and Digia.  For licensing terms and
 
15
** conditions see http://qt.digia.com/licensing.  For further information
 
16
** use the contact form at http://qt.digia.com/contact-us.
 
17
**
 
18
** GNU Lesser General Public License Usage
 
19
** Alternatively, this file may be used under the terms of the GNU Lesser
 
20
** General Public License version 2.1 as published by the Free Software
 
21
** Foundation and appearing in the file LICENSE.LGPL included in the
 
22
** packaging of this file.  Please review the following information to
 
23
** ensure the GNU Lesser General Public License version 2.1 requirements
 
24
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 
25
**
 
26
** In addition, as a special exception, Digia gives you certain additional
 
27
** rights.  These rights are described in the Digia Qt LGPL Exception
 
28
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 
29
**
 
30
****************************************************************************/
 
31
 
 
32
#include "blackberryruntimeconfiguration.h"
 
33
 
 
34
#include "qnxconstants.h"
 
35
 
 
36
#include <QVariantMap>
 
37
#include <QFileInfo>
 
38
#include <QCoreApplication>
 
39
 
 
40
namespace Qnx {
 
41
namespace Internal {
 
42
 
 
43
const QLatin1String PathKey("Path");
 
44
const QLatin1String DisplayNameKey("DisplayName");
 
45
const QLatin1String VersionKey("Version");
 
46
 
 
47
BlackBerryRuntimeConfiguration::BlackBerryRuntimeConfiguration(
 
48
        const QString &path,
 
49
        const BlackBerryVersionNumber &version)
 
50
    : m_path(path)
 
51
{
 
52
    if (!version.isEmpty())
 
53
        m_version = version;
 
54
    else
 
55
        m_version = BlackBerryVersionNumber::fromFileName(QFileInfo(path).baseName(),
 
56
                                                          QRegExp(QLatin1String("^runtime_(.*)$")));
 
57
 
 
58
    m_displayName = QCoreApplication::translate("Qnx::Internal::BlackBerryRuntimeConfiguration", "Runtime %1").arg(m_version.toString());
 
59
}
 
60
 
 
61
BlackBerryRuntimeConfiguration::BlackBerryRuntimeConfiguration(const QVariantMap &data)
 
62
{
 
63
    m_path = data.value(QLatin1String(PathKey)).toString();
 
64
    m_displayName = data.value(QLatin1String(DisplayNameKey)).toString();
 
65
    m_version = BlackBerryVersionNumber(data.value(QLatin1String(VersionKey)).toString());
 
66
}
 
67
 
 
68
QString BlackBerryRuntimeConfiguration::path() const
 
69
{
 
70
    return m_path;
 
71
}
 
72
 
 
73
QString BlackBerryRuntimeConfiguration::displayName() const
 
74
{
 
75
    return m_displayName;
 
76
}
 
77
 
 
78
BlackBerryVersionNumber BlackBerryRuntimeConfiguration::version() const
 
79
{
 
80
    return m_version;
 
81
}
 
82
 
 
83
QVariantMap BlackBerryRuntimeConfiguration::toMap() const
 
84
{
 
85
    QVariantMap data;
 
86
    data.insert(QLatin1String(Qnx::Constants::QNX_BB_KEY_CONFIGURATION_TYPE),
 
87
                QLatin1String(Qnx::Constants::QNX_BB_RUNTIME_TYPE));
 
88
    data.insert(QLatin1String(PathKey), m_path);
 
89
    data.insert(QLatin1String(DisplayNameKey), m_displayName);
 
90
    data.insert(QLatin1String(VersionKey), m_version.toString());
 
91
    return data;
 
92
}
 
93
 
 
94
}
 
95
}