~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to src/plugins/qt4projectmanager/wizards/mobileapp.cpp

  • Committer: Timo Jyrinki
  • Date: 2013-12-02 09:16:15 UTC
  • mfrom: (1.1.29)
  • Revision ID: timo.jyrinki@canonical.com-20131202091615-xbj1os1f604ber1m
New upstream release candidate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/****************************************************************************
2
 
**
3
 
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4
 
** Contact: http://www.qt-project.org/legal
5
 
**
6
 
** This file is part of Qt Creator.
7
 
**
8
 
** Commercial License Usage
9
 
** Licensees holding valid commercial Qt licenses may use this file in
10
 
** accordance with the commercial license agreement provided with the
11
 
** Software or, alternatively, in accordance with the terms contained in
12
 
** a written agreement between you and Digia.  For licensing terms and
13
 
** conditions see http://qt.digia.com/licensing.  For further information
14
 
** use the contact form at http://qt.digia.com/contact-us.
15
 
**
16
 
** GNU Lesser General Public License Usage
17
 
** Alternatively, this file may be used under the terms of the GNU Lesser
18
 
** General Public License version 2.1 as published by the Free Software
19
 
** Foundation and appearing in the file LICENSE.LGPL included in the
20
 
** packaging of this file.  Please review the following information to
21
 
** ensure the GNU Lesser General Public License version 2.1 requirements
22
 
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23
 
**
24
 
** In addition, as a special exception, Digia gives you certain additional
25
 
** rights.  These rights are described in the Digia Qt LGPL Exception
26
 
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27
 
**
28
 
****************************************************************************/
29
 
 
30
 
#include "mobileapp.h"
31
 
 
32
 
#include <QTextStream>
33
 
 
34
 
namespace QmakeProjectManager {
35
 
namespace Internal {
36
 
 
37
 
const QString mainWindowBaseName(QLatin1String("mainwindow"));
38
 
 
39
 
const QString mainWindowCppFileName(mainWindowBaseName + QLatin1String(".cpp"));
40
 
const QString mainWindowHFileName(mainWindowBaseName + QLatin1String(".h"));
41
 
const QString mainWindowUiFileName(mainWindowBaseName + QLatin1String(".ui"));
42
 
 
43
 
 
44
 
bool MobileAppGeneratedFileInfo::isOutdated() const
45
 
{
46
 
    return version < AbstractMobileApp::makeStubVersion(MobileApp::StubVersion);
47
 
}
48
 
 
49
 
MobileApp::MobileApp() : AbstractMobileApp()
50
 
{
51
 
}
52
 
 
53
 
MobileApp::~MobileApp()
54
 
{
55
 
}
56
 
 
57
 
QString MobileApp::pathExtended(int fileType) const
58
 
{
59
 
    const QString pathBase = outputPathBase();
60
 
    switch (fileType) {
61
 
        case MainWindowCpp:       return pathBase + mainWindowCppFileName;
62
 
        case MainWindowCppOrigin: return originsRoot() + mainWindowCppFileName;
63
 
        case MainWindowH:         return pathBase + mainWindowHFileName;
64
 
        case MainWindowHOrigin:   return originsRoot() + mainWindowHFileName;
65
 
        case MainWindowUi:        return pathBase + mainWindowUiFileName;
66
 
        case MainWindowUiOrigin:  return originsRoot() + mainWindowUiFileName;
67
 
        default:                  qFatal("MobileApp::path() needs more work");
68
 
    }
69
 
    return QString();
70
 
}
71
 
 
72
 
bool MobileApp::adaptCurrentMainCppTemplateLine(QString &line) const
73
 
{
74
 
    Q_UNUSED(line);
75
 
    return true;
76
 
}
77
 
 
78
 
void MobileApp::handleCurrentProFileTemplateLine(const QString &line,
79
 
    QTextStream &proFileTemplate, QTextStream &proFile,
80
 
    bool &commentOutNextLine) const
81
 
{
82
 
    Q_UNUSED(line);
83
 
    Q_UNUSED(proFileTemplate);
84
 
    Q_UNUSED(proFile);
85
 
    Q_UNUSED(commentOutNextLine);
86
 
}
87
 
 
88
 
Core::GeneratedFiles MobileApp::generateFiles(QString *errorMessage) const
89
 
{
90
 
    Core::GeneratedFiles files = AbstractMobileApp::generateFiles(errorMessage);
91
 
 
92
 
    files.append(file(generateFile(AbstractGeneratedFileInfo::DeploymentPriFile, errorMessage), path(DeploymentPri)));
93
 
    files.append(file(generateFile(MobileAppGeneratedFileInfo::MainWindowCppFile, errorMessage), path(MainWindowCpp)));
94
 
    files.append(file(generateFile(MobileAppGeneratedFileInfo::MainWindowHFile, errorMessage), path(MainWindowH)));
95
 
    files.append(file(generateFile(MobileAppGeneratedFileInfo::MainWindowUiFile, errorMessage), path(MainWindowUi)));
96
 
    files.last().setAttributes(Core::GeneratedFile::OpenEditorAttribute);
97
 
 
98
 
    return files;
99
 
}
100
 
 
101
 
QByteArray MobileApp::generateFileExtended(int fileType,
102
 
    bool *versionAndCheckSum, QString *comment, QString *errorMessage) const
103
 
{
104
 
    Q_UNUSED(comment);
105
 
    QByteArray data;
106
 
    *versionAndCheckSum = false;
107
 
    switch (fileType) {
108
 
        case MobileAppGeneratedFileInfo::MainWindowCppFile:
109
 
            data = readBlob(path(MainWindowCppOrigin), errorMessage);
110
 
            break;
111
 
        case MobileAppGeneratedFileInfo::MainWindowHFile:
112
 
            data = readBlob(path(MainWindowHOrigin), errorMessage);
113
 
            break;
114
 
        case MobileAppGeneratedFileInfo::MainWindowUiFile:
115
 
            data = readBlob(path(MainWindowUiOrigin), errorMessage);
116
 
            break;
117
 
        default:
118
 
            Q_ASSERT_X(false, Q_FUNC_INFO, "Whoops, case missing!");
119
 
    }
120
 
    return data;
121
 
}
122
 
 
123
 
QString MobileApp::originsRoot() const
124
 
{
125
 
    return templatesRoot() + QLatin1String("mobileapp/");
126
 
}
127
 
 
128
 
QString MobileApp::mainWindowClassName() const
129
 
{
130
 
    return QLatin1String("MainWindow");
131
 
}
132
 
 
133
 
int MobileApp::stubVersionMinor() const { return StubVersion; }
134
 
 
135
 
QList<AbstractGeneratedFileInfo> MobileApp::updateableFiles(const QString &mainProFile) const
136
 
{
137
 
    Q_UNUSED(mainProFile)
138
 
    return QList<AbstractGeneratedFileInfo>(); // Nothing to update, here
139
 
}
140
 
 
141
 
QList<DeploymentFolder> MobileApp::deploymentFolders() const
142
 
{
143
 
    QList<DeploymentFolder> result;
144
 
    return result;
145
 
}
146
 
 
147
 
const int MobileApp::StubVersion = 2;
148
 
 
149
 
} // namespace Internal
150
 
} // namespace QmakeProjectManager