Subject: [media-types] registering vnd.qt.*qml types

From: Mohamed Fawzi <[email-masked]>
Date: Tue, 29 Jan 2013 14:15:19 +0000

Hi,

after some discussion on the [email-masked]<mailto:[email-masked]> mailing list we
http://qt-project.org/ decided to register some qml
http://qt-project.org/wiki/Introduction_to_Qt_Quick types in the vendor tree.

Before heading to
http://www.iana.org/cgi-bin/mediatypes.pl
We wanted to post them here for review.

We would like to register

text/vnd.qt.qml => a file adhering to the QML grammar/syntax .qml suffix, subclass of text/plain; charset=utf-8

and as subclasses of that

  text/vnd.qt.qbs+qml => .qbs suffix
  text/vnd.qt.meta-info+qml => .qmltypes suffix
  text/vnd.qt.project+qml => .qmlproject suffix

I have also a patch for the free desktop shared-mime-info that reflects that change.
I am pasting it at the end of this email for reference.

Fawzi

======= diff of free desktop shared-mime-info ========
diff --git a/freedesktop.org.xml.in b/freedesktop.org.xml.in
index 3bb477e..ffe0410 100644
--- a/freedesktop.org.xml.in
+++ b/freedesktop.org.xml.in
@@ -1625,13 +1625,26 @@ command to generate the output files.
     </magic>
     <glob pattern="*.ui"/>
   </mime-type>
-  <mime-type type="text/x-qml">
+  <mime-type type="text/vnd.qt.qml">
     <_comment>Qt Markup Language file</_comment>
-    <magic priority="80">
-      <match type="string" value="import Qt " offset="0:256"/>
-    </magic>
+    <sub-class-of type="text/plain; charset=utf-8"/>
     <glob pattern="*.qml"/>
   </mime-type>
+  <mime-type type="text/vnd.qt.qbs+qml">
+    <_comment>Qt Build Suite file</_comment>
+    <sub-class-of type="text/vnd.qt.qml"/>
+    <glob pattern="*.qbs"/>
+  </mime-type>
+  <mime-type type="text/vnd.qt.meta-info+qml">
+    <_comment>File describing qml type information</_comment>
+    <sub-class-of type="text/vnd.qt.qml"/>
+    <glob pattern="*.qmltypes"/>
+  </mime-type>
+  <mime-type type="text/vnd.qt.project+qml">
+    <_comment>Qt Creator Qt Quick UI project file</_comment>
+    <sub-class-of type="text/vnd.qt.qml"/>
+    <glob pattern="*.qmlproject"/>
+  </mime-type>
   <mime-type type="application/x-desktop">
     <_comment>desktop configuration file</_comment>
     <sub-class-of type="text/plain"/>
diff --git a/tests/helloworld.qbs b/tests/helloworld.qbs
new file mode 100644
index 0000000..05c8af1
--- /dev/null
+++ b/tests/helloworld.qbs
@@ -0,0 +1,9 @@
+import qbs 1.0
+
+Application {
+    name: "HelloWorld"
+    Depends { name: "cpp" }
+    files: [
+        "main.cpp"
+    ]
+}
diff --git a/tests/list b/tests/list
index 6af5885..c607a7e 100644
--- a/tests/list
+++ b/tests/list
@@ -248,8 +248,14 @@ ssh-public-key.txt text/plain
 test.vcf text/vcard
 # Test Go source code
 test.go text/x-go oxo
-# Qt Quick (QML) file
-rectangle.qml text/x-qml
+# Qt Markup Language file
+rectangle.qml text/vnd.qt.qml
+# Qt Build Suite file
+helloworld.qbs text/vnd.qt.qbs+qml
+# File describing qml type information
+plugin.qmltypes text/vnd.qt.meta-info+qml
+# Qt Creator Qt Quick UI project file
+main.qmlproject text/vnd.qt.project+qml
 # QtiPlot (qti) file
 test.qti application/x-qtiplot
 # Scheme source code
diff --git a/tests/main.qmlproject b/tests/main.qmlproject
new file mode 100644
index 0000000..4d32f75
--- /dev/null
+++ b/tests/main.qmlproject
@@ -0,0 +1,18 @@
+import QmlProject 1.1
+
+Project {
+    mainFile: "main.qml"
+
+    /* Include .qml, .js, and image files from current directory and subdirectories */
+    QmlFiles {
+        directory: "."
+    }
+    JavaScriptFiles {
+        directory: "."
+    }
+    ImageFiles {
+        directory: "."
+    }
+    /* List of plugin directories passed to QML runtime */
+    // importPaths: [ "../exampleplugin" ]
+}
diff --git a/tests/plugin.qmltypes b/tests/plugin.qmltypes
new file mode 100644
index 0000000..ff35e72
--- /dev/null
+++ b/tests/plugin.qmltypes
@@ -0,0 +1,25 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+
+Module {
+    Component {
+        name: "QDeclarative1AbstractAnimation"
+        prototype: "QObject"
+        exports: ["QtQuick/Animation 1.0"]
+        Enum {
+            name: "Loops"
+            values: {
+                "Infinite": -2
+            }
+        }
+        Property { name: "running"; type: "bool" }
+        Signal { name: "started" }
+        Signal {
+            name: "loopCountChanged"
+            Parameter { type: "int" }
+        }
+        Method { name: "complete" }
+    }
+}
diff --git a/tests/rectangle.qml b/tests/rectangle.qml
index 1635c1d..cc5d859 100644
--- a/tests/rectangle.qml
+++ b/tests/rectangle.qml
@@ -1,4 +1,5 @@
-import Qt 4.7
+import QtQuick 1.1
+
 Rectangle {
   width: 400; height: 200
   color: "lightblue"

---

From: Julian Reschke <[email-masked]>
Date: Tue, 29 Jan 2013 15:22:43 +0100

On 2013-01-29 15:15, Mohamed Fawzi wrote:
> Hi,
>
> after some discussion on the [email-masked]
> <mailto:[email-masked]> mailing list we
> text/vnd.qt.qml => a file adhering to the QML grammar/syntax .qml
> suffix, subclass of text/plain; charset=utf-8
>
> ...

Regarding the "+qml" suffix -- you should consult 
<http://tools.ietf.org/html/draft-ietf-appsawg-media-type-regs-14>. You 
will likely realize that the use of the "+" notation isn't justified in 
this case.

Best regards, Julian

---

From: Mohamed Fawzi <[email-masked]>
Date: Tue, 29 Jan 2013 14:43:40 +0000

On 29 Jan 2013, at 15:22, Julian Reschke <[email-masked]<mailto:[email-masked]>>
 wrote:

…

I have also a patch for the free desktop shared-mime-info that reflects
that change.
I am pasting it at the end of this email for reference.
…

Hi Julian thanks for the comment,

Regarding the "+qml" suffix -- you should consult <http://tools.ietf.org/html/draft-ietf-appsawg-media-type-regs-14>. You will likely realize that the use of the "+" notation isn't justified in this case.

Qml is actually a language with a well defined grammar
http://qt.gitorious.org/qt/qtdeclarative/blobs/stable/src/qml/qml/parser/qqmljs.g
that is basically an extended javascript syntax.

All those documents share that syntax (and parser).
So I thought it was ok to use +qml for them.

>From the document it seems that is allowed, you mean that it should not be done because
1) qml definition is not performed by a standard body, or similar
2) one should register also the base type without the qml syntax
3) not worth it/correct in the vmd tree or because it is the only syntax available for those documents
4)?

Best regards

Fawzi

---

From: Julian Reschke <[email-masked]>
Date: Tue, 29 Jan 2013 15:54:21 +0100

On 2013-01-29 15:43, Mohamed Fawzi wrote:
>> <http://tools.ietf.org/html/draft-ietf-appsawg-media-type-regs-14>.
>> You will likely realize that the use of the "+" notation isn't
>> justified in this case.
>

If you want to use the suffix, you'll have to register the base type 
first (I believe).

Best regards, Julian

---

From: Mohamed Fawzi <[email-masked]>
Date: Wed, 30 Jan 2013 13:11:01 +0000

On 29 Jan 2013, at 15:54, Julian Reschke <[email-masked]> wrote:

> If you want to use the suffix, you'll have to register the base type first (I believe).

looking at the just released documents by Björn Höhrmann it looks to me,
that the main problem is not that, but rather that I should formalise the +qml
suffix, probably with an RFC, to use it.

If that is the case would changing the +qml to -qml in the name be a good solution?

Fawzi

---

From: Tony Hansen <[email-masked]>
Date: Wed, 30 Jan 2013 09:17:52 -0500

On 1/30/2013 8:11 AM, Mohamed Fawzi wrote:
>>> On 29 Jan 2013, at 15:22, Julian Reschke <[email-masked]

draft-ietf-appsawg-media-type-regs was just published as RFC 6838; see 
it for how to register +qml.

See RFC 6839 (also just published) for example registrations. Work with 
Ned Freed if you choose to go this route -- he's the designated expert 
reviewer for suffix registrations.

Registering a suffix does not *require* an RFC: it can be attached to 
the media type registration form and done together.

     Tony Hansen