summaryrefslogtreecommitdiffstats
path: root/tools/qml
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qml')
-rw-r--r--tools/qml/Info_mac.plist16
-rw-r--r--tools/qml/content/Browser.qml4
-rw-r--r--tools/qml/deviceorientation_maemo.cpp13
-rw-r--r--tools/qml/main.cpp35
-rw-r--r--tools/qml/qml.pro4
-rw-r--r--tools/qml/qmlruntime.cpp5
-rw-r--r--tools/qml/qmlruntime.h1
7 files changed, 63 insertions, 15 deletions
diff --git a/tools/qml/Info_mac.plist b/tools/qml/Info_mac.plist
new file mode 100644
index 0000000..ce4ebe3
--- /dev/null
+++ b/tools/qml/Info_mac.plist
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.1">
+<dict>
+ <key>CFBundleIdentifier</key>
+ <string>com.nokia.qt.qml</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Created by Qt/QMake</string>
+ <key>CFBundleSignature</key>
+ <string>@TYPEINFO@</string>
+ <key>CFBundleExecutable</key>
+ <string>@EXECUTABLE@</string>
+</dict>
+</plist>
diff --git a/tools/qml/content/Browser.qml b/tools/qml/content/Browser.qml
index 391ded8..8882d5a 100644
--- a/tools/qml/content/Browser.qml
+++ b/tools/qml/content/Browser.qml
@@ -3,8 +3,8 @@ import Qt 4.6
Rectangle {
id: root
property bool keyPressed: false
- property var folders: folders1
- property var view: view1
+ property variant folders: folders1
+ property variant view: view1
width: 320
height: 480
color: palette.window
diff --git a/tools/qml/deviceorientation_maemo.cpp b/tools/qml/deviceorientation_maemo.cpp
index fa2c6e5..9f12f3d 100644
--- a/tools/qml/deviceorientation_maemo.cpp
+++ b/tools/qml/deviceorientation_maemo.cpp
@@ -50,6 +50,10 @@ public:
MaemoOrientation()
: DeviceOrientation(),m_current(Portrait), m_lastSeen(Portrait), m_lastSeenCount(0)
{
+ m_current = get();
+ if (m_current == UnknownOrientation)
+ m_current = Portrait;
+
startTimer(100);
}
@@ -57,14 +61,7 @@ public:
return m_current;
}
- void setOrientation(Orientation orient) {
- //XXX maybe better to just ignore
- if (orient != m_current) {
- m_current = orient;
- emit orientationChanged();
- }
- }
-
+ void setOrientation(Orientation) { }
protected:
virtual void timerEvent(QTimerEvent *)
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 5099e49..01b3912 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -101,8 +101,9 @@ void usage()
qWarning(" -dragthreshold <size> .................... set mouse drag threshold size");
qWarning(" -netcache <size> ......................... set disk cache to size bytes");
qWarning(" -translation <translationfile> ........... set the language to run in");
- qWarning(" -L <directory> ........................... prepend to the library search path,");
+ qWarning(" -I <directory> ........................... prepend to the module import search path,");
qWarning(" display path if <directory> is empty");
+ qWarning(" -P <directory> ........................... prepend to the plugin search path");
qWarning(" -opengl .................................. use a QGLWidget for the viewport");
qWarning(" -script <path> ........................... set the script to use");
qWarning(" -scriptopts <options>|help ............... set the script options to use");
@@ -167,7 +168,8 @@ int main(int argc, char ** argv)
QString dither = "none";
QString recordfile;
QStringList recordargs;
- QStringList libraries;
+ QStringList imports;
+ QStringList plugins;
QString skin;
QString script;
QString scriptopts;
@@ -239,14 +241,19 @@ int main(int argc, char ** argv)
useGL = true;
} else if (arg == "-qmlbrowser") {
useNativeFileBrowser = false;
- } else if (arg == "-L") {
+ } else if (arg == "-I" || arg == "-L") {
+ if (arg == "-L")
+ fprintf(stderr, "-L option provided for compatibility only, use -I instead");
if (lastArg) {
QDeclarativeEngine tmpEngine;
QString paths = tmpEngine.importPathList().join(QLatin1String(":"));
fprintf(stderr, "Current search path: %s\n", paths.toLocal8Bit().constData());
return 0;
}
- libraries << QString(argv[++i]);
+ imports << QString(argv[++i]);
+ } else if (arg == "-P") {
+ if (lastArg) usage();
+ plugins << QString(argv[++i]);
} else if (arg == "-script") {
if (lastArg) usage();
script = QString(argv[++i]);
@@ -320,9 +327,12 @@ int main(int argc, char ** argv)
viewer.addLibraryPath(QCoreApplication::applicationDirPath());
- foreach (QString lib, libraries)
+ foreach (QString lib, imports)
viewer.addLibraryPath(lib);
+ foreach (QString plugin, plugins)
+ viewer.addPluginPath(plugin);
+
viewer.setNetworkCacheSize(cache);
viewer.setRecordFile(recordfile);
if (resizeview)
@@ -349,6 +359,21 @@ int main(int argc, char ** argv)
viewer.setUseNativeFileBrowser(useNativeFileBrowser);
if (fullScreen && maximized)
qWarning() << "Both -fullscreen and -maximized specified. Using -fullscreen.";
+
+ if (fileName.isEmpty()) {
+ QFile qmlapp(QLatin1String("qmlapp"));
+ if (qmlapp.exists() && qmlapp.open(QFile::ReadOnly)) {
+ QString content = QString::fromUtf8(qmlapp.readAll());
+ qmlapp.close();
+
+ int newline = content.indexOf(QLatin1Char('\n'));
+ if (newline >= 0)
+ fileName = content.left(newline);
+ else
+ fileName = content;
+ }
+ }
+
if (!fileName.isEmpty()) {
viewer.open(fileName);
fullScreen ? viewer.showFullScreen() : maximized ? viewer.showMaximized() : viewer.show();
diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro
index ba283b6..13b01f2 100644
--- a/tools/qml/qml.pro
+++ b/tools/qml/qml.pro
@@ -58,3 +58,7 @@ symbian {
LIBS += -lesock -lcommdb -lconnmon -linsock
TARGET.CAPABILITY = "All -TCB"
}
+mac {
+ QMAKE_INFO_PLIST=Info_mac.plist
+ TARGET=Qml
+}
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index 1ab528e..c4ebd80 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -870,6 +870,11 @@ void QDeclarativeViewer::addLibraryPath(const QString& lib)
canvas->engine()->addImportPath(lib);
}
+void QDeclarativeViewer::addPluginPath(const QString& plugin)
+{
+ canvas->engine()->addPluginPath(plugin);
+}
+
void QDeclarativeViewer::reload()
{
openQml(currentFileOrUrl);
diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h
index 01777bd..6f1e425 100644
--- a/tools/qml/qmlruntime.h
+++ b/tools/qml/qmlruntime.h
@@ -96,6 +96,7 @@ public:
void setDeviceKeys(bool);
void setNetworkCacheSize(int size);
void addLibraryPath(const QString& lib);
+ void addPluginPath(const QString& plugin);
void setUseGL(bool use);
void setUseNativeFileBrowser(bool);