Make a pro file based project out of the photoviewer example
authorNiels Weber <niels.weber@digia.com>
Mon, 12 May 2014 11:27:24 +0000 (13:27 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 21 May 2014 09:57:21 +0000 (11:57 +0200)
Having a .pro file project is necessary to be able to deploy to
Android. Further patches for Android support will be needed, but
this is the base.

Task-number: QTBUG-38122
Change-Id: I878ec1df50d7375ae9153f8a34f763b5678d7774
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Reviewed-by: Sami Makkonen <sami.makkonen@digia.com>
Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
12 files changed:
examples/quick/demos/photoviewer/PhotoViewerCore/qmldir [deleted file]
examples/quick/demos/photoviewer/deployment.pri [new file with mode: 0644]
examples/quick/demos/photoviewer/i18n/base.ts [deleted file]
examples/quick/demos/photoviewer/i18n/qml_de.qm [new file with mode: 0644]
examples/quick/demos/photoviewer/i18n/qml_de.ts [new file with mode: 0644]
examples/quick/demos/photoviewer/i18n/qml_fr.qm
examples/quick/demos/photoviewer/i18n/qml_fr.ts
examples/quick/demos/photoviewer/main.cpp [new file with mode: 0644]
examples/quick/demos/photoviewer/main.qml [moved from examples/quick/demos/photoviewer/photoviewer.qml with 96% similarity]
examples/quick/demos/photoviewer/photoviewer.pro [new file with mode: 0644]
examples/quick/demos/photoviewer/photoviewer.qmlproject [deleted file]
examples/quick/demos/photoviewer/qml.qrc [new file with mode: 0644]

diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/qmldir b/examples/quick/demos/photoviewer/PhotoViewerCore/qmldir
deleted file mode 100644 (file)
index d3c247f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-AlbumDelegate AlbumDelegate.qml
-PhotoDelegate PhotoDelegate.qml
-ProgressBar ProgressBar.qml
-RssModel RssModel.qml
-BusyIndicator BusyIndicator.qml
-EditableButton EditableButton.qml
-Button Button.qml
-Tag Tag.qml
diff --git a/examples/quick/demos/photoviewer/deployment.pri b/examples/quick/demos/photoviewer/deployment.pri
new file mode 100644 (file)
index 0000000..839b3b5
--- /dev/null
@@ -0,0 +1,23 @@
+android-no-sdk {
+    target.path = /data/user/qt
+    export(target.path)
+    INSTALLS += target
+} else:android {
+    x86 {
+        target.path = /libs/x86
+    } else: armeabi-v7a {
+        target.path = /libs/armeabi-v7a
+    } else {
+        target.path = /libs/armeabi
+    }
+    export(target.path)
+    INSTALLS += target
+} else:unix {
+    isEmpty(target.path) {
+        target.path = /opt/$${TARGET}/bin
+        export(target.path)
+    }
+    INSTALLS += target
+}
+
+export(INSTALLS)
diff --git a/examples/quick/demos/photoviewer/i18n/base.ts b/examples/quick/demos/photoviewer/i18n/base.ts
deleted file mode 100644 (file)
index 1accfd2..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.0">
-<context>
-    <name>AlbumDelegate</name>
-    <message>
-        <location filename="../PhotoViewerCore/AlbumDelegate.qml" line="59"/>
-        <source>Remove</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
-    <name>photoviewer</name>
-    <message>
-        <location filename="../photoviewer.qml" line="30"/>
-        <source>Add</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../photoviewer.qml" line="39"/>
-        <source>Edit</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../photoviewer.qml" line="52"/>
-        <source>Back</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-</TS>
diff --git a/examples/quick/demos/photoviewer/i18n/qml_de.qm b/examples/quick/demos/photoviewer/i18n/qml_de.qm
new file mode 100644 (file)
index 0000000..8186e73
Binary files /dev/null and b/examples/quick/demos/photoviewer/i18n/qml_de.qm differ
diff --git a/examples/quick/demos/photoviewer/i18n/qml_de.ts b/examples/quick/demos/photoviewer/i18n/qml_de.ts
new file mode 100644 (file)
index 0000000..92ab50a
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="de_DE">
+<context>
+    <name>AlbumDelegate</name>
+    <message>
+        <location filename="../PhotoViewerCore/AlbumDelegate.qml" line="102"/>
+        <source>Remove</source>
+        <translation>Entfernen</translation>
+    </message>
+</context>
+<context>
+    <name>main</name>
+    <message>
+        <location filename="../main.qml" line="75"/>
+        <source>Add</source>
+        <translation>Zufügen</translation>
+    </message>
+    <message>
+        <location filename="../main.qml" line="84"/>
+        <source>Edit</source>
+        <translation>Bearbeiten</translation>
+    </message>
+    <message>
+        <location filename="../main.qml" line="89"/>
+        <source>Quit</source>
+        <translation>Verlassen</translation>
+    </message>
+    <message>
+        <location filename="../main.qml" line="102"/>
+        <source>Back</source>
+        <translation>Zurück</translation>
+    </message>
+</context>
+</TS>
index c24fcbc..e4257d4 100644 (file)
Binary files a/examples/quick/demos/photoviewer/i18n/qml_fr.qm and b/examples/quick/demos/photoviewer/i18n/qml_fr.qm differ
index 9f892db..1edb5e0 100644 (file)
@@ -1,28 +1,33 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
-<TS version="2.0" language="fr_FR">
+<TS version="2.1" language="fr_FR">
 <context>
     <name>AlbumDelegate</name>
     <message>
-        <location filename="../PhotoViewerCore/AlbumDelegate.qml" line="59"/>
+        <location filename="../PhotoViewerCore/AlbumDelegate.qml" line="102"/>
         <source>Remove</source>
         <translation>Supprimer</translation>
     </message>
 </context>
 <context>
-    <name>photoviewer</name>
+    <name>main</name>
     <message>
-        <location filename="../photoviewer.qml" line="30"/>
+        <location filename="../main.qml" line="75"/>
         <source>Add</source>
         <translation>Ajouter</translation>
     </message>
     <message>
-        <location filename="../photoviewer.qml" line="39"/>
+        <location filename="../main.qml" line="84"/>
         <source>Edit</source>
         <translation>Éditer</translation>
     </message>
     <message>
-        <location filename="../photoviewer.qml" line="52"/>
+        <location filename="../main.qml" line="89"/>
+        <source>Quit</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../main.qml" line="102"/>
         <source>Back</source>
         <translation>Retour</translation>
     </message>
diff --git a/examples/quick/demos/photoviewer/main.cpp b/examples/quick/demos/photoviewer/main.cpp
new file mode 100644 (file)
index 0000000..6ce7c1c
--- /dev/null
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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
+** a written agreement between you and Digia.  For licensing terms and
+** conditions see http://qt.digia.com/licensing.  For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights.  These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QQmlApplicationEngine>
+#include <QTranslator>
+#include <QDebug>
+
+int main(int argc, char *argv[])
+{
+    QApplication app(argc, argv);
+
+    QTranslator qtTranslator;
+    qtTranslator.load("qml_" + QLocale::system().name(), ":/i18n/");
+    app.installTranslator(&qtTranslator);
+
+    QQmlApplicationEngine engine;
+    engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
+
+    return app.exec();
+}
similarity index 96%
rename from examples/quick/demos/photoviewer/photoviewer.qml
rename to examples/quick/demos/photoviewer/main.qml
index df344ac..f443b70 100644 (file)
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtQml module of the Qt Toolkit.
 **
 ****************************************************************************/
 
-import QtQuick 2.0
+import QtQuick 2.2
+import QtQuick.Controls 1.1
 import QtQml.Models 2.1
 import "PhotoViewerCore"
 
-Rectangle {
+ApplicationWindow {
     id: mainWindow
 
+    visible: true
+
     property real downloadProgress: 0
     property bool imageLoading: false
     property bool editMode: false
diff --git a/examples/quick/demos/photoviewer/photoviewer.pro b/examples/quick/demos/photoviewer/photoviewer.pro
new file mode 100644 (file)
index 0000000..704e2ce
--- /dev/null
@@ -0,0 +1,22 @@
+TEMPLATE = app
+
+QT += qml quick widgets xmlpatterns
+
+SOURCES += main.cpp
+
+lupdate_only{
+SOURCES = *.qml \
+          PhotoViewerCore/*.qml \
+          PhotoViewerCore/script/*.js
+}
+
+TRANSLATIONS += i18n/qml_fr.ts \
+                i18n/qml_de.ts
+
+RESOURCES += qml.qrc
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH =
+
+# Default rules for deployment.
+include(deployment.pri)
diff --git a/examples/quick/demos/photoviewer/photoviewer.qmlproject b/examples/quick/demos/photoviewer/photoviewer.qmlproject
deleted file mode 100644 (file)
index 600bdb1..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-import QmlProject 1.1
-
-Project {
-    mainFile: "photoviewer.qml"
-
-    /* Include .qml, .js, and image files from current directory and subdirectories */
-    QmlFiles {
-        directory: "."
-    }
-    JavaScriptFiles {
-        directory: "."
-    }
-    ImageFiles {
-        directory: "."
-    }
-    Files {
-        filter: "*.ts"
-        directory: "i18n"
-    }
-}
diff --git a/examples/quick/demos/photoviewer/qml.qrc b/examples/quick/demos/photoviewer/qml.qrc
new file mode 100644 (file)
index 0000000..8abefc6
--- /dev/null
@@ -0,0 +1,19 @@
+<RCC>
+    <qresource prefix="/">
+        <file>main.qml</file>
+        <file>PhotoViewerCore/AlbumDelegate.qml</file>
+        <file>PhotoViewerCore/BusyIndicator.qml</file>
+        <file>PhotoViewerCore/Button.qml</file>
+        <file>PhotoViewerCore/EditableButton.qml</file>
+        <file>PhotoViewerCore/PhotoDelegate.qml</file>
+        <file>PhotoViewerCore/ProgressBar.qml</file>
+        <file>PhotoViewerCore/RssModel.qml</file>
+        <file>PhotoViewerCore/Tag.qml</file>
+        <file>PhotoViewerCore/images/box-shadow.png</file>
+        <file>PhotoViewerCore/images/busy.png</file>
+        <file>PhotoViewerCore/images/cardboard.png</file>
+        <file>PhotoViewerCore/script/script.js</file>
+        <file>i18n/qml_fr.qm</file>
+        <file>i18n/qml_de.qm</file>
+    </qresource>
+</RCC>