~ubuntu-branches/ubuntu/utopic/ubuntu-html5-theme/utopic

« back to all changes in this revision

Viewing changes to src/ubuntu-html5-app-launcher/main.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Alexandre Abreu, Robert Bruce Park, David Barth
  • Date: 2014-02-12 21:47:19 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20140212214719-gtuxobx1jdwlwdr7
Tags: 0.1.2+14.04.20140212.4-0ubuntu1
[ Alexandre Abreu ]
* Fix gallery app (needs more fixing though) and update the css to be
  closer to qml

[ Robert Bruce Park ]
* Make -sdk depend on qtdeclarative5-ubuntu-webapps-api.
* Add python-xlib dependency which is required for AP tests to pass.

[ David Barth ]
* Set the plugin-path to load the pre-built cordova runtime

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
             << qgetenv("QML2_IMPORT_PATH").data();
63
63
}
64
64
 
 
65
QString pluginPathForCurrentArchitecture()
 
66
{
 
67
#if defined(__i386__)
 
68
    return QLatin1String("/lib/i386-linux-gnu");
 
69
#elif defined(__x86_64__)
 
70
    return QLatin1String("/lib/x86_64-linux-gnu");
 
71
#elif defined(__arm__)
 
72
    return QLatin1String("/lib/arm-linux-gnueabihf");
 
73
#else
 
74
#error Unable to determine target architecture
 
75
#endif
 
76
}
 
77
 
 
78
 
65
79
void usage()
66
80
{
67
81
    QTextStream out(stdout);
137
151
 
138
152
    if (wwwfolderArg.isEmpty())
139
153
    {
140
 
        qCritical() << "No (or empty) WWW folder path specified";
141
 
        usage();
142
 
        return EXIT_FAILURE;
 
154
        wwwfolderArg = QDir::currentPath();
 
155
        qDebug() << "No (or empty) WWW folder path specified." << endl
 
156
                 << "Defaulting to the current directory:" << wwwfolderArg;
143
157
    }
144
158
 
145
159
    QFileInfo wwwFolder(wwwfolderArg);
 
160
 
146
161
    if (wwwFolder.isRelative())
147
162
    {
148
163
        wwwFolder.makeAbsolute();
149
164
    }
 
165
 
150
166
    if (!wwwFolder.exists() || !wwwFolder.isDir())
151
167
    {
152
168
        qCritical() << "WWW folder not found or not a proper directory: "
154
170
        return EXIT_FAILURE;
155
171
    }
156
172
 
 
173
    // set the current directory to the project/application folder
 
174
    // to help use relative paths for the embedded js components as well
 
175
    QDir::setCurrent(wwwFolder.absoluteFilePath());
 
176
 
157
177
    // Ensure that application-specific data is written where it ought to.
158
178
    if (qgetenv("APP_ID").data() != NULL)
159
179
    {
163
183
 
164
184
    setUpQmlImportPathIfNecessary(wwwFolder.canonicalFilePath());
165
185
 
 
186
    QString plugin_path = wwwFolder.absoluteFilePath() +
 
187
        pluginPathForCurrentArchitecture();
 
188
 
166
189
    QQuickView view;
 
190
    view.engine()->addPluginPath(plugin_path);    
167
191
    view.setSource(QUrl::fromLocalFile(Webapp::Config::getContainerMainQmlPath()
168
192
                                          + "/main.qml"));
169
193
    if (view.status() != QQuickView::Ready)