diff options
1355 files changed, 60123 insertions, 0 deletions
diff --git a/doc/src/diagrams/webkit-webplugin.png b/doc/src/diagrams/webkit-webplugin.png Binary files differnew file mode 100644 index 0000000..be17fae --- /dev/null +++ b/doc/src/diagrams/webkit-webplugin.png diff --git a/doc/src/examples/applicationicon.qdoc b/doc/src/examples/applicationicon.qdoc new file mode 100644 index 0000000..d03bf36 --- /dev/null +++ b/doc/src/examples/applicationicon.qdoc @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! \example widgets/applicationicon + \group all-examples + \title Application Icon Example + + The example shows how to add an application icon to a mobile application. + + \image appicon_screenshot.png The icon on a Nokia XPressMusic 5800 + + \section1 Creating an icon for Maemo + + Maemo expects the icon of an application to be a 64x64 PNG image file. The + file name of the icon should be the same as the executable with a \c .png + extension. You also need a \c .desktop file that gives the window manager + hints about the application, such as name, type and icon. + + \quotefile examples/widgets/applicationicon/applicationicon.desktop + + The \c Icon field should also contain the name of the executable. On the + device, application icons are stored in the + \c /usr/share/icons/hicolor/64x64/apps directory + and desktop files in the \c /usr/share/applications/hildon directory. + + \section1 Creating an icon for Symbian + + Symbian uses Scalable Vector Graphics (SVG Tiny 1.1+) to render + application icons in the application menu. Therefore icons could be + created manually with a text editor, since SVG files are plain text with + XML syntax, but usually you would use a vector graphics program that is + able to output SVG files. Popular graphics programs such as Adobe + Illustrator or Inkscape are able to do so. + + For best results, the icon should be created on a 44x44 pixel canvas. + Otherwise the image might be scaled in unexpected ways. + + Once you have created your icon, make sure that it is stored according to + the SVG-Tiny 1.1+ standard. Inkscape, for instance, is not able to save + images that way, but there are tools that can convert general SVG files + into the Tiny format. For instance, the svg2svgt tool that is bundled with + Symbian 3rd and 5th editon SDKs under the folder s60tools can do this + conversion to some extent. Another tool to convert SVG to SVG Tiny is SVG + Pony. + + \section1 Adding the icons to the project + + Edit the .pro file and specify the ICON variable for the symbian target. + For Maemo, we need to add that the \c .desktop and icon file should be + installed. + + \quotefile examples/widgets/applicationicon/applicationicon.pro + + Currently, Qt Creator doesn't include the icon and desktop files in the + application package for Maemo, merely the executable file is included. As a + workaround for this, the files can be added manually in the Projects tab. + In the "Create Package" build step for the Maemo target, the \c .desktop + file and icon can be added to be a part of the package contents. + Unfortunately, these additions are only stored as a part of the + \c .pro.user file. This issue will be resolved in a future release of + Qt Creator. + + \image appicon_packagecontents.png Manual addition of files to the "Create Package" build step +*/ diff --git a/doc/src/examples/cube.qdoc b/doc/src/examples/cube.qdoc new file mode 100644 index 0000000..0603941 --- /dev/null +++ b/doc/src/examples/cube.qdoc @@ -0,0 +1,178 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example opengl/cube + \group all-examples + \title Cube OpenGL ES 2.0 example + + The Cube OpenGL ES 2.0 example shows how to write mouse rotateable + textured 3D cube using OpenGL ES 2.0 with Qt. It shows how to handle + polygon geometries efficiently and how to write simple vertex and + fragment shader for programmable graphics pipeline. In addition it + shows how to use quaternions for representing 3D object orientation. + + This example has been written for OpenGL ES 2.0 but it works also on + desktop OpenGL because this example is simple enough and for the + most parts desktop OpenGL API is same. It compiles also without OpenGL + support but then it just shows a label stating that OpenGL support is + required. + + \image cube.png Screenshot of the Cube example running on N900 + + The example consist of two classes: + + \list + \o \c MainWidget extends QGLWidget and contains OpenGL ES 2.0 + initialization and drawing and mouse and timer event handling + \o \c GeometryEngine handles polygon geometries. Transfers polygon geometry + to vertex buffer objects and draws geometries from vertex buffer objects. + \endlist + + We'll start by initializing OpenGL ES 2.0 in \c MainWidget. + + \tableofcontents + + \section1 Initializing OpenGL ES 2.0 + + Since OpenGL ES 2.0 doesn't support fixed graphics pipeline anymore it has to + be implemented by ourselves. This makes graphics pipeline very flexible but + in the same time it becomes more difficult because user has to implement graphics + pipeline to get even the simplest example running. It also makes graphics pipeline + more efficient because user can decide what kind of pipeline is needed for the + application. + + First we have to implement vertex shader. It gets vertex data and + model-view-projection matrix (MVP) as parameters. It transforms vertex position + using MVP matrix to screen space and passes texture coordinate to + fragment shader. Texture coordinate will be automatically interpolated on polygon + faces. + + \snippet examples/opengl/cube/vshader.glsl 0 + + After that we need to implement second part of the graphics pipeline - fragment + shader. For this exercise we need to implement fragment shader that handles + texturing. It gets interpolated texture coordinate as a parameter and looks up + fragment color from the given texture. + + \snippet examples/opengl/cube/fshader.glsl 0 + + Using \c QGLShaderProgram we can compile, link and bind shader code to + graphics pipeline. This code uses Qt Resource files to access shader source code. + + \snippet examples/opengl/cube/mainwidget.cpp 3 + + The following code enables depth buffering and back face culling. + + \snippet examples/opengl/cube/mainwidget.cpp 2 + + \section1 Loading textures from Qt Resource files + + \c QGLWidget interface implements methods for loading textures from QImage to GL + texture memory. We still need to use OpenGL provided functions for specifying + the GL texture unit and configuring texture filtering options. + + \snippet examples/opengl/cube/mainwidget.cpp 4 + + \section1 Cube Geometry + + There are many ways to render polygons in OpenGL but the most efficient way is + to use only triangle strip primitives and render vertices from graphics hardware + memory. OpenGL has a mechanism to create buffer objects to this memory area and + transfer vertex data to these buffers. In OpenGL terminology these are referred + as Vertex Buffer Objects (VBO). + + \image cube_faces.png Cube faces and vertices + + This is how cube faces break down to triangles. Vertices are ordered this way + to get vertex ordering correct using triangle strips. OpenGL determines triangle + front and back face based on vertex ordering. By default OpenGL uses + counter-clockwise order for front faces. This information is used by back face + culling which improves rendering performance by not rendering back faces of the + triangles. This way graphics pipeline can omit rendering sides of the triangle that + aren't facing towards screen. + + Creating vertex buffer objects and transferring data to them is quite simple using + OpenGL provided functions. + + \snippet examples/opengl/cube/geometryengine.cpp 0 + + \snippet examples/opengl/cube/geometryengine.cpp 1 + + Drawing primitives from VBOs and telling programmable graphics pipeline how to + locate vertex data requires few steps. First we need to bind VBOs to be used. + After that we bind shader program attribute names and configure what + kind of data it has in the bound VBO. Finally we'll draw triangle + strip primitives using indices from the other VBO. + + \snippet examples/opengl/cube/geometryengine.cpp 2 + + \section1 Perspective projection + + Using \c QMatrix4x4 helper methods it's really easy to calculate perpective + projection matrix. This matrix is used to project vertices to screen space. + + \snippet examples/opengl/cube/mainwidget.cpp 5 + + \section1 Orientation of the 3D object + + Quaternions are handy way to represent orientation of the 3D object. Quaternions + involve quite complex mathematics but fortunately all the necessary mathematics + behind quaternions is implemented in \c QQuaternion. That allows us to store + cube orientation in quaternion and rotating cube around given axis is quite + simple. + + The following code calculates rotation axis and angular speed based on mouse events. + + \snippet examples/opengl/cube/mainwidget.cpp 0 + + \c QBasicTimer is used to animate scene and update cube orientation. Rotations + can be concatenated simply by multiplying quaternions. + + \snippet examples/opengl/cube/mainwidget.cpp 1 + + Model-view matrix is calculated using the quaternion and by moving world by Z axis. + This matrix is multiplied with the projection matrix to get MVP matrix for shader + program. + + \snippet examples/opengl/cube/mainwidget.cpp 6 + +*/ diff --git a/doc/src/examples/elidedlabel.qdoc b/doc/src/examples/elidedlabel.qdoc new file mode 100644 index 0000000..4c6e8e8 --- /dev/null +++ b/doc/src/examples/elidedlabel.qdoc @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example widgets/elidedlabel + \group all-examples + \title Elided Label Example + + This example creates a widget similar to QLabel, that elides the last + visible line, if the text is too long to fit the widget's geometry. + + \image elidedlabel-example.png Elided Label example on XPressMusic 5800 + + When text of varying length has to be displayed in a uniformly sized + area, for instance within a list or grid view where all list items have the + same size, it can be useful to give the user a visual clue when not all + text is visible. QLabel can elide text that doesn't fit within it, but only + in one line. The \c ElidedLabel widget shown in this example word wraps its + text by its width, and elides the last visible line if some text is left + out. \c TestWidget gives control to the features of \c ElidedWidget and + forms the example application. + + + \section1 ElidedLabel Class Definition + + Like QLabel, \c ElidedLabel inherits from QFrame. Here's the definition of + the \c ElidedLabel class: + + + \snippet examples/widgets/elidedlabel/elidedlabel.h 0 + + The \c isElided property depends the font, text content and geometry of the + widget. Whenever any of these change, the \c elisionChanged() signal might + trigger. We cache the current elision value in \c elided, so that it + doesn't have to be recomputed every time it's asked for. + + + \section1 ElidedLabel Class Implementation + + Except for initializing the member variables, the constructor sets the size + policy to be horizontally expanding, since it's meant to fill the width of + its container and grow vertically. + + \snippet examples/widgets/elidedlabel/elidedlabel.cpp 0 + + Changing the \c content require a repaint of the widget. + + \snippet examples/widgets/elidedlabel/elidedlabel.cpp 1 + + QTextLayout is used in the \c paintEvent() to divide the \c content into + lines, that wrap on word boundaries. Each line, except the last visible + one, is drawn \c lineSpacing pixels below the previous one. The \c draw() + method of QTextLine will draw the line using the coordinate point as the + top left corner. + + \snippet examples/widgets/elidedlabel/elidedlabel.cpp 2 + + Unfortunately, QTextLayout does not elide text, so the last visible line + has to be treated differently. This last line is elided if it is too wide. + The \c drawText() method of QPainter draws the text starting from the base + line, which is \c ascecnt() pixels below the last drawn line. + + Finally, one more line is created to see if everything fit on this line. + + \snippet examples/widgets/elidedlabel/elidedlabel.cpp 3 + + If the text was elided and wasn't before or vice versa, cache it in + \c elided and emit the change. + + \snippet examples/widgets/elidedlabel/elidedlabel.cpp 4 + + + \section1 TestWidget Class Definition + + \c TestWidget is a QWidget and is the main window of the example. It + contains an \c ElidedLabel which can be resized with two QSlider widgets. + + \snippet examples/widgets/elidedlabel/testwidget.h 0 + + \section1 TestWidget Class Implementation + + The constructor initializes the whole widget. Strings of different length + are stored in \c textSamples. The user is able to switch between these. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 0 + + An \c ElidedLabel is created to contain the first of the sample strings. + The frame is made visible to make it easier to see the actual size of the + widget. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 1 + + The buttons and the elision label are created. By connecting the + \c elisionChanged() signal to the \c setVisible() slot of the \c label, + it will act as an indicator to when the text is elided or not. This signal + could, for instance, be used to make a "More" button visible, or similar. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 2 + + The \c widthSlider and \c heightSlider specify the size of the + \c elidedText. Since the y-axis is inverted, the \c heightSlider has to be + inverted to act appropriately. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 3 + + The components are all stored in a QGridLayout, which is made the layout of + the \c TestWidget. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 4 + + On the Maemo platform, windows are stuck in landscape mode by default. With + this attribute set, the window manager is aware that this window can be + rotated. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 5 + + The \c widthSlider and \c heightSlider have the exact same length as the + dimensions of the \c elidedText. The maximum value for both of them is + thus their lengths, and each tick indicates one pixel. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 6 + + The \c switchText() slot simply cycles through all the available sample + texts. + + \snippet examples/widgets/elidedlabel/testwidget.cpp 7 + + These slots set the width and height of the \c elided text, in response to + changes in the sliders. + + \section1 The \c main() Function + + The \c main() function creates an instance of \c TestWidget fullscreen and + enters the message loop. + + \snippet examples/widgets/elidedlabel/main.cpp 0 +*/ + diff --git a/doc/src/examples/maemovibration.qdoc b/doc/src/examples/maemovibration.qdoc new file mode 100644 index 0000000..280dc30 --- /dev/null +++ b/doc/src/examples/maemovibration.qdoc @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example widgets/maemovibration + \group all-examples + \title Maemo Vibration Example + + The Maemo Vibration example shows how to tell the Maemo Mode Control Entity + (MCE) to vibrate a maemo device. + + The MCE is a system service on Maemo that, among other things, provides an + D-Bus interface to trigger vibrations. The vibrations are specified as + patterns and are defined in a system configuration file. + + The example program reads the configuration file to look for possible + vibration patterns and display a button for each. Pressing a button will + make the device vibrate accordingly, until the application closes, or + another pattern is started. + + \image maemovibration-example.png Screenshot of the Maemo Vibration Example + + The code makes use of two classes: + + \list + \o \c MceVibrator connects to the MCE service and can start a certain + vibrator pattern. It also is responsible to parse the configuration + file. + + \o \c ButtonWidget provides a button for each pattern. Pressing the button + activates the pattern in question. + \endlist + + + \section1 MceVibrator Class Definition + + \snippet examples/widgets/maemovibration/mcevibrator.h 0 + + The \c MceVibrator class inherits from QObject and provides a specialized + and Qt friendly interface to the MCE vibration facilty. The slot \c vibrate() + can be called to make the device vibrate according to a specific pattern + name. We will connect it to a signal of a \c ButtonWidget object later. The + static method \c ParsePatternNames() can be called to find out which patterns + are available to us. + + \list + \o \c mceInterface is our D-Bus handle to the MCE service. We use it to + invoke methods on the MCE request object. + + \o \c lastPatternName contains the pattern that was activated last time. We + have to keep track of this, because the last pattern has to be + deactivated before activating a new pattern. + \endlist + + + \section1 MceVibrator Class Implementation + + To connect to the service, we initialize the D-Bus interface handle. The + system header \c "mce/dbus-names.h" contains definitions of the D-Bus + service name and request object path and interface. These are passed to the + constructor of the handle, and Qt will automatically establish a connection + to it, if it is possible. + + The MCE expects us to first enable the vibrator before we can use it. This + is done with the call to the \c MCE_ENABLE_VIBRATOR D-Bus method. + + \snippet examples/widgets/maemovibration/mcevibrator.cpp 0 + + From now on we can activate vibration patterns. Each time a vibration + pattern is activated, the last pattern has to be deactivated first. In the + vibrate slot we use the MCE interface to call the activation method. + + \snippet examples/widgets/maemovibration/mcevibrator.cpp 1 + + The calls to the private method deactivate simply makes sure to deactivate + the last pattern used, if there was one. + + \snippet examples/widgets/maemovibration/mcevibrator.cpp 2 + + Calling either the activate or deactivate MCE D-Bus method with invalid + pattern names are ignored. + + Finally, the destructor disables the vibrator. When the destructor of the + MCE interface handle is called, the connection is also closed. + + \snippet examples/widgets/maemovibration/mcevibrator.cpp 3 + + The MCE configuration file contains options for many different things. We + are only interested in one line that contains the vibration patterns. It + has the following format: + + + \code + VibratorPatterns=semicolon;separated;list;of;values + \endcode + + The static method \c ParsePatternNames looks for this line and returns a + QStringList containing the values, which are the pattern names we can use. + + \snippet examples/widgets/maemovibration/mcevibrator.cpp 4 + + The helper function \c checkError() saves us some code duplication. None of the + called methods return anything of use to us, so we're only interested in + getting error messages for debugging. + + \snippet examples/widgets/maemovibration/mcevibrator.cpp 5 + + + \section1 ButtonWidget Class Definition + + \snippet examples/widgets/maemovibration/buttonwidget.h 0 + + The \c ButtonWidget class inherits from QWidget and provides the main user + interface for the application. It creates a grid of buttons, one for each + string in the stringlist passed to the constructor. Pressing a button emits + the \c clicked() signal, where the string is the text of the button that + was pressed. + + This class is taken from the QSignalMapper documentation. The only change + is the number of columns in the grid from three to two, to make the button + labels fit. + + + \section1 ButtonWidget Class Implementation + + \snippet examples/widgets/maemovibration/buttonwidget.cpp 0 + + + \section1 \c main() Function + + The main function begins with looking up the patterns available to us. + + \snippet examples/widgets/maemovibration/main.cpp 0 + + Then we create one instance of both classes, and connects the + \c ButtonWidget's clicked signal to the \c MceVibrator's \c vibrate() slot. + This works, since the button texts are the same as the pattern names. + + \snippet examples/widgets/maemovibration/main.cpp 1 +*/ diff --git a/doc/src/examples/orientation.qdoc b/doc/src/examples/orientation.qdoc new file mode 100644 index 0000000..cfe1757 --- /dev/null +++ b/doc/src/examples/orientation.qdoc @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! \example widgets/orientation + \group all-examples + \title Orientation Example + + The example shows a simple way to use different UIs depending on the screen + orientation of a mobile device. + + \image orientation-landscape.png The UI in landscape mode + \image orientation-portrait.png The UI in portrait mode + + The screen on many mobile devices can be viewed in both portrait and + landscape orientation. The orientation can be swiched with the help of a + hardware or software trigger. Due to the often small physical screen size, + user interfaces has to be very simple and compact to stay usable, and + applications usually occupy the whole screen. Designing a user interface + that works equally well in both landscape and portrait mode is not always + possible, however, so making a different layout for each case usually pays + off. + + The example application makes use of two different UI widgets created with + the Qt Designer, one for portrait and one for landscape orientation. The + application has a widget that contains an image and the user is able to + select one of three images for it to show. In addition to the two UIs, the + application consists of a \c MainWindow class. + + \section1 Landscape UI + + If the screen is in landscape mode, the user probably holds the device with + both hands and is ready to give full attention to the application. The + landscape UI looks like this: + + \image orientation-landscape-ui.png The landscape UI + + To the left is a QWidget called \c choiceWidget, which will show the + current image, and to the right are three QRadioButton instances. The + active radio button specifies the image to show. + + \section1 Portrait UI + + When the device is in portrait mode, it usually means that the user holds + it with one hand, and can comfortably use the thumb for small amounts of + input. The layout is simpler, and is focused on consuming content. The + portrait UI looks like this: + + \image orientation-portrait-ui.png The portrait UI + + Similarly, it contains a QWidget, also called \c choiceWidget, that will + show the current image. In contrast to the landscape UI, this one doesn't + provide any controls to change the image. + + \section1 MainWindow Class Definition + + \c MainWindow inherits from QWidget and acts as the top level widget of the + application. + + \snippet examples/widgets/orientation/mainwindow.h 0 + + The \c resizeEvent() method is re-implemented, and used to check which + UI to show. The \c onRadioButtonClicked() slot is connected to the + landscape UI's radio button group and selects the current image. + + \c landscapeWidget and \c portraitWidget will contain the UI layouts. Only + one of them is visible at a time. + + \section1 MainWindow Class Implementation + + In the constructor, the widgets that will hold the UIs are created and set + up. + + \snippet examples/widgets/orientation/mainwindow.cpp 0 + + Since the exit buttons on the layouts are different from each other, both + of them have to have their \c clicked() signal connected to the \c close() + slot of the main widget. The first image is also made current with the call + to \c onRadioButtonClicked(). + + \snippet examples/widgets/orientation/mainwindow.cpp 1 + + On the Maemo platform, windows are stuck in landscape mode by default. The + application has to explicitly say that rotation is supported. + + \snippet examples/widgets/orientation/mainwindow.cpp 2 + + The \c resizeEvent() is called when the main window is first created, and + also whenever the window has been resized. If the window is shown in + full screen, this is an indication that the orientation of the screen has + changed. + + The dimensions of \c landscapeWidget is the transpose of the dimensions of + \c portraitWidget. When the orientation is known, both are set to the + (possibly transposed) size of the window. Depending on the orientation, one + widget is made visible and the other invisible. + + \snippet examples/widgets/orientation/mainwindow.cpp 3 + + When the user selects one of the radio buttons in the landscape UI, the + current image is changed. The image is displayed by specifying the + background style of the choice widget. Since both \c portrait and + \c landscape have a \c choiceWidget of their own, the change has to be + reflected in both instances. + + \snippet examples/widgets/orientation/mainwindow.cpp 4 + + Synchronizing both UIs like this might become unfeasible when there are + many things that can change. In that case it is better to make use of the + \l{Introduction to Model/View Programming}{Model-View-Controller pattern} + more extensively and share the content between both portrait and landscape + widgets. Then an interface for displaying and manipulating it can be tailor + made for both orientations. + + \section1 The \c main() Function + + The main function creates a \c MainWindow instance and shows it full + screen. + \snippet examples/widgets/orientation/main.cpp 0 +*/ diff --git a/doc/src/examples/simplewebplugin.qdoc b/doc/src/examples/simplewebplugin.qdoc new file mode 100644 index 0000000..9093b9b --- /dev/null +++ b/doc/src/examples/simplewebplugin.qdoc @@ -0,0 +1,181 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example webkit/simplewebplugin + \title Simple Web Plugin Example + + The Simple Web Plugin example shows how to embed a regular Qt widget into a + Web page displayed using QWebView. + + \image webkit-simplewebplugin.png A table widget embedded in a Web page. + + In this example, we will show how to include Qt widgets in Web-centric user + interfaces. + + \section1 QtWebKit Basics + + QtWebKit provides integration between Qt and WebKit on two different levels. + On a low level, Qt provides widgets for Web pages to be rendered onto; on a + high level, a set of classes are provided that represent all the key + components of a Web browser. + + QWebView is a widget that is used to display Web pages, QWebPage represents + the content in a page, and QWebFrame represents an individual frame in a + Web page. The code to display a Web page is very simple: + + \snippet webkitsnippets/simple/main.cpp Using QWebView + + The widget provides fundamental Web browsing features, such as Cascading + Style Sheet and JavaScript support. Other technologies can be added to + provide a more comprehensive experience. + + \section1 Adding a Widget to a Page + + Since Qt is used to render pages, it is easy to add both standard and + custom widgets to pages. All we need is some markup to indicate where a + widget is expected in a page and a mechanism that lets us know when it + needs to be created. + + The markup used involves the \c <object> element, described in the HTML 4 + specification, which is used to include generic objects in Web pages. When + describing an object to represent a widget, there are typically three + attributes this element can have: a \c data attribute that indicates where + any relevant data can be obtained; \c width and \c height attributes can + be used to set the size of the widget on the page. + + Here's how we might describe such an object: + + \snippet examples/webkit/simplewebplugin/pages/index.html embedded object + + The mechanism used by QtWebKit to insert widgets into pages is a plugin + factory that is registered with a given WebPage instance. Factories are + subclasses of QWebPluginFactory and can be equipped to supply more than one + type of widget. + + \section1 Creating a Widget to Embed + + To demonstrate how the factory is used, we create a simple widget that can + be used to display Comma-Separated Values (CSV) files. The widget class, + \c CSVView, is just a subclass of QTableView with extra functions to set + up an internal data model. Instances of the factory class, \c CSVFactory, + are responsible for creating \c CSVView widgets and requesting data on + their behalf. + + The \c CSVFactory class is defined in the following way: + + \snippet examples/webkit/simplewebplugin/csvfactory.h plugin factory + + The public functions give a good overview of how QtWebKit will use the + factory to create widgets. We begin by looking at the factory's constructor: + + \snippet examples/webkit/simplewebplugin/csvfactory.cpp constructor + + The factory contains a network access manager which we will use to obtain + data for each of the plugin widgets created. + + The \c plugins() function is used to report information + about the kinds of widget plugins it can create; our implementation reports + the MIME type it expects and provides a description of the plugin: + + \snippet examples/webkit/simplewebplugin/csvfactory.cpp plugins + + The \c create() function is where most of the action happens. It is + called with a MIME type that describes the kind of data to be displayed, + a URL that refers to the data, and information about any additional + arguments that were specified in the Web page. We begin by checking the + basic MIME type information passed in the \c mimeType parameter, and only + continue if we recognize it. + + \snippet examples/webkit/simplewebplugin/csvfactory.cpp begin create + + We construct a view widget + using the fully-specified MIME type, which is guaranteed to be in the list of + arguments if a MIME type has been supplied. + + \snippet examples/webkit/simplewebplugin/csvfactory.cpp submit request + + Lastly, we use the network access manager to request the data specified by + the \c url parameter, connecting its \c finished() signal to the view's + \c updateModel() slot so that it can collect the data. The reply object is + intentionally created on the heap; the \c finished() signal is connected to + its \c deleteLater() slot, ensuring that Qt will dispose of it when it is no + longer needed. + + The \c CSVView class provides only minor extensions to the functionality of + QTableView, with a public slot to handle incoming data and a private + variable to record exact MIME type information: + + \snippet examples/webkit/simplewebplugin/csvview.h definition + + The constructor is simply used to record the MIME type of the data: + + \snippet examples/webkit/simplewebplugin/csvview.cpp constructor + + To save space, we will only look at parts of the \c updateModel() function, + which begins by obtaining the QNetworkReply object that caused the slot + to be invoked before checking for errors: + + \snippet examples/webkit/simplewebplugin/csvview.cpp update model begin + + Assuming that the data is correct, we need to determine whether the + CSV file includes a table header, and to find out which character encoding was + used to store the data. Both these pieces of information may be included in + the complete MIME type information, so we parse this before continuing---this + is shown in the online example code. + + \snippet examples/webkit/simplewebplugin/csvview.cpp read data begin + + Since QNetworkReply is a QIODevice subclass, the reply can be read + using a suitably configured text stream, and the data fed into a standard + model. The mechanics of this can be found in the + \l{webkit/simplewebplugin/csvview.cpp}{code listing}. Here, we skip to the + end of the function where we close the reply object and set the model on + the view: + + \snippet examples/webkit/simplewebplugin/csvview.cpp update model + + Once the reply has been read, and the model populated with data, very little + needs to be done by the plugin. Ownership of the view widget is handled + elsewhere, and we have ensured that the model will be destroyed when it is + no longer needed by making it a child object of the view. + + Let's look quickly at the \c MainWindow implementation: + + \snippet examples/webkit/simplewebplugin/mainwindow.cpp constructor + + Apart from creating and setting a factory on the QWebPage object, the + most important task is to enable Web plugins. If this global setting is not + enabled, plugins will not be used and our \c <object> elements will simply + be ignored. + + \section1 Further Reading + + The \l{Web Plugin Example} extends this example by adding a signal-slot + connection between the embedded widget and a JavaScript function in the + page. +*/ diff --git a/doc/src/examples/symbianvibration.qdoc b/doc/src/examples/symbianvibration.qdoc new file mode 100644 index 0000000..a0de236 --- /dev/null +++ b/doc/src/examples/symbianvibration.qdoc @@ -0,0 +1,192 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! \example widgets/symbianvibration + \group all-examples + \title Symbian Vibration Example + + The Symbian Vibrator example shows how to get fine-grained vibration + control on Symbian devices. + + Native Symbian APIs have to be used to enable vibration, since QtMobility + doesn't provide an interface for it yet. It is, however, planned to be + included in a future release. In anticipation for that, we make use of the + \c XQVibra class that was a part of the Mobile Extensions Technology Preview + API for Qt for Symbian. The pre-compiled libraries are no longer compatible + with Qt 4.6, but we can include the source code itself with the project. + + \image symbianvibration-example.png Screenshot of the Symbian Vibration example + + The example application divides the window into rectangles, which can be + pressed to make the device vibrate. Pressing different rectangles make the + device vibrate with different intensities. Each rectangle has a different + color and its intensity number is drawn on top of it. Moving the cursor + from one rectangle to another changes the vibration intensity to that of + the new one. Vibration stops when the mouse button has been released. It + is also possible to launch a short burst of vibration through the menu. + + The example consists of four classes: + + \list + \o \c XQVibra is the vibration interface class taken from the Mobile + Extensions for Qt for Symbian. + + \o \c XQVibraPrivate is the Symbian specific private implementation of the + vibration implementation. + + \o \c VibrationSurface is a custom widget that uses a XQVibra instance to + vibrate the device depending on where the user presses. + + \o \c MainWindow inherits from QMainWindow and contains a \c VibrationSurface + as its central widget, and also has a menu from which it is possible to + make the phone vibrate. + \endlist + + \section1 XQVibra Class Definition + + The \c XQVibra class uses the pimpl-idiom to hide the platform specific + implementation behind a common interface. Technically it would be possible + to support more target platforms, with only the addition of a private + implementation. The rest of the code would work the same, since only the + common interface is used. + + \snippet examples/widgets/symbianvibration/xqvibra.h 0 + + \c XQVibra provides a very simple interface for us to use. The interesting + part are the three slots \c start(), \c stop() and \c setIntensity(). Calling the start + method initiates vibration for the specified duration. Calling it while the + device is already vibrating causes it to stop the current one and start the + new one, even if the intensities are the same. The \c setIntensity() method + should be called before starting vibration. + + + \section1 VibrationSurface Class Definition + + \c VibrationSurface inherits from QWidget and acts like a controller for a + \c XQVibra object. It responds to mouse events and performs custom painting. + + \snippet examples/widgets/symbianvibration/vibrationsurface.h 0 + + The virtual event methods are reimplemented from QWidget. As can be seen, + there is no public programmable interface beyond what QWidget provides. + + + \section1 VibrationSurface Class Implementation + + Mouse events control the intensity of the vibration. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 0 + \codeline + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 1 + \codeline + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 2 + + Presses starts the vibration, movement changes the intensity and releases + stops the vibration. To set the right amount of vibration, the private + method \c applyIntensity() is used. It sets the vibration intensity according to + which rectangle the mouse currently resides in. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 3 + + We make sure only to change the intensity if it is different than last + time, so that the vibrator isn't stopped and restarted unnecessarily. + + The range of vibration intensity ranges from 0 to XQVibra::MaxIntensity. We + divide this range into a set of levels. The number of levels and the intensity + increase for each level are stored in two constants. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 4 + + Each rectangle has an intensity of one \c IntensityPerLevel more than the + previous one. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 5 + + The rectangles are either put in a row, if the widget's width is greater + than its height (landscape), otherwise they are put in a column (portrait). + Each rectangle's size is thus dependent on the length of the width or the + height of the widget, whichever is longer. The length is then divided by + the number of levels, which gets us either the height or the width of each + rectangle. The dx and dy specify the distance from one rectangle to the + next, which is the same as either the width or height of the rectangle. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 6 + + For each level of intensity, we draw a rectangle with increasing + brightness. On top of the rectangle a text label is drawn, specifying the + intesity of this level. We use the rectangle rect as a template for + drawing, and move it down or right at each iteration. + + The intensity is calculated by dividing the greater of the width and height + into \c NumberOfLevels slices. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 7 + + In case the widget's geometry is too small to fit all the levels, the user + interface will not work. For simplicity, we just return 0. + + When we know the axis along which the rectangles lie, we can find the one + in which the mouse cursor lie. + + \snippet examples/widgets/symbianvibration/vibrationsurface.cpp 8 + + The final clamp of the intensity value at the end is necessary in case the + mouse coordinate lies outside the widget's geometry. + + + \section1 MainWindow Class Definition + + Here's the definition of the \c MainWindow class: + + \snippet examples/widgets/symbianvibration/mainwindow.h 0 + + \c MainWindow is a top level window that uses a \c XQVibra and a + \c VibrationSurface. It also adds a menu option to the menu bar which can + start a short vibration. + + \section1 MainWindow Class Implementation + + In the \c MainWindow constructor the \c XQVibra and the \c VibrationSurface + are created. An action is added to the menu and is connected to the vibrate + slot. + + \snippet examples/widgets/symbianvibration/mainwindow.cpp 0 + + The \c vibrate() slot offers a way to invoke the vibration in case no + mouse is present on the device. + + \snippet examples/widgets/symbianvibration/mainwindow.cpp 1 + + \section1 Symbian Vibration Library + + The \c XQVibra class requires a platform library to be included. It is + included in the \c .pro file for the symbian target. + + \quotefromfile examples/widgets/symbianvibration/symbianvibration.pro + \skipto /^symbian \{/ + \printuntil /^\}/ +*/ diff --git a/doc/src/examples/webftpclient.qdoc b/doc/src/examples/webftpclient.qdoc new file mode 100644 index 0000000..469b645 --- /dev/null +++ b/doc/src/examples/webftpclient.qdoc @@ -0,0 +1,336 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example webkit/webftpclient + \title Web FTP Client Example + + The Web FTP Client example shows how to add support for a new protocol + to QtWebKit-based applications. + + \image webkit-webftpclient.png An FTP client displaying the contents of the ftp.qt.nokia.com site. + + \section1 Introduction + + The QtWebKit module presents many ways to integrate the worlds of native + desktop and mobile applications and the Web, making it possible for + developers to extend and combine features found in Qt and WebKit to create + new ones. In this article, we examine the use of Qt's network access API + with WebKit and show how to turn QWebView into a simple FTP client. + + In the \l{Web Plugin Example}, we extended Qt's WebKit integration by + showing how to add custom widgets to Web pages. In the article, we used + QNetworkRequest to ask for content for display in a widget, and we obtained + the data returned by the server by reading from the corresponding + QNetworkReply. + + Qt's network access API is a technology that aims to replace much, but not + all, of the functionality provided by the QHttp and QFtp classes. + Although the network access API is a Qt-specific technology, the QtWebKit + module integrates this Qt technology with WebKit to enable customization of + the browser engine by Qt application developers. It also means that we can + control how the browser engine obtains and renders content. + + Since QNetworkRequest and QNetworkReply are designed to provide a reusable + abstraction for network operations, it seems obvious to use these classes + to add FTP support to browsers written using QtWebKit. To do this, we first + need to examine the network access classes before we see how the QtWebKit + module uses them to manage network operations. + + \section1 Network Access + + The central class in Qt's network access API is QNetworkAccessManager. + This class performs the work of dispatching requests to remote servers and + handling incoming replies. Applications typically construct an instance of + this class and use it for all high level network communication. + + Applications create QNetworkRequest objects, each of them specifying a URL + where the request is to be sent and containing meta-data that will be + understood by the server. Each request is dispatched by passing it to a + function in the network manager \mdash there are different functions + corresponding to different kinds of operations, such as + \l{QNetworkAccessManager::}{get()}, \l{QNetworkAccessManager::}{put()} and + \l{QNetworkAccessManager::}{post()}. Each of these functions returns a + QNetworkReply object which is used to obtain the content sent in the reply, + as well as any meta-data that describes it. + + The QtWebKit module provides the QWebPage class which represents the + content displayed in a QWebView widget. Behind the scenes, this class uses + a default network access manager to handle network communication. This + default manager works perfectly well for fetching content over HTTP from + \tt{http://} URLs, but only supports fetching of files over FTP when using + \tt{ftp://} URLs. + + Fortunately, QWebPage provides the \l{QWebPage::}{setNetworkAccessManager()} + function that allows the default manager to be replaced with one with more + features. This lets us add improved support for FTP quite easily if we can + write a new manager that supports \tt{ftp://} URLs. + + The process of replacing the manager and using a new one with an existing + QWebPage object can be broken up into three steps: + + \list 1 + \o Creating a new QNetworkAccessManager subclass. + \o Creating a new QNetworkReply subclass to deal with the FTP protocol. + \o Setting the new manager on the QWebPage. + \endlist + + Additionally, to provide a reasonable user experience, we should also handle + content that the browser engine cannot display. To do this, we create a + custom \c{Downloader} object. We will briefly return to this topic later. + + \section1 Creating a New Network Manager + + Replacing an existing network manager for a QWebPage is conceptually simple: + we subclass QNetworkAccessManager and reimplement its + \l{QNetworkAccessManager::}{createRequest()} function to check for URLs + with the \tt{ftp} scheme. However, we want to ensure that the manager uses + any existing cache and proxy settings that may have been set up for the + existing manager used by the QWebPage. + + To keep the existing proxy and cache, we give our network manager a + constructor that accepts the old manager as an argument. In the constructor, + we reuse the settings from the old manager. + + \snippet examples/webkit/webftpclient/networkaccessmanager.cpp constructor + + The \c{createRequest()} function is used to create and dispatch requests to + remote servers for each of the different kinds of operation that the API + presents to the developer. Since we are only interested in performing simple + fetches of resources using the \tt{ftp} scheme, we filter out other schemes + and other kinds of operation, delegating the task of handling these to the + default implementation. + + \snippet examples/webkit/webftpclient/networkaccessmanager.cpp create request + + Here, we construct and return an instance of the \c FtpReply class. This + class performs most of the work of handling the FTP protocol. + + \section1 Creating a Custom Reply + + The network access API is designed to be simple to use: we set up a request, + dispatch it using the network manager, and obtain a QNetworkReply object. + If we are not interested in the reply's meta-data, we can simply read the + data using its \l{QNetworkReply::}{readAll()} function because QNetworkReply + is a QIODevice subclass. + + In order to keep the API so simple, however, we need to perform some work + behind the scenes. In this case, that means that we must perform a series of + communications with the FTP server. Fortunately, we can use the existing + implementation provided by QFtp to perform the low level work. + + In the \c FtpReply class, we need to reimplement four functions in the + API to ensure that it will work correctly. These functions, + \l{QNetworkReply::}{abort()}, \l{QIODevice::}{bytesAvailable()}, + \l{QIODevice::}{isSequential()}, \l{QIODevice::}{readData()}, + rely on the rest of the implementation to fill a QByteArray with data and + use an integer offset to track how much has been read from the device by + the browser. + + \snippet examples/webkit/webftpclient/ftpreply.h class definition + + The \c{processCommand()}, \c{processListInfo} and \c{processData()} slots + handle interaction with the FTP server. The private \c{setContent()} and + \c{setListContent()} functions are used to add meta-data to the reply and + compose HTML for the browser to display. + + Two of the private variables hold information about the data obtained from + the FTP server: \c items is updated to contain information about each + file found at a given URL, and \c content contains the raw data obtained + from the server. The \c offset variable is used to track how much data has + been read by the browser from the reply. + + In the constructor, we construct a QFtp object and connect the signals and + slots that form the basis of the interaction with the FTP server. The high + level communication is reported by the \l{QFtp::}{commandFinished()} + signal. New data from the server is reported by the + \l{QFtp::}readyRead()} signal. + Individual items in an FTP directory listing are reported by the + \l{QFtp::}{listInfo()} signal. + + \snippet examples/webkit/webftpclient/ftpreply.cpp constructor + + We also initialize the \c offset into the data that represents the number + of bytes that the browser has read from the reply. Additionally, we define + a list of units for use with the \c setListContent() function. + The last two tasks performed in the constructor are to set the URL of the + reply so that the browser can tell where it came from, and to connect to + the FTP server. + + \section2 Fetching Data from the Server + + All communication with the server is handled by the \c processCommand() + slot, which acts on responses from the server and tells us when a command + we have issued has completed. + This slot performs the task of logging in to the server when connection has + occurred (the \l{QFtp::}{ConnectToHost} command has completed), asking for + a list of files when logged in (\l{QFtp::}{Login} has completed), + preparing a page with a listing when all file information has been received + (\l{QFtp::}{List} has completed), and setting the current content for the + reply when data has been fetched from the server + (\l{QFtp::}{Get} has completed). + + \snippet examples/webkit/webftpclient/ftpreply.cpp process command + + The result of the \l{QFtp::}{List} command is handled by looking at the + number of items obtained from the server. + The items themselves are recorded by the \c processListInfo() slot. When a + \l{QFtp::}{List} command is complete, we can count the number of items + received and determine whether or not we should create a file listing, or + try to fetch the file instead by invoking a \l{QFtp::}{Get} command. + + \snippet examples/webkit/webftpclient/ftpreply.cpp process list info + + Since the reply will only be used once, we can simply append items to a list + and never bother to clear it. + + The \c processData() slot simply appends data obtained from the FTP server + to the QByteArray containing the content to be supplied to the browser. + + \snippet examples/webkit/webftpclient/ftpreply.cpp process data + + Data is appended to the \c content array until the connection to the FTP + server is closed, either by the reply or by the server itself. One of the + ways in which this happens is when a \l{QFtp::}{Get} command completes. At + this point, the \c setContent() function is called from within the + \c processCommand() function. + + \snippet examples/webkit/webftpclient/ftpreply.cpp set content + + Here, we prepare the reply for use by the browser by opening it for + unbuffered reading and setting the header that reports the amount of data + held by the reply. We emit signals that indicate that the network operation + has finished and that it has data to be read. Since we are no longer + interested in the FTP server, we close the connection to it. + + \section2 Preparing Content for the Reader + + Another way in which the reply closes the connection to the server is when + the \c setListContent() function is called from the \c processCommand() + function. Most of the implementation of this function involves transforming + the information about the items held in the reply's private \c items + variable to HTML. + + \snippet examples/webkit/webftpclient/ftpreply.cpp set list content + + Once the HTML description of the files has been composed in a QString, we + convert it to a UTF-8 encoded set of bytes which we store in the reply's + private \c content variable. In this case, the QByteArray holds HTML + instead of file data. We set the reply's headers to indicate that it + contains UTF-8 encoded HTML with a certain length, and we emit the + \l{QNetworkReply::}{readyRead()} and \l{QNetworkReply::}{finished()} + signals to let the browser know that it can start reading the content. + + \section2 Supplying Data to the Browser + + We reimplement four QIODevice functions to provide basic read-only behavior, + simply supplying the data held in the \c content array. + + We do not support aborting of the reply, so our \c abort() implementation + is empty. + + \snippet examples/webkit/webftpclient/ftpreply.cpp abort + + Similarly, we do not support random access reading, so \c isSequential() + is reimplemented to always return true. + + \snippet examples/webkit/webftpclient/ftpreply.cpp is sequential + + The \c bytesAvailable() function returns the total number of bytes held by + the reply minus the value of \c offset, which is the number of bytes we + have already supplied to the reader. + + \snippet examples/webkit/webftpclient/ftpreply.cpp bytes available + + \snippet examples/webkit/webftpclient/ftpreply.cpp read data + + The \c readData() reimplementation tries to return as much data to the + reader as it will allow, copying bytes directly to the appropriate location + in memory. The \c offset variable is updated to keep track of how many + bytes have been read. + + \section1 Enabling the Protocol + + Now that we have an FTP-enabled network manager and a reply that can handle + communication with FTP servers, we can now enable the manager for a given + QWebPage. + We derive the \c FtpView class from QWebView and configure its behavior in + its constructor. + + As we mentioned earlier, we pass the original network manager to the + newly-created manager and pass the new manager to the QWebPage belonging to + the browser. This enables our network manager for the content it displays. + + \snippet examples/webkit/webftpclient/ftpview.cpp constructor + + We also go to some effort to handle content that WebKit does not natively + support, using a \c Downloader helper class to manage this and files that + the user downloads via the browser's \gui{Save Link...} context menu entry. + + In the example's \c main() function, we perform the usual steps to + initialize our Qt application. We choose an appropriate starting URL for + the \c FtpView widget to open before running the application's event loop. + + \snippet examples/webkit/webftpclient/main.cpp main + + \section1 Summary + + As we have seen, enabling support for another protocol and URL scheme in + QtWebKit is a fairly simple process involving the creation of a network + manager and custom reply object. The implementation challenges + are mostly related to how the protocol is handled by the custom + QNetworkReply subclass where, in our case, we need to issue the appropriate + commands in the correct order to obtain data from the FTP server. + + We also need to ensure that that the reply emits the appropriate signals to + inform the browser that it has content to be read. Our implementation is + intentionally simple, only notifying the browser with the + \l{QIODevice::}{readyRead()} signal when \e all the content is ready to + read and emitting the \l{QNetworkReply::}{finished()} signal to indicate + that communication is complete; a more sophisticated approach would + interleave the commands sent to the server with the emission of signals, + allowing the browser to read content as data is obtained from the FTP + server. + + The reply also needs to be open for reading. Forgetting to call the + \l{QIODevice::}{open()} function is a common error to make when dealing + with devices, but in this case it is the reply's responsibility to open + itself. + It must indicate how much content it has for the browser to read. As we + have seen, this is done by setting the reply's + \l{QNetworkRequest::}{ContentLengthHeader} header with the appropriate + value. With this information available, the browser can read from the reply + when the content becomes available, displaying a directory listing or + downloading content depending on the type of data supplied. + + We can use the approach described in this article to enable support for + other protocols by writing or extending a network manager to handle URL + schemes such as \tt mailto, \tt sip, \tt news, \tt file and \tt ldap. + Applications that integrate Web content with information from other sources + can also provide custom URL schemes as long as care is taken not to use an + existing public scheme. +*/ diff --git a/doc/src/examples/webplugin.qdoc b/doc/src/examples/webplugin.qdoc new file mode 100644 index 0000000..0410670 --- /dev/null +++ b/doc/src/examples/webplugin.qdoc @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example webkit/webplugin + \title Web Plugin Example + + The Web Plugin example shows how to communicate between a Qt widget + embedded in a Web page and the page itself. + + \image webkit-webplugin.png A table widget embedded in a Web page. + + In this example, we will take the widget described in the + \l{Simple Web Plugin Example} and show how to set up communications between + the widget and the Web environment. + + \section1 Setting up Communications + + There are two ways of interacting with the content in a Web page. The first + way involves the use of QWebElement to read and modify the page + content and structure; this is useful for certain types of application, as + demonstrated by the \l{DOM Traversal Example} and the + \l{Simple Selector Example}. + + The second way is to add Qt objects to the page, connecting their signals + to JavaScript functions, and executing the object's slots directly from + JavaScript in the page. We explore this approach in this example. + + To perform this communication, we require an updated \c CSVView widget from + the \l{Simple Web Plugin Example} that can emit a signal whenever a row is + selected, a JavaScript function to modify elements on the page, and some + glue code to make the connection. + + On the page, the plugin is declared like this: + + \snippet examples/webkit/webplugin/pages/index.html embedded object + + As in the previous example, the \c <object> definition includes information + about the data to be displayed, its location, and the dimensions of the + plugin in the page. + + Later in the document, we include a table that we will update with data + from the \c CSVView widget: + + \snippet examples/webkit/webplugin/pages/index.html table + + The \c CSVView widget is similar to the previous version. However, we + wish to obtain and export individual rows of data, so we define the + \c rowSelected() signal and \c exportRow() slot to perform this task. + + \snippet examples/webkit/webplugin/csvview.h definition + + Since we wish to obtain one row of data at a time, the constructor includes + code to restrict how the user can interact with the view: + + \snippet examples/webkit/simplewebplugin/csvview.cpp constructor + + The \c exportRow() slot provides a convenient mechanism for obtaining and + emitting the values found on the current row of the table: + + \snippet examples/webkit/webplugin/csvview.cpp export row + + This slot is connected to a signal belonging to the view's selection model: + \l{QItemSelectionModel::}{currentChanged()}. This can be seen by examining + the \c updateModel() function in the source code. + + \c exportRow() emits the \c rowSelected() signal, passing strings containing + the name, address and quantity in the current table row. To see how this + data is passed to the Web page, we need to look at the \c CSVFactory class. + + \section1 Connecting Components Together + + In the \c CSVFactory class, we reimplement the \l{QWebPluginFactory::}{create()} + function to create instances of the \c CSVView class, as in the previous + example. + + \snippet examples/webkit/webplugin/csvfactory.cpp begin create + + We also expose the view widget to the frame in the page that + contains the elements, and set up a connection between the view and a + JavaScript function defined in the page header: + + \snippet examples/webkit/webplugin/csvfactory.cpp create connection + + The view is added to the Web page as \c view, and the connection code we + evaluate performs a signal-slot connection from the view's \c rowSelected() + signal to a pure JavaScript function: + + \js + view.rowSelected.connect(fillInTable); + \endjs + + \c fillInTable is the name of the JavaScript function to modify the + form's input elements. This function expects three arguments: the name, + address and quantity values for a row of data. + + Whenever the current row changes in the \c view object, the \c exportRow() + slot is called, the data found in the selected row is extracted from the + model and emitted in the \c rowSelected() signal as three strings, and + the above connection ensures that \c fillInTable() will be called with the + current items of data. The appropriate type conversions occur behind the + scenes to ensure that each QString is converted to a JavaScript string + object. + + The rest of the function is the same as in the previous example: + + \snippet examples/webkit/webplugin/csvfactory.cpp submit request + + We now give the JavaScript \c fillInForm() function to show what it does + with the strings it is given. The function itself is defined in the HTML + page header: + + \snippet examples/webkit/webplugin/pages/index.html script + + We obtain the elements in the page that we wish to update by using the HTML + Document Object Model (DOM) API. The values of these elements are updated + with the \c name, \c address and \c quantity strings supplied. + + \section1 Linking Things Together + + Although we have used the widgets to demonstrate the use of signals and + slots for communication between Qt components and JavaScript in the browser, + we do not need to embed widgets in Web pages to be able to do this. By + inserting objects into pages and evaluating JavaScript, Qt applications can + be made to examine and process information found online. + + One additional improvement that can be made to this example is to create + a relation between the embedded widget and the table to be updated. We + could do this by including \c <param> elements within the \c <object> + element that refers to the table cells by their \c id attributes. This + would help us to avoid hard-coding the \c customers_name, + \c customers_address and \c customers_quantity identifiers in the script. +*/ diff --git a/doc/src/images/appicon_packagecontents.png b/doc/src/images/appicon_packagecontents.png Binary files differnew file mode 100644 index 0000000..49cb1e4 --- /dev/null +++ b/doc/src/images/appicon_packagecontents.png diff --git a/doc/src/images/appicon_screenshot.png b/doc/src/images/appicon_screenshot.png Binary files differnew file mode 100644 index 0000000..c29dd11 --- /dev/null +++ b/doc/src/images/appicon_screenshot.png diff --git a/doc/src/images/cube.png b/doc/src/images/cube.png Binary files differnew file mode 100644 index 0000000..95dfc98 --- /dev/null +++ b/doc/src/images/cube.png diff --git a/doc/src/images/cube_faces.png b/doc/src/images/cube_faces.png Binary files differnew file mode 100644 index 0000000..2c7102a --- /dev/null +++ b/doc/src/images/cube_faces.png diff --git a/doc/src/images/elidedlabel-example.png b/doc/src/images/elidedlabel-example.png Binary files differnew file mode 100644 index 0000000..741d289 --- /dev/null +++ b/doc/src/images/elidedlabel-example.png diff --git a/doc/src/images/maemovibration-example.png b/doc/src/images/maemovibration-example.png Binary files differnew file mode 100644 index 0000000..be975fc --- /dev/null +++ b/doc/src/images/maemovibration-example.png diff --git a/doc/src/images/orientation-landscape-ui.png b/doc/src/images/orientation-landscape-ui.png Binary files differnew file mode 100644 index 0000000..c591ff1 --- /dev/null +++ b/doc/src/images/orientation-landscape-ui.png diff --git a/doc/src/images/orientation-landscape.png b/doc/src/images/orientation-landscape.png Binary files differnew file mode 100644 index 0000000..e606804 --- /dev/null +++ b/doc/src/images/orientation-landscape.png diff --git a/doc/src/images/orientation-portrait-ui.png b/doc/src/images/orientation-portrait-ui.png Binary files differnew file mode 100644 index 0000000..304835b --- /dev/null +++ b/doc/src/images/orientation-portrait-ui.png diff --git a/doc/src/images/orientation-portrait.png b/doc/src/images/orientation-portrait.png Binary files differnew file mode 100644 index 0000000..3d778e8 --- /dev/null +++ b/doc/src/images/orientation-portrait.png diff --git a/doc/src/images/qml-listview-snippet.png b/doc/src/images/qml-listview-snippet.png Binary files differnew file mode 100644 index 0000000..0ee0ffc --- /dev/null +++ b/doc/src/images/qml-listview-snippet.png diff --git a/doc/src/images/symbianvibration-example.png b/doc/src/images/symbianvibration-example.png Binary files differnew file mode 100644 index 0000000..21461b6 --- /dev/null +++ b/doc/src/images/symbianvibration-example.png diff --git a/doc/src/images/webkit-webftpclient.png b/doc/src/images/webkit-webftpclient.png Binary files differnew file mode 100644 index 0000000..8aa7a12 --- /dev/null +++ b/doc/src/images/webkit-webftpclient.png diff --git a/doc/src/images/webkit-webplugin.png b/doc/src/images/webkit-webplugin.png Binary files differnew file mode 100644 index 0000000..1594163 --- /dev/null +++ b/doc/src/images/webkit-webplugin.png diff --git a/doc/src/snippets/declarative/grid/grid-items.qml b/doc/src/snippets/declarative/grid/grid-items.qml new file mode 100644 index 0000000..62a444d --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid-items.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 112; height: 112 + color: "#303030" + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + columns: 2 + spacing: 6 + + Rectangle { color: "#aa6666"; width: 50; height: 50 } + Rectangle { color: "#aaaa66"; width: 50; height: 50 } + Rectangle { color: "#9999aa"; width: 50; height: 50 } + Rectangle { color: "#6666aa"; width: 50; height: 50 } + } +} diff --git a/doc/src/snippets/declarative/grid/grid-no-spacing.qml b/doc/src/snippets/declarative/grid/grid-no-spacing.qml new file mode 100644 index 0000000..a6ca305 --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid-no-spacing.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 112; height: 112 + color: "#303030" + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + columns: 2 + + Rectangle { color: "#aa6666"; width: 50; height: 50 } + Rectangle { color: "#aaaa66"; width: 50; height: 50 } + Rectangle { color: "#9999aa"; width: 50; height: 50 } + Rectangle { color: "#6666aa"; width: 50; height: 50 } + } +} diff --git a/doc/src/snippets/declarative/grid/grid-spacing.qml b/doc/src/snippets/declarative/grid/grid-spacing.qml new file mode 100644 index 0000000..c03cdad --- /dev/null +++ b/doc/src/snippets/declarative/grid/grid-spacing.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import QtQuick 1.0 + +Rectangle { + width: 112; height: 112 + color: "#303030" + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + columns: 2 + spacing: 6 + + Rectangle { color: "#aa6666"; width: 50; height: 50 } + Rectangle { color: "#aaaa66"; width: 50; height: 50 } + Rectangle { color: "#9999aa"; width: 50; height: 50 } + Rectangle { color: "#6666aa"; width: 50; height: 50 } + } +} +//! [document] diff --git a/doc/src/snippets/declarative/listview/listview-snippet.qml b/doc/src/snippets/declarative/listview/listview-snippet.qml new file mode 100644 index 0000000..f2a260d --- /dev/null +++ b/doc/src/snippets/declarative/listview/listview-snippet.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import QtQuick 1.0 + +ListView { + width: 50; height: 200 + model: 4 + delegate: Text { + text: index; + font.pixelSize: 40 + } +} +//! [document] diff --git a/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg b/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg new file mode 100644 index 0000000..8c018be --- /dev/null +++ b/doc/src/snippets/declarative/qml-intro/images/qt-logo.svg @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + clip-rule="evenodd" + stroke-miterlimit="10" + viewBox="0 0 174.35 209.78" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.46" + width="744.09186" + height="895.29858" + sodipodi:docname="qt-logo.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape" + version="1.0" + style="stroke-miterlimit:10"> + <metadata + id="metadata29"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <sodipodi:namedview + inkscape:window-height="668" + inkscape:window-width="722" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + guidetolerance="10.0" + gridtolerance="10.0" + objecttolerance="10.0" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base" + showgrid="false" + inkscape:zoom="0.12195802" + inkscape:cx="525.6108" + inkscape:cy="-287.87189" + inkscape:window-x="476" + inkscape:window-y="228" + inkscape:current-layer="svg2" /> + <desc + id="desc4">SVG generated by Lineform</desc> + <defs + id="defs6"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + id="perspective31" /> + </defs> + <g + id="g8" + transform="translate(-1.5304326e-4,-3.775985e-4)"> + <path + d="M 43.08,0.36 C 40.94,0 38.84,-0.08 36.81,0.08 L 36.8,0.08 C 36.8,0.08 22.92,1.02 22.29,1.07 C 9.62,2.08 0,12.5 0,26.89 L 0,196.55 L 14.19,209.78 L 156.79,185.81 C 166.6,184.11 174.35,172.54 174.35,160.04 L 174.35,21.88 L 43.08,0.36" + id="path10" + style="fill:#0c481e" /> + <path + d="M 174.35,160.04 C 174.35,172.54 166.6,184.11 156.79,185.82 L 14.19,209.78 L 14.19,25.99 C 14.19,9.27 27.53,-2.21 43.08,0.36 L 174.35,21.88 L 174.35,160.04" + id="path12" + style="fill:#66b036" /> + <path + d="M 130.42,45.91 L 141.94,47.15 L 141.94,67.36 L 154.9,68.28 L 154.9,80.96 L 141.94,80.36 L 141.94,126.69 C 141.94,130.72 142.38,133.31 143.28,134.48 C 144.08,135.55 145.32,136.07 146.99,136.07 C 147.15,136.07 147.32,136.07 147.48,136.06 C 150.03,135.91 152.81,135.13 155.83,133.75 L 155.83,145.4 C 150.69,147.65 145.65,149 140.7,149.42 C 139.99,149.47 139.29,149.5 138.62,149.5 C 134.14,149.5 130.72,148.2 128.38,145.57 C 125.65,142.52 124.29,137.62 124.29,130.9 L 124.29,79.54 L 118.06,79.26 L 118.06,65.67 L 125.65,66.22 L 130.42,45.91" + id="path14" + style="fill:#ffffff" /> + <path + d="M 154.9,80.96 L 141.94,80.36 L 141.94,80.64 L 148.88,80.96 L 154.9,80.96" + id="path16" + style="fill:#0c481e" /> + <path + d="M 144.64,135.6 C 145.3,135.92 146.07,136.07 146.99,136.07 C 147.15,136.07 147.32,136.07 147.48,136.06 C 150.03,135.91 152.81,135.13 155.83,133.75 L 149.81,133.75 C 147.99,134.58 146.28,135.21 144.64,135.6" + id="path18" + style="fill:#0c481e" /> + <path + d="M 128.38,145.57 C 125.65,142.52 124.29,137.62 124.29,130.9 L 124.29,79.54 L 118.06,79.26 L 118.06,65.67 L 112.05,65.67 L 112.05,68.71 C 112.92,71.98 113.6,75.53 114.11,79.35 L 118.28,79.54 L 118.28,130.9 C 118.28,137.62 119.64,142.52 122.37,145.57 C 124.71,148.2 128.13,149.5 132.61,149.5 L 138.62,149.5 C 134.14,149.5 130.72,148.2 128.38,145.57 z M 130.42,45.91 L 124.41,45.91 L 119.74,65.79 L 125.65,66.22 L 130.42,45.91" + id="path20" + style="fill:#0c481e" /> + <path + d="M 91.15,132.4 C 93.5,126.36 94.66,114.49 94.66,96.79 C 94.66,80.9 93.51,69.97 91.18,63.98 C 88.84,57.95 85.35,54.69 80.66,54.28 C 80.3,54.25 79.95,54.23 79.6,54.23 C 75.26,54.23 71.92,56.77 69.59,61.86 C 67.07,67.4 65.8,78.9 65.8,96.3 C 65.8,113.11 67.04,125.05 69.54,132.05 C 71.89,138.72 75.41,142.03 80.04,142.03 C 80.25,142.03 80.45,142.02 80.66,142.01 C 85.29,141.71 88.78,138.51 91.15,132.4 M 109.13,136.15 C 105.01,145.86 98.73,152.21 90.14,155.15 C 91.01,159.6 92.32,162.6 94.06,164.17 C 95.41,165.39 97.49,165.99 100.28,165.99 C 101.09,165.99 101.96,165.94 102.87,165.84 L 102.87,178.96 L 96.91,179.75 C 95.16,179.97 93.49,180.09 91.91,180.09 C 86.69,180.09 82.47,178.82 79.29,176.26 C 75.08,172.89 71.98,166.37 69.99,156.73 C 60.86,154.78 53.73,148.97 48.8,139.23 C 43.8,129.32 41.25,114.83 41.25,95.89 C 41.25,75.46 44.74,60.38 51.6,50.81 C 57.38,42.75 65.46,38.78 75.62,38.78 C 77.24,38.78 78.93,38.88 80.66,39.08 C 92.61,40.46 101.28,46.1 106.92,55.87 C 112.46,65.43 115.17,79.14 115.17,97.13 C 115.17,113.62 113.17,126.58 109.13,136.15" + id="path22" + style="fill:#ffffff" /> + <path + d="M 100.28,165.99 C 101.09,165.99 101.95,165.94 102.87,165.84 L 98.04,165.84 C 98.71,165.94 99.49,165.99 100.28,165.99" + id="path24" + style="fill:#0c481e" /> + <path + d="M 84.85,63.98 C 87.19,69.97 88.34,80.9 88.34,96.79 C 88.34,114.49 87.18,126.36 84.82,132.4 C 82.93,137.28 80.3,140.31 76.96,141.48 C 77.93,141.84 78.96,142.03 80.04,142.03 C 80.25,142.03 80.45,142.02 80.66,142.01 C 85.29,141.71 88.78,138.51 91.15,132.4 C 93.5,126.36 94.66,114.49 94.66,96.79 C 94.66,80.9 93.51,69.97 91.18,63.98 C 88.84,57.95 85.35,54.69 80.66,54.28 C 80.3,54.25 79.95,54.23 79.6,54.23 C 78.51,54.23 77.48,54.39 76.52,54.72 L 76.52,54.72 C 80.12,55.83 82.89,58.93 84.85,63.98 z M 82.51,178.25 C 82.4,178.2 82.28,178.15 82.17,178.09 C 82.16,178.09 82.15,178.08 82.14,178.08 C 82.03,178.03 81.93,177.97 81.83,177.92 C 81.81,177.91 81.79,177.9 81.77,177.89 C 81.68,177.84 81.59,177.79 81.49,177.74 C 81.46,177.72 81.44,177.71 81.41,177.69 C 81.33,177.65 81.24,177.6 81.16,177.55 C 81.12,177.53 81.09,177.51 81.05,177.48 C 80.98,177.44 80.91,177.4 80.84,177.36 C 80.79,177.33 80.74,177.3 80.7,177.27 C 80.64,177.23 80.58,177.19 80.52,177.15 C 80.46,177.12 80.41,177.08 80.35,177.04 C 80.3,177.01 80.25,176.98 80.2,176.94 C 80.14,176.9 80.07,176.85 80.01,176.81 C 79.97,176.78 79.93,176.75 79.89,176.72 C 79.82,176.67 79.74,176.61 79.67,176.55 C 79.64,176.54 79.61,176.52 79.59,176.5 C 79.49,176.42 79.39,176.34 79.29,176.26 C 75.08,172.89 71.98,166.37 69.99,156.73 C 60.86,154.78 53.73,148.97 48.8,139.23 C 43.8,129.32 41.25,114.83 41.25,95.89 C 41.25,75.46 44.74,60.38 51.6,50.81 C 57.38,42.75 65.46,38.78 75.62,38.78 C 75.65,38.78 69.27,38.77 69.27,38.77 L 69.27,38.78 C 59.12,38.78 51.05,42.75 45.27,50.81 C 38.41,60.38 34.92,75.46 34.92,95.89 C 34.92,114.83 37.47,129.32 42.47,139.23 C 47.41,148.97 54.53,154.78 63.67,156.73 C 65.65,166.37 68.76,172.89 72.96,176.26 C 76.14,178.82 80.36,180.09 85.58,180.09 C 85.68,180.09 85.78,180.09 85.88,180.09 L 91.42,180.09 C 88.01,180.03 85.04,179.43 82.52,178.26 C 82.51,178.26 82.51,178.26 82.51,178.25" + id="path26" + style="fill:#0c481e" /> + </g> +</svg> diff --git a/doc/src/snippets/textdocument-listitemstyles/main.cpp b/doc/src/snippets/textdocument-listitemstyles/main.cpp new file mode 100644 index 0000000..6e40492 --- /dev/null +++ b/doc/src/snippets/textdocument-listitemstyles/main.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> + +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + MainWindow *window = new MainWindow; + window->resize(640, 480); + window->show(); + return app.exec(); +} diff --git a/doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp b/doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp new file mode 100644 index 0000000..94e98b3 --- /dev/null +++ b/doc/src/snippets/textdocument-listitemstyles/mainwindow.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> + +#include "mainwindow.h" + +MainWindow::MainWindow() +{ + QMenu *fileMenu = new QMenu(tr("&File")); + + fileMenu->addAction(tr("E&xit"), this, SLOT(close()), + QKeySequence(tr("Ctrl+Q", "File|Exit"))); + + QMenu *insertMenu = new QMenu(tr("&Insert")); + + insertMenu->addAction(tr("&List"), this, SLOT(insertList()), + QKeySequence(tr("Ctrl+L", "Insert|List"))); + + menuBar()->addMenu(fileMenu); + menuBar()->addMenu(insertMenu); + + editor = new QTextEdit(this); + document = new QTextDocument(this); + editor->setDocument(document); + + setCentralWidget(editor); + setWindowTitle(tr("Text Document List Item Styles")); +} + +void MainWindow::insertList() +{ + QTextCursor cursor = editor->textCursor(); + cursor.beginEditBlock(); + + //! [add a styled, ordered list] + QTextListFormat listFormat; + + listFormat.setStyle(QTextListFormat::ListDecimal); + listFormat.setNumberPrefix("("); + listFormat.setNumberSuffix(")"); + + cursor.insertList(listFormat); + //! [add a styled, ordered list] + + cursor.endEditBlock(); +} diff --git a/doc/src/snippets/textdocument-listitemstyles/mainwindow.h b/doc/src/snippets/textdocument-listitemstyles/mainwindow.h new file mode 100644 index 0000000..649a47b --- /dev/null +++ b/doc/src/snippets/textdocument-listitemstyles/mainwindow.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WINDOW_H +#define WINDOW_H + +#include <QMainWindow> + +class QTextDocument; +class QTextEdit; + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(); + +public slots: + void insertList(); + +private: + QString currentFile; + QTextEdit *editor; + QTextDocument *document; +}; + +#endif diff --git a/doc/src/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro b/doc/src/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro new file mode 100644 index 0000000..5da8d6e --- /dev/null +++ b/doc/src/snippets/textdocument-listitemstyles/textdocument-listitemstyles.pro @@ -0,0 +1,3 @@ +HEADERS = mainwindow.h +SOURCES = main.cpp \ + mainwindow.cpp diff --git a/examples/animation/animatedtiles/animatedtiles.desktop b/examples/animation/animatedtiles/animatedtiles.desktop new file mode 100644 index 0000000..97e646f --- /dev/null +++ b/examples/animation/animatedtiles/animatedtiles.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Animated Tiles +Exec=/opt/usr/bin/animatedtiles +Icon=animatedtiles +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/animation/appchooser/appchooser.desktop b/examples/animation/appchooser/appchooser.desktop new file mode 100644 index 0000000..8e413e9 --- /dev/null +++ b/examples/animation/appchooser/appchooser.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Application Chooser +Exec=/opt/usr/bin/appchooser +Icon=appchooser +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/animation/easing/easing.desktop b/examples/animation/easing/easing.desktop new file mode 100644 index 0000000..56d1222 --- /dev/null +++ b/examples/animation/easing/easing.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Easing Curves +Exec=/opt/usr/bin/easing +Icon=easing +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/animation/moveblocks/moveblocks.desktop b/examples/animation/moveblocks/moveblocks.desktop new file mode 100644 index 0000000..4100f44 --- /dev/null +++ b/examples/animation/moveblocks/moveblocks.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Move Blocks +Exec=/opt/usr/bin/moveblocks +Icon=moveblocks +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/animation/states/states.desktop b/examples/animation/states/states.desktop new file mode 100644 index 0000000..8429979 --- /dev/null +++ b/examples/animation/states/states.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=States +Exec=/opt/usr/bin/states +Icon=states +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/animation/stickman/rectbutton.cpp b/examples/animation/stickman/rectbutton.cpp new file mode 100644 index 0000000..f8b00da --- /dev/null +++ b/examples/animation/stickman/rectbutton.cpp @@ -0,0 +1,33 @@ +#include "rectbutton.h" +#include <QPainter> + +RectButton::RectButton(QString buttonText) : m_ButtonText(buttonText) +{ +} + + +RectButton::~RectButton() +{ +} + + +void RectButton::mousePressEvent (QGraphicsSceneMouseEvent *event) +{ + emit clicked(); +} + + +QRectF RectButton::boundingRect() const +{ + return QRectF(0.0, 0.0, 90.0, 40.0); +} + + +void RectButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + painter->setBrush(Qt::gray); + painter->drawRoundedRect(boundingRect(), 5, 5); + + painter->setPen(Qt::white); + painter->drawText(20, 25, m_ButtonText); +} diff --git a/examples/animation/stickman/rectbutton.h b/examples/animation/stickman/rectbutton.h new file mode 100644 index 0000000..95ca2e2 --- /dev/null +++ b/examples/animation/stickman/rectbutton.h @@ -0,0 +1,25 @@ +#ifndef RECTBUTTON_H +#define RECTBUTTON_H + +#include <QGraphicsObject> + +class RectButton : public QGraphicsObject +{ + Q_OBJECT +public: + RectButton(QString buttonText); + ~RectButton(); + + virtual QRectF boundingRect() const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + +protected: + QString m_ButtonText; + + virtual void mousePressEvent (QGraphicsSceneMouseEvent *event); + +signals: + void clicked(); +}; + +#endif // RECTBUTTON_H diff --git a/examples/animation/stickman/stickman.desktop b/examples/animation/stickman/stickman.desktop new file mode 100644 index 0000000..1722d4d --- /dev/null +++ b/examples/animation/stickman/stickman.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Stickman +Exec=/opt/usr/bin/stickman +Icon=stickman +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dbus/complexpingpong/complexping.desktop b/examples/dbus/complexpingpong/complexping.desktop new file mode 100644 index 0000000..0075856 --- /dev/null +++ b/examples/dbus/complexpingpong/complexping.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Complex Ping +Exec=/opt/usr/bin/complexping +Icon=complexping +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dbus/complexpingpong/complexpong.desktop b/examples/dbus/complexpingpong/complexpong.desktop new file mode 100644 index 0000000..2af77c5 --- /dev/null +++ b/examples/dbus/complexpingpong/complexpong.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Complex Pong +Exec=/opt/usr/bin/complexpong +Icon=complexpong +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dbus/dbus-chat/dbus-chat.desktop b/examples/dbus/dbus-chat/dbus-chat.desktop new file mode 100644 index 0000000..d25c82e --- /dev/null +++ b/examples/dbus/dbus-chat/dbus-chat.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=D-Bus Chat +Exec=/opt/usr/bin/dbus-chat +Icon=dbus-chat +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dbus/listnames/listnames.desktop b/examples/dbus/listnames/listnames.desktop new file mode 100644 index 0000000..4b2047f --- /dev/null +++ b/examples/dbus/listnames/listnames.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=D-Bus List Names +Exec=/opt/usr/bin/listnames +Icon=listnames +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dbus/pingpong/ping.desktop b/examples/dbus/pingpong/ping.desktop new file mode 100644 index 0000000..b80ea88 --- /dev/null +++ b/examples/dbus/pingpong/ping.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=D-Bus Ping +Exec=/opt/usr/bin/ping +Icon=ping +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dbus/pingpong/pong.desktop b/examples/dbus/pingpong/pong.desktop new file mode 100644 index 0000000..4b5ddc8 --- /dev/null +++ b/examples/dbus/pingpong/pong.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=D-Bus Pong +Exec=/opt/usr/bin/pong +Icon=pong +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dbus/remotecontrolledcar/car/car.desktop b/examples/dbus/remotecontrolledcar/car/car.desktop new file mode 100644 index 0000000..ab2c53b --- /dev/null +++ b/examples/dbus/remotecontrolledcar/car/car.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=D-Bus Remote Controlled Car +Exec=/opt/usr/bin/car +Icon=car +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dbus/remotecontrolledcar/controller/controller.desktop b/examples/dbus/remotecontrolledcar/controller/controller.desktop new file mode 100644 index 0000000..1ae6aa1 --- /dev/null +++ b/examples/dbus/remotecontrolledcar/controller/controller.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=D-Bus Remote Controller +Exec=/opt/usr/bin/controller +Icon=controller +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/animation/basics/color-animation/coloranimation.desktop b/examples/declarative/animation/basics/color-animation/coloranimation.desktop new file mode 100644 index 0000000..b6df2d0 --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/coloranimation.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=color-animation +Exec=/opt/usr/bin/color-animation +Icon=color-animation +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/animation/basics/color-animation/coloranimation.png b/examples/declarative/animation/basics/color-animation/coloranimation.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/coloranimation.png diff --git a/examples/declarative/animation/basics/color-animation/coloranimation.pro b/examples/declarative/animation/basics/color-animation/coloranimation.pro new file mode 100644 index 0000000..c8f6297 --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/coloranimation.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE959F610 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/animation/basics/color-animation/coloranimation.svg b/examples/declarative/animation/basics/color-animation/coloranimation.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/coloranimation.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/animation/basics/color-animation/main.cpp b/examples/declarative/animation/basics/color-animation/main.cpp new file mode 100644 index 0000000..1bf8fc2 --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/color-animation.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/animation/basics/color-animation/qml/basics.qmlproject b/examples/declarative/animation/basics/color-animation/qml/basics.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/qml/basics.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/animation/basics/color-animation/qml/color-animation.qml b/examples/declarative/animation/basics/color-animation/qml/color-animation.qml new file mode 100644 index 0000000..809f391 --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/qml/color-animation.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import Qt.labs.particles 1.0 + +Item { + id: window + width: 640; height: 480 + + // Let's draw the sky... + Rectangle { + anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter } + gradient: Gradient { + GradientStop { + position: 0.0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { from: "DeepSkyBlue"; to: "#0E1533"; duration: 5000 } + ColorAnimation { from: "#0E1533"; to: "DeepSkyBlue"; duration: 5000 } + } + } + GradientStop { + position: 1.0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { from: "SkyBlue"; to: "#437284"; duration: 5000 } + ColorAnimation { from: "#437284"; to: "SkyBlue"; duration: 5000 } + } + } + } + } + + // the sun, moon, and stars + Item { + width: parent.width; height: 2 * parent.height + NumberAnimation on rotation { from: 0; to: 360; duration: 10000; loops: Animation.Infinite } + Image { + source: "images/sun.png"; y: 10; anchors.horizontalCenter: parent.horizontalCenter + rotation: -3 * parent.rotation + } + Image { + source: "images/moon.png"; y: parent.height - 74; anchors.horizontalCenter: parent.horizontalCenter + rotation: -parent.rotation + } + Particles { + x: 0; y: parent.height/2; width: parent.width; height: parent.height/2 + source: "images/star.png"; angleDeviation: 360; velocity: 0 + velocityDeviation: 0; count: parent.width / 10; fadeInDuration: 2800 + SequentialAnimation on opacity { + loops: Animation.Infinite + NumberAnimation { from: 0; to: 1; duration: 5000 } + NumberAnimation { from: 1; to: 0; duration: 5000 } + } + } + } + + // ...and the ground. + Rectangle { + anchors { left: parent.left; top: parent.verticalCenter; right: parent.right; bottom: parent.bottom } + gradient: Gradient { + GradientStop { + position: 0.0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { from: "ForestGreen"; to: "#001600"; duration: 5000 } + ColorAnimation { from: "#001600"; to: "ForestGreen"; duration: 5000 } + } + } + GradientStop { position: 1.0; color: "DarkGreen" } + } + } +} diff --git a/examples/declarative/animation/basics/color-animation/qml/images/face-smile.png b/examples/declarative/animation/basics/color-animation/qml/images/face-smile.png Binary files differnew file mode 100644 index 0000000..3d66d72 --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/qml/images/face-smile.png diff --git a/examples/declarative/animation/basics/color-animation/qml/images/moon.png b/examples/declarative/animation/basics/color-animation/qml/images/moon.png Binary files differnew file mode 100644 index 0000000..9407b2b --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/qml/images/moon.png diff --git a/examples/declarative/animation/basics/color-animation/qml/images/shadow.png b/examples/declarative/animation/basics/color-animation/qml/images/shadow.png Binary files differnew file mode 100644 index 0000000..8270565 --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/qml/images/shadow.png diff --git a/examples/declarative/animation/basics/color-animation/qml/images/star.png b/examples/declarative/animation/basics/color-animation/qml/images/star.png Binary files differnew file mode 100644 index 0000000..27ef924 --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/qml/images/star.png diff --git a/examples/declarative/animation/basics/color-animation/qml/images/sun.png b/examples/declarative/animation/basics/color-animation/qml/images/sun.png Binary files differnew file mode 100644 index 0000000..7713ca5 --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/qml/images/sun.png diff --git a/examples/declarative/animation/basics/color-animation/qml/property-animation.qml b/examples/declarative/animation/basics/color-animation/qml/property-animation.qml new file mode 100644 index 0000000..0a5b353 --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/qml/property-animation.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: window + width: 320; height: 480 + + // Let's draw the sky... + Rectangle { + anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter } + gradient: Gradient { + GradientStop { position: 0.0; color: "DeepSkyBlue" } + GradientStop { position: 1.0; color: "LightSkyBlue" } + } + } + + // ...and the ground. + Rectangle { + anchors { left: parent.left; top: parent.verticalCenter; right: parent.right; bottom: parent.bottom } + gradient: Gradient { + GradientStop { position: 0.0; color: "ForestGreen" } + GradientStop { position: 1.0; color: "DarkGreen" } + } + } + + // The shadow for the smiley face + Image { + anchors.horizontalCenter: parent.horizontalCenter + y: smiley.minHeight + 58 + source: "images/shadow.png" + + // The scale property depends on the y position of the smiley face. + scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight) + } + + Image { + id: smiley + property int maxHeight: window.height / 3 + property int minHeight: 2 * window.height / 3 + + anchors.horizontalCenter: parent.horizontalCenter + y: minHeight + source: "images/face-smile.png" + + // Animate the y property. Setting loops to Animation.Infinite makes the + // animation repeat indefinitely, otherwise it would only run once. + SequentialAnimation on y { + loops: Animation.Infinite + + // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function + NumberAnimation { + from: smiley.minHeight; to: smiley.maxHeight + easing.type: Easing.OutExpo; duration: 300 + } + + // Then move back to minHeight in 1 second, using the OutBounce easing function + NumberAnimation { + from: smiley.maxHeight; to: smiley.minHeight + easing.type: Easing.OutBounce; duration: 1000 + } + + // Then pause for 500ms + PauseAnimation { duration: 500 } + } + } +} diff --git a/examples/declarative/animation/basics/color-animation/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/animation/basics/color-animation/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/animation/basics/color-animation/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/animation/basics/color-animation/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/animation/basics/color-animation/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/animation/basics/color-animation/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/animation/basics/color-animation/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/animation/basics/property-animation/main.cpp b/examples/declarative/animation/basics/property-animation/main.cpp new file mode 100644 index 0000000..6ae8859 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/property-animation.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/animation/basics/property-animation/propertyanimation.desktop b/examples/declarative/animation/basics/property-animation/propertyanimation.desktop new file mode 100644 index 0000000..6155c2f --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/propertyanimation.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=property-animation +Exec=/opt/usr/bin/property-animation +Icon=property-animation +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/animation/basics/property-animation/propertyanimation.png b/examples/declarative/animation/basics/property-animation/propertyanimation.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/propertyanimation.png diff --git a/examples/declarative/animation/basics/property-animation/propertyanimation.pro b/examples/declarative/animation/basics/property-animation/propertyanimation.pro new file mode 100644 index 0000000..97eb86c --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/propertyanimation.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE4032BC6 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/animation/basics/property-animation/propertyanimation.svg b/examples/declarative/animation/basics/property-animation/propertyanimation.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/propertyanimation.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/animation/basics/property-animation/qml/basics.qmlproject b/examples/declarative/animation/basics/property-animation/qml/basics.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qml/basics.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/animation/basics/property-animation/qml/color-animation.qml b/examples/declarative/animation/basics/property-animation/qml/color-animation.qml new file mode 100644 index 0000000..809f391 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qml/color-animation.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import Qt.labs.particles 1.0 + +Item { + id: window + width: 640; height: 480 + + // Let's draw the sky... + Rectangle { + anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter } + gradient: Gradient { + GradientStop { + position: 0.0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { from: "DeepSkyBlue"; to: "#0E1533"; duration: 5000 } + ColorAnimation { from: "#0E1533"; to: "DeepSkyBlue"; duration: 5000 } + } + } + GradientStop { + position: 1.0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { from: "SkyBlue"; to: "#437284"; duration: 5000 } + ColorAnimation { from: "#437284"; to: "SkyBlue"; duration: 5000 } + } + } + } + } + + // the sun, moon, and stars + Item { + width: parent.width; height: 2 * parent.height + NumberAnimation on rotation { from: 0; to: 360; duration: 10000; loops: Animation.Infinite } + Image { + source: "images/sun.png"; y: 10; anchors.horizontalCenter: parent.horizontalCenter + rotation: -3 * parent.rotation + } + Image { + source: "images/moon.png"; y: parent.height - 74; anchors.horizontalCenter: parent.horizontalCenter + rotation: -parent.rotation + } + Particles { + x: 0; y: parent.height/2; width: parent.width; height: parent.height/2 + source: "images/star.png"; angleDeviation: 360; velocity: 0 + velocityDeviation: 0; count: parent.width / 10; fadeInDuration: 2800 + SequentialAnimation on opacity { + loops: Animation.Infinite + NumberAnimation { from: 0; to: 1; duration: 5000 } + NumberAnimation { from: 1; to: 0; duration: 5000 } + } + } + } + + // ...and the ground. + Rectangle { + anchors { left: parent.left; top: parent.verticalCenter; right: parent.right; bottom: parent.bottom } + gradient: Gradient { + GradientStop { + position: 0.0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { from: "ForestGreen"; to: "#001600"; duration: 5000 } + ColorAnimation { from: "#001600"; to: "ForestGreen"; duration: 5000 } + } + } + GradientStop { position: 1.0; color: "DarkGreen" } + } + } +} diff --git a/examples/declarative/animation/basics/property-animation/qml/images/face-smile.png b/examples/declarative/animation/basics/property-animation/qml/images/face-smile.png Binary files differnew file mode 100644 index 0000000..3d66d72 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qml/images/face-smile.png diff --git a/examples/declarative/animation/basics/property-animation/qml/images/moon.png b/examples/declarative/animation/basics/property-animation/qml/images/moon.png Binary files differnew file mode 100644 index 0000000..9407b2b --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qml/images/moon.png diff --git a/examples/declarative/animation/basics/property-animation/qml/images/shadow.png b/examples/declarative/animation/basics/property-animation/qml/images/shadow.png Binary files differnew file mode 100644 index 0000000..8270565 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qml/images/shadow.png diff --git a/examples/declarative/animation/basics/property-animation/qml/images/star.png b/examples/declarative/animation/basics/property-animation/qml/images/star.png Binary files differnew file mode 100644 index 0000000..27ef924 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qml/images/star.png diff --git a/examples/declarative/animation/basics/property-animation/qml/images/sun.png b/examples/declarative/animation/basics/property-animation/qml/images/sun.png Binary files differnew file mode 100644 index 0000000..7713ca5 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qml/images/sun.png diff --git a/examples/declarative/animation/basics/property-animation/qml/property-animation.qml b/examples/declarative/animation/basics/property-animation/qml/property-animation.qml new file mode 100644 index 0000000..0a5b353 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qml/property-animation.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: window + width: 320; height: 480 + + // Let's draw the sky... + Rectangle { + anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter } + gradient: Gradient { + GradientStop { position: 0.0; color: "DeepSkyBlue" } + GradientStop { position: 1.0; color: "LightSkyBlue" } + } + } + + // ...and the ground. + Rectangle { + anchors { left: parent.left; top: parent.verticalCenter; right: parent.right; bottom: parent.bottom } + gradient: Gradient { + GradientStop { position: 0.0; color: "ForestGreen" } + GradientStop { position: 1.0; color: "DarkGreen" } + } + } + + // The shadow for the smiley face + Image { + anchors.horizontalCenter: parent.horizontalCenter + y: smiley.minHeight + 58 + source: "images/shadow.png" + + // The scale property depends on the y position of the smiley face. + scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight) + } + + Image { + id: smiley + property int maxHeight: window.height / 3 + property int minHeight: 2 * window.height / 3 + + anchors.horizontalCenter: parent.horizontalCenter + y: minHeight + source: "images/face-smile.png" + + // Animate the y property. Setting loops to Animation.Infinite makes the + // animation repeat indefinitely, otherwise it would only run once. + SequentialAnimation on y { + loops: Animation.Infinite + + // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function + NumberAnimation { + from: smiley.minHeight; to: smiley.maxHeight + easing.type: Easing.OutExpo; duration: 300 + } + + // Then move back to minHeight in 1 second, using the OutBounce easing function + NumberAnimation { + from: smiley.maxHeight; to: smiley.minHeight + easing.type: Easing.OutBounce; duration: 1000 + } + + // Then pause for 500ms + PauseAnimation { duration: 500 } + } + } +} diff --git a/examples/declarative/animation/basics/property-animation/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/animation/basics/property-animation/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/animation/basics/property-animation/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/animation/basics/property-animation/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/animation/basics/property-animation/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/animation/basics/property-animation/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/README b/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/README new file mode 100644 index 0000000..3f1e89d --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/README @@ -0,0 +1,6 @@ +The Debian Package propertyanimation +---------------------------- + +Comments regarding the Package + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 16:22:35 +0100 diff --git a/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/changelog b/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/changelog new file mode 100644 index 0000000..4e1c4df --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/changelog @@ -0,0 +1,5 @@ +propertyanimation (0.0.1) unstable; urgency=low + + * Initial Release. + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 16:22:35 +0100 diff --git a/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/compat b/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/compat @@ -0,0 +1 @@ +7 diff --git a/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/control b/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/control new file mode 100644 index 0000000..cc2e5ef --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/control @@ -0,0 +1,13 @@ +Source: propertyanimation +Section: user/hidden +Priority: optional +Maintainer: Daniel Molkentin <danimo@unknown> +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: <insert the upstream URL, if relevant> + +Package: propertyanimation +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: <insert up to 60 chars description> + <insert long description, indented with spaces> diff --git a/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/copyright b/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/copyright new file mode 100644 index 0000000..e197e37 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/copyright @@ -0,0 +1,40 @@ +This package was debianized by Daniel Molkentin <danimo@unknown> on +Thu, 18 Nov 2010 16:22:35 +0100. + +It was downloaded from <url://example.com> + +Upstream Author(s): + + <put author's name and email here> + <likewise for another author> + +Copyright: + + <Copyright (C) YYYY Name OfAuthor> + <likewise for another author> + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2010, Daniel Molkentin <danimo@unknown> and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/rules b/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/rules new file mode 100755 index 0000000..e838932 --- /dev/null +++ b/examples/declarative/animation/basics/property-animation/qtc_packaging/debian_fremantle/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/propertyanimation.sgml > propertyanimation.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/propertyanimation. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/propertyanimation install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + # dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/examples/declarative/animation/behaviors/behavior-example/behaviorexample.desktop b/examples/declarative/animation/behaviors/behavior-example/behaviorexample.desktop new file mode 100644 index 0000000..95af017 --- /dev/null +++ b/examples/declarative/animation/behaviors/behavior-example/behaviorexample.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=behavior-example +Exec=/opt/usr/bin/behavior-example +Icon=behavior-example +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/animation/behaviors/behavior-example/behaviorexample.png b/examples/declarative/animation/behaviors/behavior-example/behaviorexample.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/animation/behaviors/behavior-example/behaviorexample.png diff --git a/examples/declarative/animation/behaviors/behavior-example/behaviorexample.pro b/examples/declarative/animation/behaviors/behavior-example/behaviorexample.pro new file mode 100644 index 0000000..1bda064 --- /dev/null +++ b/examples/declarative/animation/behaviors/behavior-example/behaviorexample.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEB6022A4 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/animation/behaviors/behavior-example/behaviorexample.svg b/examples/declarative/animation/behaviors/behavior-example/behaviorexample.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/animation/behaviors/behavior-example/behaviorexample.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/animation/behaviors/behavior-example/main.cpp b/examples/declarative/animation/behaviors/behavior-example/main.cpp new file mode 100644 index 0000000..5797077 --- /dev/null +++ b/examples/declarative/animation/behaviors/behavior-example/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/behavior-example.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/animation/behaviors/behavior-example/qml/SideRect.qml b/examples/declarative/animation/behaviors/behavior-example/qml/SideRect.qml new file mode 100644 index 0000000..9517421 --- /dev/null +++ b/examples/declarative/animation/behaviors/behavior-example/qml/SideRect.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: myRect + + property string text + + width: 75; height: 50 + radius: 6 + color: "#646464" + border.width: 4; border.color: "white" + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + focusRect.x = myRect.x; + focusRect.y = myRect.y; + focusRect.text = myRect.text; + } + } +} diff --git a/examples/declarative/animation/behaviors/behavior-example/qml/behavior-example.qml b/examples/declarative/animation/behaviors/behavior-example/qml/behavior-example.qml new file mode 100644 index 0000000..3e050ab --- /dev/null +++ b/examples/declarative/animation/behaviors/behavior-example/qml/behavior-example.qml @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 600; height: 400 + color: "#343434" + + Rectangle { + anchors.centerIn: parent + width: 200; height: 200 + radius: 30 + color: "transparent" + border.width: 4; border.color: "white" + + + SideRect { + id: leftRect + anchors { verticalCenter: parent.verticalCenter; horizontalCenter: parent.left } + text: "Left" + } + + SideRect { + id: rightRect + anchors { verticalCenter: parent.verticalCenter; horizontalCenter: parent.right } + text: "Right" + } + + SideRect { + id: topRect + anchors { verticalCenter: parent.top; horizontalCenter: parent.horizontalCenter } + text: "Top" + } + + SideRect { + id: bottomRect + anchors { verticalCenter: parent.bottom; horizontalCenter: parent.horizontalCenter } + text: "Bottom" + } + + + Rectangle { + id: focusRect + + property string text + + x: 62; y: 75; width: 75; height: 50 + radius: 6 + border.width: 4; border.color: "white" + color: "firebrick" + + // Set an 'elastic' behavior on the focusRect's x property. + Behavior on x { + NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 } + } + + // Set an 'elastic' behavior on the focusRect's y property. + Behavior on y { + NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 } + } + + Text { + id: focusText + text: focusRect.text + anchors.centerIn: parent + color: "white" + font.pixelSize: 16; font.bold: true + + // Set a behavior on the focusText's x property: + // Set the opacity to 0, set the new text value, then set the opacity back to 1. + Behavior on text { + SequentialAnimation { + NumberAnimation { target: focusText; property: "opacity"; to: 0; duration: 150 } + NumberAnimation { target: focusText; property: "opacity"; to: 1; duration: 150 } + } + } + } + } + } +} diff --git a/examples/declarative/animation/behaviors/behavior-example/qml/behaviors.qmlproject b/examples/declarative/animation/behaviors/behavior-example/qml/behaviors.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/animation/behaviors/behavior-example/qml/behaviors.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/animation/behaviors/behavior-example/qml/wigglytext.qml b/examples/declarative/animation/behaviors/behavior-example/qml/wigglytext.qml new file mode 100644 index 0000000..6cd93ab --- /dev/null +++ b/examples/declarative/animation/behaviors/behavior-example/qml/wigglytext.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: container + + property string text: "Drag this text..." + property bool animated: true + + width: 640; height: 480; color: "#474747"; focus: true + + Keys.onPressed: { + if (event.key == Qt.Key_Delete || event.key == Qt.Key_Backspace) + container.remove() + else if (event.text != "") { + container.append(event.text) + } + } + + function append(text) { + container.animated = false + var lastLetter = container.children[container.children.length - 1] + var newLetter = letterComponent.createObject(container) + newLetter.text = text + newLetter.follow = lastLetter + container.animated = true + } + + function remove() { + if (container.children.length) + container.children[container.children.length - 1].destroy() + } + + function doLayout() { + var follow = null + for (var i = 0; i < container.text.length; ++i) { + var newLetter = letterComponent.createObject(container) + newLetter.text = container.text[i] + newLetter.follow = follow + follow = newLetter + } + } + + Component { + id: letterComponent + Text { + id: letter + property variant follow + + x: follow ? follow.x + follow.width : container.width / 3 + y: follow ? follow.y : container.height / 2 + + font.pixelSize: 40; font.bold: true + color: "#999999"; styleColor: "#222222"; style: Text.Raised + + MouseArea { + anchors.fill: parent + drag.target: letter; drag.axis: Drag.XandYAxis + onPressed: letter.color = "#dddddd" + onReleased: letter.color = "#999999" + } + + Behavior on x { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } } + Behavior on y { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } } + } + } + + Component.onCompleted: doLayout() +} diff --git a/examples/declarative/animation/behaviors/behavior-example/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/animation/behaviors/behavior-example/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/animation/behaviors/behavior-example/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/animation/behaviors/behavior-example/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/animation/behaviors/behavior-example/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/animation/behaviors/behavior-example/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/animation/behaviors/behavior-example/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/animation/behaviors/behavior-example/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/animation/behaviors/behavior-example/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/animation/easing/easing.desktop b/examples/declarative/animation/easing/easing.desktop new file mode 100644 index 0000000..56437b5 --- /dev/null +++ b/examples/declarative/animation/easing/easing.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=easing +Exec=/opt/usr/bin/easing +Icon=easing +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/animation/easing/easing.png b/examples/declarative/animation/easing/easing.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/animation/easing/easing.png diff --git a/examples/declarative/animation/easing/easing.pro b/examples/declarative/animation/easing/easing.pro new file mode 100644 index 0000000..3273d9f --- /dev/null +++ b/examples/declarative/animation/easing/easing.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEAA54148 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/animation/easing/easing.svg b/examples/declarative/animation/easing/easing.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/animation/easing/easing.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/animation/easing/main.cpp b/examples/declarative/animation/easing/main.cpp new file mode 100644 index 0000000..084c83a --- /dev/null +++ b/examples/declarative/animation/easing/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/easing.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/animation/easing/qml/content/QuitButton.qml b/examples/declarative/animation/easing/qml/content/QuitButton.qml new file mode 100644 index 0000000..cbbf916 --- /dev/null +++ b/examples/declarative/animation/easing/qml/content/QuitButton.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +Image { + source: "quit.png" + scale: quitMouse.pressed ? 0.8 : 1.0 + smooth: quitMouse.pressed + MouseArea { + id: quitMouse + anchors.fill: parent + anchors.margins: -10 + onClicked: Qt.quit() + } +} diff --git a/examples/declarative/animation/easing/qml/content/quit.png b/examples/declarative/animation/easing/qml/content/quit.png Binary files differnew file mode 100644 index 0000000..b822057 --- /dev/null +++ b/examples/declarative/animation/easing/qml/content/quit.png diff --git a/examples/declarative/animation/easing/qml/easing.qml b/examples/declarative/animation/easing/qml/easing.qml new file mode 100644 index 0000000..fd974d9 --- /dev/null +++ b/examples/declarative/animation/easing/qml/easing.qml @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: window + width: 600; height: 460; color: "#232323" + + ListModel { + id: easingTypes + ListElement { name: "Easing.Linear"; type: Easing.Linear; ballColor: "DarkRed" } + ListElement { name: "Easing.InQuad"; type: Easing.InQuad; ballColor: "IndianRed" } + ListElement { name: "Easing.OutQuad"; type: Easing.OutQuad; ballColor: "Salmon" } + ListElement { name: "Easing.InOutQuad"; type: Easing.InOutQuad; ballColor: "Tomato" } + ListElement { name: "Easing.OutInQuad"; type: Easing.OutInQuad; ballColor: "DarkOrange" } + ListElement { name: "Easing.InCubic"; type: Easing.InCubic; ballColor: "Gold" } + ListElement { name: "Easing.OutCubic"; type: Easing.OutCubic; ballColor: "Yellow" } + ListElement { name: "Easing.InOutCubic"; type: Easing.InOutCubic; ballColor: "PeachPuff" } + ListElement { name: "Easing.OutInCubic"; type: Easing.OutInCubic; ballColor: "Thistle" } + ListElement { name: "Easing.InQuart"; type: Easing.InQuart; ballColor: "Orchid" } + ListElement { name: "Easing.OutQuart"; type: Easing.OutQuart; ballColor: "Purple" } + ListElement { name: "Easing.InOutQuart"; type: Easing.InOutQuart; ballColor: "SlateBlue" } + ListElement { name: "Easing.OutInQuart"; type: Easing.OutInQuart; ballColor: "Chartreuse" } + ListElement { name: "Easing.InQuint"; type: Easing.InQuint; ballColor: "LimeGreen" } + ListElement { name: "Easing.OutQuint"; type: Easing.OutQuint; ballColor: "SeaGreen" } + ListElement { name: "Easing.InOutQuint"; type: Easing.InOutQuint; ballColor: "DarkGreen" } + ListElement { name: "Easing.OutInQuint"; type: Easing.OutInQuint; ballColor: "Olive" } + ListElement { name: "Easing.InSine"; type: Easing.InSine; ballColor: "DarkSeaGreen" } + ListElement { name: "Easing.OutSine"; type: Easing.OutSine; ballColor: "Teal" } + ListElement { name: "Easing.InOutSine"; type: Easing.InOutSine; ballColor: "Turquoise" } + ListElement { name: "Easing.OutInSine"; type: Easing.OutInSine; ballColor: "SteelBlue" } + ListElement { name: "Easing.InExpo"; type: Easing.InExpo; ballColor: "SkyBlue" } + ListElement { name: "Easing.OutExpo"; type: Easing.OutExpo; ballColor: "RoyalBlue" } + ListElement { name: "Easing.InOutExpo"; type: Easing.InOutExpo; ballColor: "MediumBlue" } + ListElement { name: "Easing.OutInExpo"; type: Easing.OutInExpo; ballColor: "MidnightBlue" } + ListElement { name: "Easing.InCirc"; type: Easing.InCirc; ballColor: "CornSilk" } + ListElement { name: "Easing.OutCirc"; type: Easing.OutCirc; ballColor: "Bisque" } + ListElement { name: "Easing.InOutCirc"; type: Easing.InOutCirc; ballColor: "RosyBrown" } + ListElement { name: "Easing.OutInCirc"; type: Easing.OutInCirc; ballColor: "SandyBrown" } + ListElement { name: "Easing.InElastic"; type: Easing.InElastic; ballColor: "DarkGoldenRod" } + ListElement { name: "Easing.OutElastic"; type: Easing.OutElastic; ballColor: "Chocolate" } + ListElement { name: "Easing.InOutElastic"; type: Easing.InOutElastic; ballColor: "SaddleBrown" } + ListElement { name: "Easing.OutInElastic"; type: Easing.OutInElastic; ballColor: "Brown" } + ListElement { name: "Easing.InBack"; type: Easing.InBack; ballColor: "Maroon" } + ListElement { name: "Easing.OutBack"; type: Easing.OutBack; ballColor: "LavenderBlush" } + ListElement { name: "Easing.InOutBack"; type: Easing.InOutBack; ballColor: "MistyRose" } + ListElement { name: "Easing.OutInBack"; type: Easing.OutInBack; ballColor: "Gainsboro" } + ListElement { name: "Easing.OutBounce"; type: Easing.OutBounce; ballColor: "Silver" } + ListElement { name: "Easing.InBounce"; type: Easing.InBounce; ballColor: "DimGray" } + ListElement { name: "Easing.InOutBounce"; type: Easing.InOutBounce; ballColor: "SlateGray" } + ListElement { name: "Easing.OutInBounce"; type: Easing.OutInBounce; ballColor: "DarkSlateGray" } + } + + Component { + id: delegate + + Item { + height: 56; width: window.width + + Text { text: name; anchors.centerIn: parent; color: "White" } + + Rectangle { + id: slot1; color: "#121212"; x: 30; height: 46; width: 46 + border.color: "#343434"; border.width: 1; radius: 12 + anchors.verticalCenter: parent.verticalCenter + } + + Rectangle { + id: slot2; color: "#121212"; x: window.width - 76; height: 46; width: 46 + border.color: "#343434"; border.width: 1; radius: 12 + anchors.verticalCenter: parent.verticalCenter + } + + Rectangle { + id: rect; x: 30; color: "#454545" + border.color: "White"; border.width: 2 + height: 46; width: 46; radius: 12 + anchors.verticalCenter: parent.verticalCenter + + MouseArea { + onClicked: if (rect.state == '') rect.state = "right"; else rect.state = '' + anchors.fill: parent + anchors.margins: -5 // Make MouseArea bigger than the rectangle, itself + } + + states : State { + name: "right" + PropertyChanges { target: rect; x: window.width - 76; color: ballColor } + } + + transitions: Transition { + NumberAnimation { properties: "x"; easing.type: type; duration: 1000 } + ColorAnimation { properties: "color"; easing.type: type; duration: 1000 } + } + } + } + } + + Flickable { + anchors.fill: parent + contentHeight: layout.height+50 + Rectangle { + id: titlePane + color: "#444444" + height: 35 + anchors { top: parent.top; left: parent.left; right: parent.right } + QuitButton { + id: quitButton + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 10 + } + } + Column { + id: layout + anchors { top: titlePane.bottom; topMargin: 10; left: parent.left; right: parent.right } + Repeater { model: easingTypes; delegate: delegate } + } + } +} diff --git a/examples/declarative/animation/easing/qml/easing.qmlproject b/examples/declarative/animation/easing/qml/easing.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/animation/easing/qml/easing.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/animation/easing/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/animation/easing/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/animation/easing/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/animation/easing/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/animation/easing/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/animation/easing/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/animation/easing/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/animation/easing/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/animation/easing/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/animation/states/main.cpp b/examples/declarative/animation/states/main.cpp new file mode 100644 index 0000000..fec4662 --- /dev/null +++ b/examples/declarative/animation/states/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/states.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/animation/states/qml/qt-logo.png b/examples/declarative/animation/states/qml/qt-logo.png Binary files differnew file mode 100644 index 0000000..14ddf2a --- /dev/null +++ b/examples/declarative/animation/states/qml/qt-logo.png diff --git a/examples/declarative/animation/states/qml/states.qml b/examples/declarative/animation/states/qml/states.qml new file mode 100644 index 0000000..a9046eb --- /dev/null +++ b/examples/declarative/animation/states/qml/states.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: page + width: 640; height: 480 + color: "#343434" + + Image { + id: userIcon + x: topLeftRect.x; y: topLeftRect.y + source: "qt-logo.png" + } + + Rectangle { + id: topLeftRect + + anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to the default state, returning the image to + // its initial position + MouseArea { anchors.fill: parent; onClicked: page.state = '' } + } + + Rectangle { + id: middleRightRect + + anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to 'middleRight' + MouseArea { anchors.fill: parent; onClicked: page.state = 'middleRight' } + } + + Rectangle { + id: bottomLeftRect + + anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to 'bottomLeft' + MouseArea { anchors.fill: parent; onClicked: page.state = 'bottomLeft' } + } + + states: [ + // In state 'middleRight', move the image to middleRightRect + State { + name: "middleRight" + PropertyChanges { target: userIcon; x: middleRightRect.x; y: middleRightRect.y } + }, + + // In state 'bottomLeft', move the image to bottomLeftRect + State { + name: "bottomLeft" + PropertyChanges { target: userIcon; x: bottomLeftRect.x; y: bottomLeftRect.y } + } + ] +} diff --git a/examples/declarative/animation/states/qml/states.qmlproject b/examples/declarative/animation/states/qml/states.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/animation/states/qml/states.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/animation/states/qml/transitions.qml b/examples/declarative/animation/states/qml/transitions.qml new file mode 100644 index 0000000..ea73b82 --- /dev/null +++ b/examples/declarative/animation/states/qml/transitions.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +/* + This is exactly the same as states.qml, except that we have appended + a set of transitions to apply animations when the item changes + between each state. +*/ + +Rectangle { + id: page + width: 640; height: 480 + color: "#343434" + + Image { + id: userIcon + x: topLeftRect.x; y: topLeftRect.y + source: "qt-logo.png" + } + + Rectangle { + id: topLeftRect + + anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to the default state, returning the image to + // its initial position + MouseArea { anchors.fill: parent; onClicked: page.state = '' } + } + + Rectangle { + id: middleRightRect + + anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to 'middleRight' + MouseArea { anchors.fill: parent; onClicked: page.state = 'middleRight' } + } + + Rectangle { + id: bottomLeftRect + + anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to 'bottomLeft' + MouseArea { anchors.fill: parent; onClicked: page.state = 'bottomLeft' } + } + + states: [ + // In state 'middleRight', move the image to middleRightRect + State { + name: "middleRight" + PropertyChanges { target: userIcon; x: middleRightRect.x; y: middleRightRect.y } + }, + + // In state 'bottomLeft', move the image to bottomLeftRect + State { + name: "bottomLeft" + PropertyChanges { target: userIcon; x: bottomLeftRect.x; y: bottomLeftRect.y } + } + ] + + // Transitions define how the properties change when the item moves between each state + transitions: [ + + // When transitioning to 'middleRight' move x,y over a duration of 1 second, + // with OutBounce easing function. + Transition { + from: "*"; to: "middleRight" + NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce; duration: 1000 } + }, + + // When transitioning to 'bottomLeft' move x,y over a duration of 2 seconds, + // with InOutQuad easing function. + Transition { + from: "*"; to: "bottomLeft" + NumberAnimation { properties: "x,y"; easing.type: Easing.InOutQuad; duration: 2000 } + }, + + // For any other state changes move x,y linearly over duration of 200ms. + Transition { + NumberAnimation { properties: "x,y"; duration: 200 } + } + ] +} diff --git a/examples/declarative/animation/states/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/animation/states/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/animation/states/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/animation/states/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/animation/states/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/animation/states/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/animation/states/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/animation/states/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/animation/states/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/animation/states/states.desktop b/examples/declarative/animation/states/states.desktop new file mode 100644 index 0000000..31eb8d5 --- /dev/null +++ b/examples/declarative/animation/states/states.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=states +Exec=/opt/usr/bin/states +Icon=states +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/animation/states/states.png b/examples/declarative/animation/states/states.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/animation/states/states.png diff --git a/examples/declarative/animation/states/states.pro b/examples/declarative/animation/states/states.pro new file mode 100644 index 0000000..d25e7e4 --- /dev/null +++ b/examples/declarative/animation/states/states.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE9200E0A + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/animation/states/states.svg b/examples/declarative/animation/states/states.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/animation/states/states.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/demos/calculator/calculator.desktop b/examples/declarative/demos/calculator/calculator.desktop new file mode 100644 index 0000000..837d710 --- /dev/null +++ b/examples/declarative/demos/calculator/calculator.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=calculator +Exec=/opt/usr/bin/calculator +Icon=calculator +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/demos/calculator/calculator.png b/examples/declarative/demos/calculator/calculator.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/demos/calculator/calculator.png diff --git a/examples/declarative/demos/calculator/calculator.pro b/examples/declarative/demos/calculator/calculator.pro new file mode 100644 index 0000000..7e433ac --- /dev/null +++ b/examples/declarative/demos/calculator/calculator.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE187B2C4 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/demos/calculator/calculator.svg b/examples/declarative/demos/calculator/calculator.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/demos/calculator/calculator.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/demos/calculator/main.cpp b/examples/declarative/demos/calculator/main.cpp new file mode 100644 index 0000000..cf069b7 --- /dev/null +++ b/examples/declarative/demos/calculator/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/calculator.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/demos/calculator/qml/Core/Button.qml b/examples/declarative/demos/calculator/qml/Core/Button.qml new file mode 100644 index 0000000..f37de48 --- /dev/null +++ b/examples/declarative/demos/calculator/qml/Core/Button.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +BorderImage { + id: button + + property alias operation: buttonText.text + property string color: "" + + signal clicked + + source: "images/button-" + color + ".png"; clip: true + border { left: 10; top: 10; right: 10; bottom: 10 } + + Rectangle { + id: shade + anchors.fill: button; radius: 10; color: "black"; opacity: 0 + } + + Text { + id: buttonText + anchors.centerIn: parent; anchors.verticalCenterOffset: -1 + font.pixelSize: parent.width > parent.height ? parent.height * .5 : parent.width * .5 + style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true + } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { + doOp(operation) + button.clicked() + } + } + + states: State { + name: "pressed"; when: mouseArea.pressed == true + PropertyChanges { target: shade; opacity: .4 } + } +} diff --git a/examples/declarative/demos/calculator/qml/Core/Display.qml b/examples/declarative/demos/calculator/qml/Core/Display.qml new file mode 100644 index 0000000..f928d3a --- /dev/null +++ b/examples/declarative/demos/calculator/qml/Core/Display.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +BorderImage { + id: image + + property alias text : displayText.text + property alias currentOperation : operationText + + source: "images/display.png" + border { left: 10; top: 10; right: 10; bottom: 10 } + + Text { + id: displayText + anchors { + right: parent.right; verticalCenter: parent.verticalCenter; verticalCenterOffset: -1 + rightMargin: 6; left: operationText.right + } + font.pixelSize: parent.height * .6; text: "0"; horizontalAlignment: Text.AlignRight; elide: Text.ElideRight + color: "#343434"; smooth: true; font.bold: true + } + Text { + id: operationText + font.bold: true; font.pixelSize: parent.height * .7 + color: "#343434"; smooth: true + anchors { left: parent.left; leftMargin: 6; verticalCenterOffset: -3; verticalCenter: parent.verticalCenter } + } +} diff --git a/examples/declarative/demos/calculator/qml/Core/calculator.js b/examples/declarative/demos/calculator/qml/Core/calculator.js new file mode 100644 index 0000000..7c363c7 --- /dev/null +++ b/examples/declarative/demos/calculator/qml/Core/calculator.js @@ -0,0 +1,91 @@ + +var curVal = 0 +var memory = 0 +var lastOp = "" +var timer = 0 + +function disabled(op) { + if (op == "." && display.text.toString().search(/\./) != -1) { + return true + } else if (op == squareRoot && display.text.toString().search(/-/) != -1) { + return true + } else { + return false + } +} + +function doOperation(op) { + if (disabled(op)) { + return + } + + if (op.toString().length==1 && ((op >= "0" && op <= "9") || op==".") ) { + if (display.text.toString().length >= 14) + return; // No arbitrary length numbers + if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp == ".") ) { + display.text = display.text + op.toString() + } else { + display.text = op + } + lastOp = op + return + } + lastOp = op + + if (display.currentOperation.text == "+") { + display.text = Number(display.text.valueOf()) + Number(curVal.valueOf()) + } else if (display.currentOperation.text == "-") { + display.text = Number(curVal) - Number(display.text.valueOf()) + } else if (display.currentOperation.text == multiplication) { + display.text = Number(curVal) * Number(display.text.valueOf()) + } else if (display.currentOperation.text == division) { + display.text = Number(Number(curVal) / Number(display.text.valueOf())).toString() + } else if (display.currentOperation.text == "=") { + } + + if (op == "+" || op == "-" || op == multiplication || op == division) { + display.currentOperation.text = op + curVal = display.text.valueOf() + return + } + + curVal = 0 + display.currentOperation.text = "" + + if (op == "1/x") { + display.text = (1 / display.text.valueOf()).toString() + } else if (op == "x^2") { + display.text = (display.text.valueOf() * display.text.valueOf()).toString() + } else if (op == "Abs") { + display.text = (Math.abs(display.text.valueOf())).toString() + } else if (op == "Int") { + display.text = (Math.floor(display.text.valueOf())).toString() + } else if (op == plusminus) { + display.text = (display.text.valueOf() * -1).toString() + } else if (op == squareRoot) { + display.text = (Math.sqrt(display.text.valueOf())).toString() + } else if (op == "mc") { + memory = 0; + } else if (op == "m+") { + memory += display.text.valueOf() + } else if (op == "mr") { + display.text = memory.toString() + } else if (op == "m-") { + memory = display.text.valueOf() + } else if (op == leftArrow) { + display.text = display.text.toString().slice(0, -1) + if (display.text.length == 0) { + display.text = "0" + } + } else if (op == "Off") { + Qt.quit(); + } else if (op == "C") { + display.text = "0" + } else if (op == "AC") { + curVal = 0 + memory = 0 + lastOp = "" + display.text ="0" + } +} + diff --git a/examples/declarative/demos/calculator/qml/Core/images/button-.png b/examples/declarative/demos/calculator/qml/Core/images/button-.png Binary files differnew file mode 100644 index 0000000..544e514 --- /dev/null +++ b/examples/declarative/demos/calculator/qml/Core/images/button-.png diff --git a/examples/declarative/demos/calculator/qml/Core/images/button-blue.png b/examples/declarative/demos/calculator/qml/Core/images/button-blue.png Binary files differnew file mode 100644 index 0000000..5f92de3 --- /dev/null +++ b/examples/declarative/demos/calculator/qml/Core/images/button-blue.png diff --git a/examples/declarative/demos/calculator/qml/Core/images/button-green.png b/examples/declarative/demos/calculator/qml/Core/images/button-green.png Binary files differnew file mode 100644 index 0000000..36c9391 --- /dev/null +++ b/examples/declarative/demos/calculator/qml/Core/images/button-green.png diff --git a/examples/declarative/demos/calculator/qml/Core/images/button-purple.png b/examples/declarative/demos/calculator/qml/Core/images/button-purple.png Binary files differnew file mode 100644 index 0000000..347cbbe --- /dev/null +++ b/examples/declarative/demos/calculator/qml/Core/images/button-purple.png diff --git a/examples/declarative/demos/calculator/qml/Core/images/button-red.png b/examples/declarative/demos/calculator/qml/Core/images/button-red.png Binary files differnew file mode 100644 index 0000000..3b33589 --- /dev/null +++ b/examples/declarative/demos/calculator/qml/Core/images/button-red.png diff --git a/examples/declarative/demos/calculator/qml/Core/images/display.png b/examples/declarative/demos/calculator/qml/Core/images/display.png Binary files differnew file mode 100644 index 0000000..9507f43 --- /dev/null +++ b/examples/declarative/demos/calculator/qml/Core/images/display.png diff --git a/examples/declarative/demos/calculator/qml/Core/qmldir b/examples/declarative/demos/calculator/qml/Core/qmldir new file mode 100644 index 0000000..a926b93 --- /dev/null +++ b/examples/declarative/demos/calculator/qml/Core/qmldir @@ -0,0 +1,2 @@ +Button Button.qml +Display Display.qml diff --git a/examples/declarative/demos/calculator/qml/calculator.qml b/examples/declarative/demos/calculator/qml/calculator.qml new file mode 100644 index 0000000..3e1c650 --- /dev/null +++ b/examples/declarative/demos/calculator/qml/calculator.qml @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "Core" +import "Core/calculator.js" as CalcEngine + +Rectangle { + id: window + + width: 480; height: 360 + color: "#282828" + + property string rotateLeft: "\u2939" + property string rotateRight: "\u2935" + property string leftArrow: "\u2190" + property string division : "\u00f7" + property string multiplication : "\u00d7" + property string squareRoot : "\u221a" + property string plusminus : "\u00b1" + + function doOp(operation) { CalcEngine.doOperation(operation) } + + Item { + id: main + state: "orientation " + runtime.orientation + + width: parent.width; height: parent.height; anchors.centerIn: parent + + Column { + id: box; spacing: 8 + + anchors { fill: parent; topMargin: 6; bottomMargin: 6; leftMargin: 6; rightMargin: 6 } + + Display { + id: display + width: box.width-3 + height: 64 + } + + Column { + id: column; spacing: 6 + + property real h: ((box.height - 72) / 6) - ((spacing * (6 - 1)) / 6) + property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) + + Row { + spacing: 6 + Button { width: column.w; height: column.h; color: 'purple'; operation: "Off" } + Button { width: column.w; height: column.h; color: 'purple'; operation: leftArrow } + Button { width: column.w; height: column.h; color: 'purple'; operation: "C" } + Button { width: column.w; height: column.h; color: 'purple'; operation: "AC" } + } + + Row { + spacing: 6 + property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) + + Button { width: column.w; height: column.h; color: 'green'; operation: "mc" } + Button { width: column.w; height: column.h; color: 'green'; operation: "m+" } + Button { width: column.w; height: column.h; color: 'green'; operation: "m-" } + Button { width: column.w; height: column.h; color: 'green'; operation: "mr" } + } + + Grid { + id: grid; rows: 5; columns: 5; spacing: 6 + + property real w: (box.width / columns) - ((spacing * (columns - 1)) / columns) + + Button { width: grid.w; height: column.h; operation: "7"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "8"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "9"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: division } + Button { width: grid.w; height: column.h; operation: squareRoot } + Button { width: grid.w; height: column.h; operation: "4"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "5"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "6"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: multiplication } + Button { width: grid.w; height: column.h; operation: "x^2" } + Button { width: grid.w; height: column.h; operation: "1"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "2"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "3"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "-" } + Button { width: grid.w; height: column.h; operation: "1/x" } + Button { width: grid.w; height: column.h; operation: "0"; color: 'blue' } + Button { width: grid.w; height: column.h; operation: "." } + Button { width: grid.w; height: column.h; operation: plusminus } + Button { width: grid.w; height: column.h; operation: "+" } + Button { width: grid.w; height: column.h; operation: "="; color: 'red' } + } + } + } + + states: [ + State { + name: "orientation " + Orientation.Landscape + PropertyChanges { target: main; rotation: 90; width: window.height; height: window.width } + PropertyChanges { target: rotateButton; operation: rotateLeft } + }, + State { + name: "orientation " + Orientation.PortraitInverted + PropertyChanges { target: main; rotation: 180; } + PropertyChanges { target: rotateButton; operation: rotateRight } + }, + State { + name: "orientation " + Orientation.LandscapeInverted + PropertyChanges { target: main; rotation: 270; width: window.height; height: window.width } + PropertyChanges { target: rotateButton; operation: rotateLeft } + } + ] + + transitions: Transition { + SequentialAnimation { + PropertyAction { target: rotateButton; property: "operation" } + RotationAnimation { direction: RotationAnimation.Shortest; duration: 300; easing.type: Easing.InOutQuint } + NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint } + } + } + } +} diff --git a/examples/declarative/demos/calculator/qml/calculator.qmlproject b/examples/declarative/demos/calculator/qml/calculator.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/demos/calculator/qml/calculator.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/demos/calculator/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/demos/calculator/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/demos/calculator/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/demos/calculator/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/demos/calculator/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/demos/calculator/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/demos/calculator/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/demos/calculator/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/demos/calculator/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/demos/flickr/flickr.desktop b/examples/declarative/demos/flickr/flickr.desktop new file mode 100644 index 0000000..5c8ce4f --- /dev/null +++ b/examples/declarative/demos/flickr/flickr.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=flickr +Exec=/opt/usr/bin/flickr +Icon=flickr +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/demos/flickr/flickr.png b/examples/declarative/demos/flickr/flickr.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/demos/flickr/flickr.png diff --git a/examples/declarative/demos/flickr/flickr.pro b/examples/declarative/demos/flickr/flickr.pro new file mode 100644 index 0000000..4104bc5 --- /dev/null +++ b/examples/declarative/demos/flickr/flickr.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE9DEEA70 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/demos/flickr/flickr.svg b/examples/declarative/demos/flickr/flickr.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/demos/flickr/flickr.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/demos/flickr/main.cpp b/examples/declarative/demos/flickr/main.cpp new file mode 100644 index 0000000..133f0d0 --- /dev/null +++ b/examples/declarative/demos/flickr/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); + viewer.setMainQmlFile(QLatin1String("qml/qml/flickr.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/demos/flickr/qml/common/Progress.qml b/examples/declarative/demos/flickr/qml/common/Progress.qml new file mode 100644 index 0000000..b928554 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/common/Progress.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + property variant progress: 0 + + Rectangle { + anchors.fill: parent; smooth: true + border.color: "white"; border.width: 0; radius: height/2 - 2 + gradient: Gradient { + GradientStop { position: 0; color: "#66343434" } + GradientStop { position: 1.0; color: "#66000000" } + } + } + + Rectangle { + y: 2; height: parent.height-4; + x: 2; width: Math.max(parent.width * progress - 4, 0); + opacity: width < 1 ? 0 : 1; smooth: true + gradient: Gradient { + GradientStop { position: 0; color: "lightsteelblue" } + GradientStop { position: 1.0; color: "steelblue" } + } + radius: height/2 - 2 + } + + Text { + text: Math.round(progress * 100) + "%" + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + color: "white"; font.bold: true; font.pixelSize: 15 + } +} diff --git a/examples/declarative/demos/flickr/qml/common/RssModel.qml b/examples/declarative/demos/flickr/qml/common/RssModel.qml new file mode 100644 index 0000000..0c1c834 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/common/RssModel.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +XmlListModel { + property string tags : "" + + function commasep(x) + { + return x.replace(' ',','); + } + + source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+commasep(tags)+"&" : "")+"format=rss2" + query: "/rss/channel/item" + namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";" + + XmlRole { name: "title"; query: "title/string()" } + XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" } + XmlRole { name: "url"; query: "media:content/@url/string()" } + XmlRole { name: "description"; query: "description/string()" } + XmlRole { name: "tags"; query: "media:category/string()" } + XmlRole { name: "photoWidth"; query: "media:content/@width/string()" } + XmlRole { name: "photoHeight"; query: "media:content/@height/string()" } + XmlRole { name: "photoType"; query: "media:content/@type/string()" } + XmlRole { name: "photoAuthor"; query: "author/string()" } + XmlRole { name: "photoDate"; query: "pubDate/string()" } +} diff --git a/examples/declarative/demos/flickr/qml/common/ScrollBar.qml b/examples/declarative/demos/flickr/qml/common/ScrollBar.qml new file mode 100644 index 0000000..dfe3cbf --- /dev/null +++ b/examples/declarative/demos/flickr/qml/common/ScrollBar.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property variant flickableArea + + Rectangle { + radius: 5 + color: "black" + opacity: 0.3 + border.color: "white" + border.width: 2 + x: 0 + y: flickableArea.visibleArea.yPosition * container.height + width: parent.width + height: flickableArea.visibleArea.heightRatio * container.height + } + states: [ + State { + name: "show" + when: flickableArea.movingVertically + PropertyChanges { + target: container + opacity: 1 + } + } + ] + transitions: [ + Transition { + from: "*" + to: "*" + NumberAnimation { + target: container + properties: "opacity" + duration: 400 + } + } + ] +} diff --git a/examples/declarative/demos/flickr/qml/common/Slider.qml b/examples/declarative/demos/flickr/qml/common/Slider.qml new file mode 100644 index 0000000..edccc7d --- /dev/null +++ b/examples/declarative/demos/flickr/qml/common/Slider.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: slider; width: 400; height: 16 + + // value is read/write. + property real value: 1 + onValueChanged: updatePos(); + property real maximum: 1 + property real minimum: 1 + property int xMax: width - handle.width - 4 + onXMaxChanged: updatePos(); + onMinimumChanged: updatePos(); + + function updatePos() { + if (maximum > minimum) { + var pos = 2 + (value - minimum) * slider.xMax / (maximum - minimum); + pos = Math.min(pos, width - handle.width - 2); + pos = Math.max(pos, 2); + handle.x = pos; + } else { + handle.x = 2; + } + } + + Rectangle { + anchors.fill: parent + border.color: "white"; border.width: 0; radius: 8 + gradient: Gradient { + GradientStop { position: 0.0; color: "#66343434" } + GradientStop { position: 1.0; color: "#66000000" } + } + } + + Rectangle { + id: handle; smooth: true + y: 2; width: 30; height: slider.height-4; radius: 6 + gradient: Gradient { + GradientStop { position: 0.0; color: "lightgray" } + GradientStop { position: 1.0; color: "gray" } + } + + MouseArea { + id: mouse + anchors.fill: parent; drag.target: parent + drag.axis: Drag.XAxis; drag.minimumX: 2; drag.maximumX: slider.xMax+2 + onPositionChanged: { value = (maximum - minimum) * (handle.x-2) / slider.xMax + minimum; } + } + } +} diff --git a/examples/declarative/demos/flickr/qml/common/qmldir b/examples/declarative/demos/flickr/qml/common/qmldir new file mode 100644 index 0000000..adc2479 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/common/qmldir @@ -0,0 +1,10 @@ +ImageDetails ImageDetails.qml +LikeOMeter LikeOMeter.qml +Loading Loading.qml +MediaButton MediaButton.qml +MediaLineEdit MediaLineEdit.qml +Progress Progress.qml +RssModel RssModel.qml +ScrollBar ScrollBar.qml +Slider Slider.qml +Star Star.qml diff --git a/examples/declarative/demos/flickr/qml/flickr-90.qml b/examples/declarative/demos/flickr/qml/flickr-90.qml new file mode 100644 index 0000000..31b1d91 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/flickr-90.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + width: 480; height: 320 + + Loader { + y: 320; rotation: -90 + transformOrigin: Item.TopLeft + source: "flickr.qml" + } +} diff --git a/examples/declarative/demos/flickr/qml/flickr.qml b/examples/declarative/demos/flickr/qml/flickr.qml new file mode 100644 index 0000000..740ee35 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/flickr.qml @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "common" as Common +import "mobile" as Mobile + +Item { + id: screen; width: 320; height: 480 + property bool inListView : false + + Rectangle { + id: background + anchors.fill: parent; color: "#343434"; + + Image { source: "mobile/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } + + Common.RssModel { id: rssModel } + + Item { + id: views + width: parent.width + anchors.top: titleBar.bottom; anchors.bottom: toolBar.top + + GridView { + id: photoGridView; model: rssModel; delegate: Mobile.GridDelegate {} + cacheBuffer: 100 + cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height + } + + ListView { + id: photoListView; model: rssModel; delegate: Mobile.ListDelegate { } + width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100; + } + + states: State { + name: "ListView"; when: screen.inListView == true + PropertyChanges { target: photoListView; x: 0 } + PropertyChanges { target: photoGridView; x: -(parent.width * 1.5) } + } + + transitions: Transition { + NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad } + } + + Mobile.ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height } + + Item { id: foreground; anchors.fill: parent } + } + + Mobile.TitleBar { id: titleBar; width: parent.width; height: 40; opacity: 0.9 } + + Mobile.ToolBar { + id: toolBar + height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9 + button1Label: "Update"; button2Label: "View mode" + onButton1Clicked: rssModel.reload() + onButton2Clicked: if (screen.inListView == true) screen.inListView = false; else screen.inListView = true + } + + Connections { + target: imageDetails + onClosed: { + if (background.state == "DetailedView") { + background.state = ''; + imageDetails.photoUrl = ""; + } + } + } + + states: State { + name: "DetailedView" + PropertyChanges { target: views; x: -parent.width } + PropertyChanges { target: toolBar; button1Label: "View..." } + PropertyChanges { + target: toolBar + onButton1Clicked: if (imageDetails.state=='') imageDetails.state='Back'; else imageDetails.state='' + } + PropertyChanges { target: toolBar; button2Label: "Back" } + PropertyChanges { target: toolBar; onButton2Clicked: imageDetails.closed() } + } + + transitions: Transition { + NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad } + } + } +} diff --git a/examples/declarative/demos/flickr/qml/flickr.qmlproject b/examples/declarative/demos/flickr/qml/flickr.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/flickr.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/demos/flickr/qml/mobile/Button.qml b/examples/declarative/demos/flickr/qml/mobile/Button.qml new file mode 100644 index 0000000..74a7dbb --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/Button.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + signal clicked + + property string text + + BorderImage { + id: buttonImage + source: "images/toolbutton.sci" + width: container.width; height: container.height + } + BorderImage { + id: pressed + opacity: 0 + source: "images/toolbutton.sci" + width: container.width; height: container.height + } + MouseArea { + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.clicked(); } + } + Text { + color: "white" + anchors.centerIn: buttonImage; font.bold: true; font.pixelSize: 15 + text: container.text; style: Text.Raised; styleColor: "black" + } + states: [ + State { + name: "Pressed" + when: mouseRegion.pressed == true + PropertyChanges { target: pressed; opacity: 1 } + } + ] +} diff --git a/examples/declarative/demos/flickr/qml/mobile/GridDelegate.qml b/examples/declarative/demos/flickr/qml/mobile/GridDelegate.qml new file mode 100644 index 0000000..8f01292 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/GridDelegate.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: wrapper; width: GridView.view.cellWidth; height: GridView.view.cellHeight + + function photoClicked() { + imageDetails.photoTitle = title; + imageDetails.photoTags = tags; + imageDetails.photoWidth = photoWidth; + imageDetails.photoHeight = photoHeight; + imageDetails.photoType = photoType; + imageDetails.photoAuthor = photoAuthor; + imageDetails.photoDate = photoDate; + imageDetails.photoUrl = url; + imageDetails.rating = 0; + scaleMe.state = "Details"; + } + + Item { + anchors.centerIn: parent + scale: 0.0 + Behavior on scale { NumberAnimation { easing.type: Easing.InOutQuad} } + id: scaleMe + + Item { + width: 77; height: 77; anchors.centerIn: parent + Rectangle { + id: whiteRect; width: 77; height: 77; color: "#dddddd"; smooth: true + Image { id: thumb; source: imagePath; x: 1; y: 1; smooth: true } + Image { source: "images/gloss.png" } + } + } + + Connections { + target: toolBar + onButton2Clicked: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show' + } + + states: [ + State { + name: "Show"; when: thumb.status == Image.Ready + PropertyChanges { target: scaleMe; scale: 1 } + }, + State { + name: "Details" + PropertyChanges { target: scaleMe; scale: 1 } + ParentChange { target: whiteRect; x: 10; y: 20; parent: imageDetails.frontContainer } + PropertyChanges { target: background; state: "DetailedView" } + } + ] + transitions: [ + Transition { + from: "Show"; to: "Details" + ParentAnimation { + via: foreground + NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } + } + }, + Transition { + from: "Details"; to: "Show" + ParentAnimation { + via: foreground + NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } + } + } + ] + } + MouseArea { anchors.fill: wrapper; onClicked: photoClicked() } +} + diff --git a/examples/declarative/demos/flickr/qml/mobile/ImageDetails.qml b/examples/declarative/demos/flickr/qml/mobile/ImageDetails.qml new file mode 100644 index 0000000..9d1464e --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/ImageDetails.qml @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "../common" as Common + +Flipable { + id: container + + property alias frontContainer: containerFront + property string photoTitle: "" + property string photoTags: "" + property int photoWidth + property int photoHeight + property string photoType + property string photoAuthor + property string photoDate + property string photoUrl + property int rating: 2 + property variant prevScale: 1.0 + + signal closed + + transform: Rotation { + id: itemRotation + origin.x: container.width / 2; + axis.y: 1; axis.z: 0 + } + + front: Item { + id: containerFront; anchors.fill: container + + Rectangle { + anchors.fill: parent + color: "black"; opacity: 0.4 + } + + Column { + spacing: 10 + anchors { + left: parent.left; leftMargin: 10 + right: parent.right; rightMargin: 10 + top: parent.top; topMargin: 120 + } + Text { font.bold: true; color: "white"; elide: Text.ElideRight; text: container.photoTitle; width: parent.width } + Text { color: "white"; elide: Text.ElideRight; text: "Size: " + container.photoWidth + 'x' + container.photoHeight; width: parent.width } + Text { color: "white"; elide: Text.ElideRight; text: "Type: " + container.photoType; width: parent.width } + Text { color: "white"; elide: Text.ElideRight; text: "Author: " + container.photoAuthor; width: parent.width } + Text { color: "white"; elide: Text.ElideRight; text: "Published: " + container.photoDate; width: parent.width } + Text { color: "white"; elide: Text.ElideRight; text: container.photoTags == "" ? "" : "Tags: "; width: parent.width } + Text { color: "white"; elide: Text.ElideRight; text: container.photoTags; width: parent.width } + } + } + + back: Item { + anchors.fill: container + + Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4 } + + Common.Progress { + anchors.centerIn: parent; width: 200; height: 22 + progress: bigImage.progress; visible: bigImage.status != Image.Ready + } + + Flickable { + id: flickable; anchors.fill: parent; clip: true + contentWidth: imageContainer.width; contentHeight: imageContainer.height + + function updateMinimumScale() { + if (bigImage.status == Image.Ready && bigImage.width != 0) { + slider.minimum = Math.min(flickable.width / bigImage.width, flickable.height / bigImage.height); + if (bigImage.width * slider.value > flickable.width) { + var xoff = (flickable.width/2 + flickable.contentX) * slider.value / prevScale; + flickable.contentX = xoff - flickable.width/2; + } + if (bigImage.height * slider.value > flickable.height) { + var yoff = (flickable.height/2 + flickable.contentY) * slider.value / prevScale; + flickable.contentY = yoff - flickable.height/2; + } + prevScale = slider.value; + } + } + + onWidthChanged: updateMinimumScale() + onHeightChanged: updateMinimumScale() + + Item { + id: imageContainer + width: Math.max(bigImage.width * bigImage.scale, flickable.width); + height: Math.max(bigImage.height * bigImage.scale, flickable.height); + + Image { + id: bigImage; source: container.photoUrl; scale: slider.value + anchors.centerIn: parent; smooth: !flickable.movingVertically + onStatusChanged : { + // Default scale shows the entire image. + if (bigImage.status == Image.Ready && bigImage.width != 0) { + slider.minimum = Math.min(flickable.width / bigImage.width, flickable.height / bigImage.height); + prevScale = Math.min(slider.minimum, 1); + slider.value = prevScale; + } + } + } + } + } + + Text { + text: "Image Unavailable" + visible: bigImage.status == Image.Error + anchors.centerIn: parent; color: "white"; font.bold: true + } + + Common.Slider { + id: slider; visible: { bigImage.status == Image.Ready && maximum > minimum } + anchors { + bottom: parent.bottom; bottomMargin: 65 + left: parent.left; leftMargin: 25 + right: parent.right; rightMargin: 25 + } + onValueChanged: { + if (bigImage.width * value > flickable.width) { + var xoff = (flickable.width/2 + flickable.contentX) * value / prevScale; + flickable.contentX = xoff - flickable.width/2; + } + if (bigImage.height * value > flickable.height) { + var yoff = (flickable.height/2 + flickable.contentY) * value / prevScale; + flickable.contentY = yoff - flickable.height/2; + } + prevScale = value; + } + } + } + + states: State { + name: "Back" + PropertyChanges { target: itemRotation; angle: 180 } + PropertyChanges { target: toolBar; button2Visible: false } + PropertyChanges { target: toolBar; button1Label: "Back" } + } + + transitions: Transition { + SequentialAnimation { + PropertyAction { target: bigImage; property: "smooth"; value: false } + NumberAnimation { easing.type: Easing.InOutQuad; properties: "angle"; duration: 500 } + PropertyAction { target: bigImage; property: "smooth"; value: !flickable.movingVertically } + } + } +} diff --git a/examples/declarative/demos/flickr/qml/mobile/ListDelegate.qml b/examples/declarative/demos/flickr/qml/mobile/ListDelegate.qml new file mode 100644 index 0000000..0773547 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/ListDelegate.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Component { + Item { + id: wrapper; width: wrapper.ListView.view.width; height: 86 + Item { + id: moveMe + Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 } + Rectangle { + x: 6; y: 4; width: 77; height: 77; color: "white"; smooth: true + + Image { source: imagePath; x: 1; y: 1 } + Image { source: "images/gloss.png" } + } + Column { + x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2 + Text { text: title; color: "white"; width: parent.width; font.pixelSize: 14; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" } + Text { text: photoAuthor; width: parent.width; font.pixelSize: 14; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" } + Text { text: photoDate; width: parent.width; font.pixelSize: 14; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" } + } + } + } +} diff --git a/examples/declarative/demos/flickr/qml/mobile/TitleBar.qml b/examples/declarative/demos/flickr/qml/mobile/TitleBar.qml new file mode 100644 index 0000000..f283307 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/TitleBar.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: titleBar + property string untaggedString: "Uploads from everyone" + property string taggedString: "Recent uploads tagged " + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + + Item { + id: container + width: (parent.width * 2) - 55 ; height: parent.height + + function accept() { + imageDetails.closed() + titleBar.state = "" + background.state = "" + rssModel.tags = editor.text + } + + Image { + id: quitButton + anchors.left: parent.left//; anchors.leftMargin: 0 + anchors.verticalCenter: parent.verticalCenter + source: "images/quit.png" + MouseArea { + anchors.fill: parent + onClicked: Qt.quit() + } + } + + Text { + id: categoryText + anchors { + left: quitButton.right; right: tagButton.left; leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + elide: Text.ElideLeft + text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags) + font.bold: true; font.pixelSize: 15; color: "White"; style: Text.Raised; styleColor: "Black" + } + + Button { + id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..." + onClicked: if (titleBar.state == "Tags") container.accept(); else titleBar.state = "Tags" + anchors.verticalCenter: parent.verticalCenter + } + + Item { + id: lineEdit + y: 4; height: parent.height - 9 + anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 } + + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } + + TextInput { + id: editor + anchors { + left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + cursorVisible: true; font.bold: true + color: "#151515"; selectionColor: "Green" + } + + Keys.forwardTo: [ (returnKey), (editor)] + + Item { + id: returnKey + Keys.onReturnPressed: container.accept() + Keys.onEnterPressed: container.accept() + Keys.onEscapePressed: titleBar.state = "" + } + } + } + + states: State { + name: "Tags" + PropertyChanges { target: container; x: -tagButton.x + 5 } + PropertyChanges { target: tagButton; text: "OK" } + PropertyChanges { target: editor; focus: true } + } + + transitions: Transition { + NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad } + } +} diff --git a/examples/declarative/demos/flickr/qml/mobile/ToolBar.qml b/examples/declarative/demos/flickr/qml/mobile/ToolBar.qml new file mode 100644 index 0000000..d8abb14 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/ToolBar.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: toolbar + + property alias button1Label: button1.text + property alias button2Label: button2.text + property alias button2Visible: button2.visible + + signal button1Clicked + signal button2Clicked + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + + Row { + anchors.right: parent.right; anchors.rightMargin: 5; y: 3; height: 32; spacing: 30 + Button { + id: button1 + width: 140; height: 32 + onClicked: toolbar.button1Clicked() + } + + Button { + id: button2; width: 140; height: 32 + onClicked: toolbar.button2Clicked() + } + } +} diff --git a/examples/declarative/demos/flickr/qml/mobile/images/gloss.png b/examples/declarative/demos/flickr/qml/mobile/images/gloss.png Binary files differnew file mode 100644 index 0000000..5d370cd --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/images/gloss.png diff --git a/examples/declarative/demos/flickr/qml/mobile/images/lineedit.png b/examples/declarative/demos/flickr/qml/mobile/images/lineedit.png Binary files differnew file mode 100644 index 0000000..2cc38dc --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/images/lineedit.png diff --git a/examples/declarative/demos/flickr/qml/mobile/images/lineedit.sci b/examples/declarative/demos/flickr/qml/mobile/images/lineedit.sci new file mode 100644 index 0000000..054bff7 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/images/lineedit.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 10 +border.bottom: 10 +border.right: 10 +source: lineedit.png diff --git a/examples/declarative/demos/flickr/qml/mobile/images/quit.png b/examples/declarative/demos/flickr/qml/mobile/images/quit.png Binary files differnew file mode 100644 index 0000000..5bda1b6 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/images/quit.png diff --git a/examples/declarative/demos/flickr/qml/mobile/images/stripes.png b/examples/declarative/demos/flickr/qml/mobile/images/stripes.png Binary files differnew file mode 100644 index 0000000..9f36727 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/images/stripes.png diff --git a/examples/declarative/demos/flickr/qml/mobile/images/titlebar.png b/examples/declarative/demos/flickr/qml/mobile/images/titlebar.png Binary files differnew file mode 100644 index 0000000..51c9008 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/images/titlebar.png diff --git a/examples/declarative/demos/flickr/qml/mobile/images/titlebar.sci b/examples/declarative/demos/flickr/qml/mobile/images/titlebar.sci new file mode 100644 index 0000000..0418d94 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/images/titlebar.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 12 +border.bottom: 12 +border.right: 10 +source: titlebar.png diff --git a/examples/declarative/demos/flickr/qml/mobile/images/toolbutton.png b/examples/declarative/demos/flickr/qml/mobile/images/toolbutton.png Binary files differnew file mode 100644 index 0000000..1131001 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/images/toolbutton.png diff --git a/examples/declarative/demos/flickr/qml/mobile/images/toolbutton.sci b/examples/declarative/demos/flickr/qml/mobile/images/toolbutton.sci new file mode 100644 index 0000000..9e4f965 --- /dev/null +++ b/examples/declarative/demos/flickr/qml/mobile/images/toolbutton.sci @@ -0,0 +1,5 @@ +border.left: 15 +border.top: 4 +border.bottom: 4 +border.right: 15 +source: toolbutton.png diff --git a/examples/declarative/demos/flickr/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/demos/flickr/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/demos/flickr/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/demos/flickr/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/demos/flickr/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/demos/flickr/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/demos/flickr/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/demos/flickr/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/demos/flickr/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/demos/photoviewer/main.cpp b/examples/declarative/demos/photoviewer/main.cpp new file mode 100644 index 0000000..f718dc2 --- /dev/null +++ b/examples/declarative/demos/photoviewer/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); + viewer.setMainQmlFile(QLatin1String("qml/qml/photoviewer.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/demos/photoviewer/photoviewer.desktop b/examples/declarative/demos/photoviewer/photoviewer.desktop new file mode 100644 index 0000000..0ff4d15 --- /dev/null +++ b/examples/declarative/demos/photoviewer/photoviewer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=photoviewer +Exec=/opt/usr/bin/photoviewer +Icon=photoviewer +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/demos/photoviewer/photoviewer.png b/examples/declarative/demos/photoviewer/photoviewer.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/demos/photoviewer/photoviewer.png diff --git a/examples/declarative/demos/photoviewer/photoviewer.pro b/examples/declarative/demos/photoviewer/photoviewer.pro new file mode 100644 index 0000000..0760998 --- /dev/null +++ b/examples/declarative/demos/photoviewer/photoviewer.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE1762B94 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/demos/photoviewer/photoviewer.svg b/examples/declarative/demos/photoviewer/photoviewer.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/demos/photoviewer/photoviewer.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/AlbumDelegate.qml b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/AlbumDelegate.qml new file mode 100644 index 0000000..9001033 --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/AlbumDelegate.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Component { + id: albumDelegate + Package { + + Item { + Package.name: 'browser' + GridView { + id: photosGridView; model: visualModel.parts.grid; width: mainWindow.width; height: mainWindow.height - 21 + x: 0; y: 21; cellWidth: 160; cellHeight: 153; interactive: false + onCurrentIndexChanged: photosListView.positionViewAtIndex(currentIndex, ListView.Contain) + } + } + + Item { + Package.name: 'fullscreen' + ListView { + id: photosListView; model: visualModel.parts.list; orientation: Qt.Horizontal + width: mainWindow.width; height: mainWindow.height; interactive: false + onCurrentIndexChanged: photosGridView.positionViewAtIndex(currentIndex, GridView.Contain) + highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem + } + } + + Item { + Package.name: 'album' + id: albumWrapper; width: 210; height: 220 + + VisualDataModel { + id: visualModel; delegate: PhotoDelegate { } + model: RssModel { id: rssModel; tags: tag } + } + + BusyIndicator { + id: busyIndicator + anchors { centerIn: parent; verticalCenterOffset: -20 } + on: rssModel.status != XmlListModel.Ready + } + + PathView { + id: photosPathView; model: visualModel.parts.stack; pathItemCount: 5 + visible: !busyIndicator.visible + anchors.centerIn: parent; anchors.verticalCenterOffset: -30 + path: Path { + PathAttribute { name: 'z'; value: 9999.0 } + PathLine { x: 1; y: 1 } + PathAttribute { name: 'z'; value: 0.0 } + } + } + + MouseArea { + anchors.fill: parent + onClicked: mainWindow.editMode ? photosModel.remove(index) : albumWrapper.state = 'inGrid' + } + + Tag { + anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 10 } + frontLabel: tag; backLabel: qsTr("Remove"); flipped: mainWindow.editMode + onTagChanged: rssModel.tags = tag + onBackClicked: if (mainWindow.editMode) photosModel.remove(index); + } + + states: [ + State { + name: 'inGrid' + PropertyChanges { target: photosGridView; interactive: true } + PropertyChanges { target: albumsShade; opacity: 1 } + PropertyChanges { target: backButton; onClicked: albumWrapper.state = ''; y: 6 } + }, + State { + name: 'fullscreen'; extend: 'inGrid' + PropertyChanges { target: photosGridView; interactive: false } + PropertyChanges { target: photosListView; interactive: true } + PropertyChanges { target: photosShade; opacity: 1 } + PropertyChanges { target: backButton; y: -backButton.height - 8 } + } + ] + + GridView.onAdd: NumberAnimation { + target: albumWrapper; properties: "scale"; from: 0.0; to: 1.0; easing.type: Easing.OutQuad + } + GridView.onRemove: SequentialAnimation { + PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: true } + NumberAnimation { target: albumWrapper; property: "scale"; from: 1.0; to: 0.0; easing.type: Easing.OutQuad } + PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: false } + } + + transitions: [ + Transition { + from: '*'; to: 'inGrid' + SequentialAnimation { + NumberAnimation { properties: 'opacity'; duration: 250 } + PauseAnimation { duration: 350 } + NumberAnimation { target: backButton; properties: "y"; duration: 200; easing.type: Easing.OutQuad } + } + }, + Transition { + from: 'inGrid'; to: '*' + NumberAnimation { properties: "y,opacity"; easing.type: Easing.OutQuad; duration: 300 } + } + ] + } + } +} diff --git a/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/BusyIndicator.qml b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/BusyIndicator.qml new file mode 100644 index 0000000..7b28930 --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/BusyIndicator.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: container + property bool on: false + + source: "images/busy.png"; visible: container.on + NumberAnimation on rotation { running: container.on; from: 0; to: 360; loops: Animation.Infinite; duration: 1200 } +} diff --git a/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/Button.qml b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/Button.qml new file mode 100644 index 0000000..29f2bb7 --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/Button.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property alias label: labelText.text + property color tint: "transparent" + signal clicked + + width: labelText.width + 70 ; height: labelText.height + 18 + + BorderImage { + anchors { fill: container; leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } + source: 'images/box-shadow.png'; smooth: true + border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 + } + + Image { anchors.fill: parent; source: "images/cardboard.png"; smooth: true } + + Rectangle { + anchors.fill: container; color: container.tint; visible: container.tint != "" + opacity: 0.25; smooth: true + } + + Text { id: labelText; font.pixelSize: 15; anchors.centerIn: parent; smooth: true } + + MouseArea { + anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } + onClicked: container.clicked() + } +} diff --git a/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/EditableButton.qml b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/EditableButton.qml new file mode 100644 index 0000000..06f8062 --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/EditableButton.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property string label + signal clicked + signal labelChanged(string label) + + width: textInput.width + 70 ; height: textInput.height + 18 + + BorderImage { + anchors { fill: container; leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } + source: 'images/box-shadow.png'; smooth: true + border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 + } + + Image { anchors.fill: parent; source: "images/cardboard.png"; smooth: true } + + TextInput { + id: textInput; text: label; font.pixelSize: 15; anchors.centerIn: parent; smooth: true + Keys.onReturnPressed: { + container.labelChanged(textInput.text) + container.focus = true + } + Keys.onEnterPressed: { + container.labelChanged(textInput.text) + container.focus = true + } + Keys.onEscapePressed: { + textInput.text = container.label + container.focus = true + } + } + + Rectangle { + anchors.fill: container; border.color: "steelblue"; border.width: 4 + color: "transparent"; visible: textInput.focus; smooth: true + } + + MouseArea { + anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } + onClicked: { textInput.forceActiveFocus(); textInput.openSoftwareInputPanel(); } + } +} diff --git a/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/PhotoDelegate.qml b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/PhotoDelegate.qml new file mode 100644 index 0000000..5948b5d --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/PhotoDelegate.qml @@ -0,0 +1,188 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "script/script.js" as Script + +Package { + Item { id: stackItem; Package.name: 'stack'; width: 160; height: 153; z: stackItem.PathView.z } + Item { id: listItem; Package.name: 'list'; width: mainWindow.width + 40; height: 153 } + Item { id: gridItem; Package.name: 'grid'; width: 160; height: 153 } + + Item { + width: 160; height: 153 + + Item { + id: photoWrapper + + property double randomAngle: Math.random() * (2 * 6 + 1) - 6 + property double randomAngle2: Math.random() * (2 * 6 + 1) - 6 + + x: 0; y: 0; width: 140; height: 133 + z: stackItem.PathView.z; rotation: photoWrapper.randomAngle + + BorderImage { + anchors { + fill: border.visible ? border : placeHolder + leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 + } + source: 'images/box-shadow.png'; smooth: true + border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 + } + Rectangle { + id: placeHolder + + property int w: Script.getWidth(content) + property int h: Script.getHeight(content) + property double s: Script.calculateScale(w, h, photoWrapper.width) + + color: 'white'; anchors.centerIn: parent; smooth: true + width: w * s; height: h * s; visible: originalImage.status != Image.Ready + Rectangle { + color: "#878787"; smooth: true + anchors { fill: parent; topMargin: 3; bottomMargin: 3; leftMargin: 3; rightMargin: 3 } + } + } + Rectangle { + id: border; color: 'white'; anchors.centerIn: parent; smooth: true + width: originalImage.paintedWidth + 6; height: originalImage.paintedHeight + 6 + visible: !placeHolder.visible + } + BusyIndicator { anchors.centerIn: parent; on: originalImage.status != Image.Ready } + Image { + id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content) + fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height + } + Image { + id: hqImage; smooth: true; source: ""; visible: false + fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height + } + Binding { + target: mainWindow; property: "downloadProgress"; value: hqImage.progress + when: listItem.ListView.isCurrentItem + } + Binding { + target: mainWindow; property: "imageLoading" + value: (hqImage.status == Image.Loading) ? 1 : 0; when: listItem.ListView.isCurrentItem + } + MouseArea { + width: originalImage.paintedWidth; height: originalImage.paintedHeight; anchors.centerIn: originalImage + onClicked: { + if (albumWrapper.state == 'inGrid') { + gridItem.GridView.view.currentIndex = index; + albumWrapper.state = 'fullscreen' + } else { + gridItem.GridView.view.currentIndex = index; + albumWrapper.state = 'inGrid' + } + } + } + + states: [ + State { + name: 'stacked'; when: albumWrapper.state == '' + ParentChange { target: photoWrapper; parent: stackItem; x: 10; y: 10 } + PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 } + }, + State { + name: 'inGrid'; when: albumWrapper.state == 'inGrid' + ParentChange { target: photoWrapper; parent: gridItem; x: 10; y: 10; rotation: photoWrapper.randomAngle2 } + }, + State { + name: 'fullscreen'; when: albumWrapper.state == 'fullscreen' + ParentChange { + target: photoWrapper; parent: listItem; x: 0; y: 0; rotation: 0 + width: mainWindow.width; height: mainWindow.height + } + PropertyChanges { target: border; opacity: 0 } + PropertyChanges { target: hqImage; source: listItem.ListView.isCurrentItem ? hq : ""; visible: true } + } + ] + + transitions: [ + Transition { + from: 'stacked'; to: 'inGrid' + SequentialAnimation { + PauseAnimation { duration: 10 * index } + ParentAnimation { + target: photoWrapper; via: foreground + NumberAnimation { + target: photoWrapper; properties: 'x,y,rotation,opacity'; duration: 600; easing.type: 'OutQuart' + } + } + } + }, + Transition { + from: 'inGrid'; to: 'stacked' + ParentAnimation { + target: photoWrapper; via: foreground + NumberAnimation { properties: 'x,y,rotation,opacity'; duration: 600; easing.type: 'OutQuart' } + } + }, + Transition { + from: 'inGrid'; to: 'fullscreen' + SequentialAnimation { + PauseAnimation { duration: gridItem.GridView.isCurrentItem ? 0 : 600 } + ParentAnimation { + target: photoWrapper; via: foreground + NumberAnimation { + targets: [ photoWrapper, border ] + properties: 'x,y,width,height,opacity,rotation' + duration: gridItem.GridView.isCurrentItem ? 600 : 1; easing.type: 'OutQuart' + } + } + } + }, + Transition { + from: 'fullscreen'; to: 'inGrid' + ParentAnimation { + target: photoWrapper; via: foreground + NumberAnimation { + targets: [ photoWrapper, border ] + properties: 'x,y,width,height,rotation,opacity' + duration: gridItem.GridView.isCurrentItem ? 600 : 1; easing.type: 'OutQuart' + } + } + } + ] + } + } +} diff --git a/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/ProgressBar.qml b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/ProgressBar.qml new file mode 100644 index 0000000..a0756ae --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/ProgressBar.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property real progress: 0 + + Behavior on opacity { NumberAnimation { duration: 600 } } + + Rectangle { anchors.fill: parent; color: "black"; opacity: 0.5 } + + Rectangle { + id: fill; color: "white"; height: container.height + width: container.width * container.progress + } +} diff --git a/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/RssModel.qml b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/RssModel.qml new file mode 100644 index 0000000..15bb67f --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/RssModel.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +XmlListModel { + property string tags : "" + + source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+tags+"&" : "") + query: "/feed/entry" + namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';" + + XmlRole { name: "title"; query: "title/string()" } + XmlRole { name: "content"; query: "content/string()" } + XmlRole { name: "hq"; query: "link[@rel='enclosure']/@href/string()" } +} diff --git a/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/Tag.qml b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/Tag.qml new file mode 100644 index 0000000..9358975 --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/Tag.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Flipable { + id: flipable + + property alias frontLabel: frontButton.label + property alias backLabel: backButton.label + + property int angle: 0 + property int randomAngle: Math.random() * (2 * 6 + 1) - 6 + property bool flipped: false + + signal frontClicked + signal backClicked + signal tagChanged(string tag) + + front: EditableButton { + id: frontButton; rotation: flipable.randomAngle + anchors { centerIn: parent; verticalCenterOffset: -20 } + onClicked: flipable.frontClicked() + onLabelChanged: flipable.tagChanged(label) + } + + back: Button { + id: backButton; tint: "red"; rotation: flipable.randomAngle + anchors { centerIn: parent; verticalCenterOffset: -20 } + onClicked: flipable.backClicked() + } + + transform: Rotation { + origin.x: flipable.width / 2; origin.y: flipable.height / 2 + axis.x: 0; axis.y: 1; axis.z: 0 + angle: flipable.angle + } + + states: State { + name: "back"; when: flipable.flipped + PropertyChanges { target: flipable; angle: 180 } + } + + transitions: Transition { + ParallelAnimation { + NumberAnimation { properties: "angle"; duration: 400 } + SequentialAnimation { + NumberAnimation { target: flipable; property: "scale"; to: 0.8; duration: 200 } + NumberAnimation { target: flipable; property: "scale"; to: 1.0; duration: 200 } + } + } + } +} diff --git a/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/images/box-shadow.png b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/images/box-shadow.png Binary files differnew file mode 100644 index 0000000..431af85 --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/images/box-shadow.png diff --git a/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/images/busy.png b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/images/busy.png Binary files differnew file mode 100644 index 0000000..664c2b1 --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/images/busy.png diff --git a/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/images/cardboard.png b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/images/cardboard.png Binary files differnew file mode 100644 index 0000000..1847ab5 --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/images/cardboard.png diff --git a/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/qmldir b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/qmldir new file mode 100644 index 0000000..d3c247f --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/qmldir @@ -0,0 +1,8 @@ +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/declarative/demos/photoviewer/qml/PhotoViewerCore/script/script.js b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/script/script.js new file mode 100644 index 0000000..e8ef93a --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/PhotoViewerCore/script/script.js @@ -0,0 +1,27 @@ +.pragma library + +function getWidth(string) { + return (string.match(/width=\"([0-9]+)\"/))[1] +} + +function getHeight(string) { + return (string.match(/height=\"([0-9]+)\"/))[1] +} + +function getImagePath(string) { + var pattern = /src=\"http:\/\/(\S+)\"/ + return (string.match(pattern))[1] +} + +function calculateScale(width, height, cellSize) { + var widthScale = (cellSize * 1.0) / width + var heightScale = (cellSize * 1.0) / height + var scale = 0 + + if (widthScale <= heightScale) { + scale = widthScale; + } else if (heightScale < widthScale) { + scale = heightScale; + } + return scale; +} diff --git a/examples/declarative/demos/photoviewer/qml/i18n/base.ts b/examples/declarative/demos/photoviewer/qml/i18n/base.ts new file mode 100644 index 0000000..1accfd2 --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/i18n/base.ts @@ -0,0 +1,30 @@ +<?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/declarative/demos/photoviewer/qml/i18n/qml_fr.ts b/examples/declarative/demos/photoviewer/qml/i18n/qml_fr.ts new file mode 100644 index 0000000..9f892db --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/i18n/qml_fr.ts @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="fr_FR"> +<context> + <name>AlbumDelegate</name> + <message> + <location filename="../PhotoViewerCore/AlbumDelegate.qml" line="59"/> + <source>Remove</source> + <translation>Supprimer</translation> + </message> +</context> +<context> + <name>photoviewer</name> + <message> + <location filename="../photoviewer.qml" line="30"/> + <source>Add</source> + <translation>Ajouter</translation> + </message> + <message> + <location filename="../photoviewer.qml" line="39"/> + <source>Edit</source> + <translation>Éditer</translation> + </message> + <message> + <location filename="../photoviewer.qml" line="52"/> + <source>Back</source> + <translation>Retour</translation> + </message> +</context> +</TS> diff --git a/examples/declarative/demos/photoviewer/qml/photoviewer.qml b/examples/declarative/demos/photoviewer/qml/photoviewer.qml new file mode 100644 index 0000000..0f59c64 --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/photoviewer.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "PhotoViewerCore" + +Rectangle { + id: mainWindow + + property real downloadProgress: 0 + property bool imageLoading: false + property bool editMode: false + + width: 800; height: 480; color: "#d5d6d8" + + ListModel { + id: photosModel + ListElement { tag: "Flowers" } + ListElement { tag: "Wildlife" } + ListElement { tag: "Prague" } + } + + VisualDataModel { id: albumVisualModel; model: photosModel; delegate: AlbumDelegate {} } + + GridView { + id: albumView; width: parent.width; height: parent.height; cellWidth: 210; cellHeight: 220 + model: albumVisualModel.parts.album; visible: albumsShade.opacity != 1.0 + } + + Column { + spacing: 20; anchors { bottom: parent.bottom; right: parent.right; rightMargin: 20; bottomMargin: 20 } + Button { + id: newButton; label: qsTr("Add"); rotation: 3 + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + mainWindow.editMode = false + photosModel.append( { tag: "" } ) + albumView.positionViewAtIndex(albumView.count - 1, GridView.Contain) + } + } + Button { + id: deleteButton; label: qsTr("Edit"); rotation: -2; + onClicked: mainWindow.editMode = !mainWindow.editMode + anchors.horizontalCenter: parent.horizontalCenter + } + Button { + id: quitButton; label: qsTr("Quit"); rotation: -2; + onClicked: Qt.quit() + anchors.horizontalCenter: parent.horizontalCenter + } + } + + Rectangle { + id: albumsShade; color: mainWindow.color + width: parent.width; height: parent.height; opacity: 0.0 + } + + ListView { anchors.fill: parent; model: albumVisualModel.parts.browser; interactive: false } + + Button { id: backButton; label: qsTr("Back"); rotation: 3; x: parent.width - backButton.width - 6; y: -backButton.height - 8 } + + Rectangle { id: photosShade; color: 'black'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 } + + ListView { anchors.fill: parent; model: albumVisualModel.parts.fullscreen; interactive: false } + + Item { id: foreground; anchors.fill: parent } + + ProgressBar { + progress: mainWindow.downloadProgress; width: parent.width; height: 4 + anchors.bottom: parent.bottom; opacity: mainWindow.imageLoading; visible: opacity != 0.0 + } +} diff --git a/examples/declarative/demos/photoviewer/qml/photoviewer.qmlproject b/examples/declarative/demos/photoviewer/qml/photoviewer.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/demos/photoviewer/qml/photoviewer.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/demos/photoviewer/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/demos/photoviewer/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/demos/photoviewer/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/demos/photoviewer/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/demos/photoviewer/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/demos/photoviewer/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/demos/photoviewer/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/demos/photoviewer/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/demos/photoviewer/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/demos/rssnews/main.cpp b/examples/declarative/demos/rssnews/main.cpp new file mode 100644 index 0000000..ad57596 --- /dev/null +++ b/examples/declarative/demos/rssnews/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/rssnews.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/demos/rssnews/qml/content/BusyIndicator.qml b/examples/declarative/demos/rssnews/qml/content/BusyIndicator.qml new file mode 100644 index 0000000..e305cbe --- /dev/null +++ b/examples/declarative/demos/rssnews/qml/content/BusyIndicator.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: container + property bool on: false + + source: "images/busy.png"; visible: container.on + + NumberAnimation on rotation { + running: container.on; from: 0; to: 360; loops: Animation.Infinite; duration: 1200 + } +} diff --git a/examples/declarative/demos/rssnews/qml/content/CategoryDelegate.qml b/examples/declarative/demos/rssnews/qml/content/CategoryDelegate.qml new file mode 100644 index 0000000..c4fa8cc --- /dev/null +++ b/examples/declarative/demos/rssnews/qml/content/CategoryDelegate.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: delegate + + width: delegate.ListView.view.width; height: 60 + + Text { + text: name + color: delegate.ListView.isCurrentItem ? "white" : "black" + font { family: "Helvetica"; pixelSize: 16; bold: true } + anchors { + left: parent.left; leftMargin: 15 + verticalCenter: parent.verticalCenter + } + } + + BusyIndicator { + scale: 0.6 + on: delegate.ListView.isCurrentItem && window.loading + anchors { right: parent.right; rightMargin: 10; verticalCenter: parent.verticalCenter } + } + + Rectangle { + width: delegate.width; height: 1; color: "#cccccc" + anchors.bottom: delegate.bottom + visible: delegate.ListView.isCurrentItem ? false : true + } + Rectangle { + width: delegate.width; height: 1; color: "white" + visible: delegate.ListView.isCurrentItem ? false : true + } + + MouseArea { + anchors.fill: delegate + onClicked: { + delegate.ListView.view.currentIndex = index + window.currentFeed = feed + } + } +} diff --git a/examples/declarative/demos/rssnews/qml/content/NewsDelegate.qml b/examples/declarative/demos/rssnews/qml/content/NewsDelegate.qml new file mode 100644 index 0000000..cf88f4e --- /dev/null +++ b/examples/declarative/demos/rssnews/qml/content/NewsDelegate.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: delegate + height: column.height + 40 + width: delegate.ListView.view.width + + Column { + id: column + x: 20; y: 20 + width: parent.width - 40 + + Text { + id: titleText + text: title; width: parent.width; wrapMode: Text.WordWrap + font { bold: true; family: "Helvetica"; pointSize: 16 } + } + + Text { + id: descriptionText + width: parent.width; text: description + wrapMode: Text.WordWrap; font.family: "Helvetica" + } + } + + Rectangle { + width: parent.width; height: 1; color: "#cccccc" + anchors.bottom: parent.bottom + } +} diff --git a/examples/declarative/demos/rssnews/qml/content/RssFeeds.qml b/examples/declarative/demos/rssnews/qml/content/RssFeeds.qml new file mode 100644 index 0000000..37c4b69 --- /dev/null +++ b/examples/declarative/demos/rssnews/qml/content/RssFeeds.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + id: rssFeeds + + ListElement { name: "Top Stories"; feed: "rss.news.yahoo.com/rss/topstories" } + ListElement { name: "World"; feed: "rss.news.yahoo.com/rss/world" } + ListElement { name: "Europe"; feed: "rss.news.yahoo.com/rss/europe" } + ListElement { name: "Oceania"; feed: "rss.news.yahoo.com/rss/oceania" } + ListElement { name: "U.S. National"; feed: "rss.news.yahoo.com/rss/us" } + ListElement { name: "Politics"; feed: "rss.news.yahoo.com/rss/politics" } + ListElement { name: "Business"; feed: "rss.news.yahoo.com/rss/business" } + ListElement { name: "Technology"; feed: "rss.news.yahoo.com/rss/tech" } + ListElement { name: "Entertainment"; feed: "rss.news.yahoo.com/rss/entertainment" } + ListElement { name: "Health"; feed: "rss.news.yahoo.com/rss/health" } + ListElement { name: "Science"; feed: "rss.news.yahoo.com/rss/science" } + ListElement { name: "Sports"; feed: "rss.news.yahoo.com/rss/sports" } +} diff --git a/examples/declarative/demos/rssnews/qml/content/ScrollBar.qml b/examples/declarative/demos/rssnews/qml/content/ScrollBar.qml new file mode 100644 index 0000000..f20f0aa --- /dev/null +++ b/examples/declarative/demos/rssnews/qml/content/ScrollBar.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property variant scrollArea + property variant orientation: Qt.Vertical + + opacity: 0 + + function position() + { + var ny = 0; + if (container.orientation == Qt.Vertical) + ny = scrollArea.visibleArea.yPosition * container.height; + else + ny = scrollArea.visibleArea.xPosition * container.width; + if (ny > 2) return ny; else return 2; + } + + function size() + { + var nh, ny; + + if (container.orientation == Qt.Vertical) + nh = scrollArea.visibleArea.heightRatio * container.height; + else + nh = scrollArea.visibleArea.widthRatio * container.width; + + if (container.orientation == Qt.Vertical) + ny = scrollArea.visibleArea.yPosition * container.height; + else + ny = scrollArea.visibleArea.xPosition * container.width; + + if (ny > 3) { + var t; + if (container.orientation == Qt.Vertical) + t = Math.ceil(container.height - 3 - ny); + else + t = Math.ceil(container.width - 3 - ny); + if (nh > t) return t; else return nh; + } else return nh + ny; + } + + Rectangle { anchors.fill: parent; color: "Black"; opacity: 0.3 } + + BorderImage { + source: "images/scrollbar.png" + border { left: 1; right: 1; top: 1; bottom: 1 } + x: container.orientation == Qt.Vertical ? 2 : position() + width: container.orientation == Qt.Vertical ? container.width - 4 : size() + y: container.orientation == Qt.Vertical ? position() : 2 + height: container.orientation == Qt.Vertical ? size() : container.height - 4 + } + + states: State { + name: "visible" + when: container.orientation == Qt.Vertical ? scrollArea.movingVertically : scrollArea.movingHorizontally + PropertyChanges { target: container; opacity: 1.0 } + } + + transitions: Transition { + from: "visible"; to: "" + NumberAnimation { properties: "opacity"; duration: 600 } + } +} diff --git a/examples/declarative/demos/rssnews/qml/content/images/busy.png b/examples/declarative/demos/rssnews/qml/content/images/busy.png Binary files differnew file mode 100644 index 0000000..664c2b1 --- /dev/null +++ b/examples/declarative/demos/rssnews/qml/content/images/busy.png diff --git a/examples/declarative/demos/rssnews/qml/content/images/scrollbar.png b/examples/declarative/demos/rssnews/qml/content/images/scrollbar.png Binary files differnew file mode 100644 index 0000000..0228dcf --- /dev/null +++ b/examples/declarative/demos/rssnews/qml/content/images/scrollbar.png diff --git a/examples/declarative/demos/rssnews/qml/rssnews.qml b/examples/declarative/demos/rssnews/qml/rssnews.qml new file mode 100644 index 0000000..f6fe188 --- /dev/null +++ b/examples/declarative/demos/rssnews/qml/rssnews.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: window + width: 800; height: 480 + + property string currentFeed: "rss.news.yahoo.com/rss/topstories" + property bool loading: feedModel.status == XmlListModel.Loading + + RssFeeds { id: rssFeeds } + + XmlListModel { + id: feedModel + source: "http://" + window.currentFeed + query: "/rss/channel/item" + + XmlRole { name: "title"; query: "title/string()" } + XmlRole { name: "link"; query: "link/string()" } + XmlRole { name: "description"; query: "description/string()" } + } + + Row { + Rectangle { + width: 220; height: window.height + color: "#efefef" + + ListView { + focus: true + id: categories + anchors.fill: parent + model: rssFeeds + footer: quitButtonDelegate + delegate: CategoryDelegate {} + highlight: Rectangle { color: "steelblue" } + highlightMoveSpeed: 9999999 + } + ScrollBar { + scrollArea: categories; height: categories.height; width: 8 + anchors.right: categories.right + } + } + ListView { + id: list + width: window.width - 220; height: window.height + model: feedModel + delegate: NewsDelegate {} + } + } + Component { + id: quitButtonDelegate + Item { + width: categories.width; height: 60 + Text { + text: "Quit" + font { family: "Helvetica"; pixelSize: 16; bold: true } + anchors { + left: parent.left; leftMargin: 15 + verticalCenter: parent.verticalCenter + } + } + MouseArea { + anchors.fill: parent + onClicked: Qt.quit() + } + } + } + ScrollBar { scrollArea: list; height: list.height; width: 8; anchors.right: window.right } + Rectangle { x: 220; height: window.height; width: 1; color: "#cccccc" } +} diff --git a/examples/declarative/demos/rssnews/qml/rssnews.qmlproject b/examples/declarative/demos/rssnews/qml/rssnews.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/demos/rssnews/qml/rssnews.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/demos/rssnews/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/demos/rssnews/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/demos/rssnews/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/demos/rssnews/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/demos/rssnews/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/demos/rssnews/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/demos/rssnews/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/demos/rssnews/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/demos/rssnews/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/demos/rssnews/rssnews.desktop b/examples/declarative/demos/rssnews/rssnews.desktop new file mode 100644 index 0000000..ba6110f --- /dev/null +++ b/examples/declarative/demos/rssnews/rssnews.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=rssnews +Exec=/opt/usr/bin/rssnews +Icon=rssnews +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/demos/rssnews/rssnews.png b/examples/declarative/demos/rssnews/rssnews.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/demos/rssnews/rssnews.png diff --git a/examples/declarative/demos/rssnews/rssnews.pro b/examples/declarative/demos/rssnews/rssnews.pro new file mode 100644 index 0000000..a44d567 --- /dev/null +++ b/examples/declarative/demos/rssnews/rssnews.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE72E9E51 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/demos/rssnews/rssnews.svg b/examples/declarative/demos/rssnews/rssnews.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/demos/rssnews/rssnews.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/demos/samegame/main.cpp b/examples/declarative/demos/samegame/main.cpp new file mode 100644 index 0000000..d70b1d3 --- /dev/null +++ b/examples/declarative/demos/samegame/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); + viewer.setMainQmlFile(QLatin1String("qml/qml/samegame.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/BoomBlock.qml b/examples/declarative/demos/samegame/qml/SamegameCore/BoomBlock.qml new file mode 100644 index 0000000..afda29c --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/BoomBlock.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import Qt.labs.particles 1.0 + +Item { + id: block + property bool dying: false + property bool spawned: false + property int type: 0 + + Behavior on x { + enabled: spawned; + SpringAnimation{ spring: 2; damping: 0.2 } + } + Behavior on y { + SpringAnimation{ spring: 2; damping: 0.2 } + } + + Image { + id: img + source: { + if(type == 0){ + "pics/redStone.png"; + } else if(type == 1) { + "pics/blueStone.png"; + } else { + "pics/greenStone.png"; + } + } + opacity: 0 + Behavior on opacity { NumberAnimation { duration: 200 } } + anchors.fill: parent + } + + Particles { + id: particles + + width: 1; height: 1 + anchors.centerIn: parent + + emissionRate: 0 + lifeSpan: 700; lifeSpanDeviation: 600 + angle: 0; angleDeviation: 360; + velocity: 100; velocityDeviation: 30 + source: { + if(type == 0){ + "pics/redStar.png"; + } else if (type == 1) { + "pics/blueStar.png"; + } else { + "pics/greenStar.png"; + } + } + } + + states: [ + State { + name: "AliveState"; when: spawned == true && dying == false + PropertyChanges { target: img; opacity: 1 } + }, + + State { + name: "DeathState"; when: dying == true + StateChangeScript { script: particles.burst(50); } + PropertyChanges { target: img; opacity: 0 } + StateChangeScript { script: block.destroy(1000); } + } + ] +} diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/Button.qml b/examples/declarative/demos/samegame/qml/SamegameCore/Button.qml new file mode 100644 index 0000000..140b196 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/Button.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: container + + property string text: "Button" + + signal clicked + + width: buttonLabel.width + 20; height: buttonLabel.height + 20 + smooth: true + border { width: 1; color: Qt.darker(activePalette.button) } + radius: 8 + color: activePalette.button + + gradient: Gradient { + GradientStop { + position: 0.0 + color: { + if (mouseArea.pressed) + return activePalette.dark + else + return activePalette.light + } + } + GradientStop { position: 1.0; color: activePalette.button } + } + + MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } + + Text { + id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText; font.pixelSize: 24 + } +} diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/Dialog.qml b/examples/declarative/demos/samegame/qml/SamegameCore/Dialog.qml new file mode 100644 index 0000000..e1f3900 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/Dialog.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: page + + property Item text: dialogText + + signal closed + signal opened + function forceClose() { + if(page.opacity == 0) + return; //already closed + page.closed(); + page.opacity = 0; + } + + function show(txt) { + page.opened(); + dialogText.text = txt; + page.opacity = 1; + } + + width: dialogText.width + 20; height: dialogText.height + 20 + color: "white" + border.width: 1 + opacity: 0 + visible: opacity > 0 + Behavior on opacity { + NumberAnimation { duration: 1000 } + } + + Text { id: dialogText; anchors.centerIn: parent; text: "Hello World!" } + + MouseArea { anchors.fill: parent; onClicked: forceClose(); } +} + diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/pics/background.png b/examples/declarative/demos/samegame/qml/SamegameCore/pics/background.png Binary files differnew file mode 100644 index 0000000..3734a27 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/pics/background.png diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/pics/blueStar.png b/examples/declarative/demos/samegame/qml/SamegameCore/pics/blueStar.png Binary files differnew file mode 100644 index 0000000..ff9588f --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/pics/blueStar.png diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/pics/blueStone.png b/examples/declarative/demos/samegame/qml/SamegameCore/pics/blueStone.png Binary files differnew file mode 100644 index 0000000..20e43c7 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/pics/blueStone.png diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/pics/greenStar.png b/examples/declarative/demos/samegame/qml/SamegameCore/pics/greenStar.png Binary files differnew file mode 100644 index 0000000..cd06854 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/pics/greenStar.png diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/pics/greenStone.png b/examples/declarative/demos/samegame/qml/SamegameCore/pics/greenStone.png Binary files differnew file mode 100644 index 0000000..b568a19 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/pics/greenStone.png diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/pics/redStar.png b/examples/declarative/demos/samegame/qml/SamegameCore/pics/redStar.png Binary files differnew file mode 100644 index 0000000..0a4dffe --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/pics/redStar.png diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/pics/redStone.png b/examples/declarative/demos/samegame/qml/SamegameCore/pics/redStone.png Binary files differnew file mode 100644 index 0000000..36b09a2 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/pics/redStone.png diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/pics/star.png b/examples/declarative/demos/samegame/qml/SamegameCore/pics/star.png Binary files differnew file mode 100644 index 0000000..defbde5 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/pics/star.png diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/pics/yellowStone.png b/examples/declarative/demos/samegame/qml/SamegameCore/pics/yellowStone.png Binary files differnew file mode 100644 index 0000000..b1ce762 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/pics/yellowStone.png diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/qmldir b/examples/declarative/demos/samegame/qml/SamegameCore/qmldir new file mode 100644 index 0000000..e17b1f5 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/qmldir @@ -0,0 +1,3 @@ +BoomBlock BoomBlock.qml +Button Button.qml +Dialog Dialog.qml diff --git a/examples/declarative/demos/samegame/qml/SamegameCore/samegame.js b/examples/declarative/demos/samegame/qml/SamegameCore/samegame.js new file mode 100644 index 0000000..9266767 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/SamegameCore/samegame.js @@ -0,0 +1,238 @@ +/* This script file handles the game logic */ + +var maxColumn = 10; +var maxRow = 15; +var maxIndex = maxColumn*maxRow; +var board = new Array(maxIndex); +var blockSrc = "SamegameCore/BoomBlock.qml"; +var scoresURL = ""; +var gameDuration; +var component = Qt.createComponent(blockSrc); + +//Index function used instead of a 2D array +function index(column,row) { + return column + (row * maxColumn); +} + +function timeStr(msecs) { + var secs = Math.floor(msecs/1000); + var m = Math.floor(secs/60); + var ret = "" + m + "m " + (secs%60) + "s"; + return ret; +} + +function startNewGame() +{ + //Delete blocks from previous game + for(var i = 0; i<maxIndex; i++){ + if(board[i] != null) + board[i].destroy(); + } + + //Calculate board size + maxColumn = Math.floor(gameCanvas.width/gameCanvas.blockSize); + maxRow = Math.floor(gameCanvas.height/gameCanvas.blockSize); + maxIndex = maxRow*maxColumn; + + //Close dialogs + nameInputDialog.forceClose(); + dialog.forceClose(); + + //Initialize Board + board = new Array(maxIndex); + gameCanvas.score = 0; + for(var column=0; column<maxColumn; column++){ + for(var row=0; row<maxRow; row++){ + board[index(column,row)] = null; + createBlock(column,row); + } + } + gameDuration = new Date(); +} + +var fillFound;//Set after a floodFill call to the number of blocks found +var floodBoard;//Set to 1 if the floodFill reaches off that node +//NOTE: Be careful with vars named x,y, as the calling object's x,y are still in scope +function handleClick(x,y) +{ + var column = Math.floor(x/gameCanvas.blockSize); + var row = Math.floor(y/gameCanvas.blockSize); + if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) + return; + if(board[index(column, row)] == null) + return; + //If it's a valid block, remove it and all connected (does nothing if it's not connected) + floodFill(column,row, -1); + if(fillFound <= 0) + return; + gameCanvas.score += (fillFound - 1) * (fillFound - 1); + shuffleDown(); + victoryCheck(); +} + +function floodFill(column,row,type) +{ + if(board[index(column, row)] == null) + return; + var first = false; + if(type == -1){ + first = true; + type = board[index(column,row)].type; + + //Flood fill initialization + fillFound = 0; + floodBoard = new Array(maxIndex); + } + if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) + return; + if(floodBoard[index(column, row)] == 1 || (!first && type != board[index(column,row)].type)) + return; + floodBoard[index(column, row)] = 1; + floodFill(column+1,row,type); + floodFill(column-1,row,type); + floodFill(column,row+1,type); + floodFill(column,row-1,type); + if(first==true && fillFound == 0) + return;//Can't remove single blocks + board[index(column,row)].dying = true; + board[index(column,row)] = null; + fillFound += 1; +} + +function shuffleDown() +{ + //Fall down + for(var column=0; column<maxColumn; column++){ + var fallDist = 0; + for(var row=maxRow-1; row>=0; row--){ + if(board[index(column,row)] == null){ + fallDist += 1; + }else{ + if(fallDist > 0){ + var obj = board[index(column,row)]; + obj.y = (row+fallDist) * gameCanvas.blockSize; + board[index(column,row+fallDist)] = obj; + board[index(column,row)] = null; + } + } + } + } + //Fall to the left + fallDist = 0; + for(column=0; column<maxColumn; column++){ + if(board[index(column, maxRow - 1)] == null){ + fallDist += 1; + }else{ + if(fallDist > 0){ + for(row=0; row<maxRow; row++){ + obj = board[index(column,row)]; + if(obj == null) + continue; + obj.x = (column-fallDist) * gameCanvas.blockSize; + board[index(column-fallDist,row)] = obj; + board[index(column,row)] = null; + } + } + } + } +} + +function victoryCheck() +{ + //awards bonuses for no blocks left + var deservesBonus = true; + for(var column=maxColumn-1; column>=0; column--) + if(board[index(column, maxRow - 1)] != null) + deservesBonus = false; + if(deservesBonus) + gameCanvas.score += 500; + //Checks for game over + if(deservesBonus || !(floodMoveCheck(0,maxRow-1, -1))){ + gameDuration = new Date() - gameDuration; + nameInputDialog.show("You won! Please enter your name: "); + nameInputDialog.initialWidth = nameInputDialog.text.width + 20; + if(nameInputDialog.name == "") + nameInputDialog.width = nameInputDialog.initialWidth; + nameInputDialog.text.opacity = 0;//Just a spacer + } +} + +//only floods up and right, to see if it can find adjacent same-typed blocks +function floodMoveCheck(column, row, type) +{ + if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) + return false; + if(board[index(column, row)] == null) + return false; + var myType = board[index(column, row)].type; + if(type == myType) + return true; + return floodMoveCheck(column + 1, row, myType) || + floodMoveCheck(column, row - 1, board[index(column,row)].type); +} + +function createBlock(column,row){ + // Note that we don't wait for the component to become ready. This will + // only work if the block QML is a local file. Otherwise the component will + // not be ready immediately. There is a statusChanged signal on the + // component you could use if you want to wait to load remote files. + if(component.status == Component.Ready){ + var dynamicObject = component.createObject(gameCanvas); + if(dynamicObject == null){ + console.log("error creating block"); + console.log(component.errorString()); + return false; + } + dynamicObject.type = Math.floor(Math.random() * 3); + dynamicObject.x = column*gameCanvas.blockSize; + dynamicObject.y = row*gameCanvas.blockSize; + dynamicObject.width = gameCanvas.blockSize; + dynamicObject.height = gameCanvas.blockSize; + dynamicObject.spawned = true; + board[index(column,row)] = dynamicObject; + }else{ + console.log("error loading block component"); + console.log(component.errorString()); + return false; + } + return true; +} + +function saveHighScore(name) { + if(scoresURL!="") + sendHighScore(name); + //OfflineStorage + var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores",100); + var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; + var data = [name, gameCanvas.score, maxColumn+"x"+maxRow ,Math.floor(gameDuration/1000)]; + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); + tx.executeSql(dataStr, data); + + //Only show results for the current grid size + var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "'+maxColumn+"x"+maxRow+'" ORDER BY score desc LIMIT 10'); + var r = "\nHIGH SCORES for this grid size\n\n" + for(var i = 0; i < rs.rows.length; i++){ + r += (i+1)+". " + rs.rows.item(i).name +' got ' + + rs.rows.item(i).score + ' points in ' + + rs.rows.item(i).time + ' seconds.\n'; + } + dialog.show(r); + } + ); +} + +function sendHighScore(name) { + var postman = new XMLHttpRequest() + var postData = "name="+name+"&score="+gameCanvas.score + +"&gridSize="+maxColumn+"x"+maxRow +"&time="+Math.floor(gameDuration/1000); + postman.open("POST", scoresURL, true); + postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + postman.onreadystatechange = function() { + if (postman.readyState == postman.DONE) { + dialog.show("Your score has been uploaded."); + } + } + postman.send(postData); +} diff --git a/examples/declarative/demos/samegame/qml/highscores/README b/examples/declarative/demos/samegame/qml/highscores/README new file mode 100644 index 0000000..eaa00fa --- /dev/null +++ b/examples/declarative/demos/samegame/qml/highscores/README @@ -0,0 +1 @@ +The SameGame example can interface with a simple PHP script to store XML high score data on a remote server. We do not have a publically accessible server available for this use, but if you have access to a PHP capable webserver you can copy the files (score_data.xml, score.php, score_style.xsl) to it and alter the highscore_server variable at the top of the samegame.js file to point to it. diff --git a/examples/declarative/demos/samegame/qml/highscores/score_data.xml b/examples/declarative/demos/samegame/qml/highscores/score_data.xml new file mode 100644 index 0000000..c3fd90d --- /dev/null +++ b/examples/declarative/demos/samegame/qml/highscores/score_data.xml @@ -0,0 +1,2 @@ +<record><score>1000000</score><name>Alan the Tester</name><gridSize>0x0</gridSize><seconds>0</seconds></record> +<record><score>6213</score><name>Alan</name><gridSize>12x17</gridSize><seconds>51</seconds></record> diff --git a/examples/declarative/demos/samegame/qml/highscores/score_style.xsl b/examples/declarative/demos/samegame/qml/highscores/score_style.xsl new file mode 100644 index 0000000..670354c --- /dev/null +++ b/examples/declarative/demos/samegame/qml/highscores/score_style.xsl @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<xsl:template match="/"> + <html> + <head><title>SameGame High Scores</title></head> + <body> + <h2>SameGame High Scores</h2> + <table border="1"> + <tr bgcolor="lightsteelblue"> + <th>Name</th> + <th>Score</th> + <th>Grid Size</th> + <th>Time, s</th> + </tr> + <xsl:for-each select="records/record"> + <xsl:sort select="score" data-type="number" order="descending"/> + <tr> + <td><xsl:value-of select="name"/></td> + <td><xsl:value-of select="score"/></td> + <td><xsl:value-of select="gridSize"/></td> + <td><xsl:value-of select="seconds"/></td> + </tr> + </xsl:for-each> + </table> + </body> + </html> +</xsl:template> +</xsl:stylesheet> diff --git a/examples/declarative/demos/samegame/qml/highscores/scores.php b/examples/declarative/demos/samegame/qml/highscores/scores.php new file mode 100644 index 0000000..3cceb2d --- /dev/null +++ b/examples/declarative/demos/samegame/qml/highscores/scores.php @@ -0,0 +1,34 @@ +<?php + $score = $_POST["score"]; + echo "<html>"; + echo "<head><title>SameGame High Scores</title></head><body>"; + if($score > 0){#Sending in a new high score + $name = $_POST["name"]; + $grid = $_POST["gridSize"]; + $time = $_POST["time"]; + if($name == "") + $name = "Anonymous"; + //if($grid != "10x10"){ + //Need a standard, so as to reject others? + //} + $file = fopen("score_data.xml", "a"); #It's XML. Happy? + $ret = fwrite($file, "<record><score>". $score . "</score><name>" + . $name . "</name><gridSize>" . $grid . "</gridSize><seconds>" + . $time . "</seconds></record>\n"); + echo "Your score has been recorded. Thanks for playing!"; + if($ret == False) + echo "<br/> There was an error though, so don't expect to see that score again."; + }else{#Read high score list + #Now uses XSLT to display. So just print the file. With XML cruft added. + #Note that firefox at least won't apply the XSLT on a php file. So redirecting + $file = fopen("scores.xml", "w"); + $ret = fwrite($file, '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n" + . '<?xml-stylesheet type="text/xsl" href="score_style.xsl"?>' . "\n" + . "<records>\n" . file_get_contents("score_data.xml") . "</records>\n"); + if($ret == False) + echo "There was an internal error. Sorry."; + else + echo '<script type="text/javascript">window.location.replace("scores.xml")</script>'; + } + echo "</body></html>"; +?> diff --git a/examples/declarative/demos/samegame/qml/samegame.qml b/examples/declarative/demos/samegame/qml/samegame.qml new file mode 100644 index 0000000..ab49c04 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/samegame.qml @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "SamegameCore" +import "SamegameCore/samegame.js" as Logic + +Rectangle { + id: screen + width: 490; height: 720 + property bool inAnotherDemo: false //Samegame often is just plonked straight into other demos + + SystemPalette { id: activePalette } + + Item { + width: parent.width + anchors { top: parent.top; bottom: toolBar.top } + + Image { + id: background + anchors.fill: parent + source: "SamegameCore/pics/background.png" + fillMode: Image.PreserveAspectCrop + } + + Item { + id: gameCanvas + property int score: 0 + property int blockSize: 40 + + z: 20; anchors.centerIn: parent + width: parent.width - (parent.width % blockSize); + height: parent.height - (parent.height % blockSize); + + MouseArea { + anchors.fill: parent; onClicked: Logic.handleClick(mouse.x,mouse.y); + } + } + } + + Dialog { id: dialog; anchors.centerIn: parent; z: 21 } + + Dialog { + id: nameInputDialog + + property int initialWidth: 0 + property alias name: nameInputText.text + + anchors.centerIn: parent + z: 22; + + Behavior on width { + NumberAnimation {} + enabled: nameInputDialog.initialWidth != 0 + } + + onClosed: { + if (nameInputText.text != "") + Logic.saveHighScore(nameInputText.text); + } + Text { + id: dialogText + anchors { left: nameInputDialog.left; leftMargin: 20; verticalCenter: parent.verticalCenter } + text: "You won! Please enter your name: " + } + MouseArea { + anchors.fill: parent + onClicked: { + if (nameInputText.text == "") + nameInputText.openSoftwareInputPanel(); + else + nameInputDialog.forceClose(); + } + } + + TextInput { + id: nameInputText + anchors { verticalCenter: parent.verticalCenter; left: dialogText.right } + focus: visible + autoScroll: false + maximumLength: 24 + onTextChanged: { + var newWidth = nameInputText.width + dialogText.width + 40; + if ( (newWidth > nameInputDialog.width && newWidth < screen.width) + || (nameInputDialog.width > nameInputDialog.initialWidth) ) + nameInputDialog.width = newWidth; + } + onAccepted: { + nameInputDialog.forceClose(); + } + } + } + + Rectangle { + id: toolBar + width: parent.width; height: 58 + color: activePalette.window + anchors.bottom: screen.bottom + + Button { + id: newGameButton + anchors { left: parent.left; leftMargin: 3; verticalCenter: parent.verticalCenter } + text: "New Game" + onClicked: Logic.startNewGame() + } + + Button { + visible: !inAnotherDemo + text: "Quit" + anchors { left: newGameButton.right; leftMargin: 3; verticalCenter: parent.verticalCenter } + onClicked: Qt.quit(); + } + + Text { + id: score + anchors { right: parent.right; rightMargin: 3; verticalCenter: parent.verticalCenter } + text: "Score: " + gameCanvas.score + font.bold: true + font.pixelSize: 24 + color: activePalette.windowText + } + } +} diff --git a/examples/declarative/demos/samegame/qml/samegame.qmlproject b/examples/declarative/demos/samegame/qml/samegame.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/demos/samegame/qml/samegame.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/demos/samegame/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/demos/samegame/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/demos/samegame/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/demos/samegame/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/demos/samegame/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/demos/samegame/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/demos/samegame/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/demos/samegame/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/demos/samegame/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/demos/samegame/samegame.desktop b/examples/declarative/demos/samegame/samegame.desktop new file mode 100644 index 0000000..e9e79c6 --- /dev/null +++ b/examples/declarative/demos/samegame/samegame.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=samegame +Exec=/opt/usr/bin/samegame +Icon=samegame +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/demos/samegame/samegame.png b/examples/declarative/demos/samegame/samegame.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/demos/samegame/samegame.png diff --git a/examples/declarative/demos/samegame/samegame.pro b/examples/declarative/demos/samegame/samegame.pro new file mode 100644 index 0000000..ac548d5 --- /dev/null +++ b/examples/declarative/demos/samegame/samegame.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE6438E92 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/demos/samegame/samegame.svg b/examples/declarative/demos/samegame/samegame.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/demos/samegame/samegame.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/demos/twitter/main.cpp b/examples/declarative/demos/twitter/main.cpp new file mode 100644 index 0000000..b3b58df --- /dev/null +++ b/examples/declarative/demos/twitter/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); + viewer.setMainQmlFile(QLatin1String("qml/qml/twitter.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/Button.qml b/examples/declarative/demos/twitter/qml/TwitterCore/Button.qml new file mode 100644 index 0000000..a1fc2a2 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/Button.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + signal clicked + + property string text + property bool keyUsing: false + + BorderImage { + id: buttonImage + source: "images/toolbutton.sci" + width: container.width; height: container.height + } + BorderImage { + id: pressed + opacity: 0 + source: "images/toolbutton.sci" + width: container.width; height: container.height + } + MouseArea { + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.clicked(); } + } + Text { + id: btnText + color: if(container.keyUsing){"#D0D0D0";} else {"#FFFFFF";} + anchors.centerIn: buttonImage; font.bold: true + text: container.text; style: Text.Raised; styleColor: "black" + font.pixelSize: 12 + } + states: [ + State { + name: "Pressed" + when: mouseRegion.pressed == true + PropertyChanges { target: pressed; opacity: 1 } + }, + State { + name: "Focused" + when: container.activeFocus == true + PropertyChanges { target: btnText; color: "#FFFFFF" } + } + ] + transitions: Transition { + ColorAnimation { target: btnText; } + } +} diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/FatDelegate.qml b/examples/declarative/demos/twitter/qml/TwitterCore/FatDelegate.qml new file mode 100644 index 0000000..896abbe --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/FatDelegate.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Component { + id: listDelegate + Item { + id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 60){txt.height+10}else{60} //50+5+5 + function handleLink(link){ + if(link.slice(0,3) == 'app'){ + screen.setUser(link.slice(7)); + }else if(link.slice(0,4) == 'http'){ + Qt.openUrlExternally(link); + } + } + function addTags(str){ + var ret = str.replace(/@[a-zA-Z0-9_]+/g, '<a href="app://$&">$&</a>');//click to jump to user? + var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '<a href="$&">$&</a>');//surrounds http links with html link tags + return ret2; + } + + // Strip away paranthesis + function userName(str) { + var user = str.replace(/\([\S|\s]*\)/gi, ""); + return user.trim(); + } + + Item { + id: moveMe; height: parent.height + Rectangle { + id: blackRect + color: "black"; opacity: wrapper.ListView.index % 2 ? 0.2 : 0.3; height: wrapper.height-2; width: wrapper.width; y: 1 + } + Item { + id: image; x: 6; width: 48; height: 48; smooth: true + anchors.verticalCenter: parent.verticalCenter + + Loading { x: 1; y: 1; width: 48; height: 48; visible: realImage.status != Image.Ready } + Image { + id: realImage; + source: userImage; x: 1; y: 1; + width:48; height:48; opacity:0 ; + onStatusChanged: { + if(status==Image.Ready) + image.state="loaded" + } + } + states: State { + name: "loaded"; + PropertyChanges { target: realImage ; opacity:1 } + } + transitions: Transition { NumberAnimation { target: realImage; property: "opacity"; duration: 200 } } + + } + Text { id:txt; y:4; x: 56 + text: '<html><style type="text/css">a:link {color:"#aaccaa"}; a:visited {color:"#336633"}</style>' + + '<a href="app://@'+userName(name)+'"><b>'+userName(name) + "</b></a> from " +source + + "<br /><b>" + statusText + "</b></html>"; + textFormat: Qt.RichText + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap + anchors.left: image.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 + onLinkActivated: wrapper.handleLink(link) + } + } + } +} diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/Input.qml b/examples/declarative/demos/twitter/qml/TwitterCore/Input.qml new file mode 100644 index 0000000..b15f0d5 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/Input.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +FocusScope { + id:container + width: 220 + height: 28 + BorderImage { source: "images/lineedit.sci"; anchors.fill: parent } + signal accepted + property alias text: input.text + property alias item:input + TextInput{ + id: input + width: parent.width - 12 + anchors.centerIn: parent + maximumLength:21 + font.pixelSize: 16; + font.bold: true + color: "#151515"; selectionColor: "mediumseagreen" + focus: true + onAccepted:{container.accepted()} + text: "" + selectByMouse: true + } +} diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/Loading.qml b/examples/declarative/demos/twitter/qml/TwitterCore/Loading.qml new file mode 100644 index 0000000..afeafa0 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/Loading.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: loading; source: "images/loading.png" + NumberAnimation on rotation { + from: 0; to: 360; running: loading.visible == true; loops: Animation.Infinite; duration: 900 + } +} diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/MultiTitleBar.qml b/examples/declarative/demos/twitter/qml/TwitterCore/MultiTitleBar.qml new file mode 100644 index 0000000..bc8e0de --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/MultiTitleBar.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + TitleBar { id: titleBar; width: parent.width; height: 60; + y: -80 + untaggedString: "Latest tweets from everyone" + taggedString: "Latest tweets from " + } + states: [ + State { + name: "search"; when: screen.state!="search" + PropertyChanges { target: titleBar; y: 0 } + } + ] + transitions: [ + Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } } + ] +} + diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/RssModel.qml b/examples/declarative/demos/twitter/qml/TwitterCore/RssModel.qml new file mode 100644 index 0000000..276df62 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/RssModel.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { id: wrapper + property variant model: xmlModel + property string from : "" + property string to : "" + property string phrase : "" + + property string mode : "everyone" + property int status: xmlModel.status + function reload() { xmlModel.reload(); } + XmlListModel { + id: xmlModel + + source: (from=="" && to=="" && phrase=="") ? "" : + 'http://search.twitter.com/search.atom?from='+from+"&to="+to+"&phrase="+phrase + + namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom'; " + + "declare namespace twitter=\"http://api.twitter.com/\";"; + + query: "/feed/entry" + + XmlRole { name: "statusText"; query: "content/string()" } + XmlRole { name: "timestamp"; query: "published/string()" } + XmlRole { name: "source"; query: "twitter:source/string()" } + XmlRole { name: "name"; query: "author/name/string()" } + XmlRole { name: "userImage"; query: "link[@rel = 'image']/@href/string()" } + + } + Binding { + property: "mode" + target: wrapper + value: {if(wrapper.tags==''){"everyone";}else if(wrapper.tags=='my timeline'){"self";}else{"user";}} + } +} diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/SearchView.qml b/examples/declarative/demos/twitter/qml/TwitterCore/SearchView.qml new file mode 100644 index 0000000..effab30 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/SearchView.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +FocusScope { + id: wrapper + Column { + anchors.centerIn: parent + spacing: 20 + Column{ + spacing: 4 + Text { + text: "Posted by:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Input{ + id: fromIn + KeyNavigation.backtab: searchbutton + KeyNavigation.tab:toIn + onAccepted:searchbutton.doSearch(); + focus: true + } + Text { + text: "In reply to:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Input{ + id: toIn + KeyNavigation.backtab: fromIn + KeyNavigation.tab:phraseIn + onAccepted:searchbutton.doSearch(); + } + Text { + text: "Search phrase:" + font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" + horizontalAlignment: Qt.AlignRight + } + Input{ + id: phraseIn + KeyNavigation.backtab: toIn + KeyNavigation.tab:searchbutton + onAccepted:searchbutton.doSearch(); + text: "Qt Quick" + } + } + Button { + width: 100 + height: 32 + id: searchbutton + keyUsing: true; + opacity: 1 + text: "Search" + KeyNavigation.tab: fromIn + Keys.onReturnPressed: searchbutton.doSearch(); + Keys.onEnterPressed: searchbutton.doSearch(); + Keys.onSelectPressed: searchbutton.doSearch(); + Keys.onSpacePressed: searchbutton.doSearch(); + onClicked: searchbutton.doSearch(); + + function doSearch() { + // Search ! allowed + if (wrapper.state=="invalidinput") + return; + + rssModel.from=fromIn.text; + rssModel.to= toIn.text; + rssModel.phrase = phraseIn.text; + screen.focus = true; + screen.state = "" + } + } + } + states: + State { + name: "invalidinput" + when: fromIn.text=="" && toIn.text=="" && phraseIn.text=="" + PropertyChanges { target: searchbutton ; opacity: 0.6 ; } + } + transitions: + Transition { + NumberAnimation { target: searchbutton; property: "opacity"; duration: 200 } + } +} diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/TitleBar.qml b/examples/declarative/demos/twitter/qml/TwitterCore/TitleBar.qml new file mode 100644 index 0000000..19da491 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/TitleBar.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: titleBar + property string untaggedString: "Uploads from everyone" + property string taggedString: "Recent uploads tagged " + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + + Item { + id: container + width: (parent.width * 2) - 55 ; height: parent.height + + function accept() { + titleBar.state = "" + background.state = "" + rssModel.tags = editor.text + } + + Item { + id:imageBox + x: 6; width: 0; height: 50; smooth: true + anchors.verticalCenter: parent.verticalCenter + + UserModel { user: rssModel.from; id: userModel } + Component { + id: imgDelegate; + Item { + id:imageitem + visible:true + Loading { width:48; height:48; visible: realImage.status != Image.Ready } + Image { id: realImage; source: image; width:48; height:48; opacity:0; } + states: + State { + name: "loaded" + when: (realImage.status == Image.Ready) + PropertyChanges { target: realImage; opacity:1 } + } + transitions: Transition { + NumberAnimation { target: realImage; property: "opacity"; duration: 200 } + } + } + } + ListView { id:view; model: userModel.model; x:1; y:1; delegate: imgDelegate } + states: + State { + when: !userModel.user=="" + PropertyChanges { target: imageBox; width: 50; } + } + transitions: + Transition { + NumberAnimation { target: imageBox; property: "width"; duration: 200 } + } + } + + Image { + id: quitButton + x: 5 + anchors.verticalCenter: parent.verticalCenter + source: "images/quit.png" + MouseArea { + anchors.fill: parent + onClicked: Qt.quit() + } + } + + Text { + id: categoryText + anchors { + left: quitButton.right; right: parent.right; leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + elide: Text.ElideLeft + text: (rssModel.from=="" ? untaggedString : taggedString + rssModel.from) + font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black" + font.pixelSize: 12 + } + } + + states: State { + name: "Tags" + PropertyChanges { target: container; x: -tagButton.x + 5 } + PropertyChanges { target: editor; focus: true } + } + + transitions: Transition { + NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad } + } +} diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/ToolBar.qml b/examples/declarative/demos/twitter/qml/TwitterCore/ToolBar.qml new file mode 100644 index 0000000..4ef92ff --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/ToolBar.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: toolbar + + property alias button1Label: button1.text + property alias button2Label: button2.text + signal button1Clicked + signal button2Clicked + focus:true + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + Button { + id: button1 + anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32 + onClicked: toolbar.button1Clicked() + focus:true + } + Button { + id: button2 + anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32 + onClicked: toolbar.button2Clicked() + } +} diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/UserModel.qml b/examples/declarative/demos/twitter/qml/TwitterCore/UserModel.qml new file mode 100644 index 0000000..013b827 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/UserModel.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +//This "model" gets the user information about the searched user. Mainly for the icon. + +Item { id: wrapper + property variant model: xmlModel + property string user : "" + property int status: xmlModel.status + function reload() { xmlModel.reload(); } + XmlListModel { + id: xmlModel + + source: user!= "" ? "http://twitter.com/users/show.xml?screen_name="+user : "" + query: "/user" + + XmlRole { name: "name"; query: "name/string()" } + XmlRole { name: "screenName"; query: "screen_name/string()" } + XmlRole { name: "image"; query: "profile_image_url/string()" } + XmlRole { name: "location"; query: "location/string()" } + XmlRole { name: "description"; query: "description/string()" } + XmlRole { name: "followers"; query: "followers_count/string()" } + //TODO: Could also get the user's color scheme, timezone and a few other things + } +} diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/images/gloss.png b/examples/declarative/demos/twitter/qml/TwitterCore/images/gloss.png Binary files differnew file mode 100644 index 0000000..5d370cd --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/images/gloss.png diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/images/lineedit.png b/examples/declarative/demos/twitter/qml/TwitterCore/images/lineedit.png Binary files differnew file mode 100644 index 0000000..2cc38dc --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/images/lineedit.png diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/images/lineedit.sci b/examples/declarative/demos/twitter/qml/TwitterCore/images/lineedit.sci new file mode 100644 index 0000000..054bff7 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/images/lineedit.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 10 +border.bottom: 10 +border.right: 10 +source: lineedit.png diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/images/loading.png b/examples/declarative/demos/twitter/qml/TwitterCore/images/loading.png Binary files differnew file mode 100644 index 0000000..47a1589 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/images/loading.png diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/images/quit.png b/examples/declarative/demos/twitter/qml/TwitterCore/images/quit.png Binary files differnew file mode 100644 index 0000000..5bda1b6 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/images/quit.png diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/images/stripes.png b/examples/declarative/demos/twitter/qml/TwitterCore/images/stripes.png Binary files differnew file mode 100644 index 0000000..9f36727 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/images/stripes.png diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/images/titlebar.png b/examples/declarative/demos/twitter/qml/TwitterCore/images/titlebar.png Binary files differnew file mode 100644 index 0000000..51c9008 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/images/titlebar.png diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/images/titlebar.sci b/examples/declarative/demos/twitter/qml/TwitterCore/images/titlebar.sci new file mode 100644 index 0000000..0418d94 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/images/titlebar.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 12 +border.bottom: 12 +border.right: 10 +source: titlebar.png diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/images/toolbutton.png b/examples/declarative/demos/twitter/qml/TwitterCore/images/toolbutton.png Binary files differnew file mode 100644 index 0000000..1131001 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/images/toolbutton.png diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/images/toolbutton.sci b/examples/declarative/demos/twitter/qml/TwitterCore/images/toolbutton.sci new file mode 100644 index 0000000..9e4f965 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/images/toolbutton.sci @@ -0,0 +1,5 @@ +border.left: 15 +border.top: 4 +border.bottom: 4 +border.right: 15 +source: toolbutton.png diff --git a/examples/declarative/demos/twitter/qml/TwitterCore/qmldir b/examples/declarative/demos/twitter/qml/TwitterCore/qmldir new file mode 100644 index 0000000..84d85c2 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/TwitterCore/qmldir @@ -0,0 +1,10 @@ +SearchView 1.0 SearchView.qml +Button 1.0 Button.qml +Input 1.0 Input.qml +FatDelegate 1.0 FatDelegate.qml +Loading 1.0 Loading.qml +MultiTitleBar 1.0 MultiTitleBar.qml +TitleBar 1.0 TitleBar.qml +RssModel 1.0 RssModel.qml +UserModel 1.0 UserModel.qml +ToolBar 1.0 ToolBar.qml diff --git a/examples/declarative/demos/twitter/qml/twitter.qml b/examples/declarative/demos/twitter/qml/twitter.qml new file mode 100644 index 0000000..74bab37 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/twitter.qml @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "TwitterCore" 1.0 as Twitter + +Item { + id: screen; width: 320; height: 480 + property bool userView : false + property variant tmpStr + function setUser(str){hack.running = true; tmpStr = str} + function reallySetUser(){rssModel.from = tmpStr;rssModel.to = ""; rssModel.phrase = ""} + state:"searchquery" + //Workaround for bug 260266 + Timer{ interval: 1; running: false; repeat: false; onTriggered: screen.reallySetUser(); id:hack } + Keys.onEscapePressed: screen.state="searchquery" + Keys.onBacktabPressed: screen.state="searchquery" + Rectangle { + id: background + anchors.fill: parent; color: "#343434"; + + state:"searchquery" + Image { source: "TwitterCore/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } + + MouseArea { + anchors.fill: parent + onClicked: screen.focus = false; + } + + Twitter.RssModel { id: rssModel } + Twitter.Loading { anchors.centerIn: parent; visible: rssModel.status==XmlListModel.Loading && state!='unauthed'} + Text { + width: 180 + text: "Could not access twitter using this screen name and password pair."; + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap + visible: rssModel.status==XmlListModel.Error; anchors.centerIn: parent + } + + Item { + id: views + x: 2; width: parent.width - 4 + y:60 //Below the title bars + height: parent.height - 100 + + Text { + id:title + text: "Search Twitter" + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 20; font.bold: true; color: "#bbb"; style: Text.Raised; styleColor: "black" + opacity:0 + } + + Twitter.SearchView{ + id: searchView + anchors.verticalCenter: parent.verticalCenter + width: parent.width; height: parent.height-60; + x: -(screen.width * 1.5) + } + + Twitter.FatDelegate { id: fatDelegate } + ListView { + id: mainView; model: rssModel.model; delegate: fatDelegate; + width: parent.width; height: parent.height; x: 0; cacheBuffer: 100; + } + } + + Twitter.MultiTitleBar { id: titleBar; width: parent.width } + Twitter.ToolBar { id: toolBar; height: 40; + //anchors.bottom: parent.bottom; + //TODO: Use anchor changes instead of hard coding + y: screen.height - 40 + width: parent.width; opacity: 0.9 + button1Label: "New Search" + button2Label: "Update" + onButton1Clicked: + { + screen.state="searchquery" + } + onButton2Clicked: rssModel.reload(); + } + } + states: [ + State { + name: "searchquery"; + PropertyChanges { target: searchView; x: 0; focus:true} + PropertyChanges { target: mainView; x: -(parent.width * 1.5) } + PropertyChanges { target: titleBar; y: -80 } + PropertyChanges { target: toolBar; y: screen.height } + PropertyChanges { target: toolBar } + PropertyChanges { target: title; opacity:1} + } + ] + transitions: [ + Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutQuad } } + ] +} diff --git a/examples/declarative/demos/twitter/qml/twitter.qmlproject b/examples/declarative/demos/twitter/qml/twitter.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/demos/twitter/qml/twitter.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/demos/twitter/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/demos/twitter/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/demos/twitter/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/demos/twitter/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/demos/twitter/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/demos/twitter/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/demos/twitter/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/demos/twitter/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/demos/twitter/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/demos/twitter/twitter.desktop b/examples/declarative/demos/twitter/twitter.desktop new file mode 100644 index 0000000..afe52c5 --- /dev/null +++ b/examples/declarative/demos/twitter/twitter.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=twitter +Exec=/opt/usr/bin/twitter +Icon=twitter +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/demos/twitter/twitter.png b/examples/declarative/demos/twitter/twitter.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/demos/twitter/twitter.png diff --git a/examples/declarative/demos/twitter/twitter.pro b/examples/declarative/demos/twitter/twitter.pro new file mode 100644 index 0000000..253e5db --- /dev/null +++ b/examples/declarative/demos/twitter/twitter.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE49225BD + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/demos/twitter/twitter.svg b/examples/declarative/demos/twitter/twitter.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/demos/twitter/twitter.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/demos/webbrowser/main.cpp b/examples/declarative/demos/webbrowser/main.cpp new file mode 100644 index 0000000..cd08611 --- /dev/null +++ b/examples/declarative/demos/webbrowser/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); + viewer.setMainQmlFile(QLatin1String("qml/qml/webbrowser.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/demos/webbrowser/qml/content/Button.qml b/examples/declarative/demos/webbrowser/qml/content/Button.qml new file mode 100644 index 0000000..2da1c11 --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/Button.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + property alias image: icon.source + property variant action + + signal clicked + + width: 40; height: parent.height + + Image { + id: icon; anchors.centerIn: parent + opacity: if (action != undefined) { action.enabled ? 1.0 : 0.4 } else 1 + } + + MouseArea { + anchors { fill: parent; topMargin: -10; bottomMargin: -10 } + onClicked: { + if (action != undefined) + action.trigger() + parent.clicked() + } + } +} diff --git a/examples/declarative/demos/webbrowser/qml/content/FlickableWebView.qml b/examples/declarative/demos/webbrowser/qml/content/FlickableWebView.qml new file mode 100644 index 0000000..6f4e09c --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/FlickableWebView.qml @@ -0,0 +1,195 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +Flickable { + property alias title: webView.title + property alias icon: webView.icon + property alias progress: webView.progress + property alias url: webView.url + property alias back: webView.back + property alias stop: webView.stop + property alias reload: webView.reload + property alias forward: webView.forward + + id: flickable + width: parent.width + contentWidth: Math.max(parent.width,webView.width) + contentHeight: Math.max(parent.height,webView.height) + anchors.top: headerSpace.bottom + anchors.bottom: parent.top + anchors.left: parent.left + anchors.right: parent.right + pressDelay: 200 + + onWidthChanged : { + // Expand (but not above 1:1) if otherwise would be smaller that available width. + if (width > webView.width*webView.contentsScale && webView.contentsScale < 1.0) + webView.contentsScale = width / webView.width * webView.contentsScale; + } + + WebView { + id: webView + transformOrigin: Item.TopLeft + + function fixUrl(url) + { + if (url == "") return url + if (url[0] == "/") return "file://"+url + if (url.indexOf(":")<0) { + if (url.indexOf(".")<0 || url.indexOf(" ")>=0) { + // Fall back to a search engine; hard-code Wikipedia + return "http://en.wikipedia.org/w/index.php?search="+url + } else { + return "http://"+url + } + } + return url + } + + url: fixUrl(webBrowser.urlString) + smooth: false // We don't want smooth scaling, since we only scale during (fast) transitions + focus: true + + onAlert: console.log(message) + + function doZoom(zoom,centerX,centerY) + { + if (centerX) { + var sc = zoom*contentsScale; + scaleAnim.to = sc; + flickVX.from = flickable.contentX + flickVX.to = Math.max(0,Math.min(centerX-flickable.width/2,webView.width*sc-flickable.width)) + finalX.value = flickVX.to + flickVY.from = flickable.contentY + flickVY.to = Math.max(0,Math.min(centerY-flickable.height/2,webView.height*sc-flickable.height)) + finalY.value = flickVY.to + quickZoom.start() + } + } + + Keys.onLeftPressed: webView.contentsScale -= 0.1 + Keys.onRightPressed: webView.contentsScale += 0.1 + + preferredWidth: flickable.width + preferredHeight: flickable.height + contentsScale: 1 + onContentsSizeChanged: { + // zoom out + contentsScale = Math.min(1,flickable.width / contentsSize.width) + } + onUrlChanged: { + // got to topleft + flickable.contentX = 0 + flickable.contentY = 0 + if (url != null) { header.editUrl = url.toString(); } + } + onDoubleClick: { + if (!heuristicZoom(clickX,clickY,2.5)) { + var zf = flickable.width / contentsSize.width + if (zf >= contentsScale) + zf = 2.0/zoomFactor // zoom in (else zooming out) + doZoom(zf,clickX*zf,clickY*zf) + } + } + + SequentialAnimation { + id: quickZoom + + PropertyAction { + target: webView + property: "renderingEnabled" + value: false + } + ParallelAnimation { + NumberAnimation { + id: scaleAnim + target: webView + property: "contentsScale" + // the to property is set before calling + easing.type: Easing.Linear + duration: 200 + } + NumberAnimation { + id: flickVX + target: flickable + property: "contentX" + easing.type: Easing.Linear + duration: 200 + from: 0 // set before calling + to: 0 // set before calling + } + NumberAnimation { + id: flickVY + target: flickable + property: "contentY" + easing.type: Easing.Linear + duration: 200 + from: 0 // set before calling + to: 0 // set before calling + } + } + // Have to set the contentXY, since the above 2 + // size changes may have started a correction if + // contentsScale < 1.0. + PropertyAction { + id: finalX + target: flickable + property: "contentX" + value: 0 // set before calling + } + PropertyAction { + id: finalY + target: flickable + property: "contentY" + value: 0 // set before calling + } + PropertyAction { + target: webView + property: "renderingEnabled" + value: true + } + } + onZoomTo: doZoom(zoom,centerX,centerY) + } +} diff --git a/examples/declarative/demos/webbrowser/qml/content/Header.qml b/examples/declarative/demos/webbrowser/qml/content/Header.qml new file mode 100644 index 0000000..88e3000 --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/Header.qml @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: header + + property alias editUrl: urlInput.url + property bool urlChanged: false + + source: "pics/titlebar-bg.png"; fillMode: Image.TileHorizontally + + x: webView.contentX < 0 ? -webView.contentX : webView.contentX > webView.contentWidth-webView.width + ? -webView.contentX+webView.contentWidth-webView.width : 0 + y: { + if (webView.progress < 1.0) + return 0; + else { + webView.contentY < 0 ? -webView.contentY : webView.contentY > height ? -height : -webView.contentY + } + } + Column { + width: parent.width + + Item { + width: parent.width; height: 20 + Text { + anchors.centerIn: parent + text: webView.title; font.pixelSize: 14; font.bold: true + color: "white"; styleColor: "black"; style: Text.Sunken + } + } + + Item { + width: parent.width; height: 40 + + Button { + id: backButton + action: webView.back; image: "pics/go-previous-view.png" + anchors { left: parent.left; bottom: parent.bottom } + } + + Button { + id: nextButton + anchors.left: backButton.right + action: webView.forward; image: "pics/go-next-view.png" + } + + UrlInput { + id: urlInput + anchors { left: nextButton.right; right: reloadButton.left } + image: "pics/display.png" + onUrlEntered: { + webBrowser.urlString = url + webBrowser.focus = true + header.urlChanged = false + } + onUrlChanged: header.urlChanged = true + } + + Button { + id: reloadButton + anchors { right: quitButton.left; rightMargin: 10 } + action: webView.reload; image: "pics/view-refresh.png" + visible: webView.progress == 1.0 && !header.urlChanged + } + Text { + id: quitButton + color: "white" + style: Text.Sunken + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 18 + width: 60 + text: "Quit" + MouseArea { + anchors.fill: parent + onClicked: Qt.quit() + } + Rectangle { + width: 1 + y: 5 + height: parent.height-10 + anchors.right: parent.left + color: "darkgray" + } + } + + Button { + id: stopButton + anchors { right: quitButton.left; rightMargin: 10 } + action: webView.stop; image: "pics/edit-delete.png" + visible: webView.progress < 1.0 && !header.urlChanged + } + + Button { + id: goButton + anchors { right: parent.right; rightMargin: 4 } + onClicked: { + webBrowser.urlString = urlInput.url + webBrowser.focus = true + header.urlChanged = false + } + image: "pics/go-jump-locationbar.png"; visible: header.urlChanged + } + } + } +} diff --git a/examples/declarative/demos/webbrowser/qml/content/ScrollBar.qml b/examples/declarative/demos/webbrowser/qml/content/ScrollBar.qml new file mode 100644 index 0000000..19309fa --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/ScrollBar.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property variant scrollArea + property variant orientation: Qt.Vertical + + opacity: 0 + + function position() + { + var ny = 0; + if (container.orientation == Qt.Vertical) + ny = scrollArea.visibleArea.yPosition * container.height; + else + ny = scrollArea.visibleArea.xPosition * container.width; + if (ny > 2) return ny; else return 2; + } + + function size() + { + var nh, ny; + + if (container.orientation == Qt.Vertical) + nh = scrollArea.visibleArea.heightRatio * container.height; + else + nh = scrollArea.visibleArea.widthRatio * container.width; + + if (container.orientation == Qt.Vertical) + ny = scrollArea.visibleArea.yPosition * container.height; + else + ny = scrollArea.visibleArea.xPosition * container.width; + + if (ny > 3) { + var t; + if (container.orientation == Qt.Vertical) + t = Math.ceil(container.height - 3 - ny); + else + t = Math.ceil(container.width - 3 - ny); + if (nh > t) return t; else return nh; + } else return nh + ny; + } + + Rectangle { anchors.fill: parent; color: "Black"; opacity: 0.5 } + + BorderImage { + source: "pics/scrollbar.png" + border { left: 1; right: 1; top: 1; bottom: 1 } + x: container.orientation == Qt.Vertical ? 2 : position() + width: container.orientation == Qt.Vertical ? container.width - 4 : size() + y: container.orientation == Qt.Vertical ? position() : 2 + height: container.orientation == Qt.Vertical ? size() : container.height - 4 + } + + states: State { + name: "visible" + when: container.orientation == Qt.Vertical ? scrollArea.movingVertically : scrollArea.movingHorizontally + PropertyChanges { target: container; opacity: 1.0 } + } + + transitions: Transition { + from: "visible"; to: "" + NumberAnimation { properties: "opacity"; duration: 600 } + } +} diff --git a/examples/declarative/demos/webbrowser/qml/content/UrlInput.qml b/examples/declarative/demos/webbrowser/qml/content/UrlInput.qml new file mode 100644 index 0000000..0468b64 --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/UrlInput.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property alias image: bg.source + property alias url: urlText.text + + signal urlEntered(string url) + signal urlChanged + + width: parent.height; height: parent.height + + BorderImage { + id: bg; rotation: 180 + x: 8; width: parent.width - 16; height: 30; + anchors.verticalCenter: parent.verticalCenter + border { left: 10; top: 10; right: 10; bottom: 10 } + } + + Rectangle { + anchors.bottom: bg.bottom + x: 18; height: 4; color: "#63b1ed" + width: (bg.width - 20) * webView.progress + opacity: webView.progress == 1.0 ? 0.0 : 1.0 + } + + TextInput { + id: urlText + horizontalAlignment: TextEdit.AlignLeft + font.pixelSize: 14; + + onTextChanged: container.urlChanged() + + Keys.onEscapePressed: { + urlText.text = webView.url + webView.focus = true + } + + Keys.onEnterPressed: { + container.urlEntered(urlText.text) + webView.focus = true + } + + Keys.onReturnPressed: { + container.urlEntered(urlText.text) + webView.focus = true + } + + anchors { + left: parent.left; right: parent.right; leftMargin: 18; rightMargin: 18 + verticalCenter: parent.verticalCenter + } + } +} diff --git a/examples/declarative/demos/webbrowser/qml/content/pics/display.png b/examples/declarative/demos/webbrowser/qml/content/pics/display.png Binary files differnew file mode 100644 index 0000000..9507f43 --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/pics/display.png diff --git a/examples/declarative/demos/webbrowser/qml/content/pics/edit-delete.png b/examples/declarative/demos/webbrowser/qml/content/pics/edit-delete.png Binary files differnew file mode 100644 index 0000000..df2a147 --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/pics/edit-delete.png diff --git a/examples/declarative/demos/webbrowser/qml/content/pics/go-jump-locationbar.png b/examples/declarative/demos/webbrowser/qml/content/pics/go-jump-locationbar.png Binary files differnew file mode 100644 index 0000000..61f779c --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/pics/go-jump-locationbar.png diff --git a/examples/declarative/demos/webbrowser/qml/content/pics/go-next-view.png b/examples/declarative/demos/webbrowser/qml/content/pics/go-next-view.png Binary files differnew file mode 100644 index 0000000..a585cab --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/pics/go-next-view.png diff --git a/examples/declarative/demos/webbrowser/qml/content/pics/go-previous-view.png b/examples/declarative/demos/webbrowser/qml/content/pics/go-previous-view.png Binary files differnew file mode 100644 index 0000000..612fb34 --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/pics/go-previous-view.png diff --git a/examples/declarative/demos/webbrowser/qml/content/pics/scrollbar.png b/examples/declarative/demos/webbrowser/qml/content/pics/scrollbar.png Binary files differnew file mode 100644 index 0000000..0228dcf --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/pics/scrollbar.png diff --git a/examples/declarative/demos/webbrowser/qml/content/pics/titlebar-bg.png b/examples/declarative/demos/webbrowser/qml/content/pics/titlebar-bg.png Binary files differnew file mode 100644 index 0000000..06961e8 --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/pics/titlebar-bg.png diff --git a/examples/declarative/demos/webbrowser/qml/content/pics/view-refresh.png b/examples/declarative/demos/webbrowser/qml/content/pics/view-refresh.png Binary files differnew file mode 100644 index 0000000..afa2a9d --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/content/pics/view-refresh.png diff --git a/examples/declarative/demos/webbrowser/qml/webbrowser.qml b/examples/declarative/demos/webbrowser/qml/webbrowser.qml new file mode 100644 index 0000000..a21fa0b --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/webbrowser.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +import "content" + +Rectangle { + id: webBrowser + + property string urlString : "http://www.nokia.com/" + + width: 800; height: 600 + color: "#343434" + + FlickableWebView { + id: webView + url: webBrowser.urlString + onProgressChanged: header.urlChanged = false + anchors { top: headerSpace.bottom; left: parent.left; right: parent.right; bottom: parent.bottom } + } + + Item { id: headerSpace; width: parent.width; height: 62 } + + Header { + id: header + editUrl: webBrowser.urlString + width: headerSpace.width; height: headerSpace.height + } + + ScrollBar { + scrollArea: webView; width: 8 + anchors { right: parent.right; top: header.bottom; bottom: parent.bottom } + } + + ScrollBar { + scrollArea: webView; height: 8; orientation: Qt.Horizontal + anchors { right: parent.right; rightMargin: 8; left: parent.left; bottom: parent.bottom } + } +} diff --git a/examples/declarative/demos/webbrowser/qml/webbrowser.qmlproject b/examples/declarative/demos/webbrowser/qml/webbrowser.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/demos/webbrowser/qml/webbrowser.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/demos/webbrowser/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/demos/webbrowser/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/demos/webbrowser/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/demos/webbrowser/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/demos/webbrowser/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/demos/webbrowser/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/demos/webbrowser/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/demos/webbrowser/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/demos/webbrowser/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/demos/webbrowser/webbrowser.desktop b/examples/declarative/demos/webbrowser/webbrowser.desktop new file mode 100644 index 0000000..26da1fe --- /dev/null +++ b/examples/declarative/demos/webbrowser/webbrowser.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=webbrowser +Exec=/opt/usr/bin/webbrowser +Icon=webbrowser +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/demos/webbrowser/webbrowser.png b/examples/declarative/demos/webbrowser/webbrowser.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/demos/webbrowser/webbrowser.png diff --git a/examples/declarative/demos/webbrowser/webbrowser.pro b/examples/declarative/demos/webbrowser/webbrowser.pro new file mode 100644 index 0000000..580cc55 --- /dev/null +++ b/examples/declarative/demos/webbrowser/webbrowser.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE1704EEA + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/demos/webbrowser/webbrowser.svg b/examples/declarative/demos/webbrowser/webbrowser.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/demos/webbrowser/webbrowser.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/i18n/i18n.desktop b/examples/declarative/i18n/i18n.desktop new file mode 100644 index 0000000..8dd6e34 --- /dev/null +++ b/examples/declarative/i18n/i18n.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=i18n +Exec=/opt/usr/bin/i18n +Icon=i18n +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/i18n/i18n.png b/examples/declarative/i18n/i18n.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/i18n/i18n.png diff --git a/examples/declarative/i18n/i18n.pro b/examples/declarative/i18n/i18n.pro new file mode 100644 index 0000000..184feab --- /dev/null +++ b/examples/declarative/i18n/i18n.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE069582C + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/i18n/i18n.svg b/examples/declarative/i18n/i18n.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/i18n/i18n.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/i18n/main.cpp b/examples/declarative/i18n/main.cpp new file mode 100644 index 0000000..66b3ffe --- /dev/null +++ b/examples/declarative/i18n/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/i18n.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/i18n/qml/i18n.qml b/examples/declarative/i18n/qml/i18n.qml new file mode 100644 index 0000000..219deda --- /dev/null +++ b/examples/declarative/i18n/qml/i18n.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +// +// The QML runtime automatically loads a translation from the i18n subdirectory of the root +// QML file, based on the system language. +// +// The files are created/updated by running: +// +// lupdate i18n.qml -ts i18n/base.ts +// +// Translations for new languages are created by copying i18n/base.ts to i18n/qml_<lang>.ts +// The .ts files can then be edited with Linguist: +// +// linguist i18n/qml_fr.ts +// +// The run-time translation files are then generaeted by running: +// +// lrelease i18n/*.ts +// + +Rectangle { + width: 640; height: 480 + + Column { + anchors.fill: parent; spacing: 20 + + Text { + text: "If a translation is available for the system language (eg. French) then the + string below will translated (eg. 'Bonjour'). Otherwise it will show 'Hello'." + width: parent.width; wrapMode: Text.WordWrap + } + + Text { + text: qsTr("Hello") + font.pointSize: 25; anchors.horizontalCenter: parent.horizontalCenter + } + } +} diff --git a/examples/declarative/i18n/qml/i18n.qmlproject b/examples/declarative/i18n/qml/i18n.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/i18n/qml/i18n.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/i18n/qml/i18n/base.ts b/examples/declarative/i18n/qml/i18n/base.ts new file mode 100644 index 0000000..82547a1 --- /dev/null +++ b/examples/declarative/i18n/qml/i18n/base.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" sourcelanguage="en"> +<context> + <name>i18n</name> + <message> + <location filename="../i18n.qml" line="30"/> + <source>Hello</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/examples/declarative/i18n/qml/i18n/qml_en_AU.ts b/examples/declarative/i18n/qml/i18n/qml_en_AU.ts new file mode 100644 index 0000000..e991aff --- /dev/null +++ b/examples/declarative/i18n/qml/i18n/qml_en_AU.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="en_AU" sourcelanguage="en"> +<context> + <name>i18n</name> + <message> + <location filename="../i18n.qml" line="30"/> + <source>Hello</source> + <translation>G'day</translation> + </message> +</context> +</TS> diff --git a/examples/declarative/i18n/qml/i18n/qml_fr.ts b/examples/declarative/i18n/qml/i18n/qml_fr.ts new file mode 100644 index 0000000..365abd9 --- /dev/null +++ b/examples/declarative/i18n/qml/i18n/qml_fr.ts @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="fr" sourcelanguage="en"> +<context> + <name>i18n</name> + <message> + <location filename="../i18n.qml" line="30"/> + <source>Hello</source> + <translation>Bonjour</translation> + </message> +</context> +</TS> diff --git a/examples/declarative/i18n/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/i18n/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/i18n/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/i18n/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/i18n/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/i18n/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/i18n/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/i18n/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/i18n/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/imageelements/borderimage/borderimage.desktop b/examples/declarative/imageelements/borderimage/borderimage.desktop new file mode 100644 index 0000000..35f4d2b --- /dev/null +++ b/examples/declarative/imageelements/borderimage/borderimage.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=borderimage +Exec=/opt/usr/bin/borderimage +Icon=borderimage +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/imageelements/borderimage/borderimage.png b/examples/declarative/imageelements/borderimage/borderimage.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/borderimage.png diff --git a/examples/declarative/imageelements/borderimage/borderimage.pro b/examples/declarative/imageelements/borderimage/borderimage.pro new file mode 100644 index 0000000..fd49676 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/borderimage.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEBB4D123 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/imageelements/borderimage/borderimage.svg b/examples/declarative/imageelements/borderimage/borderimage.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/imageelements/borderimage/borderimage.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/imageelements/borderimage/main.cpp b/examples/declarative/imageelements/borderimage/main.cpp new file mode 100644 index 0000000..1cd6d0c --- /dev/null +++ b/examples/declarative/imageelements/borderimage/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/shadows.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/imageelements/borderimage/qml/borderimage.qml b/examples/declarative/imageelements/borderimage/qml/borderimage.qml new file mode 100644 index 0000000..53e35f9 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qml/borderimage.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: page + width: 1030; height: 540 + + Grid { + anchors.centerIn: parent; spacing: 20 + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + } + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round + } + } +} diff --git a/examples/declarative/imageelements/borderimage/qml/borderimage.qmlproject b/examples/declarative/imageelements/borderimage/qml/borderimage.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qml/borderimage.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/imageelements/borderimage/qml/content/MyBorderImage.qml b/examples/declarative/imageelements/borderimage/qml/content/MyBorderImage.qml new file mode 100644 index 0000000..96495cb --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qml/content/MyBorderImage.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property alias horizontalMode: image.horizontalTileMode + property alias verticalMode: image.verticalTileMode + property alias source: image.source + + property int minWidth + property int minHeight + property int maxWidth + property int maxHeight + property int margin + + width: 240; height: 240 + + BorderImage { + id: image; anchors.centerIn: parent + + SequentialAnimation on width { + loops: Animation.Infinite + NumberAnimation { + from: container.minWidth; to: container.maxWidth + duration: 2000; easing.type: Easing.InOutQuad + } + NumberAnimation { + from: container.maxWidth; to: container.minWidth + duration: 2000; easing.type: Easing.InOutQuad + } + } + + SequentialAnimation on height { + loops: Animation.Infinite + NumberAnimation { + from: container.minHeight; to: container.maxHeight + duration: 2000; easing.type: Easing.InOutQuad + } + NumberAnimation { + from: container.maxHeight; to: container.minHeight + duration: 2000; easing.type: Easing.InOutQuad + } + } + + border.top: container.margin + border.left: container.margin + border.bottom: container.margin + border.right: container.margin + } +} diff --git a/examples/declarative/imageelements/borderimage/qml/content/ShadowRectangle.qml b/examples/declarative/imageelements/borderimage/qml/content/ShadowRectangle.qml new file mode 100644 index 0000000..839ecf1 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qml/content/ShadowRectangle.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + property alias color : rectangle.color + + BorderImage { + anchors.fill: rectangle + anchors { leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } + border { left: 10; top: 10; right: 10; bottom: 10 } + source: "shadow.png"; smooth: true + } + + Rectangle { id: rectangle; anchors.fill: parent } +} diff --git a/examples/declarative/imageelements/borderimage/qml/content/bw.png b/examples/declarative/imageelements/borderimage/qml/content/bw.png Binary files differnew file mode 100644 index 0000000..486eaae --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qml/content/bw.png diff --git a/examples/declarative/imageelements/borderimage/qml/content/colors-round.sci b/examples/declarative/imageelements/borderimage/qml/content/colors-round.sci new file mode 100644 index 0000000..506f6f5 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qml/content/colors-round.sci @@ -0,0 +1,7 @@ +border.left:30 +border.top:30 +border.right:30 +border.bottom:30 +horizontalTileRule:Round +verticalTileRule:Round +source:colors.png diff --git a/examples/declarative/imageelements/borderimage/qml/content/colors-stretch.sci b/examples/declarative/imageelements/borderimage/qml/content/colors-stretch.sci new file mode 100644 index 0000000..e4989a7 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qml/content/colors-stretch.sci @@ -0,0 +1,5 @@ +border.left:30 +border.top:30 +border.right:30 +border.bottom:30 +source:colors.png diff --git a/examples/declarative/imageelements/borderimage/qml/content/colors.png b/examples/declarative/imageelements/borderimage/qml/content/colors.png Binary files differnew file mode 100644 index 0000000..dfb62f3 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qml/content/colors.png diff --git a/examples/declarative/imageelements/borderimage/qml/content/shadow.png b/examples/declarative/imageelements/borderimage/qml/content/shadow.png Binary files differnew file mode 100644 index 0000000..431af85 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qml/content/shadow.png diff --git a/examples/declarative/imageelements/borderimage/qml/shadows.qml b/examples/declarative/imageelements/borderimage/qml/shadows.qml new file mode 100644 index 0000000..d547f63 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qml/shadows.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: window + + width: 480; height: 320 + color: "gray" + + ShadowRectangle { + anchors.centerIn: parent; width: 250; height: 250 + color: "lightsteelblue" + } + + ShadowRectangle { + anchors.centerIn: parent; width: 200; height: 200 + color: "steelblue" + } + + ShadowRectangle { + anchors.centerIn: parent; width: 150; height: 150 + color: "thistle" + } +} diff --git a/examples/declarative/imageelements/borderimage/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/imageelements/borderimage/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/imageelements/borderimage/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/imageelements/borderimage/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/imageelements/borderimage/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/imageelements/borderimage/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/README b/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/README new file mode 100644 index 0000000..421e6e3 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/README @@ -0,0 +1,6 @@ +The Debian Package borderimage +---------------------------- + +Comments regarding the Package + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 16:13:09 +0100 diff --git a/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/changelog b/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/changelog new file mode 100644 index 0000000..77071e0 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/changelog @@ -0,0 +1,5 @@ +borderimage (0.0.1) unstable; urgency=low + + * Initial Release. + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 16:13:09 +0100 diff --git a/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/compat b/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/compat @@ -0,0 +1 @@ +7 diff --git a/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/control b/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/control new file mode 100644 index 0000000..4bdc93e --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/control @@ -0,0 +1,13 @@ +Source: borderimage +Section: user/hidden +Priority: optional +Maintainer: Daniel Molkentin <danimo@unknown> +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: <insert the upstream URL, if relevant> + +Package: borderimage +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: <insert up to 60 chars description> + <insert long description, indented with spaces> diff --git a/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/copyright b/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/copyright new file mode 100644 index 0000000..e1c7a29 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/copyright @@ -0,0 +1,40 @@ +This package was debianized by Daniel Molkentin <danimo@unknown> on +Thu, 18 Nov 2010 16:13:09 +0100. + +It was downloaded from <url://example.com> + +Upstream Author(s): + + <put author's name and email here> + <likewise for another author> + +Copyright: + + <Copyright (C) YYYY Name OfAuthor> + <likewise for another author> + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2010, Daniel Molkentin <danimo@unknown> and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/rules b/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/rules new file mode 100755 index 0000000..3799b01 --- /dev/null +++ b/examples/declarative/imageelements/borderimage/qtc_packaging/debian_fremantle/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/borderimage.sgml > borderimage.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/borderimage. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/borderimage install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + # dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/examples/declarative/imageelements/image/image.desktop b/examples/declarative/imageelements/image/image.desktop new file mode 100644 index 0000000..6103d44 --- /dev/null +++ b/examples/declarative/imageelements/image/image.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=image +Exec=/opt/usr/bin/image +Icon=image +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/imageelements/image/image.png b/examples/declarative/imageelements/image/image.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/imageelements/image/image.png diff --git a/examples/declarative/imageelements/image/image.pro b/examples/declarative/imageelements/image/image.pro new file mode 100644 index 0000000..c5e94cc --- /dev/null +++ b/examples/declarative/imageelements/image/image.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE5D64785 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/imageelements/image/image.svg b/examples/declarative/imageelements/image/image.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/imageelements/image/image.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/imageelements/image/main.cpp b/examples/declarative/imageelements/image/main.cpp new file mode 100644 index 0000000..152d536 --- /dev/null +++ b/examples/declarative/imageelements/image/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/image.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/imageelements/image/qml/ImageCell.qml b/examples/declarative/imageelements/image/qml/ImageCell.qml new file mode 100644 index 0000000..e8a6c55 --- /dev/null +++ b/examples/declarative/imageelements/image/qml/ImageCell.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 1.0 + +Item { + property alias mode: image.fillMode + property alias caption: captionItem.text + + width: parent.cellWidth; height: parent.cellHeight + + Image { + id: image + width: parent.width; height: parent.height - captionItem.height + source: "qt-logo.png" + clip: true // only makes a difference if mode is PreserveAspectCrop + smooth: true + } + + Text { + id: captionItem + anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom + } +} diff --git a/examples/declarative/imageelements/image/qml/image.qml b/examples/declarative/imageelements/image/qml/image.qml new file mode 100644 index 0000000..f00fc18 --- /dev/null +++ b/examples/declarative/imageelements/image/qml/image.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 490 + height: 285 + + Grid { + property int cellWidth: (width - (spacing * (columns - 1))) / columns + property int cellHeight: (height - (spacing * (rows - 1))) / rows + + anchors.fill: parent + anchors.margins: 30 + + columns: 3 + rows: 2 + spacing: 30 + + ImageCell { mode: Image.Stretch; caption: "Stretch" } + ImageCell { mode: Image.PreserveAspectFit; caption: "PreserveAspectFit" } + ImageCell { mode: Image.PreserveAspectCrop; caption: "PreserveAspectCrop" } + + ImageCell { mode: Image.Tile; caption: "Tile" } + ImageCell { mode: Image.TileHorizontally; caption: "TileHorizontally" } + ImageCell { mode: Image.TileVertically; caption: "TileVertically" } + } +} diff --git a/examples/declarative/imageelements/image/qml/image.qmlproject b/examples/declarative/imageelements/image/qml/image.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/imageelements/image/qml/image.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/imageelements/image/qml/qt-logo.png b/examples/declarative/imageelements/image/qml/qt-logo.png Binary files differnew file mode 100644 index 0000000..14ddf2a --- /dev/null +++ b/examples/declarative/imageelements/image/qml/qt-logo.png diff --git a/examples/declarative/imageelements/image/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/imageelements/image/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/imageelements/image/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/imageelements/image/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/imageelements/image/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/imageelements/image/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/imageelements/image/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/imageelements/image/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/imageelements/image/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/imageelements/shadows/main.cpp b/examples/declarative/imageelements/shadows/main.cpp new file mode 100644 index 0000000..1cd6d0c --- /dev/null +++ b/examples/declarative/imageelements/shadows/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/shadows.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/imageelements/shadows/qml/borderimage.qml b/examples/declarative/imageelements/shadows/qml/borderimage.qml new file mode 100644 index 0000000..53e35f9 --- /dev/null +++ b/examples/declarative/imageelements/shadows/qml/borderimage.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: page + width: 1030; height: 540 + + Grid { + anchors.centerIn: parent; spacing: 20 + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + } + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 240 + source: "content/colors.png"; margin: 30 + horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat + } + + MyBorderImage { + minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200 + source: "content/bw.png"; margin: 10 + horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round + } + } +} diff --git a/examples/declarative/imageelements/shadows/qml/borderimage.qmlproject b/examples/declarative/imageelements/shadows/qml/borderimage.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/imageelements/shadows/qml/borderimage.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/imageelements/shadows/qml/content/MyBorderImage.qml b/examples/declarative/imageelements/shadows/qml/content/MyBorderImage.qml new file mode 100644 index 0000000..96495cb --- /dev/null +++ b/examples/declarative/imageelements/shadows/qml/content/MyBorderImage.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + + property alias horizontalMode: image.horizontalTileMode + property alias verticalMode: image.verticalTileMode + property alias source: image.source + + property int minWidth + property int minHeight + property int maxWidth + property int maxHeight + property int margin + + width: 240; height: 240 + + BorderImage { + id: image; anchors.centerIn: parent + + SequentialAnimation on width { + loops: Animation.Infinite + NumberAnimation { + from: container.minWidth; to: container.maxWidth + duration: 2000; easing.type: Easing.InOutQuad + } + NumberAnimation { + from: container.maxWidth; to: container.minWidth + duration: 2000; easing.type: Easing.InOutQuad + } + } + + SequentialAnimation on height { + loops: Animation.Infinite + NumberAnimation { + from: container.minHeight; to: container.maxHeight + duration: 2000; easing.type: Easing.InOutQuad + } + NumberAnimation { + from: container.maxHeight; to: container.minHeight + duration: 2000; easing.type: Easing.InOutQuad + } + } + + border.top: container.margin + border.left: container.margin + border.bottom: container.margin + border.right: container.margin + } +} diff --git a/examples/declarative/imageelements/shadows/qml/content/ShadowRectangle.qml b/examples/declarative/imageelements/shadows/qml/content/ShadowRectangle.qml new file mode 100644 index 0000000..839ecf1 --- /dev/null +++ b/examples/declarative/imageelements/shadows/qml/content/ShadowRectangle.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + property alias color : rectangle.color + + BorderImage { + anchors.fill: rectangle + anchors { leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 } + border { left: 10; top: 10; right: 10; bottom: 10 } + source: "shadow.png"; smooth: true + } + + Rectangle { id: rectangle; anchors.fill: parent } +} diff --git a/examples/declarative/imageelements/shadows/qml/content/bw.png b/examples/declarative/imageelements/shadows/qml/content/bw.png Binary files differnew file mode 100644 index 0000000..486eaae --- /dev/null +++ b/examples/declarative/imageelements/shadows/qml/content/bw.png diff --git a/examples/declarative/imageelements/shadows/qml/content/colors-round.sci b/examples/declarative/imageelements/shadows/qml/content/colors-round.sci new file mode 100644 index 0000000..506f6f5 --- /dev/null +++ b/examples/declarative/imageelements/shadows/qml/content/colors-round.sci @@ -0,0 +1,7 @@ +border.left:30 +border.top:30 +border.right:30 +border.bottom:30 +horizontalTileRule:Round +verticalTileRule:Round +source:colors.png diff --git a/examples/declarative/imageelements/shadows/qml/content/colors-stretch.sci b/examples/declarative/imageelements/shadows/qml/content/colors-stretch.sci new file mode 100644 index 0000000..e4989a7 --- /dev/null +++ b/examples/declarative/imageelements/shadows/qml/content/colors-stretch.sci @@ -0,0 +1,5 @@ +border.left:30 +border.top:30 +border.right:30 +border.bottom:30 +source:colors.png diff --git a/examples/declarative/imageelements/shadows/qml/content/colors.png b/examples/declarative/imageelements/shadows/qml/content/colors.png Binary files differnew file mode 100644 index 0000000..dfb62f3 --- /dev/null +++ b/examples/declarative/imageelements/shadows/qml/content/colors.png diff --git a/examples/declarative/imageelements/shadows/qml/content/shadow.png b/examples/declarative/imageelements/shadows/qml/content/shadow.png Binary files differnew file mode 100644 index 0000000..431af85 --- /dev/null +++ b/examples/declarative/imageelements/shadows/qml/content/shadow.png diff --git a/examples/declarative/imageelements/shadows/qml/shadows.qml b/examples/declarative/imageelements/shadows/qml/shadows.qml new file mode 100644 index 0000000..d547f63 --- /dev/null +++ b/examples/declarative/imageelements/shadows/qml/shadows.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: window + + width: 480; height: 320 + color: "gray" + + ShadowRectangle { + anchors.centerIn: parent; width: 250; height: 250 + color: "lightsteelblue" + } + + ShadowRectangle { + anchors.centerIn: parent; width: 200; height: 200 + color: "steelblue" + } + + ShadowRectangle { + anchors.centerIn: parent; width: 150; height: 150 + color: "thistle" + } +} diff --git a/examples/declarative/imageelements/shadows/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/imageelements/shadows/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/imageelements/shadows/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/imageelements/shadows/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/imageelements/shadows/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/imageelements/shadows/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/imageelements/shadows/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/imageelements/shadows/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/imageelements/shadows/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/imageelements/shadows/shadows.desktop b/examples/declarative/imageelements/shadows/shadows.desktop new file mode 100644 index 0000000..83acea3 --- /dev/null +++ b/examples/declarative/imageelements/shadows/shadows.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=shadows +Exec=/opt/usr/bin/shadows +Icon=shadows +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/imageelements/shadows/shadows.png b/examples/declarative/imageelements/shadows/shadows.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/imageelements/shadows/shadows.png diff --git a/examples/declarative/imageelements/shadows/shadows.pro b/examples/declarative/imageelements/shadows/shadows.pro new file mode 100644 index 0000000..6c88896 --- /dev/null +++ b/examples/declarative/imageelements/shadows/shadows.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE2C00C58 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/imageelements/shadows/shadows.svg b/examples/declarative/imageelements/shadows/shadows.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/imageelements/shadows/shadows.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/keyinteraction/focus/focus.desktop b/examples/declarative/keyinteraction/focus/focus.desktop new file mode 100644 index 0000000..68513b3 --- /dev/null +++ b/examples/declarative/keyinteraction/focus/focus.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=focus +Exec=/opt/usr/bin/focus +Icon=focus +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/keyinteraction/focus/focus.png b/examples/declarative/keyinteraction/focus/focus.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/keyinteraction/focus/focus.png diff --git a/examples/declarative/keyinteraction/focus/focus.pro b/examples/declarative/keyinteraction/focus/focus.pro new file mode 100644 index 0000000..db502a0 --- /dev/null +++ b/examples/declarative/keyinteraction/focus/focus.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEC9F742D + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/keyinteraction/focus/focus.svg b/examples/declarative/keyinteraction/focus/focus.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/keyinteraction/focus/focus.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/keyinteraction/focus/main.cpp b/examples/declarative/keyinteraction/focus/main.cpp new file mode 100644 index 0000000..9e5270a --- /dev/null +++ b/examples/declarative/keyinteraction/focus/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/focus.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/keyinteraction/focus/qml/Core/ContextMenu.qml b/examples/declarative/keyinteraction/focus/qml/Core/ContextMenu.qml new file mode 100644 index 0000000..79273ad --- /dev/null +++ b/examples/declarative/keyinteraction/focus/qml/Core/ContextMenu.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +FocusScope { + id: container + + property bool open: false + + Item { + anchors.fill: parent + + Rectangle { + anchors.fill: parent + color: "#D1DBBD" + focus: true + Keys.onRightPressed: mainView.focus = true + + Text { + anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; margins: 30 } + color: "black" + font.pixelSize: 14 + text: "Context Menu" + } + } + } +} diff --git a/examples/declarative/keyinteraction/focus/qml/Core/GridMenu.qml b/examples/declarative/keyinteraction/focus/qml/Core/GridMenu.qml new file mode 100644 index 0000000..263adad --- /dev/null +++ b/examples/declarative/keyinteraction/focus/qml/Core/GridMenu.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +FocusScope { + property alias interactive: gridView.interactive + + onActiveFocusChanged: { + if (activeFocus) + mainView.state = "" + } + + Rectangle { + anchors.fill: parent + clip: true + gradient: Gradient { + GradientStop { position: 0.0; color: "#193441" } + GradientStop { position: 1.0; color: Qt.darker("#193441") } + } + + GridView { + id: gridView + anchors.fill: parent; anchors.leftMargin: 20; anchors.rightMargin: 20 + cellWidth: 152; cellHeight: 152 + focus: true + model: 12 + + KeyNavigation.down: listMenu + KeyNavigation.left: contextMenu + + delegate: Item { + id: container + width: GridView.view.cellWidth; height: GridView.view.cellHeight + + Rectangle { + id: content + color: "transparent" + smooth: true + anchors.fill: parent; anchors.margins: 20; radius: 10 + + Rectangle { color: "#91AA9D"; anchors.fill: parent; anchors.margins: 3; radius: 8; smooth: true } + Image { source: "images/qt-logo.png"; anchors.centerIn: parent; smooth: true } + } + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + + onClicked: { + GridView.view.currentIndex = index + container.forceActiveFocus() + } + } + + states: State { + name: "active"; when: container.activeFocus + PropertyChanges { target: content; color: "#FCFFF5"; scale: 1.1 } + } + + transitions: Transition { + NumberAnimation { properties: "scale"; duration: 100 } + } + } + } + } +} diff --git a/examples/declarative/keyinteraction/focus/qml/Core/ListMenu.qml b/examples/declarative/keyinteraction/focus/qml/Core/ListMenu.qml new file mode 100644 index 0000000..cefc9a3 --- /dev/null +++ b/examples/declarative/keyinteraction/focus/qml/Core/ListMenu.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +FocusScope { + clip: true + + onActiveFocusChanged: { + if (activeFocus) + mainView.state = "showListViews" + } + + ListView { + id: list1 + y: activeFocus ? 10 : 40; width: parent.width / 3; height: parent.height - 20 + focus: true + KeyNavigation.up: gridMenu; KeyNavigation.left: contextMenu; KeyNavigation.right: list2 + model: 10; cacheBuffer: 200 + delegate: ListViewDelegate {} + + Behavior on y { + NumberAnimation { duration: 600; easing.type: Easing.OutQuint } + } + } + + ListView { + id: list2 + y: activeFocus ? 10 : 40; x: parseInt(parent.width / 3); width: parent.width / 3; height: parent.height - 20 + KeyNavigation.up: gridMenu; KeyNavigation.left: list1; KeyNavigation.right: list3 + model: 10; cacheBuffer: 200 + delegate: ListViewDelegate {} + + Behavior on y { + NumberAnimation { duration: 600; easing.type: Easing.OutQuint } + } + } + + ListView { + id: list3 + y: activeFocus ? 10 : 40; x: parseInt(2 * parent.width / 3); width: parent.width / 3; height: parent.height - 20 + KeyNavigation.up: gridMenu; KeyNavigation.left: list2 + model: 10; cacheBuffer: 200 + delegate: ListViewDelegate {} + + Behavior on y { + NumberAnimation { duration: 600; easing.type: Easing.OutQuint } + } + } + + Rectangle { width: parent.width; height: 1; color: "#D1DBBD" } + + Rectangle { + y: 1; width: parent.width; height: 10 + gradient: Gradient { + GradientStop { position: 0.0; color: "#3E606F" } + GradientStop { position: 1.0; color: "transparent" } + } + } + + Rectangle { + y: parent.height - 10; width: parent.width; height: 10 + gradient: Gradient { + GradientStop { position: 1.0; color: "#3E606F" } + GradientStop { position: 0.0; color: "transparent" } + } + } +} diff --git a/examples/declarative/keyinteraction/focus/qml/Core/ListViewDelegate.qml b/examples/declarative/keyinteraction/focus/qml/Core/ListViewDelegate.qml new file mode 100644 index 0000000..7b63cd8 --- /dev/null +++ b/examples/declarative/keyinteraction/focus/qml/Core/ListViewDelegate.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: container + width: ListView.view.width; height: 60; anchors.leftMargin: 10; anchors.rightMargin: 10 + + Rectangle { + id: content + anchors.centerIn: parent; width: container.width - 40; height: container.height - 10 + color: "transparent" + smooth: true + radius: 10 + + Rectangle { anchors.fill: parent; anchors.margins: 3; color: "#91AA9D"; smooth: true; radius: 8 } + } + + Text { + id: label + anchors.centerIn: content + text: "List element " + (index + 1) + color: "#193441" + font.pixelSize: 14 + } + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + + onClicked: { + ListView.view.currentIndex = index + container.forceActiveFocus() + } + } + + states: State { + name: "active"; when: container.activeFocus + PropertyChanges { target: content; color: "#FCFFF5"; scale: 1.1 } + PropertyChanges { target: label; font.pixelSize: 16 } + } + + transitions: Transition { + NumberAnimation { properties: "scale"; duration: 100 } + } +} diff --git a/examples/declarative/keyinteraction/focus/qml/Core/images/arrow.png b/examples/declarative/keyinteraction/focus/qml/Core/images/arrow.png Binary files differnew file mode 100644 index 0000000..14978c2 --- /dev/null +++ b/examples/declarative/keyinteraction/focus/qml/Core/images/arrow.png diff --git a/examples/declarative/keyinteraction/focus/qml/Core/images/qt-logo.png b/examples/declarative/keyinteraction/focus/qml/Core/images/qt-logo.png Binary files differnew file mode 100644 index 0000000..14ddf2a --- /dev/null +++ b/examples/declarative/keyinteraction/focus/qml/Core/images/qt-logo.png diff --git a/examples/declarative/keyinteraction/focus/qml/focus.qml b/examples/declarative/keyinteraction/focus/qml/focus.qml new file mode 100644 index 0000000..e2115d8 --- /dev/null +++ b/examples/declarative/keyinteraction/focus/qml/focus.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "Core" + +Rectangle { + id: window + + width: 800; height: 480 + color: "#3E606F" + + FocusScope { + id: mainView + + width: parent.width; height: parent.height + focus: true + + GridMenu { + id: gridMenu + width: parent.width; height: 320 + + focus: true + interactive: parent.activeFocus + } + + ListMenu { + id: listMenu + y: 320; width: parent.width; height: 320 + } + + Rectangle { + id: shade + anchors.fill: parent + color: "black" + opacity: 0 + } + + states: State { + name: "showListViews" + PropertyChanges { target: gridMenu; y: -160 } + PropertyChanges { target: listMenu; y: 160 } + } + + transitions: Transition { + NumberAnimation { properties: "y"; duration: 600; easing.type: Easing.OutQuint } + } + } + + Image { + source: "Core/images/arrow.png" + rotation: 90 + anchors.verticalCenter: parent.verticalCenter + + MouseArea { + anchors.fill: parent; anchors.margins: -10 + onClicked: window.state = "contextMenuOpen" + } + } + + ContextMenu { id: contextMenu; x: -265; width: 260; height: parent.height } + + states: State { + name: "contextMenuOpen" + when: !mainView.activeFocus + PropertyChanges { target: contextMenu; x: 0; open: true } + PropertyChanges { target: mainView; x: 130 } + PropertyChanges { target: shade; opacity: 0.25 } + } + + transitions: Transition { + NumberAnimation { properties: "x,opacity"; duration: 600; easing.type: Easing.OutQuint } + } +} diff --git a/examples/declarative/keyinteraction/focus/qml/focus.qmlproject b/examples/declarative/keyinteraction/focus/qml/focus.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/keyinteraction/focus/qml/focus.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/keyinteraction/focus/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/keyinteraction/focus/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/keyinteraction/focus/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/keyinteraction/focus/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/keyinteraction/focus/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/keyinteraction/focus/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/keyinteraction/focus/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/keyinteraction/focus/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/keyinteraction/focus/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/Delegate/Delegate.desktop b/examples/declarative/modelviews/Delegate/Delegate.desktop new file mode 100644 index 0000000..9815ded --- /dev/null +++ b/examples/declarative/modelviews/Delegate/Delegate.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Delegate +Exec=/opt/usr/bin/Delegate +Icon=Delegate +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/Delegate/Delegate.png b/examples/declarative/modelviews/Delegate/Delegate.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/Delegate/Delegate.png diff --git a/examples/declarative/modelviews/Delegate/Delegate.pro b/examples/declarative/modelviews/Delegate/Delegate.pro new file mode 100644 index 0000000..1b2a7e9 --- /dev/null +++ b/examples/declarative/modelviews/Delegate/Delegate.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE5FF52C0 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/Delegate/Delegate.svg b/examples/declarative/modelviews/Delegate/Delegate.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/Delegate/Delegate.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/Delegate/main.cpp b/examples/declarative/modelviews/Delegate/main.cpp new file mode 100644 index 0000000..22252ce --- /dev/null +++ b/examples/declarative/modelviews/Delegate/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/Delegate.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/Delegate/qml/Delegate.qml b/examples/declarative/modelviews/Delegate/qml/Delegate.qml new file mode 100644 index 0000000..57048f4 --- /dev/null +++ b/examples/declarative/modelviews/Delegate/qml/Delegate.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +//![0] +Package { + Text { id: listDelegate; width: 200; height: 25; text: 'Empty'; Package.name: 'list' } + Text { id: gridDelegate; width: 100; height: 50; text: 'Empty'; Package.name: 'grid' } + + Rectangle { + id: wrapper + width: 200; height: 25 + color: 'lightsteelblue' + + Text { text: display; anchors.centerIn: parent } + MouseArea { + anchors.fill: parent + onClicked: { + if (wrapper.state == 'inList') + wrapper.state = 'inGrid'; + else + wrapper.state = 'inList'; + } + } + + state: 'inList' + states: [ + State { + name: 'inList' + ParentChange { target: wrapper; parent: listDelegate } + }, + State { + name: 'inGrid' + ParentChange { + target: wrapper; parent: gridDelegate + x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height + } + } + ] + + transitions: [ + Transition { + ParentAnimation { + NumberAnimation { properties: 'x,y,width,height'; duration: 300 } + } + } + ] + } +} +//![0] diff --git a/examples/declarative/modelviews/Delegate/qml/package.qmlproject b/examples/declarative/modelviews/Delegate/qml/package.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/Delegate/qml/package.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/Delegate/qml/view.qml b/examples/declarative/modelviews/Delegate/qml/view.qml new file mode 100644 index 0000000..cbe8f06 --- /dev/null +++ b/examples/declarative/modelviews/Delegate/qml/view.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + color: "white" + width: 400 + height: 200 + + ListModel { + id: myModel + ListElement { display: "One" } + ListElement { display: "Two" } + ListElement { display: "Three" } + ListElement { display: "Four" } + ListElement { display: "Five" } + ListElement { display: "Six" } + ListElement { display: "Seven" } + ListElement { display: "Eight" } + } + //![0] + VisualDataModel { + id: visualModel + delegate: Delegate {} + model: myModel + } + + ListView { + width: 200; height:200 + model: visualModel.parts.list + } + GridView { + x: 200; width: 200; height:200 + cellHeight: 50 + model: visualModel.parts.grid + } + //![0] +} diff --git a/examples/declarative/modelviews/Delegate/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/Delegate/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/Delegate/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/Delegate/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/Delegate/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/Delegate/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/Delegate/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/Delegate/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/Delegate/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/gridview-example/gridviewexample.desktop b/examples/declarative/modelviews/gridview-example/gridviewexample.desktop new file mode 100644 index 0000000..1ba59a4 --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/gridviewexample.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=gridview-example +Exec=/opt/usr/bin/gridview-example +Icon=gridview-example +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/gridview-example/gridviewexample.png b/examples/declarative/modelviews/gridview-example/gridviewexample.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/gridviewexample.png diff --git a/examples/declarative/modelviews/gridview-example/gridviewexample.pro b/examples/declarative/modelviews/gridview-example/gridviewexample.pro new file mode 100644 index 0000000..61d7865 --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/gridviewexample.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE53E8FDC + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/gridview-example/gridviewexample.svg b/examples/declarative/modelviews/gridview-example/gridviewexample.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/gridviewexample.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/gridview-example/main.cpp b/examples/declarative/modelviews/gridview-example/main.cpp new file mode 100644 index 0000000..3cf521f --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/gridview-example.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/gridview-example/qml/gridview-example.qml b/examples/declarative/modelviews/gridview-example/qml/gridview-example.qml new file mode 100644 index 0000000..85fefda --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/qml/gridview-example.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 300; height: 400 + color: "white" + + ListModel { + id: appModel + ListElement { name: "Music"; icon: "pics/AudioPlayer_48.png" } + ListElement { name: "Movies"; icon: "pics/VideoPlayer_48.png" } + ListElement { name: "Camera"; icon: "pics/Camera_48.png" } + ListElement { name: "Calendar"; icon: "pics/DateBook_48.png" } + ListElement { name: "Messaging"; icon: "pics/EMail_48.png" } + ListElement { name: "Todo List"; icon: "pics/TodoList_48.png" } + ListElement { name: "Contacts"; icon: "pics/AddressBook_48.png" } + } + + Component { + id: appDelegate + + Item { + width: 100; height: 100 + + Image { + id: myIcon + y: 20; anchors.horizontalCenter: parent.horizontalCenter + source: icon + } + Text { + anchors { top: myIcon.bottom; horizontalCenter: parent.horizontalCenter } + text: name + } + } + } + + Component { + id: appHighlight + Rectangle { width: 80; height: 80; color: "lightsteelblue" } + } + + GridView { + anchors.fill: parent + cellWidth: 100; cellHeight: 100 + highlight: appHighlight + focus: true + model: appModel + delegate: appDelegate + } +} diff --git a/examples/declarative/modelviews/gridview-example/qml/gridview.qmlproject b/examples/declarative/modelviews/gridview-example/qml/gridview.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/qml/gridview.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/gridview-example/qml/pics/AddressBook_48.png b/examples/declarative/modelviews/gridview-example/qml/pics/AddressBook_48.png Binary files differnew file mode 100644 index 0000000..1ab7c8e --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/qml/pics/AddressBook_48.png diff --git a/examples/declarative/modelviews/gridview-example/qml/pics/AudioPlayer_48.png b/examples/declarative/modelviews/gridview-example/qml/pics/AudioPlayer_48.png Binary files differnew file mode 100644 index 0000000..f4b8689 --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/qml/pics/AudioPlayer_48.png diff --git a/examples/declarative/modelviews/gridview-example/qml/pics/Camera_48.png b/examples/declarative/modelviews/gridview-example/qml/pics/Camera_48.png Binary files differnew file mode 100644 index 0000000..c76b524 --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/qml/pics/Camera_48.png diff --git a/examples/declarative/modelviews/gridview-example/qml/pics/DateBook_48.png b/examples/declarative/modelviews/gridview-example/qml/pics/DateBook_48.png Binary files differnew file mode 100644 index 0000000..58f5787 --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/qml/pics/DateBook_48.png diff --git a/examples/declarative/modelviews/gridview-example/qml/pics/EMail_48.png b/examples/declarative/modelviews/gridview-example/qml/pics/EMail_48.png Binary files differnew file mode 100644 index 0000000..d6d84a6 --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/qml/pics/EMail_48.png diff --git a/examples/declarative/modelviews/gridview-example/qml/pics/TodoList_48.png b/examples/declarative/modelviews/gridview-example/qml/pics/TodoList_48.png Binary files differnew file mode 100644 index 0000000..0988448 --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/qml/pics/TodoList_48.png diff --git a/examples/declarative/modelviews/gridview-example/qml/pics/VideoPlayer_48.png b/examples/declarative/modelviews/gridview-example/qml/pics/VideoPlayer_48.png Binary files differnew file mode 100644 index 0000000..52638c5 --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/qml/pics/VideoPlayer_48.png diff --git a/examples/declarative/modelviews/gridview-example/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/gridview-example/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/gridview-example/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/gridview-example/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/gridview-example/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/gridview-example/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/gridview-example/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.desktop b/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.desktop new file mode 100644 index 0000000..d056093 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=dynamiclist +Exec=/opt/usr/bin/dynamiclist +Icon=dynamiclist +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.png b/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.png diff --git a/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.pro b/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.pro new file mode 100644 index 0000000..39b1ad1 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE49D962F + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.svg b/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/dynamiclist.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/listview/dynamiclist/main.cpp b/examples/declarative/modelviews/listview/dynamiclist/main.cpp new file mode 100644 index 0000000..28cc168 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/dynamiclist.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/PetsModel.qml b/examples/declarative/modelviews/listview/dynamiclist/qml/content/PetsModel.qml new file mode 100644 index 0000000..5220763 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/PetsModel.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + ListElement { + name: "Polly" + type: "Parrot" + age: 12 + size: "Small" + } + ListElement { + name: "Penny" + type: "Turtle" + age: 4 + size: "Small" + } + ListElement { + name: "Warren" + type: "Rabbit" + age: 2 + size: "Small" + } + ListElement { + name: "Spot" + type: "Dog" + age: 9 + size: "Medium" + } + ListElement { + name: "Schrödinger" + type: "Cat" + age: 2 + size: "Medium" + } + ListElement { + name: "Joey" + type: "Kangaroo" + age: 1 + size: "Medium" + } + ListElement { + name: "Kimba" + type: "Bunny" + age: 65 + size: "Large" + } + ListElement { + name: "Rover" + type: "Dog" + age: 5 + size: "Large" + } + ListElement { + name: "Tiny" + type: "Elephant" + age: 15 + size: "Large" + } +} diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/PressAndHoldButton.qml b/examples/declarative/modelviews/listview/dynamiclist/qml/content/PressAndHoldButton.qml new file mode 100644 index 0000000..d6808a4 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/PressAndHoldButton.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: container + + property int repeatDelay: 300 + property int repeatDuration: 75 + property bool pressed: false + + signal clicked + + scale: pressed ? 0.9 : 1 + + function release() { + autoRepeatClicks.stop() + container.pressed = false + } + + SequentialAnimation on pressed { + id: autoRepeatClicks + running: false + + PropertyAction { target: container; property: "pressed"; value: true } + ScriptAction { script: container.clicked() } + PauseAnimation { duration: repeatDelay } + + SequentialAnimation { + loops: Animation.Infinite + ScriptAction { script: container.clicked() } + PauseAnimation { duration: repeatDuration } + } + } + + MouseArea { + anchors.fill: parent + + onPressed: autoRepeatClicks.start() + onReleased: container.release() + onCanceled: container.release() + } +} + diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/RecipesModel.qml b/examples/declarative/modelviews/listview/dynamiclist/qml/content/RecipesModel.qml new file mode 100644 index 0000000..6056b90 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/RecipesModel.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + ListElement { + title: "Pancakes" + picture: "content/pics/pancakes.jpg" + ingredients: "<html> + <ul> + <li> 1 cup (150g) self-raising flour + <li> 1 tbs caster sugar + <li> 3/4 cup (185ml) milk + <li> 1 egg + </ul> + </html>" + method: "<html> + <ol> + <li> Sift flour and sugar together into a bowl. Add a pinch of salt. + <li> Beat milk and egg together, then add to dry ingredients. Beat until smooth. + <li> Pour mixture into a pan on medium heat and cook until bubbles appear on the surface. + <li> Turn over and cook other side until golden. + </ol> + </html>" + } + ListElement { + title: "Fruit Salad" + picture: "content/pics/fruit-salad.jpg" + ingredients: "* Seasonal Fruit" + method: "* Chop fruit and place in a bowl." + } + ListElement { + title: "Vegetable Soup" + picture: "content/pics/vegetable-soup.jpg" + ingredients: "<html> + <ul> + <li> 1 onion + <li> 1 turnip + <li> 1 potato + <li> 1 carrot + <li> 1 head of celery + <li> 1 1/2 litres of water + </ul> + </html>" + method: "<html> + <ol> + <li> Chop vegetables. + <li> Boil in water until vegetables soften. + <li> Season with salt and pepper to taste. + </ol> + </html>" + } + ListElement { + title: "Hamburger" + picture: "content/pics/hamburger.jpg" + ingredients: "<html> + <ul> + <li> 500g minced beef + <li> Seasoning + <li> lettuce, tomato, onion, cheese + <li> 1 hamburger bun for each burger + </ul> + </html>" + method: "<html> + <ol> + <li> Mix the beef, together with seasoning, in a food processor. + <li> Shape the beef into burgers. + <li> Grill the burgers for about 5 mins on each side (until cooked through) + <li> Serve each burger on a bun with ketchup, cheese, lettuce, tomato and onion. + </ol> + </html>" + } + ListElement { + title: "Lemonade" + picture: "content/pics/lemonade.jpg" + ingredients: "<html> + <ul> + <li> 1 cup Lemon Juice + <li> 1 cup Sugar + <li> 6 Cups of Water (2 cups warm water, 4 cups cold water) + </ul> + </html>" + method: "<html> + <ol> + <li> Pour 2 cups of warm water into a pitcher and stir in sugar until it dissolves. + <li> Pour in lemon juice, stir again, and add 4 cups of cold water. + <li> Chill or serve over ice cubes. + </ol> + </html>" + } +} diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/TextButton.qml b/examples/declarative/modelviews/listview/dynamiclist/qml/content/TextButton.qml new file mode 100644 index 0000000..f26d775 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/TextButton.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: container + + property alias text: label.text + + signal clicked + + width: label.width + 20; height: label.height + 6 + smooth: true + radius: 10 + + gradient: Gradient { + GradientStop { id: gradientStop; position: 0.0; color: palette.light } + GradientStop { position: 1.0; color: palette.button } + } + + SystemPalette { id: palette } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { container.clicked() } + } + + Text { + id: label + anchors.centerIn: parent + } + + states: State { + name: "pressed" + when: mouseArea.pressed + PropertyChanges { target: gradientStop; color: palette.dark } + } +} + diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/arrow-down.png b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/arrow-down.png Binary files differnew file mode 100644 index 0000000..29d1d44 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/arrow-down.png diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/arrow-up.png b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/arrow-up.png Binary files differnew file mode 100644 index 0000000..e437312 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/arrow-up.png diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/fruit-salad.jpg b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/fruit-salad.jpg Binary files differnew file mode 100644 index 0000000..da5a6b1 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/fruit-salad.jpg diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/hamburger.jpg b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/hamburger.jpg Binary files differnew file mode 100644 index 0000000..d0a15be --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/hamburger.jpg diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/lemonade.jpg b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/lemonade.jpg Binary files differnew file mode 100644 index 0000000..db445c9 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/lemonade.jpg diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/list-delete.png b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/list-delete.png Binary files differnew file mode 100644 index 0000000..df2a147 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/list-delete.png diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/minus-sign.png b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/minus-sign.png Binary files differnew file mode 100644 index 0000000..d6f233d --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/minus-sign.png diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/moreDown.png b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/moreDown.png Binary files differnew file mode 100644 index 0000000..31a35d5 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/moreDown.png diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/moreUp.png b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/moreUp.png Binary files differnew file mode 100644 index 0000000..fefb9c9 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/moreUp.png diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/pancakes.jpg b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/pancakes.jpg Binary files differnew file mode 100644 index 0000000..60c4396 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/pancakes.jpg diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/plus-sign.png b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/plus-sign.png Binary files differnew file mode 100644 index 0000000..40df113 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/plus-sign.png diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/vegetable-soup.jpg b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/vegetable-soup.jpg Binary files differnew file mode 100644 index 0000000..9dce332 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/content/pics/vegetable-soup.jpg diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/dynamiclist.qml b/examples/declarative/modelviews/listview/dynamiclist/qml/dynamiclist.qml new file mode 100644 index 0000000..f25f0fa --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/dynamiclist.qml @@ -0,0 +1,203 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 1.0 +import "content" + +// This example shows how items can be dynamically added to and removed from +// a ListModel, and how these list modifications can be animated. + +Rectangle { + id: container + width: 500; height: 400 + color: "#343434" + + // The model: + ListModel { + id: fruitModel + + ListElement { + name: "Apple"; cost: 2.45 + attributes: [ + ListElement { description: "Core" }, + ListElement { description: "Deciduous" } + ] + } + ListElement { + name: "Banana"; cost: 1.95 + attributes: [ + ListElement { description: "Tropical" }, + ListElement { description: "Seedless" } + ] + } + ListElement { + name: "Cumquat"; cost: 3.25 + attributes: [ + ListElement { description: "Citrus" } + ] + } + ListElement { + name: "Durian"; cost: 9.95 + attributes: [ + ListElement { description: "Tropical" }, + ListElement { description: "Smelly" } + ] + } + } + + // The delegate for each fruit in the model: + Component { + id: listDelegate + + Item { + id: delegateItem + width: listView.width; height: 55 + clip: true + + Row { + anchors.verticalCenter: parent.verticalCenter + spacing: 10 + + Column { + Image { + source: "content/pics/arrow-up.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index-1, 1) } + } + Image { source: "content/pics/arrow-down.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index+1, 1) } + } + } + + Column { + anchors.verticalCenter: parent.verticalCenter + + Text { + text: name + font.pixelSize: 15 + color: "white" + } + Row { + spacing: 5 + Repeater { + model: attributes + Text { text: description; color: "White" } + } + } + } + } + + Row { + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + spacing: 10 + + PressAndHoldButton { + anchors.verticalCenter: parent.verticalCenter + source: "content/pics/plus-sign.png" + onClicked: fruitModel.setProperty(index, "cost", cost + 0.25) + } + + Text { + id: costText + anchors.verticalCenter: parent.verticalCenter + text: '$' + Number(cost).toFixed(2) + font.pixelSize: 15 + color: "white" + font.bold: true + } + + PressAndHoldButton { + anchors.verticalCenter: parent.verticalCenter + source: "content/pics/minus-sign.png" + onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25)) + } + + Image { + source: "content/pics/list-delete.png" + MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) } + } + } + + // Animate adding and removing of items: + + ListView.onAdd: SequentialAnimation { + PropertyAction { target: delegateItem; property: "height"; value: 0 } + NumberAnimation { target: delegateItem; property: "height"; to: 55; duration: 250; easing.type: Easing.InOutQuad } + } + + ListView.onRemove: SequentialAnimation { + PropertyAction { target: delegateItem; property: "ListView.delayRemove"; value: true } + NumberAnimation { target: delegateItem; property: "height"; to: 0; duration: 250; easing.type: Easing.InOutQuad } + + // Make sure delayRemove is set back to false so that the item can be destroyed + PropertyAction { target: delegateItem; property: "ListView.delayRemove"; value: false } + } + } + } + + // The view: + ListView { + id: listView + anchors.fill: parent; anchors.margins: 20 + model: fruitModel + delegate: listDelegate + } + + Row { + anchors { left: parent.left; bottom: parent.bottom; margins: 20 } + spacing: 10 + + TextButton { + text: "Add an item" + onClicked: { + fruitModel.append({ + "name": "Pizza Margarita", + "cost": 5.95, + "attributes": [{"description": "Cheese"}, {"description": "Tomato"}] + }) + } + } + + TextButton { + text: "Remove all items" + onClicked: fruitModel.clear() + } + } +} + diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/expandingdelegates.qml b/examples/declarative/modelviews/listview/dynamiclist/qml/expandingdelegates.qml new file mode 100644 index 0000000..bd3d3a9 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/expandingdelegates.qml @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +// This example illustrates expanding a list item to show a more detailed view. + +Rectangle { + id: page + width: 400; height: 240 + color: "black" + + // Delegate for the recipes. This delegate has two modes: + // 1. List mode (default), which just shows the picture and title of the recipe. + // 2. Details mode, which also shows the ingredients and method. + Component { + id: recipeDelegate + + Item { + id: recipe + + // Create a property to contain the visibility of the details. + // We can bind multiple element's opacity to this one property, + // rather than having a "PropertyChanges" line for each element we + // want to fade. + property real detailsOpacity : 0 + + width: listView.width + height: 70 + + // A simple rounded rectangle for the background + Rectangle { + id: background + x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2 + color: "ivory" + border.color: "orange" + radius: 5 + } + + // This mouse region covers the entire delegate. + // When clicked it changes mode to 'Details'. If we are already + // in Details mode, then no change will happen. + MouseArea { + anchors.fill: parent + onClicked: recipe.state = 'Details'; + } + + // Lay out the page: picture, title and ingredients at the top, and method at the + // bottom. Note that elements that should not be visible in the list + // mode have their opacity set to recipe.detailsOpacity. + Row { + id: topLayout + x: 10; y: 10; height: recipeImage.height; width: parent.width + spacing: 10 + + Image { + id: recipeImage + width: 50; height: 50 + source: picture + } + + Column { + width: background.width - recipeImage.width - 20; height: recipeImage.height + spacing: 5 + + Text { + text: title + font.bold: true; font.pointSize: 16 + } + + Text { + text: "Ingredients" + font.pointSize: 12; font.bold: true + opacity: recipe.detailsOpacity + } + + Text { + text: ingredients + wrapMode: Text.WordWrap + width: parent.width + opacity: recipe.detailsOpacity + } + } + } + + Item { + id: details + x: 10; width: parent.width - 20 + anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 } + opacity: recipe.detailsOpacity + + Text { + id: methodTitle + anchors.top: parent.top + text: "Method" + font.pointSize: 12; font.bold: true + } + + Flickable { + id: flick + width: parent.width + anchors { top: methodTitle.bottom; bottom: parent.bottom } + contentHeight: methodText.height + clip: true + + Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width } + } + + Image { + anchors { right: flick.right; top: flick.top } + source: "content/pics/moreUp.png" + opacity: flick.atYBeginning ? 0 : 1 + } + + Image { + anchors { right: flick.right; bottom: flick.bottom } + source: "content/pics/moreDown.png" + opacity: flick.atYEnd ? 0 : 1 + } + } + + // A button to close the detailed view, i.e. set the state back to default (''). + TextButton { + y: 10 + anchors { right: background.right; rightMargin: 10 } + opacity: recipe.detailsOpacity + text: "Close" + + onClicked: recipe.state = ''; + } + + states: State { + name: "Details" + + PropertyChanges { target: background; color: "white" } + PropertyChanges { target: recipeImage; width: 130; height: 130 } // Make picture bigger + PropertyChanges { target: recipe; detailsOpacity: 1; x: 0 } // Make details visible + PropertyChanges { target: recipe; height: listView.height } // Fill the entire list area with the detailed view + + // Move the list so that this item is at the top. + PropertyChanges { target: recipe.ListView.view; explicit: true; contentY: recipe.y } + + // Disallow flicking while we're in detailed view + PropertyChanges { target: recipe.ListView.view; interactive: false } + } + + transitions: Transition { + // Make the state changes smooth + ParallelAnimation { + ColorAnimation { property: "color"; duration: 500 } + NumberAnimation { duration: 300; properties: "detailsOpacity,x,contentY,height,width" } + } + } + } + } + + // The actual list + ListView { + id: listView + anchors.fill: parent + model: RecipesModel {} + delegate: recipeDelegate + } +} diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/highlight.qml b/examples/declarative/modelviews/listview/dynamiclist/qml/highlight.qml new file mode 100644 index 0000000..249c73b --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/highlight.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example shows how to create your own highlight delegate for a ListView +// that uses a SpringAnimation to provide custom movement when the +// highlight bar is moved between items. + +import QtQuick 1.0 +import "content" + +Rectangle { + width: 200; height: 300 + + // Define a delegate component. A component will be + // instantiated for each visible item in the list. + Component { + id: petDelegate + Item { + id: wrapper + width: 200; height: 55 + Column { + Text { text: 'Name: ' + name } + Text { text: 'Type: ' + type } + Text { text: 'Age: ' + age } + } + // indent the item if it is the current item + states: State { + name: "Current" + when: wrapper.ListView.isCurrentItem + PropertyChanges { target: wrapper; x: 20 } + } + transitions: Transition { + NumberAnimation { properties: "x"; duration: 200 } + } + } + } + + // Define a highlight with customised movement between items. + Component { + id: highlightBar + Rectangle { + width: 200; height: 50 + color: "#FFFF88" + y: listView.currentItem.y; + Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } } + } + } + + ListView { + id: listView + width: 200; height: parent.height + + model: PetsModel {} + delegate: petDelegate + focus: true + + // Set the highlight delegate. Note we must also set highlightFollowsCurrentItem + // to false so the highlight delegate can control how the highlight is moved. + highlight: highlightBar + highlightFollowsCurrentItem: false + } +} diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/highlightranges.qml b/examples/declarative/modelviews/listview/dynamiclist/qml/highlightranges.qml new file mode 100644 index 0000000..58d37a3 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/highlightranges.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: root + property int current: 0 + width: 600; height: 300 + + // This example shows the same model in three different ListView items, + // with different highlight ranges. The highlight ranges are set by the + // preferredHighlightBegin and preferredHighlightEnd properties in ListView. + // + // The first ListView does not set a highlight range, so its currentItem + // can move freely within the visible area. If it moves outside the + // visible area, the view is automatically scrolled to keep the current + // item visible. + // + // The second ListView sets a highlight range which attempts to keep the + // current item within the the bounds of the range. However, + // items will not scroll beyond the beginning or end of the view, + // forcing the highlight to move outside the range at the ends. + // + // The third ListView sets the highlightRangeMode to StrictlyEnforceRange + // and sets a range smaller than the height of an item. This + // forces the current item to change when the view is flicked, + // since the highlight is unable to move. + // + // All ListViews bind their currentIndex to the root.current property. + // The first ListView sets root.current whenever its currentIndex changes + // due to keyboard interaction. + // Flicking the third ListView with the mouse also changes root.current. + + ListView { + id: list1 + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "lightsteelblue" } + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex + focus: true + } + + ListView { + id: list2 + x: list1.width + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "yellow" } + currentIndex: root.current + preferredHighlightBegin: 80; preferredHighlightEnd: 220 + highlightRangeMode: ListView.ApplyRange + } + + ListView { + id: list3 + x: list1.width + list2.width + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "yellow" } + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex + preferredHighlightBegin: 125; preferredHighlightEnd: 125 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + // The delegate for each list + Component { + id: petDelegate + Column { + width: 200 + Text { text: 'Name: ' + name } + Text { text: 'Type: ' + type } + Text { text: 'Age: ' + age } + } + } +} diff --git a/examples/declarative/modelviews/listview/dynamiclist/qml/listview.qmlproject b/examples/declarative/modelviews/listview/dynamiclist/qml/listview.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/listview.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/listview/dynamiclist/qml/sections.qml b/examples/declarative/modelviews/listview/dynamiclist/qml/sections.qml new file mode 100644 index 0000000..3248899 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qml/sections.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example shows how a ListView can be separated into sections using +// the ListView.section attached property. + +import QtQuick 1.0 + +//! [0] +Rectangle { + id: container + width: 200 + height: 250 + + ListModel { + id: animalsModel + ListElement { name: "Parrot"; size: "Small" } + ListElement { name: "Guinea pig"; size: "Small" } + ListElement { name: "Dog"; size: "Medium" } + ListElement { name: "Cat"; size: "Medium" } + ListElement { name: "Elephant"; size: "Large" } + } + + // The delegate for each section header + Component { + id: sectionHeading + Rectangle { + width: container.width + height: childrenRect.height + color: "lightsteelblue" + + Text { + text: section + font.bold: true + } + } + } + + ListView { + anchors.fill: parent + model: animalsModel + delegate: Text { text: name } + + section.property: "size" + section.criteria: ViewSection.FullString + section.delegate: sectionHeading + } +} +//! [0] + diff --git a/examples/declarative/modelviews/listview/dynamiclist/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/listview/dynamiclist/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/listview/dynamiclist/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/listview/dynamiclist/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/listview/dynamiclist/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/listview/dynamiclist/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/listview/dynamiclist/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.desktop b/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.desktop new file mode 100644 index 0000000..6113e00 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=expandingdelegates +Exec=/opt/usr/bin/expandingdelegates +Icon=expandingdelegates +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.png b/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.png diff --git a/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.pro b/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.pro new file mode 100644 index 0000000..59f0554 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEEA16F93 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.svg b/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/expandingdelegates.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/listview/expandingdelegates/main.cpp b/examples/declarative/modelviews/listview/expandingdelegates/main.cpp new file mode 100644 index 0000000..0de5247 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/expandingdelegates.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/PetsModel.qml b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/PetsModel.qml new file mode 100644 index 0000000..5220763 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/PetsModel.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + ListElement { + name: "Polly" + type: "Parrot" + age: 12 + size: "Small" + } + ListElement { + name: "Penny" + type: "Turtle" + age: 4 + size: "Small" + } + ListElement { + name: "Warren" + type: "Rabbit" + age: 2 + size: "Small" + } + ListElement { + name: "Spot" + type: "Dog" + age: 9 + size: "Medium" + } + ListElement { + name: "Schrödinger" + type: "Cat" + age: 2 + size: "Medium" + } + ListElement { + name: "Joey" + type: "Kangaroo" + age: 1 + size: "Medium" + } + ListElement { + name: "Kimba" + type: "Bunny" + age: 65 + size: "Large" + } + ListElement { + name: "Rover" + type: "Dog" + age: 5 + size: "Large" + } + ListElement { + name: "Tiny" + type: "Elephant" + age: 15 + size: "Large" + } +} diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/PressAndHoldButton.qml b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/PressAndHoldButton.qml new file mode 100644 index 0000000..d6808a4 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/PressAndHoldButton.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: container + + property int repeatDelay: 300 + property int repeatDuration: 75 + property bool pressed: false + + signal clicked + + scale: pressed ? 0.9 : 1 + + function release() { + autoRepeatClicks.stop() + container.pressed = false + } + + SequentialAnimation on pressed { + id: autoRepeatClicks + running: false + + PropertyAction { target: container; property: "pressed"; value: true } + ScriptAction { script: container.clicked() } + PauseAnimation { duration: repeatDelay } + + SequentialAnimation { + loops: Animation.Infinite + ScriptAction { script: container.clicked() } + PauseAnimation { duration: repeatDuration } + } + } + + MouseArea { + anchors.fill: parent + + onPressed: autoRepeatClicks.start() + onReleased: container.release() + onCanceled: container.release() + } +} + diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/RecipesModel.qml b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/RecipesModel.qml new file mode 100644 index 0000000..6056b90 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/RecipesModel.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + ListElement { + title: "Pancakes" + picture: "content/pics/pancakes.jpg" + ingredients: "<html> + <ul> + <li> 1 cup (150g) self-raising flour + <li> 1 tbs caster sugar + <li> 3/4 cup (185ml) milk + <li> 1 egg + </ul> + </html>" + method: "<html> + <ol> + <li> Sift flour and sugar together into a bowl. Add a pinch of salt. + <li> Beat milk and egg together, then add to dry ingredients. Beat until smooth. + <li> Pour mixture into a pan on medium heat and cook until bubbles appear on the surface. + <li> Turn over and cook other side until golden. + </ol> + </html>" + } + ListElement { + title: "Fruit Salad" + picture: "content/pics/fruit-salad.jpg" + ingredients: "* Seasonal Fruit" + method: "* Chop fruit and place in a bowl." + } + ListElement { + title: "Vegetable Soup" + picture: "content/pics/vegetable-soup.jpg" + ingredients: "<html> + <ul> + <li> 1 onion + <li> 1 turnip + <li> 1 potato + <li> 1 carrot + <li> 1 head of celery + <li> 1 1/2 litres of water + </ul> + </html>" + method: "<html> + <ol> + <li> Chop vegetables. + <li> Boil in water until vegetables soften. + <li> Season with salt and pepper to taste. + </ol> + </html>" + } + ListElement { + title: "Hamburger" + picture: "content/pics/hamburger.jpg" + ingredients: "<html> + <ul> + <li> 500g minced beef + <li> Seasoning + <li> lettuce, tomato, onion, cheese + <li> 1 hamburger bun for each burger + </ul> + </html>" + method: "<html> + <ol> + <li> Mix the beef, together with seasoning, in a food processor. + <li> Shape the beef into burgers. + <li> Grill the burgers for about 5 mins on each side (until cooked through) + <li> Serve each burger on a bun with ketchup, cheese, lettuce, tomato and onion. + </ol> + </html>" + } + ListElement { + title: "Lemonade" + picture: "content/pics/lemonade.jpg" + ingredients: "<html> + <ul> + <li> 1 cup Lemon Juice + <li> 1 cup Sugar + <li> 6 Cups of Water (2 cups warm water, 4 cups cold water) + </ul> + </html>" + method: "<html> + <ol> + <li> Pour 2 cups of warm water into a pitcher and stir in sugar until it dissolves. + <li> Pour in lemon juice, stir again, and add 4 cups of cold water. + <li> Chill or serve over ice cubes. + </ol> + </html>" + } +} diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/TextButton.qml b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/TextButton.qml new file mode 100644 index 0000000..f26d775 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/TextButton.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: container + + property alias text: label.text + + signal clicked + + width: label.width + 20; height: label.height + 6 + smooth: true + radius: 10 + + gradient: Gradient { + GradientStop { id: gradientStop; position: 0.0; color: palette.light } + GradientStop { position: 1.0; color: palette.button } + } + + SystemPalette { id: palette } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { container.clicked() } + } + + Text { + id: label + anchors.centerIn: parent + } + + states: State { + name: "pressed" + when: mouseArea.pressed + PropertyChanges { target: gradientStop; color: palette.dark } + } +} + diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/arrow-down.png b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/arrow-down.png Binary files differnew file mode 100644 index 0000000..29d1d44 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/arrow-down.png diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/arrow-up.png b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/arrow-up.png Binary files differnew file mode 100644 index 0000000..e437312 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/arrow-up.png diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/fruit-salad.jpg b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/fruit-salad.jpg Binary files differnew file mode 100644 index 0000000..da5a6b1 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/fruit-salad.jpg diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/hamburger.jpg b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/hamburger.jpg Binary files differnew file mode 100644 index 0000000..d0a15be --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/hamburger.jpg diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/lemonade.jpg b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/lemonade.jpg Binary files differnew file mode 100644 index 0000000..db445c9 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/lemonade.jpg diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/list-delete.png b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/list-delete.png Binary files differnew file mode 100644 index 0000000..df2a147 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/list-delete.png diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/minus-sign.png b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/minus-sign.png Binary files differnew file mode 100644 index 0000000..d6f233d --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/minus-sign.png diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/moreDown.png b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/moreDown.png Binary files differnew file mode 100644 index 0000000..31a35d5 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/moreDown.png diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/moreUp.png b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/moreUp.png Binary files differnew file mode 100644 index 0000000..fefb9c9 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/moreUp.png diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/pancakes.jpg b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/pancakes.jpg Binary files differnew file mode 100644 index 0000000..60c4396 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/pancakes.jpg diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/plus-sign.png b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/plus-sign.png Binary files differnew file mode 100644 index 0000000..40df113 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/plus-sign.png diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/vegetable-soup.jpg b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/vegetable-soup.jpg Binary files differnew file mode 100644 index 0000000..9dce332 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/content/pics/vegetable-soup.jpg diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/dynamiclist.qml b/examples/declarative/modelviews/listview/expandingdelegates/qml/dynamiclist.qml new file mode 100644 index 0000000..f25f0fa --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/dynamiclist.qml @@ -0,0 +1,203 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 1.0 +import "content" + +// This example shows how items can be dynamically added to and removed from +// a ListModel, and how these list modifications can be animated. + +Rectangle { + id: container + width: 500; height: 400 + color: "#343434" + + // The model: + ListModel { + id: fruitModel + + ListElement { + name: "Apple"; cost: 2.45 + attributes: [ + ListElement { description: "Core" }, + ListElement { description: "Deciduous" } + ] + } + ListElement { + name: "Banana"; cost: 1.95 + attributes: [ + ListElement { description: "Tropical" }, + ListElement { description: "Seedless" } + ] + } + ListElement { + name: "Cumquat"; cost: 3.25 + attributes: [ + ListElement { description: "Citrus" } + ] + } + ListElement { + name: "Durian"; cost: 9.95 + attributes: [ + ListElement { description: "Tropical" }, + ListElement { description: "Smelly" } + ] + } + } + + // The delegate for each fruit in the model: + Component { + id: listDelegate + + Item { + id: delegateItem + width: listView.width; height: 55 + clip: true + + Row { + anchors.verticalCenter: parent.verticalCenter + spacing: 10 + + Column { + Image { + source: "content/pics/arrow-up.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index-1, 1) } + } + Image { source: "content/pics/arrow-down.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index+1, 1) } + } + } + + Column { + anchors.verticalCenter: parent.verticalCenter + + Text { + text: name + font.pixelSize: 15 + color: "white" + } + Row { + spacing: 5 + Repeater { + model: attributes + Text { text: description; color: "White" } + } + } + } + } + + Row { + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + spacing: 10 + + PressAndHoldButton { + anchors.verticalCenter: parent.verticalCenter + source: "content/pics/plus-sign.png" + onClicked: fruitModel.setProperty(index, "cost", cost + 0.25) + } + + Text { + id: costText + anchors.verticalCenter: parent.verticalCenter + text: '$' + Number(cost).toFixed(2) + font.pixelSize: 15 + color: "white" + font.bold: true + } + + PressAndHoldButton { + anchors.verticalCenter: parent.verticalCenter + source: "content/pics/minus-sign.png" + onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25)) + } + + Image { + source: "content/pics/list-delete.png" + MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) } + } + } + + // Animate adding and removing of items: + + ListView.onAdd: SequentialAnimation { + PropertyAction { target: delegateItem; property: "height"; value: 0 } + NumberAnimation { target: delegateItem; property: "height"; to: 55; duration: 250; easing.type: Easing.InOutQuad } + } + + ListView.onRemove: SequentialAnimation { + PropertyAction { target: delegateItem; property: "ListView.delayRemove"; value: true } + NumberAnimation { target: delegateItem; property: "height"; to: 0; duration: 250; easing.type: Easing.InOutQuad } + + // Make sure delayRemove is set back to false so that the item can be destroyed + PropertyAction { target: delegateItem; property: "ListView.delayRemove"; value: false } + } + } + } + + // The view: + ListView { + id: listView + anchors.fill: parent; anchors.margins: 20 + model: fruitModel + delegate: listDelegate + } + + Row { + anchors { left: parent.left; bottom: parent.bottom; margins: 20 } + spacing: 10 + + TextButton { + text: "Add an item" + onClicked: { + fruitModel.append({ + "name": "Pizza Margarita", + "cost": 5.95, + "attributes": [{"description": "Cheese"}, {"description": "Tomato"}] + }) + } + } + + TextButton { + text: "Remove all items" + onClicked: fruitModel.clear() + } + } +} + diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/expandingdelegates.qml b/examples/declarative/modelviews/listview/expandingdelegates/qml/expandingdelegates.qml new file mode 100644 index 0000000..bd3d3a9 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/expandingdelegates.qml @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +// This example illustrates expanding a list item to show a more detailed view. + +Rectangle { + id: page + width: 400; height: 240 + color: "black" + + // Delegate for the recipes. This delegate has two modes: + // 1. List mode (default), which just shows the picture and title of the recipe. + // 2. Details mode, which also shows the ingredients and method. + Component { + id: recipeDelegate + + Item { + id: recipe + + // Create a property to contain the visibility of the details. + // We can bind multiple element's opacity to this one property, + // rather than having a "PropertyChanges" line for each element we + // want to fade. + property real detailsOpacity : 0 + + width: listView.width + height: 70 + + // A simple rounded rectangle for the background + Rectangle { + id: background + x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2 + color: "ivory" + border.color: "orange" + radius: 5 + } + + // This mouse region covers the entire delegate. + // When clicked it changes mode to 'Details'. If we are already + // in Details mode, then no change will happen. + MouseArea { + anchors.fill: parent + onClicked: recipe.state = 'Details'; + } + + // Lay out the page: picture, title and ingredients at the top, and method at the + // bottom. Note that elements that should not be visible in the list + // mode have their opacity set to recipe.detailsOpacity. + Row { + id: topLayout + x: 10; y: 10; height: recipeImage.height; width: parent.width + spacing: 10 + + Image { + id: recipeImage + width: 50; height: 50 + source: picture + } + + Column { + width: background.width - recipeImage.width - 20; height: recipeImage.height + spacing: 5 + + Text { + text: title + font.bold: true; font.pointSize: 16 + } + + Text { + text: "Ingredients" + font.pointSize: 12; font.bold: true + opacity: recipe.detailsOpacity + } + + Text { + text: ingredients + wrapMode: Text.WordWrap + width: parent.width + opacity: recipe.detailsOpacity + } + } + } + + Item { + id: details + x: 10; width: parent.width - 20 + anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 } + opacity: recipe.detailsOpacity + + Text { + id: methodTitle + anchors.top: parent.top + text: "Method" + font.pointSize: 12; font.bold: true + } + + Flickable { + id: flick + width: parent.width + anchors { top: methodTitle.bottom; bottom: parent.bottom } + contentHeight: methodText.height + clip: true + + Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width } + } + + Image { + anchors { right: flick.right; top: flick.top } + source: "content/pics/moreUp.png" + opacity: flick.atYBeginning ? 0 : 1 + } + + Image { + anchors { right: flick.right; bottom: flick.bottom } + source: "content/pics/moreDown.png" + opacity: flick.atYEnd ? 0 : 1 + } + } + + // A button to close the detailed view, i.e. set the state back to default (''). + TextButton { + y: 10 + anchors { right: background.right; rightMargin: 10 } + opacity: recipe.detailsOpacity + text: "Close" + + onClicked: recipe.state = ''; + } + + states: State { + name: "Details" + + PropertyChanges { target: background; color: "white" } + PropertyChanges { target: recipeImage; width: 130; height: 130 } // Make picture bigger + PropertyChanges { target: recipe; detailsOpacity: 1; x: 0 } // Make details visible + PropertyChanges { target: recipe; height: listView.height } // Fill the entire list area with the detailed view + + // Move the list so that this item is at the top. + PropertyChanges { target: recipe.ListView.view; explicit: true; contentY: recipe.y } + + // Disallow flicking while we're in detailed view + PropertyChanges { target: recipe.ListView.view; interactive: false } + } + + transitions: Transition { + // Make the state changes smooth + ParallelAnimation { + ColorAnimation { property: "color"; duration: 500 } + NumberAnimation { duration: 300; properties: "detailsOpacity,x,contentY,height,width" } + } + } + } + } + + // The actual list + ListView { + id: listView + anchors.fill: parent + model: RecipesModel {} + delegate: recipeDelegate + } +} diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/highlight.qml b/examples/declarative/modelviews/listview/expandingdelegates/qml/highlight.qml new file mode 100644 index 0000000..249c73b --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/highlight.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example shows how to create your own highlight delegate for a ListView +// that uses a SpringAnimation to provide custom movement when the +// highlight bar is moved between items. + +import QtQuick 1.0 +import "content" + +Rectangle { + width: 200; height: 300 + + // Define a delegate component. A component will be + // instantiated for each visible item in the list. + Component { + id: petDelegate + Item { + id: wrapper + width: 200; height: 55 + Column { + Text { text: 'Name: ' + name } + Text { text: 'Type: ' + type } + Text { text: 'Age: ' + age } + } + // indent the item if it is the current item + states: State { + name: "Current" + when: wrapper.ListView.isCurrentItem + PropertyChanges { target: wrapper; x: 20 } + } + transitions: Transition { + NumberAnimation { properties: "x"; duration: 200 } + } + } + } + + // Define a highlight with customised movement between items. + Component { + id: highlightBar + Rectangle { + width: 200; height: 50 + color: "#FFFF88" + y: listView.currentItem.y; + Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } } + } + } + + ListView { + id: listView + width: 200; height: parent.height + + model: PetsModel {} + delegate: petDelegate + focus: true + + // Set the highlight delegate. Note we must also set highlightFollowsCurrentItem + // to false so the highlight delegate can control how the highlight is moved. + highlight: highlightBar + highlightFollowsCurrentItem: false + } +} diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/highlightranges.qml b/examples/declarative/modelviews/listview/expandingdelegates/qml/highlightranges.qml new file mode 100644 index 0000000..58d37a3 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/highlightranges.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: root + property int current: 0 + width: 600; height: 300 + + // This example shows the same model in three different ListView items, + // with different highlight ranges. The highlight ranges are set by the + // preferredHighlightBegin and preferredHighlightEnd properties in ListView. + // + // The first ListView does not set a highlight range, so its currentItem + // can move freely within the visible area. If it moves outside the + // visible area, the view is automatically scrolled to keep the current + // item visible. + // + // The second ListView sets a highlight range which attempts to keep the + // current item within the the bounds of the range. However, + // items will not scroll beyond the beginning or end of the view, + // forcing the highlight to move outside the range at the ends. + // + // The third ListView sets the highlightRangeMode to StrictlyEnforceRange + // and sets a range smaller than the height of an item. This + // forces the current item to change when the view is flicked, + // since the highlight is unable to move. + // + // All ListViews bind their currentIndex to the root.current property. + // The first ListView sets root.current whenever its currentIndex changes + // due to keyboard interaction. + // Flicking the third ListView with the mouse also changes root.current. + + ListView { + id: list1 + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "lightsteelblue" } + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex + focus: true + } + + ListView { + id: list2 + x: list1.width + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "yellow" } + currentIndex: root.current + preferredHighlightBegin: 80; preferredHighlightEnd: 220 + highlightRangeMode: ListView.ApplyRange + } + + ListView { + id: list3 + x: list1.width + list2.width + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "yellow" } + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex + preferredHighlightBegin: 125; preferredHighlightEnd: 125 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + // The delegate for each list + Component { + id: petDelegate + Column { + width: 200 + Text { text: 'Name: ' + name } + Text { text: 'Type: ' + type } + Text { text: 'Age: ' + age } + } + } +} diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qml/listview.qmlproject b/examples/declarative/modelviews/listview/expandingdelegates/qml/listview.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/listview.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/listview/expandingdelegates/qml/sections.qml b/examples/declarative/modelviews/listview/expandingdelegates/qml/sections.qml new file mode 100644 index 0000000..3248899 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qml/sections.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example shows how a ListView can be separated into sections using +// the ListView.section attached property. + +import QtQuick 1.0 + +//! [0] +Rectangle { + id: container + width: 200 + height: 250 + + ListModel { + id: animalsModel + ListElement { name: "Parrot"; size: "Small" } + ListElement { name: "Guinea pig"; size: "Small" } + ListElement { name: "Dog"; size: "Medium" } + ListElement { name: "Cat"; size: "Medium" } + ListElement { name: "Elephant"; size: "Large" } + } + + // The delegate for each section header + Component { + id: sectionHeading + Rectangle { + width: container.width + height: childrenRect.height + color: "lightsteelblue" + + Text { + text: section + font.bold: true + } + } + } + + ListView { + anchors.fill: parent + model: animalsModel + delegate: Text { text: name } + + section.property: "size" + section.criteria: ViewSection.FullString + section.delegate: sectionHeading + } +} +//! [0] + diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/listview/expandingdelegates/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/listview/expandingdelegates/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/listview/expandingdelegates/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/README b/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/README new file mode 100644 index 0000000..1ceed78 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/README @@ -0,0 +1,6 @@ +The Debian Package expandingdelegates +---------------------------- + +Comments regarding the Package + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:28:38 +0100 diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/changelog b/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/changelog new file mode 100644 index 0000000..5161d7d --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/changelog @@ -0,0 +1,5 @@ +expandingdelegates (0.0.1) unstable; urgency=low + + * Initial Release. + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:28:38 +0100 diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/compat b/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/compat @@ -0,0 +1 @@ +7 diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/control b/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/control new file mode 100644 index 0000000..6993cea --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/control @@ -0,0 +1,13 @@ +Source: expandingdelegates +Section: user/hidden +Priority: optional +Maintainer: Daniel Molkentin <danimo@unknown> +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: <insert the upstream URL, if relevant> + +Package: expandingdelegates +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: <insert up to 60 chars description> + <insert long description, indented with spaces> diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/copyright b/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/copyright new file mode 100644 index 0000000..6185298 --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/copyright @@ -0,0 +1,40 @@ +This package was debianized by Daniel Molkentin <danimo@unknown> on +Thu, 18 Nov 2010 17:28:38 +0100. + +It was downloaded from <url://example.com> + +Upstream Author(s): + + <put author's name and email here> + <likewise for another author> + +Copyright: + + <Copyright (C) YYYY Name OfAuthor> + <likewise for another author> + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2010, Daniel Molkentin <danimo@unknown> and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/rules b/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/rules new file mode 100755 index 0000000..96213ef --- /dev/null +++ b/examples/declarative/modelviews/listview/expandingdelegates/qtc_packaging/debian_fremantle/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/expandingdelegates.sgml > expandingdelegates.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/expandingdelegates. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/expandingdelegates install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + # dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/examples/declarative/modelviews/listview/highlight/highlight.desktop b/examples/declarative/modelviews/listview/highlight/highlight.desktop new file mode 100644 index 0000000..5348e40 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/highlight.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=highlight +Exec=/opt/usr/bin/highlight +Icon=highlight +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/listview/highlight/highlight.png b/examples/declarative/modelviews/listview/highlight/highlight.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/highlight.png diff --git a/examples/declarative/modelviews/listview/highlight/highlight.pro b/examples/declarative/modelviews/listview/highlight/highlight.pro new file mode 100644 index 0000000..60ae50c --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/highlight.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE9439941 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/listview/highlight/highlight.svg b/examples/declarative/modelviews/listview/highlight/highlight.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/highlight.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/listview/highlight/main.cpp b/examples/declarative/modelviews/listview/highlight/main.cpp new file mode 100644 index 0000000..6628a67 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); + viewer.setMainQmlFile(QLatin1String("qml/qml/highlight.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/PetsModel.qml b/examples/declarative/modelviews/listview/highlight/qml/content/PetsModel.qml new file mode 100644 index 0000000..5220763 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/PetsModel.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + ListElement { + name: "Polly" + type: "Parrot" + age: 12 + size: "Small" + } + ListElement { + name: "Penny" + type: "Turtle" + age: 4 + size: "Small" + } + ListElement { + name: "Warren" + type: "Rabbit" + age: 2 + size: "Small" + } + ListElement { + name: "Spot" + type: "Dog" + age: 9 + size: "Medium" + } + ListElement { + name: "Schrödinger" + type: "Cat" + age: 2 + size: "Medium" + } + ListElement { + name: "Joey" + type: "Kangaroo" + age: 1 + size: "Medium" + } + ListElement { + name: "Kimba" + type: "Bunny" + age: 65 + size: "Large" + } + ListElement { + name: "Rover" + type: "Dog" + age: 5 + size: "Large" + } + ListElement { + name: "Tiny" + type: "Elephant" + age: 15 + size: "Large" + } +} diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/PressAndHoldButton.qml b/examples/declarative/modelviews/listview/highlight/qml/content/PressAndHoldButton.qml new file mode 100644 index 0000000..d6808a4 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/PressAndHoldButton.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: container + + property int repeatDelay: 300 + property int repeatDuration: 75 + property bool pressed: false + + signal clicked + + scale: pressed ? 0.9 : 1 + + function release() { + autoRepeatClicks.stop() + container.pressed = false + } + + SequentialAnimation on pressed { + id: autoRepeatClicks + running: false + + PropertyAction { target: container; property: "pressed"; value: true } + ScriptAction { script: container.clicked() } + PauseAnimation { duration: repeatDelay } + + SequentialAnimation { + loops: Animation.Infinite + ScriptAction { script: container.clicked() } + PauseAnimation { duration: repeatDuration } + } + } + + MouseArea { + anchors.fill: parent + + onPressed: autoRepeatClicks.start() + onReleased: container.release() + onCanceled: container.release() + } +} + diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/RecipesModel.qml b/examples/declarative/modelviews/listview/highlight/qml/content/RecipesModel.qml new file mode 100644 index 0000000..6056b90 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/RecipesModel.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + ListElement { + title: "Pancakes" + picture: "content/pics/pancakes.jpg" + ingredients: "<html> + <ul> + <li> 1 cup (150g) self-raising flour + <li> 1 tbs caster sugar + <li> 3/4 cup (185ml) milk + <li> 1 egg + </ul> + </html>" + method: "<html> + <ol> + <li> Sift flour and sugar together into a bowl. Add a pinch of salt. + <li> Beat milk and egg together, then add to dry ingredients. Beat until smooth. + <li> Pour mixture into a pan on medium heat and cook until bubbles appear on the surface. + <li> Turn over and cook other side until golden. + </ol> + </html>" + } + ListElement { + title: "Fruit Salad" + picture: "content/pics/fruit-salad.jpg" + ingredients: "* Seasonal Fruit" + method: "* Chop fruit and place in a bowl." + } + ListElement { + title: "Vegetable Soup" + picture: "content/pics/vegetable-soup.jpg" + ingredients: "<html> + <ul> + <li> 1 onion + <li> 1 turnip + <li> 1 potato + <li> 1 carrot + <li> 1 head of celery + <li> 1 1/2 litres of water + </ul> + </html>" + method: "<html> + <ol> + <li> Chop vegetables. + <li> Boil in water until vegetables soften. + <li> Season with salt and pepper to taste. + </ol> + </html>" + } + ListElement { + title: "Hamburger" + picture: "content/pics/hamburger.jpg" + ingredients: "<html> + <ul> + <li> 500g minced beef + <li> Seasoning + <li> lettuce, tomato, onion, cheese + <li> 1 hamburger bun for each burger + </ul> + </html>" + method: "<html> + <ol> + <li> Mix the beef, together with seasoning, in a food processor. + <li> Shape the beef into burgers. + <li> Grill the burgers for about 5 mins on each side (until cooked through) + <li> Serve each burger on a bun with ketchup, cheese, lettuce, tomato and onion. + </ol> + </html>" + } + ListElement { + title: "Lemonade" + picture: "content/pics/lemonade.jpg" + ingredients: "<html> + <ul> + <li> 1 cup Lemon Juice + <li> 1 cup Sugar + <li> 6 Cups of Water (2 cups warm water, 4 cups cold water) + </ul> + </html>" + method: "<html> + <ol> + <li> Pour 2 cups of warm water into a pitcher and stir in sugar until it dissolves. + <li> Pour in lemon juice, stir again, and add 4 cups of cold water. + <li> Chill or serve over ice cubes. + </ol> + </html>" + } +} diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/TextButton.qml b/examples/declarative/modelviews/listview/highlight/qml/content/TextButton.qml new file mode 100644 index 0000000..f26d775 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/TextButton.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: container + + property alias text: label.text + + signal clicked + + width: label.width + 20; height: label.height + 6 + smooth: true + radius: 10 + + gradient: Gradient { + GradientStop { id: gradientStop; position: 0.0; color: palette.light } + GradientStop { position: 1.0; color: palette.button } + } + + SystemPalette { id: palette } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { container.clicked() } + } + + Text { + id: label + anchors.centerIn: parent + } + + states: State { + name: "pressed" + when: mouseArea.pressed + PropertyChanges { target: gradientStop; color: palette.dark } + } +} + diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/pics/arrow-down.png b/examples/declarative/modelviews/listview/highlight/qml/content/pics/arrow-down.png Binary files differnew file mode 100644 index 0000000..29d1d44 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/pics/arrow-down.png diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/pics/arrow-up.png b/examples/declarative/modelviews/listview/highlight/qml/content/pics/arrow-up.png Binary files differnew file mode 100644 index 0000000..e437312 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/pics/arrow-up.png diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/pics/fruit-salad.jpg b/examples/declarative/modelviews/listview/highlight/qml/content/pics/fruit-salad.jpg Binary files differnew file mode 100644 index 0000000..da5a6b1 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/pics/fruit-salad.jpg diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/pics/hamburger.jpg b/examples/declarative/modelviews/listview/highlight/qml/content/pics/hamburger.jpg Binary files differnew file mode 100644 index 0000000..d0a15be --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/pics/hamburger.jpg diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/pics/lemonade.jpg b/examples/declarative/modelviews/listview/highlight/qml/content/pics/lemonade.jpg Binary files differnew file mode 100644 index 0000000..db445c9 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/pics/lemonade.jpg diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/pics/list-delete.png b/examples/declarative/modelviews/listview/highlight/qml/content/pics/list-delete.png Binary files differnew file mode 100644 index 0000000..df2a147 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/pics/list-delete.png diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/pics/minus-sign.png b/examples/declarative/modelviews/listview/highlight/qml/content/pics/minus-sign.png Binary files differnew file mode 100644 index 0000000..d6f233d --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/pics/minus-sign.png diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/pics/moreDown.png b/examples/declarative/modelviews/listview/highlight/qml/content/pics/moreDown.png Binary files differnew file mode 100644 index 0000000..31a35d5 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/pics/moreDown.png diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/pics/moreUp.png b/examples/declarative/modelviews/listview/highlight/qml/content/pics/moreUp.png Binary files differnew file mode 100644 index 0000000..fefb9c9 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/pics/moreUp.png diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/pics/pancakes.jpg b/examples/declarative/modelviews/listview/highlight/qml/content/pics/pancakes.jpg Binary files differnew file mode 100644 index 0000000..60c4396 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/pics/pancakes.jpg diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/pics/plus-sign.png b/examples/declarative/modelviews/listview/highlight/qml/content/pics/plus-sign.png Binary files differnew file mode 100644 index 0000000..40df113 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/pics/plus-sign.png diff --git a/examples/declarative/modelviews/listview/highlight/qml/content/pics/vegetable-soup.jpg b/examples/declarative/modelviews/listview/highlight/qml/content/pics/vegetable-soup.jpg Binary files differnew file mode 100644 index 0000000..9dce332 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/content/pics/vegetable-soup.jpg diff --git a/examples/declarative/modelviews/listview/highlight/qml/dynamiclist.qml b/examples/declarative/modelviews/listview/highlight/qml/dynamiclist.qml new file mode 100644 index 0000000..f25f0fa --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/dynamiclist.qml @@ -0,0 +1,203 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 1.0 +import "content" + +// This example shows how items can be dynamically added to and removed from +// a ListModel, and how these list modifications can be animated. + +Rectangle { + id: container + width: 500; height: 400 + color: "#343434" + + // The model: + ListModel { + id: fruitModel + + ListElement { + name: "Apple"; cost: 2.45 + attributes: [ + ListElement { description: "Core" }, + ListElement { description: "Deciduous" } + ] + } + ListElement { + name: "Banana"; cost: 1.95 + attributes: [ + ListElement { description: "Tropical" }, + ListElement { description: "Seedless" } + ] + } + ListElement { + name: "Cumquat"; cost: 3.25 + attributes: [ + ListElement { description: "Citrus" } + ] + } + ListElement { + name: "Durian"; cost: 9.95 + attributes: [ + ListElement { description: "Tropical" }, + ListElement { description: "Smelly" } + ] + } + } + + // The delegate for each fruit in the model: + Component { + id: listDelegate + + Item { + id: delegateItem + width: listView.width; height: 55 + clip: true + + Row { + anchors.verticalCenter: parent.verticalCenter + spacing: 10 + + Column { + Image { + source: "content/pics/arrow-up.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index-1, 1) } + } + Image { source: "content/pics/arrow-down.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index+1, 1) } + } + } + + Column { + anchors.verticalCenter: parent.verticalCenter + + Text { + text: name + font.pixelSize: 15 + color: "white" + } + Row { + spacing: 5 + Repeater { + model: attributes + Text { text: description; color: "White" } + } + } + } + } + + Row { + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + spacing: 10 + + PressAndHoldButton { + anchors.verticalCenter: parent.verticalCenter + source: "content/pics/plus-sign.png" + onClicked: fruitModel.setProperty(index, "cost", cost + 0.25) + } + + Text { + id: costText + anchors.verticalCenter: parent.verticalCenter + text: '$' + Number(cost).toFixed(2) + font.pixelSize: 15 + color: "white" + font.bold: true + } + + PressAndHoldButton { + anchors.verticalCenter: parent.verticalCenter + source: "content/pics/minus-sign.png" + onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25)) + } + + Image { + source: "content/pics/list-delete.png" + MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) } + } + } + + // Animate adding and removing of items: + + ListView.onAdd: SequentialAnimation { + PropertyAction { target: delegateItem; property: "height"; value: 0 } + NumberAnimation { target: delegateItem; property: "height"; to: 55; duration: 250; easing.type: Easing.InOutQuad } + } + + ListView.onRemove: SequentialAnimation { + PropertyAction { target: delegateItem; property: "ListView.delayRemove"; value: true } + NumberAnimation { target: delegateItem; property: "height"; to: 0; duration: 250; easing.type: Easing.InOutQuad } + + // Make sure delayRemove is set back to false so that the item can be destroyed + PropertyAction { target: delegateItem; property: "ListView.delayRemove"; value: false } + } + } + } + + // The view: + ListView { + id: listView + anchors.fill: parent; anchors.margins: 20 + model: fruitModel + delegate: listDelegate + } + + Row { + anchors { left: parent.left; bottom: parent.bottom; margins: 20 } + spacing: 10 + + TextButton { + text: "Add an item" + onClicked: { + fruitModel.append({ + "name": "Pizza Margarita", + "cost": 5.95, + "attributes": [{"description": "Cheese"}, {"description": "Tomato"}] + }) + } + } + + TextButton { + text: "Remove all items" + onClicked: fruitModel.clear() + } + } +} + diff --git a/examples/declarative/modelviews/listview/highlight/qml/expandingdelegates.qml b/examples/declarative/modelviews/listview/highlight/qml/expandingdelegates.qml new file mode 100644 index 0000000..bd3d3a9 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/expandingdelegates.qml @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +// This example illustrates expanding a list item to show a more detailed view. + +Rectangle { + id: page + width: 400; height: 240 + color: "black" + + // Delegate for the recipes. This delegate has two modes: + // 1. List mode (default), which just shows the picture and title of the recipe. + // 2. Details mode, which also shows the ingredients and method. + Component { + id: recipeDelegate + + Item { + id: recipe + + // Create a property to contain the visibility of the details. + // We can bind multiple element's opacity to this one property, + // rather than having a "PropertyChanges" line for each element we + // want to fade. + property real detailsOpacity : 0 + + width: listView.width + height: 70 + + // A simple rounded rectangle for the background + Rectangle { + id: background + x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2 + color: "ivory" + border.color: "orange" + radius: 5 + } + + // This mouse region covers the entire delegate. + // When clicked it changes mode to 'Details'. If we are already + // in Details mode, then no change will happen. + MouseArea { + anchors.fill: parent + onClicked: recipe.state = 'Details'; + } + + // Lay out the page: picture, title and ingredients at the top, and method at the + // bottom. Note that elements that should not be visible in the list + // mode have their opacity set to recipe.detailsOpacity. + Row { + id: topLayout + x: 10; y: 10; height: recipeImage.height; width: parent.width + spacing: 10 + + Image { + id: recipeImage + width: 50; height: 50 + source: picture + } + + Column { + width: background.width - recipeImage.width - 20; height: recipeImage.height + spacing: 5 + + Text { + text: title + font.bold: true; font.pointSize: 16 + } + + Text { + text: "Ingredients" + font.pointSize: 12; font.bold: true + opacity: recipe.detailsOpacity + } + + Text { + text: ingredients + wrapMode: Text.WordWrap + width: parent.width + opacity: recipe.detailsOpacity + } + } + } + + Item { + id: details + x: 10; width: parent.width - 20 + anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 } + opacity: recipe.detailsOpacity + + Text { + id: methodTitle + anchors.top: parent.top + text: "Method" + font.pointSize: 12; font.bold: true + } + + Flickable { + id: flick + width: parent.width + anchors { top: methodTitle.bottom; bottom: parent.bottom } + contentHeight: methodText.height + clip: true + + Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width } + } + + Image { + anchors { right: flick.right; top: flick.top } + source: "content/pics/moreUp.png" + opacity: flick.atYBeginning ? 0 : 1 + } + + Image { + anchors { right: flick.right; bottom: flick.bottom } + source: "content/pics/moreDown.png" + opacity: flick.atYEnd ? 0 : 1 + } + } + + // A button to close the detailed view, i.e. set the state back to default (''). + TextButton { + y: 10 + anchors { right: background.right; rightMargin: 10 } + opacity: recipe.detailsOpacity + text: "Close" + + onClicked: recipe.state = ''; + } + + states: State { + name: "Details" + + PropertyChanges { target: background; color: "white" } + PropertyChanges { target: recipeImage; width: 130; height: 130 } // Make picture bigger + PropertyChanges { target: recipe; detailsOpacity: 1; x: 0 } // Make details visible + PropertyChanges { target: recipe; height: listView.height } // Fill the entire list area with the detailed view + + // Move the list so that this item is at the top. + PropertyChanges { target: recipe.ListView.view; explicit: true; contentY: recipe.y } + + // Disallow flicking while we're in detailed view + PropertyChanges { target: recipe.ListView.view; interactive: false } + } + + transitions: Transition { + // Make the state changes smooth + ParallelAnimation { + ColorAnimation { property: "color"; duration: 500 } + NumberAnimation { duration: 300; properties: "detailsOpacity,x,contentY,height,width" } + } + } + } + } + + // The actual list + ListView { + id: listView + anchors.fill: parent + model: RecipesModel {} + delegate: recipeDelegate + } +} diff --git a/examples/declarative/modelviews/listview/highlight/qml/highlight.qml b/examples/declarative/modelviews/listview/highlight/qml/highlight.qml new file mode 100644 index 0000000..249c73b --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/highlight.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example shows how to create your own highlight delegate for a ListView +// that uses a SpringAnimation to provide custom movement when the +// highlight bar is moved between items. + +import QtQuick 1.0 +import "content" + +Rectangle { + width: 200; height: 300 + + // Define a delegate component. A component will be + // instantiated for each visible item in the list. + Component { + id: petDelegate + Item { + id: wrapper + width: 200; height: 55 + Column { + Text { text: 'Name: ' + name } + Text { text: 'Type: ' + type } + Text { text: 'Age: ' + age } + } + // indent the item if it is the current item + states: State { + name: "Current" + when: wrapper.ListView.isCurrentItem + PropertyChanges { target: wrapper; x: 20 } + } + transitions: Transition { + NumberAnimation { properties: "x"; duration: 200 } + } + } + } + + // Define a highlight with customised movement between items. + Component { + id: highlightBar + Rectangle { + width: 200; height: 50 + color: "#FFFF88" + y: listView.currentItem.y; + Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } } + } + } + + ListView { + id: listView + width: 200; height: parent.height + + model: PetsModel {} + delegate: petDelegate + focus: true + + // Set the highlight delegate. Note we must also set highlightFollowsCurrentItem + // to false so the highlight delegate can control how the highlight is moved. + highlight: highlightBar + highlightFollowsCurrentItem: false + } +} diff --git a/examples/declarative/modelviews/listview/highlight/qml/highlightranges.qml b/examples/declarative/modelviews/listview/highlight/qml/highlightranges.qml new file mode 100644 index 0000000..58d37a3 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/highlightranges.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: root + property int current: 0 + width: 600; height: 300 + + // This example shows the same model in three different ListView items, + // with different highlight ranges. The highlight ranges are set by the + // preferredHighlightBegin and preferredHighlightEnd properties in ListView. + // + // The first ListView does not set a highlight range, so its currentItem + // can move freely within the visible area. If it moves outside the + // visible area, the view is automatically scrolled to keep the current + // item visible. + // + // The second ListView sets a highlight range which attempts to keep the + // current item within the the bounds of the range. However, + // items will not scroll beyond the beginning or end of the view, + // forcing the highlight to move outside the range at the ends. + // + // The third ListView sets the highlightRangeMode to StrictlyEnforceRange + // and sets a range smaller than the height of an item. This + // forces the current item to change when the view is flicked, + // since the highlight is unable to move. + // + // All ListViews bind their currentIndex to the root.current property. + // The first ListView sets root.current whenever its currentIndex changes + // due to keyboard interaction. + // Flicking the third ListView with the mouse also changes root.current. + + ListView { + id: list1 + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "lightsteelblue" } + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex + focus: true + } + + ListView { + id: list2 + x: list1.width + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "yellow" } + currentIndex: root.current + preferredHighlightBegin: 80; preferredHighlightEnd: 220 + highlightRangeMode: ListView.ApplyRange + } + + ListView { + id: list3 + x: list1.width + list2.width + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "yellow" } + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex + preferredHighlightBegin: 125; preferredHighlightEnd: 125 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + // The delegate for each list + Component { + id: petDelegate + Column { + width: 200 + Text { text: 'Name: ' + name } + Text { text: 'Type: ' + type } + Text { text: 'Age: ' + age } + } + } +} diff --git a/examples/declarative/modelviews/listview/highlight/qml/listview.qmlproject b/examples/declarative/modelviews/listview/highlight/qml/listview.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/listview.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/listview/highlight/qml/sections.qml b/examples/declarative/modelviews/listview/highlight/qml/sections.qml new file mode 100644 index 0000000..3248899 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qml/sections.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example shows how a ListView can be separated into sections using +// the ListView.section attached property. + +import QtQuick 1.0 + +//! [0] +Rectangle { + id: container + width: 200 + height: 250 + + ListModel { + id: animalsModel + ListElement { name: "Parrot"; size: "Small" } + ListElement { name: "Guinea pig"; size: "Small" } + ListElement { name: "Dog"; size: "Medium" } + ListElement { name: "Cat"; size: "Medium" } + ListElement { name: "Elephant"; size: "Large" } + } + + // The delegate for each section header + Component { + id: sectionHeading + Rectangle { + width: container.width + height: childrenRect.height + color: "lightsteelblue" + + Text { + text: section + font.bold: true + } + } + } + + ListView { + anchors.fill: parent + model: animalsModel + delegate: Text { text: name } + + section.property: "size" + section.criteria: ViewSection.FullString + section.delegate: sectionHeading + } +} +//! [0] + diff --git a/examples/declarative/modelviews/listview/highlight/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/listview/highlight/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/listview/highlight/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/listview/highlight/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/listview/highlight/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/listview/highlight/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/README b/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/README new file mode 100644 index 0000000..37e930a --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/README @@ -0,0 +1,6 @@ +The Debian Package highlight +---------------------------- + +Comments regarding the Package + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:33:55 +0100 diff --git a/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/changelog b/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/changelog new file mode 100644 index 0000000..43e669b --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/changelog @@ -0,0 +1,5 @@ +highlight (0.0.1) unstable; urgency=low + + * Initial Release. + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:33:55 +0100 diff --git a/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/compat b/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/compat @@ -0,0 +1 @@ +7 diff --git a/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/control b/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/control new file mode 100644 index 0000000..0ed2ce2 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/control @@ -0,0 +1,13 @@ +Source: highlight +Section: user/hidden +Priority: optional +Maintainer: Daniel Molkentin <danimo@unknown> +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: <insert the upstream URL, if relevant> + +Package: highlight +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: <insert up to 60 chars description> + <insert long description, indented with spaces> diff --git a/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/copyright b/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/copyright new file mode 100644 index 0000000..b795943 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/copyright @@ -0,0 +1,40 @@ +This package was debianized by Daniel Molkentin <danimo@unknown> on +Thu, 18 Nov 2010 17:33:55 +0100. + +It was downloaded from <url://example.com> + +Upstream Author(s): + + <put author's name and email here> + <likewise for another author> + +Copyright: + + <Copyright (C) YYYY Name OfAuthor> + <likewise for another author> + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2010, Daniel Molkentin <danimo@unknown> and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/rules b/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/rules new file mode 100755 index 0000000..986e3ee --- /dev/null +++ b/examples/declarative/modelviews/listview/highlight/qtc_packaging/debian_fremantle/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/highlight.sgml > highlight.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/highlight. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/highlight install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + # dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/examples/declarative/modelviews/listview/highlightranges/highlightranges.desktop b/examples/declarative/modelviews/listview/highlightranges/highlightranges.desktop new file mode 100644 index 0000000..57200be --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/highlightranges.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=highlightranges +Exec=/opt/usr/bin/highlightranges +Icon=highlightranges +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/listview/highlightranges/highlightranges.png b/examples/declarative/modelviews/listview/highlightranges/highlightranges.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/highlightranges.png diff --git a/examples/declarative/modelviews/listview/highlightranges/highlightranges.pro b/examples/declarative/modelviews/listview/highlightranges/highlightranges.pro new file mode 100644 index 0000000..4dd178f --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/highlightranges.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE7A0AE23 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/listview/highlightranges/highlightranges.svg b/examples/declarative/modelviews/listview/highlightranges/highlightranges.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/highlightranges.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/listview/highlightranges/main.cpp b/examples/declarative/modelviews/listview/highlightranges/main.cpp new file mode 100644 index 0000000..f77ce15 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/highlightranges.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/PetsModel.qml b/examples/declarative/modelviews/listview/highlightranges/qml/content/PetsModel.qml new file mode 100644 index 0000000..5220763 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/PetsModel.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + ListElement { + name: "Polly" + type: "Parrot" + age: 12 + size: "Small" + } + ListElement { + name: "Penny" + type: "Turtle" + age: 4 + size: "Small" + } + ListElement { + name: "Warren" + type: "Rabbit" + age: 2 + size: "Small" + } + ListElement { + name: "Spot" + type: "Dog" + age: 9 + size: "Medium" + } + ListElement { + name: "Schrödinger" + type: "Cat" + age: 2 + size: "Medium" + } + ListElement { + name: "Joey" + type: "Kangaroo" + age: 1 + size: "Medium" + } + ListElement { + name: "Kimba" + type: "Bunny" + age: 65 + size: "Large" + } + ListElement { + name: "Rover" + type: "Dog" + age: 5 + size: "Large" + } + ListElement { + name: "Tiny" + type: "Elephant" + age: 15 + size: "Large" + } +} diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/PressAndHoldButton.qml b/examples/declarative/modelviews/listview/highlightranges/qml/content/PressAndHoldButton.qml new file mode 100644 index 0000000..d6808a4 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/PressAndHoldButton.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: container + + property int repeatDelay: 300 + property int repeatDuration: 75 + property bool pressed: false + + signal clicked + + scale: pressed ? 0.9 : 1 + + function release() { + autoRepeatClicks.stop() + container.pressed = false + } + + SequentialAnimation on pressed { + id: autoRepeatClicks + running: false + + PropertyAction { target: container; property: "pressed"; value: true } + ScriptAction { script: container.clicked() } + PauseAnimation { duration: repeatDelay } + + SequentialAnimation { + loops: Animation.Infinite + ScriptAction { script: container.clicked() } + PauseAnimation { duration: repeatDuration } + } + } + + MouseArea { + anchors.fill: parent + + onPressed: autoRepeatClicks.start() + onReleased: container.release() + onCanceled: container.release() + } +} + diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/RecipesModel.qml b/examples/declarative/modelviews/listview/highlightranges/qml/content/RecipesModel.qml new file mode 100644 index 0000000..6056b90 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/RecipesModel.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + ListElement { + title: "Pancakes" + picture: "content/pics/pancakes.jpg" + ingredients: "<html> + <ul> + <li> 1 cup (150g) self-raising flour + <li> 1 tbs caster sugar + <li> 3/4 cup (185ml) milk + <li> 1 egg + </ul> + </html>" + method: "<html> + <ol> + <li> Sift flour and sugar together into a bowl. Add a pinch of salt. + <li> Beat milk and egg together, then add to dry ingredients. Beat until smooth. + <li> Pour mixture into a pan on medium heat and cook until bubbles appear on the surface. + <li> Turn over and cook other side until golden. + </ol> + </html>" + } + ListElement { + title: "Fruit Salad" + picture: "content/pics/fruit-salad.jpg" + ingredients: "* Seasonal Fruit" + method: "* Chop fruit and place in a bowl." + } + ListElement { + title: "Vegetable Soup" + picture: "content/pics/vegetable-soup.jpg" + ingredients: "<html> + <ul> + <li> 1 onion + <li> 1 turnip + <li> 1 potato + <li> 1 carrot + <li> 1 head of celery + <li> 1 1/2 litres of water + </ul> + </html>" + method: "<html> + <ol> + <li> Chop vegetables. + <li> Boil in water until vegetables soften. + <li> Season with salt and pepper to taste. + </ol> + </html>" + } + ListElement { + title: "Hamburger" + picture: "content/pics/hamburger.jpg" + ingredients: "<html> + <ul> + <li> 500g minced beef + <li> Seasoning + <li> lettuce, tomato, onion, cheese + <li> 1 hamburger bun for each burger + </ul> + </html>" + method: "<html> + <ol> + <li> Mix the beef, together with seasoning, in a food processor. + <li> Shape the beef into burgers. + <li> Grill the burgers for about 5 mins on each side (until cooked through) + <li> Serve each burger on a bun with ketchup, cheese, lettuce, tomato and onion. + </ol> + </html>" + } + ListElement { + title: "Lemonade" + picture: "content/pics/lemonade.jpg" + ingredients: "<html> + <ul> + <li> 1 cup Lemon Juice + <li> 1 cup Sugar + <li> 6 Cups of Water (2 cups warm water, 4 cups cold water) + </ul> + </html>" + method: "<html> + <ol> + <li> Pour 2 cups of warm water into a pitcher and stir in sugar until it dissolves. + <li> Pour in lemon juice, stir again, and add 4 cups of cold water. + <li> Chill or serve over ice cubes. + </ol> + </html>" + } +} diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/TextButton.qml b/examples/declarative/modelviews/listview/highlightranges/qml/content/TextButton.qml new file mode 100644 index 0000000..f26d775 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/TextButton.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: container + + property alias text: label.text + + signal clicked + + width: label.width + 20; height: label.height + 6 + smooth: true + radius: 10 + + gradient: Gradient { + GradientStop { id: gradientStop; position: 0.0; color: palette.light } + GradientStop { position: 1.0; color: palette.button } + } + + SystemPalette { id: palette } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { container.clicked() } + } + + Text { + id: label + anchors.centerIn: parent + } + + states: State { + name: "pressed" + when: mouseArea.pressed + PropertyChanges { target: gradientStop; color: palette.dark } + } +} + diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/arrow-down.png b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/arrow-down.png Binary files differnew file mode 100644 index 0000000..29d1d44 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/arrow-down.png diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/arrow-up.png b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/arrow-up.png Binary files differnew file mode 100644 index 0000000..e437312 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/arrow-up.png diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/fruit-salad.jpg b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/fruit-salad.jpg Binary files differnew file mode 100644 index 0000000..da5a6b1 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/fruit-salad.jpg diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/hamburger.jpg b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/hamburger.jpg Binary files differnew file mode 100644 index 0000000..d0a15be --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/hamburger.jpg diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/lemonade.jpg b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/lemonade.jpg Binary files differnew file mode 100644 index 0000000..db445c9 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/lemonade.jpg diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/list-delete.png b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/list-delete.png Binary files differnew file mode 100644 index 0000000..df2a147 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/list-delete.png diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/minus-sign.png b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/minus-sign.png Binary files differnew file mode 100644 index 0000000..d6f233d --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/minus-sign.png diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/moreDown.png b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/moreDown.png Binary files differnew file mode 100644 index 0000000..31a35d5 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/moreDown.png diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/moreUp.png b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/moreUp.png Binary files differnew file mode 100644 index 0000000..fefb9c9 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/moreUp.png diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/pancakes.jpg b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/pancakes.jpg Binary files differnew file mode 100644 index 0000000..60c4396 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/pancakes.jpg diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/plus-sign.png b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/plus-sign.png Binary files differnew file mode 100644 index 0000000..40df113 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/plus-sign.png diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/vegetable-soup.jpg b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/vegetable-soup.jpg Binary files differnew file mode 100644 index 0000000..9dce332 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/content/pics/vegetable-soup.jpg diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/dynamiclist.qml b/examples/declarative/modelviews/listview/highlightranges/qml/dynamiclist.qml new file mode 100644 index 0000000..f25f0fa --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/dynamiclist.qml @@ -0,0 +1,203 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 1.0 +import "content" + +// This example shows how items can be dynamically added to and removed from +// a ListModel, and how these list modifications can be animated. + +Rectangle { + id: container + width: 500; height: 400 + color: "#343434" + + // The model: + ListModel { + id: fruitModel + + ListElement { + name: "Apple"; cost: 2.45 + attributes: [ + ListElement { description: "Core" }, + ListElement { description: "Deciduous" } + ] + } + ListElement { + name: "Banana"; cost: 1.95 + attributes: [ + ListElement { description: "Tropical" }, + ListElement { description: "Seedless" } + ] + } + ListElement { + name: "Cumquat"; cost: 3.25 + attributes: [ + ListElement { description: "Citrus" } + ] + } + ListElement { + name: "Durian"; cost: 9.95 + attributes: [ + ListElement { description: "Tropical" }, + ListElement { description: "Smelly" } + ] + } + } + + // The delegate for each fruit in the model: + Component { + id: listDelegate + + Item { + id: delegateItem + width: listView.width; height: 55 + clip: true + + Row { + anchors.verticalCenter: parent.verticalCenter + spacing: 10 + + Column { + Image { + source: "content/pics/arrow-up.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index-1, 1) } + } + Image { source: "content/pics/arrow-down.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index+1, 1) } + } + } + + Column { + anchors.verticalCenter: parent.verticalCenter + + Text { + text: name + font.pixelSize: 15 + color: "white" + } + Row { + spacing: 5 + Repeater { + model: attributes + Text { text: description; color: "White" } + } + } + } + } + + Row { + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + spacing: 10 + + PressAndHoldButton { + anchors.verticalCenter: parent.verticalCenter + source: "content/pics/plus-sign.png" + onClicked: fruitModel.setProperty(index, "cost", cost + 0.25) + } + + Text { + id: costText + anchors.verticalCenter: parent.verticalCenter + text: '$' + Number(cost).toFixed(2) + font.pixelSize: 15 + color: "white" + font.bold: true + } + + PressAndHoldButton { + anchors.verticalCenter: parent.verticalCenter + source: "content/pics/minus-sign.png" + onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25)) + } + + Image { + source: "content/pics/list-delete.png" + MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) } + } + } + + // Animate adding and removing of items: + + ListView.onAdd: SequentialAnimation { + PropertyAction { target: delegateItem; property: "height"; value: 0 } + NumberAnimation { target: delegateItem; property: "height"; to: 55; duration: 250; easing.type: Easing.InOutQuad } + } + + ListView.onRemove: SequentialAnimation { + PropertyAction { target: delegateItem; property: "ListView.delayRemove"; value: true } + NumberAnimation { target: delegateItem; property: "height"; to: 0; duration: 250; easing.type: Easing.InOutQuad } + + // Make sure delayRemove is set back to false so that the item can be destroyed + PropertyAction { target: delegateItem; property: "ListView.delayRemove"; value: false } + } + } + } + + // The view: + ListView { + id: listView + anchors.fill: parent; anchors.margins: 20 + model: fruitModel + delegate: listDelegate + } + + Row { + anchors { left: parent.left; bottom: parent.bottom; margins: 20 } + spacing: 10 + + TextButton { + text: "Add an item" + onClicked: { + fruitModel.append({ + "name": "Pizza Margarita", + "cost": 5.95, + "attributes": [{"description": "Cheese"}, {"description": "Tomato"}] + }) + } + } + + TextButton { + text: "Remove all items" + onClicked: fruitModel.clear() + } + } +} + diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/expandingdelegates.qml b/examples/declarative/modelviews/listview/highlightranges/qml/expandingdelegates.qml new file mode 100644 index 0000000..bd3d3a9 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/expandingdelegates.qml @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +// This example illustrates expanding a list item to show a more detailed view. + +Rectangle { + id: page + width: 400; height: 240 + color: "black" + + // Delegate for the recipes. This delegate has two modes: + // 1. List mode (default), which just shows the picture and title of the recipe. + // 2. Details mode, which also shows the ingredients and method. + Component { + id: recipeDelegate + + Item { + id: recipe + + // Create a property to contain the visibility of the details. + // We can bind multiple element's opacity to this one property, + // rather than having a "PropertyChanges" line for each element we + // want to fade. + property real detailsOpacity : 0 + + width: listView.width + height: 70 + + // A simple rounded rectangle for the background + Rectangle { + id: background + x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2 + color: "ivory" + border.color: "orange" + radius: 5 + } + + // This mouse region covers the entire delegate. + // When clicked it changes mode to 'Details'. If we are already + // in Details mode, then no change will happen. + MouseArea { + anchors.fill: parent + onClicked: recipe.state = 'Details'; + } + + // Lay out the page: picture, title and ingredients at the top, and method at the + // bottom. Note that elements that should not be visible in the list + // mode have their opacity set to recipe.detailsOpacity. + Row { + id: topLayout + x: 10; y: 10; height: recipeImage.height; width: parent.width + spacing: 10 + + Image { + id: recipeImage + width: 50; height: 50 + source: picture + } + + Column { + width: background.width - recipeImage.width - 20; height: recipeImage.height + spacing: 5 + + Text { + text: title + font.bold: true; font.pointSize: 16 + } + + Text { + text: "Ingredients" + font.pointSize: 12; font.bold: true + opacity: recipe.detailsOpacity + } + + Text { + text: ingredients + wrapMode: Text.WordWrap + width: parent.width + opacity: recipe.detailsOpacity + } + } + } + + Item { + id: details + x: 10; width: parent.width - 20 + anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 } + opacity: recipe.detailsOpacity + + Text { + id: methodTitle + anchors.top: parent.top + text: "Method" + font.pointSize: 12; font.bold: true + } + + Flickable { + id: flick + width: parent.width + anchors { top: methodTitle.bottom; bottom: parent.bottom } + contentHeight: methodText.height + clip: true + + Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width } + } + + Image { + anchors { right: flick.right; top: flick.top } + source: "content/pics/moreUp.png" + opacity: flick.atYBeginning ? 0 : 1 + } + + Image { + anchors { right: flick.right; bottom: flick.bottom } + source: "content/pics/moreDown.png" + opacity: flick.atYEnd ? 0 : 1 + } + } + + // A button to close the detailed view, i.e. set the state back to default (''). + TextButton { + y: 10 + anchors { right: background.right; rightMargin: 10 } + opacity: recipe.detailsOpacity + text: "Close" + + onClicked: recipe.state = ''; + } + + states: State { + name: "Details" + + PropertyChanges { target: background; color: "white" } + PropertyChanges { target: recipeImage; width: 130; height: 130 } // Make picture bigger + PropertyChanges { target: recipe; detailsOpacity: 1; x: 0 } // Make details visible + PropertyChanges { target: recipe; height: listView.height } // Fill the entire list area with the detailed view + + // Move the list so that this item is at the top. + PropertyChanges { target: recipe.ListView.view; explicit: true; contentY: recipe.y } + + // Disallow flicking while we're in detailed view + PropertyChanges { target: recipe.ListView.view; interactive: false } + } + + transitions: Transition { + // Make the state changes smooth + ParallelAnimation { + ColorAnimation { property: "color"; duration: 500 } + NumberAnimation { duration: 300; properties: "detailsOpacity,x,contentY,height,width" } + } + } + } + } + + // The actual list + ListView { + id: listView + anchors.fill: parent + model: RecipesModel {} + delegate: recipeDelegate + } +} diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/highlight.qml b/examples/declarative/modelviews/listview/highlightranges/qml/highlight.qml new file mode 100644 index 0000000..249c73b --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/highlight.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example shows how to create your own highlight delegate for a ListView +// that uses a SpringAnimation to provide custom movement when the +// highlight bar is moved between items. + +import QtQuick 1.0 +import "content" + +Rectangle { + width: 200; height: 300 + + // Define a delegate component. A component will be + // instantiated for each visible item in the list. + Component { + id: petDelegate + Item { + id: wrapper + width: 200; height: 55 + Column { + Text { text: 'Name: ' + name } + Text { text: 'Type: ' + type } + Text { text: 'Age: ' + age } + } + // indent the item if it is the current item + states: State { + name: "Current" + when: wrapper.ListView.isCurrentItem + PropertyChanges { target: wrapper; x: 20 } + } + transitions: Transition { + NumberAnimation { properties: "x"; duration: 200 } + } + } + } + + // Define a highlight with customised movement between items. + Component { + id: highlightBar + Rectangle { + width: 200; height: 50 + color: "#FFFF88" + y: listView.currentItem.y; + Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } } + } + } + + ListView { + id: listView + width: 200; height: parent.height + + model: PetsModel {} + delegate: petDelegate + focus: true + + // Set the highlight delegate. Note we must also set highlightFollowsCurrentItem + // to false so the highlight delegate can control how the highlight is moved. + highlight: highlightBar + highlightFollowsCurrentItem: false + } +} diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/highlightranges.qml b/examples/declarative/modelviews/listview/highlightranges/qml/highlightranges.qml new file mode 100644 index 0000000..58d37a3 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/highlightranges.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: root + property int current: 0 + width: 600; height: 300 + + // This example shows the same model in three different ListView items, + // with different highlight ranges. The highlight ranges are set by the + // preferredHighlightBegin and preferredHighlightEnd properties in ListView. + // + // The first ListView does not set a highlight range, so its currentItem + // can move freely within the visible area. If it moves outside the + // visible area, the view is automatically scrolled to keep the current + // item visible. + // + // The second ListView sets a highlight range which attempts to keep the + // current item within the the bounds of the range. However, + // items will not scroll beyond the beginning or end of the view, + // forcing the highlight to move outside the range at the ends. + // + // The third ListView sets the highlightRangeMode to StrictlyEnforceRange + // and sets a range smaller than the height of an item. This + // forces the current item to change when the view is flicked, + // since the highlight is unable to move. + // + // All ListViews bind their currentIndex to the root.current property. + // The first ListView sets root.current whenever its currentIndex changes + // due to keyboard interaction. + // Flicking the third ListView with the mouse also changes root.current. + + ListView { + id: list1 + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "lightsteelblue" } + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex + focus: true + } + + ListView { + id: list2 + x: list1.width + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "yellow" } + currentIndex: root.current + preferredHighlightBegin: 80; preferredHighlightEnd: 220 + highlightRangeMode: ListView.ApplyRange + } + + ListView { + id: list3 + x: list1.width + list2.width + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "yellow" } + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex + preferredHighlightBegin: 125; preferredHighlightEnd: 125 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + // The delegate for each list + Component { + id: petDelegate + Column { + width: 200 + Text { text: 'Name: ' + name } + Text { text: 'Type: ' + type } + Text { text: 'Age: ' + age } + } + } +} diff --git a/examples/declarative/modelviews/listview/highlightranges/qml/listview.qmlproject b/examples/declarative/modelviews/listview/highlightranges/qml/listview.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/listview.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/listview/highlightranges/qml/sections.qml b/examples/declarative/modelviews/listview/highlightranges/qml/sections.qml new file mode 100644 index 0000000..3248899 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qml/sections.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example shows how a ListView can be separated into sections using +// the ListView.section attached property. + +import QtQuick 1.0 + +//! [0] +Rectangle { + id: container + width: 200 + height: 250 + + ListModel { + id: animalsModel + ListElement { name: "Parrot"; size: "Small" } + ListElement { name: "Guinea pig"; size: "Small" } + ListElement { name: "Dog"; size: "Medium" } + ListElement { name: "Cat"; size: "Medium" } + ListElement { name: "Elephant"; size: "Large" } + } + + // The delegate for each section header + Component { + id: sectionHeading + Rectangle { + width: container.width + height: childrenRect.height + color: "lightsteelblue" + + Text { + text: section + font.bold: true + } + } + } + + ListView { + anchors.fill: parent + model: animalsModel + delegate: Text { text: name } + + section.property: "size" + section.criteria: ViewSection.FullString + section.delegate: sectionHeading + } +} +//! [0] + diff --git a/examples/declarative/modelviews/listview/highlightranges/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/listview/highlightranges/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/listview/highlightranges/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/listview/highlightranges/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/listview/highlightranges/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/listview/highlightranges/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/listview/highlightranges/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/listview/sections/main.cpp b/examples/declarative/modelviews/listview/sections/main.cpp new file mode 100644 index 0000000..19b2dc8 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); + viewer.setMainQmlFile(QLatin1String("qml/qml/sections.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/listview/sections/qml/content/PetsModel.qml b/examples/declarative/modelviews/listview/sections/qml/content/PetsModel.qml new file mode 100644 index 0000000..5220763 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/PetsModel.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + ListElement { + name: "Polly" + type: "Parrot" + age: 12 + size: "Small" + } + ListElement { + name: "Penny" + type: "Turtle" + age: 4 + size: "Small" + } + ListElement { + name: "Warren" + type: "Rabbit" + age: 2 + size: "Small" + } + ListElement { + name: "Spot" + type: "Dog" + age: 9 + size: "Medium" + } + ListElement { + name: "Schrödinger" + type: "Cat" + age: 2 + size: "Medium" + } + ListElement { + name: "Joey" + type: "Kangaroo" + age: 1 + size: "Medium" + } + ListElement { + name: "Kimba" + type: "Bunny" + age: 65 + size: "Large" + } + ListElement { + name: "Rover" + type: "Dog" + age: 5 + size: "Large" + } + ListElement { + name: "Tiny" + type: "Elephant" + age: 15 + size: "Large" + } +} diff --git a/examples/declarative/modelviews/listview/sections/qml/content/PressAndHoldButton.qml b/examples/declarative/modelviews/listview/sections/qml/content/PressAndHoldButton.qml new file mode 100644 index 0000000..d6808a4 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/PressAndHoldButton.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: container + + property int repeatDelay: 300 + property int repeatDuration: 75 + property bool pressed: false + + signal clicked + + scale: pressed ? 0.9 : 1 + + function release() { + autoRepeatClicks.stop() + container.pressed = false + } + + SequentialAnimation on pressed { + id: autoRepeatClicks + running: false + + PropertyAction { target: container; property: "pressed"; value: true } + ScriptAction { script: container.clicked() } + PauseAnimation { duration: repeatDelay } + + SequentialAnimation { + loops: Animation.Infinite + ScriptAction { script: container.clicked() } + PauseAnimation { duration: repeatDuration } + } + } + + MouseArea { + anchors.fill: parent + + onPressed: autoRepeatClicks.start() + onReleased: container.release() + onCanceled: container.release() + } +} + diff --git a/examples/declarative/modelviews/listview/sections/qml/content/RecipesModel.qml b/examples/declarative/modelviews/listview/sections/qml/content/RecipesModel.qml new file mode 100644 index 0000000..6056b90 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/RecipesModel.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +ListModel { + ListElement { + title: "Pancakes" + picture: "content/pics/pancakes.jpg" + ingredients: "<html> + <ul> + <li> 1 cup (150g) self-raising flour + <li> 1 tbs caster sugar + <li> 3/4 cup (185ml) milk + <li> 1 egg + </ul> + </html>" + method: "<html> + <ol> + <li> Sift flour and sugar together into a bowl. Add a pinch of salt. + <li> Beat milk and egg together, then add to dry ingredients. Beat until smooth. + <li> Pour mixture into a pan on medium heat and cook until bubbles appear on the surface. + <li> Turn over and cook other side until golden. + </ol> + </html>" + } + ListElement { + title: "Fruit Salad" + picture: "content/pics/fruit-salad.jpg" + ingredients: "* Seasonal Fruit" + method: "* Chop fruit and place in a bowl." + } + ListElement { + title: "Vegetable Soup" + picture: "content/pics/vegetable-soup.jpg" + ingredients: "<html> + <ul> + <li> 1 onion + <li> 1 turnip + <li> 1 potato + <li> 1 carrot + <li> 1 head of celery + <li> 1 1/2 litres of water + </ul> + </html>" + method: "<html> + <ol> + <li> Chop vegetables. + <li> Boil in water until vegetables soften. + <li> Season with salt and pepper to taste. + </ol> + </html>" + } + ListElement { + title: "Hamburger" + picture: "content/pics/hamburger.jpg" + ingredients: "<html> + <ul> + <li> 500g minced beef + <li> Seasoning + <li> lettuce, tomato, onion, cheese + <li> 1 hamburger bun for each burger + </ul> + </html>" + method: "<html> + <ol> + <li> Mix the beef, together with seasoning, in a food processor. + <li> Shape the beef into burgers. + <li> Grill the burgers for about 5 mins on each side (until cooked through) + <li> Serve each burger on a bun with ketchup, cheese, lettuce, tomato and onion. + </ol> + </html>" + } + ListElement { + title: "Lemonade" + picture: "content/pics/lemonade.jpg" + ingredients: "<html> + <ul> + <li> 1 cup Lemon Juice + <li> 1 cup Sugar + <li> 6 Cups of Water (2 cups warm water, 4 cups cold water) + </ul> + </html>" + method: "<html> + <ol> + <li> Pour 2 cups of warm water into a pitcher and stir in sugar until it dissolves. + <li> Pour in lemon juice, stir again, and add 4 cups of cold water. + <li> Chill or serve over ice cubes. + </ol> + </html>" + } +} diff --git a/examples/declarative/modelviews/listview/sections/qml/content/TextButton.qml b/examples/declarative/modelviews/listview/sections/qml/content/TextButton.qml new file mode 100644 index 0000000..f26d775 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/TextButton.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: container + + property alias text: label.text + + signal clicked + + width: label.width + 20; height: label.height + 6 + smooth: true + radius: 10 + + gradient: Gradient { + GradientStop { id: gradientStop; position: 0.0; color: palette.light } + GradientStop { position: 1.0; color: palette.button } + } + + SystemPalette { id: palette } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { container.clicked() } + } + + Text { + id: label + anchors.centerIn: parent + } + + states: State { + name: "pressed" + when: mouseArea.pressed + PropertyChanges { target: gradientStop; color: palette.dark } + } +} + diff --git a/examples/declarative/modelviews/listview/sections/qml/content/pics/arrow-down.png b/examples/declarative/modelviews/listview/sections/qml/content/pics/arrow-down.png Binary files differnew file mode 100644 index 0000000..29d1d44 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/pics/arrow-down.png diff --git a/examples/declarative/modelviews/listview/sections/qml/content/pics/arrow-up.png b/examples/declarative/modelviews/listview/sections/qml/content/pics/arrow-up.png Binary files differnew file mode 100644 index 0000000..e437312 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/pics/arrow-up.png diff --git a/examples/declarative/modelviews/listview/sections/qml/content/pics/fruit-salad.jpg b/examples/declarative/modelviews/listview/sections/qml/content/pics/fruit-salad.jpg Binary files differnew file mode 100644 index 0000000..da5a6b1 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/pics/fruit-salad.jpg diff --git a/examples/declarative/modelviews/listview/sections/qml/content/pics/hamburger.jpg b/examples/declarative/modelviews/listview/sections/qml/content/pics/hamburger.jpg Binary files differnew file mode 100644 index 0000000..d0a15be --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/pics/hamburger.jpg diff --git a/examples/declarative/modelviews/listview/sections/qml/content/pics/lemonade.jpg b/examples/declarative/modelviews/listview/sections/qml/content/pics/lemonade.jpg Binary files differnew file mode 100644 index 0000000..db445c9 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/pics/lemonade.jpg diff --git a/examples/declarative/modelviews/listview/sections/qml/content/pics/list-delete.png b/examples/declarative/modelviews/listview/sections/qml/content/pics/list-delete.png Binary files differnew file mode 100644 index 0000000..df2a147 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/pics/list-delete.png diff --git a/examples/declarative/modelviews/listview/sections/qml/content/pics/minus-sign.png b/examples/declarative/modelviews/listview/sections/qml/content/pics/minus-sign.png Binary files differnew file mode 100644 index 0000000..d6f233d --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/pics/minus-sign.png diff --git a/examples/declarative/modelviews/listview/sections/qml/content/pics/moreDown.png b/examples/declarative/modelviews/listview/sections/qml/content/pics/moreDown.png Binary files differnew file mode 100644 index 0000000..31a35d5 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/pics/moreDown.png diff --git a/examples/declarative/modelviews/listview/sections/qml/content/pics/moreUp.png b/examples/declarative/modelviews/listview/sections/qml/content/pics/moreUp.png Binary files differnew file mode 100644 index 0000000..fefb9c9 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/pics/moreUp.png diff --git a/examples/declarative/modelviews/listview/sections/qml/content/pics/pancakes.jpg b/examples/declarative/modelviews/listview/sections/qml/content/pics/pancakes.jpg Binary files differnew file mode 100644 index 0000000..60c4396 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/pics/pancakes.jpg diff --git a/examples/declarative/modelviews/listview/sections/qml/content/pics/plus-sign.png b/examples/declarative/modelviews/listview/sections/qml/content/pics/plus-sign.png Binary files differnew file mode 100644 index 0000000..40df113 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/pics/plus-sign.png diff --git a/examples/declarative/modelviews/listview/sections/qml/content/pics/vegetable-soup.jpg b/examples/declarative/modelviews/listview/sections/qml/content/pics/vegetable-soup.jpg Binary files differnew file mode 100644 index 0000000..9dce332 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/content/pics/vegetable-soup.jpg diff --git a/examples/declarative/modelviews/listview/sections/qml/dynamiclist.qml b/examples/declarative/modelviews/listview/sections/qml/dynamiclist.qml new file mode 100644 index 0000000..f25f0fa --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/dynamiclist.qml @@ -0,0 +1,203 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 1.0 +import "content" + +// This example shows how items can be dynamically added to and removed from +// a ListModel, and how these list modifications can be animated. + +Rectangle { + id: container + width: 500; height: 400 + color: "#343434" + + // The model: + ListModel { + id: fruitModel + + ListElement { + name: "Apple"; cost: 2.45 + attributes: [ + ListElement { description: "Core" }, + ListElement { description: "Deciduous" } + ] + } + ListElement { + name: "Banana"; cost: 1.95 + attributes: [ + ListElement { description: "Tropical" }, + ListElement { description: "Seedless" } + ] + } + ListElement { + name: "Cumquat"; cost: 3.25 + attributes: [ + ListElement { description: "Citrus" } + ] + } + ListElement { + name: "Durian"; cost: 9.95 + attributes: [ + ListElement { description: "Tropical" }, + ListElement { description: "Smelly" } + ] + } + } + + // The delegate for each fruit in the model: + Component { + id: listDelegate + + Item { + id: delegateItem + width: listView.width; height: 55 + clip: true + + Row { + anchors.verticalCenter: parent.verticalCenter + spacing: 10 + + Column { + Image { + source: "content/pics/arrow-up.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index-1, 1) } + } + Image { source: "content/pics/arrow-down.png" + MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index+1, 1) } + } + } + + Column { + anchors.verticalCenter: parent.verticalCenter + + Text { + text: name + font.pixelSize: 15 + color: "white" + } + Row { + spacing: 5 + Repeater { + model: attributes + Text { text: description; color: "White" } + } + } + } + } + + Row { + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + spacing: 10 + + PressAndHoldButton { + anchors.verticalCenter: parent.verticalCenter + source: "content/pics/plus-sign.png" + onClicked: fruitModel.setProperty(index, "cost", cost + 0.25) + } + + Text { + id: costText + anchors.verticalCenter: parent.verticalCenter + text: '$' + Number(cost).toFixed(2) + font.pixelSize: 15 + color: "white" + font.bold: true + } + + PressAndHoldButton { + anchors.verticalCenter: parent.verticalCenter + source: "content/pics/minus-sign.png" + onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25)) + } + + Image { + source: "content/pics/list-delete.png" + MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) } + } + } + + // Animate adding and removing of items: + + ListView.onAdd: SequentialAnimation { + PropertyAction { target: delegateItem; property: "height"; value: 0 } + NumberAnimation { target: delegateItem; property: "height"; to: 55; duration: 250; easing.type: Easing.InOutQuad } + } + + ListView.onRemove: SequentialAnimation { + PropertyAction { target: delegateItem; property: "ListView.delayRemove"; value: true } + NumberAnimation { target: delegateItem; property: "height"; to: 0; duration: 250; easing.type: Easing.InOutQuad } + + // Make sure delayRemove is set back to false so that the item can be destroyed + PropertyAction { target: delegateItem; property: "ListView.delayRemove"; value: false } + } + } + } + + // The view: + ListView { + id: listView + anchors.fill: parent; anchors.margins: 20 + model: fruitModel + delegate: listDelegate + } + + Row { + anchors { left: parent.left; bottom: parent.bottom; margins: 20 } + spacing: 10 + + TextButton { + text: "Add an item" + onClicked: { + fruitModel.append({ + "name": "Pizza Margarita", + "cost": 5.95, + "attributes": [{"description": "Cheese"}, {"description": "Tomato"}] + }) + } + } + + TextButton { + text: "Remove all items" + onClicked: fruitModel.clear() + } + } +} + diff --git a/examples/declarative/modelviews/listview/sections/qml/expandingdelegates.qml b/examples/declarative/modelviews/listview/sections/qml/expandingdelegates.qml new file mode 100644 index 0000000..bd3d3a9 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/expandingdelegates.qml @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +// This example illustrates expanding a list item to show a more detailed view. + +Rectangle { + id: page + width: 400; height: 240 + color: "black" + + // Delegate for the recipes. This delegate has two modes: + // 1. List mode (default), which just shows the picture and title of the recipe. + // 2. Details mode, which also shows the ingredients and method. + Component { + id: recipeDelegate + + Item { + id: recipe + + // Create a property to contain the visibility of the details. + // We can bind multiple element's opacity to this one property, + // rather than having a "PropertyChanges" line for each element we + // want to fade. + property real detailsOpacity : 0 + + width: listView.width + height: 70 + + // A simple rounded rectangle for the background + Rectangle { + id: background + x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2 + color: "ivory" + border.color: "orange" + radius: 5 + } + + // This mouse region covers the entire delegate. + // When clicked it changes mode to 'Details'. If we are already + // in Details mode, then no change will happen. + MouseArea { + anchors.fill: parent + onClicked: recipe.state = 'Details'; + } + + // Lay out the page: picture, title and ingredients at the top, and method at the + // bottom. Note that elements that should not be visible in the list + // mode have their opacity set to recipe.detailsOpacity. + Row { + id: topLayout + x: 10; y: 10; height: recipeImage.height; width: parent.width + spacing: 10 + + Image { + id: recipeImage + width: 50; height: 50 + source: picture + } + + Column { + width: background.width - recipeImage.width - 20; height: recipeImage.height + spacing: 5 + + Text { + text: title + font.bold: true; font.pointSize: 16 + } + + Text { + text: "Ingredients" + font.pointSize: 12; font.bold: true + opacity: recipe.detailsOpacity + } + + Text { + text: ingredients + wrapMode: Text.WordWrap + width: parent.width + opacity: recipe.detailsOpacity + } + } + } + + Item { + id: details + x: 10; width: parent.width - 20 + anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 } + opacity: recipe.detailsOpacity + + Text { + id: methodTitle + anchors.top: parent.top + text: "Method" + font.pointSize: 12; font.bold: true + } + + Flickable { + id: flick + width: parent.width + anchors { top: methodTitle.bottom; bottom: parent.bottom } + contentHeight: methodText.height + clip: true + + Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width } + } + + Image { + anchors { right: flick.right; top: flick.top } + source: "content/pics/moreUp.png" + opacity: flick.atYBeginning ? 0 : 1 + } + + Image { + anchors { right: flick.right; bottom: flick.bottom } + source: "content/pics/moreDown.png" + opacity: flick.atYEnd ? 0 : 1 + } + } + + // A button to close the detailed view, i.e. set the state back to default (''). + TextButton { + y: 10 + anchors { right: background.right; rightMargin: 10 } + opacity: recipe.detailsOpacity + text: "Close" + + onClicked: recipe.state = ''; + } + + states: State { + name: "Details" + + PropertyChanges { target: background; color: "white" } + PropertyChanges { target: recipeImage; width: 130; height: 130 } // Make picture bigger + PropertyChanges { target: recipe; detailsOpacity: 1; x: 0 } // Make details visible + PropertyChanges { target: recipe; height: listView.height } // Fill the entire list area with the detailed view + + // Move the list so that this item is at the top. + PropertyChanges { target: recipe.ListView.view; explicit: true; contentY: recipe.y } + + // Disallow flicking while we're in detailed view + PropertyChanges { target: recipe.ListView.view; interactive: false } + } + + transitions: Transition { + // Make the state changes smooth + ParallelAnimation { + ColorAnimation { property: "color"; duration: 500 } + NumberAnimation { duration: 300; properties: "detailsOpacity,x,contentY,height,width" } + } + } + } + } + + // The actual list + ListView { + id: listView + anchors.fill: parent + model: RecipesModel {} + delegate: recipeDelegate + } +} diff --git a/examples/declarative/modelviews/listview/sections/qml/highlight.qml b/examples/declarative/modelviews/listview/sections/qml/highlight.qml new file mode 100644 index 0000000..249c73b --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/highlight.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example shows how to create your own highlight delegate for a ListView +// that uses a SpringAnimation to provide custom movement when the +// highlight bar is moved between items. + +import QtQuick 1.0 +import "content" + +Rectangle { + width: 200; height: 300 + + // Define a delegate component. A component will be + // instantiated for each visible item in the list. + Component { + id: petDelegate + Item { + id: wrapper + width: 200; height: 55 + Column { + Text { text: 'Name: ' + name } + Text { text: 'Type: ' + type } + Text { text: 'Age: ' + age } + } + // indent the item if it is the current item + states: State { + name: "Current" + when: wrapper.ListView.isCurrentItem + PropertyChanges { target: wrapper; x: 20 } + } + transitions: Transition { + NumberAnimation { properties: "x"; duration: 200 } + } + } + } + + // Define a highlight with customised movement between items. + Component { + id: highlightBar + Rectangle { + width: 200; height: 50 + color: "#FFFF88" + y: listView.currentItem.y; + Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } } + } + } + + ListView { + id: listView + width: 200; height: parent.height + + model: PetsModel {} + delegate: petDelegate + focus: true + + // Set the highlight delegate. Note we must also set highlightFollowsCurrentItem + // to false so the highlight delegate can control how the highlight is moved. + highlight: highlightBar + highlightFollowsCurrentItem: false + } +} diff --git a/examples/declarative/modelviews/listview/sections/qml/highlightranges.qml b/examples/declarative/modelviews/listview/sections/qml/highlightranges.qml new file mode 100644 index 0000000..58d37a3 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/highlightranges.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: root + property int current: 0 + width: 600; height: 300 + + // This example shows the same model in three different ListView items, + // with different highlight ranges. The highlight ranges are set by the + // preferredHighlightBegin and preferredHighlightEnd properties in ListView. + // + // The first ListView does not set a highlight range, so its currentItem + // can move freely within the visible area. If it moves outside the + // visible area, the view is automatically scrolled to keep the current + // item visible. + // + // The second ListView sets a highlight range which attempts to keep the + // current item within the the bounds of the range. However, + // items will not scroll beyond the beginning or end of the view, + // forcing the highlight to move outside the range at the ends. + // + // The third ListView sets the highlightRangeMode to StrictlyEnforceRange + // and sets a range smaller than the height of an item. This + // forces the current item to change when the view is flicked, + // since the highlight is unable to move. + // + // All ListViews bind their currentIndex to the root.current property. + // The first ListView sets root.current whenever its currentIndex changes + // due to keyboard interaction. + // Flicking the third ListView with the mouse also changes root.current. + + ListView { + id: list1 + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "lightsteelblue" } + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex + focus: true + } + + ListView { + id: list2 + x: list1.width + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "yellow" } + currentIndex: root.current + preferredHighlightBegin: 80; preferredHighlightEnd: 220 + highlightRangeMode: ListView.ApplyRange + } + + ListView { + id: list3 + x: list1.width + list2.width + width: 200; height: parent.height + model: PetsModel {} + delegate: petDelegate + + highlight: Rectangle { color: "yellow" } + currentIndex: root.current + onCurrentIndexChanged: root.current = currentIndex + preferredHighlightBegin: 125; preferredHighlightEnd: 125 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + // The delegate for each list + Component { + id: petDelegate + Column { + width: 200 + Text { text: 'Name: ' + name } + Text { text: 'Type: ' + type } + Text { text: 'Age: ' + age } + } + } +} diff --git a/examples/declarative/modelviews/listview/sections/qml/listview.qmlproject b/examples/declarative/modelviews/listview/sections/qml/listview.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/listview.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/listview/sections/qml/sections.qml b/examples/declarative/modelviews/listview/sections/qml/sections.qml new file mode 100644 index 0000000..3248899 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qml/sections.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example shows how a ListView can be separated into sections using +// the ListView.section attached property. + +import QtQuick 1.0 + +//! [0] +Rectangle { + id: container + width: 200 + height: 250 + + ListModel { + id: animalsModel + ListElement { name: "Parrot"; size: "Small" } + ListElement { name: "Guinea pig"; size: "Small" } + ListElement { name: "Dog"; size: "Medium" } + ListElement { name: "Cat"; size: "Medium" } + ListElement { name: "Elephant"; size: "Large" } + } + + // The delegate for each section header + Component { + id: sectionHeading + Rectangle { + width: container.width + height: childrenRect.height + color: "lightsteelblue" + + Text { + text: section + font.bold: true + } + } + } + + ListView { + anchors.fill: parent + model: animalsModel + delegate: Text { text: name } + + section.property: "size" + section.criteria: ViewSection.FullString + section.delegate: sectionHeading + } +} +//! [0] + diff --git a/examples/declarative/modelviews/listview/sections/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/listview/sections/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/listview/sections/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/listview/sections/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/listview/sections/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/listview/sections/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/listview/sections/sections.desktop b/examples/declarative/modelviews/listview/sections/sections.desktop new file mode 100644 index 0000000..c11801e --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/sections.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=sections +Exec=/opt/usr/bin/sections +Icon=sections +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/listview/sections/sections.png b/examples/declarative/modelviews/listview/sections/sections.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/sections.png diff --git a/examples/declarative/modelviews/listview/sections/sections.pro b/examples/declarative/modelviews/listview/sections/sections.pro new file mode 100644 index 0000000..17e04f4 --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/sections.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEA0874F7 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/listview/sections/sections.svg b/examples/declarative/modelviews/listview/sections/sections.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/listview/sections/sections.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/pathview-example/main.cpp b/examples/declarative/modelviews/pathview-example/main.cpp new file mode 100644 index 0000000..15585ab --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/pathview-example.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/pathview-example/pathviewexample.desktop b/examples/declarative/modelviews/pathview-example/pathviewexample.desktop new file mode 100644 index 0000000..30d29e3 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/pathviewexample.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=pathview-example +Exec=/opt/usr/bin/pathview-example +Icon=pathview-example +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/pathview-example/pathviewexample.png b/examples/declarative/modelviews/pathview-example/pathviewexample.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/pathviewexample.png diff --git a/examples/declarative/modelviews/pathview-example/pathviewexample.pro b/examples/declarative/modelviews/pathview-example/pathviewexample.pro new file mode 100644 index 0000000..60a62ad --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/pathviewexample.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE51EA833 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/pathview-example/pathviewexample.svg b/examples/declarative/modelviews/pathview-example/pathviewexample.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/pathviewexample.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/pathview-example/qml/pathview-example.qml b/examples/declarative/modelviews/pathview-example/qml/pathview-example.qml new file mode 100644 index 0000000..267c57c --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qml/pathview-example.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 400; height: 240 + color: "white" + + ListModel { + id: appModel + ListElement { name: "Music"; icon: "pics/AudioPlayer_48.png" } + ListElement { name: "Movies"; icon: "pics/VideoPlayer_48.png" } + ListElement { name: "Camera"; icon: "pics/Camera_48.png" } + ListElement { name: "Calendar"; icon: "pics/DateBook_48.png" } + ListElement { name: "Messaging"; icon: "pics/EMail_48.png" } + ListElement { name: "Todo List"; icon: "pics/TodoList_48.png" } + ListElement { name: "Contacts"; icon: "pics/AddressBook_48.png" } + } + + Component { + id: appDelegate + Item { + width: 100; height: 100 + scale: PathView.iconScale + + Image { + id: myIcon + y: 20; anchors.horizontalCenter: parent.horizontalCenter + source: icon + smooth: true + } + Text { + anchors { top: myIcon.bottom; horizontalCenter: parent.horizontalCenter } + text: name + smooth: true + } + + MouseArea { + anchors.fill: parent + onClicked: view.currentIndex = index + } + } + } + + Component { + id: appHighlight + Rectangle { width: 80; height: 80; color: "lightsteelblue" } + } + + PathView { + Keys.onRightPressed: if (!moving) { incrementCurrentIndex(); console.log(moving) } + Keys.onLeftPressed: if (!moving) decrementCurrentIndex() + id: view + anchors.fill: parent + highlight: appHighlight + preferredHighlightBegin: 0.5 + preferredHighlightEnd: 0.5 + focus: true + model: appModel + delegate: appDelegate + path: Path { + startX: 10 + startY: 50 + PathAttribute { name: "iconScale"; value: 0.5 } + PathQuad { x: 200; y: 150; controlX: 50; controlY: 200 } + PathAttribute { name: "iconScale"; value: 1.0 } + PathQuad { x: 390; y: 50; controlX: 350; controlY: 200 } + PathAttribute { name: "iconScale"; value: 0.5 } + } + } +} diff --git a/examples/declarative/modelviews/pathview-example/qml/pathview.qmlproject b/examples/declarative/modelviews/pathview-example/qml/pathview.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qml/pathview.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/pathview-example/qml/pics/AddressBook_48.png b/examples/declarative/modelviews/pathview-example/qml/pics/AddressBook_48.png Binary files differnew file mode 100644 index 0000000..1ab7c8e --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qml/pics/AddressBook_48.png diff --git a/examples/declarative/modelviews/pathview-example/qml/pics/AudioPlayer_48.png b/examples/declarative/modelviews/pathview-example/qml/pics/AudioPlayer_48.png Binary files differnew file mode 100644 index 0000000..f4b8689 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qml/pics/AudioPlayer_48.png diff --git a/examples/declarative/modelviews/pathview-example/qml/pics/Camera_48.png b/examples/declarative/modelviews/pathview-example/qml/pics/Camera_48.png Binary files differnew file mode 100644 index 0000000..c76b524 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qml/pics/Camera_48.png diff --git a/examples/declarative/modelviews/pathview-example/qml/pics/DateBook_48.png b/examples/declarative/modelviews/pathview-example/qml/pics/DateBook_48.png Binary files differnew file mode 100644 index 0000000..58f5787 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qml/pics/DateBook_48.png diff --git a/examples/declarative/modelviews/pathview-example/qml/pics/EMail_48.png b/examples/declarative/modelviews/pathview-example/qml/pics/EMail_48.png Binary files differnew file mode 100644 index 0000000..d6d84a6 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qml/pics/EMail_48.png diff --git a/examples/declarative/modelviews/pathview-example/qml/pics/TodoList_48.png b/examples/declarative/modelviews/pathview-example/qml/pics/TodoList_48.png Binary files differnew file mode 100644 index 0000000..0988448 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qml/pics/TodoList_48.png diff --git a/examples/declarative/modelviews/pathview-example/qml/pics/VideoPlayer_48.png b/examples/declarative/modelviews/pathview-example/qml/pics/VideoPlayer_48.png Binary files differnew file mode 100644 index 0000000..52638c5 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qml/pics/VideoPlayer_48.png diff --git a/examples/declarative/modelviews/pathview-example/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/pathview-example/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/pathview-example/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/pathview-example/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/pathview-example/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/pathview-example/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/README b/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/README new file mode 100644 index 0000000..0d82252 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/README @@ -0,0 +1,6 @@ +The Debian Package pathviewexample +---------------------------- + +Comments regarding the Package + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:48:31 +0100 diff --git a/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/changelog b/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/changelog new file mode 100644 index 0000000..ab74121 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/changelog @@ -0,0 +1,5 @@ +pathviewexample (0.0.1) unstable; urgency=low + + * Initial Release. + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:48:31 +0100 diff --git a/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/compat b/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/compat @@ -0,0 +1 @@ +7 diff --git a/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/control b/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/control new file mode 100644 index 0000000..c931a89 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/control @@ -0,0 +1,13 @@ +Source: pathviewexample +Section: user/hidden +Priority: optional +Maintainer: Daniel Molkentin <danimo@unknown> +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: <insert the upstream URL, if relevant> + +Package: pathviewexample +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: <insert up to 60 chars description> + <insert long description, indented with spaces> diff --git a/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/copyright b/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/copyright new file mode 100644 index 0000000..f848d27 --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/copyright @@ -0,0 +1,40 @@ +This package was debianized by Daniel Molkentin <danimo@unknown> on +Thu, 18 Nov 2010 17:48:31 +0100. + +It was downloaded from <url://example.com> + +Upstream Author(s): + + <put author's name and email here> + <likewise for another author> + +Copyright: + + <Copyright (C) YYYY Name OfAuthor> + <likewise for another author> + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2010, Daniel Molkentin <danimo@unknown> and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/rules b/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/rules new file mode 100755 index 0000000..c604e5d --- /dev/null +++ b/examples/declarative/modelviews/pathview-example/qtc_packaging/debian_fremantle/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/pathviewexample.sgml > pathviewexample.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/pathviewexample. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/pathviewexample install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + # dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/examples/declarative/modelviews/visualitemmodel/main.cpp b/examples/declarative/modelviews/visualitemmodel/main.cpp new file mode 100644 index 0000000..6faeec8 --- /dev/null +++ b/examples/declarative/modelviews/visualitemmodel/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/visualitemmodel.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/visualitemmodel/qml/visualitemmodel.qml b/examples/declarative/modelviews/visualitemmodel/qml/visualitemmodel.qml new file mode 100644 index 0000000..15f2f11 --- /dev/null +++ b/examples/declarative/modelviews/visualitemmodel/qml/visualitemmodel.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example demonstrates placing items in a view using +// a VisualItemModel + +import QtQuick 1.0 + +Rectangle { + color: "lightgray" + width: 240 + height: 320 + + VisualItemModel { + id: itemModel + + Rectangle { + width: view.width; height: view.height + color: "#FFFEF0" + Text { text: "Page 1"; font.bold: true; anchors.centerIn: parent } + } + Rectangle { + width: view.width; height: view.height + color: "#F0FFF7" + Text { text: "Page 2"; font.bold: true; anchors.centerIn: parent } + } + Rectangle { + width: view.width; height: view.height + color: "#F4F0FF" + Text { text: "Page 3"; font.bold: true; anchors.centerIn: parent } + } + } + + ListView { + id: view + anchors { fill: parent; bottomMargin: 30 } + model: itemModel + preferredHighlightBegin: 0; preferredHighlightEnd: 0 + highlightRangeMode: ListView.StrictlyEnforceRange + orientation: ListView.Horizontal + snapMode: ListView.SnapOneItem; flickDeceleration: 2000 + } + + Rectangle { + width: 240; height: 30 + anchors { top: view.bottom; bottom: parent.bottom } + color: "gray" + + Row { + anchors.centerIn: parent + spacing: 20 + + Repeater { + model: itemModel.count + + Rectangle { + width: 5; height: 5 + radius: 3 + color: view.currentIndex == index ? "blue" : "white" + + MouseArea { + width: 20; height: 20 + anchors.centerIn: parent + onClicked: view.currentIndex = index + } + } + } + } + } +} diff --git a/examples/declarative/modelviews/visualitemmodel/qml/visualitemmodel.qmlproject b/examples/declarative/modelviews/visualitemmodel/qml/visualitemmodel.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/visualitemmodel/qml/visualitemmodel.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/visualitemmodel/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/visualitemmodel/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/visualitemmodel/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/visualitemmodel/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/visualitemmodel/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/visualitemmodel/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/visualitemmodel/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/visualitemmodel/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/visualitemmodel/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/visualitemmodel/visualitemmodel.desktop b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.desktop new file mode 100644 index 0000000..ae40ec0 --- /dev/null +++ b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=visualitemmodel +Exec=/opt/usr/bin/visualitemmodel +Icon=visualitemmodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/visualitemmodel/visualitemmodel.png b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.png diff --git a/examples/declarative/modelviews/visualitemmodel/visualitemmodel.pro b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.pro new file mode 100644 index 0000000..cf61323 --- /dev/null +++ b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE722A922 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/visualitemmodel/visualitemmodel.svg b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/webview/alerts/alerts.desktop b/examples/declarative/modelviews/webview/alerts/alerts.desktop new file mode 100644 index 0000000..80af9d2 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/alerts.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=alerts +Exec=/opt/usr/bin/alerts +Icon=alerts +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/webview/alerts/alerts.png b/examples/declarative/modelviews/webview/alerts/alerts.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/alerts.png diff --git a/examples/declarative/modelviews/webview/alerts/alerts.pro b/examples/declarative/modelviews/webview/alerts/alerts.pro new file mode 100644 index 0000000..335c3a3 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/alerts.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE14997C0 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/webview/alerts/alerts.svg b/examples/declarative/modelviews/webview/alerts/alerts.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/alerts.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/webview/alerts/main.cpp b/examples/declarative/modelviews/webview/alerts/main.cpp new file mode 100644 index 0000000..efcfb28 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/alerts.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/webview/alerts/qml/alerts.html b/examples/declarative/modelviews/webview/alerts/qml/alerts.html new file mode 100644 index 0000000..82caddf --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qml/alerts.html @@ -0,0 +1,5 @@ +<html> +<body onclick="alert('This is an alert')"> +<p>This is a web page. It fires an alert when clicked. +</body> +</html> diff --git a/examples/declarative/modelviews/webview/alerts/qml/alerts.qml b/examples/declarative/modelviews/webview/alerts/qml/alerts.qml new file mode 100644 index 0000000..4aa4a3b --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qml/alerts.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +WebView { + id: webView + width: 200 + height: 150 + url: "alerts.html" + + onAlert: popup.show(message) + + Rectangle { + id: popup + + color: "red" + border.color: "black"; border.width: 2 + radius: 4 + + y: parent.height // off "screen" + anchors.horizontalCenter: parent.horizontalCenter + width: label.width + 5 + height: label.height + 5 + + opacity: 0 + + function show(text) { + label.text = text + popup.state = "visible" + timer.start() + } + states: State { + name: "visible" + PropertyChanges { target: popup; opacity: 1 } + PropertyChanges { target: popup; y: (webView.height-popup.height)/2 } + } + + transitions: [ + Transition { from: ""; PropertyAnimation { properties: "opacity,y"; duration: 65 } }, + Transition { from: "visible"; PropertyAnimation { properties: "opacity,y"; duration: 500 } } + ] + + Timer { + id: timer + interval: 1000 + + onTriggered: popup.state = "" + } + + Text { + id: label + anchors.centerIn: parent + width: webView.width *0.75 + + color: "white" + font.pixelSize: 20 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + smooth: true + } + } +} diff --git a/examples/declarative/modelviews/webview/alerts/qml/autosize.qml b/examples/declarative/modelviews/webview/alerts/qml/autosize.qml new file mode 100644 index 0000000..7e10403 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qml/autosize.qml @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +// The WebView size is determined by the width, height, +// preferredWidth, and preferredHeight properties. +Rectangle { + id: rect + width: 200 + height: layout.height + + Column { + id: layout + spacing: 2 + + WebView { + html: "No width defined." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + width: rect.width + html: "The width is full." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + width: rect.width/2 + html: "The width is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: rect.width/2 + html: "The_width_is_half." // not wrapped + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + preferredWidth: rect.width/2 + html: "The preferredWidth is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + preferredWidth: rect.width/2 + html: "The_preferredWidth_is_half." // not wrapped + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + } +} diff --git a/examples/declarative/modelviews/webview/alerts/qml/content/Mapping/Map.qml b/examples/declarative/modelviews/webview/alerts/qml/content/Mapping/Map.qml new file mode 100644 index 0000000..9a86579 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qml/content/Mapping/Map.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +Item { + id: page + + property real latitude: -34.397 + property real longitude: 150.644 + property string address: "" + property alias status: js.status + + WebView { + id: map + anchors.fill: parent + url: "map.html" + pressGrabTime: 0 + javaScriptWindowObjects: QtObject { + id: js + WebView.windowObjectName: "qml" + property real lat: page.latitude + property real lng: page.longitude + property string address: page.address + property string status: "Loading" + + onAddressChanged: { + if (map.url != "" && map.progress == 1) + map.evaluateJavaScript("goToAddress()") + } + } + + onLoadFinished: { evaluateJavaScript("goToAddress()"); } + } +} diff --git a/examples/declarative/modelviews/webview/alerts/qml/content/Mapping/map.html b/examples/declarative/modelviews/webview/alerts/qml/content/Mapping/map.html new file mode 100644 index 0000000..a98da54 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qml/content/Mapping/map.html @@ -0,0 +1,60 @@ +<html> +<head> +<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> +<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> +<script type="text/javascript"> + var geocoder + var map + function goToLatLng(latlng,bounds) { + if (map) { + map.setCenter(latlng) + map.fitBounds(bounds) + } else { + var myOptions = { + zoom: 8, + center: latlng, + mapTypeId: google.maps.MapTypeId.ROADMAP + }; + map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); + } + } + function initialize() { + geocoder = new google.maps.Geocoder(); + if (window.qml.address) { + goToAddress() + } else { + goToLatLng(new google.maps.LatLng(window.qml.lat,window.qml.lng)); + } + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(function(position) { + initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); + window.qml.lat = initialLocation.lat; + window.qml.lng = initialLocation.lng; + goToLatLng(initialLocation); + }); + } + } + function goToAddress() { + if (geocoder) { + var req = { + address: window.qml.address, + } + if (map) + req.bounds = map.getBounds() + window.qml.status = "Loading"; + geocoder.geocode(req, function(results, status) { + if (status == google.maps.GeocoderStatus.OK) { + window.qml.status = "Ready"; + goToLatLng(results[0].geometry.location,results[0].geometry.bounds); + } else { + window.qml.status = "Error"; + } + }); + } + } +</script> +</head> +<body onload="initialize()" leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px"> + <div id="map_canvas" style="width:100%; height:100%"></div> +</body> +</html> diff --git a/examples/declarative/modelviews/webview/alerts/qml/content/pics/cancel.png b/examples/declarative/modelviews/webview/alerts/qml/content/pics/cancel.png Binary files differnew file mode 100644 index 0000000..ecc9533 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qml/content/pics/cancel.png diff --git a/examples/declarative/modelviews/webview/alerts/qml/content/pics/ok.png b/examples/declarative/modelviews/webview/alerts/qml/content/pics/ok.png Binary files differnew file mode 100644 index 0000000..5795f04 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qml/content/pics/ok.png diff --git a/examples/declarative/modelviews/webview/alerts/qml/googlemaps.qml b/examples/declarative/modelviews/webview/alerts/qml/googlemaps.qml new file mode 100644 index 0000000..aed0ddd --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qml/googlemaps.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example demonstrates how Web services such as Google Maps can be +// abstracted as QML types. Here we have a "Mapping" module with a "Map" +// type. The Map type has an address property. Setting that property moves +// the map. The underlying implementation uses WebView and the Google Maps +// API, but users from QML don't need to understand the implementation in +// order to create a Map. + +import QtQuick 1.0 +import QtWebKit 1.0 +import "content/Mapping" + +Map { + id: map + width: 300 + height: 300 + address: "Paris" + + Rectangle { + x: 70 + width: input.width + 20 + height: input.height + 4 + anchors.bottom: parent.bottom; anchors.bottomMargin: 5 + radius: 5 + opacity: map.status == "Ready" ? 1 : 0 + + TextInput { + id: input + text: map.address + anchors.centerIn: parent + Keys.onReturnPressed: map.address = input.text + } + } + + Text { + id: loading + anchors.centerIn: parent + text: map.status == "Error" ? "Error" : "Loading" + opacity: map.status == "Ready" ? 0 : 1 + font.pixelSize: 30 + + Behavior on opacity { NumberAnimation{} } + } +} diff --git a/examples/declarative/modelviews/webview/alerts/qml/inlinehtml.qml b/examples/declarative/modelviews/webview/alerts/qml/inlinehtml.qml new file mode 100644 index 0000000..afc1fa9 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qml/inlinehtml.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +// Inline HTML with loose formatting can be +// set on the html property. +WebView { + html:"\ + <body> + <table border=1> + <tr><th><th>One<th>Two<th>Three + <tr><th>1<td>X<td>1<td>X + <tr><th>2<td>0<td>X<td>0 + <tr><th>3<td>X<td>1<td>X + </table>" +} diff --git a/examples/declarative/modelviews/webview/alerts/qml/newwindows.html b/examples/declarative/modelviews/webview/alerts/qml/newwindows.html new file mode 100644 index 0000000..f169599 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qml/newwindows.html @@ -0,0 +1,3 @@ +<h1>Multiple windows...</h1> + +<a target="_blank" href="newwindows.html">Popup!</a> diff --git a/examples/declarative/modelviews/webview/alerts/qml/newwindows.qml b/examples/declarative/modelviews/webview/alerts/qml/newwindows.qml new file mode 100644 index 0000000..52f7a0b --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qml/newwindows.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Demonstrates opening new WebViews from HTML +// +// Note that to open windows from JavaScript, you will need to +// allow it on WebView with settings.javascriptCanOpenWindows: true + +import QtQuick 1.0 +import QtWebKit 1.0 + +Grid { + columns: 3 + id: pages + height: 300; width: 600 + + Component { + id: webViewPage + Rectangle { + width: webView.width + height: webView.height + border.color: "gray" + + WebView { + id: webView + newWindowComponent: webViewPage + newWindowParent: pages + url: "newwindows.html" + } + } + } + + Loader { sourceComponent: webViewPage } +} diff --git a/examples/declarative/modelviews/webview/alerts/qml/webview.qmlproject b/examples/declarative/modelviews/webview/alerts/qml/webview.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qml/webview.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/webview/alerts/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/webview/alerts/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/webview/alerts/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/webview/alerts/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/webview/alerts/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/webview/alerts/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/webview/alerts/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/webview/autosize/autosize.desktop b/examples/declarative/modelviews/webview/autosize/autosize.desktop new file mode 100644 index 0000000..29a81c5 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/autosize.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=autosize +Exec=/opt/usr/bin/autosize +Icon=autosize +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/webview/autosize/autosize.png b/examples/declarative/modelviews/webview/autosize/autosize.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/autosize.png diff --git a/examples/declarative/modelviews/webview/autosize/autosize.pro b/examples/declarative/modelviews/webview/autosize/autosize.pro new file mode 100644 index 0000000..a17f822 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/autosize.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEE6AB317 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/webview/autosize/autosize.svg b/examples/declarative/modelviews/webview/autosize/autosize.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/autosize.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/webview/autosize/main.cpp b/examples/declarative/modelviews/webview/autosize/main.cpp new file mode 100644 index 0000000..8c2e63a --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait); + viewer.setMainQmlFile(QLatin1String("qml/qml/autosize.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/webview/autosize/qml/alerts.html b/examples/declarative/modelviews/webview/autosize/qml/alerts.html new file mode 100644 index 0000000..82caddf --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qml/alerts.html @@ -0,0 +1,5 @@ +<html> +<body onclick="alert('This is an alert')"> +<p>This is a web page. It fires an alert when clicked. +</body> +</html> diff --git a/examples/declarative/modelviews/webview/autosize/qml/alerts.qml b/examples/declarative/modelviews/webview/autosize/qml/alerts.qml new file mode 100644 index 0000000..4aa4a3b --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qml/alerts.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +WebView { + id: webView + width: 200 + height: 150 + url: "alerts.html" + + onAlert: popup.show(message) + + Rectangle { + id: popup + + color: "red" + border.color: "black"; border.width: 2 + radius: 4 + + y: parent.height // off "screen" + anchors.horizontalCenter: parent.horizontalCenter + width: label.width + 5 + height: label.height + 5 + + opacity: 0 + + function show(text) { + label.text = text + popup.state = "visible" + timer.start() + } + states: State { + name: "visible" + PropertyChanges { target: popup; opacity: 1 } + PropertyChanges { target: popup; y: (webView.height-popup.height)/2 } + } + + transitions: [ + Transition { from: ""; PropertyAnimation { properties: "opacity,y"; duration: 65 } }, + Transition { from: "visible"; PropertyAnimation { properties: "opacity,y"; duration: 500 } } + ] + + Timer { + id: timer + interval: 1000 + + onTriggered: popup.state = "" + } + + Text { + id: label + anchors.centerIn: parent + width: webView.width *0.75 + + color: "white" + font.pixelSize: 20 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + smooth: true + } + } +} diff --git a/examples/declarative/modelviews/webview/autosize/qml/autosize.qml b/examples/declarative/modelviews/webview/autosize/qml/autosize.qml new file mode 100644 index 0000000..7e10403 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qml/autosize.qml @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +// The WebView size is determined by the width, height, +// preferredWidth, and preferredHeight properties. +Rectangle { + id: rect + width: 200 + height: layout.height + + Column { + id: layout + spacing: 2 + + WebView { + html: "No width defined." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + width: rect.width + html: "The width is full." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + width: rect.width/2 + html: "The width is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: rect.width/2 + html: "The_width_is_half." // not wrapped + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + preferredWidth: rect.width/2 + html: "The preferredWidth is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + preferredWidth: rect.width/2 + html: "The_preferredWidth_is_half." // not wrapped + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + } +} diff --git a/examples/declarative/modelviews/webview/autosize/qml/content/Mapping/Map.qml b/examples/declarative/modelviews/webview/autosize/qml/content/Mapping/Map.qml new file mode 100644 index 0000000..9a86579 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qml/content/Mapping/Map.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +Item { + id: page + + property real latitude: -34.397 + property real longitude: 150.644 + property string address: "" + property alias status: js.status + + WebView { + id: map + anchors.fill: parent + url: "map.html" + pressGrabTime: 0 + javaScriptWindowObjects: QtObject { + id: js + WebView.windowObjectName: "qml" + property real lat: page.latitude + property real lng: page.longitude + property string address: page.address + property string status: "Loading" + + onAddressChanged: { + if (map.url != "" && map.progress == 1) + map.evaluateJavaScript("goToAddress()") + } + } + + onLoadFinished: { evaluateJavaScript("goToAddress()"); } + } +} diff --git a/examples/declarative/modelviews/webview/autosize/qml/content/Mapping/map.html b/examples/declarative/modelviews/webview/autosize/qml/content/Mapping/map.html new file mode 100644 index 0000000..a98da54 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qml/content/Mapping/map.html @@ -0,0 +1,60 @@ +<html> +<head> +<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> +<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> +<script type="text/javascript"> + var geocoder + var map + function goToLatLng(latlng,bounds) { + if (map) { + map.setCenter(latlng) + map.fitBounds(bounds) + } else { + var myOptions = { + zoom: 8, + center: latlng, + mapTypeId: google.maps.MapTypeId.ROADMAP + }; + map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); + } + } + function initialize() { + geocoder = new google.maps.Geocoder(); + if (window.qml.address) { + goToAddress() + } else { + goToLatLng(new google.maps.LatLng(window.qml.lat,window.qml.lng)); + } + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(function(position) { + initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); + window.qml.lat = initialLocation.lat; + window.qml.lng = initialLocation.lng; + goToLatLng(initialLocation); + }); + } + } + function goToAddress() { + if (geocoder) { + var req = { + address: window.qml.address, + } + if (map) + req.bounds = map.getBounds() + window.qml.status = "Loading"; + geocoder.geocode(req, function(results, status) { + if (status == google.maps.GeocoderStatus.OK) { + window.qml.status = "Ready"; + goToLatLng(results[0].geometry.location,results[0].geometry.bounds); + } else { + window.qml.status = "Error"; + } + }); + } + } +</script> +</head> +<body onload="initialize()" leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px"> + <div id="map_canvas" style="width:100%; height:100%"></div> +</body> +</html> diff --git a/examples/declarative/modelviews/webview/autosize/qml/content/pics/cancel.png b/examples/declarative/modelviews/webview/autosize/qml/content/pics/cancel.png Binary files differnew file mode 100644 index 0000000..ecc9533 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qml/content/pics/cancel.png diff --git a/examples/declarative/modelviews/webview/autosize/qml/content/pics/ok.png b/examples/declarative/modelviews/webview/autosize/qml/content/pics/ok.png Binary files differnew file mode 100644 index 0000000..5795f04 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qml/content/pics/ok.png diff --git a/examples/declarative/modelviews/webview/autosize/qml/googlemaps.qml b/examples/declarative/modelviews/webview/autosize/qml/googlemaps.qml new file mode 100644 index 0000000..aed0ddd --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qml/googlemaps.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example demonstrates how Web services such as Google Maps can be +// abstracted as QML types. Here we have a "Mapping" module with a "Map" +// type. The Map type has an address property. Setting that property moves +// the map. The underlying implementation uses WebView and the Google Maps +// API, but users from QML don't need to understand the implementation in +// order to create a Map. + +import QtQuick 1.0 +import QtWebKit 1.0 +import "content/Mapping" + +Map { + id: map + width: 300 + height: 300 + address: "Paris" + + Rectangle { + x: 70 + width: input.width + 20 + height: input.height + 4 + anchors.bottom: parent.bottom; anchors.bottomMargin: 5 + radius: 5 + opacity: map.status == "Ready" ? 1 : 0 + + TextInput { + id: input + text: map.address + anchors.centerIn: parent + Keys.onReturnPressed: map.address = input.text + } + } + + Text { + id: loading + anchors.centerIn: parent + text: map.status == "Error" ? "Error" : "Loading" + opacity: map.status == "Ready" ? 0 : 1 + font.pixelSize: 30 + + Behavior on opacity { NumberAnimation{} } + } +} diff --git a/examples/declarative/modelviews/webview/autosize/qml/inlinehtml.qml b/examples/declarative/modelviews/webview/autosize/qml/inlinehtml.qml new file mode 100644 index 0000000..afc1fa9 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qml/inlinehtml.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +// Inline HTML with loose formatting can be +// set on the html property. +WebView { + html:"\ + <body> + <table border=1> + <tr><th><th>One<th>Two<th>Three + <tr><th>1<td>X<td>1<td>X + <tr><th>2<td>0<td>X<td>0 + <tr><th>3<td>X<td>1<td>X + </table>" +} diff --git a/examples/declarative/modelviews/webview/autosize/qml/newwindows.html b/examples/declarative/modelviews/webview/autosize/qml/newwindows.html new file mode 100644 index 0000000..f169599 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qml/newwindows.html @@ -0,0 +1,3 @@ +<h1>Multiple windows...</h1> + +<a target="_blank" href="newwindows.html">Popup!</a> diff --git a/examples/declarative/modelviews/webview/autosize/qml/newwindows.qml b/examples/declarative/modelviews/webview/autosize/qml/newwindows.qml new file mode 100644 index 0000000..52f7a0b --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qml/newwindows.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Demonstrates opening new WebViews from HTML +// +// Note that to open windows from JavaScript, you will need to +// allow it on WebView with settings.javascriptCanOpenWindows: true + +import QtQuick 1.0 +import QtWebKit 1.0 + +Grid { + columns: 3 + id: pages + height: 300; width: 600 + + Component { + id: webViewPage + Rectangle { + width: webView.width + height: webView.height + border.color: "gray" + + WebView { + id: webView + newWindowComponent: webViewPage + newWindowParent: pages + url: "newwindows.html" + } + } + } + + Loader { sourceComponent: webViewPage } +} diff --git a/examples/declarative/modelviews/webview/autosize/qml/webview.qmlproject b/examples/declarative/modelviews/webview/autosize/qml/webview.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qml/webview.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/webview/autosize/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/webview/autosize/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/webview/autosize/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/webview/autosize/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/webview/autosize/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/webview/autosize/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/README b/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/README new file mode 100644 index 0000000..ba73287 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/README @@ -0,0 +1,6 @@ +The Debian Package autosize +---------------------------- + +Comments regarding the Package + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:21:56 +0100 diff --git a/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/changelog b/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/changelog new file mode 100644 index 0000000..2939e3b --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/changelog @@ -0,0 +1,5 @@ +autosize (0.0.1) unstable; urgency=low + + * Initial Release. + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:21:56 +0100 diff --git a/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/compat b/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/compat @@ -0,0 +1 @@ +7 diff --git a/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/control b/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/control new file mode 100644 index 0000000..22a510c --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/control @@ -0,0 +1,13 @@ +Source: autosize +Section: user/hidden +Priority: optional +Maintainer: Daniel Molkentin <danimo@unknown> +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: <insert the upstream URL, if relevant> + +Package: autosize +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: <insert up to 60 chars description> + <insert long description, indented with spaces> diff --git a/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/copyright b/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/copyright new file mode 100644 index 0000000..afff162 --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/copyright @@ -0,0 +1,40 @@ +This package was debianized by Daniel Molkentin <danimo@unknown> on +Thu, 18 Nov 2010 17:21:56 +0100. + +It was downloaded from <url://example.com> + +Upstream Author(s): + + <put author's name and email here> + <likewise for another author> + +Copyright: + + <Copyright (C) YYYY Name OfAuthor> + <likewise for another author> + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2010, Daniel Molkentin <danimo@unknown> and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/rules b/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/rules new file mode 100755 index 0000000..5fa637c --- /dev/null +++ b/examples/declarative/modelviews/webview/autosize/qtc_packaging/debian_fremantle/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/autosize.sgml > autosize.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/autosize. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/autosize install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + # dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/examples/declarative/modelviews/webview/googlemaps/googlemaps.desktop b/examples/declarative/modelviews/webview/googlemaps/googlemaps.desktop new file mode 100644 index 0000000..99d9a79 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/googlemaps.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=googlemaps +Exec=/opt/usr/bin/googlemaps +Icon=googlemaps +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/webview/googlemaps/googlemaps.png b/examples/declarative/modelviews/webview/googlemaps/googlemaps.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/googlemaps.png diff --git a/examples/declarative/modelviews/webview/googlemaps/googlemaps.pro b/examples/declarative/modelviews/webview/googlemaps/googlemaps.pro new file mode 100644 index 0000000..2a4c5f2 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/googlemaps.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEF02570C + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/webview/googlemaps/googlemaps.svg b/examples/declarative/modelviews/webview/googlemaps/googlemaps.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/googlemaps.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/webview/googlemaps/main.cpp b/examples/declarative/modelviews/webview/googlemaps/main.cpp new file mode 100644 index 0000000..0cd9c4f --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/googlemaps.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/webview/googlemaps/qml/alerts.html b/examples/declarative/modelviews/webview/googlemaps/qml/alerts.html new file mode 100644 index 0000000..82caddf --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qml/alerts.html @@ -0,0 +1,5 @@ +<html> +<body onclick="alert('This is an alert')"> +<p>This is a web page. It fires an alert when clicked. +</body> +</html> diff --git a/examples/declarative/modelviews/webview/googlemaps/qml/alerts.qml b/examples/declarative/modelviews/webview/googlemaps/qml/alerts.qml new file mode 100644 index 0000000..4aa4a3b --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qml/alerts.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +WebView { + id: webView + width: 200 + height: 150 + url: "alerts.html" + + onAlert: popup.show(message) + + Rectangle { + id: popup + + color: "red" + border.color: "black"; border.width: 2 + radius: 4 + + y: parent.height // off "screen" + anchors.horizontalCenter: parent.horizontalCenter + width: label.width + 5 + height: label.height + 5 + + opacity: 0 + + function show(text) { + label.text = text + popup.state = "visible" + timer.start() + } + states: State { + name: "visible" + PropertyChanges { target: popup; opacity: 1 } + PropertyChanges { target: popup; y: (webView.height-popup.height)/2 } + } + + transitions: [ + Transition { from: ""; PropertyAnimation { properties: "opacity,y"; duration: 65 } }, + Transition { from: "visible"; PropertyAnimation { properties: "opacity,y"; duration: 500 } } + ] + + Timer { + id: timer + interval: 1000 + + onTriggered: popup.state = "" + } + + Text { + id: label + anchors.centerIn: parent + width: webView.width *0.75 + + color: "white" + font.pixelSize: 20 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + smooth: true + } + } +} diff --git a/examples/declarative/modelviews/webview/googlemaps/qml/autosize.qml b/examples/declarative/modelviews/webview/googlemaps/qml/autosize.qml new file mode 100644 index 0000000..7e10403 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qml/autosize.qml @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +// The WebView size is determined by the width, height, +// preferredWidth, and preferredHeight properties. +Rectangle { + id: rect + width: 200 + height: layout.height + + Column { + id: layout + spacing: 2 + + WebView { + html: "No width defined." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + width: rect.width + html: "The width is full." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + width: rect.width/2 + html: "The width is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: rect.width/2 + html: "The_width_is_half." // not wrapped + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + preferredWidth: rect.width/2 + html: "The preferredWidth is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + preferredWidth: rect.width/2 + html: "The_preferredWidth_is_half." // not wrapped + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + } +} diff --git a/examples/declarative/modelviews/webview/googlemaps/qml/content/Mapping/Map.qml b/examples/declarative/modelviews/webview/googlemaps/qml/content/Mapping/Map.qml new file mode 100644 index 0000000..9a86579 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qml/content/Mapping/Map.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +Item { + id: page + + property real latitude: -34.397 + property real longitude: 150.644 + property string address: "" + property alias status: js.status + + WebView { + id: map + anchors.fill: parent + url: "map.html" + pressGrabTime: 0 + javaScriptWindowObjects: QtObject { + id: js + WebView.windowObjectName: "qml" + property real lat: page.latitude + property real lng: page.longitude + property string address: page.address + property string status: "Loading" + + onAddressChanged: { + if (map.url != "" && map.progress == 1) + map.evaluateJavaScript("goToAddress()") + } + } + + onLoadFinished: { evaluateJavaScript("goToAddress()"); } + } +} diff --git a/examples/declarative/modelviews/webview/googlemaps/qml/content/Mapping/map.html b/examples/declarative/modelviews/webview/googlemaps/qml/content/Mapping/map.html new file mode 100644 index 0000000..a98da54 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qml/content/Mapping/map.html @@ -0,0 +1,60 @@ +<html> +<head> +<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> +<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> +<script type="text/javascript"> + var geocoder + var map + function goToLatLng(latlng,bounds) { + if (map) { + map.setCenter(latlng) + map.fitBounds(bounds) + } else { + var myOptions = { + zoom: 8, + center: latlng, + mapTypeId: google.maps.MapTypeId.ROADMAP + }; + map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); + } + } + function initialize() { + geocoder = new google.maps.Geocoder(); + if (window.qml.address) { + goToAddress() + } else { + goToLatLng(new google.maps.LatLng(window.qml.lat,window.qml.lng)); + } + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(function(position) { + initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); + window.qml.lat = initialLocation.lat; + window.qml.lng = initialLocation.lng; + goToLatLng(initialLocation); + }); + } + } + function goToAddress() { + if (geocoder) { + var req = { + address: window.qml.address, + } + if (map) + req.bounds = map.getBounds() + window.qml.status = "Loading"; + geocoder.geocode(req, function(results, status) { + if (status == google.maps.GeocoderStatus.OK) { + window.qml.status = "Ready"; + goToLatLng(results[0].geometry.location,results[0].geometry.bounds); + } else { + window.qml.status = "Error"; + } + }); + } + } +</script> +</head> +<body onload="initialize()" leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px"> + <div id="map_canvas" style="width:100%; height:100%"></div> +</body> +</html> diff --git a/examples/declarative/modelviews/webview/googlemaps/qml/content/pics/cancel.png b/examples/declarative/modelviews/webview/googlemaps/qml/content/pics/cancel.png Binary files differnew file mode 100644 index 0000000..ecc9533 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qml/content/pics/cancel.png diff --git a/examples/declarative/modelviews/webview/googlemaps/qml/content/pics/ok.png b/examples/declarative/modelviews/webview/googlemaps/qml/content/pics/ok.png Binary files differnew file mode 100644 index 0000000..5795f04 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qml/content/pics/ok.png diff --git a/examples/declarative/modelviews/webview/googlemaps/qml/googlemaps.qml b/examples/declarative/modelviews/webview/googlemaps/qml/googlemaps.qml new file mode 100644 index 0000000..aed0ddd --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qml/googlemaps.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example demonstrates how Web services such as Google Maps can be +// abstracted as QML types. Here we have a "Mapping" module with a "Map" +// type. The Map type has an address property. Setting that property moves +// the map. The underlying implementation uses WebView and the Google Maps +// API, but users from QML don't need to understand the implementation in +// order to create a Map. + +import QtQuick 1.0 +import QtWebKit 1.0 +import "content/Mapping" + +Map { + id: map + width: 300 + height: 300 + address: "Paris" + + Rectangle { + x: 70 + width: input.width + 20 + height: input.height + 4 + anchors.bottom: parent.bottom; anchors.bottomMargin: 5 + radius: 5 + opacity: map.status == "Ready" ? 1 : 0 + + TextInput { + id: input + text: map.address + anchors.centerIn: parent + Keys.onReturnPressed: map.address = input.text + } + } + + Text { + id: loading + anchors.centerIn: parent + text: map.status == "Error" ? "Error" : "Loading" + opacity: map.status == "Ready" ? 0 : 1 + font.pixelSize: 30 + + Behavior on opacity { NumberAnimation{} } + } +} diff --git a/examples/declarative/modelviews/webview/googlemaps/qml/inlinehtml.qml b/examples/declarative/modelviews/webview/googlemaps/qml/inlinehtml.qml new file mode 100644 index 0000000..afc1fa9 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qml/inlinehtml.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +// Inline HTML with loose formatting can be +// set on the html property. +WebView { + html:"\ + <body> + <table border=1> + <tr><th><th>One<th>Two<th>Three + <tr><th>1<td>X<td>1<td>X + <tr><th>2<td>0<td>X<td>0 + <tr><th>3<td>X<td>1<td>X + </table>" +} diff --git a/examples/declarative/modelviews/webview/googlemaps/qml/newwindows.html b/examples/declarative/modelviews/webview/googlemaps/qml/newwindows.html new file mode 100644 index 0000000..f169599 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qml/newwindows.html @@ -0,0 +1,3 @@ +<h1>Multiple windows...</h1> + +<a target="_blank" href="newwindows.html">Popup!</a> diff --git a/examples/declarative/modelviews/webview/googlemaps/qml/newwindows.qml b/examples/declarative/modelviews/webview/googlemaps/qml/newwindows.qml new file mode 100644 index 0000000..52f7a0b --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qml/newwindows.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Demonstrates opening new WebViews from HTML +// +// Note that to open windows from JavaScript, you will need to +// allow it on WebView with settings.javascriptCanOpenWindows: true + +import QtQuick 1.0 +import QtWebKit 1.0 + +Grid { + columns: 3 + id: pages + height: 300; width: 600 + + Component { + id: webViewPage + Rectangle { + width: webView.width + height: webView.height + border.color: "gray" + + WebView { + id: webView + newWindowComponent: webViewPage + newWindowParent: pages + url: "newwindows.html" + } + } + } + + Loader { sourceComponent: webViewPage } +} diff --git a/examples/declarative/modelviews/webview/googlemaps/qml/webview.qmlproject b/examples/declarative/modelviews/webview/googlemaps/qml/webview.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qml/webview.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/webview/googlemaps/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/webview/googlemaps/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/webview/googlemaps/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/webview/googlemaps/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/webview/googlemaps/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/webview/googlemaps/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/README b/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/README new file mode 100644 index 0000000..8bc7f9e --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/README @@ -0,0 +1,6 @@ +The Debian Package googlemaps +---------------------------- + +Comments regarding the Package + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:19:23 +0100 diff --git a/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/changelog b/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/changelog new file mode 100644 index 0000000..e3e11d9 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/changelog @@ -0,0 +1,5 @@ +googlemaps (0.0.1) unstable; urgency=low + + * Initial Release. + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:19:23 +0100 diff --git a/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/compat b/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/compat @@ -0,0 +1 @@ +7 diff --git a/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/control b/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/control new file mode 100644 index 0000000..e046e7c --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/control @@ -0,0 +1,13 @@ +Source: googlemaps +Section: user/hidden +Priority: optional +Maintainer: Daniel Molkentin <danimo@unknown> +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: <insert the upstream URL, if relevant> + +Package: googlemaps +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: <insert up to 60 chars description> + <insert long description, indented with spaces> diff --git a/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/copyright b/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/copyright new file mode 100644 index 0000000..d800cef --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/copyright @@ -0,0 +1,40 @@ +This package was debianized by Daniel Molkentin <danimo@unknown> on +Thu, 18 Nov 2010 17:19:23 +0100. + +It was downloaded from <url://example.com> + +Upstream Author(s): + + <put author's name and email here> + <likewise for another author> + +Copyright: + + <Copyright (C) YYYY Name OfAuthor> + <likewise for another author> + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2010, Daniel Molkentin <danimo@unknown> and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/rules b/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/rules new file mode 100755 index 0000000..de6c89a --- /dev/null +++ b/examples/declarative/modelviews/webview/googlemaps/qtc_packaging/debian_fremantle/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/googlemaps.sgml > googlemaps.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/googlemaps. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/googlemaps install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + # dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/examples/declarative/modelviews/webview/inlinehtml/inlinehtml.desktop b/examples/declarative/modelviews/webview/inlinehtml/inlinehtml.desktop new file mode 100644 index 0000000..98e5949 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/inlinehtml.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=inlinehtml +Exec=/opt/usr/bin/inlinehtml +Icon=inlinehtml +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/webview/inlinehtml/inlinehtml.png b/examples/declarative/modelviews/webview/inlinehtml/inlinehtml.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/inlinehtml.png diff --git a/examples/declarative/modelviews/webview/inlinehtml/inlinehtml.pro b/examples/declarative/modelviews/webview/inlinehtml/inlinehtml.pro new file mode 100644 index 0000000..86cdd1e --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/inlinehtml.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEF18EEF4 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/webview/inlinehtml/inlinehtml.svg b/examples/declarative/modelviews/webview/inlinehtml/inlinehtml.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/inlinehtml.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/webview/inlinehtml/main.cpp b/examples/declarative/modelviews/webview/inlinehtml/main.cpp new file mode 100644 index 0000000..28050c1 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/inlinehtml.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/webview/inlinehtml/qml/alerts.html b/examples/declarative/modelviews/webview/inlinehtml/qml/alerts.html new file mode 100644 index 0000000..82caddf --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qml/alerts.html @@ -0,0 +1,5 @@ +<html> +<body onclick="alert('This is an alert')"> +<p>This is a web page. It fires an alert when clicked. +</body> +</html> diff --git a/examples/declarative/modelviews/webview/inlinehtml/qml/alerts.qml b/examples/declarative/modelviews/webview/inlinehtml/qml/alerts.qml new file mode 100644 index 0000000..4aa4a3b --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qml/alerts.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +WebView { + id: webView + width: 200 + height: 150 + url: "alerts.html" + + onAlert: popup.show(message) + + Rectangle { + id: popup + + color: "red" + border.color: "black"; border.width: 2 + radius: 4 + + y: parent.height // off "screen" + anchors.horizontalCenter: parent.horizontalCenter + width: label.width + 5 + height: label.height + 5 + + opacity: 0 + + function show(text) { + label.text = text + popup.state = "visible" + timer.start() + } + states: State { + name: "visible" + PropertyChanges { target: popup; opacity: 1 } + PropertyChanges { target: popup; y: (webView.height-popup.height)/2 } + } + + transitions: [ + Transition { from: ""; PropertyAnimation { properties: "opacity,y"; duration: 65 } }, + Transition { from: "visible"; PropertyAnimation { properties: "opacity,y"; duration: 500 } } + ] + + Timer { + id: timer + interval: 1000 + + onTriggered: popup.state = "" + } + + Text { + id: label + anchors.centerIn: parent + width: webView.width *0.75 + + color: "white" + font.pixelSize: 20 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + smooth: true + } + } +} diff --git a/examples/declarative/modelviews/webview/inlinehtml/qml/autosize.qml b/examples/declarative/modelviews/webview/inlinehtml/qml/autosize.qml new file mode 100644 index 0000000..7e10403 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qml/autosize.qml @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +// The WebView size is determined by the width, height, +// preferredWidth, and preferredHeight properties. +Rectangle { + id: rect + width: 200 + height: layout.height + + Column { + id: layout + spacing: 2 + + WebView { + html: "No width defined." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + width: rect.width + html: "The width is full." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + width: rect.width/2 + html: "The width is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: rect.width/2 + html: "The_width_is_half." // not wrapped + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + preferredWidth: rect.width/2 + html: "The preferredWidth is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + preferredWidth: rect.width/2 + html: "The_preferredWidth_is_half." // not wrapped + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + } +} diff --git a/examples/declarative/modelviews/webview/inlinehtml/qml/content/Mapping/Map.qml b/examples/declarative/modelviews/webview/inlinehtml/qml/content/Mapping/Map.qml new file mode 100644 index 0000000..9a86579 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qml/content/Mapping/Map.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +Item { + id: page + + property real latitude: -34.397 + property real longitude: 150.644 + property string address: "" + property alias status: js.status + + WebView { + id: map + anchors.fill: parent + url: "map.html" + pressGrabTime: 0 + javaScriptWindowObjects: QtObject { + id: js + WebView.windowObjectName: "qml" + property real lat: page.latitude + property real lng: page.longitude + property string address: page.address + property string status: "Loading" + + onAddressChanged: { + if (map.url != "" && map.progress == 1) + map.evaluateJavaScript("goToAddress()") + } + } + + onLoadFinished: { evaluateJavaScript("goToAddress()"); } + } +} diff --git a/examples/declarative/modelviews/webview/inlinehtml/qml/content/Mapping/map.html b/examples/declarative/modelviews/webview/inlinehtml/qml/content/Mapping/map.html new file mode 100644 index 0000000..a98da54 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qml/content/Mapping/map.html @@ -0,0 +1,60 @@ +<html> +<head> +<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> +<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> +<script type="text/javascript"> + var geocoder + var map + function goToLatLng(latlng,bounds) { + if (map) { + map.setCenter(latlng) + map.fitBounds(bounds) + } else { + var myOptions = { + zoom: 8, + center: latlng, + mapTypeId: google.maps.MapTypeId.ROADMAP + }; + map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); + } + } + function initialize() { + geocoder = new google.maps.Geocoder(); + if (window.qml.address) { + goToAddress() + } else { + goToLatLng(new google.maps.LatLng(window.qml.lat,window.qml.lng)); + } + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(function(position) { + initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); + window.qml.lat = initialLocation.lat; + window.qml.lng = initialLocation.lng; + goToLatLng(initialLocation); + }); + } + } + function goToAddress() { + if (geocoder) { + var req = { + address: window.qml.address, + } + if (map) + req.bounds = map.getBounds() + window.qml.status = "Loading"; + geocoder.geocode(req, function(results, status) { + if (status == google.maps.GeocoderStatus.OK) { + window.qml.status = "Ready"; + goToLatLng(results[0].geometry.location,results[0].geometry.bounds); + } else { + window.qml.status = "Error"; + } + }); + } + } +</script> +</head> +<body onload="initialize()" leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px"> + <div id="map_canvas" style="width:100%; height:100%"></div> +</body> +</html> diff --git a/examples/declarative/modelviews/webview/inlinehtml/qml/content/pics/cancel.png b/examples/declarative/modelviews/webview/inlinehtml/qml/content/pics/cancel.png Binary files differnew file mode 100644 index 0000000..ecc9533 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qml/content/pics/cancel.png diff --git a/examples/declarative/modelviews/webview/inlinehtml/qml/content/pics/ok.png b/examples/declarative/modelviews/webview/inlinehtml/qml/content/pics/ok.png Binary files differnew file mode 100644 index 0000000..5795f04 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qml/content/pics/ok.png diff --git a/examples/declarative/modelviews/webview/inlinehtml/qml/googlemaps.qml b/examples/declarative/modelviews/webview/inlinehtml/qml/googlemaps.qml new file mode 100644 index 0000000..aed0ddd --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qml/googlemaps.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example demonstrates how Web services such as Google Maps can be +// abstracted as QML types. Here we have a "Mapping" module with a "Map" +// type. The Map type has an address property. Setting that property moves +// the map. The underlying implementation uses WebView and the Google Maps +// API, but users from QML don't need to understand the implementation in +// order to create a Map. + +import QtQuick 1.0 +import QtWebKit 1.0 +import "content/Mapping" + +Map { + id: map + width: 300 + height: 300 + address: "Paris" + + Rectangle { + x: 70 + width: input.width + 20 + height: input.height + 4 + anchors.bottom: parent.bottom; anchors.bottomMargin: 5 + radius: 5 + opacity: map.status == "Ready" ? 1 : 0 + + TextInput { + id: input + text: map.address + anchors.centerIn: parent + Keys.onReturnPressed: map.address = input.text + } + } + + Text { + id: loading + anchors.centerIn: parent + text: map.status == "Error" ? "Error" : "Loading" + opacity: map.status == "Ready" ? 0 : 1 + font.pixelSize: 30 + + Behavior on opacity { NumberAnimation{} } + } +} diff --git a/examples/declarative/modelviews/webview/inlinehtml/qml/inlinehtml.qml b/examples/declarative/modelviews/webview/inlinehtml/qml/inlinehtml.qml new file mode 100644 index 0000000..afc1fa9 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qml/inlinehtml.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +// Inline HTML with loose formatting can be +// set on the html property. +WebView { + html:"\ + <body> + <table border=1> + <tr><th><th>One<th>Two<th>Three + <tr><th>1<td>X<td>1<td>X + <tr><th>2<td>0<td>X<td>0 + <tr><th>3<td>X<td>1<td>X + </table>" +} diff --git a/examples/declarative/modelviews/webview/inlinehtml/qml/newwindows.html b/examples/declarative/modelviews/webview/inlinehtml/qml/newwindows.html new file mode 100644 index 0000000..f169599 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qml/newwindows.html @@ -0,0 +1,3 @@ +<h1>Multiple windows...</h1> + +<a target="_blank" href="newwindows.html">Popup!</a> diff --git a/examples/declarative/modelviews/webview/inlinehtml/qml/newwindows.qml b/examples/declarative/modelviews/webview/inlinehtml/qml/newwindows.qml new file mode 100644 index 0000000..52f7a0b --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qml/newwindows.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Demonstrates opening new WebViews from HTML +// +// Note that to open windows from JavaScript, you will need to +// allow it on WebView with settings.javascriptCanOpenWindows: true + +import QtQuick 1.0 +import QtWebKit 1.0 + +Grid { + columns: 3 + id: pages + height: 300; width: 600 + + Component { + id: webViewPage + Rectangle { + width: webView.width + height: webView.height + border.color: "gray" + + WebView { + id: webView + newWindowComponent: webViewPage + newWindowParent: pages + url: "newwindows.html" + } + } + } + + Loader { sourceComponent: webViewPage } +} diff --git a/examples/declarative/modelviews/webview/inlinehtml/qml/webview.qmlproject b/examples/declarative/modelviews/webview/inlinehtml/qml/webview.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qml/webview.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/webview/inlinehtml/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/webview/inlinehtml/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/webview/inlinehtml/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/webview/inlinehtml/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/webview/inlinehtml/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/webview/inlinehtml/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/README b/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/README new file mode 100644 index 0000000..c0dfce0 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/README @@ -0,0 +1,6 @@ +The Debian Package inlinehtml +---------------------------- + +Comments regarding the Package + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:20:40 +0100 diff --git a/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/changelog b/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/changelog new file mode 100644 index 0000000..68a9930 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/changelog @@ -0,0 +1,5 @@ +inlinehtml (0.0.1) unstable; urgency=low + + * Initial Release. + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:20:40 +0100 diff --git a/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/compat b/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/compat @@ -0,0 +1 @@ +7 diff --git a/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/control b/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/control new file mode 100644 index 0000000..dbb1638 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/control @@ -0,0 +1,13 @@ +Source: inlinehtml +Section: user/hidden +Priority: optional +Maintainer: Daniel Molkentin <danimo@unknown> +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: <insert the upstream URL, if relevant> + +Package: inlinehtml +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: <insert up to 60 chars description> + <insert long description, indented with spaces> diff --git a/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/copyright b/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/copyright new file mode 100644 index 0000000..67b61f7 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/copyright @@ -0,0 +1,40 @@ +This package was debianized by Daniel Molkentin <danimo@unknown> on +Thu, 18 Nov 2010 17:20:40 +0100. + +It was downloaded from <url://example.com> + +Upstream Author(s): + + <put author's name and email here> + <likewise for another author> + +Copyright: + + <Copyright (C) YYYY Name OfAuthor> + <likewise for another author> + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2010, Daniel Molkentin <danimo@unknown> and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/rules b/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/rules new file mode 100755 index 0000000..39509f9 --- /dev/null +++ b/examples/declarative/modelviews/webview/inlinehtml/qtc_packaging/debian_fremantle/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/inlinehtml.sgml > inlinehtml.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/inlinehtml. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/inlinehtml install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + # dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/examples/declarative/modelviews/webview/newwindows/main.cpp b/examples/declarative/modelviews/webview/newwindows/main.cpp new file mode 100644 index 0000000..358b747 --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/newwindows.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/webview/newwindows/newwindows.desktop b/examples/declarative/modelviews/webview/newwindows/newwindows.desktop new file mode 100644 index 0000000..ab2655c --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/newwindows.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=newwindows +Exec=/opt/usr/bin/newwindows +Icon=newwindows +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/webview/newwindows/newwindows.png b/examples/declarative/modelviews/webview/newwindows/newwindows.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/newwindows.png diff --git a/examples/declarative/modelviews/webview/newwindows/newwindows.pro b/examples/declarative/modelviews/webview/newwindows/newwindows.pro new file mode 100644 index 0000000..0ade74b --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/newwindows.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEE16E439 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/webview/newwindows/newwindows.svg b/examples/declarative/modelviews/webview/newwindows/newwindows.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/newwindows.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/modelviews/webview/newwindows/qml/alerts.html b/examples/declarative/modelviews/webview/newwindows/qml/alerts.html new file mode 100644 index 0000000..82caddf --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qml/alerts.html @@ -0,0 +1,5 @@ +<html> +<body onclick="alert('This is an alert')"> +<p>This is a web page. It fires an alert when clicked. +</body> +</html> diff --git a/examples/declarative/modelviews/webview/newwindows/qml/alerts.qml b/examples/declarative/modelviews/webview/newwindows/qml/alerts.qml new file mode 100644 index 0000000..4aa4a3b --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qml/alerts.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +WebView { + id: webView + width: 200 + height: 150 + url: "alerts.html" + + onAlert: popup.show(message) + + Rectangle { + id: popup + + color: "red" + border.color: "black"; border.width: 2 + radius: 4 + + y: parent.height // off "screen" + anchors.horizontalCenter: parent.horizontalCenter + width: label.width + 5 + height: label.height + 5 + + opacity: 0 + + function show(text) { + label.text = text + popup.state = "visible" + timer.start() + } + states: State { + name: "visible" + PropertyChanges { target: popup; opacity: 1 } + PropertyChanges { target: popup; y: (webView.height-popup.height)/2 } + } + + transitions: [ + Transition { from: ""; PropertyAnimation { properties: "opacity,y"; duration: 65 } }, + Transition { from: "visible"; PropertyAnimation { properties: "opacity,y"; duration: 500 } } + ] + + Timer { + id: timer + interval: 1000 + + onTriggered: popup.state = "" + } + + Text { + id: label + anchors.centerIn: parent + width: webView.width *0.75 + + color: "white" + font.pixelSize: 20 + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + smooth: true + } + } +} diff --git a/examples/declarative/modelviews/webview/newwindows/qml/autosize.qml b/examples/declarative/modelviews/webview/newwindows/qml/autosize.qml new file mode 100644 index 0000000..7e10403 --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qml/autosize.qml @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +// The WebView size is determined by the width, height, +// preferredWidth, and preferredHeight properties. +Rectangle { + id: rect + width: 200 + height: layout.height + + Column { + id: layout + spacing: 2 + + WebView { + html: "No width defined." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + width: rect.width + html: "The width is full." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + width: rect.width/2 + html: "The width is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + width: rect.width/2 + html: "The_width_is_half." // not wrapped + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + + WebView { + preferredWidth: rect.width/2 + html: "The preferredWidth is half." + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + WebView { + preferredWidth: rect.width/2 + html: "The_preferredWidth_is_half." // not wrapped + Rectangle { + color: "#10000000" + anchors.fill: parent + } + } + } +} diff --git a/examples/declarative/modelviews/webview/newwindows/qml/content/Mapping/Map.qml b/examples/declarative/modelviews/webview/newwindows/qml/content/Mapping/Map.qml new file mode 100644 index 0000000..9a86579 --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qml/content/Mapping/Map.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +Item { + id: page + + property real latitude: -34.397 + property real longitude: 150.644 + property string address: "" + property alias status: js.status + + WebView { + id: map + anchors.fill: parent + url: "map.html" + pressGrabTime: 0 + javaScriptWindowObjects: QtObject { + id: js + WebView.windowObjectName: "qml" + property real lat: page.latitude + property real lng: page.longitude + property string address: page.address + property string status: "Loading" + + onAddressChanged: { + if (map.url != "" && map.progress == 1) + map.evaluateJavaScript("goToAddress()") + } + } + + onLoadFinished: { evaluateJavaScript("goToAddress()"); } + } +} diff --git a/examples/declarative/modelviews/webview/newwindows/qml/content/Mapping/map.html b/examples/declarative/modelviews/webview/newwindows/qml/content/Mapping/map.html new file mode 100644 index 0000000..a98da54 --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qml/content/Mapping/map.html @@ -0,0 +1,60 @@ +<html> +<head> +<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> +<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> +<script type="text/javascript"> + var geocoder + var map + function goToLatLng(latlng,bounds) { + if (map) { + map.setCenter(latlng) + map.fitBounds(bounds) + } else { + var myOptions = { + zoom: 8, + center: latlng, + mapTypeId: google.maps.MapTypeId.ROADMAP + }; + map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); + } + } + function initialize() { + geocoder = new google.maps.Geocoder(); + if (window.qml.address) { + goToAddress() + } else { + goToLatLng(new google.maps.LatLng(window.qml.lat,window.qml.lng)); + } + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition(function(position) { + initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); + window.qml.lat = initialLocation.lat; + window.qml.lng = initialLocation.lng; + goToLatLng(initialLocation); + }); + } + } + function goToAddress() { + if (geocoder) { + var req = { + address: window.qml.address, + } + if (map) + req.bounds = map.getBounds() + window.qml.status = "Loading"; + geocoder.geocode(req, function(results, status) { + if (status == google.maps.GeocoderStatus.OK) { + window.qml.status = "Ready"; + goToLatLng(results[0].geometry.location,results[0].geometry.bounds); + } else { + window.qml.status = "Error"; + } + }); + } + } +</script> +</head> +<body onload="initialize()" leftmargin="0px" topmargin="0px" marginwidth="0px" marginheight="0px"> + <div id="map_canvas" style="width:100%; height:100%"></div> +</body> +</html> diff --git a/examples/declarative/modelviews/webview/newwindows/qml/content/pics/cancel.png b/examples/declarative/modelviews/webview/newwindows/qml/content/pics/cancel.png Binary files differnew file mode 100644 index 0000000..ecc9533 --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qml/content/pics/cancel.png diff --git a/examples/declarative/modelviews/webview/newwindows/qml/content/pics/ok.png b/examples/declarative/modelviews/webview/newwindows/qml/content/pics/ok.png Binary files differnew file mode 100644 index 0000000..5795f04 --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qml/content/pics/ok.png diff --git a/examples/declarative/modelviews/webview/newwindows/qml/googlemaps.qml b/examples/declarative/modelviews/webview/newwindows/qml/googlemaps.qml new file mode 100644 index 0000000..aed0ddd --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qml/googlemaps.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This example demonstrates how Web services such as Google Maps can be +// abstracted as QML types. Here we have a "Mapping" module with a "Map" +// type. The Map type has an address property. Setting that property moves +// the map. The underlying implementation uses WebView and the Google Maps +// API, but users from QML don't need to understand the implementation in +// order to create a Map. + +import QtQuick 1.0 +import QtWebKit 1.0 +import "content/Mapping" + +Map { + id: map + width: 300 + height: 300 + address: "Paris" + + Rectangle { + x: 70 + width: input.width + 20 + height: input.height + 4 + anchors.bottom: parent.bottom; anchors.bottomMargin: 5 + radius: 5 + opacity: map.status == "Ready" ? 1 : 0 + + TextInput { + id: input + text: map.address + anchors.centerIn: parent + Keys.onReturnPressed: map.address = input.text + } + } + + Text { + id: loading + anchors.centerIn: parent + text: map.status == "Error" ? "Error" : "Loading" + opacity: map.status == "Ready" ? 0 : 1 + font.pixelSize: 30 + + Behavior on opacity { NumberAnimation{} } + } +} diff --git a/examples/declarative/modelviews/webview/newwindows/qml/inlinehtml.qml b/examples/declarative/modelviews/webview/newwindows/qml/inlinehtml.qml new file mode 100644 index 0000000..afc1fa9 --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qml/inlinehtml.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import QtWebKit 1.0 + +// Inline HTML with loose formatting can be +// set on the html property. +WebView { + html:"\ + <body> + <table border=1> + <tr><th><th>One<th>Two<th>Three + <tr><th>1<td>X<td>1<td>X + <tr><th>2<td>0<td>X<td>0 + <tr><th>3<td>X<td>1<td>X + </table>" +} diff --git a/examples/declarative/modelviews/webview/newwindows/qml/newwindows.html b/examples/declarative/modelviews/webview/newwindows/qml/newwindows.html new file mode 100644 index 0000000..f169599 --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qml/newwindows.html @@ -0,0 +1,3 @@ +<h1>Multiple windows...</h1> + +<a target="_blank" href="newwindows.html">Popup!</a> diff --git a/examples/declarative/modelviews/webview/newwindows/qml/newwindows.qml b/examples/declarative/modelviews/webview/newwindows/qml/newwindows.qml new file mode 100644 index 0000000..52f7a0b --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qml/newwindows.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Demonstrates opening new WebViews from HTML +// +// Note that to open windows from JavaScript, you will need to +// allow it on WebView with settings.javascriptCanOpenWindows: true + +import QtQuick 1.0 +import QtWebKit 1.0 + +Grid { + columns: 3 + id: pages + height: 300; width: 600 + + Component { + id: webViewPage + Rectangle { + width: webView.width + height: webView.height + border.color: "gray" + + WebView { + id: webView + newWindowComponent: webViewPage + newWindowParent: pages + url: "newwindows.html" + } + } + } + + Loader { sourceComponent: webViewPage } +} diff --git a/examples/declarative/modelviews/webview/newwindows/qml/webview.qmlproject b/examples/declarative/modelviews/webview/newwindows/qml/webview.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qml/webview.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/modelviews/webview/newwindows/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/modelviews/webview/newwindows/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/modelviews/webview/newwindows/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/modelviews/webview/newwindows/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/modelviews/webview/newwindows/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/modelviews/webview/newwindows/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/modelviews/webview/newwindows/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/positioners/main.cpp b/examples/declarative/positioners/main.cpp new file mode 100644 index 0000000..1338c66 --- /dev/null +++ b/examples/declarative/positioners/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/positioners.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/positioners/positioners.desktop b/examples/declarative/positioners/positioners.desktop new file mode 100644 index 0000000..16b8efc --- /dev/null +++ b/examples/declarative/positioners/positioners.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=positioners +Exec=/opt/usr/bin/positioners +Icon=positioners +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/positioners/positioners.png b/examples/declarative/positioners/positioners.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/positioners/positioners.png diff --git a/examples/declarative/positioners/positioners.pro b/examples/declarative/positioners/positioners.pro new file mode 100644 index 0000000..38daa89 --- /dev/null +++ b/examples/declarative/positioners/positioners.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE6D726D3 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/positioners/positioners.svg b/examples/declarative/positioners/positioners.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/positioners/positioners.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/positioners/qml/Button.qml b/examples/declarative/positioners/qml/Button.qml new file mode 100644 index 0000000..32e5993 --- /dev/null +++ b/examples/declarative/positioners/qml/Button.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: page + + property string text + property string icon + signal clicked + + border.color: "black"; color: "steelblue"; radius: 5 + width: pix.width + textelement.width + 13 + height: pix.height + 10 + + Image { id: pix; x: 5; y:5; source: parent.icon } + + Text { + id: textelement + text: page.text; color: "white" + x: pix.width + pix.x + 3 + anchors.verticalCenter: pix.verticalCenter + } + + MouseArea { + id: mr + anchors.fill: parent + onClicked: { parent.focus = true; page.clicked() } + } + + states: State { + name: "pressed"; when: mr.pressed + PropertyChanges { target: textelement; x: 5 } + PropertyChanges { target: pix; x: textelement.x + textelement.width + 3 } + } + + transitions: Transition { + NumberAnimation { properties: "x,left"; easing.type: Easing.InOutQuad; duration: 200 } + } +} diff --git a/examples/declarative/positioners/qml/add.png b/examples/declarative/positioners/qml/add.png Binary files differnew file mode 100644 index 0000000..1ee4542 --- /dev/null +++ b/examples/declarative/positioners/qml/add.png diff --git a/examples/declarative/positioners/qml/del.png b/examples/declarative/positioners/qml/del.png Binary files differnew file mode 100644 index 0000000..8d2eaed --- /dev/null +++ b/examples/declarative/positioners/qml/del.png diff --git a/examples/declarative/positioners/qml/positioners.qml b/examples/declarative/positioners/qml/positioners.qml new file mode 100644 index 0000000..6ae265e --- /dev/null +++ b/examples/declarative/positioners/qml/positioners.qml @@ -0,0 +1,253 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: page + width: 420; height: 420 + + Column { + id: layout1 + y: 0 + move: Transition { + NumberAnimation { properties: "y"; easing.type: Easing.OutBounce } + } + add: Transition { + NumberAnimation { properties: "y"; easing.type: Easing.OutQuad } + } + + Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueV1 + width: 100; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "green"; width: 100; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueV2 + width: 100; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "orange"; width: 100; height: 50; border.color: "black"; radius: 15 } + } + + Row { + id: layout2 + y: 300 + move: Transition { + NumberAnimation { properties: "x"; easing.type: Easing.OutBounce } + } + add: Transition { + NumberAnimation { properties: "x"; easing.type: Easing.OutQuad } + } + + Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 } + + Rectangle { + id: blueH1 + width: 50; height: 100 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "green"; width: 50; height: 100; border.color: "black"; radius: 15 } + + Rectangle { + id: blueH2 + width: 50; height: 100 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "orange"; width: 50; height: 100; border.color: "black"; radius: 15 } + } + + Button { + x: 135; y: 90 + text: "Remove" + icon: "del.png" + + onClicked: { + blueH2.opacity = 0 + blueH1.opacity = 0 + blueV1.opacity = 0 + blueV2.opacity = 0 + blueG1.opacity = 0 + blueG2.opacity = 0 + blueG3.opacity = 0 + blueF1.opacity = 0 + blueF2.opacity = 0 + blueF3.opacity = 0 + } + } + + Button { + x: 145; y: 140 + text: "Add" + icon: "add.png" + + onClicked: { + blueH2.opacity = 1 + blueH1.opacity = 1 + blueV1.opacity = 1 + blueV2.opacity = 1 + blueG1.opacity = 1 + blueG2.opacity = 1 + blueG3.opacity = 1 + blueF1.opacity = 1 + blueF2.opacity = 1 + blueF3.opacity = 1 + } + } + + Grid { + x: 260; y: 0 + columns: 3 + + move: Transition { + NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } + } + + add: Transition { + NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } + } + + Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueG1 + width: 50; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueG2 + width: 50; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueG3 + width: 50; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } + Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 } + Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } + } + + Flow { + id: layout4 + x: 260; y: 250; width: 150 + + move: Transition { + NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } + } + + add: Transition { + NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce } + } + + Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueF1 + width: 60; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "green"; width: 30; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueF2 + width: 60; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } + + Rectangle { + id: blueF3 + width: 40; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } + } + + Rectangle { color: "red"; width: 80; height: 50; border.color: "black"; radius: 15 } + } + +} diff --git a/examples/declarative/positioners/qml/positioners.qmlproject b/examples/declarative/positioners/qml/positioners.qmlproject new file mode 100644 index 0000000..e526217 --- /dev/null +++ b/examples/declarative/positioners/qml/positioners.qmlproject @@ -0,0 +1,18 @@ +/* File generated by QtCreator */ + +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/positioners/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/positioners/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/positioners/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/positioners/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/positioners/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/positioners/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/positioners/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/positioners/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/positioners/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/sqllocalstorage/sqllocalstorage.qmlproject b/examples/declarative/sqllocalstorage/sqllocalstorage.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/sqllocalstorage/sqllocalstorage.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/text/fonts/availableFonts/availableFonts.desktop b/examples/declarative/text/fonts/availableFonts/availableFonts.desktop new file mode 100644 index 0000000..708a8cf --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/availableFonts.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=availableFonts +Exec=/opt/usr/bin/availableFonts +Icon=availableFonts +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/text/fonts/availableFonts/availableFonts.png b/examples/declarative/text/fonts/availableFonts/availableFonts.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/availableFonts.png diff --git a/examples/declarative/text/fonts/availableFonts/availableFonts.pro b/examples/declarative/text/fonts/availableFonts/availableFonts.pro new file mode 100644 index 0000000..75753e0 --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/availableFonts.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE696D9F7 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/text/fonts/availableFonts/availableFonts.svg b/examples/declarative/text/fonts/availableFonts/availableFonts.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/availableFonts.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/text/fonts/availableFonts/main.cpp b/examples/declarative/text/fonts/availableFonts/main.cpp new file mode 100644 index 0000000..06e56bb --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/availableFonts.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/text/fonts/availableFonts/qml/availableFonts.qml b/examples/declarative/text/fonts/availableFonts/qml/availableFonts.qml new file mode 100644 index 0000000..4966a41 --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/qml/availableFonts.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 480; height: 640; color: "steelblue" + + ListView { + anchors.fill: parent; model: Qt.fontFamilies() + + delegate: Item { + height: 40; width: ListView.view.width + Text { + anchors.centerIn: parent + text: modelData; font.family: modelData; font.pixelSize: 24; color: "white" + } + } + } +} diff --git a/examples/declarative/text/fonts/availableFonts/qml/banner.qml b/examples/declarative/text/fonts/availableFonts/qml/banner.qml new file mode 100644 index 0000000..d722468 --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/qml/banner.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: screen + + property int pixelSize: screen.height * 1.25 + property color textColor: "lightsteelblue" + property string text: "Hello world! " + + width: 640; height: 320 + color: "steelblue" + + Row { + y: -screen.height / 4.5 + + NumberAnimation on x { from: 0; to: -text.width; duration: 6000; loops: Animation.Infinite } + Text { id: text; font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } + Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } + Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } + } +} diff --git a/examples/declarative/text/fonts/availableFonts/qml/fonts.qml b/examples/declarative/text/fonts/availableFonts/qml/fonts.qml new file mode 100644 index 0000000..ae48f24 --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/qml/fonts.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + property string myText: "The quick brown fox jumps over the lazy dog." + + width: 800; height: 480 + color: "steelblue" + + FontLoader { id: fixedFont; name: "Courier" } + FontLoader { id: localFont; source: "fonts/tarzeau_ocr_a.ttf" } + FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" } + + Column { + anchors { fill: parent; leftMargin: 10; rightMargin: 10 } + spacing: 15 + + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideRight + font.family: "Times"; font.pointSize: 42 + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideLeft + font { family: "Times"; pointSize: 42; capitalization: Font.AllUppercase } + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideMiddle + font { family: fixedFont.name; pointSize: 42; weight: Font.Bold; capitalization: Font.AllLowercase } + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideRight + font { family: fixedFont.name; pointSize: 42; italic: true; capitalization: Font.SmallCaps } + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideLeft + font { family: localFont.name; pointSize: 42; capitalization: Font.Capitalize } + } + Text { + text: { + if (webFont.status == FontLoader.Ready) myText + else if (webFont.status == FontLoader.Loading) "Loading..." + else if (webFont.status == FontLoader.Error) "Error loading font" + } + color: "lightsteelblue" + width: parent.width + elide: Text.ElideMiddle + font.family: webFont.name; font.pointSize: 42 + } + } +} diff --git a/examples/declarative/text/fonts/availableFonts/qml/fonts.qmlproject b/examples/declarative/text/fonts/availableFonts/qml/fonts.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/qml/fonts.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/text/fonts/availableFonts/qml/fonts/tarzeau_ocr_a.ttf b/examples/declarative/text/fonts/availableFonts/qml/fonts/tarzeau_ocr_a.ttf Binary files differnew file mode 100644 index 0000000..cf93f96 --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/qml/fonts/tarzeau_ocr_a.ttf diff --git a/examples/declarative/text/fonts/availableFonts/qml/hello.qml b/examples/declarative/text/fonts/availableFonts/qml/hello.qml new file mode 100644 index 0000000..3aaf0fe --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/qml/hello.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: screen + + width: 800; height: 480 + color: "black" + + Item { + id: container + x: screen.width / 2; y: screen.height / 2 + + Text { + id: text + anchors.centerIn: parent + color: "white" + text: "Hello world!" + font.pixelSize: 60 + smooth: true + + SequentialAnimation on font.letterSpacing { + loops: Animation.Infinite; + NumberAnimation { from: 0; to: 150; easing.type: Easing.InQuad; duration: 3000 } + ScriptAction { + script: { + container.y = (screen.height / 4) + (Math.random() * screen.height / 2) + container.x = (screen.width / 4) + (Math.random() * screen.width / 2) + } + } + } + + SequentialAnimation on opacity { + loops: Animation.Infinite; + NumberAnimation { from: 1; to: 0; duration: 2600 } + PauseAnimation { duration: 400 } + } + } + } +} diff --git a/examples/declarative/text/fonts/availableFonts/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/text/fonts/availableFonts/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/text/fonts/availableFonts/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/text/fonts/availableFonts/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/text/fonts/availableFonts/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/text/fonts/availableFonts/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/text/fonts/availableFonts/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/text/fonts/banner/banner.desktop b/examples/declarative/text/fonts/banner/banner.desktop new file mode 100644 index 0000000..3cc66c5 --- /dev/null +++ b/examples/declarative/text/fonts/banner/banner.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=banner +Exec=/opt/usr/bin/banner +Icon=banner +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/text/fonts/banner/banner.png b/examples/declarative/text/fonts/banner/banner.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/text/fonts/banner/banner.png diff --git a/examples/declarative/text/fonts/banner/banner.pro b/examples/declarative/text/fonts/banner/banner.pro new file mode 100644 index 0000000..8f4279c --- /dev/null +++ b/examples/declarative/text/fonts/banner/banner.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEBAA8CBE + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/text/fonts/banner/banner.svg b/examples/declarative/text/fonts/banner/banner.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/text/fonts/banner/banner.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/text/fonts/banner/main.cpp b/examples/declarative/text/fonts/banner/main.cpp new file mode 100644 index 0000000..06e26b5 --- /dev/null +++ b/examples/declarative/text/fonts/banner/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/banner.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/text/fonts/banner/qml/availableFonts.qml b/examples/declarative/text/fonts/banner/qml/availableFonts.qml new file mode 100644 index 0000000..4966a41 --- /dev/null +++ b/examples/declarative/text/fonts/banner/qml/availableFonts.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 480; height: 640; color: "steelblue" + + ListView { + anchors.fill: parent; model: Qt.fontFamilies() + + delegate: Item { + height: 40; width: ListView.view.width + Text { + anchors.centerIn: parent + text: modelData; font.family: modelData; font.pixelSize: 24; color: "white" + } + } + } +} diff --git a/examples/declarative/text/fonts/banner/qml/banner.qml b/examples/declarative/text/fonts/banner/qml/banner.qml new file mode 100644 index 0000000..d722468 --- /dev/null +++ b/examples/declarative/text/fonts/banner/qml/banner.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: screen + + property int pixelSize: screen.height * 1.25 + property color textColor: "lightsteelblue" + property string text: "Hello world! " + + width: 640; height: 320 + color: "steelblue" + + Row { + y: -screen.height / 4.5 + + NumberAnimation on x { from: 0; to: -text.width; duration: 6000; loops: Animation.Infinite } + Text { id: text; font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } + Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } + Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } + } +} diff --git a/examples/declarative/text/fonts/banner/qml/fonts.qml b/examples/declarative/text/fonts/banner/qml/fonts.qml new file mode 100644 index 0000000..ae48f24 --- /dev/null +++ b/examples/declarative/text/fonts/banner/qml/fonts.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + property string myText: "The quick brown fox jumps over the lazy dog." + + width: 800; height: 480 + color: "steelblue" + + FontLoader { id: fixedFont; name: "Courier" } + FontLoader { id: localFont; source: "fonts/tarzeau_ocr_a.ttf" } + FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" } + + Column { + anchors { fill: parent; leftMargin: 10; rightMargin: 10 } + spacing: 15 + + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideRight + font.family: "Times"; font.pointSize: 42 + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideLeft + font { family: "Times"; pointSize: 42; capitalization: Font.AllUppercase } + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideMiddle + font { family: fixedFont.name; pointSize: 42; weight: Font.Bold; capitalization: Font.AllLowercase } + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideRight + font { family: fixedFont.name; pointSize: 42; italic: true; capitalization: Font.SmallCaps } + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideLeft + font { family: localFont.name; pointSize: 42; capitalization: Font.Capitalize } + } + Text { + text: { + if (webFont.status == FontLoader.Ready) myText + else if (webFont.status == FontLoader.Loading) "Loading..." + else if (webFont.status == FontLoader.Error) "Error loading font" + } + color: "lightsteelblue" + width: parent.width + elide: Text.ElideMiddle + font.family: webFont.name; font.pointSize: 42 + } + } +} diff --git a/examples/declarative/text/fonts/banner/qml/fonts.qmlproject b/examples/declarative/text/fonts/banner/qml/fonts.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/text/fonts/banner/qml/fonts.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/text/fonts/banner/qml/fonts/tarzeau_ocr_a.ttf b/examples/declarative/text/fonts/banner/qml/fonts/tarzeau_ocr_a.ttf Binary files differnew file mode 100644 index 0000000..cf93f96 --- /dev/null +++ b/examples/declarative/text/fonts/banner/qml/fonts/tarzeau_ocr_a.ttf diff --git a/examples/declarative/text/fonts/banner/qml/hello.qml b/examples/declarative/text/fonts/banner/qml/hello.qml new file mode 100644 index 0000000..3aaf0fe --- /dev/null +++ b/examples/declarative/text/fonts/banner/qml/hello.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: screen + + width: 800; height: 480 + color: "black" + + Item { + id: container + x: screen.width / 2; y: screen.height / 2 + + Text { + id: text + anchors.centerIn: parent + color: "white" + text: "Hello world!" + font.pixelSize: 60 + smooth: true + + SequentialAnimation on font.letterSpacing { + loops: Animation.Infinite; + NumberAnimation { from: 0; to: 150; easing.type: Easing.InQuad; duration: 3000 } + ScriptAction { + script: { + container.y = (screen.height / 4) + (Math.random() * screen.height / 2) + container.x = (screen.width / 4) + (Math.random() * screen.width / 2) + } + } + } + + SequentialAnimation on opacity { + loops: Animation.Infinite; + NumberAnimation { from: 1; to: 0; duration: 2600 } + PauseAnimation { duration: 400 } + } + } + } +} diff --git a/examples/declarative/text/fonts/banner/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/text/fonts/banner/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/text/fonts/banner/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/text/fonts/banner/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/text/fonts/banner/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/text/fonts/banner/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/text/fonts/banner/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/text/fonts/banner/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/text/fonts/banner/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/text/fonts/fonts/fonts.desktop b/examples/declarative/text/fonts/fonts/fonts.desktop new file mode 100644 index 0000000..ffb31e9 --- /dev/null +++ b/examples/declarative/text/fonts/fonts/fonts.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=fonts +Exec=/opt/usr/bin/fonts +Icon=fonts +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/text/fonts/fonts/fonts.png b/examples/declarative/text/fonts/fonts/fonts.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/text/fonts/fonts/fonts.png diff --git a/examples/declarative/text/fonts/fonts/fonts.pro b/examples/declarative/text/fonts/fonts/fonts.pro new file mode 100644 index 0000000..a7342f0 --- /dev/null +++ b/examples/declarative/text/fonts/fonts/fonts.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE4CA52B6 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/text/fonts/fonts/fonts.svg b/examples/declarative/text/fonts/fonts/fonts.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/text/fonts/fonts/fonts.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/text/fonts/fonts/main.cpp b/examples/declarative/text/fonts/fonts/main.cpp new file mode 100644 index 0000000..95d1299 --- /dev/null +++ b/examples/declarative/text/fonts/fonts/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/fonts.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/text/fonts/fonts/qml/availableFonts.qml b/examples/declarative/text/fonts/fonts/qml/availableFonts.qml new file mode 100644 index 0000000..4966a41 --- /dev/null +++ b/examples/declarative/text/fonts/fonts/qml/availableFonts.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 480; height: 640; color: "steelblue" + + ListView { + anchors.fill: parent; model: Qt.fontFamilies() + + delegate: Item { + height: 40; width: ListView.view.width + Text { + anchors.centerIn: parent + text: modelData; font.family: modelData; font.pixelSize: 24; color: "white" + } + } + } +} diff --git a/examples/declarative/text/fonts/fonts/qml/banner.qml b/examples/declarative/text/fonts/fonts/qml/banner.qml new file mode 100644 index 0000000..d722468 --- /dev/null +++ b/examples/declarative/text/fonts/fonts/qml/banner.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: screen + + property int pixelSize: screen.height * 1.25 + property color textColor: "lightsteelblue" + property string text: "Hello world! " + + width: 640; height: 320 + color: "steelblue" + + Row { + y: -screen.height / 4.5 + + NumberAnimation on x { from: 0; to: -text.width; duration: 6000; loops: Animation.Infinite } + Text { id: text; font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } + Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } + Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } + } +} diff --git a/examples/declarative/text/fonts/fonts/qml/fonts.qml b/examples/declarative/text/fonts/fonts/qml/fonts.qml new file mode 100644 index 0000000..ae48f24 --- /dev/null +++ b/examples/declarative/text/fonts/fonts/qml/fonts.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + property string myText: "The quick brown fox jumps over the lazy dog." + + width: 800; height: 480 + color: "steelblue" + + FontLoader { id: fixedFont; name: "Courier" } + FontLoader { id: localFont; source: "fonts/tarzeau_ocr_a.ttf" } + FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" } + + Column { + anchors { fill: parent; leftMargin: 10; rightMargin: 10 } + spacing: 15 + + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideRight + font.family: "Times"; font.pointSize: 42 + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideLeft + font { family: "Times"; pointSize: 42; capitalization: Font.AllUppercase } + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideMiddle + font { family: fixedFont.name; pointSize: 42; weight: Font.Bold; capitalization: Font.AllLowercase } + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideRight + font { family: fixedFont.name; pointSize: 42; italic: true; capitalization: Font.SmallCaps } + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideLeft + font { family: localFont.name; pointSize: 42; capitalization: Font.Capitalize } + } + Text { + text: { + if (webFont.status == FontLoader.Ready) myText + else if (webFont.status == FontLoader.Loading) "Loading..." + else if (webFont.status == FontLoader.Error) "Error loading font" + } + color: "lightsteelblue" + width: parent.width + elide: Text.ElideMiddle + font.family: webFont.name; font.pointSize: 42 + } + } +} diff --git a/examples/declarative/text/fonts/fonts/qml/fonts.qmlproject b/examples/declarative/text/fonts/fonts/qml/fonts.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/text/fonts/fonts/qml/fonts.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/text/fonts/fonts/qml/fonts/tarzeau_ocr_a.ttf b/examples/declarative/text/fonts/fonts/qml/fonts/tarzeau_ocr_a.ttf Binary files differnew file mode 100644 index 0000000..cf93f96 --- /dev/null +++ b/examples/declarative/text/fonts/fonts/qml/fonts/tarzeau_ocr_a.ttf diff --git a/examples/declarative/text/fonts/fonts/qml/hello.qml b/examples/declarative/text/fonts/fonts/qml/hello.qml new file mode 100644 index 0000000..3aaf0fe --- /dev/null +++ b/examples/declarative/text/fonts/fonts/qml/hello.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: screen + + width: 800; height: 480 + color: "black" + + Item { + id: container + x: screen.width / 2; y: screen.height / 2 + + Text { + id: text + anchors.centerIn: parent + color: "white" + text: "Hello world!" + font.pixelSize: 60 + smooth: true + + SequentialAnimation on font.letterSpacing { + loops: Animation.Infinite; + NumberAnimation { from: 0; to: 150; easing.type: Easing.InQuad; duration: 3000 } + ScriptAction { + script: { + container.y = (screen.height / 4) + (Math.random() * screen.height / 2) + container.x = (screen.width / 4) + (Math.random() * screen.width / 2) + } + } + } + + SequentialAnimation on opacity { + loops: Animation.Infinite; + NumberAnimation { from: 1; to: 0; duration: 2600 } + PauseAnimation { duration: 400 } + } + } + } +} diff --git a/examples/declarative/text/fonts/fonts/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/text/fonts/fonts/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/text/fonts/fonts/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/text/fonts/fonts/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/text/fonts/fonts/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/text/fonts/fonts/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/text/fonts/fonts/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/text/fonts/fonts/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/text/fonts/fonts/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/text/fonts/hello/hello.desktop b/examples/declarative/text/fonts/hello/hello.desktop new file mode 100644 index 0000000..ad55aad --- /dev/null +++ b/examples/declarative/text/fonts/hello/hello.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=hello +Exec=/opt/usr/bin/hello +Icon=hello +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/text/fonts/hello/hello.png b/examples/declarative/text/fonts/hello/hello.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/text/fonts/hello/hello.png diff --git a/examples/declarative/text/fonts/hello/hello.pro b/examples/declarative/text/fonts/hello/hello.pro new file mode 100644 index 0000000..a0b04be --- /dev/null +++ b/examples/declarative/text/fonts/hello/hello.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE4A6D856 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/text/fonts/hello/hello.svg b/examples/declarative/text/fonts/hello/hello.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/text/fonts/hello/hello.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/text/fonts/hello/main.cpp b/examples/declarative/text/fonts/hello/main.cpp new file mode 100644 index 0000000..293d7da --- /dev/null +++ b/examples/declarative/text/fonts/hello/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/hello.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/text/fonts/hello/qml/availableFonts.qml b/examples/declarative/text/fonts/hello/qml/availableFonts.qml new file mode 100644 index 0000000..4966a41 --- /dev/null +++ b/examples/declarative/text/fonts/hello/qml/availableFonts.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 480; height: 640; color: "steelblue" + + ListView { + anchors.fill: parent; model: Qt.fontFamilies() + + delegate: Item { + height: 40; width: ListView.view.width + Text { + anchors.centerIn: parent + text: modelData; font.family: modelData; font.pixelSize: 24; color: "white" + } + } + } +} diff --git a/examples/declarative/text/fonts/hello/qml/banner.qml b/examples/declarative/text/fonts/hello/qml/banner.qml new file mode 100644 index 0000000..d722468 --- /dev/null +++ b/examples/declarative/text/fonts/hello/qml/banner.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: screen + + property int pixelSize: screen.height * 1.25 + property color textColor: "lightsteelblue" + property string text: "Hello world! " + + width: 640; height: 320 + color: "steelblue" + + Row { + y: -screen.height / 4.5 + + NumberAnimation on x { from: 0; to: -text.width; duration: 6000; loops: Animation.Infinite } + Text { id: text; font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } + Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } + Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } + } +} diff --git a/examples/declarative/text/fonts/hello/qml/fonts.qml b/examples/declarative/text/fonts/hello/qml/fonts.qml new file mode 100644 index 0000000..ae48f24 --- /dev/null +++ b/examples/declarative/text/fonts/hello/qml/fonts.qml @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + property string myText: "The quick brown fox jumps over the lazy dog." + + width: 800; height: 480 + color: "steelblue" + + FontLoader { id: fixedFont; name: "Courier" } + FontLoader { id: localFont; source: "fonts/tarzeau_ocr_a.ttf" } + FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" } + + Column { + anchors { fill: parent; leftMargin: 10; rightMargin: 10 } + spacing: 15 + + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideRight + font.family: "Times"; font.pointSize: 42 + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideLeft + font { family: "Times"; pointSize: 42; capitalization: Font.AllUppercase } + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideMiddle + font { family: fixedFont.name; pointSize: 42; weight: Font.Bold; capitalization: Font.AllLowercase } + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideRight + font { family: fixedFont.name; pointSize: 42; italic: true; capitalization: Font.SmallCaps } + } + Text { + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideLeft + font { family: localFont.name; pointSize: 42; capitalization: Font.Capitalize } + } + Text { + text: { + if (webFont.status == FontLoader.Ready) myText + else if (webFont.status == FontLoader.Loading) "Loading..." + else if (webFont.status == FontLoader.Error) "Error loading font" + } + color: "lightsteelblue" + width: parent.width + elide: Text.ElideMiddle + font.family: webFont.name; font.pointSize: 42 + } + } +} diff --git a/examples/declarative/text/fonts/hello/qml/fonts.qmlproject b/examples/declarative/text/fonts/hello/qml/fonts.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/text/fonts/hello/qml/fonts.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/text/fonts/hello/qml/fonts/tarzeau_ocr_a.ttf b/examples/declarative/text/fonts/hello/qml/fonts/tarzeau_ocr_a.ttf Binary files differnew file mode 100644 index 0000000..cf93f96 --- /dev/null +++ b/examples/declarative/text/fonts/hello/qml/fonts/tarzeau_ocr_a.ttf diff --git a/examples/declarative/text/fonts/hello/qml/hello.qml b/examples/declarative/text/fonts/hello/qml/hello.qml new file mode 100644 index 0000000..3aaf0fe --- /dev/null +++ b/examples/declarative/text/fonts/hello/qml/hello.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: screen + + width: 800; height: 480 + color: "black" + + Item { + id: container + x: screen.width / 2; y: screen.height / 2 + + Text { + id: text + anchors.centerIn: parent + color: "white" + text: "Hello world!" + font.pixelSize: 60 + smooth: true + + SequentialAnimation on font.letterSpacing { + loops: Animation.Infinite; + NumberAnimation { from: 0; to: 150; easing.type: Easing.InQuad; duration: 3000 } + ScriptAction { + script: { + container.y = (screen.height / 4) + (Math.random() * screen.height / 2) + container.x = (screen.width / 4) + (Math.random() * screen.width / 2) + } + } + } + + SequentialAnimation on opacity { + loops: Animation.Infinite; + NumberAnimation { from: 1; to: 0; duration: 2600 } + PauseAnimation { duration: 400 } + } + } + } +} diff --git a/examples/declarative/text/fonts/hello/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/text/fonts/hello/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/text/fonts/hello/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/text/fonts/hello/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/text/fonts/hello/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/text/fonts/hello/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/text/fonts/hello/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/text/fonts/hello/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/text/fonts/hello/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/text/textselection/main.cpp b/examples/declarative/text/textselection/main.cpp new file mode 100644 index 0000000..4b670b6 --- /dev/null +++ b/examples/declarative/text/textselection/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/textselection.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/text/textselection/qml/pics/endHandle.png b/examples/declarative/text/textselection/qml/pics/endHandle.png Binary files differnew file mode 100644 index 0000000..1a4bc5d --- /dev/null +++ b/examples/declarative/text/textselection/qml/pics/endHandle.png diff --git a/examples/declarative/text/textselection/qml/pics/endHandle.sci b/examples/declarative/text/textselection/qml/pics/endHandle.sci new file mode 100644 index 0000000..4f51f24 --- /dev/null +++ b/examples/declarative/text/textselection/qml/pics/endHandle.sci @@ -0,0 +1,5 @@ +border.left: 0 +border.top: 6 +border.bottom: 6 +border.right: 6 +source: endHandle.png diff --git a/examples/declarative/text/textselection/qml/pics/startHandle.png b/examples/declarative/text/textselection/qml/pics/startHandle.png Binary files differnew file mode 100644 index 0000000..deedcd5 --- /dev/null +++ b/examples/declarative/text/textselection/qml/pics/startHandle.png diff --git a/examples/declarative/text/textselection/qml/pics/startHandle.sci b/examples/declarative/text/textselection/qml/pics/startHandle.sci new file mode 100644 index 0000000..f9eae20 --- /dev/null +++ b/examples/declarative/text/textselection/qml/pics/startHandle.sci @@ -0,0 +1,5 @@ +border.left: 6 +border.top: 6 +border.bottom: 6 +border.right: 0 +source: startHandle.png diff --git a/examples/declarative/text/textselection/qml/textselection.qml b/examples/declarative/text/textselection/qml/textselection.qml new file mode 100644 index 0000000..f343be5 --- /dev/null +++ b/examples/declarative/text/textselection/qml/textselection.qml @@ -0,0 +1,290 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 1.0 + +Rectangle { + id: editor + color: "lightGrey" + width: 640; height: 480 + + Rectangle { + color: "white" + anchors.fill: parent + anchors.margins: 20 + + BorderImage { + id: startHandle + source: "pics/startHandle.sci" + opacity: 0.0 + width: 10 + x: edit.positionToRectangle(edit.selectionStart).x - flick.contentX-width + y: edit.positionToRectangle(edit.selectionStart).y - flick.contentY + height: edit.positionToRectangle(edit.selectionStart).height + } + + BorderImage { + id: endHandle + source: "pics/endHandle.sci" + opacity: 0.0 + width: 10 + x: edit.positionToRectangle(edit.selectionEnd).x - flick.contentX + y: edit.positionToRectangle(edit.selectionEnd).y - flick.contentY + height: edit.positionToRectangle(edit.selectionEnd).height + } + + Flickable { + id: flick + + anchors.fill: parent + contentWidth: edit.paintedWidth + contentHeight: edit.paintedHeight + interactive: true + clip: true + + function ensureVisible(r) { + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + + TextEdit { + id: edit + width: flick.width + height: flick.height + focus: true + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) + + text: "<h1>Text Selection</h1>" + +"<p>This example is a whacky text selection mechanisms, showing how these can be implemented in the TextEdit element, to cater for whatever style is appropriate for the target platform." + +"<p><b>Press-and-hold</b> to select a word, then drag the selection handles." + +"<p><b>Drag outside the selection</b> to scroll the text." + +"<p><b>Click inside the selection</b> to cut/copy/paste/cancel selection." + +"<p>It's too whacky to let you paste if there is no current selection." + + MouseArea { + property string drag: "" + property int pressPos + + x: -startHandle.width + y: 0 + width: parent.width+startHandle.width+endHandle.width + height: parent.height + + onPressAndHold: { + if (editor.state == "") { + edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y); + edit.selectWord(); + editor.state = "selection" + } + } + + onClicked: { + if (editor.state == "") { + edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y); + if (!edit.focus) + edit.focus = true; + edit.openSoftwareInputPanel(); + } + } + + function hitHandle(h,x,y) { + return x>=h.x+flick.contentX && x<h.x+flick.contentX+h.width && y>=h.y+flick.contentY && y<h.y+flick.contentY+h.height + } + + onPressed: { + if (editor.state == "selection") { + if (hitHandle(startHandle,mouse.x+x,mouse.y+y)) { + drag = "start" + flick.interactive = false + } else if (hitHandle(endHandle,mouse.x+x,mouse.y+y)) { + drag = "end" + flick.interactive = false + } else { + var pos = edit.positionAt(mouse.x+x,mouse.y+y); + if (pos >= edit.selectionStart && pos <= edit.selectionEnd) { + drag = "selection" + flick.interactive = false + } else { + drag = "" + flick.interactive = true + } + } + } + } + + onReleased: { + if (editor.state == "selection") { + if (drag == "selection") { + editor.state = "menu" + } + drag = "" + } + flick.interactive = true + } + + onPositionChanged: { + if (editor.state == "selection" && drag != "") { + if (drag == "start") { + var pos = edit.positionAt(mouse.x+x+startHandle.width/2,mouse.y+y); + var e = edit.selectionEnd; + if (e < pos) + e = pos; + edit.select(pos,e); + } else if (drag == "end") { + var pos = edit.positionAt(mouse.x+x-endHandle.width/2,mouse.y+y); + var s = edit.selectionStart; + if (s > pos) + s = pos; + edit.select(s,pos); + } + } + } + } + } + } + + Item { + id: menu + opacity: 0.0 + width: 100 + height: 120 + anchors.centerIn: parent + + Rectangle { + border.width: 1 + border.color: "darkBlue" + radius: 15 + color: "#806080FF" + anchors.fill: parent + } + + Column { + anchors.centerIn: parent + spacing: 8 + + Rectangle { + border.width: 1 + border.color: "darkBlue" + color: "#ff7090FF" + width: 60 + height: 16 + + Text { anchors.centerIn: parent; text: "Cut" } + + MouseArea { + anchors.fill: parent + onClicked: { edit.cut(); editor.state = "" } + } + } + + Rectangle { + border.width: 1 + border.color: "darkBlue" + color: "#ff7090FF" + width: 60 + height: 16 + + Text { anchors.centerIn: parent; text: "Copy" } + + MouseArea { + anchors.fill: parent + onClicked: { edit.copy(); editor.state = "selection" } + } + } + + Rectangle { + border.width: 1 + border.color: "darkBlue" + color: "#ff7090FF" + width: 60 + height: 16 + + Text { anchors.centerIn: parent; text: "Paste" } + + MouseArea { + anchors.fill: parent + onClicked: { edit.paste(); edit.cursorPosition = edit.selectionEnd; editor.state = "" } + } + } + + Rectangle { + border.width: 1 + border.color: "darkBlue" + color: "#ff7090FF" + width: 60 + height: 16 + + Text { anchors.centerIn: parent; text: "Deselect" } + + MouseArea { + anchors.fill: parent + onClicked: { + edit.cursorPosition = edit.selectionEnd; + edit.select(edit.cursorPosition, edit.cursorPosition); + editor.state = "" + } + } + } + } + } + } + + states: [ + State { + name: "selection" + PropertyChanges { target: startHandle; opacity: 1.0 } + PropertyChanges { target: endHandle; opacity: 1.0 } + }, + State { + name: "menu" + PropertyChanges { target: startHandle; opacity: 0.5 } + PropertyChanges { target: endHandle; opacity: 0.5 } + PropertyChanges { target: menu; opacity: 1.0 } + } + ] +} diff --git a/examples/declarative/text/textselection/qml/textselection.qmlproject b/examples/declarative/text/textselection/qml/textselection.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/text/textselection/qml/textselection.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/text/textselection/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/text/textselection/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/text/textselection/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/text/textselection/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/text/textselection/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/text/textselection/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/text/textselection/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/text/textselection/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/text/textselection/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/text/textselection/textselection.desktop b/examples/declarative/text/textselection/textselection.desktop new file mode 100644 index 0000000..87e2ac0 --- /dev/null +++ b/examples/declarative/text/textselection/textselection.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=textselection +Exec=/opt/usr/bin/textselection +Icon=textselection +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/text/textselection/textselection.png b/examples/declarative/text/textselection/textselection.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/text/textselection/textselection.png diff --git a/examples/declarative/text/textselection/textselection.pro b/examples/declarative/text/textselection/textselection.pro new file mode 100644 index 0000000..17543a13 --- /dev/null +++ b/examples/declarative/text/textselection/textselection.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEFBED80D + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/text/textselection/textselection.svg b/examples/declarative/text/textselection/textselection.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/text/textselection/textselection.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.desktop b/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.desktop new file mode 100644 index 0000000..aa5062e --- /dev/null +++ b/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=experimental-gestures +Exec=/opt/usr/bin/experimental-gestures +Icon=experimental-gestures +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.png b/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.png diff --git a/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.pro b/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.pro new file mode 100644 index 0000000..8f98940 --- /dev/null +++ b/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE3FF6816 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.svg b/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/touchinteraction/gestures/experimental-gestures/experimentalgestures.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/touchinteraction/gestures/experimental-gestures/main.cpp b/examples/declarative/touchinteraction/gestures/experimental-gestures/main.cpp new file mode 100644 index 0000000..bdbf6a7 --- /dev/null +++ b/examples/declarative/touchinteraction/gestures/experimental-gestures/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/experimental-gestures.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/touchinteraction/gestures/experimental-gestures/qml/experimental-gestures.qml b/examples/declarative/touchinteraction/gestures/experimental-gestures/qml/experimental-gestures.qml new file mode 100644 index 0000000..6a4cb3d --- /dev/null +++ b/examples/declarative/touchinteraction/gestures/experimental-gestures/qml/experimental-gestures.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import Qt.labs.gestures 1.0 + +// Only works on platforms with Touch support. + +Rectangle { + id: rect + width: 320 + height: 180 + + Text { + anchors.centerIn: parent + text: "Tap / TapAndHold / Pan / Pinch / Swipe\nOnly works on platforms with Touch support." + horizontalAlignment: Text.Center + } + + GestureArea { + anchors.fill: parent + focus: true + + // Only some of the many gesture properties are shown. See Gesture documentation. + + onTap: + console.log("tap pos = (",gesture.position.x,",",gesture.position.y,")") + onTapAndHold: + console.log("tap and hold pos = (",gesture.position.x,",",gesture.position.y,")") + onPan: + console.log("pan delta = (",gesture.delta.x,",",gesture.delta.y,") acceleration = ",gesture.acceleration) + onPinch: + console.log("pinch center = (",gesture.centerPoint.x,",",gesture.centerPoint.y,") rotation =",gesture.rotationAngle," scale =",gesture.scaleFactor) + onSwipe: + console.log("swipe angle=",gesture.swipeAngle) + onGesture: + console.log("gesture hot spot = (",gesture.hotSpot.x,",",gesture.hotSpot.y,")") + } +} diff --git a/examples/declarative/touchinteraction/gestures/experimental-gestures/qml/gestures.qmlproject b/examples/declarative/touchinteraction/gestures/experimental-gestures/qml/gestures.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/touchinteraction/gestures/experimental-gestures/qml/gestures.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/touchinteraction/gestures/experimental-gestures/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/touchinteraction/gestures/experimental-gestures/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/touchinteraction/gestures/experimental-gestures/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/touchinteraction/gestures/experimental-gestures/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/touchinteraction/gestures/experimental-gestures/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/touchinteraction/gestures/experimental-gestures/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/touchinteraction/gestures/experimental-gestures/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/touchinteraction/gestures/experimental-gestures/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/touchinteraction/gestures/experimental-gestures/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example/main.cpp b/examples/declarative/touchinteraction/mousearea/mousearea-example/main.cpp new file mode 100644 index 0000000..6c3c47e --- /dev/null +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/mousearea-example.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.desktop b/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.desktop new file mode 100644 index 0000000..2306ece --- /dev/null +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=mousearea-example +Exec=/opt/usr/bin/mousearea-example +Icon=mousearea-example +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.png b/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.png diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.pro b/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.pro new file mode 100644 index 0000000..2d20e3d --- /dev/null +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xECA7EEBE + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.svg b/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example/mouseareaexample.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example/qml/mousearea-example.qml b/examples/declarative/touchinteraction/mousearea/mousearea-example/qml/mousearea-example.qml new file mode 100644 index 0000000..8dacc05 --- /dev/null +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example/qml/mousearea-example.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: box + width: 350; height: 250 + + Rectangle { + id: redSquare + width: 80; height: 80 + anchors.top: parent.top; anchors.left: parent.left; anchors.margins: 10 + color: "red" + + Text { text: "Click"; font.pixelSize: 16; anchors.centerIn: parent } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton + + onEntered: info.text = 'Entered' + onExited: info.text = 'Exited (pressed=' + pressed + ')' + + onPressed: { + info.text = 'Pressed (button=' + (mouse.button == Qt.RightButton ? 'right' : 'left') + + ' shift=' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')' + var posInBox = redSquare.mapToItem(box, mouse.x, mouse.y) + posInfo.text = + mouse.x + ',' + mouse.y + ' in square' + + ' (' + posInBox.x + ',' + posInBox.y + ' in window)' + } + + onReleased: { + info.text = 'Released (isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')' + posInfo.text = '' + } + + onPressAndHold: info.text = 'Press and hold' + onClicked: info.text = 'Clicked (wasHeld=' + mouse.wasHeld + ')' + onDoubleClicked: info.text = 'Double clicked' + } + } + + Rectangle { + id: blueSquare + width: 80; height: 80 + x: box.width - width - 10; y: 10 // making this item draggable, so don't use anchors + color: "blue" + + Text { text: "Drag"; font.pixelSize: 16; color: "white"; anchors.centerIn: parent } + + MouseArea { + anchors.fill: parent + drag.target: blueSquare + drag.axis: Drag.XandYAxis + drag.minimumX: 0 + drag.maximumX: box.width - parent.width + drag.minimumY: 0 + drag.maximumY: box.height - parent.width + } + } + + Text { + id: info + anchors.bottom: posInfo.top; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30 + + onTextChanged: console.log(text) + } + + Text { + id: posInfo + anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30 + } +} diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example/qml/mousearea.qmlproject b/examples/declarative/touchinteraction/mousearea/mousearea-example/qml/mousearea.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example/qml/mousearea.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/touchinteraction/mousearea/mousearea-example/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/touchinteraction/mousearea/mousearea-example/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/touchinteraction/mousearea/mousearea-example/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/touchinteraction/mousearea/mousearea-example/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/touchinteraction/mousearea/mousearea-example/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/touchinteraction/touchinteraction.pro b/examples/declarative/touchinteraction/touchinteraction.pro new file mode 100644 index 0000000..1beaeab --- /dev/null +++ b/examples/declarative/touchinteraction/touchinteraction.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +SUBDIRS = gestures \ + mousearea \ + pincharea diff --git a/examples/declarative/toys/clocks/clocks.desktop b/examples/declarative/toys/clocks/clocks.desktop new file mode 100644 index 0000000..96afae6 --- /dev/null +++ b/examples/declarative/toys/clocks/clocks.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=clocks +Exec=/opt/usr/bin/clocks +Icon=clocks +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/toys/clocks/clocks.png b/examples/declarative/toys/clocks/clocks.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/toys/clocks/clocks.png diff --git a/examples/declarative/toys/clocks/clocks.pro b/examples/declarative/toys/clocks/clocks.pro new file mode 100644 index 0000000..8137121 --- /dev/null +++ b/examples/declarative/toys/clocks/clocks.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE96223F9 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/toys/clocks/clocks.svg b/examples/declarative/toys/clocks/clocks.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/toys/clocks/clocks.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/toys/clocks/main.cpp b/examples/declarative/toys/clocks/main.cpp new file mode 100644 index 0000000..2952238 --- /dev/null +++ b/examples/declarative/toys/clocks/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/clocks.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/toys/clocks/qml/clocks.qml b/examples/declarative/toys/clocks/qml/clocks.qml new file mode 100644 index 0000000..3354f11 --- /dev/null +++ b/examples/declarative/toys/clocks/qml/clocks.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + width: 640; height: 240 + color: "#646464" + + Row { + anchors.centerIn: parent + Clock { city: "New York"; shift: -4 } + Clock { city: "Mumbai"; shift: 5.5 } + Clock { city: "Tokyo"; shift: 9 } + } + QuitButton { + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: 10 + } +} diff --git a/examples/declarative/toys/clocks/qml/clocks.qmlproject b/examples/declarative/toys/clocks/qml/clocks.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/toys/clocks/qml/clocks.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/toys/clocks/qml/content/Clock.qml b/examples/declarative/toys/clocks/qml/content/Clock.qml new file mode 100644 index 0000000..09e8393 --- /dev/null +++ b/examples/declarative/toys/clocks/qml/content/Clock.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: clock + width: 200; height: 230 + + property alias city: cityLabel.text + property int hours + property int minutes + property int seconds + property real shift + property bool night: false + + function timeChanged() { + var date = new Date; + hours = shift ? date.getUTCHours() + Math.floor(clock.shift) : date.getHours() + night = ( hours < 7 || hours > 19 ) + minutes = shift ? date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes() + seconds = date.getUTCSeconds(); + } + + Timer { + interval: 100; running: true; repeat: true; + onTriggered: clock.timeChanged() + } + + Image { id: background; source: "clock.png"; visible: clock.night == false } + Image { source: "clock-night.png"; visible: clock.night == true } + + + Image { + x: 92.5; y: 27 + source: "hour.png" + smooth: true + transform: Rotation { + id: hourRotation + origin.x: 7.5; origin.y: 73; + angle: (clock.hours * 30) + (clock.minutes * 0.5) + Behavior on angle { + SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } + } + } + } + + Image { + x: 93.5; y: 17 + source: "minute.png" + smooth: true + transform: Rotation { + id: minuteRotation + origin.x: 6.5; origin.y: 83; + angle: clock.minutes * 6 + Behavior on angle { + SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } + } + } + } + + Image { + x: 97.5; y: 20 + source: "second.png" + smooth: true + transform: Rotation { + id: secondRotation + origin.x: 2.5; origin.y: 80; + angle: clock.seconds * 6 + Behavior on angle { + SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } + } + } + } + + Image { + anchors.centerIn: background; source: "center.png" + } + + Text { + id: cityLabel + y: 200; anchors.horizontalCenter: parent.horizontalCenter + color: "white" + font.bold: true; font.pixelSize: 14 + style: Text.Raised; styleColor: "black" + } +} diff --git a/examples/declarative/toys/clocks/qml/content/QuitButton.qml b/examples/declarative/toys/clocks/qml/content/QuitButton.qml new file mode 100644 index 0000000..cbbf916 --- /dev/null +++ b/examples/declarative/toys/clocks/qml/content/QuitButton.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +Image { + source: "quit.png" + scale: quitMouse.pressed ? 0.8 : 1.0 + smooth: quitMouse.pressed + MouseArea { + id: quitMouse + anchors.fill: parent + anchors.margins: -10 + onClicked: Qt.quit() + } +} diff --git a/examples/declarative/toys/clocks/qml/content/background.png b/examples/declarative/toys/clocks/qml/content/background.png Binary files differnew file mode 100644 index 0000000..a885950 --- /dev/null +++ b/examples/declarative/toys/clocks/qml/content/background.png diff --git a/examples/declarative/toys/clocks/qml/content/center.png b/examples/declarative/toys/clocks/qml/content/center.png Binary files differnew file mode 100644 index 0000000..7fbd802 --- /dev/null +++ b/examples/declarative/toys/clocks/qml/content/center.png diff --git a/examples/declarative/toys/clocks/qml/content/clock-night.png b/examples/declarative/toys/clocks/qml/content/clock-night.png Binary files differnew file mode 100644 index 0000000..cc7151a --- /dev/null +++ b/examples/declarative/toys/clocks/qml/content/clock-night.png diff --git a/examples/declarative/toys/clocks/qml/content/clock.png b/examples/declarative/toys/clocks/qml/content/clock.png Binary files differnew file mode 100644 index 0000000..462edac --- /dev/null +++ b/examples/declarative/toys/clocks/qml/content/clock.png diff --git a/examples/declarative/toys/clocks/qml/content/hour.png b/examples/declarative/toys/clocks/qml/content/hour.png Binary files differnew file mode 100644 index 0000000..f8061a1 --- /dev/null +++ b/examples/declarative/toys/clocks/qml/content/hour.png diff --git a/examples/declarative/toys/clocks/qml/content/minute.png b/examples/declarative/toys/clocks/qml/content/minute.png Binary files differnew file mode 100644 index 0000000..1297ec7 --- /dev/null +++ b/examples/declarative/toys/clocks/qml/content/minute.png diff --git a/examples/declarative/toys/clocks/qml/content/quit.png b/examples/declarative/toys/clocks/qml/content/quit.png Binary files differnew file mode 100644 index 0000000..b822057 --- /dev/null +++ b/examples/declarative/toys/clocks/qml/content/quit.png diff --git a/examples/declarative/toys/clocks/qml/content/second.png b/examples/declarative/toys/clocks/qml/content/second.png Binary files differnew file mode 100644 index 0000000..4aa9fb5 --- /dev/null +++ b/examples/declarative/toys/clocks/qml/content/second.png diff --git a/examples/declarative/toys/clocks/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/toys/clocks/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/toys/clocks/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/toys/clocks/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/toys/clocks/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/toys/clocks/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/toys/clocks/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/toys/clocks/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/toys/clocks/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/toys/corkboards/corkboards.desktop b/examples/declarative/toys/corkboards/corkboards.desktop new file mode 100644 index 0000000..fcd2002 --- /dev/null +++ b/examples/declarative/toys/corkboards/corkboards.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=corkboards +Exec=/opt/usr/bin/corkboards +Icon=corkboards +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/toys/corkboards/corkboards.png b/examples/declarative/toys/corkboards/corkboards.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/toys/corkboards/corkboards.png diff --git a/examples/declarative/toys/corkboards/corkboards.pro b/examples/declarative/toys/corkboards/corkboards.pro new file mode 100644 index 0000000..9ea89f0 --- /dev/null +++ b/examples/declarative/toys/corkboards/corkboards.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEAF97D84 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/toys/corkboards/corkboards.svg b/examples/declarative/toys/corkboards/corkboards.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/toys/corkboards/corkboards.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/toys/corkboards/main.cpp b/examples/declarative/toys/corkboards/main.cpp new file mode 100644 index 0000000..38eb712 --- /dev/null +++ b/examples/declarative/toys/corkboards/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/corkboards.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/toys/corkboards/qml/Day.qml b/examples/declarative/toys/corkboards/qml/Day.qml new file mode 100644 index 0000000..6afa12e --- /dev/null +++ b/examples/declarative/toys/corkboards/qml/Day.qml @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Component { + Item { + property variant stickies + + id: page + width: ListView.view.width+40; height: ListView.view.height + + + Image { + source: "cork.jpg" + width: page.ListView.view.width + height: page.ListView.view.height + fillMode: Image.PreserveAspectCrop + clip: true + } + + MouseArea { + anchors.fill: parent + onClicked: page.focus = false; + } + + Text { + text: name; x: 15; y: 8; height: 40; width: 370 + font.pixelSize: 18; font.bold: true; color: "white" + style: Text.Outline; styleColor: "black" + } + + Repeater { + model: notes + Item { + id: stickyPage + + property int randomX: Math.random() * (page.ListView.view.width-0.5*stickyImage.width) +100 + property int randomY: Math.random() * (page.ListView.view.height-0.5*stickyImage.height) +50 + + x: randomX; y: randomY + + rotation: -flickable.horizontalVelocity / 100; + Behavior on rotation { + SpringAnimation { spring: 2.0; damping: 0.15 } + } + + Item { + id: sticky + scale: 0.7 + + Image { + id: stickyImage + x: 8 + -width * 0.6 / 2; y: -20 + source: "note-yellow.png" + scale: 0.6; transformOrigin: Item.TopLeft + smooth: true + } + + TextEdit { + id: myText + x: -104; y: 36; width: 215; height: 200 + smooth: true + font.pixelSize: 24 + readOnly: false + rotation: -8 + text: noteText + } + + Item { + x: stickyImage.x; y: -20 + width: stickyImage.width * stickyImage.scale + height: stickyImage.height * stickyImage.scale + + MouseArea { + id: mouse + anchors.fill: parent + drag.target: stickyPage + drag.axis: Drag.XandYAxis + drag.minimumY: 0 + drag.maximumY: page.height - 80 + drag.minimumX: 100 + drag.maximumX: page.width - 140 + onClicked: { myText.focus = true; myText.openSoftwareInputPanel(); } + } + } + } + + Image { + x: -width / 2; y: -height * 0.5 / 2 + source: "tack.png" + scale: 0.7; transformOrigin: Item.TopLeft + } + + states: State { + name: "pressed" + when: mouse.pressed + PropertyChanges { target: sticky; rotation: 8; scale: 1 } + PropertyChanges { target: page; z: 8 } + } + + transitions: Transition { + NumberAnimation { properties: "rotation,scale"; duration: 200 } + } + } + } + } +} + + + + + + + + diff --git a/examples/declarative/toys/corkboards/qml/cork.jpg b/examples/declarative/toys/corkboards/qml/cork.jpg Binary files differnew file mode 100644 index 0000000..160bc00 --- /dev/null +++ b/examples/declarative/toys/corkboards/qml/cork.jpg diff --git a/examples/declarative/toys/corkboards/qml/corkboards.qml b/examples/declarative/toys/corkboards/qml/corkboards.qml new file mode 100644 index 0000000..14bc5f0 --- /dev/null +++ b/examples/declarative/toys/corkboards/qml/corkboards.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 800; height: 480 + color: "#464646" + + ListModel { + id: list + + ListElement { + name: "Sunday" + notes: [ + ListElement { noteText: "Lunch" }, + ListElement { noteText: "Birthday Party" } + ] + } + + ListElement { + name: "Monday" + notes: [ + ListElement { noteText: "Pickup kids from\nschool\n4.30pm" }, + ListElement { noteText: "Checkout Qt" }, ListElement { noteText: "Read email" } + ] + } + + ListElement { + name: "Tuesday" + notes: [ + ListElement { noteText: "Walk dog" }, + ListElement { noteText: "Buy newspaper" } + ] + } + + ListElement { + name: "Wednesday" + notes: [ ListElement { noteText: "Cook dinner" } ] + } + + ListElement { + name: "Thursday" + notes: [ + ListElement { noteText: "Meeting\n5.30pm" }, + ListElement { noteText: "Weed garden" } + ] + } + + ListElement { + name: "Friday" + notes: [ + ListElement { noteText: "More work" }, + ListElement { noteText: "Grocery shopping" } + ] + } + + ListElement { + name: "Saturday" + notes: [ + ListElement { noteText: "Drink" }, + ListElement { noteText: "Download Qt\nPlay with QML" } + ] + } + } + + ListView { + id: flickable + + anchors.fill: parent + focus: true + highlightRangeMode: ListView.StrictlyEnforceRange + orientation: ListView.Horizontal + snapMode: ListView.SnapOneItem + model: list + delegate: Day { } + } +} diff --git a/examples/declarative/toys/corkboards/qml/corkboards.qmlproject b/examples/declarative/toys/corkboards/qml/corkboards.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/toys/corkboards/qml/corkboards.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/toys/corkboards/qml/note-yellow.png b/examples/declarative/toys/corkboards/qml/note-yellow.png Binary files differnew file mode 100644 index 0000000..8ddecc8 --- /dev/null +++ b/examples/declarative/toys/corkboards/qml/note-yellow.png diff --git a/examples/declarative/toys/corkboards/qml/tack.png b/examples/declarative/toys/corkboards/qml/tack.png Binary files differnew file mode 100644 index 0000000..cef2d1c --- /dev/null +++ b/examples/declarative/toys/corkboards/qml/tack.png diff --git a/examples/declarative/toys/corkboards/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/toys/corkboards/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/toys/corkboards/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/toys/corkboards/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/toys/corkboards/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/toys/corkboards/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/toys/corkboards/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/toys/corkboards/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/toys/corkboards/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/toys/dynamicscene/dynamicscene.desktop b/examples/declarative/toys/dynamicscene/dynamicscene.desktop new file mode 100644 index 0000000..c5170c6 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/dynamicscene.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=dynamicscene +Exec=/opt/usr/bin/dynamicscene +Icon=dynamicscene +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/toys/dynamicscene/dynamicscene.png b/examples/declarative/toys/dynamicscene/dynamicscene.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/dynamicscene.png diff --git a/examples/declarative/toys/dynamicscene/dynamicscene.pro b/examples/declarative/toys/dynamicscene/dynamicscene.pro new file mode 100644 index 0000000..1359c55 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/dynamicscene.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEE509F2D + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/toys/dynamicscene/dynamicscene.svg b/examples/declarative/toys/dynamicscene/dynamicscene.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/toys/dynamicscene/dynamicscene.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/toys/dynamicscene/main.cpp b/examples/declarative/toys/dynamicscene/main.cpp new file mode 100644 index 0000000..77e279f --- /dev/null +++ b/examples/declarative/toys/dynamicscene/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/dynamicscene.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/toys/dynamicscene/qml/dynamicscene.qml b/examples/declarative/toys/dynamicscene/qml/dynamicscene.qml new file mode 100644 index 0000000..5f14e1d --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/dynamicscene.qml @@ -0,0 +1,223 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import Qt.labs.particles 1.0 +import "qml" + +Item { + id: window + + property int activeSuns: 0 + + //This is a desktop-sized example + width: 800; height: 480 + + + MouseArea { + anchors.fill: parent + onClicked: window.focus = false; + } + + //This is the message box that pops up when there's an error + Rectangle { + id: dialog + + opacity: 0 + anchors.centerIn: parent + width: dialogText.width + 6; height: dialogText.height + 6 + border.color: 'black' + color: 'lightsteelblue' + z: 65535 //Arbitrary number chosen to be above all the items, including the scaled perspective ones. + + function show(str){ + dialogText.text = str; + dialogAnim.start(); + } + + Text { + id: dialogText + x: 3; y: 3 + font.pixelSize: 14 + } + + SequentialAnimation { + id: dialogAnim + NumberAnimation { target: dialog; property:"opacity"; to: 1; duration: 1000 } + PauseAnimation { duration: 5000 } + NumberAnimation { target: dialog; property:"opacity"; to: 0; duration: 1000 } + } + } + + // sky + Rectangle { + id: sky + anchors { left: parent.left; top: parent.top; right: toolbox.right; bottom: parent.verticalCenter } + gradient: Gradient { + GradientStop { id: gradientStopA; position: 0.0; color: "#0E1533" } + GradientStop { id: gradientStopB; position: 1.0; color: "#437284" } + } + } + + // stars (when there's no sun) + Particles { + id: stars + x: 0; y: 0; width: parent.width; height: parent.height / 2 + source: "images/star.png" + angleDeviation: 360 + velocity: 0; velocityDeviation: 0 + count: parent.width / 10 + fadeInDuration: 2800 + opacity: 1 + } + + // ground + Rectangle { + id: ground + z: 2 // just above the sun so that the sun can set behind it + anchors { left: parent.left; top: parent.verticalCenter; right: toolbox.left; bottom: parent.bottom } + gradient: Gradient { + GradientStop { position: 0.0; color: "ForestGreen" } + GradientStop { position: 1.0; color: "DarkGreen" } + } + } + + SystemPalette { id: activePalette } + + // right-hand panel + Rectangle { + id: toolbox + + width: 380 + color: activePalette.window + anchors { right: parent.right; top: parent.top; bottom: parent.bottom } + + Column { + anchors.centerIn: parent + spacing: 8 + + Text { text: "Drag an item into the scene." } + + Rectangle { + width: palette.width + 10; height: palette.height + 10 + border.color: "black" + + Row { + id: palette + anchors.centerIn: parent + spacing: 8 + + PaletteItem { + anchors.verticalCenter: parent.verticalCenter + componentFile: "Sun.qml" + image: "../images/sun.png" + } + PaletteItem { + anchors.verticalCenter: parent.verticalCenter + componentFile: "GenericSceneItem.qml" + image: "../images/moon.png" + } + PaletteItem { + anchors.verticalCenter: parent.verticalCenter + componentFile: "PerspectiveItem.qml" + image: "../images/tree_s.png" + } + PaletteItem { + anchors.verticalCenter: parent.verticalCenter + componentFile: "PerspectiveItem.qml" + image: "../images/rabbit_brown.png" + } + PaletteItem { + anchors.verticalCenter: parent.verticalCenter + componentFile: "PerspectiveItem.qml" + image: "../images/rabbit_bw.png" + } + } + } + + Text { text: "Active Suns: " + activeSuns } + + Rectangle { width: parent.width; height: 1; color: "black" } + + Text { text: "Arbitrary QML:" } + + Rectangle { + width: 360; height: 240 + + TextEdit { + id: qmlText + anchors.fill: parent; anchors.margins: 5 + readOnly: false + font.pixelSize: 14 + wrapMode: TextEdit.WordWrap + + text: "import QtQuick 1.0\nImage {\n id: smile\n x: 360 * Math.random()\n y: 180 * Math.random() \n source: 'images/face-smile.png'\n NumberAnimation on opacity { \n to: 0; duration: 1500\n }\n Component.onCompleted: smile.destroy(1500);\n}" + } + } + + Button { + text: "Create" + onClicked: { + try { + Qt.createQmlObject(qmlText.text, window, 'CustomObject'); + } catch(err) { + dialog.show('Error on line ' + err.qmlErrors[0].lineNumber + '\n' + err.qmlErrors[0].message); + } + } + } + } + } + + //Day state, for when a sun is added to the scene + states: State { + name: "Day" + when: window.activeSuns > 0 + + PropertyChanges { target: gradientStopA; color: "DeepSkyBlue" } + PropertyChanges { target: gradientStopB; color: "SkyBlue" } + PropertyChanges { target: stars; opacity: 0 } + } + + transitions: Transition { + PropertyAnimation { duration: 3000 } + ColorAnimation { duration: 3000 } + } + +} diff --git a/examples/declarative/toys/dynamicscene/qml/dynamicscene.qmlproject b/examples/declarative/toys/dynamicscene/qml/dynamicscene.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/dynamicscene.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/toys/dynamicscene/qml/images/NOTE b/examples/declarative/toys/dynamicscene/qml/images/NOTE new file mode 100644 index 0000000..fcd87f9 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/images/NOTE @@ -0,0 +1 @@ +Images (except star.png) are from the KDE project. diff --git a/examples/declarative/toys/dynamicscene/qml/images/face-smile.png b/examples/declarative/toys/dynamicscene/qml/images/face-smile.png Binary files differnew file mode 100644 index 0000000..3d66d72 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/images/face-smile.png diff --git a/examples/declarative/toys/dynamicscene/qml/images/moon.png b/examples/declarative/toys/dynamicscene/qml/images/moon.png Binary files differnew file mode 100644 index 0000000..1c0d606 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/images/moon.png diff --git a/examples/declarative/toys/dynamicscene/qml/images/rabbit_brown.png b/examples/declarative/toys/dynamicscene/qml/images/rabbit_brown.png Binary files differnew file mode 100644 index 0000000..ebfdeed --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/images/rabbit_brown.png diff --git a/examples/declarative/toys/dynamicscene/qml/images/rabbit_bw.png b/examples/declarative/toys/dynamicscene/qml/images/rabbit_bw.png Binary files differnew file mode 100644 index 0000000..7bff9b9 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/images/rabbit_bw.png diff --git a/examples/declarative/toys/dynamicscene/qml/images/star.png b/examples/declarative/toys/dynamicscene/qml/images/star.png Binary files differnew file mode 100644 index 0000000..27ef924 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/images/star.png diff --git a/examples/declarative/toys/dynamicscene/qml/images/sun.png b/examples/declarative/toys/dynamicscene/qml/images/sun.png Binary files differnew file mode 100644 index 0000000..7713ca5 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/images/sun.png diff --git a/examples/declarative/toys/dynamicscene/qml/images/tree_s.png b/examples/declarative/toys/dynamicscene/qml/images/tree_s.png Binary files differnew file mode 100644 index 0000000..6eac35a --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/images/tree_s.png diff --git a/examples/declarative/toys/dynamicscene/qml/qml/Button.qml b/examples/declarative/toys/dynamicscene/qml/qml/Button.qml new file mode 100644 index 0000000..8da799e --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/qml/Button.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: container + + property variant text + signal clicked + + height: text.height + 10; width: text.width + 20 + border.width: 1 + radius: 4 + smooth: true + + gradient: Gradient { + GradientStop { + position: 0.0 + color: !mouseArea.pressed ? activePalette.light : activePalette.button + } + GradientStop { + position: 1.0 + color: !mouseArea.pressed ? activePalette.button : activePalette.dark + } + } + + SystemPalette { id: activePalette } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: container.clicked() + } + + Text { + id: text + anchors.centerIn:parent + font.pointSize: 10 + text: parent.text + color: activePalette.buttonText + } +} diff --git a/examples/declarative/toys/dynamicscene/qml/qml/GenericSceneItem.qml b/examples/declarative/toys/dynamicscene/qml/qml/GenericSceneItem.qml new file mode 100644 index 0000000..7391412 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/qml/GenericSceneItem.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + property bool created: false + property string image + + source: image + +} diff --git a/examples/declarative/toys/dynamicscene/qml/qml/PaletteItem.qml b/examples/declarative/toys/dynamicscene/qml/qml/PaletteItem.qml new file mode 100644 index 0000000..cf5395f --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/qml/PaletteItem.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "itemCreation.js" as Code + +Image { + id: paletteItem + + property string componentFile + property string image + + source: image + + MouseArea { + anchors.fill: parent + + onPressed: Code.startDrag(mouse); + onPositionChanged: Code.continueDrag(mouse); + onReleased: Code.endDrag(mouse); + } +} diff --git a/examples/declarative/toys/dynamicscene/qml/qml/PerspectiveItem.qml b/examples/declarative/toys/dynamicscene/qml/qml/PerspectiveItem.qml new file mode 100644 index 0000000..6536df3 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/qml/PerspectiveItem.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: rootItem + + property bool created: false + property string image + + property double scaledBottom: y + (height + height*scale) / 2 + property bool onLand: scaledBottom > window.height / 2 + + source: image + opacity: onLand ? 1 : 0.25 + scale: Math.max((y + height - 250) * 0.01, 0.3) + smooth: true + + onCreatedChanged: { + if (created && !onLand) + rootItem.destroy(); + else + z = scaledBottom; + } + + onYChanged: z = scaledBottom; +} diff --git a/examples/declarative/toys/dynamicscene/qml/qml/Sun.qml b/examples/declarative/toys/dynamicscene/qml/qml/Sun.qml new file mode 100644 index 0000000..5b28b39 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/qml/Sun.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + id: sun + + property bool created: false + property string image: "../images/sun.png" + + source: image + + // once item is created, start moving offscreen + NumberAnimation on y { + to: window.height / 2 + running: created + onRunningChanged: { + if (running) + duration = (window.height - sun.y) * 10; + else + state = "OffScreen" + } + } + + states: State { + name: "OffScreen" + StateChangeScript { + script: { sun.created = false; sun.destroy() } + } + } + + onCreatedChanged: { + if (created) { + sun.z = 1; // above the sky but below the ground layer + window.activeSuns++; + } else { + window.activeSuns--; + } + } +} diff --git a/examples/declarative/toys/dynamicscene/qml/qml/itemCreation.js b/examples/declarative/toys/dynamicscene/qml/qml/itemCreation.js new file mode 100644 index 0000000..4ee74c2 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qml/qml/itemCreation.js @@ -0,0 +1,62 @@ +var itemComponent = null; +var draggedItem = null; +var startingMouse; +var posnInWindow; + +function startDrag(mouse) +{ + posnInWindow = paletteItem.mapToItem(window, 0, 0); + startingMouse = { x: mouse.x, y: mouse.y } + loadComponent(); +} + +//Creation is split into two functions due to an asynchronous wait while +//possible external files are loaded. + +function loadComponent() { + if (itemComponent != null) { // component has been previously loaded + createItem(); + return; + } + + itemComponent = Qt.createComponent(paletteItem.componentFile); + if (itemComponent.status == Component.Loading) //Depending on the content, it can be ready or error immediately + component.statusChanged.connect(createItem); + else + createItem(); +} + +function createItem() { + if (itemComponent.status == Component.Ready && draggedItem == null) { + draggedItem = itemComponent.createObject(window, {"image": paletteItem.image, "x": posnInWindow.x, "y": posnInWindow.y, "z": 3}); + // make sure created item is above the ground layer + } else if (itemComponent.status == Component.Error) { + draggedItem = null; + console.log("error creating component"); + console.log(itemComponent.errorString()); + } +} + +function continueDrag(mouse) +{ + if (draggedItem == null) + return; + + draggedItem.x = mouse.x + posnInWindow.x - startingMouse.x; + draggedItem.y = mouse.y + posnInWindow.y - startingMouse.y; +} + +function endDrag(mouse) +{ + if (draggedItem == null) + return; + + if (draggedItem.x + draggedItem.width > toolbox.x) { //Don't drop it in the toolbox + draggedItem.destroy(); + draggedItem = null; + } else { + draggedItem.created = true; + draggedItem = null; + } +} + diff --git a/examples/declarative/toys/dynamicscene/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/toys/dynamicscene/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/toys/dynamicscene/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/toys/dynamicscene/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/toys/dynamicscene/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/toys/dynamicscene/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/toys/dynamicscene/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/toys/tic-tac-toe/main.cpp b/examples/declarative/toys/tic-tac-toe/main.cpp new file mode 100644 index 0000000..269c435 --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/tic-tac-toe.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/toys/tic-tac-toe/qml/content/Button.qml b/examples/declarative/toys/tic-tac-toe/qml/content/Button.qml new file mode 100644 index 0000000..403d587 --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/qml/content/Button.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: container + + property string text + property bool pressed: false + + signal clicked + + width: buttonLabel.width + 20; height: buttonLabel.height + 6 + border { width: 1; color: Qt.darker(container.color) } + radius: 8 + color: "lightgray" + smooth: true + + gradient: Gradient { + GradientStop { + position: 0.0 + color: container.pressed ? "darkgray" : "white" + } + GradientStop { + position: 1.0 + color: container.color + } + } + + MouseArea { + anchors.fill: parent + onClicked: container.clicked() + } + + Text { + id: buttonLabel + anchors.centerIn: container + text: container.text + font.pixelSize: 14 + } +} diff --git a/examples/declarative/toys/tic-tac-toe/qml/content/TicTac.qml b/examples/declarative/toys/tic-tac-toe/qml/content/TicTac.qml new file mode 100644 index 0000000..7e50736 --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/qml/content/TicTac.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + signal clicked + + states: [ + State { name: "X"; PropertyChanges { target: image; source: "pics/x.png" } }, + State { name: "O"; PropertyChanges { target: image; source: "pics/o.png" } } + ] + + Image { + id: image + anchors.centerIn: parent + } + + MouseArea { + anchors.fill: parent + onClicked: parent.clicked() + } +} diff --git a/examples/declarative/toys/tic-tac-toe/qml/content/pics/board.png b/examples/declarative/toys/tic-tac-toe/qml/content/pics/board.png Binary files differnew file mode 100644 index 0000000..7e5b7ba --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/qml/content/pics/board.png diff --git a/examples/declarative/toys/tic-tac-toe/qml/content/pics/o.png b/examples/declarative/toys/tic-tac-toe/qml/content/pics/o.png Binary files differnew file mode 100644 index 0000000..abc7ee0 --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/qml/content/pics/o.png diff --git a/examples/declarative/toys/tic-tac-toe/qml/content/pics/x.png b/examples/declarative/toys/tic-tac-toe/qml/content/pics/x.png Binary files differnew file mode 100644 index 0000000..ddc65c8 --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/qml/content/pics/x.png diff --git a/examples/declarative/toys/tic-tac-toe/qml/content/tic-tac-toe.js b/examples/declarative/toys/tic-tac-toe/qml/content/tic-tac-toe.js new file mode 100644 index 0000000..5a166b7 --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/qml/content/tic-tac-toe.js @@ -0,0 +1,149 @@ +function winner(board) +{ + for (var i=0; i<3; ++i) { + if (board.children[i].state != "" + && board.children[i].state == board.children[i+3].state + && board.children[i].state == board.children[i+6].state) + return true + + if (board.children[i*3].state != "" + && board.children[i*3].state == board.children[i*3+1].state + && board.children[i*3].state == board.children[i*3+2].state) + return true + } + + if (board.children[0].state != "" + && board.children[0].state == board.children[4].state != "" + && board.children[0].state == board.children[8].state != "") + return true + + if (board.children[2].state != "" + && board.children[2].state == board.children[4].state != "" + && board.children[2].state == board.children[6].state != "") + return true + + return false +} + +function restartGame() +{ + game.running = true + + for (var i=0; i<9; ++i) + board.children[i].state = "" +} + +function makeMove(pos, player) +{ + board.children[pos].state = player + if (winner(board)) { + gameFinished(player + " wins") + return true + } else { + return false + } +} + +function canPlayAtPos(pos) +{ + return board.children[pos].state == "" +} + +function computerTurn() +{ + var r = Math.random(); + if (r < game.difficulty) + smartAI(); + else + randomAI(); +} + +function smartAI() +{ + function boardCopy(a) { + var ret = new Object; + ret.children = new Array(9); + for (var i = 0; i<9; i++) { + ret.children[i] = new Object; + ret.children[i].state = a.children[i].state; + } + return ret; + } + + for (var i=0; i<9; i++) { + var simpleBoard = boardCopy(board); + if (canPlayAtPos(i)) { + simpleBoard.children[i].state = "O"; + if (winner(simpleBoard)) { + makeMove(i, "O") + return + } + } + } + for (var i=0; i<9; i++) { + var simpleBoard = boardCopy(board); + if (canPlayAtPos(i)) { + simpleBoard.children[i].state = "X"; + if (winner(simpleBoard)) { + makeMove(i, "O") + return + } + } + } + + function thwart(a,b,c) { //If they are at a, try b or c + if (board.children[a].state == "X") { + if (canPlayAtPos(b)) { + makeMove(b, "O") + return true + } else if (canPlayAtPos(c)) { + makeMove(c, "O") + return true + } + } + return false; + } + + if (thwart(4,0,2)) return; + if (thwart(0,4,3)) return; + if (thwart(2,4,1)) return; + if (thwart(6,4,7)) return; + if (thwart(8,4,5)) return; + if (thwart(1,4,2)) return; + if (thwart(3,4,0)) return; + if (thwart(5,4,8)) return; + if (thwart(7,4,6)) return; + + for (var i =0; i<9; i++) { + if (canPlayAtPos(i)) { + makeMove(i, "O") + return + } + } + restartGame(); +} + +function randomAI() +{ + var unfilledPosns = new Array(); + + for (var i=0; i<9; ++i) { + if (canPlayAtPos(i)) + unfilledPosns.push(i); + } + + if (unfilledPosns.length == 0) { + restartGame(); + } else { + var choice = unfilledPosns[Math.floor(Math.random() * unfilledPosns.length)]; + makeMove(choice, "O"); + } +} + +function gameFinished(message) +{ + messageDisplay.text = message + messageDisplay.visible = true + game.running = false +} + diff --git a/examples/declarative/toys/tic-tac-toe/qml/tic-tac-toe.qml b/examples/declarative/toys/tic-tac-toe/qml/tic-tac-toe.qml new file mode 100644 index 0000000..c60f2df --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/qml/tic-tac-toe.qml @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" +import "content/tic-tac-toe.js" as Logic + +Rectangle { + id: game + + property bool running: true + property real difficulty: 1.0 //chance it will actually think + + width: display.width; height: display.height + 10 + + Image { + id: boardImage + source: "content/pics/board.png" + } + + + Column { + id: display + + Grid { + id: board + width: boardImage.width; height: boardImage.height + columns: 3 + + Repeater { + model: 9 + + TicTac { + width: board.width/3 + height: board.height/3 + + onClicked: { + if (game.running && Logic.canPlayAtPos(index)) { + if (!Logic.makeMove(index, "X")) + Logic.computerTurn(); + } + } + } + } + } + + Row { + spacing: 4 + anchors.horizontalCenter: parent.horizontalCenter + + Button { + text: "Hard" + pressed: game.difficulty == 1.0 + onClicked: { game.difficulty = 1.0 } + } + Button { + text: "Moderate" + pressed: game.difficulty == 0.8 + onClicked: { game.difficulty = 0.8 } + } + Button { + text: "Easy" + pressed: game.difficulty == 0.2 + onClicked: { game.difficulty = 0.2 } + } + } + } + + + Text { + id: messageDisplay + anchors.centerIn: parent + color: "blue" + style: Text.Outline; styleColor: "white" + font.pixelSize: 50; font.bold: true + visible: false + + Timer { + running: messageDisplay.visible + onTriggered: { + messageDisplay.visible = false; + Logic.restartGame(); + } + } + } +} diff --git a/examples/declarative/toys/tic-tac-toe/qml/tic-tac-toe.qmlproject b/examples/declarative/toys/tic-tac-toe/qml/tic-tac-toe.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/qml/tic-tac-toe.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/toys/tic-tac-toe/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/toys/tic-tac-toe/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/toys/tic-tac-toe/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/toys/tic-tac-toe/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/toys/tic-tac-toe/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/toys/tic-tac-toe/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/toys/tic-tac-toe/tic-tac-toe.pro b/examples/declarative/toys/tic-tac-toe/tic-tac-toe.pro new file mode 100644 index 0000000..2e1fbd3 --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/tic-tac-toe.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEFDDF868 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/toys/tic-tac-toe/tictactoe.desktop b/examples/declarative/toys/tic-tac-toe/tictactoe.desktop new file mode 100644 index 0000000..e66569c --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/tictactoe.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=tic-tac-toe +Exec=/opt/usr/bin/tic-tac-toe +Icon=tic-tac-toe +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/toys/tic-tac-toe/tictactoe.png b/examples/declarative/toys/tic-tac-toe/tictactoe.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/tictactoe.png diff --git a/examples/declarative/toys/tic-tac-toe/tictactoe.pro b/examples/declarative/toys/tic-tac-toe/tictactoe.pro new file mode 100644 index 0000000..2e1fbd3 --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/tictactoe.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEFDDF868 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/toys/tic-tac-toe/tictactoe.svg b/examples/declarative/toys/tic-tac-toe/tictactoe.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/toys/tic-tac-toe/tictactoe.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/toys/tvtennis/main.cpp b/examples/declarative/toys/tvtennis/main.cpp new file mode 100644 index 0000000..e4c28e0 --- /dev/null +++ b/examples/declarative/toys/tvtennis/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/tvtennis.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/toys/tvtennis/qml/tvtennis.qml b/examples/declarative/toys/tvtennis/qml/tvtennis.qml new file mode 100644 index 0000000..805666d --- /dev/null +++ b/examples/declarative/toys/tvtennis/qml/tvtennis.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: page + width: 640; height: 480 + color: "Black" + + // Make a ball to bounce + Rectangle { + id: ball + + // Add a property for the target y coordinate + property variant direction : "right" + + x: 20; width: 20; height: 20; z: 1 + color: "Lime" + + // Move the ball to the right and back to the left repeatedly + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { to: page.width - 40; duration: 2000 } + PropertyAction { target: ball; property: "direction"; value: "left" } + NumberAnimation { to: 20; duration: 2000 } + PropertyAction { target: ball; property: "direction"; value: "right" } + } + + // Make y move with a velocity of 200 + Behavior on y { SpringAnimation{ velocity: 200; } + } + + Component.onCompleted: y = page.height-10; // start the ball motion + + // Detect the ball hitting the top or bottom of the view and bounce it + onYChanged: { + if (y <= 0) { + y = page.height - 20; + } else if (y >= page.height - 20) { + y = 0; + } + } + } + + // Place bats to the left and right of the view, following the y + // coordinates of the ball. + Rectangle { + id: leftBat + color: "Lime" + x: 2; width: 20; height: 90 + y: ball.direction == 'left' ? ball.y - 45 : page.height/2 -45; + Behavior on y { SpringAnimation{ velocity: 300 } } + } + Rectangle { + id: rightBat + color: "Lime" + x: page.width - 22; width: 20; height: 90 + y: ball.direction == 'right' ? ball.y - 45 : page.height/2 -45; + Behavior on y { SpringAnimation{ velocity: 300 } } + } + + // The rest, to make it look realistic, if neither ever scores... + Rectangle { color: "Lime"; x: page.width/2-80; y: 0; width: 40; height: 60 } + Rectangle { color: "Black"; x: page.width/2-70; y: 10; width: 20; height: 40 } + Rectangle { color: "Lime"; x: page.width/2+40; y: 0; width: 40; height: 60 } + Rectangle { color: "Black"; x: page.width/2+50; y: 10; width: 20; height: 40 } + Repeater { + model: page.height / 20 + Rectangle { color: "Lime"; x: page.width/2-5; y: index * 20; width: 10; height: 10 } + } +} diff --git a/examples/declarative/toys/tvtennis/qml/tvtennis.qmlproject b/examples/declarative/toys/tvtennis/qml/tvtennis.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/toys/tvtennis/qml/tvtennis.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/toys/tvtennis/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/toys/tvtennis/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/toys/tvtennis/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/toys/tvtennis/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/toys/tvtennis/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/toys/tvtennis/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/toys/tvtennis/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/toys/tvtennis/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/toys/tvtennis/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/toys/tvtennis/tvtennis.desktop b/examples/declarative/toys/tvtennis/tvtennis.desktop new file mode 100644 index 0000000..e9ca1b9 --- /dev/null +++ b/examples/declarative/toys/tvtennis/tvtennis.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=tvtennis +Exec=/opt/usr/bin/tvtennis +Icon=tvtennis +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/toys/tvtennis/tvtennis.png b/examples/declarative/toys/tvtennis/tvtennis.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/toys/tvtennis/tvtennis.png diff --git a/examples/declarative/toys/tvtennis/tvtennis.pro b/examples/declarative/toys/tvtennis/tvtennis.pro new file mode 100644 index 0000000..3637921 --- /dev/null +++ b/examples/declarative/toys/tvtennis/tvtennis.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE6511DAE + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/toys/tvtennis/tvtennis.svg b/examples/declarative/toys/tvtennis/tvtennis.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/toys/tvtennis/tvtennis.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.desktop b/examples/declarative/ui-components/dialcontrol/dialcontrol.desktop new file mode 100644 index 0000000..d12a374 --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/dialcontrol.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=dialcontrol +Exec=/opt/usr/bin/dialcontrol +Icon=dialcontrol +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.png b/examples/declarative/ui-components/dialcontrol/dialcontrol.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/dialcontrol.png diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.pro b/examples/declarative/ui-components/dialcontrol/dialcontrol.pro new file mode 100644 index 0000000..bdf55cc --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/dialcontrol.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEB1C54E8 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.svg b/examples/declarative/ui-components/dialcontrol/dialcontrol.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/dialcontrol.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/ui-components/dialcontrol/main.cpp b/examples/declarative/ui-components/dialcontrol/main.cpp new file mode 100644 index 0000000..f5f5508 --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/dialcontrol.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/ui-components/dialcontrol/qml/content/Dial.qml b/examples/declarative/ui-components/dialcontrol/qml/content/Dial.qml new file mode 100644 index 0000000..2f1d27a --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/qml/content/Dial.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: root + property real value : 0 + + width: 210; height: 210 + + Image { source: "background.png" } + +//! [needle_shadow] + Image { + x: 96 + y: 35 + source: "needle_shadow.png" + transform: Rotation { + origin.x: 9; origin.y: 67 + angle: needleRotation.angle + } + } +//! [needle_shadow] +//! [needle] + Image { + id: needle + x: 98; y: 33 + smooth: true + source: "needle.png" + transform: Rotation { + id: needleRotation + origin.x: 5; origin.y: 65 + //! [needle angle] + angle: Math.min(Math.max(-130, root.value*2.6 - 130), 133) + Behavior on angle { + SpringAnimation { + spring: 1.4 + damping: .15 + } + } + //! [needle angle] + } + } +//! [needle] +//! [overlay] + Image { x: 21; y: 18; source: "overlay.png" } +//! [overlay] +} diff --git a/examples/declarative/ui-components/dialcontrol/qml/content/QuitButton.qml b/examples/declarative/ui-components/dialcontrol/qml/content/QuitButton.qml new file mode 100644 index 0000000..cbbf916 --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/qml/content/QuitButton.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +Image { + source: "quit.png" + scale: quitMouse.pressed ? 0.8 : 1.0 + smooth: quitMouse.pressed + MouseArea { + id: quitMouse + anchors.fill: parent + anchors.margins: -10 + onClicked: Qt.quit() + } +} diff --git a/examples/declarative/ui-components/dialcontrol/qml/content/background.png b/examples/declarative/ui-components/dialcontrol/qml/content/background.png Binary files differnew file mode 100644 index 0000000..75d555d --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/qml/content/background.png diff --git a/examples/declarative/ui-components/dialcontrol/qml/content/needle.png b/examples/declarative/ui-components/dialcontrol/qml/content/needle.png Binary files differnew file mode 100644 index 0000000..2d19f75 --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/qml/content/needle.png diff --git a/examples/declarative/ui-components/dialcontrol/qml/content/needle_shadow.png b/examples/declarative/ui-components/dialcontrol/qml/content/needle_shadow.png Binary files differnew file mode 100644 index 0000000..8d8a928 --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/qml/content/needle_shadow.png diff --git a/examples/declarative/ui-components/dialcontrol/qml/content/overlay.png b/examples/declarative/ui-components/dialcontrol/qml/content/overlay.png Binary files differnew file mode 100644 index 0000000..3860a7b --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/qml/content/overlay.png diff --git a/examples/declarative/ui-components/dialcontrol/qml/content/quit.png b/examples/declarative/ui-components/dialcontrol/qml/content/quit.png Binary files differnew file mode 100644 index 0000000..b822057 --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/qml/content/quit.png diff --git a/examples/declarative/ui-components/dialcontrol/qml/dialcontrol.qml b/examples/declarative/ui-components/dialcontrol/qml/dialcontrol.qml new file mode 100644 index 0000000..c66dcdd --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/qml/dialcontrol.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [imports] +import QtQuick 1.0 +import "content" +//! [imports] + +//! [0] +Rectangle { + color: "#545454" + width: 300; height: 300 + + // Dial with a slider to adjust it + Dial { + id: dial + anchors.centerIn: parent + value: slider.x * 100 / (container.width - 34) + } + + Rectangle { + id: container + anchors { bottom: parent.bottom; left: parent.left + right: parent.right; leftMargin: 20; rightMargin: 20 + bottomMargin: 10 + } + height: 16 + + radius: 8 + opacity: 0.7 + smooth: true + gradient: Gradient { + GradientStop { position: 0.0; color: "gray" } + GradientStop { position: 1.0; color: "white" } + } + + Rectangle { + id: slider + x: 1; y: 1; width: 30; height: 14 + radius: 6 + smooth: true + gradient: Gradient { + GradientStop { position: 0.0; color: "#424242" } + GradientStop { position: 1.0; color: "black" } + } + + MouseArea { + anchors.fill: parent + anchors.margins: -16 // Increase mouse area a lot outside the slider + drag.target: parent; drag.axis: Drag.XAxis + drag.minimumX: 2; drag.maximumX: container.width - 32 + } + } + } + QuitButton { + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: 10 + } +} +//! [0] diff --git a/examples/declarative/ui-components/dialcontrol/qml/dialcontrol.qmlproject b/examples/declarative/ui-components/dialcontrol/qml/dialcontrol.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/qml/dialcontrol.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/ui-components/dialcontrol/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/ui-components/dialcontrol/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/ui-components/dialcontrol/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/ui-components/dialcontrol/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/ui-components/dialcontrol/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/ui-components/dialcontrol/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/ui-components/flipable/flipable.desktop b/examples/declarative/ui-components/flipable/flipable.desktop new file mode 100644 index 0000000..640d99d --- /dev/null +++ b/examples/declarative/ui-components/flipable/flipable.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=flipable +Exec=/opt/usr/bin/flipable +Icon=flipable +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/ui-components/flipable/flipable.png b/examples/declarative/ui-components/flipable/flipable.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/ui-components/flipable/flipable.png diff --git a/examples/declarative/ui-components/flipable/flipable.pro b/examples/declarative/ui-components/flipable/flipable.pro new file mode 100644 index 0000000..c7ad200 --- /dev/null +++ b/examples/declarative/ui-components/flipable/flipable.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE31D80B6 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/ui-components/flipable/flipable.svg b/examples/declarative/ui-components/flipable/flipable.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/ui-components/flipable/flipable.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/ui-components/flipable/main.cpp b/examples/declarative/ui-components/flipable/main.cpp new file mode 100644 index 0000000..c4ea8b8 --- /dev/null +++ b/examples/declarative/ui-components/flipable/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/flipable.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/ui-components/flipable/qml/content/5_heart.png b/examples/declarative/ui-components/flipable/qml/content/5_heart.png Binary files differnew file mode 100644 index 0000000..fb59d81 --- /dev/null +++ b/examples/declarative/ui-components/flipable/qml/content/5_heart.png diff --git a/examples/declarative/ui-components/flipable/qml/content/9_club.png b/examples/declarative/ui-components/flipable/qml/content/9_club.png Binary files differnew file mode 100644 index 0000000..2545001 --- /dev/null +++ b/examples/declarative/ui-components/flipable/qml/content/9_club.png diff --git a/examples/declarative/ui-components/flipable/qml/content/Card.qml b/examples/declarative/ui-components/flipable/qml/content/Card.qml new file mode 100644 index 0000000..32c4ed1 --- /dev/null +++ b/examples/declarative/ui-components/flipable/qml/content/Card.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Flipable { + id: container + + property alias image: frontImage.source + property bool flipped: true + property int xAxis: 0 + property int yAxis: 0 + property int angle: 0 + + width: front.width; height: front.height + + front: Image { id: frontImage; smooth: true } + back: Image { source: "back.png"; smooth: true } + + state: "back" + + MouseArea { anchors.fill: parent; onClicked: container.flipped = !container.flipped } + + transform: Rotation { + id: rotation; origin.x: container.width / 2; origin.y: container.height / 2 + axis.x: container.xAxis; axis.y: container.yAxis; axis.z: 0 + } + + states: State { + name: "back"; when: container.flipped + PropertyChanges { target: rotation; angle: container.angle } + } + + transitions: Transition { + ParallelAnimation { + NumberAnimation { target: rotation; properties: "angle"; duration: 600 } + SequentialAnimation { + NumberAnimation { target: container; property: "scale"; to: 0.75; duration: 300 } + NumberAnimation { target: container; property: "scale"; to: 1.0; duration: 300 } + } + } + } +} diff --git a/examples/declarative/ui-components/flipable/qml/content/back.png b/examples/declarative/ui-components/flipable/qml/content/back.png Binary files differnew file mode 100644 index 0000000..f715d74 --- /dev/null +++ b/examples/declarative/ui-components/flipable/qml/content/back.png diff --git a/examples/declarative/ui-components/flipable/qml/flipable.qml b/examples/declarative/ui-components/flipable/qml/flipable.qml new file mode 100644 index 0000000..51867f9 --- /dev/null +++ b/examples/declarative/ui-components/flipable/qml/flipable.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: window + + width: 480; height: 320 + color: "darkgreen" + + Row { + anchors.centerIn: parent; spacing: 30 + Card { image: "content/9_club.png"; angle: 180; yAxis: 1 } + Card { image: "content/5_heart.png"; angle: 540; xAxis: 1 } + } +} diff --git a/examples/declarative/ui-components/flipable/qml/flipable.qmlproject b/examples/declarative/ui-components/flipable/qml/flipable.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/ui-components/flipable/qml/flipable.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/ui-components/flipable/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/ui-components/flipable/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/ui-components/flipable/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/ui-components/flipable/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/ui-components/flipable/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/ui-components/flipable/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/ui-components/flipable/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/ui-components/flipable/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/ui-components/flipable/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/ui-components/main/main.cpp b/examples/declarative/ui-components/main/main.cpp new file mode 100644 index 0000000..6679628 --- /dev/null +++ b/examples/declarative/ui-components/main/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/main.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/ui-components/main/main.desktop b/examples/declarative/ui-components/main/main.desktop new file mode 100644 index 0000000..157fa32 --- /dev/null +++ b/examples/declarative/ui-components/main/main.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=main +Exec=/opt/usr/bin/main +Icon=main +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/ui-components/main/main.png b/examples/declarative/ui-components/main/main.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/ui-components/main/main.png diff --git a/examples/declarative/ui-components/main/main.pro b/examples/declarative/ui-components/main/main.pro new file mode 100644 index 0000000..cf172ab --- /dev/null +++ b/examples/declarative/ui-components/main/main.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE647B679 + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/ui-components/main/main.svg b/examples/declarative/ui-components/main/main.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/ui-components/main/main.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/ui-components/main/qml/ScrollBar.qml b/examples/declarative/ui-components/main/qml/ScrollBar.qml new file mode 100644 index 0000000..faa501a --- /dev/null +++ b/examples/declarative/ui-components/main/qml/ScrollBar.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: scrollBar + + // The properties that define the scrollbar's state. + // position and pageSize are in the range 0.0 - 1.0. They are relative to the + // height of the page, i.e. a pageSize of 0.5 means that you can see 50% + // of the height of the view. + // orientation can be either Qt.Vertical or Qt.Horizontal + property real position + property real pageSize + property variant orientation : Qt.Vertical + + // A light, semi-transparent background + Rectangle { + id: background + anchors.fill: parent + radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1) + color: "white" + opacity: 0.3 + } + + // Size the bar to the required size, depending upon the orientation. + Rectangle { + x: orientation == Qt.Vertical ? 1 : (scrollBar.position * (scrollBar.width-2) + 1) + y: orientation == Qt.Vertical ? (scrollBar.position * (scrollBar.height-2) + 1) : 1 + width: orientation == Qt.Vertical ? (parent.width-2) : (scrollBar.pageSize * (scrollBar.width-2)) + height: orientation == Qt.Vertical ? (scrollBar.pageSize * (scrollBar.height-2)) : (parent.height-2) + radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1) + color: "black" + opacity: 0.7 + } +} diff --git a/examples/declarative/ui-components/main/qml/SearchBox.qml b/examples/declarative/ui-components/main/qml/SearchBox.qml new file mode 100644 index 0000000..f54954a --- /dev/null +++ b/examples/declarative/ui-components/main/qml/SearchBox.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +FocusScope { + id: focusScope + width: 250; height: 28 + + BorderImage { + source: "images/lineedit-bg.png" + width: parent.width; height: parent.height + border { left: 4; top: 4; right: 4; bottom: 4 } + } + + BorderImage { + source: "images/lineedit-bg-focus.png" + width: parent.width; height: parent.height + border { left: 4; top: 4; right: 4; bottom: 4 } + visible: parent.activeFocus ? true : false + } + + Text { + id: typeSomething + anchors.fill: parent; anchors.leftMargin: 8 + verticalAlignment: Text.AlignVCenter + text: "Type something..." + color: "gray" + font.italic: true + } + + MouseArea { + anchors.fill: parent + onClicked: { focusScope.focus = true; textInput.openSoftwareInputPanel(); } + } + + TextInput { + id: textInput + anchors { left: parent.left; leftMargin: 8; right: clear.left; rightMargin: 8; verticalCenter: parent.verticalCenter } + focus: true + selectByMouse: true + } + + Image { + id: clear + anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter } + source: "images/clear.png" + opacity: 0 + + MouseArea { + anchors.fill: parent + onClicked: { textInput.text = ''; focusScope.focus = true; textInput.openSoftwareInputPanel(); } + } + } + + states: State { + name: "hasText"; when: textInput.text != '' + PropertyChanges { target: typeSomething; opacity: 0 } + PropertyChanges { target: clear; opacity: 1 } + } + + transitions: [ + Transition { + from: ""; to: "hasText" + NumberAnimation { exclude: typeSomething; properties: "opacity" } + }, + Transition { + from: "hasText"; to: "" + NumberAnimation { properties: "opacity" } + } + ] +} diff --git a/examples/declarative/ui-components/main/qml/TabWidget.qml b/examples/declarative/ui-components/main/qml/TabWidget.qml new file mode 100644 index 0000000..f066fd2 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/TabWidget.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: tabWidget + + // Setting the default property to stack.children means any child items + // of the TabWidget are actually added to the 'stack' item's children. + // See the "Extending Types from QML" documentation for details on default + // properties. + default property alias content: stack.children + + property int current: 0 + + onCurrentChanged: setOpacities() + Component.onCompleted: setOpacities() + + function setOpacities() { + for (var i = 0; i < stack.children.length; ++i) { + stack.children[i].opacity = (i == current ? 1 : 0) + } + } + + Row { + id: header + + Repeater { + model: stack.children.length + delegate: Rectangle { + width: tabWidget.width / stack.children.length; height: 36 + + Rectangle { + width: parent.width; height: 1 + anchors { bottom: parent.bottom; bottomMargin: 1 } + color: "#acb2c2" + } + BorderImage { + anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 } + border { left: 7; right: 7 } + source: "tab.png" + visible: tabWidget.current == index + } + Text { + horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter + anchors.fill: parent + text: stack.children[index].title + elide: Text.ElideRight + font.bold: tabWidget.current == index + } + MouseArea { + anchors.fill: parent + onClicked: tabWidget.current = index + } + } + } + } + + Item { + id: stack + width: tabWidget.width + anchors.top: header.bottom; anchors.bottom: tabWidget.bottom + } +} diff --git a/examples/declarative/ui-components/main/qml/content/ProgressBar.qml b/examples/declarative/ui-components/main/qml/content/ProgressBar.qml new file mode 100644 index 0000000..e92342a --- /dev/null +++ b/examples/declarative/ui-components/main/qml/content/ProgressBar.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: progressbar + + property int minimum: 0 + property int maximum: 100 + property int value: 0 + property alias color: gradient1.color + property alias secondColor: gradient2.color + + width: 250; height: 23 + clip: true + + BorderImage { + source: "background.png" + width: parent.width; height: parent.height + border { left: 4; top: 4; right: 4; bottom: 4 } + } + + Rectangle { + id: highlight + + property int widthDest: ((progressbar.width * (value - minimum)) / (maximum - minimum) - 6) + + width: highlight.widthDest + Behavior on width { SmoothedAnimation { velocity: 1200 } } + + anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: 3 } + radius: 1 + gradient: Gradient { + GradientStop { id: gradient1; position: 0.0 } + GradientStop { id: gradient2; position: 1.0 } + } + + } + Text { + anchors { right: highlight.right; rightMargin: 6; verticalCenter: parent.verticalCenter } + color: "white" + font.bold: true + text: Math.floor((value - minimum) / (maximum - minimum) * 100) + '%' + } +} diff --git a/examples/declarative/ui-components/main/qml/content/Spinner.qml b/examples/declarative/ui-components/main/qml/content/Spinner.qml new file mode 100644 index 0000000..853c787 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/content/Spinner.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Image { + property alias model: view.model + property alias delegate: view.delegate + property alias currentIndex: view.currentIndex + property real itemHeight: 30 + + source: "spinner-bg.png" + clip: true + + PathView { + id: view + anchors.fill: parent + + pathItemCount: height/itemHeight + preferredHighlightBegin: 0.5 + preferredHighlightEnd: 0.5 + highlight: Image { source: "spinner-select.png"; width: view.width; height: itemHeight+4 } + dragMargin: view.width/2 + + path: Path { + startX: view.width/2; startY: -itemHeight/2 + PathLine { x: view.width/2; y: view.pathItemCount*itemHeight + itemHeight } + } + } + + Keys.onDownPressed: view.incrementCurrentIndex() + Keys.onUpPressed: view.decrementCurrentIndex() +} diff --git a/examples/declarative/ui-components/main/qml/content/background.png b/examples/declarative/ui-components/main/qml/content/background.png Binary files differnew file mode 100644 index 0000000..9044226 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/content/background.png diff --git a/examples/declarative/ui-components/main/qml/content/spinner-bg.png b/examples/declarative/ui-components/main/qml/content/spinner-bg.png Binary files differnew file mode 100644 index 0000000..b3556f1 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/content/spinner-bg.png diff --git a/examples/declarative/ui-components/main/qml/content/spinner-select.png b/examples/declarative/ui-components/main/qml/content/spinner-select.png Binary files differnew file mode 100644 index 0000000..95a17a1 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/content/spinner-select.png diff --git a/examples/declarative/ui-components/main/qml/images/clear.png b/examples/declarative/ui-components/main/qml/images/clear.png Binary files differnew file mode 100644 index 0000000..91eb270 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/images/clear.png diff --git a/examples/declarative/ui-components/main/qml/images/lineedit-bg-focus.png b/examples/declarative/ui-components/main/qml/images/lineedit-bg-focus.png Binary files differnew file mode 100644 index 0000000..bbfac38 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/images/lineedit-bg-focus.png diff --git a/examples/declarative/ui-components/main/qml/images/lineedit-bg.png b/examples/declarative/ui-components/main/qml/images/lineedit-bg.png Binary files differnew file mode 100644 index 0000000..9044226 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/images/lineedit-bg.png diff --git a/examples/declarative/ui-components/main/qml/main.qml b/examples/declarative/ui-components/main/qml/main.qml new file mode 100644 index 0000000..842ef1a --- /dev/null +++ b/examples/declarative/ui-components/main/qml/main.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +TabWidget { + id: tabs + width: 640; height: 480 + + Rectangle { + property string title: "Red" + anchors.fill: parent + color: "#e3e3e3" + + Rectangle { + anchors.fill: parent; anchors.margins: 20 + color: "#ff7f7f" + Text { + width: parent.width - 20 + anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter + text: "Roses are red" + font.pixelSize: 20 + wrapMode: Text.WordWrap + } + } + } + + Rectangle { + property string title: "Green" + anchors.fill: parent + color: "#e3e3e3" + + Rectangle { + anchors.fill: parent; anchors.margins: 20 + color: "#7fff7f" + Text { + width: parent.width - 20 + anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter + text: "Flower stems are green" + font.pixelSize: 20 + wrapMode: Text.WordWrap + } + } + } + + Rectangle { + property string title: "Blue" + anchors.fill: parent; color: "#e3e3e3" + + Rectangle { + anchors.fill: parent; anchors.margins: 20 + color: "#7f7fff" + Text { + width: parent.width - 20 + anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter + text: "Violets are blue" + font.pixelSize: 20 + wrapMode: Text.WordWrap + } + } + } +} diff --git a/examples/declarative/ui-components/main/qml/pics/niagara_falls.jpg b/examples/declarative/ui-components/main/qml/pics/niagara_falls.jpg Binary files differnew file mode 100644 index 0000000..e625c0d --- /dev/null +++ b/examples/declarative/ui-components/main/qml/pics/niagara_falls.jpg diff --git a/examples/declarative/ui-components/main/qml/progressbar.qmlproject b/examples/declarative/ui-components/main/qml/progressbar.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/progressbar.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/ui-components/main/qml/scrollbar.qmlproject b/examples/declarative/ui-components/main/qml/scrollbar.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/scrollbar.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/ui-components/main/qml/searchbox.qmlproject b/examples/declarative/ui-components/main/qml/searchbox.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/searchbox.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/ui-components/main/qml/spinner.qmlproject b/examples/declarative/ui-components/main/qml/spinner.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/spinner.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/ui-components/main/qml/tab.png b/examples/declarative/ui-components/main/qml/tab.png Binary files differnew file mode 100644 index 0000000..ad80216 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/tab.png diff --git a/examples/declarative/ui-components/main/qml/tabwidget.qmlproject b/examples/declarative/ui-components/main/qml/tabwidget.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/ui-components/main/qml/tabwidget.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/ui-components/main/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/ui-components/main/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/ui-components/main/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/ui-components/main/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/ui-components/main/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/ui-components/main/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/ui-components/main/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/ui-components/main/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/ui-components/main/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/ui-components/progressbar/main.cpp b/examples/declarative/ui-components/progressbar/main.cpp new file mode 100644 index 0000000..d10bcd1 --- /dev/null +++ b/examples/declarative/ui-components/progressbar/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile(QLatin1String("qml/qml/main.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/ui-components/progressbar/progressbar.desktop b/examples/declarative/ui-components/progressbar/progressbar.desktop new file mode 100644 index 0000000..3fb6f21 --- /dev/null +++ b/examples/declarative/ui-components/progressbar/progressbar.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=progressbar +Exec=/opt/usr/bin/progressbar +Icon=progressbar +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/ui-components/progressbar/progressbar.png b/examples/declarative/ui-components/progressbar/progressbar.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/ui-components/progressbar/progressbar.png diff --git a/examples/declarative/ui-components/progressbar/progressbar.pro b/examples/declarative/ui-components/progressbar/progressbar.pro new file mode 100644 index 0000000..aae34b0 --- /dev/null +++ b/examples/declarative/ui-components/progressbar/progressbar.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +#DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEAA2206D + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/ui-components/progressbar/progressbar.svg b/examples/declarative/ui-components/progressbar/progressbar.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/ui-components/progressbar/progressbar.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/ui-components/progressbar/qml/content/ProgressBar.qml b/examples/declarative/ui-components/progressbar/qml/content/ProgressBar.qml new file mode 100644 index 0000000..e92342a --- /dev/null +++ b/examples/declarative/ui-components/progressbar/qml/content/ProgressBar.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Item { + id: progressbar + + property int minimum: 0 + property int maximum: 100 + property int value: 0 + property alias color: gradient1.color + property alias secondColor: gradient2.color + + width: 250; height: 23 + clip: true + + BorderImage { + source: "background.png" + width: parent.width; height: parent.height + border { left: 4; top: 4; right: 4; bottom: 4 } + } + + Rectangle { + id: highlight + + property int widthDest: ((progressbar.width * (value - minimum)) / (maximum - minimum) - 6) + + width: highlight.widthDest + Behavior on width { SmoothedAnimation { velocity: 1200 } } + + anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: 3 } + radius: 1 + gradient: Gradient { + GradientStop { id: gradient1; position: 0.0 } + GradientStop { id: gradient2; position: 1.0 } + } + + } + Text { + anchors { right: highlight.right; rightMargin: 6; verticalCenter: parent.verticalCenter } + color: "white" + font.bold: true + text: Math.floor((value - minimum) / (maximum - minimum) * 100) + '%' + } +} diff --git a/examples/declarative/ui-components/progressbar/qml/content/background.png b/examples/declarative/ui-components/progressbar/qml/content/background.png Binary files differnew file mode 100644 index 0000000..9044226 --- /dev/null +++ b/examples/declarative/ui-components/progressbar/qml/content/background.png diff --git a/examples/declarative/ui-components/progressbar/qml/main.qml b/examples/declarative/ui-components/progressbar/qml/main.qml new file mode 100644 index 0000000..a805a7e --- /dev/null +++ b/examples/declarative/ui-components/progressbar/qml/main.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + id: main + + width: 600; height: 405 + color: "#edecec" + + Flickable { + anchors.fill: parent + contentHeight: column.height + 20 + + Column { + id: column + x: 10; y: 10 + spacing: 10 + + Repeater { + model: 25 + + ProgressBar { + property int r: Math.floor(Math.random() * 5000 + 1000) + width: main.width - 20 + + NumberAnimation on value { duration: r; from: 0; to: 100; loops: Animation.Infinite } + ColorAnimation on color { duration: r; from: "lightsteelblue"; to: "thistle"; loops: Animation.Infinite } + ColorAnimation on secondColor { duration: r; from: "steelblue"; to: "#CD96CD"; loops: Animation.Infinite } + } + } + } + } +} diff --git a/examples/declarative/ui-components/progressbar/qml/progressbar.qmlproject b/examples/declarative/ui-components/progressbar/qml/progressbar.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/ui-components/progressbar/qml/progressbar.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/ui-components/progressbar/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/ui-components/progressbar/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/ui-components/progressbar/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/ui-components/progressbar/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/ui-components/progressbar/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/ui-components/progressbar/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/ui-components/progressbar/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/ui-components/progressbar/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/ui-components/progressbar/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/ui-components/slideswitch/main.cpp b/examples/declarative/ui-components/slideswitch/main.cpp new file mode 100644 index 0000000..a419c9d --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/slideswitch.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/ui-components/slideswitch/qml/content/Switch.qml b/examples/declarative/ui-components/slideswitch/qml/content/Switch.qml new file mode 100644 index 0000000..06d7a2b --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qml/content/Switch.qml @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//![0] +import QtQuick 1.0 + +Item { + id: toggleswitch + width: background.width; height: background.height + +//![1] + property bool on: false +//![1] + +//![2] + function toggle() { + if (toggleswitch.state == "on") + toggleswitch.state = "off"; + else + toggleswitch.state = "on"; + } +//![2] + +//![3] + function releaseSwitch() { + if (knob.x == 1) { + if (toggleswitch.state == "off") return; + } + if (knob.x == 78) { + if (toggleswitch.state == "on") return; + } + toggle(); + } +//![3] + +//![4] + Image { + id: background + source: "background.svg" + MouseArea { anchors.fill: parent; onClicked: toggle() } + } +//![4] + +//![5] + Image { + id: knob + x: 1; y: 2 + source: "knob.svg" + + MouseArea { + anchors.fill: parent + drag.target: knob; drag.axis: Drag.XAxis; drag.minimumX: 1; drag.maximumX: 78 + onClicked: toggle() + onReleased: releaseSwitch() + } + } +//![5] + +//![6] + states: [ + State { + name: "on" + PropertyChanges { target: knob; x: 78 } + PropertyChanges { target: toggleswitch; on: true } + }, + State { + name: "off" + PropertyChanges { target: knob; x: 1 } + PropertyChanges { target: toggleswitch; on: false } + } + ] +//![6] + +//![7] + transitions: Transition { + NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad; duration: 200 } + } +//![7] +} +//![0] diff --git a/examples/declarative/ui-components/slideswitch/qml/content/background.svg b/examples/declarative/ui-components/slideswitch/qml/content/background.svg new file mode 100644 index 0000000..f920d3e --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qml/content/background.svg @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ + <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/"> +]> +<svg version="1.1" + xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" + x="0px" y="0px" width="130px" height="56px" viewBox="0 0 130 56" enable-background="new 0 0 130 56" xml:space="preserve"> +<defs> +</defs> +<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-37.5005" y1="-66" x2="-37.5005" y2="-121.9985" gradientTransform="matrix(1 0 0 -1 102.5 -66)"> + <stop offset="0.0056" style="stop-color:#000000"/> + <stop offset="1" style="stop-color:#EAECEF"/> +</linearGradient> +<path fill="url(#SVGID_1_)" d="M101.998,55.998H28c-15.439,0-28-12.562-28-28C0,12.56,12.561,0,28,0h73.998 + c15.439,0,28,12.559,28,27.998C129.998,43.438,117.438,55.998,101.998,55.998L101.998,55.998z"/> +<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="-5.5" y1="-132.1338" x2="-69.5002" y2="-55.8613" gradientTransform="matrix(1 0 0 -1 102.5 -66)"> + <stop offset="0.0056" style="stop-color:#000000"/> + <stop offset="1" style="stop-color:#828385"/> +</linearGradient> +<path fill="url(#SVGID_2_)" d="M127.999,27.998c0,14.359-11.642,26-26,26h-74c-14.359,0-26-11.641-26-26l0,0 + c0-14.359,11.641-26,26-26h74C116.357,1.998,127.999,13.639,127.999,27.998L127.999,27.998z"/> +</svg> diff --git a/examples/declarative/ui-components/slideswitch/qml/content/knob.svg b/examples/declarative/ui-components/slideswitch/qml/content/knob.svg new file mode 100644 index 0000000..fb69337 --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qml/content/knob.svg @@ -0,0 +1,867 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://web.resource.org/cc/" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + x="0px" + y="0px" + width="52px" + height="52px" + viewBox="0 0 52 52" + enable-background="new 0 0 52 52" + xml:space="preserve" + id="svg3883" + sodipodi:version="0.32" + inkscape:version="0.44.1" + sodipodi:docname="knob_on.svg" + sodipodi:docbase="/local/axel/embeddedwidgets/embeddedstories/skins/svgslideswitch/MetallicBrush"><metadata + id="metadata4200"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><sodipodi:namedview + inkscape:window-height="640" + inkscape:window-width="937" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + guidetolerance="10.0" + gridtolerance="10.0" + objecttolerance="10.0" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base" + inkscape:zoom="8.3653846" + inkscape:cx="26.000002" + inkscape:cy="26" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:current-layer="svg3883" /> +<defs + id="defs3885"> +</defs> +<linearGradient + id="SVGID_1_" + gradientUnits="userSpaceOnUse" + x1="-59.7866" + y1="-115.917" + x2="-93.2123" + y2="-76.0818" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#000000" + id="stop3888" /> + <stop + offset="1" + style="stop-color:#EAECEF" + id="stop3890" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="26" + id="circle3892" + style="fill:url(#SVGID_1_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="26" + sodipodi:ry="26" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_2_" + gradientUnits="userSpaceOnUse" + x1="-100.5" + y1="-96" + x2="-52.5" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop3895" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop3897" /> + <stop + offset="0.6043" + style="stop-color:#E7EAED" + id="stop3899" /> + <stop + offset="0.6751" + style="stop-color:#DEE4E7" + id="stop3901" /> + <stop + offset="0.7358" + style="stop-color:#CFD9DD" + id="stop3903" /> + <stop + offset="0.791" + style="stop-color:#B9CACF" + id="stop3905" /> + <stop + offset="0.8425" + style="stop-color:#9EB6BD" + id="stop3907" /> + <stop + offset="0.891" + style="stop-color:#7B9EA7" + id="stop3909" /> + <stop + offset="0.9374" + style="stop-color:#53828C" + id="stop3911" /> + <stop + offset="0.9809" + style="stop-color:#25626E" + id="stop3913" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop3915" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="24" + id="circle3917" + style="fill:url(#SVGID_2_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="24" + sodipodi:ry="24" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_3_" + gradientUnits="userSpaceOnUse" + x1="-98.6328" + y1="-96" + x2="-54.3672" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop3920" /> + <stop + offset="0.073" + style="stop-color:#8FAECB" + id="stop3922" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop3924" /> + <stop + offset="0.5902" + style="stop-color:#E7E9ED" + id="stop3926" /> + <stop + offset="0.618" + style="stop-color:#E4E7EB" + id="stop3928" /> + <stop + offset="0.6697" + style="stop-color:#E0E4E9" + id="stop3930" /> + <stop + offset="0.7211" + style="stop-color:#D4DCE1" + id="stop3932" /> + <stop + offset="0.7722" + style="stop-color:#C0CFD5" + id="stop3934" /> + <stop + offset="0.809" + style="stop-color:#ADC2C9" + id="stop3936" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop3938" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="22.132999" + id="circle3940" + style="fill:url(#SVGID_3_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="22.132999" + sodipodi:ry="22.132999" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_4_" + gradientUnits="userSpaceOnUse" + x1="-96.7671" + y1="-96" + x2="-56.2324" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop3943" /> + <stop + offset="0.073" + style="stop-color:#86A7C4" + id="stop3945" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop3947" /> + <stop + offset="0.577" + style="stop-color:#E7EAED" + id="stop3949" /> + <stop + offset="0.618" + style="stop-color:#E1E6EA" + id="stop3951" /> + <stop + offset="0.6697" + style="stop-color:#DDE3E8" + id="stop3953" /> + <stop + offset="0.7211" + style="stop-color:#D1DBE1" + id="stop3955" /> + <stop + offset="0.7722" + style="stop-color:#BDCDD5" + id="stop3957" /> + <stop + offset="0.809" + style="stop-color:#AAC0CA" + id="stop3959" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop3961" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="20.267" + id="circle3963" + style="fill:url(#SVGID_4_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="20.267" + sodipodi:ry="20.267" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_5_" + gradientUnits="userSpaceOnUse" + x1="-94.8999" + y1="-96" + x2="-58.0996" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop3966" /> + <stop + offset="0.073" + style="stop-color:#7E9FBC" + id="stop3968" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop3970" /> + <stop + offset="0.5709" + style="stop-color:#E6E9ED" + id="stop3972" /> + <stop + offset="0.618" + style="stop-color:#DFE4E9" + id="stop3974" /> + <stop + offset="0.6687" + style="stop-color:#DBE1E7" + id="stop3976" /> + <stop + offset="0.7193" + style="stop-color:#CFD9E0" + id="stop3978" /> + <stop + offset="0.7695" + style="stop-color:#BBCCD6" + id="stop3980" /> + <stop + offset="0.809" + style="stop-color:#A6BECA" + id="stop3982" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop3984" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="18.4" + id="circle3986" + style="fill:url(#SVGID_5_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="18.4" + sodipodi:ry="18.4" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_6_" + gradientUnits="userSpaceOnUse" + x1="-93.0332" + y1="-96" + x2="-59.9668" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop3989" /> + <stop + offset="0.073" + style="stop-color:#7697B4" + id="stop3991" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop3993" /> + <stop + offset="0.5636" + style="stop-color:#E6E9ED" + id="stop3995" /> + <stop + offset="0.618" + style="stop-color:#DCE2E8" + id="stop3997" /> + <stop + offset="0.6687" + style="stop-color:#D8DFE6" + id="stop3999" /> + <stop + offset="0.7193" + style="stop-color:#CCD7E0" + id="stop4001" /> + <stop + offset="0.7695" + style="stop-color:#B8CAD5" + id="stop4003" /> + <stop + offset="0.809" + style="stop-color:#A3BCCA" + id="stop4005" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop4007" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="16.533001" + id="circle4009" + style="fill:url(#SVGID_6_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="16.533001" + sodipodi:ry="16.533001" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_7_" + gradientUnits="userSpaceOnUse" + x1="-91.167" + y1="-96" + x2="-61.833" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop4012" /> + <stop + offset="0.073" + style="stop-color:#6D8FAD" + id="stop4014" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop4016" /> + <stop + offset="0.5605" + style="stop-color:#E5E8EC" + id="stop4018" /> + <stop + offset="0.618" + style="stop-color:#DAE1E7" + id="stop4020" /> + <stop + offset="0.6679" + style="stop-color:#D6DEE5" + id="stop4022" /> + <stop + offset="0.7175" + style="stop-color:#CAD6DF" + id="stop4024" /> + <stop + offset="0.7669" + style="stop-color:#B6C9D6" + id="stop4026" /> + <stop + offset="0.809" + style="stop-color:#9FBACB" + id="stop4028" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop4030" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="14.667" + id="circle4032" + style="fill:url(#SVGID_7_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="14.667" + sodipodi:ry="14.667" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_8_" + gradientUnits="userSpaceOnUse" + x1="-89.2998" + y1="-96" + x2="-63.7002" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop4035" /> + <stop + offset="0.073" + style="stop-color:#6587A5" + id="stop4037" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop4039" /> + <stop + offset="0.5588" + style="stop-color:#E4E8EC" + id="stop4041" /> + <stop + offset="0.618" + style="stop-color:#D8DFE7" + id="stop4043" /> + <stop + offset="0.6675" + style="stop-color:#D4DCE5" + id="stop4045" /> + <stop + offset="0.7167" + style="stop-color:#C8D5E0" + id="stop4047" /> + <stop + offset="0.7657" + style="stop-color:#B4C8D6" + id="stop4049" /> + <stop + offset="0.809" + style="stop-color:#9CB8CB" + id="stop4051" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop4053" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="12.8" + id="circle4055" + style="fill:url(#SVGID_8_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="12.8" + sodipodi:ry="12.8" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_9_" + gradientUnits="userSpaceOnUse" + x1="-87.4331" + y1="-96" + x2="-65.5664" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop4058" /> + <stop + offset="0.073" + style="stop-color:#5D809D" + id="stop4060" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop4062" /> + <stop + offset="0.5567" + style="stop-color:#E3E7EC" + id="stop4064" /> + <stop + offset="0.618" + style="stop-color:#D5DDE6" + id="stop4066" /> + <stop + offset="0.6671" + style="stop-color:#D1DAE4" + id="stop4068" /> + <stop + offset="0.7159" + style="stop-color:#C5D3DF" + id="stop4070" /> + <stop + offset="0.7645" + style="stop-color:#B1C6D6" + id="stop4072" /> + <stop + offset="0.809" + style="stop-color:#98B5CB" + id="stop4074" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop4076" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="10.933" + id="circle4078" + style="fill:url(#SVGID_9_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="10.933" + sodipodi:ry="10.933" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_10_" + gradientUnits="userSpaceOnUse" + x1="-85.5659" + y1="-96" + x2="-67.4336" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop4081" /> + <stop + offset="0.073" + style="stop-color:#547896" + id="stop4083" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop4085" /> + <stop + offset="0.5588" + style="stop-color:#E1E6EB" + id="stop4087" /> + <stop + offset="0.618" + style="stop-color:#D3DCE5" + id="stop4089" /> + <stop + offset="0.6663" + style="stop-color:#CFD9E3" + id="stop4091" /> + <stop + offset="0.7143" + style="stop-color:#C3D2DF" + id="stop4093" /> + <stop + offset="0.7621" + style="stop-color:#AFC5D7" + id="stop4095" /> + <stop + offset="0.809" + style="stop-color:#94B3CC" + id="stop4097" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop4099" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="9.066" + id="circle4101" + style="fill:url(#SVGID_10_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="9.066" + sodipodi:ry="9.066" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_11_" + gradientUnits="userSpaceOnUse" + x1="-83.7002" + y1="-96" + x2="-69.2998" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop4104" /> + <stop + offset="0.073" + style="stop-color:#4C708E" + id="stop4106" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop4108" /> + <stop + offset="0.5625" + style="stop-color:#DEE4EA" + id="stop4110" /> + <stop + offset="0.618" + style="stop-color:#D0DAE4" + id="stop4112" /> + <stop + offset="0.6663" + style="stop-color:#CCD7E2" + id="stop4114" /> + <stop + offset="0.7143" + style="stop-color:#C0D0DE" + id="stop4116" /> + <stop + offset="0.7621" + style="stop-color:#ACC3D6" + id="stop4118" /> + <stop + offset="0.809" + style="stop-color:#91B1CC" + id="stop4120" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop4122" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="7.1999998" + id="circle4124" + style="fill:url(#SVGID_11_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="7.1999998" + sodipodi:ry="7.1999998" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_12_" + gradientUnits="userSpaceOnUse" + x1="-81.833" + y1="-96" + x2="-71.167" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop4127" /> + <stop + offset="0.073" + style="stop-color:#446986" + id="stop4129" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop4131" /> + <stop + offset="0.5757" + style="stop-color:#D9E0E8" + id="stop4133" /> + <stop + offset="0.618" + style="stop-color:#CED8E3" + id="stop4135" /> + <stop + offset="0.6655" + style="stop-color:#CAD5E2" + id="stop4137" /> + <stop + offset="0.7129" + style="stop-color:#BECEDD" + id="stop4139" /> + <stop + offset="0.7601" + style="stop-color:#AAC1D6" + id="stop4141" /> + <stop + offset="0.807" + style="stop-color:#8EB0CC" + id="stop4143" /> + <stop + offset="0.809" + style="stop-color:#8DAFCC" + id="stop4145" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop4147" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="5.3330002" + id="circle4149" + style="fill:url(#SVGID_12_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="5.3330002" + sodipodi:ry="5.3330002" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_13_" + gradientUnits="userSpaceOnUse" + x1="-79.9658" + y1="-96" + x2="-73.0342" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop4152" /> + <stop + offset="0.073" + style="stop-color:#3B617F" + id="stop4154" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop4156" /> + <stop + offset="0.6087" + style="stop-color:#CED9E3" + id="stop4158" /> + <stop + offset="0.618" + style="stop-color:#CBD7E2" + id="stop4160" /> + <stop + offset="0.6655" + style="stop-color:#C7D4E1" + id="stop4162" /> + <stop + offset="0.7129" + style="stop-color:#BBCDDD" + id="stop4164" /> + <stop + offset="0.7601" + style="stop-color:#A7C0D6" + id="stop4166" /> + <stop + offset="0.807" + style="stop-color:#8BAECD" + id="stop4168" /> + <stop + offset="0.809" + style="stop-color:#8AADCD" + id="stop4170" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop4172" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="3.4660001" + id="circle4174" + style="fill:url(#SVGID_13_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="3.4660001" + sodipodi:ry="3.4660001" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +<linearGradient + id="SVGID_14_" + gradientUnits="userSpaceOnUse" + x1="-78.1001" + y1="-96" + x2="-74.9004" + y2="-96" + gradientTransform="matrix(1,0,0,-1,102.5,-70)"> + <stop + offset="0.0056" + style="stop-color:#8AADCE" + id="stop4177" /> + <stop + offset="0.073" + style="stop-color:#335977" + id="stop4179" /> + <stop + offset="0.5" + style="stop-color:#EAECEF" + id="stop4181" /> + <stop + offset="0.618" + style="stop-color:#C9D5E1" + id="stop4183" /> + <stop + offset="0.6648" + style="stop-color:#C5D3E0" + id="stop4185" /> + <stop + offset="0.7114" + style="stop-color:#B9CBDC" + id="stop4187" /> + <stop + offset="0.758" + style="stop-color:#A5BFD6" + id="stop4189" /> + <stop + offset="0.8042" + style="stop-color:#89ADCE" + id="stop4191" /> + <stop + offset="0.809" + style="stop-color:#86ABCD" + id="stop4193" /> + <stop + offset="1" + style="stop-color:#0E525F" + id="stop4195" /> +</linearGradient> +<circle + cx="26" + cy="26" + r="1.6" + id="circle4197" + style="fill:url(#SVGID_14_)" + sodipodi:cx="26" + sodipodi:cy="26" + sodipodi:rx="1.6" + sodipodi:ry="1.6" + transform="matrix(0.923077,0,0,0.923077,2,1.999996)" /> +</svg>
\ No newline at end of file diff --git a/examples/declarative/ui-components/slideswitch/qml/slideswitch.qml b/examples/declarative/ui-components/slideswitch/qml/slideswitch.qml new file mode 100644 index 0000000..0472f9f --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qml/slideswitch.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 +import "content" + +Rectangle { + color: "white" + width: 400; height: 250 + +//![0] + Switch { anchors.centerIn: parent; on: false } +//![0] +} diff --git a/examples/declarative/ui-components/slideswitch/qml/slideswitch.qmlproject b/examples/declarative/ui-components/slideswitch/qml/slideswitch.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qml/slideswitch.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/ui-components/slideswitch/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/ui-components/slideswitch/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/ui-components/slideswitch/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/ui-components/slideswitch/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/ui-components/slideswitch/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/ui-components/slideswitch/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/README b/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/README new file mode 100644 index 0000000..f2b87fb --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/README @@ -0,0 +1,6 @@ +The Debian Package slideswitch +---------------------------- + +Comments regarding the Package + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:31:28 +0100 diff --git a/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/changelog b/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/changelog new file mode 100644 index 0000000..46d83ac --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/changelog @@ -0,0 +1,5 @@ +slideswitch (0.0.1) unstable; urgency=low + + * Initial Release. + + -- Daniel Molkentin <danimo@unknown> Thu, 18 Nov 2010 17:31:28 +0100 diff --git a/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/compat b/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/compat @@ -0,0 +1 @@ +7 diff --git a/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/control b/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/control new file mode 100644 index 0000000..f6eb57d --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/control @@ -0,0 +1,13 @@ +Source: slideswitch +Section: user/hidden +Priority: optional +Maintainer: Daniel Molkentin <danimo@unknown> +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: <insert the upstream URL, if relevant> + +Package: slideswitch +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: <insert up to 60 chars description> + <insert long description, indented with spaces> diff --git a/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/copyright b/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/copyright new file mode 100644 index 0000000..06785f0 --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/copyright @@ -0,0 +1,40 @@ +This package was debianized by Daniel Molkentin <danimo@unknown> on +Thu, 18 Nov 2010 17:31:28 +0100. + +It was downloaded from <url://example.com> + +Upstream Author(s): + + <put author's name and email here> + <likewise for another author> + +Copyright: + + <Copyright (C) YYYY Name OfAuthor> + <likewise for another author> + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2010, Daniel Molkentin <danimo@unknown> and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/rules b/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/rules new file mode 100755 index 0000000..0205aef --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/qtc_packaging/debian_fremantle/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + #docbook-to-man debian/slideswitch.sgml > slideswitch.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/slideswitch. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/slideswitch install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + # dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/examples/declarative/ui-components/slideswitch/slideswitch.desktop b/examples/declarative/ui-components/slideswitch/slideswitch.desktop new file mode 100644 index 0000000..9f46a0b --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/slideswitch.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=slideswitch +Exec=/opt/usr/bin/slideswitch +Icon=slideswitch +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/ui-components/slideswitch/slideswitch.png b/examples/declarative/ui-components/slideswitch/slideswitch.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/slideswitch.png diff --git a/examples/declarative/ui-components/slideswitch/slideswitch.pro b/examples/declarative/ui-components/slideswitch/slideswitch.pro new file mode 100644 index 0000000..230281b --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/slideswitch.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +#DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xEAB2005A + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/ui-components/slideswitch/slideswitch.svg b/examples/declarative/ui-components/slideswitch/slideswitch.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/ui-components/slideswitch/slideswitch.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/declarative/xml/xmlhttprequest-example/main.cpp b/examples/declarative/xml/xmlhttprequest-example/main.cpp new file mode 100644 index 0000000..037f551 --- /dev/null +++ b/examples/declarative/xml/xmlhttprequest-example/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "qmlapplicationviewer.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/qml/xmlhttprequest-example.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/xml/xmlhttprequest-example/qml/data.xml b/examples/declarative/xml/xmlhttprequest-example/qml/data.xml new file mode 100644 index 0000000..8b7f1e1 --- /dev/null +++ b/examples/declarative/xml/xmlhttprequest-example/qml/data.xml @@ -0,0 +1,5 @@ +<data> + <element1 /> + <element2 /> +</data> + diff --git a/examples/declarative/xml/xmlhttprequest-example/qml/xmlhttprequest-example.qml b/examples/declarative/xml/xmlhttprequest-example/qml/xmlhttprequest-example.qml new file mode 100644 index 0000000..78f93b5 --- /dev/null +++ b/examples/declarative/xml/xmlhttprequest-example/qml/xmlhttprequest-example.qml @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + width: 350; height: 400 + + function showRequestInfo(text) { + log.text = log.text + "\n" + text + console.log(text) + } + + Text { id: log; anchors.fill: parent; anchors.margins: 10 } + + Rectangle { + id: button + anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; anchors.margins: 10 + width: buttonText.width + 10; height: buttonText.height + 10 + border.width: mouseArea.pressed ? 2 : 1 + radius : 5; smooth: true + + Text { id: buttonText; anchors.centerIn: parent; text: "Request data.xml" } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { + log.text = "" + console.log("\n") + + var doc = new XMLHttpRequest(); + doc.onreadystatechange = function() { + if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) { + showRequestInfo("Headers -->"); + showRequestInfo(doc.getAllResponseHeaders ()); + showRequestInfo("Last modified -->"); + showRequestInfo(doc.getResponseHeader ("Last-Modified")); + + } else if (doc.readyState == XMLHttpRequest.DONE) { + var a = doc.responseXML.documentElement; + for (var ii = 0; ii < a.childNodes.length; ++ii) { + showRequestInfo(a.childNodes[ii].nodeName); + } + showRequestInfo("Headers -->"); + showRequestInfo(doc.getAllResponseHeaders ()); + showRequestInfo("Last modified -->"); + showRequestInfo(doc.getResponseHeader ("Last-Modified")); + } + } + + doc.open("GET", "data.xml"); + doc.send(); + } + } + } +} + diff --git a/examples/declarative/xml/xmlhttprequest-example/qml/xmlhttprequest.qmlproject b/examples/declarative/xml/xmlhttprequest-example/qml/xmlhttprequest.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/xml/xmlhttprequest-example/qml/xmlhttprequest.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* 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/examples/declarative/xml/xmlhttprequest-example/qmlapplicationviewer/qmlapplicationviewer.cpp b/examples/declarative/xml/xmlhttprequest-example/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..11bedd1 --- /dev/null +++ b/examples/declarative/xml/xmlhttprequest-example/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,157 @@ +// checksum 0x28c7 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) +#include <eikenv.h> +#include <eikappui.h> +#include <aknenv.h> +#include <aknappui.h> +#endif // Q_OS_SYMBIAN && ORIENTATIONLOCK + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#ifdef Q_OS_SYMBIAN + if (orientation != ScreenOrientationAuto) { +#if defined(ORIENTATIONLOCK) + const CAknAppUiBase::TAppUiOrientation uiOrientation = + (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait + : CAknAppUi::EAppUiOrientationLandscape; + CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); + TRAPD(error, + if (appUi) + appUi->SetOrientationL(uiOrientation); + ); + Q_UNUSED(error) +#else // ORIENTATIONLOCK + qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); +#endif // ORIENTATIONLOCK + } +#elif defined(Q_WS_MAEMO_5) + Qt::WidgetAttribute attribute; + switch (orientation) { + case ScreenOrientationLockPortrait: + attribute = Qt::WA_Maemo5PortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_Maemo5LandscapeOrientation; + break; + case ScreenOrientationAuto: + default: + attribute = Qt::WA_Maemo5AutoOrientation; + break; + } + setAttribute(attribute, true); +#else // Q_OS_SYMBIAN + Q_UNUSED(orientation); +#endif // Q_OS_SYMBIAN +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/examples/declarative/xml/xmlhttprequest-example/qmlapplicationviewer/qmlapplicationviewer.h b/examples/declarative/xml/xmlhttprequest-example/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..143c17b --- /dev/null +++ b/examples/declarative/xml/xmlhttprequest-example/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x2000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/examples/declarative/xml/xmlhttprequest-example/qmlapplicationviewer/qmlapplicationviewer.pri b/examples/declarative/xml/xmlhttprequest-example/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1c0c7ed --- /dev/null +++ b/examples/declarative/xml/xmlhttprequest-example/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,154 @@ +# checksum 0x3dc8 version 0x2000a +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + return(false) +} + +contains(DEFINES, QMLJSDEBUGGER) { + CONFIG(debug, debug|release) { + !minQtVersion(4, 7, 1) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("This library requires Qt 4.7.1 or newer.") + warning() + DEFINES -= QMLJSDEBUGGER + } else:isEmpty(QMLJSDEBUGGER_PATH) { + warning() + warning("Disabling QML debugging:") + warning() + warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.") + warning("Please specify its location on the qmake command line, eg") + warning(" qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger") + warning() + DEFINES -= QMLJSDEBUGGER + } else { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) + } + } else { + DEFINES -= QMLJSDEBUGGER + } +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + ICON = $${TARGET}.svg + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 + contains(DEFINES, ORIENTATIONLOCK):LIBS += -lavkon -leikcore -lcone + contains(DEFINES, NETWORKACCESS):TARGET.CAPABILITY += NetworkServices +} else:win32 { + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$eval($${deploymentfolder}.source) + pathSegments = $$split(source, /) + sourceAndTarget = $$MAINPROFILEPWD/$$source $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(pathSegments) + copyCommand += && $(COPY_DIR) $$replace(sourceAndTarget, /, \\) + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + installPrefix = /opt/usr + desktopfile.path = /usr/share/applications/hildon + } else { + installPrefix = /usr/local + desktopfile.path = /usr/share/applications + !isEqual(PWD,$$OUT_PWD) { + copyCommand = @echo Copying application data... + for(deploymentfolder, DEPLOYMENTFOLDERS) { + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + copyCommand += && $(MKDIR) $$target + copyCommand += && $(COPY_DIR) $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) $$target + } + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/share/$${TARGET}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.desktop b/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.desktop new file mode 100644 index 0000000..c5065cf --- /dev/null +++ b/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=xmlhttprequest-example +Exec=/opt/usr/bin/xmlhttprequest-example +Icon=xmlhttprequest-example +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.png b/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.png Binary files differnew file mode 100644 index 0000000..707d5c4 --- /dev/null +++ b/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.png diff --git a/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.pro b/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.pro new file mode 100644 index 0000000..687c8ca --- /dev/null +++ b/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.pro @@ -0,0 +1,39 @@ +# Add more folders to ship with the application, here +folder_01.source = qml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +# Avoid auto screen rotation +DEFINES += ORIENTATIONLOCK + +# Needs to be defined for Symbian +DEFINES += NETWORKACCESS + +symbian:TARGET.UID3 = 0xE83495FC + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Define QMLJSDEBUGGER to allow debugging of QML in debug builds +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.svg b/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/xml/xmlhttprequest-example/xmlhttprequestexample.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/designer/calculatorbuilder/calculatorbuilder.desktop b/examples/designer/calculatorbuilder/calculatorbuilder.desktop new file mode 100644 index 0000000..9c7abed --- /dev/null +++ b/examples/designer/calculatorbuilder/calculatorbuilder.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Calculator Builder +Exec=/opt/usr/bin/calculatorbuilder +Icon=calculatorbuilder +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/designer/calculatorform/calculatorform.desktop b/examples/designer/calculatorform/calculatorform.desktop new file mode 100644 index 0000000..5368b70 --- /dev/null +++ b/examples/designer/calculatorform/calculatorform.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Calculator Form +Exec=/opt/usr/bin/calculatorform +Icon=calculatorform +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/designer/containerextension/containerextension.desktop b/examples/designer/containerextension/containerextension.desktop new file mode 100644 index 0000000..7c4ef6d --- /dev/null +++ b/examples/designer/containerextension/containerextension.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Container Extension +Exec=/opt/usr/bin/containerextension +Icon=containerextension +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/designer/customwidgetplugin/customwidgetplugin.desktop b/examples/designer/customwidgetplugin/customwidgetplugin.desktop new file mode 100644 index 0000000..ae652c7 --- /dev/null +++ b/examples/designer/customwidgetplugin/customwidgetplugin.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Custom Widget Plugin +Exec=/opt/usr/bin/customwidgetplugin +Icon=customwidgetplugin +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/designer/taskmenuextension/taskmenuextension.desktop b/examples/designer/taskmenuextension/taskmenuextension.desktop new file mode 100644 index 0000000..278d157 --- /dev/null +++ b/examples/designer/taskmenuextension/taskmenuextension.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Task Menu Extension +Exec=/opt/usr/bin/taskmenuextension +Icon=taskmenuextension +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.desktop b/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.desktop new file mode 100644 index 0000000..986922c --- /dev/null +++ b/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=World Time Clock Builder +Exec=/opt/usr/bin/worldtimeclockbuilder +Icon=worldtimeclockbuilder +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/desktop/screenshot/screenshot.desktop b/examples/desktop/screenshot/screenshot.desktop new file mode 100644 index 0000000..236d360 --- /dev/null +++ b/examples/desktop/screenshot/screenshot.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Screenshot +Exec=/opt/usr/bin/screenshot +Icon=screenshot +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/desktop/systray/systray.desktop b/examples/desktop/systray/systray.desktop new file mode 100644 index 0000000..0490e71 --- /dev/null +++ b/examples/desktop/systray/systray.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=System Tray Icon +Exec=/opt/usr/bin/systray +Icon=systray +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dialogs/classwizard/classwizard.desktop b/examples/dialogs/classwizard/classwizard.desktop new file mode 100644 index 0000000..7f7d232 --- /dev/null +++ b/examples/dialogs/classwizard/classwizard.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Class Wizard +Exec=/opt/usr/bin/classwizard +Icon=classwizard +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dialogs/configdialog/configdialog.desktop b/examples/dialogs/configdialog/configdialog.desktop new file mode 100644 index 0000000..11a3268 --- /dev/null +++ b/examples/dialogs/configdialog/configdialog.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Config Dialog +Exec=/opt/usr/bin/configdialog +Icon=configdialog +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dialogs/extension/extension.desktop b/examples/dialogs/extension/extension.desktop new file mode 100644 index 0000000..374b1c8 --- /dev/null +++ b/examples/dialogs/extension/extension.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Extension +Exec=/opt/usr/bin/extension +Icon=extension +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dialogs/findfiles/findfiles.desktop b/examples/dialogs/findfiles/findfiles.desktop new file mode 100644 index 0000000..04c91cd --- /dev/null +++ b/examples/dialogs/findfiles/findfiles.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Find Files +Exec=/opt/usr/bin/findfiles +Icon=findfiles +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dialogs/licensewizard/licensewizard.desktop b/examples/dialogs/licensewizard/licensewizard.desktop new file mode 100644 index 0000000..423d81e --- /dev/null +++ b/examples/dialogs/licensewizard/licensewizard.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=License Wizard +Exec=/opt/usr/bin/licensewizard +Icon=licensewizard +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dialogs/sipdialog/sipdialog.desktop b/examples/dialogs/sipdialog/sipdialog.desktop new file mode 100644 index 0000000..b9c9955 --- /dev/null +++ b/examples/dialogs/sipdialog/sipdialog.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=SIP Dialog +Exec=/opt/usr/bin/sipdialog +Icon=sipdialog +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dialogs/standarddialogs/standarddialogs.desktop b/examples/dialogs/standarddialogs/standarddialogs.desktop new file mode 100644 index 0000000..f748303 --- /dev/null +++ b/examples/dialogs/standarddialogs/standarddialogs.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Standard Dialogs +Exec=/opt/usr/bin/standarddialogs +Icon=standarddialogs +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dialogs/tabdialog/tabdialog.desktop b/examples/dialogs/tabdialog/tabdialog.desktop new file mode 100644 index 0000000..651f7d4 --- /dev/null +++ b/examples/dialogs/tabdialog/tabdialog.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Tab Dialog +Exec=/opt/usr/bin/tabdialog +Icon=tabdialog +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/dialogs/trivialwizard/trivialwizard.desktop b/examples/dialogs/trivialwizard/trivialwizard.desktop new file mode 100644 index 0000000..fad568e --- /dev/null +++ b/examples/dialogs/trivialwizard/trivialwizard.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Trivial Wizard +Exec=/opt/usr/bin/trivialwizard +Icon=trivialwizard +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/draganddrop/delayedencoding/delayedencoding.desktop b/examples/draganddrop/delayedencoding/delayedencoding.desktop new file mode 100644 index 0000000..629c497 --- /dev/null +++ b/examples/draganddrop/delayedencoding/delayedencoding.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Delayed Encoding +Exec=/opt/usr/bin/delayedencoding +Icon=delayedencoding +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/draganddrop/draggableicons/draggableicons.desktop b/examples/draganddrop/draggableicons/draggableicons.desktop new file mode 100644 index 0000000..d14f758 --- /dev/null +++ b/examples/draganddrop/draggableicons/draggableicons.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Draggable Icons +Exec=/opt/usr/bin/draggableicons +Icon=draggableicons +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/draganddrop/draggabletext/draggabletext.desktop b/examples/draganddrop/draggabletext/draggabletext.desktop new file mode 100644 index 0000000..ceda807 --- /dev/null +++ b/examples/draganddrop/draggabletext/draggabletext.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Draggable Text +Exec=/opt/usr/bin/draggabletext +Icon=draggabletext +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/draganddrop/dropsite/dropsite.desktop b/examples/draganddrop/dropsite/dropsite.desktop new file mode 100644 index 0000000..70a192f --- /dev/null +++ b/examples/draganddrop/dropsite/dropsite.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Drop Site +Exec=/opt/usr/bin/dropsite +Icon=dropsite +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/draganddrop/fridgemagnets/fridgemagnets.desktop b/examples/draganddrop/fridgemagnets/fridgemagnets.desktop new file mode 100644 index 0000000..a240590 --- /dev/null +++ b/examples/draganddrop/fridgemagnets/fridgemagnets.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Fridge Magnets +Exec=/opt/usr/bin/fridgemagnets +Icon=fridgemagnets +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/draganddrop/puzzle/puzzle.desktop b/examples/draganddrop/puzzle/puzzle.desktop new file mode 100644 index 0000000..f6765e1 --- /dev/null +++ b/examples/draganddrop/puzzle/puzzle.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Drag and Drop Puzzle +Exec=/opt/usr/bin/puzzle +Icon=puzzle +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/effects/blurpicker/blurpicker.desktop b/examples/effects/blurpicker/blurpicker.desktop new file mode 100644 index 0000000..0863ef7 --- /dev/null +++ b/examples/effects/blurpicker/blurpicker.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Blur Picker Effect +Exec=/opt/usr/bin/blurpicker +Icon=blurpicker +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/effects/fademessage/fademessage.desktop b/examples/effects/fademessage/fademessage.desktop new file mode 100644 index 0000000..aa22ad7 --- /dev/null +++ b/examples/effects/fademessage/fademessage.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Fade Message Effect +Exec=/opt/usr/bin/fademessage +Icon=fademessage +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/effects/lighting/lighting.desktop b/examples/effects/lighting/lighting.desktop new file mode 100644 index 0000000..806b3de --- /dev/null +++ b/examples/effects/lighting/lighting.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Lighting Effect +Exec=/opt/usr/bin/lighting +Icon=lighting +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/gestures/imagegestures/imagegestures.desktop b/examples/gestures/imagegestures/imagegestures.desktop new file mode 100644 index 0000000..06068ff --- /dev/null +++ b/examples/gestures/imagegestures/imagegestures.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Image Gestures +Exec=/opt/usr/bin/imagegestures +Icon=imagegestures +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/graphicsview/anchorlayout/anchorlayout.desktop b/examples/graphicsview/anchorlayout/anchorlayout.desktop new file mode 100644 index 0000000..6cf53c3 --- /dev/null +++ b/examples/graphicsview/anchorlayout/anchorlayout.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Anchor Layout +Exec=/opt/usr/bin/anchorlayout +Icon=anchorlayout +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.desktop b/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.desktop new file mode 100644 index 0000000..be1c3e4 --- /dev/null +++ b/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Basic Graphics Layouts +Exec=/opt/usr/bin/basicgraphicslayouts +Icon=basicgraphicslayouts +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/graphicsview/collidingmice/collidingmice.desktop b/examples/graphicsview/collidingmice/collidingmice.desktop new file mode 100644 index 0000000..f0064e7 --- /dev/null +++ b/examples/graphicsview/collidingmice/collidingmice.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Colliding Mice +Exec=/opt/usr/bin/collidingmice +Icon=collidingmice +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/graphicsview/dragdroprobot/dragdroprobot.desktop b/examples/graphicsview/dragdroprobot/dragdroprobot.desktop new file mode 100644 index 0000000..c01e3a3 --- /dev/null +++ b/examples/graphicsview/dragdroprobot/dragdroprobot.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Drag and Drop Robot +Exec=/opt/usr/bin/dragdroprobot +Icon=dragdroprobot +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/graphicsview/elasticnodes/elasticnodes.desktop b/examples/graphicsview/elasticnodes/elasticnodes.desktop new file mode 100644 index 0000000..64402d0 --- /dev/null +++ b/examples/graphicsview/elasticnodes/elasticnodes.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Elastic Nodes +Exec=/opt/usr/bin/elasticnodes +Icon=elasticnodes +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/graphicsview/flowlayout/flowlayout.desktop b/examples/graphicsview/flowlayout/flowlayout.desktop new file mode 100644 index 0000000..54ea3b0 --- /dev/null +++ b/examples/graphicsview/flowlayout/flowlayout.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Flow Layout +Exec=/opt/usr/bin/flowlayout +Icon=flowlayout +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/graphicsview/padnavigator/padnavigator.desktop b/examples/graphicsview/padnavigator/padnavigator.desktop new file mode 100644 index 0000000..f049073 --- /dev/null +++ b/examples/graphicsview/padnavigator/padnavigator.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Pad Navigator +Exec=/opt/usr/bin/padnavigator +Icon=padnavigator +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/graphicsview/portedasteroids/portedasteroids.desktop b/examples/graphicsview/portedasteroids/portedasteroids.desktop new file mode 100644 index 0000000..abd0616 --- /dev/null +++ b/examples/graphicsview/portedasteroids/portedasteroids.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Ported Asteroids +Exec=/opt/usr/bin/portedasteroids +Icon=portedasteroids +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/graphicsview/portedcanvas/portedcanvas.desktop b/examples/graphicsview/portedcanvas/portedcanvas.desktop new file mode 100644 index 0000000..1217dc4 --- /dev/null +++ b/examples/graphicsview/portedcanvas/portedcanvas.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Ported Canvas +Exec=/opt/usr/bin/portedcanvas +Icon=portedcanvas +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/graphicsview/simpleanchorlayout/simpleanchorlayout.desktop b/examples/graphicsview/simpleanchorlayout/simpleanchorlayout.desktop new file mode 100644 index 0000000..0e8d73a --- /dev/null +++ b/examples/graphicsview/simpleanchorlayout/simpleanchorlayout.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Simple Anchor Layout +Exec=/opt/usr/bin/simpleanchorlayout +Icon=simpleanchorlayout +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.desktop b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.desktop new file mode 100644 index 0000000..0c6ab89 --- /dev/null +++ b/examples/graphicsview/weatheranchorlayout/weatheranchorlayout.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Weather Anchor Layout +Exec=/opt/usr/bin/weatheranchorlayout +Icon=weatheranchorlayout +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/help/contextsensitivehelp/contextsensitivehelp.desktop b/examples/help/contextsensitivehelp/contextsensitivehelp.desktop new file mode 100644 index 0000000..3171065 --- /dev/null +++ b/examples/help/contextsensitivehelp/contextsensitivehelp.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Context-Sensitive Help +Exec=/opt/usr/bin/contextsensitivehelp +Icon=contextsensitivehelp +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/help/remotecontrol/remotecontrol.desktop b/examples/help/remotecontrol/remotecontrol.desktop new file mode 100644 index 0000000..7a72055 --- /dev/null +++ b/examples/help/remotecontrol/remotecontrol.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Remote Control +Exec=/opt/usr/bin/remotecontrol +Icon=remotecontrol +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/help/simpletextviewer/simpletextviewer.desktop b/examples/help/simpletextviewer/simpletextviewer.desktop new file mode 100644 index 0000000..d72b602 --- /dev/null +++ b/examples/help/simpletextviewer/simpletextviewer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Simple Text Viewer +Exec=/opt/usr/bin/simpletextviewer +Icon=simpletextviewer +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/ipc/localfortuneclient/localfortuneclient.desktop b/examples/ipc/localfortuneclient/localfortuneclient.desktop new file mode 100644 index 0000000..556ff47 --- /dev/null +++ b/examples/ipc/localfortuneclient/localfortuneclient.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Local Fortune Client +Exec=/opt/usr/bin/localfortuneclient +Icon=localfortuneclient +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/ipc/localfortuneserver/localfortuneserver.desktop b/examples/ipc/localfortuneserver/localfortuneserver.desktop new file mode 100644 index 0000000..74f4850 --- /dev/null +++ b/examples/ipc/localfortuneserver/localfortuneserver.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Local Fortune Server +Exec=/opt/usr/bin/localfortuneserver +Icon=localfortuneserver +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/ipc/sharedmemory/sharedmemory.desktop b/examples/ipc/sharedmemory/sharedmemory.desktop new file mode 100644 index 0000000..118ded9 --- /dev/null +++ b/examples/ipc/sharedmemory/sharedmemory.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Shared Memory +Exec=/opt/usr/bin/sharedmemory +Icon=sharedmemory +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/addressbook/addressbook.desktop b/examples/itemviews/addressbook/addressbook.desktop new file mode 100644 index 0000000..11767f5 --- /dev/null +++ b/examples/itemviews/addressbook/addressbook.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Address Book +Exec=/opt/usr/bin/addressbook +Icon=addressbook +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/basicsortfiltermodel/basicsortfiltermodel.desktop b/examples/itemviews/basicsortfiltermodel/basicsortfiltermodel.desktop new file mode 100644 index 0000000..22621f3 --- /dev/null +++ b/examples/itemviews/basicsortfiltermodel/basicsortfiltermodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Basic Sort Filter Model +Exec=/opt/usr/bin/basicsortfiltermodel +Icon=basicsortfiltermodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/chart/chart.desktop b/examples/itemviews/chart/chart.desktop new file mode 100644 index 0000000..73e017b --- /dev/null +++ b/examples/itemviews/chart/chart.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Chart +Exec=/opt/usr/bin/chart +Icon=chart +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/coloreditorfactory/coloreditorfactory.desktop b/examples/itemviews/coloreditorfactory/coloreditorfactory.desktop new file mode 100644 index 0000000..70b9664 --- /dev/null +++ b/examples/itemviews/coloreditorfactory/coloreditorfactory.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Color Editor Factory +Exec=/opt/usr/bin/coloreditorfactory +Icon=coloreditorfactory +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/combowidgetmapper/combowidgetmapper.desktop b/examples/itemviews/combowidgetmapper/combowidgetmapper.desktop new file mode 100644 index 0000000..3bbf6ad --- /dev/null +++ b/examples/itemviews/combowidgetmapper/combowidgetmapper.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Combo Widget Mapper +Exec=/opt/usr/bin/combowidgetmapper +Icon=combowidgetmapper +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/customsortfiltermodel/customsortfiltermodel.desktop b/examples/itemviews/customsortfiltermodel/customsortfiltermodel.desktop new file mode 100644 index 0000000..3c961f7 --- /dev/null +++ b/examples/itemviews/customsortfiltermodel/customsortfiltermodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Custom Sort Filter Model +Exec=/opt/usr/bin/customsortfiltermodel +Icon=customsortfiltermodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/dirview/dirview.desktop b/examples/itemviews/dirview/dirview.desktop new file mode 100644 index 0000000..51ec4df --- /dev/null +++ b/examples/itemviews/dirview/dirview.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Dir View +Exec=/opt/usr/bin/dirview +Icon=dirview +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/editabletreemodel/editabletreemodel.desktop b/examples/itemviews/editabletreemodel/editabletreemodel.desktop new file mode 100644 index 0000000..17d1733 --- /dev/null +++ b/examples/itemviews/editabletreemodel/editabletreemodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Editable Tree Model +Exec=/opt/usr/bin/editabletreemodel +Icon=editabletreemodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/fetchmore/fetchmore.desktop b/examples/itemviews/fetchmore/fetchmore.desktop new file mode 100644 index 0000000..b8c9ff3 --- /dev/null +++ b/examples/itemviews/fetchmore/fetchmore.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Fetch More +Exec=/opt/usr/bin/fetchmore +Icon=fetchmore +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/frozencolumn/frozencolumn.desktop b/examples/itemviews/frozencolumn/frozencolumn.desktop new file mode 100644 index 0000000..3d1e3b4 --- /dev/null +++ b/examples/itemviews/frozencolumn/frozencolumn.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Frozen Column +Exec=/opt/usr/bin/frozencolumn +Icon=frozencolumn +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/pixelator/pixelator.desktop b/examples/itemviews/pixelator/pixelator.desktop new file mode 100644 index 0000000..751deb1 --- /dev/null +++ b/examples/itemviews/pixelator/pixelator.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Pixelator +Exec=/opt/usr/bin/pixelator +Icon=pixelator +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/puzzle/puzzle.desktop b/examples/itemviews/puzzle/puzzle.desktop new file mode 100644 index 0000000..d493e7d --- /dev/null +++ b/examples/itemviews/puzzle/puzzle.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Item Views Puzzle +Exec=/opt/usr/bin/puzzle +Icon=puzzle +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/simpledommodel/simpledommodel.desktop b/examples/itemviews/simpledommodel/simpledommodel.desktop new file mode 100644 index 0000000..a53b896 --- /dev/null +++ b/examples/itemviews/simpledommodel/simpledommodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Simple DOM Model +Exec=/opt/usr/bin/simpledommodel +Icon=simpledommodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/simpletreemodel/simpletreemodel.desktop b/examples/itemviews/simpletreemodel/simpletreemodel.desktop new file mode 100644 index 0000000..361202f --- /dev/null +++ b/examples/itemviews/simpletreemodel/simpletreemodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Simple Tree Model +Exec=/opt/usr/bin/simpletreemodel +Icon=simpletreemodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/simplewidgetmapper/simplewidgetmapper.desktop b/examples/itemviews/simplewidgetmapper/simplewidgetmapper.desktop new file mode 100644 index 0000000..6b09a23 --- /dev/null +++ b/examples/itemviews/simplewidgetmapper/simplewidgetmapper.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Simple Widget Mapper +Exec=/opt/usr/bin/simplewidgetmapper +Icon=simplewidgetmapper +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/spinboxdelegate/spinboxdelegate.desktop b/examples/itemviews/spinboxdelegate/spinboxdelegate.desktop new file mode 100644 index 0000000..347e408 --- /dev/null +++ b/examples/itemviews/spinboxdelegate/spinboxdelegate.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Spin Box Delegate +Exec=/opt/usr/bin/spinboxdelegate +Icon=spinboxdelegate +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/itemviews/stardelegate/stardelegate.desktop b/examples/itemviews/stardelegate/stardelegate.desktop new file mode 100644 index 0000000..d508c3b --- /dev/null +++ b/examples/itemviews/stardelegate/stardelegate.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Star Delegate +Exec=/opt/usr/bin/stardelegate +Icon=stardelegate +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/layouts/basiclayouts/basiclayouts.desktop b/examples/layouts/basiclayouts/basiclayouts.desktop new file mode 100644 index 0000000..6c612ee --- /dev/null +++ b/examples/layouts/basiclayouts/basiclayouts.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Basic Layouts +Exec=/opt/usr/bin/basiclayouts +Icon=basiclayouts +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/layouts/borderlayout/borderlayout.desktop b/examples/layouts/borderlayout/borderlayout.desktop new file mode 100644 index 0000000..3fd0641 --- /dev/null +++ b/examples/layouts/borderlayout/borderlayout.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Border Layout +Exec=/opt/usr/bin/borderlayout +Icon=borderlayout +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/layouts/dynamiclayouts/dynamiclayouts.desktop b/examples/layouts/dynamiclayouts/dynamiclayouts.desktop new file mode 100644 index 0000000..482286b --- /dev/null +++ b/examples/layouts/dynamiclayouts/dynamiclayouts.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Dynamic Layouts +Exec=/opt/usr/bin/dynamiclayouts +Icon=dynamiclayouts +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/layouts/flowlayout/flowlayout.desktop b/examples/layouts/flowlayout/flowlayout.desktop new file mode 100644 index 0000000..54ea3b0 --- /dev/null +++ b/examples/layouts/flowlayout/flowlayout.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Flow Layout +Exec=/opt/usr/bin/flowlayout +Icon=flowlayout +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/linguist/arrowpad/arrowpad.desktop b/examples/linguist/arrowpad/arrowpad.desktop new file mode 100644 index 0000000..a498296 --- /dev/null +++ b/examples/linguist/arrowpad/arrowpad.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Arrow Pad +Exec=/opt/usr/bin/arrowpad +Icon=arrowpad +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/linguist/hellotr/hellotr.desktop b/examples/linguist/hellotr/hellotr.desktop new file mode 100644 index 0000000..0d916b0 --- /dev/null +++ b/examples/linguist/hellotr/hellotr.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Hello tr() +Exec=/opt/usr/bin/hellotr +Icon=hellotr +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/linguist/trollprint/trollprint.desktop b/examples/linguist/trollprint/trollprint.desktop new file mode 100644 index 0000000..7690bc2 --- /dev/null +++ b/examples/linguist/trollprint/trollprint.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Troll Print +Exec=/opt/usr/bin/trollprint +Icon=trollprint +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/maemo5pkgrules.pri b/examples/maemo5pkgrules.pri new file mode 100644 index 0000000..18cc1a7 --- /dev/null +++ b/examples/maemo5pkgrules.pri @@ -0,0 +1,27 @@ +!maemo5: error(Only include this file for Maemo5 platforms) + +PREFIX = /opt/usr +BINDIR = $$PREFIX/bin +DATADIR = $$PREFIX/share + +provide_icon.commands = "$$QMAKE_COPY \"$$PWD/qt.png\" \"$$OUT_PWD/$${TARGET}.png\"" +QMAKE_EXTRA_TARGETS += provide_icon +CLEANFILES += $$OUT_PWD/$${TARGET}.png + +icon.CONFIG += no_check_exist +icon.files = $$OUT_PWD/$${TARGET}.png +icon.path = /usr/share/icons/hicolor/64x64/apps/ +icon.depends = provide_icon + +desktopfile.path = /usr/share/applications/hildon +desktopfile.files = $${TARGET}.desktop + +DEFINES += DATADIR=\\\"$$DATADIR\\\" \ + PKGDATADIR=\\\"$$PKGDATADIR\\\" + +target.path = $$BINDIR + +INSTALLS += desktopfile icon + +# Don't install sources on the embedded target +INSTALLS -= sources diff --git a/examples/mainwindows/application/application.desktop b/examples/mainwindows/application/application.desktop new file mode 100644 index 0000000..b6fab1f --- /dev/null +++ b/examples/mainwindows/application/application.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Application +Exec=/opt/usr/bin/application +Icon=application +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/mainwindows/dockwidgets/dockwidgets.desktop b/examples/mainwindows/dockwidgets/dockwidgets.desktop new file mode 100644 index 0000000..1f57cb6 --- /dev/null +++ b/examples/mainwindows/dockwidgets/dockwidgets.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Dock Widgets +Exec=/opt/usr/bin/dockwidgets +Icon=dockwidgets +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/mainwindows/mdi/mdi.desktop b/examples/mainwindows/mdi/mdi.desktop new file mode 100644 index 0000000..267e6f1 --- /dev/null +++ b/examples/mainwindows/mdi/mdi.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=MDI +Exec=/opt/usr/bin/mdi +Icon=mdi +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/mainwindows/menus/menus.desktop b/examples/mainwindows/menus/menus.desktop new file mode 100644 index 0000000..dc2bda9 --- /dev/null +++ b/examples/mainwindows/menus/menus.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Menus +Exec=/opt/usr/bin/menus +Icon=menus +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/mainwindows/recentfiles/recentfiles.desktop b/examples/mainwindows/recentfiles/recentfiles.desktop new file mode 100644 index 0000000..c314cf7 --- /dev/null +++ b/examples/mainwindows/recentfiles/recentfiles.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Recent Files +Exec=/opt/usr/bin/recentfiles +Icon=recentfiles +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/mainwindows/sdi/sdi.desktop b/examples/mainwindows/sdi/sdi.desktop new file mode 100644 index 0000000..06d7289 --- /dev/null +++ b/examples/mainwindows/sdi/sdi.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=SDI +Exec=/opt/usr/bin/sdi +Icon=sdi +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/multimedia/audiodevices/audiodevices.desktop b/examples/multimedia/audiodevices/audiodevices.desktop new file mode 100644 index 0000000..ffff4b4 --- /dev/null +++ b/examples/multimedia/audiodevices/audiodevices.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Audio Devices +Exec=/opt/usr/bin/audiodevices +Icon=audiodevices +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/multimedia/audioinput/audioinput.desktop b/examples/multimedia/audioinput/audioinput.desktop new file mode 100644 index 0000000..0f1571e --- /dev/null +++ b/examples/multimedia/audioinput/audioinput.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=AudioInput +Exec=/opt/usr/bin/audioinput +Icon=audioinput +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/multimedia/audiooutput/audiooutput.desktop b/examples/multimedia/audiooutput/audiooutput.desktop new file mode 100644 index 0000000..147633f --- /dev/null +++ b/examples/multimedia/audiooutput/audiooutput.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Audio Output +Exec=/opt/usr/bin/audiooutput +Icon=audiooutput +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/multimedia/videographicsitem/videographicsitem.desktop b/examples/multimedia/videographicsitem/videographicsitem.desktop new file mode 100644 index 0000000..8d5d087 --- /dev/null +++ b/examples/multimedia/videographicsitem/videographicsitem.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Video Graphics Item +Exec=/opt/usr/bin/videographicsitem +Icon=videographicsitem +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/multimedia/videowidget/videowidget.desktop b/examples/multimedia/videowidget/videowidget.desktop new file mode 100644 index 0000000..9bc183d --- /dev/null +++ b/examples/multimedia/videowidget/videowidget.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Video Widget +Exec=/opt/usr/bin/videowidget +Icon=videowidget +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/bearercloud/bearercloud.desktop b/examples/network/bearercloud/bearercloud.desktop new file mode 100644 index 0000000..4e494e0 --- /dev/null +++ b/examples/network/bearercloud/bearercloud.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Bearer Cloud +Exec=/opt/usr/bin/bearercloud +Icon=bearercloud +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/bearermonitor/bearermonitor.desktop b/examples/network/bearermonitor/bearermonitor.desktop new file mode 100644 index 0000000..14f1094 --- /dev/null +++ b/examples/network/bearermonitor/bearermonitor.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Bearer Monitor +Exec=/opt/usr/bin/bearermonitor +Icon=bearermonitor +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/blockingfortuneclient/blockingfortuneclient.desktop b/examples/network/blockingfortuneclient/blockingfortuneclient.desktop new file mode 100644 index 0000000..87b1309 --- /dev/null +++ b/examples/network/blockingfortuneclient/blockingfortuneclient.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Blocking Fortune Client +Exec=/opt/usr/bin/blockingfortuneclient +Icon=blockingfortuneclient +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/broadcastreceiver/broadcastreceiver.desktop b/examples/network/broadcastreceiver/broadcastreceiver.desktop new file mode 100644 index 0000000..29072ed --- /dev/null +++ b/examples/network/broadcastreceiver/broadcastreceiver.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Broadcast Receiver +Exec=/opt/usr/bin/broadcastreceiver +Icon=broadcastreceiver +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/broadcastsender/broadcastsender.desktop b/examples/network/broadcastsender/broadcastsender.desktop new file mode 100644 index 0000000..2690a15 --- /dev/null +++ b/examples/network/broadcastsender/broadcastsender.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Broadcast Sender +Exec=/opt/usr/bin/broadcastsender +Icon=broadcastsender +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/download/download.desktop b/examples/network/download/download.desktop new file mode 100644 index 0000000..8dbdfe8 --- /dev/null +++ b/examples/network/download/download.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Network Download +Exec=/opt/usr/bin/download +Icon=download +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/downloadmanager/downloadmanager.desktop b/examples/network/downloadmanager/downloadmanager.desktop new file mode 100644 index 0000000..d046340 --- /dev/null +++ b/examples/network/downloadmanager/downloadmanager.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Network Download Manager +Exec=/opt/usr/bin/downloadmanager +Icon=downloadmanager +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/fortuneclient/fortuneclient.desktop b/examples/network/fortuneclient/fortuneclient.desktop new file mode 100644 index 0000000..dc801ed --- /dev/null +++ b/examples/network/fortuneclient/fortuneclient.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Fortune Client +Exec=/opt/usr/bin/fortuneclient +Icon=fortuneclient +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/fortuneserver/fortuneserver.desktop b/examples/network/fortuneserver/fortuneserver.desktop new file mode 100644 index 0000000..8c936e8 --- /dev/null +++ b/examples/network/fortuneserver/fortuneserver.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Fortune Server +Exec=/opt/usr/bin/fortuneserver +Icon=fortuneserver +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/googlesuggest/googlesuggest.desktop b/examples/network/googlesuggest/googlesuggest.desktop new file mode 100644 index 0000000..5034e23 --- /dev/null +++ b/examples/network/googlesuggest/googlesuggest.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Google Suggest +Exec=/opt/usr/bin/googlesuggest +Icon=googlesuggest +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/http/http.desktop b/examples/network/http/http.desktop new file mode 100644 index 0000000..ce35e51 --- /dev/null +++ b/examples/network/http/http.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=HTTP +Exec=/opt/usr/bin/http +Icon=http +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/loopback/loopback.desktop b/examples/network/loopback/loopback.desktop new file mode 100644 index 0000000..ee98215 --- /dev/null +++ b/examples/network/loopback/loopback.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Loopback +Exec=/opt/usr/bin/loopback +Icon=loopback +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/network-chat/network-chat.desktop b/examples/network/network-chat/network-chat.desktop new file mode 100644 index 0000000..ba3eeb3 --- /dev/null +++ b/examples/network/network-chat/network-chat.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Network Chat +Exec=/opt/usr/bin/network-chat +Icon=network-chat +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/qftp/qftp.desktop b/examples/network/qftp/qftp.desktop new file mode 100644 index 0000000..6149fe9 --- /dev/null +++ b/examples/network/qftp/qftp.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=FTP +Exec=/opt/usr/bin/qftp +Icon=qftp +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/securesocketclient/securesocketclient.desktop b/examples/network/securesocketclient/securesocketclient.desktop new file mode 100644 index 0000000..8335b27 --- /dev/null +++ b/examples/network/securesocketclient/securesocketclient.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Secure Socket Client +Exec=/opt/usr/bin/securesocketclient +Icon=securesocketclient +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/threadedfortuneserver/threadedfortuneserver.desktop b/examples/network/threadedfortuneserver/threadedfortuneserver.desktop new file mode 100644 index 0000000..509e244 --- /dev/null +++ b/examples/network/threadedfortuneserver/threadedfortuneserver.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Threaded Fortune Server +Exec=/opt/usr/bin/threadedfortuneserver +Icon=threadedfortuneserver +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/network/torrent/torrent.desktop b/examples/network/torrent/torrent.desktop new file mode 100644 index 0000000..59db3d3 --- /dev/null +++ b/examples/network/torrent/torrent.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Torrent +Exec=/opt/usr/bin/torrent +Icon=torrent +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/2dpainting/2dpainting.desktop b/examples/opengl/2dpainting/2dpainting.desktop new file mode 100644 index 0000000..0b3570d --- /dev/null +++ b/examples/opengl/2dpainting/2dpainting.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=2D Painting +Exec=/opt/usr/bin/2dpainting +Icon=2dpainting +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/cube/cube.desktop b/examples/opengl/cube/cube.desktop new file mode 100644 index 0000000..627e5f2 --- /dev/null +++ b/examples/opengl/cube/cube.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Cube OpenGL ES 2.0 +Exec=/opt/usr/bin/cube +Icon=cube +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/cube/cube.png b/examples/opengl/cube/cube.png Binary files differnew file mode 100644 index 0000000..42c8c51 --- /dev/null +++ b/examples/opengl/cube/cube.png diff --git a/examples/opengl/cube/cube.pro b/examples/opengl/cube/cube.pro new file mode 100644 index 0000000..64f6973 --- /dev/null +++ b/examples/opengl/cube/cube.pro @@ -0,0 +1,40 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2010-06-23T12:55:35 +# +#------------------------------------------------- + +QT += core gui + +TARGET = cube +TEMPLATE = app + +SOURCES += main.cpp + +contains(QT_CONFIG, opengl) { + message(Building with OpenGL support.) + QT += opengl + + SOURCES += mainwidget.cpp \ + geometryengine.cpp + + HEADERS += \ + mainwidget.h \ + geometryengine.h + + RESOURCES += \ + shaders.qrc \ + textures.qrc + + OTHER_FILES += \ + vshader.glsl \ + fshader.glsl +} else { + message(OpenGL support is not available.) +} + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + +symbian: warning(This example might not fully work on Symbian platform) +simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/opengl/cube/fshader.glsl b/examples/opengl/cube/fshader.glsl new file mode 100644 index 0000000..18068cf --- /dev/null +++ b/examples/opengl/cube/fshader.glsl @@ -0,0 +1,18 @@ +#ifdef GL_ES +// Set default precision to medium +precision mediump int; +precision mediump float; +#endif + +uniform sampler2D texture; + +varying vec2 v_texcoord; + +//! [0] +void main() +{ + // Set fragment color from texture + gl_FragColor = texture2D(texture, v_texcoord); +} +//! [0] + diff --git a/examples/opengl/cube/geometryengine.cpp b/examples/opengl/cube/geometryengine.cpp new file mode 100644 index 0000000..2f6f659 --- /dev/null +++ b/examples/opengl/cube/geometryengine.cpp @@ -0,0 +1,130 @@ +#include "geometryengine.h" + +#include <QVector2D> +#include <QVector3D> + +struct VertexData +{ + QVector3D position; + QVector2D texCoord; +}; + +GeometryEngine::GeometryEngine() : vboIds(new GLuint[2]) +{ +} + +GeometryEngine::~GeometryEngine() +{ + glDeleteBuffers(2, vboIds); + delete[] vboIds; +} + +void GeometryEngine::init() +{ +//! [0] + // Generate 2 VBOs + glGenBuffers(2, vboIds); + +//! [0] + + // Initializes cube geometry and transfers it to VBOs + initCubeGeometry(); +} + +void GeometryEngine::initCubeGeometry() +{ + // For cube we would need only 8 vertices but we have to + // duplicate vertex for each face because texture coordinate + // is different. + VertexData vertices[] = { + // Vertex data for face 0 + {QVector3D(-1.0, -1.0, 1.0), QVector2D(0.0, 0.0)}, // v0 + {QVector3D( 1.0, -1.0, 1.0), QVector2D(0.33, 0.0)}, // v1 + {QVector3D(-1.0, 1.0, 1.0), QVector2D(0.0, 0.5)}, // v2 + {QVector3D( 1.0, 1.0, 1.0), QVector2D(0.33, 0.5)}, // v3 + + // Vertex data for face 1 + {QVector3D( 1.0, -1.0, 1.0), QVector2D( 0.0, 0.5)}, // v4 + {QVector3D( 1.0, -1.0, -1.0), QVector2D(0.33, 0.5)}, // v5 + {QVector3D( 1.0, 1.0, 1.0), QVector2D(0.0, 1.0)}, // v6 + {QVector3D( 1.0, 1.0, -1.0), QVector2D(0.33, 1.0)}, // v7 + + // Vertex data for face 2 + {QVector3D( 1.0, -1.0, -1.0), QVector2D(0.66, 0.5)}, // v8 + {QVector3D(-1.0, -1.0, -1.0), QVector2D(1.0, 0.5)}, // v9 + {QVector3D( 1.0, 1.0, -1.0), QVector2D(0.66, 1.0)}, // v10 + {QVector3D(-1.0, 1.0, -1.0), QVector2D(1.0, 1.0)}, // v11 + + // Vertex data for face 3 + {QVector3D(-1.0, -1.0, -1.0), QVector2D(0.66, 0.0)}, // v12 + {QVector3D(-1.0, -1.0, 1.0), QVector2D(1.0, 0.0)}, // v13 + {QVector3D(-1.0, 1.0, -1.0), QVector2D(0.66, 0.5)}, // v14 + {QVector3D(-1.0, 1.0, 1.0), QVector2D(1.0, 0.5)}, // v15 + + // Vertex data for face 4 + {QVector3D(-1.0, -1.0, -1.0), QVector2D(0.33, 0.0)}, // v16 + {QVector3D( 1.0, -1.0, -1.0), QVector2D(0.66, 0.0)}, // v17 + {QVector3D(-1.0, -1.0, 1.0), QVector2D(0.33, 0.5)}, // v18 + {QVector3D( 1.0, -1.0, 1.0), QVector2D(0.66, 0.5)}, // v19 + + // Vertex data for face 5 + {QVector3D(-1.0, 1.0, 1.0), QVector2D(0.33, 0.5)}, // v20 + {QVector3D( 1.0, 1.0, 1.0), QVector2D(0.66, 0.5)}, // v21 + {QVector3D(-1.0, 1.0, -1.0), QVector2D(0.33, 1.0)}, // v22 + {QVector3D( 1.0, 1.0, -1.0), QVector2D(0.66, 1.0)} // v23 + }; + + // Indices for drawing cube faces using triangle strips. + // Triangle strips can be connected by duplicating indices + // between the strips. If connecting strips have opposite + // vertex order then last index of the first strip and first + // index of the second strip needs to be duplicated. If + // connecting strips have same vertex order then only last + // index of the first strip needs to be duplicated. + GLushort indices[] = { + 0, 1, 2, 3, 3, // Face 0 - triangle strip ( v0, v1, v2, v3) + 4, 4, 5, 6, 7, 7, // Face 1 - triangle strip ( v4, v5, v6, v7) + 8, 8, 9, 10, 11, 11, // Face 2 - triangle strip ( v8, v9, v10, v11) + 12, 12, 13, 14, 15, 15, // Face 3 - triangle strip (v12, v13, v14, v15) + 16, 16, 17, 18, 19, 19, // Face 4 - triangle strip (v16, v17, v18, v19) + 20, 20, 21, 22, 23 // Face 5 - triangle strip (v20, v21, v22, v23) + }; + +//! [1] + // Transfer vertex data to VBO 0 + glBindBuffer(GL_ARRAY_BUFFER, vboIds[0]); + glBufferData(GL_ARRAY_BUFFER, 24 * sizeof(VertexData), vertices, GL_STATIC_DRAW); + + // Transfer index data to VBO 1 + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIds[1]); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, 34 * sizeof(GLushort), indices, GL_STATIC_DRAW); +//! [1] +} + +//! [2] +void GeometryEngine::drawCubeGeometry(QGLShaderProgram *program) +{ + // Tell OpenGL which VBOs to use + glBindBuffer(GL_ARRAY_BUFFER, vboIds[0]); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIds[1]); + + // Offset for position + int offset = 0; + + // Tell OpenGL programmable pipeline how to locate vertex position data + int vertexLocation = program->attributeLocation("a_position"); + program->enableAttributeArray(vertexLocation); + glVertexAttribPointer(vertexLocation, 3, GL_FLOAT, GL_FALSE, sizeof(VertexData), (const void *)offset); + + // Offset for texture coordinate + offset += sizeof(QVector3D); + + // Tell OpenGL programmable pipeline how to locate vertex texture coordinate data + int texcoordLocation = program->attributeLocation("a_texcoord"); + program->enableAttributeArray(texcoordLocation); + glVertexAttribPointer(texcoordLocation, 2, GL_FLOAT, GL_FALSE, sizeof(VertexData), (const void *)offset); + + // Draw cube geometry using indices from VBO 1 + glDrawElements(GL_TRIANGLE_STRIP, 34, GL_UNSIGNED_SHORT, 0); +} +//! [2] diff --git a/examples/opengl/cube/geometryengine.h b/examples/opengl/cube/geometryengine.h new file mode 100644 index 0000000..d0fba69 --- /dev/null +++ b/examples/opengl/cube/geometryengine.h @@ -0,0 +1,24 @@ +#ifndef GEOMETRYENGINE_H +#define GEOMETRYENGINE_H + +#include <QtOpenGL/QGLFunctions> +#include <QtOpenGL/QGLShaderProgram> + +class GeometryEngine : protected QGLFunctions +{ +public: + GeometryEngine(); + virtual ~GeometryEngine(); + + void init(); + + void drawCubeGeometry(QGLShaderProgram *program); + +private: + void initCubeGeometry(); + + GLuint *vboIds; + +}; + +#endif // GEOMETRYENGINE_H diff --git a/examples/opengl/cube/main.cpp b/examples/opengl/cube/main.cpp new file mode 100644 index 0000000..faac8a0 --- /dev/null +++ b/examples/opengl/cube/main.cpp @@ -0,0 +1,22 @@ +#include <QtGui/QApplication> +#include <QLabel> + +#ifndef QT_NO_OPENGL +#include "mainwidget.h" +#endif + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + a.setApplicationName("cube"); + a.setApplicationVersion("0.1"); +#ifndef QT_NO_OPENGL + MainWidget w; + w.resize(640, 480); + w.show(); +#else + QLabel * notifyLabel = new QLabel("OpenGL Support required"); + notifyLabel->show(); +#endif + return a.exec(); +} diff --git a/examples/opengl/cube/mainwidget.cpp b/examples/opengl/cube/mainwidget.cpp new file mode 100644 index 0000000..bead5f79 --- /dev/null +++ b/examples/opengl/cube/mainwidget.cpp @@ -0,0 +1,192 @@ +#include "mainwidget.h" + +#include "geometryengine.h" + +#include <QtOpenGL/QGLShaderProgram> + +#include <QBasicTimer> +#include <QMouseEvent> + +#include <math.h> + +#include <QDebug> + +MainWidget::MainWidget(QWidget *parent) : + QGLWidget(parent), + timer(new QBasicTimer), + program(new QGLShaderProgram), + geometries(new GeometryEngine) +{ +} + +MainWidget::~MainWidget() +{ + delete timer; timer = 0; + delete program; program = 0; + delete geometries; geometries = 0; + + deleteTexture(texture); +} + +//! [0] +void MainWidget::mousePressEvent(QMouseEvent *e) +{ + // Saving mouse press position + mousePressPosition = QVector2D(e->posF()); +} + +void MainWidget::mouseReleaseEvent(QMouseEvent *e) +{ + // Mouse release position - mouse press position + QVector2D diff = QVector2D(e->posF()) - mousePressPosition; + + // Rotation axis is perpendicular to the mouse position difference + // vector + QVector3D n = QVector3D(diff.y(), diff.x(), 0.0).normalized(); + + // Accelerate angular speed relative to the length of the mouse sweep + qreal acc = diff.length() / 100.0; + + // Calculate new rotation axis as weighted sum + rotationAxis = (rotationAxis * angularSpeed + n * acc).normalized(); + + // Increase angular speed + angularSpeed += acc; +} +//! [0] + +//! [1] +void MainWidget::timerEvent(QTimerEvent *e) +{ + Q_UNUSED(e); + + // Decrease angular speed (friction) + angularSpeed *= 0.99; + + // Stop rotation when speed goes below threshold + if (angularSpeed < 0.01) + angularSpeed = 0.0; + else { + // Update rotation + rotation = QQuaternion::fromAxisAndAngle(rotationAxis, angularSpeed) * rotation; + + // Update scene + updateGL(); + } +} +//! [1] + +void MainWidget::initializeGL() +{ + qglClearColor(Qt::black); + + qDebug() << "Initializing shaders..."; + initShaders(); + + qDebug() << "Initializing textures..."; + initTextures(); + +//! [2] + // Enable depth buffer + glEnable(GL_DEPTH_TEST); + + // Enable back face culling + glEnable(GL_CULL_FACE); +//! [2] + + qDebug() << "Initializing geometries..."; + geometries->init(); + + // using QBasicTimer because its faster that QTimer + timer->start(12, this); +} + +//! [3] +void MainWidget::initShaders() +{ + // Overriding system locale until shaders are compiled + setlocale(LC_NUMERIC, "C"); + + // Compiling vertex shader + if (!program->addShaderFromSourceFile(QGLShader::Vertex, ":/vshader.glsl")) + close(); + + // Compiling fragment shader + if (!program->addShaderFromSourceFile(QGLShader::Fragment, ":/fshader.glsl")) + close(); + + // Linking shader pipeline + if (!program->link()) + close(); + + // Binding shader pipeline for use + if (!program->bind()) + close(); + + // Restore system locale + setlocale(LC_ALL, ""); +} +//! [3] + +//! [4] +void MainWidget::initTextures() +{ + // Loading cube.png to texture unit 0 + glActiveTexture(GL_TEXTURE0); + glEnable(GL_TEXTURE_2D); + texture = bindTexture(QImage(":/cube.png")); + + // Set nearest filtering mode for texture minification + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + + // Set bilinear filtering mode for texture magnification + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + // Wrap texture coordinates by repeating + // f.ex. texture coordinate (1.1, 1.2) is same as (0.1, 0.2) + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); +} +//! [4] + +//! [5] +void MainWidget::resizeGL(int w, int h) +{ + // Set OpenGL viewport to cover whole widget + glViewport(0, 0, w, h); + + // Calculate aspect ratio + qreal aspect = (qreal)w / ((qreal)h?h:1); + + // Set near plane to 3.0, far plane to 7.0, field of view 45 degrees + const qreal zNear = 3.0, zFar = 7.0, fov = 45.0; + + // Reset projection + projection.setToIdentity(); + + // Set perspective projection + projection.perspective(fov, aspect, zNear, zFar); +} +//! [5] + +void MainWidget::paintGL() +{ + // Clear color and depth buffer + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + +//! [6] + // Calculate model view transformation + QMatrix4x4 matrix; + matrix.translate(0.0, 0.0, -5.0); + matrix.rotate(rotation); + + // Set modelview-projection matrix + program->setUniformValue("mvp_matrix", projection * matrix); +//! [6] + + // Using texture unit 0 which contains cube.png + program->setUniformValue("texture", 0); + + // Draw cube geometry + geometries->drawCubeGeometry(program); +} diff --git a/examples/opengl/cube/mainwidget.h b/examples/opengl/cube/mainwidget.h new file mode 100644 index 0000000..595173b --- /dev/null +++ b/examples/opengl/cube/mainwidget.h @@ -0,0 +1,53 @@ +#ifndef MAINWIDGET_H +#define MAINWIDGET_H + +#include <QtOpenGL/QGLWidget> + +#include <QMatrix4x4> +#include <QQuaternion> +#include <QVector2D> + +class QBasicTimer; +class QGLShaderProgram; + +class GeometryEngine; + +class MainWidget : public QGLWidget +{ + Q_OBJECT +public: + explicit MainWidget(QWidget *parent = 0); + virtual ~MainWidget(); + +signals: + +public slots: + +protected: + void mousePressEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + void timerEvent(QTimerEvent *e); + + void initializeGL(); + void resizeGL(int w, int h); + void paintGL(); + + void initShaders(); + void initTextures(); + +private: + QBasicTimer *timer; + QGLShaderProgram *program; + GeometryEngine *geometries; + + GLuint texture; + + QMatrix4x4 projection; + + QVector2D mousePressPosition; + QVector3D rotationAxis; + qreal angularSpeed; + QQuaternion rotation; +}; + +#endif // MAINWIDGET_H diff --git a/examples/opengl/cube/shaders.qrc b/examples/opengl/cube/shaders.qrc new file mode 100644 index 0000000..bfc4b25 --- /dev/null +++ b/examples/opengl/cube/shaders.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>vshader.glsl</file> + <file>fshader.glsl</file> + </qresource> +</RCC> diff --git a/examples/opengl/cube/textures.qrc b/examples/opengl/cube/textures.qrc new file mode 100644 index 0000000..fe53be5 --- /dev/null +++ b/examples/opengl/cube/textures.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>cube.png</file> + </qresource> +</RCC> diff --git a/examples/opengl/cube/vshader.glsl b/examples/opengl/cube/vshader.glsl new file mode 100644 index 0000000..cfdc061 --- /dev/null +++ b/examples/opengl/cube/vshader.glsl @@ -0,0 +1,24 @@ +#ifdef GL_ES +// Set default precision to medium +precision mediump int; +precision mediump float; +#endif + +uniform mat4 mvp_matrix; + +attribute vec4 a_position; +attribute vec2 a_texcoord; + +varying vec2 v_texcoord; + +//! [0] +void main() +{ + // Calculate vertex position in screen space + gl_Position = mvp_matrix * a_position; + + // Pass texture coordinate to fragment shader + // Value will be automatically interpolated to fragments inside polygon faces + v_texcoord = a_texcoord; +} +//! [0] diff --git a/examples/opengl/framebufferobject/framebufferobject.desktop b/examples/opengl/framebufferobject/framebufferobject.desktop new file mode 100644 index 0000000..5858dea --- /dev/null +++ b/examples/opengl/framebufferobject/framebufferobject.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Framebuffer Object +Exec=/opt/usr/bin/framebufferobject +Icon=framebufferobject +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/framebufferobject2/framebufferobject2.desktop b/examples/opengl/framebufferobject2/framebufferobject2.desktop new file mode 100644 index 0000000..6aed108 --- /dev/null +++ b/examples/opengl/framebufferobject2/framebufferobject2.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Framebuffer Object 2 +Exec=/opt/usr/bin/framebufferobject2 +Icon=framebufferobject2 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/grabber/grabber.desktop b/examples/opengl/grabber/grabber.desktop new file mode 100644 index 0000000..76f31be --- /dev/null +++ b/examples/opengl/grabber/grabber.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Grabber +Exec=/opt/usr/bin/grabber +Icon=grabber +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/hellogl/hellogl.desktop b/examples/opengl/hellogl/hellogl.desktop new file mode 100644 index 0000000..355e259 --- /dev/null +++ b/examples/opengl/hellogl/hellogl.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Hello GL +Exec=/opt/usr/bin/hellogl +Icon=hellogl +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/hellogl_es/hellogl_es.desktop b/examples/opengl/hellogl_es/hellogl_es.desktop new file mode 100644 index 0000000..11c1dd7 --- /dev/null +++ b/examples/opengl/hellogl_es/hellogl_es.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Hello GL ES +Exec=/opt/usr/bin/hellogl_es +Icon=hellogl_es +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/hellogl_es2/hellogl_es2.desktop b/examples/opengl/hellogl_es2/hellogl_es2.desktop new file mode 100644 index 0000000..2fe0adf --- /dev/null +++ b/examples/opengl/hellogl_es2/hellogl_es2.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Hello GL ES 2 +Exec=/opt/usr/bin/hellogl_es2 +Icon=hellogl_es2 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/overpainting/overpainting.desktop b/examples/opengl/overpainting/overpainting.desktop new file mode 100644 index 0000000..025300b --- /dev/null +++ b/examples/opengl/overpainting/overpainting.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Overpainting +Exec=/opt/usr/bin/overpainting +Icon=overpainting +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/pbuffers/pbuffers.desktop b/examples/opengl/pbuffers/pbuffers.desktop new file mode 100644 index 0000000..e5c5cee --- /dev/null +++ b/examples/opengl/pbuffers/pbuffers.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Pixel Buffers +Exec=/opt/usr/bin/pbuffers +Icon=pbuffers +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/pbuffers2/pbuffers2.desktop b/examples/opengl/pbuffers2/pbuffers2.desktop new file mode 100644 index 0000000..eed908c --- /dev/null +++ b/examples/opengl/pbuffers2/pbuffers2.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Pixel Buffers 2 +Exec=/opt/usr/bin/pbuffers2 +Icon=pbuffers2 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/samplebuffers/samplebuffers.desktop b/examples/opengl/samplebuffers/samplebuffers.desktop new file mode 100644 index 0000000..d7bd43d --- /dev/null +++ b/examples/opengl/samplebuffers/samplebuffers.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Sample Buffers +Exec=/opt/usr/bin/samplebuffers +Icon=samplebuffers +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/opengl/textures/textures.desktop b/examples/opengl/textures/textures.desktop new file mode 100644 index 0000000..e8a40cd --- /dev/null +++ b/examples/opengl/textures/textures.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Textures +Exec=/opt/usr/bin/textures +Icon=textures +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/openvg/openvg.desktop b/examples/openvg/openvg.desktop new file mode 100644 index 0000000..186699a --- /dev/null +++ b/examples/openvg/openvg.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=OpenVG Star +Exec=/opt/usr/bin/openvg +Icon=openvg +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/basicdrawing/basicdrawing.desktop b/examples/painting/basicdrawing/basicdrawing.desktop new file mode 100644 index 0000000..7f178ec --- /dev/null +++ b/examples/painting/basicdrawing/basicdrawing.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Basic Drawing +Exec=/opt/usr/bin/basicdrawing +Icon=basicdrawing +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/concentriccircles/concentriccircles.desktop b/examples/painting/concentriccircles/concentriccircles.desktop new file mode 100644 index 0000000..7007f19 --- /dev/null +++ b/examples/painting/concentriccircles/concentriccircles.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Concentric Circles +Exec=/opt/usr/bin/concentriccircles +Icon=concentriccircles +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/fontsampler/fontsampler.desktop b/examples/painting/fontsampler/fontsampler.desktop new file mode 100644 index 0000000..8582891 --- /dev/null +++ b/examples/painting/fontsampler/fontsampler.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Font Sampler +Exec=/opt/usr/bin/fontsampler +Icon=fontsampler +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/imagecomposition/imagecomposition.desktop b/examples/painting/imagecomposition/imagecomposition.desktop new file mode 100644 index 0000000..854fc86 --- /dev/null +++ b/examples/painting/imagecomposition/imagecomposition.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Image Composition +Exec=/opt/usr/bin/imagecomposition +Icon=imagecomposition +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/painterpaths/painterpaths.desktop b/examples/painting/painterpaths/painterpaths.desktop new file mode 100644 index 0000000..ae92f2c --- /dev/null +++ b/examples/painting/painterpaths/painterpaths.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Painter Paths +Exec=/opt/usr/bin/painterpaths +Icon=painterpaths +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/svggenerator/svggenerator.desktop b/examples/painting/svggenerator/svggenerator.desktop new file mode 100644 index 0000000..3ae32a4 --- /dev/null +++ b/examples/painting/svggenerator/svggenerator.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=SVG Generator +Exec=/opt/usr/bin/svggenerator +Icon=svggenerator +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/svgviewer/svgviewer.desktop b/examples/painting/svgviewer/svgviewer.desktop new file mode 100644 index 0000000..477ef78 --- /dev/null +++ b/examples/painting/svgviewer/svgviewer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=SVG Viewer +Exec=/opt/usr/bin/svgviewer +Icon=svgviewer +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/painting/transformations/transformations.desktop b/examples/painting/transformations/transformations.desktop new file mode 100644 index 0000000..2f53891 --- /dev/null +++ b/examples/painting/transformations/transformations.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Transformations +Exec=/opt/usr/bin/transformations +Icon=transformations +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/phonon/capabilities/capabilities.desktop b/examples/phonon/capabilities/capabilities.desktop new file mode 100644 index 0000000..e6e87d1 --- /dev/null +++ b/examples/phonon/capabilities/capabilities.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Capabilities +Exec=/opt/usr/bin/capabilities +Icon=capabilities +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/phonon/qmusicplayer/qmusicplayer.desktop b/examples/phonon/qmusicplayer/qmusicplayer.desktop new file mode 100644 index 0000000..9ca0a19 --- /dev/null +++ b/examples/phonon/qmusicplayer/qmusicplayer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Music Player +Exec=/opt/usr/bin/qmusicplayer +Icon=qmusicplayer +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qt.png b/examples/qt.png Binary files differnew file mode 100644 index 0000000..d27e30e --- /dev/null +++ b/examples/qt.png diff --git a/examples/qt.svg b/examples/qt.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/qt.svg @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="44px" + version="1.1" + viewBox="0 0 44 44" + width="44px" + x="0px" + y="0px" + id="svg2" + inkscape:version="0.47 r22583" + sodipodi:docname="qt.svg"> + <metadata + id="metadata18"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs16"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="44 : 22 : 1" + inkscape:persp3d-origin="22 : 14.666667 : 1" + id="perspective2836" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1020" + id="namedview14" + showgrid="false" + inkscape:zoom="21.454545" + inkscape:cx="49.412871" + inkscape:cy="21.894358" + inkscape:window-x="-4" + inkscape:window-y="-4" + inkscape:window-maximized="1" + inkscape:current-layer="g3" /> + <g + transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" + id="g3"> + <path + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + style="fill:#006225" + id="path5" + sodipodi:nodetypes="cccccccc" /> + <path + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + style="fill:#80c342" + id="path7" /> + <path + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + style="fill:#006225" + id="path11" /> + <path + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + style="fill:#006225" + id="path13" /> + <path + id="path17" + style="fill:#ffffff" + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> + <path + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + style="fill:#006225" + id="path19" /> + <path + id="path21" + style="fill:#006225" + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> + </g> +</svg> diff --git a/examples/qtconcurrent/imagescaling/imagescaling.desktop b/examples/qtconcurrent/imagescaling/imagescaling.desktop new file mode 100644 index 0000000..289f56c --- /dev/null +++ b/examples/qtconcurrent/imagescaling/imagescaling.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=QtConcurrent Image Scaling +Exec=/opt/usr/bin/imagescaling +Icon=imagescaling +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qtconcurrent/map/map.desktop b/examples/qtconcurrent/map/map.desktop new file mode 100644 index 0000000..7d8bba9 --- /dev/null +++ b/examples/qtconcurrent/map/map.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=QtConcurrent Map +Exec=/opt/usr/bin/map +Icon=map +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qtconcurrent/progressdialog/progressdialog.desktop b/examples/qtconcurrent/progressdialog/progressdialog.desktop new file mode 100644 index 0000000..5179471 --- /dev/null +++ b/examples/qtconcurrent/progressdialog/progressdialog.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=QtConcurrent Progress Dialog +Exec=/opt/usr/bin/progressdialog +Icon=progressdialog +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qtconcurrent/runfunction/runfunction.desktop b/examples/qtconcurrent/runfunction/runfunction.desktop new file mode 100644 index 0000000..0c36f89 --- /dev/null +++ b/examples/qtconcurrent/runfunction/runfunction.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=QtConcurrent Run Function +Exec=/opt/usr/bin/runfunction +Icon=runfunction +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qtconcurrent/wordcount/wordcount.desktop b/examples/qtconcurrent/wordcount/wordcount.desktop new file mode 100644 index 0000000..382d573 --- /dev/null +++ b/examples/qtconcurrent/wordcount/wordcount.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=QtConcurrent Word Count +Exec=/opt/usr/bin/wordcount +Icon=wordcount +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qtestlib/tutorial1/tutorial1.desktop b/examples/qtestlib/tutorial1/tutorial1.desktop new file mode 100644 index 0000000..4b0b585 --- /dev/null +++ b/examples/qtestlib/tutorial1/tutorial1.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Writing a Unit Test +Exec=/opt/usr/bin/tutorial1 +Icon=tutorial1 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qtestlib/tutorial2/tutorial2.desktop b/examples/qtestlib/tutorial2/tutorial2.desktop new file mode 100644 index 0000000..df8e781 --- /dev/null +++ b/examples/qtestlib/tutorial2/tutorial2.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Data Driven Testing +Exec=/opt/usr/bin/tutorial2 +Icon=tutorial2 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qtestlib/tutorial3/tutorial3.desktop b/examples/qtestlib/tutorial3/tutorial3.desktop new file mode 100644 index 0000000..0522ca5 --- /dev/null +++ b/examples/qtestlib/tutorial3/tutorial3.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Simulating GUI Events +Exec=/opt/usr/bin/tutorial3 +Icon=tutorial3 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qtestlib/tutorial4/tutorial4.desktop b/examples/qtestlib/tutorial4/tutorial4.desktop new file mode 100644 index 0000000..05b5678 --- /dev/null +++ b/examples/qtestlib/tutorial4/tutorial4.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Replaying GUI Events +Exec=/opt/usr/bin/tutorial4 +Icon=tutorial4 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qtestlib/tutorial5/tutorial5.desktop b/examples/qtestlib/tutorial5/tutorial5.desktop new file mode 100644 index 0000000..9e8e6cf --- /dev/null +++ b/examples/qtestlib/tutorial5/tutorial5.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Writing a Benchmark +Exec=/opt/usr/bin/tutorial5 +Icon=tutorial5 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qws/dbscreen/dbscreen.desktop b/examples/qws/dbscreen/dbscreen.desktop new file mode 100644 index 0000000..1726e6c --- /dev/null +++ b/examples/qws/dbscreen/dbscreen.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Double Buffered Graphics Driver +Exec=/opt/usr/bin/dbscreen +Icon=dbscreen +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qws/framebuffer/framebuffer.desktop b/examples/qws/framebuffer/framebuffer.desktop new file mode 100644 index 0000000..030f264 --- /dev/null +++ b/examples/qws/framebuffer/framebuffer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Linux Framebuffer +Exec=/opt/usr/bin/framebuffer +Icon=framebuffer +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qws/mousecalibration/mousecalibration.desktop b/examples/qws/mousecalibration/mousecalibration.desktop new file mode 100644 index 0000000..07c231e --- /dev/null +++ b/examples/qws/mousecalibration/mousecalibration.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Mouse Calibration +Exec=/opt/usr/bin/mousecalibration +Icon=mousecalibration +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qws/simpledecoration/simpledecoration.desktop b/examples/qws/simpledecoration/simpledecoration.desktop new file mode 100644 index 0000000..9cd588e --- /dev/null +++ b/examples/qws/simpledecoration/simpledecoration.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Simple Decoration +Exec=/opt/usr/bin/simpledecoration +Icon=simpledecoration +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/qws/svgalib/svgalib.desktop b/examples/qws/svgalib/svgalib.desktop new file mode 100644 index 0000000..94ea92f --- /dev/null +++ b/examples/qws/svgalib/svgalib.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Accelerated Graphics Driver +Exec=/opt/usr/bin/svgalib +Icon=svgalib +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/richtext/calendar/calendar.desktop b/examples/richtext/calendar/calendar.desktop new file mode 100644 index 0000000..41ba6dd --- /dev/null +++ b/examples/richtext/calendar/calendar.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Calendar +Exec=/opt/usr/bin/calendar +Icon=calendar +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/richtext/orderform/orderform.desktop b/examples/richtext/orderform/orderform.desktop new file mode 100644 index 0000000..4690cbc --- /dev/null +++ b/examples/richtext/orderform/orderform.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Order Form +Exec=/opt/usr/bin/orderform +Icon=orderform +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/richtext/syntaxhighlighter/syntaxhighlighter.desktop b/examples/richtext/syntaxhighlighter/syntaxhighlighter.desktop new file mode 100644 index 0000000..2e3c833 --- /dev/null +++ b/examples/richtext/syntaxhighlighter/syntaxhighlighter.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Syntax Highlighter +Exec=/opt/usr/bin/syntaxhighlighter +Icon=syntaxhighlighter +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/richtext/textobject/textobject.desktop b/examples/richtext/textobject/textobject.desktop new file mode 100644 index 0000000..1b0980f --- /dev/null +++ b/examples/richtext/textobject/textobject.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Text Object +Exec=/opt/usr/bin/textobject +Icon=textobject +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/script/calculator/calculator.desktop b/examples/script/calculator/calculator.desktop new file mode 100644 index 0000000..64d6f33 --- /dev/null +++ b/examples/script/calculator/calculator.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=QtScript Calculator +Exec=/opt/usr/bin/calculator +Icon=calculator +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/script/context2d/context2d.desktop b/examples/script/context2d/context2d.desktop new file mode 100644 index 0000000..16f7df2 --- /dev/null +++ b/examples/script/context2d/context2d.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Context2D +Exec=/opt/usr/bin/context2d +Icon=context2d +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/script/customclass/customclass.desktop b/examples/script/customclass/customclass.desktop new file mode 100644 index 0000000..2e3ffa6 --- /dev/null +++ b/examples/script/customclass/customclass.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Custom Script Class +Exec=/opt/usr/bin/customclass +Icon=customclass +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/script/defaultprototypes/defaultprototypes.desktop b/examples/script/defaultprototypes/defaultprototypes.desktop new file mode 100644 index 0000000..6381546 --- /dev/null +++ b/examples/script/defaultprototypes/defaultprototypes.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Default Prototypes +Exec=/opt/usr/bin/defaultprototypes +Icon=defaultprototypes +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/script/helloscript/helloscript.desktop b/examples/script/helloscript/helloscript.desktop new file mode 100644 index 0000000..7dafad9 --- /dev/null +++ b/examples/script/helloscript/helloscript.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Hello Script +Exec=/opt/usr/bin/helloscript +Icon=helloscript +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/script/marshal/marshal.desktop b/examples/script/marshal/marshal.desktop new file mode 100644 index 0000000..8abed70 --- /dev/null +++ b/examples/script/marshal/marshal.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Qt Script Marshalling +Exec=/opt/usr/bin/marshal +Icon=marshal +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/script/qscript/qscript.desktop b/examples/script/qscript/qscript.desktop new file mode 100644 index 0000000..d580981 --- /dev/null +++ b/examples/script/qscript/qscript.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Qt Script Interpreter +Exec=/opt/usr/bin/qscript +Icon=qscript +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/script/qsdbg/qsdbg.desktop b/examples/script/qsdbg/qsdbg.desktop new file mode 100644 index 0000000..359b93c --- /dev/null +++ b/examples/script/qsdbg/qsdbg.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Qt Script Debugger +Exec=/opt/usr/bin/qsdbg +Icon=qsdbg +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/script/qstetrix/qstetrix.desktop b/examples/script/qstetrix/qstetrix.desktop new file mode 100644 index 0000000..4795b13 --- /dev/null +++ b/examples/script/qstetrix/qstetrix.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Qt Script Tetrix +Exec=/opt/usr/bin/qstetrix +Icon=qstetrix +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/cachedtable/cachedtable.desktop b/examples/sql/cachedtable/cachedtable.desktop new file mode 100644 index 0000000..aeec353 --- /dev/null +++ b/examples/sql/cachedtable/cachedtable.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Cached Table +Exec=/opt/usr/bin/cachedtable +Icon=cachedtable +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/drilldown/drilldown.desktop b/examples/sql/drilldown/drilldown.desktop new file mode 100644 index 0000000..b0f3ce0 --- /dev/null +++ b/examples/sql/drilldown/drilldown.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Drill Down +Exec=/opt/usr/bin/drilldown +Icon=drilldown +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/masterdetail/masterdetail.desktop b/examples/sql/masterdetail/masterdetail.desktop new file mode 100644 index 0000000..6f8c3e5 --- /dev/null +++ b/examples/sql/masterdetail/masterdetail.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Master Detail +Exec=/opt/usr/bin/masterdetail +Icon=masterdetail +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/querymodel/querymodel.desktop b/examples/sql/querymodel/querymodel.desktop new file mode 100644 index 0000000..8bba971 --- /dev/null +++ b/examples/sql/querymodel/querymodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Query Model +Exec=/opt/usr/bin/querymodel +Icon=querymodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/relationaltablemodel/relationaltablemodel.desktop b/examples/sql/relationaltablemodel/relationaltablemodel.desktop new file mode 100644 index 0000000..8d5437d --- /dev/null +++ b/examples/sql/relationaltablemodel/relationaltablemodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Relational Table Model +Exec=/opt/usr/bin/relationaltablemodel +Icon=relationaltablemodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/sqlwidgetmapper/sqlwidgetmapper.desktop b/examples/sql/sqlwidgetmapper/sqlwidgetmapper.desktop new file mode 100644 index 0000000..c02e6bc --- /dev/null +++ b/examples/sql/sqlwidgetmapper/sqlwidgetmapper.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=SQL Widget Mapper +Exec=/opt/usr/bin/sqlwidgetmapper +Icon=sqlwidgetmapper +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/sql/tablemodel/tablemodel.desktop b/examples/sql/tablemodel/tablemodel.desktop new file mode 100644 index 0000000..821fbd9 --- /dev/null +++ b/examples/sql/tablemodel/tablemodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Table Model +Exec=/opt/usr/bin/tablemodel +Icon=tablemodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/statemachine/eventtransitions/eventtransitions.desktop b/examples/statemachine/eventtransitions/eventtransitions.desktop new file mode 100644 index 0000000..c1bceb2 --- /dev/null +++ b/examples/statemachine/eventtransitions/eventtransitions.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Event Transitions +Exec=/opt/usr/bin/eventtransitions +Icon=eventtransitions +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/statemachine/factorial/factorial.desktop b/examples/statemachine/factorial/factorial.desktop new file mode 100644 index 0000000..41b2722 --- /dev/null +++ b/examples/statemachine/factorial/factorial.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Factorial States +Exec=/opt/usr/bin/factorial +Icon=factorial +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/statemachine/pingpong/pingpong.desktop b/examples/statemachine/pingpong/pingpong.desktop new file mode 100644 index 0000000..79646a2 --- /dev/null +++ b/examples/statemachine/pingpong/pingpong.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Ping Pong States +Exec=/opt/usr/bin/pingpong +Icon=pingpong +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/statemachine/rogue/rogue.desktop b/examples/statemachine/rogue/rogue.desktop new file mode 100644 index 0000000..71ca4b6 --- /dev/null +++ b/examples/statemachine/rogue/rogue.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Rogue +Exec=/opt/usr/bin/rogue +Icon=rogue +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/statemachine/trafficlight/trafficlight.desktop b/examples/statemachine/trafficlight/trafficlight.desktop new file mode 100644 index 0000000..8a5cc16 --- /dev/null +++ b/examples/statemachine/trafficlight/trafficlight.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Traffic Light +Exec=/opt/usr/bin/trafficlight +Icon=trafficlight +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/statemachine/twowaybutton/twowaybutton.desktop b/examples/statemachine/twowaybutton/twowaybutton.desktop new file mode 100644 index 0000000..9dd0918 --- /dev/null +++ b/examples/statemachine/twowaybutton/twowaybutton.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Two-way Button +Exec=/opt/usr/bin/twowaybutton +Icon=twowaybutton +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/threads/mandelbrot/mandelbrot.desktop b/examples/threads/mandelbrot/mandelbrot.desktop new file mode 100644 index 0000000..3e70e1a --- /dev/null +++ b/examples/threads/mandelbrot/mandelbrot.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Mandelbrot +Exec=/opt/usr/bin/mandelbrot +Icon=mandelbrot +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/threads/queuedcustomtype/queuedcustomtype.desktop b/examples/threads/queuedcustomtype/queuedcustomtype.desktop new file mode 100644 index 0000000..fa5ed7a --- /dev/null +++ b/examples/threads/queuedcustomtype/queuedcustomtype.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Queued Custom Type +Exec=/opt/usr/bin/queuedcustomtype +Icon=queuedcustomtype +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/threads/semaphores/semaphores.desktop b/examples/threads/semaphores/semaphores.desktop new file mode 100644 index 0000000..a7dc467 --- /dev/null +++ b/examples/threads/semaphores/semaphores.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Semaphores +Exec=/opt/usr/bin/semaphores +Icon=semaphores +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/threads/waitconditions/waitconditions.desktop b/examples/threads/waitconditions/waitconditions.desktop new file mode 100644 index 0000000..4fbc304 --- /dev/null +++ b/examples/threads/waitconditions/waitconditions.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Wait Conditions +Exec=/opt/usr/bin/waitconditions +Icon=waitconditions +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/codecs/codecs.desktop b/examples/tools/codecs/codecs.desktop new file mode 100644 index 0000000..bba6220 --- /dev/null +++ b/examples/tools/codecs/codecs.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Codecs +Exec=/opt/usr/bin/codecs +Icon=codecs +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/completer/completer.desktop b/examples/tools/completer/completer.desktop new file mode 100644 index 0000000..f7e2d15 --- /dev/null +++ b/examples/tools/completer/completer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Completer +Exec=/opt/usr/bin/completer +Icon=completer +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/contiguouscache/contiguouscache.desktop b/examples/tools/contiguouscache/contiguouscache.desktop new file mode 100644 index 0000000..e89e206 --- /dev/null +++ b/examples/tools/contiguouscache/contiguouscache.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Contiguous Cache +Exec=/opt/usr/bin/contiguouscache +Icon=contiguouscache +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/customcompleter/customcompleter.desktop b/examples/tools/customcompleter/customcompleter.desktop new file mode 100644 index 0000000..bbc2111 --- /dev/null +++ b/examples/tools/customcompleter/customcompleter.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Custom Completer +Exec=/opt/usr/bin/customcompleter +Icon=customcompleter +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/customtype/customtype.desktop b/examples/tools/customtype/customtype.desktop new file mode 100644 index 0000000..ff15e19 --- /dev/null +++ b/examples/tools/customtype/customtype.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Custom Type +Exec=/opt/usr/bin/customtype +Icon=customtype +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/customtypesending/customtypesending.desktop b/examples/tools/customtypesending/customtypesending.desktop new file mode 100644 index 0000000..dd59b43 --- /dev/null +++ b/examples/tools/customtypesending/customtypesending.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Custom Type Sending +Exec=/opt/usr/bin/customtypesending +Icon=customtypesending +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/echoplugin/echowindow/echowindow.desktop b/examples/tools/echoplugin/echowindow/echowindow.desktop new file mode 100644 index 0000000..7b36de4 --- /dev/null +++ b/examples/tools/echoplugin/echowindow/echowindow.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Echo Window +Exec=/opt/usr/bin/echowindow +Icon=echowindow +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/echoplugin/plugin/plugin.desktop b/examples/tools/echoplugin/plugin/plugin.desktop new file mode 100644 index 0000000..5aba4d1 --- /dev/null +++ b/examples/tools/echoplugin/plugin/plugin.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Echo Plugin +Exec=/opt/usr/bin/plugin +Icon=plugin +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/i18n/i18n.desktop b/examples/tools/i18n/i18n.desktop new file mode 100644 index 0000000..e1632c4 --- /dev/null +++ b/examples/tools/i18n/i18n.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=I18N +Exec=/opt/usr/bin/i18n +Icon=i18n +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/inputpanel/inputpanel.desktop b/examples/tools/inputpanel/inputpanel.desktop new file mode 100644 index 0000000..3cc9bd0 --- /dev/null +++ b/examples/tools/inputpanel/inputpanel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Input Panel +Exec=/opt/usr/bin/inputpanel +Icon=inputpanel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/plugandpaint/plugandpaint.desktop b/examples/tools/plugandpaint/plugandpaint.desktop new file mode 100644 index 0000000..e39d512 --- /dev/null +++ b/examples/tools/plugandpaint/plugandpaint.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Plug appnameplaceholder Paint +Exec=/opt/usr/bin/plugandpaint +Icon=plugandpaint +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/regexp/regexp.desktop b/examples/tools/regexp/regexp.desktop new file mode 100644 index 0000000..b3ae14e --- /dev/null +++ b/examples/tools/regexp/regexp.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Regular Expressions +Exec=/opt/usr/bin/regexp +Icon=regexp +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/settingseditor/settingseditor.desktop b/examples/tools/settingseditor/settingseditor.desktop new file mode 100644 index 0000000..b8561a6 --- /dev/null +++ b/examples/tools/settingseditor/settingseditor.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Settings Editor +Exec=/opt/usr/bin/settingseditor +Icon=settingseditor +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/treemodelcompleter/treemodelcompleter.desktop b/examples/tools/treemodelcompleter/treemodelcompleter.desktop new file mode 100644 index 0000000..a54aa7b --- /dev/null +++ b/examples/tools/treemodelcompleter/treemodelcompleter.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Tree Model Completer +Exec=/opt/usr/bin/treemodelcompleter +Icon=treemodelcompleter +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tools/undoframework/undoframework.desktop b/examples/tools/undoframework/undoframework.desktop new file mode 100644 index 0000000..24b7f32 --- /dev/null +++ b/examples/tools/undoframework/undoframework.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Undo Framework +Exec=/opt/usr/bin/undoframework +Icon=undoframework +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/touch/dials/dials.desktop b/examples/touch/dials/dials.desktop new file mode 100644 index 0000000..1536099 --- /dev/null +++ b/examples/touch/dials/dials.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Touch Dials +Exec=/opt/usr/bin/dials +Icon=dials +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/touch/fingerpaint/fingerpaint.desktop b/examples/touch/fingerpaint/fingerpaint.desktop new file mode 100644 index 0000000..a0bcf31 --- /dev/null +++ b/examples/touch/fingerpaint/fingerpaint.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Finger Paint +Exec=/opt/usr/bin/fingerpaint +Icon=fingerpaint +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/touch/knobs/knobs.desktop b/examples/touch/knobs/knobs.desktop new file mode 100644 index 0000000..bf2fe32 --- /dev/null +++ b/examples/touch/knobs/knobs.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Touch Knobs +Exec=/opt/usr/bin/knobs +Icon=knobs +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/touch/pinchzoom/pinchzoom.desktop b/examples/touch/pinchzoom/pinchzoom.desktop new file mode 100644 index 0000000..727e626 --- /dev/null +++ b/examples/touch/pinchzoom/pinchzoom.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Pinch Zoom +Exec=/opt/usr/bin/pinchzoom +Icon=pinchzoom +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook-fr/part1/part1.desktop b/examples/tutorials/addressbook-fr/part1/part1.desktop new file mode 100644 index 0000000..0cf4115 --- /dev/null +++ b/examples/tutorials/addressbook-fr/part1/part1.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=1 Address Book FR +Exec=/opt/usr/bin/part1 +Icon=part1 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook-fr/part2/part2.desktop b/examples/tutorials/addressbook-fr/part2/part2.desktop new file mode 100644 index 0000000..681c6a1 --- /dev/null +++ b/examples/tutorials/addressbook-fr/part2/part2.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=2 Address Book FR +Exec=/opt/usr/bin/part2 +Icon=part2 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook-fr/part3/part3.desktop b/examples/tutorials/addressbook-fr/part3/part3.desktop new file mode 100644 index 0000000..3c97d51 --- /dev/null +++ b/examples/tutorials/addressbook-fr/part3/part3.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=3 Address Book FR +Exec=/opt/usr/bin/part3 +Icon=part3 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook-fr/part4/part4.desktop b/examples/tutorials/addressbook-fr/part4/part4.desktop new file mode 100644 index 0000000..7726989 --- /dev/null +++ b/examples/tutorials/addressbook-fr/part4/part4.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=4 Address Book FR +Exec=/opt/usr/bin/part4 +Icon=part4 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook-fr/part5/part5.desktop b/examples/tutorials/addressbook-fr/part5/part5.desktop new file mode 100644 index 0000000..0efcb15 --- /dev/null +++ b/examples/tutorials/addressbook-fr/part5/part5.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=5 Address Book FR +Exec=/opt/usr/bin/part5 +Icon=part5 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook-fr/part6/part6.desktop b/examples/tutorials/addressbook-fr/part6/part6.desktop new file mode 100644 index 0000000..1440259 --- /dev/null +++ b/examples/tutorials/addressbook-fr/part6/part6.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=6 Address Book FR +Exec=/opt/usr/bin/part6 +Icon=part6 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook-fr/part7/part7.desktop b/examples/tutorials/addressbook-fr/part7/part7.desktop new file mode 100644 index 0000000..f78ff4b --- /dev/null +++ b/examples/tutorials/addressbook-fr/part7/part7.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=7 Address Book FR +Exec=/opt/usr/bin/part7 +Icon=part7 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook/part1/part1.desktop b/examples/tutorials/addressbook/part1/part1.desktop new file mode 100644 index 0000000..69946ed --- /dev/null +++ b/examples/tutorials/addressbook/part1/part1.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=1 Address Book +Exec=/opt/usr/bin/part1 +Icon=part1 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook/part2/part2.desktop b/examples/tutorials/addressbook/part2/part2.desktop new file mode 100644 index 0000000..5c87ef8 --- /dev/null +++ b/examples/tutorials/addressbook/part2/part2.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=2 Address Book +Exec=/opt/usr/bin/part2 +Icon=part2 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook/part3/part3.desktop b/examples/tutorials/addressbook/part3/part3.desktop new file mode 100644 index 0000000..882a242 --- /dev/null +++ b/examples/tutorials/addressbook/part3/part3.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=3 Address Book +Exec=/opt/usr/bin/part3 +Icon=part3 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook/part4/part4.desktop b/examples/tutorials/addressbook/part4/part4.desktop new file mode 100644 index 0000000..27802b1 --- /dev/null +++ b/examples/tutorials/addressbook/part4/part4.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=4 Address Book +Exec=/opt/usr/bin/part4 +Icon=part4 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook/part5/part5.desktop b/examples/tutorials/addressbook/part5/part5.desktop new file mode 100644 index 0000000..e8b151c --- /dev/null +++ b/examples/tutorials/addressbook/part5/part5.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=5 Address Book +Exec=/opt/usr/bin/part5 +Icon=part5 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook/part6/part6.desktop b/examples/tutorials/addressbook/part6/part6.desktop new file mode 100644 index 0000000..dd49260 --- /dev/null +++ b/examples/tutorials/addressbook/part6/part6.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=6 Address Book +Exec=/opt/usr/bin/part6 +Icon=part6 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/addressbook/part7/part7.desktop b/examples/tutorials/addressbook/part7/part7.desktop new file mode 100644 index 0000000..26d3fdd --- /dev/null +++ b/examples/tutorials/addressbook/part7/part7.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=7 Address Book +Exec=/opt/usr/bin/part7 +Icon=part7 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/gettingStarted/gsQt/part1/part1.pro b/examples/tutorials/gettingStarted/gsQt/part1/part1.pro new file mode 100755 index 0000000..f52a633 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQt/part1/part1.pro @@ -0,0 +1,8 @@ +SOURCES = main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/gettingStarted/gsQt/part1 +sources.files = $$SOURCES *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorial/gettingStarted/gsQt/part1 +INSTALLS += target sources + diff --git a/examples/tutorials/gettingStarted/gsQt/part2/part2.pro b/examples/tutorials/gettingStarted/gsQt/part2/part2.pro new file mode 100755 index 0000000..383c3ce --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQt/part2/part2.pro @@ -0,0 +1,9 @@ + +SOURCES = main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/gettingStarted/gsQt/part2 +sources.files = $$SOURCES *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorial/gettingStarted/gsQt/part2 +INSTALLS += target sources + diff --git a/examples/tutorials/gettingStarted/gsQt/part3/part3.pro b/examples/tutorials/gettingStarted/gsQt/part3/part3.pro new file mode 100755 index 0000000..d194acb --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQt/part3/part3.pro @@ -0,0 +1,9 @@ + +SOURCES = main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/gettingStarted/gsQt/part3 +sources.files = $$SOURCES *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorial/gettingStarted/gsQt/part3 +INSTALLS += target sources + diff --git a/examples/tutorials/gettingStarted/gsQt/part4/part4.pro b/examples/tutorials/gettingStarted/gsQt/part4/part4.pro new file mode 100755 index 0000000..3de03ac --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQt/part4/part4.pro @@ -0,0 +1,9 @@ + +SOURCES = main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/gettingStarted/gsQt/part4 +sources.files = $$SOURCES *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorial/gettingStarted/gsQt/part4 +INSTALLS += target sources + diff --git a/examples/tutorials/gettingStarted/gsQt/part5/part5.pro b/examples/tutorials/gettingStarted/gsQt/part5/part5.pro new file mode 100755 index 0000000..711cac2 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQt/part5/part5.pro @@ -0,0 +1,9 @@ + +SOURCES = main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/gettingStarted/gsQt/part5 +sources.files = $$SOURCES *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorial/gettingStarted/gsQt/part5 +INSTALLS += target sources + diff --git a/examples/tutorials/modelview/1_readonly/1_readonly.desktop b/examples/tutorials/modelview/1_readonly/1_readonly.desktop new file mode 100644 index 0000000..137f56e --- /dev/null +++ b/examples/tutorials/modelview/1_readonly/1_readonly.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=1 Model View +Exec=/opt/usr/bin/1_readonly +Icon=1_readonly +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/2_formatting/2_formatting.desktop b/examples/tutorials/modelview/2_formatting/2_formatting.desktop new file mode 100644 index 0000000..a395000 --- /dev/null +++ b/examples/tutorials/modelview/2_formatting/2_formatting.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=2 Model View +Exec=/opt/usr/bin/2_formatting +Icon=2_formatting +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.desktop b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.desktop new file mode 100644 index 0000000..3e053c9 --- /dev/null +++ b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=3 Model View +Exec=/opt/usr/bin/3_changingmodel +Icon=3_changingmodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/4_headers/4_headers.desktop b/examples/tutorials/modelview/4_headers/4_headers.desktop new file mode 100644 index 0000000..f17fe45 --- /dev/null +++ b/examples/tutorials/modelview/4_headers/4_headers.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=4 Model View +Exec=/opt/usr/bin/4_headers +Icon=4_headers +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/5_edit/5_edit.desktop b/examples/tutorials/modelview/5_edit/5_edit.desktop new file mode 100644 index 0000000..4402c0a --- /dev/null +++ b/examples/tutorials/modelview/5_edit/5_edit.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=5 Model View +Exec=/opt/usr/bin/5_edit +Icon=5_edit +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/6_treeview/6_treeview.desktop b/examples/tutorials/modelview/6_treeview/6_treeview.desktop new file mode 100644 index 0000000..e0b872b --- /dev/null +++ b/examples/tutorials/modelview/6_treeview/6_treeview.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=6 Model View +Exec=/opt/usr/bin/6_treeview +Icon=6_treeview +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/7_selections/7_selections.desktop b/examples/tutorials/modelview/7_selections/7_selections.desktop new file mode 100644 index 0000000..afba383 --- /dev/null +++ b/examples/tutorials/modelview/7_selections/7_selections.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=7 Model View +Exec=/opt/usr/bin/7_selections +Icon=7_selections +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/widgets/childwidget/childwidget.desktop b/examples/tutorials/widgets/childwidget/childwidget.desktop new file mode 100644 index 0000000..81bc7c1 --- /dev/null +++ b/examples/tutorials/widgets/childwidget/childwidget.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Child Widgets +Exec=/opt/usr/bin/childwidget +Icon=childwidget +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/widgets/nestedlayouts/nestedlayouts.desktop b/examples/tutorials/widgets/nestedlayouts/nestedlayouts.desktop new file mode 100644 index 0000000..9ff737d --- /dev/null +++ b/examples/tutorials/widgets/nestedlayouts/nestedlayouts.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Nested Layouts +Exec=/opt/usr/bin/nestedlayouts +Icon=nestedlayouts +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/widgets/toplevel/toplevel.desktop b/examples/tutorials/widgets/toplevel/toplevel.desktop new file mode 100644 index 0000000..5626297 --- /dev/null +++ b/examples/tutorials/widgets/toplevel/toplevel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Creating a Window +Exec=/opt/usr/bin/toplevel +Icon=toplevel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/tutorials/widgets/windowlayout/windowlayout.desktop b/examples/tutorials/widgets/windowlayout/windowlayout.desktop new file mode 100644 index 0000000..4a00795 --- /dev/null +++ b/examples/tutorials/widgets/windowlayout/windowlayout.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Using Layouts +Exec=/opt/usr/bin/windowlayout +Icon=windowlayout +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/uitools/multipleinheritance/multipleinheritance.desktop b/examples/uitools/multipleinheritance/multipleinheritance.desktop new file mode 100644 index 0000000..7e652f9 --- /dev/null +++ b/examples/uitools/multipleinheritance/multipleinheritance.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Multiple Inheritance +Exec=/opt/usr/bin/multipleinheritance +Icon=multipleinheritance +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/uitools/textfinder/textfinder.desktop b/examples/uitools/textfinder/textfinder.desktop new file mode 100644 index 0000000..e1911cc --- /dev/null +++ b/examples/uitools/textfinder/textfinder.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Text Finder +Exec=/opt/usr/bin/textfinder +Icon=textfinder +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/webkit/domtraversal/domtraversal.desktop b/examples/webkit/domtraversal/domtraversal.desktop new file mode 100644 index 0000000..e44d725 --- /dev/null +++ b/examples/webkit/domtraversal/domtraversal.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=DOM Traversal +Exec=/opt/usr/bin/domtraversal +Icon=domtraversal +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/webkit/domtraversal/window_mobiles.ui b/examples/webkit/domtraversal/window_mobiles.ui new file mode 100644 index 0000000..d6b6d11 --- /dev/null +++ b/examples/webkit/domtraversal/window_mobiles.ui @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Window</class> + <widget class="QMainWindow" name="Window"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>404</width> + <height>600</height> + </rect> + </property> + <property name="windowTitle"> + <string>Web Element DOM Traversal</string> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="topMargin"> + <number>4</number> + </property> + <property name="bottomMargin"> + <number>4</number> + </property> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Web View</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QWebView" name="webView"> + <property name="url"> + <url> + <string>http://qt.nokia.com/</string> + </url> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Document Structure</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QTreeWidget" name="treeWidget"> + <attribute name="headerVisible"> + <bool>false</bool> + </attribute> + <column> + <property name="text"> + <string notr="true">1</string> + </property> + </column> + </widget> + </item> + </layout> + <zorder>treeWidget</zorder> + <zorder>treeWidget</zorder> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>404</width> + <height>20</height> + </rect> + </property> + </widget> + </widget> + <customwidgets> + <customwidget> + <class>QWebView</class> + <extends>QWidget</extends> + <header>QtWebKit/QWebView</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/examples/webkit/fancybrowser/fancybrowser.desktop b/examples/webkit/fancybrowser/fancybrowser.desktop new file mode 100644 index 0000000..975eb0c --- /dev/null +++ b/examples/webkit/fancybrowser/fancybrowser.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Fancy Browser +Exec=/opt/usr/bin/fancybrowser +Icon=fancybrowser +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/webkit/formextractor/formextractor.desktop b/examples/webkit/formextractor/formextractor.desktop new file mode 100644 index 0000000..5c67097 --- /dev/null +++ b/examples/webkit/formextractor/formextractor.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Form Extractor +Exec=/opt/usr/bin/formextractor +Icon=formextractor +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/webkit/formextractor/formextractor_mobiles.ui b/examples/webkit/formextractor/formextractor_mobiles.ui new file mode 100644 index 0000000..4b81bc7 --- /dev/null +++ b/examples/webkit/formextractor/formextractor_mobiles.ui @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Form</class> + <widget class="QWidget" name="Form"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>242</width> + <height>313</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tabWebForm"> + <attribute name="title"> + <string>Web Form</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QWebView" name="webView"> + <property name="minimumSize"> + <size> + <width>200</width> + <height>150</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>400</width> + <height>16777215</height> + </size> + </property> + <property name="url"> + <url> + <string>about:blank</string> + </url> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tabData"> + <attribute name="title"> + <string>Extracted Data</string> + </attribute> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="firstNameLabel"> + <property name="text"> + <string>First Name</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="firstNameEdit"> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lastNameLabel"> + <property name="text"> + <string>Last Name</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="lastNameEdit"> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="genderLabel"> + <property name="text"> + <string>Gender</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="genderEdit"> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="updatesLabel"> + <property name="text"> + <string>Receive Updates</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="updatesEdit"> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="4" column="1"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>QWebView</class> + <extends>QWidget</extends> + <header>QtWebKit/QWebView</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/examples/webkit/framecapture/framecapture.desktop b/examples/webkit/framecapture/framecapture.desktop new file mode 100644 index 0000000..14d74e4 --- /dev/null +++ b/examples/webkit/framecapture/framecapture.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=WebKit Frame Capture +Exec=/opt/usr/bin/framecapture +Icon=framecapture +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/webkit/googlechat/googlechat.desktop b/examples/webkit/googlechat/googlechat.desktop new file mode 100644 index 0000000..b19b74b --- /dev/null +++ b/examples/webkit/googlechat/googlechat.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Google Chat +Exec=/opt/usr/bin/googlechat +Icon=googlechat +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/webkit/previewer/previewer.desktop b/examples/webkit/previewer/previewer.desktop new file mode 100644 index 0000000..51c570d --- /dev/null +++ b/examples/webkit/previewer/previewer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Previewer +Exec=/opt/usr/bin/previewer +Icon=previewer +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/webkit/previewer/previewer_mobiles.ui b/examples/webkit/previewer/previewer_mobiles.ui new file mode 100644 index 0000000..b65a88e --- /dev/null +++ b/examples/webkit/previewer/previewer_mobiles.ui @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Form</class> + <widget class="QWidget" name="Form"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>259</width> + <height>177</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tabHTMLPreview"> + <attribute name="title"> + <string>HTML Preview</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QWebView" name="webView"> + <property name="url"> + <url> + <string>about:blank</string> + </url> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tabHTMLEditor"> + <attribute name="title"> + <string>HTML Editor</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QPlainTextEdit" name="plainTextEdit"/> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QPushButton" name="clearButton"> + <property name="text"> + <string>Clear</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="previewButton"> + <property name="text"> + <string>Preview</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>QWebView</class> + <extends>QWidget</extends> + <header>QtWebKit/QWebView</header> + </customwidget> + </customwidgets> + <resources/> + <connections> + <connection> + <sender>clearButton</sender> + <signal>clicked()</signal> + <receiver>plainTextEdit</receiver> + <slot>clear()</slot> + <hints> + <hint type="sourcelabel"> + <x>56</x> + <y>653</y> + </hint> + <hint type="destinationlabel"> + <x>98</x> + <y>551</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/examples/webkit/simpleselector/simpleselector.desktop b/examples/webkit/simpleselector/simpleselector.desktop new file mode 100644 index 0000000..2f9fde1 --- /dev/null +++ b/examples/webkit/simpleselector/simpleselector.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Simple Selector +Exec=/opt/usr/bin/simpleselector +Icon=simpleselector +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/webkit/simplewebplugin/csvfactory.cpp b/examples/webkit/simplewebplugin/csvfactory.cpp new file mode 100644 index 0000000..56b4558 --- /dev/null +++ b/examples/webkit/simplewebplugin/csvfactory.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> +#include <QtNetwork> +#include <QWebPluginFactory> +#include "csvfactory.h" +#include "csvview.h" + +//! [constructor] +CSVFactory::CSVFactory(QObject *parent) + : QWebPluginFactory(parent) +{ + manager = new QNetworkAccessManager(this); +}; +//! [constructor] + +//! [begin create] +QObject *CSVFactory::create(const QString &mimeType, const QUrl &url, + const QStringList &argumentNames, + const QStringList &argumentValues) const +{ + if (mimeType != "text/csv") + return 0; + + CSVView *view = new CSVView(argumentValues[argumentNames.indexOf("type")]); +//! [begin create] + +//! [submit request] + QNetworkRequest request(url); + QNetworkReply *reply = manager->get(request); + connect(reply, SIGNAL(finished()), view, SLOT(updateModel())); + connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater())); + + return view; +} +//! [submit request] + +//! [plugins] +QList<QWebPluginFactory::Plugin> CSVFactory::plugins() const +{ + QWebPluginFactory::MimeType mimeType; + mimeType.name = "text/csv"; + mimeType.description = "Comma-separated values"; + mimeType.fileExtensions = QStringList() << "csv"; + + QWebPluginFactory::Plugin plugin; + plugin.name = "CSV file viewer"; + plugin.description = "A CSV file Web plugin."; + plugin.mimeTypes = QList<MimeType>() << mimeType; + + return QList<QWebPluginFactory::Plugin>() << plugin; +} +//! [plugins] diff --git a/examples/webkit/simplewebplugin/csvfactory.h b/examples/webkit/simplewebplugin/csvfactory.h new file mode 100644 index 0000000..0b046c5 --- /dev/null +++ b/examples/webkit/simplewebplugin/csvfactory.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CSVFACTORY_H +#define CSVFACTORY_H + +#include <QNetworkRequest> +#include <QWebPluginFactory> + +class QNetworkAccessManager; +class QNetworkReply; + +//! [plugin factory] +class CSVFactory : public QWebPluginFactory +{ + Q_OBJECT + +public: + CSVFactory(QObject *parent = 0); + QObject *create(const QString &mimeType, const QUrl &url, + const QStringList &argumentNames, + const QStringList &argumentValues) const; + QList<QWebPluginFactory::Plugin> plugins() const; + +private: + QNetworkAccessManager *manager; +}; +//! [plugin factory] + +#endif diff --git a/examples/webkit/simplewebplugin/csvview.cpp b/examples/webkit/simplewebplugin/csvview.cpp new file mode 100644 index 0000000..3d87daa --- /dev/null +++ b/examples/webkit/simplewebplugin/csvview.cpp @@ -0,0 +1,176 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> +#include <QtNetwork> +#include "csvview.h" + +//! [constructor] +CSVView::CSVView(const QString &mimeType, QWidget *parent) + : QTableView(parent) +{ + this->mimeType = mimeType; +} +//! [constructor] + +//! [update model begin] +void CSVView::updateModel() +{ + QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); + + if (reply->error() != QNetworkReply::NoError) + return; + + bool hasHeader = false; + QString charset = "latin1"; +//! [update model begin] + + foreach (QString piece, mimeType.split(";")) { + piece = piece.trimmed(); + if (piece.contains("=")) { + int index = piece.indexOf("="); + QString left = piece.left(index).trimmed(); + QString right = piece.mid(index + 1).trimmed(); + if (left == "header") + hasHeader = (right == "present"); + else if (left == "charset") + charset = right; + } + } + +//! [read data begin] + QTextStream stream(reply); + stream.setCodec(QTextCodec::codecForName(charset.toLatin1())); + + QStandardItemModel *model = new QStandardItemModel(this); +//! [read data begin] + QList<QStandardItem *> items; + bool firstLine = hasHeader; + bool wasQuote = false; + bool wasCR = false; + bool quoted = false; + QString text; + + while (!stream.atEnd()) { + + QString ch = stream.read(1); + + if (wasQuote) { + if (ch == "\"") { + if (quoted) { + text += ch; // quoted "" are inserted as " + wasQuote = false; // no quotes are pending + } else { + quoted = true; // unquoted "" starts quoting + wasQuote = true; // with a pending quote + } + continue; // process the next character + + } else { + quoted = !quoted; // process the pending quote + wasQuote = false; // no quotes are pending + } // process the current character + + } else if (wasCR) { + wasCR = false; + + if (ch == "\n") { // CR LF represents the end of a row + if (!text.isEmpty()) + items.append(new QStandardItem(QString(text))); + + addRow(firstLine, model, items); + items.clear(); + text = ""; + firstLine = false; + continue; // process the next character + } else + text += "\r"; // CR on its own is inserted + } // process the current character + + // wasQuote is never true here. + // wasCR is never true here. + + if (ch == "\"") + wasQuote = true; // handle the pending quote later + + else if (ch == ",") { + if (quoted) + text += ch; + else { + items.append(new QStandardItem(QString(text))); + text = ""; + } + } + + else if (ch == "\r") { + if (!quoted) + wasCR = true; + else + text += ch; + } + + else if (ch == "\n") + text += ch; + else + text += ch; + + } + + if (items.count() > 0) + addRow(firstLine, model, items); + +//! [update model] + reply->close(); + + setModel(model); + resizeColumnsToContents(); + horizontalHeader()->setStretchLastSection(true); +} +//! [update model] + +void CSVView::addRow(bool firstLine, QStandardItemModel *model, + const QList<QStandardItem *> &items) +{ + if (firstLine) { + for (int j = 0; j < items.count(); ++j) + model->setHorizontalHeaderItem(j, items[j]); + } else + model->appendRow(items); +} diff --git a/examples/webkit/simplewebplugin/csvview.h b/examples/webkit/simplewebplugin/csvview.h new file mode 100644 index 0000000..0a136f3 --- /dev/null +++ b/examples/webkit/simplewebplugin/csvview.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CSVVIEW_H +#define CSVVIEW_H + +#include <QNetworkRequest> +#include <QStandardItemModel> +#include <QTableView> +#include <QWebPluginFactory> + +class QNetworkAccessManager; +class QNetworkReply; + +//! [definition] +class CSVView : public QTableView +{ + Q_OBJECT + +public: + CSVView(const QString &mimeType, QWidget *parent = 0); + +public slots: + void updateModel(); + +private: + void addRow(bool firstLine, QStandardItemModel *model, + const QList<QStandardItem *> &items); + + QString mimeType; +}; +//! [definition] + +#endif diff --git a/examples/webkit/simplewebplugin/main.cpp b/examples/webkit/simplewebplugin/main.cpp new file mode 100644 index 0000000..8e823b1 --- /dev/null +++ b/examples/webkit/simplewebplugin/main.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include "mainwindow.h" + +//! [main] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + MainWindow window; + window.show(); + return app.exec(); +} +//! [main] diff --git a/examples/webkit/simplewebplugin/mainwindow.cpp b/examples/webkit/simplewebplugin/mainwindow.cpp new file mode 100644 index 0000000..60bdd8b --- /dev/null +++ b/examples/webkit/simplewebplugin/mainwindow.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QFile> +#include <QWebView> +#include "csvfactory.h" +#include "mainwindow.h" + +//! [constructor] +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ + QWebSettings::globalSettings()->setAttribute( + QWebSettings::PluginsEnabled, true); + + QWebView *webView = new QWebView; + CSVFactory *factory = new CSVFactory(this); + webView->page()->setPluginFactory(factory); + QFile file(":/pages/index.html"); + file.open(QFile::ReadOnly); + webView->setHtml(file.readAll()); + + setCentralWidget(webView); + setWindowTitle(tr("Simple Web Plugin Example")); +} +//! [constructor] diff --git a/examples/webkit/simplewebplugin/mainwindow.h b/examples/webkit/simplewebplugin/mainwindow.h new file mode 100644 index 0000000..12c8306 --- /dev/null +++ b/examples/webkit/simplewebplugin/mainwindow.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = 0); +}; + +#endif diff --git a/examples/webkit/webftpclient/downloader.cpp b/examples/webkit/webftpclient/downloader.cpp new file mode 100644 index 0000000..7185852 --- /dev/null +++ b/examples/webkit/webftpclient/downloader.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QFileDialog> +#include <QMessageBox> +#include <QNetworkRequest> +#include <QNetworkReply> +#include "downloader.h" + +Downloader::Downloader(QWidget *parentWidget, QNetworkAccessManager *manager) + : QObject(parentWidget), manager(manager), parentWidget(parentWidget) +{ +} + +QString Downloader::chooseSaveFile(const QUrl &url) +{ + QString fileName = url.path().split("/").last(); + if (!path.isEmpty()) + fileName = QDir(path).filePath(fileName); + + return QFileDialog::getSaveFileName(parentWidget, tr("Save File"), fileName); +} + +void Downloader::startDownload(const QNetworkRequest &request) +{ + downloads[request.url().toString()] = chooseSaveFile(request.url()); + + QNetworkReply *reply = manager->get(request); + connect(reply, SIGNAL(finished()), this, SLOT(finishDownload())); +} + +void Downloader::saveFile(QNetworkReply *reply) +{ + QString newPath = downloads[reply->url().toString()]; + + if (newPath.isEmpty()) + newPath = chooseSaveFile(reply->url()); + + if (!newPath.isEmpty()) { + QFile file(newPath); + if (file.open(QIODevice::WriteOnly)) { + file.write(reply->readAll()); + file.close(); + path = QDir(newPath).dirName(); + QMessageBox::information(parentWidget, tr("Download Completed"), + tr("Saved '%1'.").arg(newPath)); + } else + QMessageBox::warning(parentWidget, tr("Download Failed"), + tr("Failed to save the file.")); + } +} + +void Downloader::finishDownload() +{ + QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); + saveFile(reply); + downloads.remove(reply->url().toString()); + reply->deleteLater(); +} diff --git a/examples/webkit/webftpclient/downloader.h b/examples/webkit/webftpclient/downloader.h new file mode 100644 index 0000000..8201cea --- /dev/null +++ b/examples/webkit/webftpclient/downloader.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DOWNLOADER_H +#define DOWNLOADER_H + +#include <QDir> +#include <QHash> +#include <QObject> +#include <QUrl> + +class QNetworkAccessManager; +class QNetworkRequest; +class QNetworkReply; +class QWidget; + +class Downloader : public QObject +{ + Q_OBJECT + +public: + Downloader(QWidget *parentWidget, QNetworkAccessManager *manager); + +public slots: + QString chooseSaveFile(const QUrl &url); + void startDownload(const QNetworkRequest &request); + void saveFile(QNetworkReply *reply); + void finishDownload(); + +private: + QNetworkAccessManager *manager; + QNetworkReply *reply; + QHash<QString, QString> downloads; + QString path; + QWidget *parentWidget; +}; + +#endif diff --git a/examples/webkit/webftpclient/ftpreply.cpp b/examples/webkit/webftpclient/ftpreply.cpp new file mode 100644 index 0000000..d3b7aa7 --- /dev/null +++ b/examples/webkit/webftpclient/ftpreply.cpp @@ -0,0 +1,237 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QTextDocument> +#include <QtNetwork> +#include "ftpreply.h" + +//! [constructor] +FtpReply::FtpReply(const QUrl &url) + : QNetworkReply() +{ + ftp = new QFtp(this); + connect(ftp, SIGNAL(listInfo(QUrlInfo)), this, SLOT(processListInfo(QUrlInfo))); + connect(ftp, SIGNAL(readyRead()), this, SLOT(processData())); + connect(ftp, SIGNAL(commandFinished(int, bool)), this, SLOT(processCommand(int, bool))); + + offset = 0; + units = QStringList() << tr("bytes") << tr("K") << tr("M") << tr("G") + << tr("Ti") << tr("Pi") << tr("Ei") << tr("Zi") + << tr("Yi"); + + setUrl(url); + ftp->connectToHost(url.host()); +} +//! [constructor] + +//! [process command] +void FtpReply::processCommand(int, bool err) +{ + if (err) { + setError(ContentNotFoundError, tr("Unknown command")); + emit error(ContentNotFoundError); + return; + } + + switch (ftp->currentCommand()) { + case QFtp::ConnectToHost: + ftp->login(); + break; + + case QFtp::Login: + ftp->list(url().path()); + break; + + case QFtp::List: + if (items.size() == 1) + ftp->get(url().path()); + else + setListContent(); + break; + + case QFtp::Get: + setContent(); + + default: + ; + } +} +//! [process command] + +//! [process list info] +void FtpReply::processListInfo(const QUrlInfo &urlInfo) +{ + items.append(urlInfo); +} +//! [process list info] + +//! [process data] +void FtpReply::processData() +{ + content += ftp->readAll(); +} +//! [process data] + +//! [set content] +void FtpReply::setContent() +{ + open(ReadOnly | Unbuffered); + setHeader(QNetworkRequest::ContentLengthHeader, QVariant(content.size())); + emit readyRead(); + emit finished(); + ftp->close(); +} +//! [set content] + +//! [set list content] +void FtpReply::setListContent() +{ + QUrl u = url(); + if (!u.path().endsWith("/")) + u.setPath(u.path() + "/"); + + QString base_url = url().toString(); + QString base_path = u.path(); + + open(ReadOnly | Unbuffered); + QString content( + "<html>\n" + "<head>\n" + " <title>" + Qt::escape(base_url) + "</title>\n" + " <style type=\"text/css\">\n" + " th { background-color: #aaaaaa; color: black }\n" + " table { border: solid 1px #aaaaaa }\n" + " tr.odd { background-color: #dddddd; color: black\n }\n" + " tr.even { background-color: white; color: black\n }\n" + " </style>\n" + "</head>\n\n" + "<body>\n" + "<h1>" + tr("Listing for %1").arg(base_path) + "</h1>\n\n" + "<table align=\"center\" cellspacing=\"0\" width=\"90%\">\n" + "<tr><th>Name</th><th>Size</th></tr>\n"); + + QUrl parent = u.resolved(QUrl("..")); + + if (parent.isParentOf(u)) + + content += QString("<tr><td><strong><a href=\"" + parent.toString() + "\">" + + tr("Parent directory") + "</a></strong></td><td></td></tr>\n"); + + int i = 0; + foreach (const QUrlInfo &item, items) { + + QUrl child = u.resolved(QUrl(item.name())); + + if (i == 0) + content += QString("<tr class=\"odd\">"); + else + content += QString("<tr class=\"even\">"); + + content += QString("<td><a href=\"" + child.toString() + "\">" + + Qt::escape(item.name()) + "</a></td>"); + + qint64 size = item.size(); + int unit = 0; + while (size) { + qint64 new_size = size/1024; + if (new_size && unit < units.size()) { + size = new_size; + unit += 1; + } else + break; + } + + if (item.isFile()) + content += QString("<td>" + QString::number(size) + " " + + units[unit] + "</td></tr>\n"); + else + content += QString("<td></td></tr>\n"); + + i = 1 - i; + } + + content += QString("</table>\n" + "</body>\n" + "</html>\n"); + + this->content = content.toUtf8(); + + setHeader(QNetworkRequest::ContentTypeHeader, QVariant("text/html; charset=UTF-8")); + setHeader(QNetworkRequest::ContentLengthHeader, QVariant(this->content.size())); + emit readyRead(); + emit finished(); + ftp->close(); +} +//! [set list content] + +// QIODevice methods + +//! [abort] +void FtpReply::abort() +{ +} +//! [abort] + +//! [bytes available] +qint64 FtpReply::bytesAvailable() const +{ + return content.size() - offset; +} +//! [bytes available] + +//! [is sequential] +bool FtpReply::isSequential() const +{ + return true; +} +//! [is sequential] + +//! [read data] +qint64 FtpReply::readData(char *data, qint64 maxSize) +{ + if (offset < content.size()) { + qint64 number = qMin(maxSize, content.size() - offset); + memcpy(data, content.constData() + offset, number); + offset += number; + return number; + } else + return -1; +} +//! [read data] diff --git a/examples/webkit/webftpclient/ftpreply.h b/examples/webkit/webftpclient/ftpreply.h new file mode 100644 index 0000000..becd4e4 --- /dev/null +++ b/examples/webkit/webftpclient/ftpreply.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FTPREPLY_H +#define FTPREPLY_H + +#include <QNetworkReply> +#include <QStringList> +#include <QUrlInfo> + +class QFtp; + +//! [class definition] +class FtpReply : public QNetworkReply +{ + Q_OBJECT + +public: + FtpReply(const QUrl &url); + void abort(); + qint64 bytesAvailable() const; + bool isSequential() const; + +protected: + qint64 readData(char *data, qint64 maxSize); + +private slots: + void processCommand(int command, bool error); + void processListInfo(const QUrlInfo &urlInfo); + void processData(); + +private: + void setContent(); + void setListContent(); + + QFtp *ftp; + QList<QUrlInfo> items; + QByteArray content; + qint64 offset; + QStringList units; +}; +//! [class definition] + +#endif diff --git a/examples/webkit/webftpclient/ftpview.cpp b/examples/webkit/webftpclient/ftpview.cpp new file mode 100644 index 0000000..dd3fc8a --- /dev/null +++ b/examples/webkit/webftpclient/ftpview.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "downloader.h" +#include "ftpview.h" +#include "networkaccessmanager.h" + +//! [constructor] +FtpView::FtpView() +{ + QNetworkAccessManager *oldManager = page()->networkAccessManager(); + NetworkAccessManager *newManager = new NetworkAccessManager(oldManager, this); + page()->setNetworkAccessManager(newManager); + + page()->setForwardUnsupportedContent(true); + downloader = new Downloader(this, newManager); + + connect(page(), SIGNAL(unsupportedContent(QNetworkReply *)), + downloader, SLOT(saveFile(QNetworkReply *))); + connect(page(), SIGNAL(downloadRequested(const QNetworkRequest &)), + downloader, SLOT(startDownload(const QNetworkRequest &))); + + connect(this, SIGNAL(urlChanged(const QUrl &)), + this, SLOT(updateWindowTitle(const QUrl &))); +} +//! [constructor] + +void FtpView::updateWindowTitle(const QUrl &url) +{ + setWindowTitle(tr("FTP Client - %1").arg(url.toString())); +} diff --git a/examples/webkit/webftpclient/ftpview.h b/examples/webkit/webftpclient/ftpview.h new file mode 100644 index 0000000..2538812 --- /dev/null +++ b/examples/webkit/webftpclient/ftpview.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QWebView> + +class Downloader; +class QNetworkAccessManager; + +class FtpView : public QWebView +{ + Q_OBJECT + +public: + FtpView(); + +private slots: + void updateWindowTitle(const QUrl &url); + +private: + Downloader *downloader; +}; diff --git a/examples/webkit/webftpclient/main.cpp b/examples/webkit/webftpclient/main.cpp new file mode 100644 index 0000000..ac42e36 --- /dev/null +++ b/examples/webkit/webftpclient/main.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> +#include <QtWebKit> + +#include "ftpview.h" + +//! [main] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + FtpView view; + view.setUrl(QUrl("ftp://ftp.qt.nokia.com")); + view.show(); + + return app.exec(); +} +//! [main] diff --git a/examples/webkit/webftpclient/networkaccessmanager.cpp b/examples/webkit/webftpclient/networkaccessmanager.cpp new file mode 100644 index 0000000..e52c7fe --- /dev/null +++ b/examples/webkit/webftpclient/networkaccessmanager.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtNetwork> +#include "networkaccessmanager.h" +#include "ftpreply.h" + +//! [constructor] +NetworkAccessManager::NetworkAccessManager(QNetworkAccessManager *manager, QObject *parent) + : QNetworkAccessManager(parent) +{ + setCache(manager->cache()); + setCookieJar(manager->cookieJar()); + setProxy(manager->proxy()); + setProxyFactory(manager->proxyFactory()); +} +//! [constructor] + +//! [create request] +QNetworkReply *NetworkAccessManager::createRequest( + QNetworkAccessManager::Operation operation, const QNetworkRequest &request, + QIODevice *device) +{ + if (request.url().scheme() != "ftp") + return QNetworkAccessManager::createRequest(operation, request, device); + + if (operation == GetOperation) + // Handle ftp:// URLs separately by creating custom QNetworkReply + // objects. + return new FtpReply(request.url()); + else + return QNetworkAccessManager::createRequest(operation, request, device); +} +//! [create request] diff --git a/examples/webkit/webftpclient/networkaccessmanager.h b/examples/webkit/webftpclient/networkaccessmanager.h new file mode 100644 index 0000000..256ae82 --- /dev/null +++ b/examples/webkit/webftpclient/networkaccessmanager.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef NETWORKACCESSMANAGER_H +#define NETWORKACCESSMANAGER_H + +#include <QNetworkAccessManager> + +class NetworkAccessManager : public QNetworkAccessManager +{ + Q_OBJECT + +public: + NetworkAccessManager(QNetworkAccessManager *oldManager, QObject *parent = 0); + +protected: + QNetworkReply *createRequest(Operation operation, const QNetworkRequest &request, QIODevice *device); +}; + +#endif diff --git a/examples/webkit/webftpclient/webftpclient.pro b/examples/webkit/webftpclient/webftpclient.pro new file mode 100644 index 0000000..6c17410 --- /dev/null +++ b/examples/webkit/webftpclient/webftpclient.pro @@ -0,0 +1,22 @@ +HEADERS = downloader.h \ + ftpreply.h \ + ftpview.h \ + networkaccessmanager.h +SOURCES = downloader.cpp \ + ftpreply.cpp \ + ftpview.cpp \ + main.cpp \ + networkaccessmanager.cpp + +QT += network webkit + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/webkit/webftpclient +sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/webftpclient +INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000EFEF + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/webkit/webplugin/csvfactory.cpp b/examples/webkit/webplugin/csvfactory.cpp new file mode 100644 index 0000000..b605a76 --- /dev/null +++ b/examples/webkit/webplugin/csvfactory.cpp @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> +#include <QtNetwork> +#include <QtWebKit> +#include "csvfactory.h" +#include "csvview.h" + +CSVFactory::CSVFactory(QWebView *webView, QObject *parent) + : QWebPluginFactory(parent) +{ + manager = new QNetworkAccessManager(this); + this->webView = webView; +}; + +//! [begin create] +QObject *CSVFactory::create(const QString &mimeType, const QUrl &url, + const QStringList &argumentNames, + const QStringList &argumentValues) const +{ + if (mimeType != "text/csv") + return 0; + + QHash<QString, QString> arguments; + for (int i = 0; i < argumentNames.count(); ++i) + arguments[argumentNames[i]] = argumentValues[i]; + + CSVView *view = new CSVView(arguments["type"]); +//! [begin create] + +//! [create connection] + QWebFrame *frame = webView->page()->mainFrame(); + frame->addToJavaScriptWindowObject("view", view); + frame->evaluateJavaScript("view.rowSelected.connect(fillInTable);\n"); +//! [create connection] + +//! [submit request] + QNetworkRequest request(url); + QNetworkReply *reply = manager->get(request); + connect(reply, SIGNAL(finished()), view, SLOT(updateModel())); + connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater())); + + return view; +} +//! [submit request] + +QList<QWebPluginFactory::Plugin> CSVFactory::plugins() const +{ + QWebPluginFactory::MimeType mimeType; + mimeType.name = "text/csv"; + mimeType.description = "Comma-separated values"; + mimeType.fileExtensions = QStringList() << "csv"; + + QWebPluginFactory::Plugin plugin; + plugin.name = "CSV file viewer"; + plugin.description = "A CSV file Web plugin."; + plugin.mimeTypes = QList<MimeType>() << mimeType; + + return QList<QWebPluginFactory::Plugin>() << plugin; +} diff --git a/examples/webkit/webplugin/csvfactory.h b/examples/webkit/webplugin/csvfactory.h new file mode 100644 index 0000000..5a44c50 --- /dev/null +++ b/examples/webkit/webplugin/csvfactory.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CSVFACTORY_H +#define CSVFACTORY_H + +#include <QNetworkRequest> +#include <QWebPluginFactory> + +class QNetworkAccessManager; +class QNetworkReply; +class QWebView; + +class CSVFactory : public QWebPluginFactory +{ + Q_OBJECT + +public: + CSVFactory(QWebView *webView, QObject *parent = 0); + QObject *create(const QString &mimeType, const QUrl &url, + const QStringList &argumentNames, + const QStringList &argumentValues) const; + QList<QWebPluginFactory::Plugin> plugins() const; + +private: + QNetworkAccessManager *manager; + QWebView *webView; +}; + +#endif diff --git a/examples/webkit/webplugin/csvview.cpp b/examples/webkit/webplugin/csvview.cpp new file mode 100644 index 0000000..0996f24 --- /dev/null +++ b/examples/webkit/webplugin/csvview.cpp @@ -0,0 +1,190 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> +#include <QtNetwork> +#include "csvview.h" + +//! [constructor] +CSVView::CSVView(const QString &mimeType, QWidget *parent) + : QTableView(parent) +{ + this->mimeType = mimeType; + + setEditTriggers(NoEditTriggers); + setSelectionBehavior(SelectRows); + setSelectionMode(SingleSelection); +} +//! [constructor] + +void CSVView::updateModel() +{ + QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); + + if (reply->error() != QNetworkReply::NoError) + return; + + bool hasHeader = false; + QString charset = "latin1"; + + foreach (QString piece, mimeType.split(";")) { + piece = piece.trimmed(); + if (piece.contains("=")) { + int index = piece.indexOf("="); + QString left = piece.left(index).trimmed(); + QString right = piece.mid(index + 1).trimmed(); + if (left == "header") + hasHeader = (right == "present"); + else if (left == "charset") + charset = right; + } + } + + QTextStream stream(reply); + stream.setCodec(QTextCodec::codecForName(charset.toLatin1())); + + QStandardItemModel *model = new QStandardItemModel(this); + QList<QStandardItem *> items; + bool firstLine = hasHeader; + bool wasQuote = false; + bool wasCR = false; + bool quoted = false; + QString text; + + while (!stream.atEnd()) { + + QString ch = stream.read(1); + + if (wasQuote) { + if (ch == "\"") { + if (quoted) { + text += ch; // quoted "" are inserted as " + wasQuote = false; // no quotes are pending + } else { + quoted = true; // unquoted "" starts quoting + wasQuote = true; // with a pending quote + } + continue; // process the next character + + } else { + quoted = !quoted; // process the pending quote + wasQuote = false; // no quotes are pending + } // process the current character + + } else if (wasCR) { + wasCR = false; + + if (ch == "\n") { // CR LF represents the end of a row + if (!text.isEmpty()) + items.append(new QStandardItem(QString(text))); + + addRow(firstLine, model, items); + items.clear(); + text = ""; + firstLine = false; + continue; // process the next character + } else + text += "\r"; // CR on its own is inserted + } // process the current character + + // wasQuote is never true here. + // wasCR is never true here. + + if (ch == "\"") + wasQuote = true; // handle the pending quote later + + else if (ch == ",") { + if (quoted) + text += ch; + else { + items.append(new QStandardItem(QString(text))); + text = ""; + } + } + + else if (ch == "\r") { + if (!quoted) + wasCR = true; + else + text += ch; + } + + else if (ch == "\n") + text += ch; + else + text += ch; + + } + + if (items.count() > 0) + addRow(firstLine, model, items); + + reply->close(); + + setModel(model); + + connect(selectionModel(), + SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), + this, SLOT(exportRow(const QModelIndex &))); + + resizeColumnsToContents(); + horizontalHeader()->setStretchLastSection(true); +} + +void CSVView::addRow(bool firstLine, QStandardItemModel *model, + const QList<QStandardItem *> &items) +{ + if (firstLine) { + for (int j = 0; j < items.count(); ++j) + model->setHorizontalHeaderItem(j, items[j]); + } else + model->appendRow(items); +} + +//! [export row] +void CSVView::exportRow(const QModelIndex ¤t) +{ + QString name = model()->index(current.row(), 0).data().toString(); + QString address = model()->index(current.row(), 1).data().toString(); + QString quantity = model()->index(current.row(), 2).data().toString(); + + emit rowSelected(name, address, quantity); +} +//! [export row] diff --git a/examples/webkit/webplugin/csvview.h b/examples/webkit/webplugin/csvview.h new file mode 100644 index 0000000..bf8918b --- /dev/null +++ b/examples/webkit/webplugin/csvview.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CSVVIEW_H +#define CSVVIEW_H + +#include <QNetworkRequest> +#include <QStandardItemModel> +#include <QTableView> +#include <QWebPluginFactory> + +class QNetworkAccessManager; +class QNetworkReply; +class QWebFrame; + +//! [definition] +class CSVView : public QTableView +{ + Q_OBJECT + +public: + CSVView(const QString &mimeType, QWidget *parent = 0); + +signals: + void rowSelected(const QString &name, const QString &address, + const QString &quantity); + +public slots: + void updateModel(); + +private slots: + void exportRow(const QModelIndex ¤t); + +private: + void addRow(bool firstLine, QStandardItemModel *model, + const QList<QStandardItem *> &items); + + QString mimeType; +}; +//! [definition] + +#endif diff --git a/examples/webkit/webplugin/main.cpp b/examples/webkit/webplugin/main.cpp new file mode 100644 index 0000000..fd2b233 --- /dev/null +++ b/examples/webkit/webplugin/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + MainWindow window; + window.show(); + return app.exec(); +} diff --git a/examples/webkit/webplugin/mainwindow.cpp b/examples/webkit/webplugin/mainwindow.cpp new file mode 100644 index 0000000..188e08f --- /dev/null +++ b/examples/webkit/webplugin/mainwindow.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QFile> +#include <QWebView> +#include "csvfactory.h" +#include "mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ + QWebSettings::globalSettings()->setAttribute( + QWebSettings::PluginsEnabled, true); + + QWebView *webView = new QWebView; + CSVFactory *factory = new CSVFactory(webView, this); + webView->page()->setPluginFactory(factory); + webView->setUrl(QUrl("qrc:/pages/index.html")); + + setCentralWidget(webView); + setWindowTitle(tr("Web Plugin Example")); +} diff --git a/examples/webkit/webplugin/mainwindow.h b/examples/webkit/webplugin/mainwindow.h new file mode 100644 index 0000000..12c8306 --- /dev/null +++ b/examples/webkit/webplugin/mainwindow.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = 0); +}; + +#endif diff --git a/examples/widgets/analogclock/analogclock.desktop b/examples/widgets/analogclock/analogclock.desktop new file mode 100644 index 0000000..b177a62 --- /dev/null +++ b/examples/widgets/analogclock/analogclock.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Analog Clock +Exec=/opt/usr/bin/analogclock +Icon=analogclock +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/applicationicon/applicationicon.desktop b/examples/widgets/applicationicon/applicationicon.desktop new file mode 100644 index 0000000..9645802 --- /dev/null +++ b/examples/widgets/applicationicon/applicationicon.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Application Icon +Exec=/opt/usr/bin/applicationicon +Icon=applicationicon +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/applicationicon/applicationicon.png b/examples/widgets/applicationicon/applicationicon.png Binary files differnew file mode 100644 index 0000000..83a186e --- /dev/null +++ b/examples/widgets/applicationicon/applicationicon.png diff --git a/examples/widgets/applicationicon/applicationicon.pro b/examples/widgets/applicationicon/applicationicon.pro new file mode 100644 index 0000000..f9ab55d --- /dev/null +++ b/examples/widgets/applicationicon/applicationicon.pro @@ -0,0 +1,30 @@ + +QT += core gui + +TARGET = applicationicon +TEMPLATE = app + +SOURCES += main.cpp + +OTHER_FILES += applicationicon.svg \ + applicationicon.png \ + applicationicon.desktop + +symbian { + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) + # override icon + ICON = applicationicon.svg + TARGET.UID3 = 0xe9f919ee + TARGET.EPOCSTACKSIZE = 0x14000 + TARGET.EPOCHEAPSIZE = 0x020000 0x800000 +} + +maemo5 { + include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + + # override icon from maemo5pkgrules.pri + icon.files = $${TARGET}.png +} +symbian: warning(This example might not fully work on Symbian platform) +maemo5: warning(This example might not fully work on Maemo platform) +simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/calculator/calculator.desktop b/examples/widgets/calculator/calculator.desktop new file mode 100644 index 0000000..d0ae81d --- /dev/null +++ b/examples/widgets/calculator/calculator.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Calculator +Exec=/opt/usr/bin/calculator +Icon=calculator +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/calculator/releasenotes.txt b/examples/widgets/calculator/releasenotes.txt new file mode 100644 index 0000000..053f651 --- /dev/null +++ b/examples/widgets/calculator/releasenotes.txt @@ -0,0 +1,4 @@ +Calculator +============= + +Compared to the original example in the Qt SDK, the Calculator class (calculator.h) has been derived from QWidget instead of QDialog because in Maemo you cannot have any additional controls with dialogs. The mainLayout size constraint has been changed to SetNoConstraint to enable immediate scaling of the grid in Symbian. Screen definition for Symbian has been changed to showMaximized() to enable correct scaling of the application (see main.cpp).
\ No newline at end of file diff --git a/examples/widgets/calendarwidget/calendarwidget.desktop b/examples/widgets/calendarwidget/calendarwidget.desktop new file mode 100644 index 0000000..645dc41 --- /dev/null +++ b/examples/widgets/calendarwidget/calendarwidget.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Calendar Widget +Exec=/opt/usr/bin/calendarwidget +Icon=calendarwidget +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/charactermap/charactermap.desktop b/examples/widgets/charactermap/charactermap.desktop new file mode 100644 index 0000000..7f19194 --- /dev/null +++ b/examples/widgets/charactermap/charactermap.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Character Map +Exec=/opt/usr/bin/charactermap +Icon=charactermap +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/codeeditor/codeeditor.desktop b/examples/widgets/codeeditor/codeeditor.desktop new file mode 100644 index 0000000..9347479 --- /dev/null +++ b/examples/widgets/codeeditor/codeeditor.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Code Editor +Exec=/opt/usr/bin/codeeditor +Icon=codeeditor +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/digitalclock/digitalclock.desktop b/examples/widgets/digitalclock/digitalclock.desktop new file mode 100644 index 0000000..b138768 --- /dev/null +++ b/examples/widgets/digitalclock/digitalclock.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Digital Clock +Exec=/opt/usr/bin/digitalclock +Icon=digitalclock +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/elidedlabel/elidedlabel.desktop b/examples/widgets/elidedlabel/elidedlabel.desktop new file mode 100644 index 0000000..5da3a6c --- /dev/null +++ b/examples/widgets/elidedlabel/elidedlabel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Elided Label +Exec=/opt/usr/bin/elidedlabel +Icon=elidedlabel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/elidedlabel/elidedlabel.pro b/examples/widgets/elidedlabel/elidedlabel.pro new file mode 100644 index 0000000..072cd2f --- /dev/null +++ b/examples/widgets/elidedlabel/elidedlabel.pro @@ -0,0 +1,31 @@ +# Nokia Qt Examples: elided label example + +QT += core gui + +TARGET = elidedlabel +TEMPLATE = app + +SOURCES += \ + main.cpp\ + testwidget.cpp \ + elidedlabel.cpp + +HEADERS += \ + testwidget.h \ + elidedlabel.h + +CONFIG += mobility +MOBILITY = + +symbian { + TARGET.UID3 = 0xE2728354 # randomly generated + TARGET.EPOCSTACKSIZE = 0x14000 + TARGET.EPOCHEAPSIZE = 0x020000 0x800000 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} + +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + +symbian: warning(This example might not fully work on Symbian platform) +maemo5: warning(This example might not fully work on Maemo platform) +simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/groupbox/groupbox.desktop b/examples/widgets/groupbox/groupbox.desktop new file mode 100644 index 0000000..8239bbf --- /dev/null +++ b/examples/widgets/groupbox/groupbox.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Group Box +Exec=/opt/usr/bin/groupbox +Icon=groupbox +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/icons/icons.desktop b/examples/widgets/icons/icons.desktop new file mode 100644 index 0000000..df90cc5 --- /dev/null +++ b/examples/widgets/icons/icons.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Icons +Exec=/opt/usr/bin/icons +Icon=icons +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/imageviewer/imageviewer.desktop b/examples/widgets/imageviewer/imageviewer.desktop new file mode 100644 index 0000000..63f2408 --- /dev/null +++ b/examples/widgets/imageviewer/imageviewer.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Image Viewer +Exec=/opt/usr/bin/imageviewer +Icon=imageviewer +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/lineedits/lineedits.desktop b/examples/widgets/lineedits/lineedits.desktop new file mode 100644 index 0000000..7d8dea3 --- /dev/null +++ b/examples/widgets/lineedits/lineedits.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Line Edits +Exec=/opt/usr/bin/lineedits +Icon=lineedits +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/maemovibration/buttonwidget.cpp b/examples/widgets/maemovibration/buttonwidget.cpp new file mode 100644 index 0000000..a723c31 --- /dev/null +++ b/examples/widgets/maemovibration/buttonwidget.cpp @@ -0,0 +1,26 @@ +#include "buttonwidget.h" +#include <QSignalMapper> +#include <QGridLayout> +#include <QPushButton> + +//! [0] +ButtonWidget::ButtonWidget(QStringList texts, QWidget *parent) + : QWidget(parent) +{ + signalMapper = new QSignalMapper(this); + + QGridLayout *gridLayout = new QGridLayout; + for (int i = 0; i < texts.size(); ++i) { + QPushButton *button = new QPushButton(texts[i]); + connect(button, SIGNAL(clicked()), signalMapper, SLOT(map())); + signalMapper->setMapping(button, texts[i]); + gridLayout->addWidget(button, i / 2, i % 2); + } + + connect(signalMapper, SIGNAL(mapped(const QString &)), + this, SIGNAL(clicked(const QString &))); + + setLayout(gridLayout); +} +//! [0] + diff --git a/examples/widgets/maemovibration/buttonwidget.h b/examples/widgets/maemovibration/buttonwidget.h new file mode 100644 index 0000000..6635c67 --- /dev/null +++ b/examples/widgets/maemovibration/buttonwidget.h @@ -0,0 +1,24 @@ +#ifndef BUTTONWIDGET_H +#define BUTTONWIDGET_H + +#include <QWidget> +#include <QSignalMapper> + +//! [0] +class ButtonWidget : public QWidget +{ + Q_OBJECT + +public: + ButtonWidget(QStringList texts, QWidget *parent = 0); + +signals: + void clicked(const QString &text); + +private: + QSignalMapper *signalMapper; +}; +//! [0] + +#endif // BUTTONWIDGET_H + diff --git a/examples/widgets/maemovibration/data/48x48/maemovibration.png b/examples/widgets/maemovibration/data/48x48/maemovibration.png Binary files differnew file mode 100644 index 0000000..f32e9ce --- /dev/null +++ b/examples/widgets/maemovibration/data/48x48/maemovibration.png diff --git a/examples/widgets/maemovibration/data/64x64/maemovibration.png b/examples/widgets/maemovibration/data/64x64/maemovibration.png Binary files differnew file mode 100644 index 0000000..f09cf7c --- /dev/null +++ b/examples/widgets/maemovibration/data/64x64/maemovibration.png diff --git a/examples/widgets/maemovibration/data/maemovibration.desktop b/examples/widgets/maemovibration/data/maemovibration.desktop new file mode 100644 index 0000000..a88ed4e --- /dev/null +++ b/examples/widgets/maemovibration/data/maemovibration.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Name=Maemo Vibration +Exec=/usr/bin/maemovibration +Icon=maemovibration +X-HildonDesk-ShowInToolbar=true +X-Window-Icon=maemovibration +X-Window-Icon-Dimmed=maemovibration +X-Osso-Type=application/x-executable +X-Osso-Service=com.nokia.maemovibration diff --git a/examples/widgets/maemovibration/data/maemovibration.service b/examples/widgets/maemovibration/data/maemovibration.service new file mode 100644 index 0000000..1fab19f --- /dev/null +++ b/examples/widgets/maemovibration/data/maemovibration.service @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=com.nokia.maemovibration +Exec=/usr/bin/maemovibration diff --git a/examples/widgets/maemovibration/maemovibration.pro b/examples/widgets/maemovibration/maemovibration.pro new file mode 100644 index 0000000..5c645dd --- /dev/null +++ b/examples/widgets/maemovibration/maemovibration.pro @@ -0,0 +1,52 @@ +TARGET = maemovibration +HEADERS += buttonwidget.h mcevibrator.h +SOURCES += main.cpp buttonwidget.cpp mcevibrator.cpp + +# All generated files goes same directory +OBJECTS_DIR = build +MOC_DIR = build +UI_DIR = build +DESTDIR = build + +TEMPLATE = app +CONFIG += debug +QT=core gui + +maemo5 { + QT += dbus + CONFIG += link_pkgconfig + PKG_CONFIG += mce + INSTALLS += target + target.path = /usr/bin/ + + INSTALLS += desktop + desktop.path = /usr/share/applications/hildon + desktop.files = data/maemovibration.desktop + + INSTALLS += service + service.path = /usr/share/dbus-1/services + service.files = data/maemovibration.service + + INSTALLS += icon64 + icon64.path = /usr/share/icons/hicolor/64x64/apps + icon64.files = data/64x64/maemovibration.png + + # + # Targets for debian source and binary package creation + # + debian-src.commands = dpkg-buildpackage -S -r -us -uc -d + debian-bin.commands = dpkg-buildpackage -b -r -uc -d + debian-all.depends = debian-src debian-bin + + # + # Clean all but Makefile + # + compiler_clean.commands = -$(DEL_FILE) $(TARGET) + + QMAKE_EXTRA_TARGETS += debian-all debian-src debian-bin compiler_clean +} + +!maemo5 { + error(The Maemo Vibration Example only works for the maemo target!) +} + diff --git a/examples/widgets/maemovibration/main.cpp b/examples/widgets/maemovibration/main.cpp new file mode 100644 index 0000000..f81529b --- /dev/null +++ b/examples/widgets/maemovibration/main.cpp @@ -0,0 +1,44 @@ + +#include "buttonwidget.h" +#include "mcevibrator.h" + +#include <QtDebug> +#include <QApplication> +#include <QFile> +#include <QTextStream> +#include <QMessageBox> +#include <QTextStream> + +#include <cstdlib> + +//! [0] +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QString path = MceVibrator::defaultMceFilePath; + + QFile file(path); + QStringList names; + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream stream(&file); + names = MceVibrator::parsePatternNames(stream); + file.close(); + } + + if (names.isEmpty()){ + qDebug() << "Could not read vibration pattern names from " << path; + a.exit(-1); + } +//! [0] + +//! [1] + ButtonWidget buttonWidget(names); + MceVibrator vibrator; + QObject::connect(&buttonWidget, SIGNAL(clicked(const QString &)), + &vibrator, SLOT(vibrate(const QString &))); + buttonWidget.show(); + + return a.exec(); +} +//! [1] + diff --git a/examples/widgets/maemovibration/mcevibrator.cpp b/examples/widgets/maemovibration/mcevibrator.cpp new file mode 100644 index 0000000..be6415f --- /dev/null +++ b/examples/widgets/maemovibration/mcevibrator.cpp @@ -0,0 +1,79 @@ + +#include "mcevibrator.h" + +#include <QStringList> +#include <QDebug> +#include <QDBusConnection> +#include <QDBusMessage> + +#include <mce/dbus-names.h> + +const char MceVibrator::defaultMceFilePath[] = "/etc/mce/mce.ini"; + +//! [5] +static void checkError(QDBusMessage &msg) +{ + if (msg.type() == QDBusMessage::ErrorMessage) + qDebug() << msg.errorName() << msg.errorMessage(); +} +//! [5] + +//! [0] +MceVibrator::MceVibrator(QObject *parent) : + QObject(parent), + mceInterface(MCE_SERVICE, MCE_REQUEST_PATH, MCE_REQUEST_IF, + QDBusConnection::systemBus()) +{ + QDBusMessage reply = mceInterface.call(MCE_ENABLE_VIBRATOR); + checkError(reply); +} +//! [0] + +//! [3] +MceVibrator::~MceVibrator() +{ + deactivate(lastPatternName); + QDBusMessage reply = mceInterface.call(MCE_DISABLE_VIBRATOR); + checkError(reply); +} +//! [3] + +//! [1] +void MceVibrator::vibrate(const QString &patternName) +{ + deactivate(lastPatternName); + lastPatternName = patternName; + QDBusMessage reply = mceInterface.call(MCE_ACTIVATE_VIBRATOR_PATTERN, patternName); + checkError(reply); +} +//! [1] + +//! [2] +void MceVibrator::deactivate(const QString &patternName) +{ + if (!patternName.isNull()) { + QDBusMessage reply = mceInterface.call(MCE_DEACTIVATE_VIBRATOR_PATTERN, patternName); + checkError(reply); + } +} +//! [2] + +//! [4] +QStringList MceVibrator::parsePatternNames(QTextStream &stream) +{ + QStringList result; + QString line; + + do { + line = stream.readLine(); + if (line.startsWith(QLatin1String("VibratorPatterns="))) { + QString values = line.section('=', 1); + result = values.split(';'); + break; + } + } while (!line.isNull()); + + return result; +} +//! [4] + diff --git a/examples/widgets/maemovibration/mcevibrator.h b/examples/widgets/maemovibration/mcevibrator.h new file mode 100644 index 0000000..5aac87d --- /dev/null +++ b/examples/widgets/maemovibration/mcevibrator.h @@ -0,0 +1,31 @@ +#ifndef MCEVIBRATOR_H +#define MCEVIBRATOR_H + +#include <QObject> +#include <QTextStream> +#include <QDBusInterface> + +//! [0] +class MceVibrator : public QObject +{ + Q_OBJECT +public: + explicit MceVibrator(QObject *parent = 0); + ~MceVibrator(); + + static const char defaultMceFilePath[]; + static QStringList parsePatternNames(QTextStream &stream); + +public slots: + void vibrate(const QString &patternName); + +private: + void deactivate(const QString &patternName); + + QDBusInterface mceInterface; + QString lastPatternName; +}; +//! [0] + +#endif // MCEVIBRATOR_H + diff --git a/examples/widgets/movie/movie.desktop b/examples/widgets/movie/movie.desktop new file mode 100644 index 0000000..5c7ae21 --- /dev/null +++ b/examples/widgets/movie/movie.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Movie +Exec=/opt/usr/bin/movie +Icon=movie +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/orientation/image_a.png b/examples/widgets/orientation/image_a.png Binary files differnew file mode 100644 index 0000000..4a1a0d3 --- /dev/null +++ b/examples/widgets/orientation/image_a.png diff --git a/examples/widgets/orientation/image_b.png b/examples/widgets/orientation/image_b.png Binary files differnew file mode 100644 index 0000000..8722d1e --- /dev/null +++ b/examples/widgets/orientation/image_b.png diff --git a/examples/widgets/orientation/image_c.png b/examples/widgets/orientation/image_c.png Binary files differnew file mode 100644 index 0000000..6c9304f --- /dev/null +++ b/examples/widgets/orientation/image_c.png diff --git a/examples/widgets/orientation/images.qrc b/examples/widgets/orientation/images.qrc new file mode 100644 index 0000000..b258291 --- /dev/null +++ b/examples/widgets/orientation/images.qrc @@ -0,0 +1,7 @@ +<RCC> + <qresource prefix="/"> + <file>image_a.png</file> + <file>image_b.png</file> + <file>image_c.png</file> + </qresource> +</RCC> diff --git a/examples/widgets/orientation/landscape.ui b/examples/widgets/orientation/landscape.ui new file mode 100644 index 0000000..4616c04 --- /dev/null +++ b/examples/widgets/orientation/landscape.ui @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>LandscapeUI</class> + <widget class="QWidget" name="LandscapeUI"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>514</width> + <height>265</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">font-weight: bold;</string> + </property> + <property name="text"> + <string>Landscape mode</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QPushButton" name="exitButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Exit</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QGroupBox" name="groupBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Choices</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QRadioButton" name="radioAButton"> + <property name="text"> + <string>Long description explaining choice A</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <attribute name="buttonGroup"> + <string>buttonGroup</string> + </attribute> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioBButton"> + <property name="text"> + <string>Long description explaining choice B</string> + </property> + <attribute name="buttonGroup"> + <string>buttonGroup</string> + </attribute> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioCButton"> + <property name="text"> + <string>Long description explaining choice C</string> + </property> + <attribute name="buttonGroup"> + <string>buttonGroup</string> + </attribute> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="0" colspan="2"> + <widget class="QWidget" name="choiceWidget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> + <buttongroups> + <buttongroup name="buttonGroup"/> + </buttongroups> +</ui> diff --git a/examples/widgets/orientation/main.cpp b/examples/widgets/orientation/main.cpp new file mode 100644 index 0000000..34b05d6 --- /dev/null +++ b/examples/widgets/orientation/main.cpp @@ -0,0 +1,15 @@ +#include <QtGui/QApplication> +#include "mainwindow.h" + +//! [0] +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + + MainWindow w; + w.showFullScreen(); + + return a.exec(); +} +//! [0] + diff --git a/examples/widgets/orientation/mainwindow.cpp b/examples/widgets/orientation/mainwindow.cpp new file mode 100644 index 0000000..328af44 --- /dev/null +++ b/examples/widgets/orientation/mainwindow.cpp @@ -0,0 +1,75 @@ +#include "mainwindow.h" +#include "ui_landscape.h" +#include "ui_portrait.h" + +#include <QDesktopWidget> +#include <QResizeEvent> + +//! [0] +MainWindow::MainWindow(QWidget *parent) : + QWidget(parent), + landscapeWidget(0), + portraitWidget(0) +{ + landscapeWidget = new QWidget(this); + landscape.setupUi(landscapeWidget); + + portraitWidget = new QWidget(this); + portrait.setupUi(portraitWidget); +//! [0] + +//! [1] + connect(portrait.exitButton, SIGNAL(clicked()), this, SLOT(close())); + connect(landscape.exitButton, SIGNAL(clicked()), this, SLOT(close())); + connect(landscape.buttonGroup, SIGNAL(buttonClicked(QAbstractButton*)), + this, SLOT(onRadioButtonClicked(QAbstractButton*))); + + landscape.radioAButton->setChecked(true); + onRadioButtonClicked(landscape.radioAButton); +//! [1] + +//! [2] +#ifdef Q_WS_MAEMO_5 + setAttribute(Qt::WA_Maemo5AutoOrientation, true); +#endif +} +//! [2] + +//! [3] +void MainWindow::resizeEvent(QResizeEvent *event) +{ + QSize size = event->size(); + bool isLandscape = size.width() > size.height(); + + if (!isLandscape) + size.transpose(); + + landscapeWidget->setFixedSize(size); + size.transpose(); + portraitWidget->setFixedSize(size); + + landscapeWidget->setVisible(isLandscape); + portraitWidget->setVisible(!isLandscape); +} +//! [3] + +//! [4] +void MainWindow::onRadioButtonClicked(QAbstractButton *button) +{ + QString styleTemplate = "background-image: url(:/image_%1.png);" + "background-repeat: no-repeat;" + "background-position: center center"; + + QString imageStyle(""); + if (button == landscape.radioAButton) + imageStyle = styleTemplate.arg("a"); + else if (button == landscape.radioBButton) + imageStyle = styleTemplate.arg("b"); + else if (button == landscape.radioCButton) + imageStyle = styleTemplate.arg("c"); + + portrait.choiceWidget->setStyleSheet(imageStyle); + landscape.choiceWidget->setStyleSheet(imageStyle); +} +//! [4] + diff --git a/examples/widgets/orientation/mainwindow.h b/examples/widgets/orientation/mainwindow.h new file mode 100644 index 0000000..7c2546d --- /dev/null +++ b/examples/widgets/orientation/mainwindow.h @@ -0,0 +1,33 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QWidget> + +#include "ui_landscape.h" +#include "ui_portrait.h" + +class QAbstractButton; + +//! [0] +class MainWindow : public QWidget +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = 0); + +protected: + void resizeEvent(QResizeEvent *event); + +private slots: + void onRadioButtonClicked(QAbstractButton *button); + +private: + Ui::LandscapeUI landscape; + Ui::PortraitUI portrait; + QWidget *landscapeWidget; + QWidget *portraitWidget; +}; +//! [0] + +#endif // MAINWINDOW_H diff --git a/examples/widgets/orientation/orientation.desktop b/examples/widgets/orientation/orientation.desktop new file mode 100644 index 0000000..7bbf558 --- /dev/null +++ b/examples/widgets/orientation/orientation.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Orientation +Exec=/opt/usr/bin/orientation +Icon=orientation +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/orientation/orientation.pro b/examples/widgets/orientation/orientation.pro new file mode 100644 index 0000000..c146322 --- /dev/null +++ b/examples/widgets/orientation/orientation.pro @@ -0,0 +1,30 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2010-08-04T10:27:31 +# +#------------------------------------------------- + +QT += core gui + +TARGET = orientation +TEMPLATE = app + + +SOURCES += main.cpp\ + mainwindow.cpp + +HEADERS += mainwindow.h + +FORMS += \ + portrait.ui \ + landscape.ui + +RESOURCES += \ + images.qrc + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) + +symbian: warning(This example might not fully work on Symbian platform) +maemo5: warning(This example might not fully work on Maemo platform) +simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/orientation/portrait.ui b/examples/widgets/orientation/portrait.ui new file mode 100644 index 0000000..31a55af --- /dev/null +++ b/examples/widgets/orientation/portrait.ui @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PortraitUI</class> + <widget class="QWidget" name="PortraitUI"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>201</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="styleSheet"> + <string notr="true">font-weight: bold;</string> + </property> + <property name="text"> + <string>Portrait mode</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QPushButton" name="exitButton"> + <property name="text"> + <string>Exit</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="helpLabel"> + <property name="text"> + <string>Switch to landscape mode. In landscape mode you can change visible image.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QWidget" name="choiceWidget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/examples/widgets/scribble/scribble.desktop b/examples/widgets/scribble/scribble.desktop new file mode 100644 index 0000000..9c1ee0c --- /dev/null +++ b/examples/widgets/scribble/scribble.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Scribble +Exec=/opt/usr/bin/scribble +Icon=scribble +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/shapedclock/shapedclock.desktop b/examples/widgets/shapedclock/shapedclock.desktop new file mode 100644 index 0000000..bae58e3 --- /dev/null +++ b/examples/widgets/shapedclock/shapedclock.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Shaped Clock +Exec=/opt/usr/bin/shapedclock +Icon=shapedclock +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/sliders/sliders.desktop b/examples/widgets/sliders/sliders.desktop new file mode 100644 index 0000000..bc89043 --- /dev/null +++ b/examples/widgets/sliders/sliders.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Sliders +Exec=/opt/usr/bin/sliders +Icon=sliders +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/softkeys/softkeys.desktop b/examples/widgets/softkeys/softkeys.desktop new file mode 100644 index 0000000..7f4993a --- /dev/null +++ b/examples/widgets/softkeys/softkeys.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Soft Keys +Exec=/opt/usr/bin/softkeys +Icon=softkeys +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/spinboxes/spinboxes.desktop b/examples/widgets/spinboxes/spinboxes.desktop new file mode 100644 index 0000000..7de3038 --- /dev/null +++ b/examples/widgets/spinboxes/spinboxes.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Spin Boxes +Exec=/opt/usr/bin/spinboxes +Icon=spinboxes +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/styles/styles.desktop b/examples/widgets/styles/styles.desktop new file mode 100644 index 0000000..fb9ef42 --- /dev/null +++ b/examples/widgets/styles/styles.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Styles +Exec=/opt/usr/bin/styles +Icon=styles +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/stylesheet/stylesheet.desktop b/examples/widgets/stylesheet/stylesheet.desktop new file mode 100644 index 0000000..0550b19 --- /dev/null +++ b/examples/widgets/stylesheet/stylesheet.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Style Sheet +Exec=/opt/usr/bin/stylesheet +Icon=stylesheet +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/symbianvibration/main.cpp b/examples/widgets/symbianvibration/main.cpp new file mode 100644 index 0000000..015ed54 --- /dev/null +++ b/examples/widgets/symbianvibration/main.cpp @@ -0,0 +1,14 @@ +#include <QtGui/QApplication> +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; +#if defined(Q_WS_S60) + w.showMaximized(); +#else + w.show(); +#endif + return a.exec(); +} diff --git a/examples/widgets/symbianvibration/mainwindow.cpp b/examples/widgets/symbianvibration/mainwindow.cpp new file mode 100644 index 0000000..67cf220 --- /dev/null +++ b/examples/widgets/symbianvibration/mainwindow.cpp @@ -0,0 +1,23 @@ +#include <QtGui/QMenuBar> +#include "mainwindow.h" +#include "vibrationsurface.h" +#include "XQVibra.h" + +//! [0] +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ + vibra = new XQVibra(this); + setCentralWidget(new VibrationSurface(vibra, this)); + menuBar()->addAction(tr("Vibrate"), this, SLOT(vibrate())); +} +//! [0] + +//! [1] +void MainWindow::vibrate() +{ + vibra->setIntensity(75); + vibra->start(2500); +} +//! [1] + diff --git a/examples/widgets/symbianvibration/mainwindow.h b/examples/widgets/symbianvibration/mainwindow.h new file mode 100644 index 0000000..cc77f7b --- /dev/null +++ b/examples/widgets/symbianvibration/mainwindow.h @@ -0,0 +1,23 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QtGui/QMainWindow> +class XQVibra; + +//! [0] +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = 0); + +private slots: + void vibrate(); + +private: + XQVibra *vibra; +}; +//! [0] + +#endif // MAINWINDOW_H diff --git a/examples/widgets/symbianvibration/symbianvibration.pro b/examples/widgets/symbianvibration/symbianvibration.pro new file mode 100644 index 0000000..d99b76d --- /dev/null +++ b/examples/widgets/symbianvibration/symbianvibration.pro @@ -0,0 +1,39 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2010-06-14T10:09:27 +# +#------------------------------------------------- + +QT += core gui + +TARGET = symbianvibration +TEMPLATE = app + + +SOURCES += main.cpp\ + mainwindow.cpp \ + vibrationsurface.cpp \ + xqvibra.cpp \ + xqvibra_p.cpp + +HEADERS += mainwindow.h \ + vibrationsurface.h \ + xqvibra.h \ + xqvibra_p.h + +CONFIG += mobility +MOBILITY = + +symbian { + TARGET.UID3 = 0xecf47018 + # TARGET.CAPABILITY += + TARGET.EPOCSTACKSIZE = 0x14000 + TARGET.EPOCHEAPSIZE = 0x020000 0x800000 + LIBS += -lhwrmvibraclient + include($$PWD/../../symbianpkgrules.pri) +} + +!symbian { + error(The Symbian Vibration Example only works for the Symbian target!) +} + diff --git a/examples/widgets/symbianvibration/vibrationsurface.cpp b/examples/widgets/symbianvibration/vibrationsurface.cpp new file mode 100644 index 0000000..5e2e962 --- /dev/null +++ b/examples/widgets/symbianvibration/vibrationsurface.cpp @@ -0,0 +1,117 @@ +#include "vibrationsurface.h" +#include <QtGui/QPainter> +#include <QtCore/QLine> +#include <QtGui/QMouseEvent> +#include <QtGui/QScreen> +#include <QtCore/QRect> +#include <QtGui/QColor> + +#include "xqvibra.h" + +//! [4] +const int NumberOfLevels = 10; +const double IntensityFactor = XQVibra::MaxIntensity / NumberOfLevels; +//! [4] + +VibrationSurface::VibrationSurface(XQVibra *vibra, QWidget *parent) : + QWidget(parent), + vibra(vibra), + lastIntensity(0) +{ +} + +//! [0] +void VibrationSurface::mousePressEvent(QMouseEvent *event) +{ + applyIntensity(event->x(), event->y()); + vibra->start(); +} +//! [0] + +//! [1] +void VibrationSurface::mouseMoveEvent(QMouseEvent *event) +{ + applyIntensity(event->x(), event->y()); +} +//! [1] + +//! [2] +void VibrationSurface::mouseReleaseEvent(QMouseEvent *) +{ + vibra->stop(); +} +//! [2] + +//! [5] +void VibrationSurface::paintEvent(QPaintEvent *) +{ + QPainter painter(this); + QRect rect = geometry(); + int dx = 0, dy = 0; + + if (height() > width()) { + dy = height() / NumberOfLevels; + rect.setHeight(dy); + } else { + dx = width() / NumberOfLevels; + rect.setWidth(dx); + } +//! [5] +//! [6] + for (int i = 0; i < NumberOfLevels; i++) { + int x = i * dx; + int y = i * dy; + int intensity = getIntensity(x, y); + QColor color = QColor(40, 80, 10).lighter(100 + intensity); + + rect.moveTo(x, y); + painter.fillRect(rect, color); + painter.setPen(color.darker()); + painter.drawText(rect, Qt::AlignCenter, QString::number(intensity)); + } +} +//! [6] + +//! [7] +int VibrationSurface::getIntensity(int x, int y) +{ + int level; + int coord; + + if (height() > width()) { + level = height() / NumberOfLevels; + coord = y; + } else { + level = width() / NumberOfLevels; + coord = x; + } + + if (level == 0) { + return 0; + } +//! [7] +//! [8] + int intensity = (coord / level + 1) * IntensityFactor; + + if (intensity < 0) { + intensity = 0; + } else if (intensity > XQVibra::MaxIntensity) { + intensity = XQVibra::MaxIntensity; + } + + return intensity; +} +//! [8] + +//! [3] +void VibrationSurface::applyIntensity(int x, int y) +{ + int intensity = getIntensity(x, y); + + if (intensity != lastIntensity) { + vibra->setIntensity(intensity); + lastIntensity = intensity; + } +} +//! [3] + diff --git a/examples/widgets/symbianvibration/vibrationsurface.h b/examples/widgets/symbianvibration/vibrationsurface.h new file mode 100644 index 0000000..eee6291 --- /dev/null +++ b/examples/widgets/symbianvibration/vibrationsurface.h @@ -0,0 +1,31 @@ +#ifndef TOUCHAREA_H +#define TOUCHAREA_H + +#include <QWidget> + +class XQVibra; + +//! [0] +class VibrationSurface : public QWidget +{ + Q_OBJECT +public: + explicit VibrationSurface(XQVibra *vibra, QWidget *parent = 0); + +protected: + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void paintEvent(QPaintEvent *); + +private: + + int getIntensity(int x, int y); + void applyIntensity(int x, int y); + + XQVibra *vibra; + int lastIntensity; +}; +//! [0] + +#endif // TOUCHAREA_H diff --git a/examples/widgets/symbianvibration/xqvibra.cpp b/examples/widgets/symbianvibration/xqvibra.cpp new file mode 100644 index 0000000..1263c3e --- /dev/null +++ b/examples/widgets/symbianvibration/xqvibra.cpp @@ -0,0 +1,170 @@ +#include "xqvibra.h" +#include "xqvibra_p.h" + +/*! + \class XQVibra + + \brief The XQVibra class is used to control the device's vibra. The XQVibra + class provides also information of vibration setting in the user profile. + + Example: + \code + XQVibra *vibra = new XQVibra(this); + QPushButton *startButton = new QPushButton(this); + QPushButton *stopButton = new QPushButton(this); + connect(startButton, SIGNAL(clicked()), vibra, SLOT(start())); + connect(stopButton, SIGNAL(clicked()), vibra, SLOT(stop())); + \endcode +*/ + +/*! \var XQVibra::InfiniteDuration + With this constant vibration can be set to work indefinitely (Note! Depends on the HW) +*/ +/*! \var XQVibra::MaxIntensity + Maximum intensity as percentages +*/ +/*! \var XQVibra::MinIntensity + Minumum intensity as percentages +*/ + +/*! + Constructs a XQVibra object with the given parent. + Call error() to get a value of XQVibra::Error that indicates which error occurred during initialisation if any. + \sa start(), setIntensity(), error() +*/ +XQVibra::XQVibra(QObject *parent) + : QObject(parent), d(new XQVibraPrivate(this)) +{ +} + +/*! + Destroys the XQVibra object. +*/ +XQVibra::~XQVibra() +{ + delete d; +} + +/*! + \enum XQVibra::Error + + This enum defines the possible errors for a XQVibra object. +*/ +/*! \var XQVibra::Error XQVibra::NoError + No error occured. +*/ +/*! \var XQVibra::Error XQVibra::OutOfMemoryError + Not enough memory. +*/ +/*! \var XQVibra::Error XQVibra::ArgumentError + Duration is invalid. +*/ +/*! \var XQVibra::Error XQVibra::VibraInUseError + Vibra is already in used by other client. +*/ +/*! \var XQVibra::Error XQVibra::HardwareError + There is a hardware error. +*/ +/*! \var XQVibra::Error XQVibra::TimeOutError + Timeout occurred in controlling vibra. +*/ +/*! \var XQVibra::Error XQVibra::VibraLockedError + Vibra is locked down because too much continuous use or explicitly blocked by + for example some vibration sensitive accessory. +*/ +/*! \var XQVibra::Error XQVibra::AccessDeniedError + Vibration setting in the user profile is not set. +*/ +/*! \var XQVibra::Error XQVibra::UnknownError + Unknown error. +*/ + +/*! + \enum XQVibra::Status + + This enum defines the possible statuses of the vibration +*/ +/*! \var XQVibra::Status XQVibra::StatusNotAllowed + Vibra is set off in the user profile or status is unknow +*/ +/*! \var XQVibra::Status XQVibra::StatusOff + Vibration is non-active +*/ +/*! \var XQVibra::Status XQVibra::StatusOn + Vibration is active +*/ + +/*! + Starts vibrating. If duration hasn't been set the vibration continues + indefinitely unless stopped with stop() function. Calling the start while vibration + is active the active vibration is interrupted and the new vibration starts immediately. + + \param duration Specifies duration how long vibration should last + \return If false is returned, an error has occurred. Call error() to get a value of + XQVibra::Error that indicates which error occurred + \sa stop(), setIntensity(), error() +*/ +bool XQVibra::start(int duration) +{ + return d->start(duration); +} + +/*! + Interrupts the device vibration immediately. + + \return If false is returned, an error has occurred. Call error() to get a value of + XQVibra::Error that indicates which error occurred + \sa start(), setIntensity(), error() +*/ +bool XQVibra::stop() +{ + return d->stop(); +} + +/*! + Sets the intensity of the vibration. Allowed values for the intensity are + between -100 and 100. 0 means no vibrating. NOTE: The device might have + hardware-imposed limits on supported vibra intensity values, so actual + effect might vary between different hardware. + + \param intensity Intensity of the vibra in decimals + \return If false is returned, an error has occurred. Call error() to get a value of + XQVibra::Error that indicates which error occurred + \sa error() +*/ +bool XQVibra::setIntensity(int intensity) +{ + return d->setIntensity(intensity); +} + +/*! + Returns the current status of the vibration. This function can be used to check has vibration + allowed in the user profile. + + \return current status + \sa statusChanged() +*/ +XQVibra::Status XQVibra::currentStatus() const +{ + return d->currentStatus(); +} + +/*! + Returns the type of error that occurred if the latest function call failed; otherwise returns NoError + \return Error code +*/ +XQVibra::Error XQVibra::error() const +{ + return d->error(); +} + +/*! + \fn void XQVibra::statusChanged(Status status) + + This signal is emitted when the there is a change of the vibration status. + + \param status a vibration status + \sa currentStatus() +*/ + +// End of file diff --git a/examples/widgets/symbianvibration/xqvibra.h b/examples/widgets/symbianvibration/xqvibra.h new file mode 100644 index 0000000..5520d08 --- /dev/null +++ b/examples/widgets/symbianvibration/xqvibra.h @@ -0,0 +1,61 @@ +#ifndef XQVIBRA_H +#define XQVIBRA_H + +// INCLUDES +#include <QObject> + +// FORWARD DECLARATIONS +class XQVibraPrivate; + +// CLASS DECLARATION +//! [0] +class XQVibra : public QObject +{ + Q_OBJECT + +public: + static const int InfiniteDuration = 0; + static const int MaxIntensity = 100; + static const int MinIntensity = -100; + + enum Error { + NoError = 0, + OutOfMemoryError, + ArgumentError, + VibraInUseError, + HardwareError, + TimeOutError, + VibraLockedError, + AccessDeniedError, + UnknownError = -1 + }; + + enum Status { + StatusNotAllowed = 0, + StatusOff, + StatusOn + }; + + XQVibra(QObject *parent = 0); + ~XQVibra(); + + XQVibra::Status currentStatus() const; + XQVibra::Error error() const; + +Q_SIGNALS: + void statusChanged(XQVibra::Status status); + +public Q_SLOTS: + bool start(int duration = InfiniteDuration); + bool stop(); + bool setIntensity(int intensity); + +private: + friend class XQVibraPrivate; + XQVibraPrivate *d; +}; +//! [0] + +#endif // XQVIBRA_H + +// End of file diff --git a/examples/widgets/symbianvibration/xqvibra_p.cpp b/examples/widgets/symbianvibration/xqvibra_p.cpp new file mode 100644 index 0000000..9f2b5f9 --- /dev/null +++ b/examples/widgets/symbianvibration/xqvibra_p.cpp @@ -0,0 +1,131 @@ +#include "xqvibra_p.h" + +const int KDefaultIntensity = 0xFF; + +XQVibraPrivate::XQVibraPrivate(XQVibra *vibra) + : q(vibra), iStatus(XQVibra::StatusOff), iDuration(XQVibra::InfiniteDuration), iIntensity(KDefaultIntensity) + +{ + TRAP(iError, iVibra = CHWRMVibra::NewL();) + QObject::connect(&iTimer, SIGNAL(timeout()), q, SLOT(stop())); +} + +XQVibraPrivate::~XQVibraPrivate() +{ + delete iVibra; +} + +bool XQVibraPrivate::start(int aDuration) +{ + iDuration = aDuration; + TRAP(iError, + if (iIntensity == KDefaultIntensity) { + iVibra->StartVibraL(XQVibra::InfiniteDuration); + } else { + iVibra->StopVibraL(); + iVibra->StartVibraL(XQVibra::InfiniteDuration, iIntensity); + } + + if (aDuration != XQVibra::InfiniteDuration) { + iTimer.start(aDuration); + } else { + iTimer.stop(); + } + + if (iStatus != XQVibra::StatusOn) { + iStatus = XQVibra::StatusOn; + emit q->statusChanged(iStatus); + } + ) + return (iError == KErrNone); +} + +bool XQVibraPrivate::stop() +{ + TRAP(iError, + if (iVibra->VibraStatus() == CHWRMVibra::EVibraStatusOn) { + iVibra->StopVibraL(); + if (iTimer.isActive()) { + iTimer.stop(); + } + } + + iStatus = XQVibra::StatusOff; + emit q->statusChanged(iStatus); + ) + return (iError == KErrNone); +} + +void XQVibraPrivate::VibraModeChanged(CHWRMVibra::TVibraModeState /*aStatus*/) +{ + // Implementation isn't needed here because this information isn't used in the public side of the extension +} + +void XQVibraPrivate::VibraStatusChanged(CHWRMVibra::TVibraStatus aStatus) +{ + if (aStatus == CHWRMVibra::EVibraStatusUnknown || + aStatus == CHWRMVibra::EVibraStatusNotAllowed) { + iStatus = XQVibra::StatusNotAllowed; + emit q->statusChanged(iStatus); + } + + if (iDuration == XQVibra::InfiniteDuration) { + if (iStatus != XQVibra::StatusOff) { + iStatus = XQVibra::StatusOff; + emit q->statusChanged(iStatus); + } + } +} + +bool XQVibraPrivate::setIntensity(int aIntensity) +{ + TRAP(iError, + if (aIntensity >= KHWRMVibraMinIntensity && aIntensity <= KHWRMVibraMaxIntensity) { + iIntensity = aIntensity; + if (iIntensity == 0 && iStatus == XQVibra::StatusOn) { + iVibra->StopVibraL(); + } else if (iStatus == XQVibra::StatusOn) { + iVibra->StopVibraL(); + iVibra->StartVibraL(XQVibra::InfiniteDuration, iIntensity); + } + } else { + User::Leave(KErrArgument); + } + ) + return (iError == KErrNone); +} + +XQVibra::Status XQVibraPrivate::currentStatus() const +{ + if (iVibra->VibraStatus() == CHWRMVibra::EVibraStatusUnknown || + iVibra->VibraStatus() == CHWRMVibra::EVibraStatusNotAllowed) { + return XQVibra::StatusNotAllowed; + } + return iStatus; +} + +XQVibra::Error XQVibraPrivate::error() const +{ + switch (iError) { + case KErrNone: + return XQVibra::NoError; + case KErrNoMemory: + return XQVibra::OutOfMemoryError; + case KErrArgument: + return XQVibra::ArgumentError; + case KErrInUse: + return XQVibra::VibraInUseError; + case KErrGeneral: + return XQVibra::HardwareError; + case KErrTimedOut: + return XQVibra::TimeOutError; + case KErrLocked: + return XQVibra::VibraLockedError; + case KErrAccessDenied: + return XQVibra::AccessDeniedError; + default: + return XQVibra::UnknownError; + } +} + +// End of file diff --git a/examples/widgets/symbianvibration/xqvibra_p.h b/examples/widgets/symbianvibration/xqvibra_p.h new file mode 100644 index 0000000..7b4e9d8 --- /dev/null +++ b/examples/widgets/symbianvibration/xqvibra_p.h @@ -0,0 +1,39 @@ +#ifndef XQVIBRA_P_H +#define XQVIBRA_P_H + +// INCLUDES +#include "xqvibra.h" +#include <HWRMVibra.h> +#include <QTimer> + +// CLASS DECLARATION +class XQVibraPrivate: public CBase, public MHWRMVibraObserver +{ + +public: + XQVibraPrivate(XQVibra *vibra); + ~XQVibraPrivate(); + + bool start(int aDuration = XQVibra::InfiniteDuration); + bool stop(); + bool setIntensity(int aIntensity); + XQVibra::Status currentStatus() const; + XQVibra::Error error() const; + +private: // From MHWRMVibraObserver + void VibraModeChanged(CHWRMVibra::TVibraModeState aStatus); + void VibraStatusChanged(CHWRMVibra::TVibraStatus aStatus); + +private: + XQVibra *q; + XQVibra::Status iStatus; + CHWRMVibra *iVibra; + QTimer iTimer; + int iDuration; + int iIntensity; + int iError; +}; + +#endif /*XQVIBRA_P_H*/ + +// End of file diff --git a/examples/widgets/tablet/tablet.desktop b/examples/widgets/tablet/tablet.desktop new file mode 100644 index 0000000..9b40dc2 --- /dev/null +++ b/examples/widgets/tablet/tablet.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Tablet +Exec=/opt/usr/bin/tablet +Icon=tablet +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/tetrix/tetrix.desktop b/examples/widgets/tetrix/tetrix.desktop new file mode 100644 index 0000000..4d7a3de --- /dev/null +++ b/examples/widgets/tetrix/tetrix.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Tetrix +Exec=/opt/usr/bin/tetrix +Icon=tetrix +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/tooltips/tooltips.desktop b/examples/widgets/tooltips/tooltips.desktop new file mode 100644 index 0000000..7dade26 --- /dev/null +++ b/examples/widgets/tooltips/tooltips.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Tool Tips +Exec=/opt/usr/bin/tooltips +Icon=tooltips +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/validators/validators.desktop b/examples/widgets/validators/validators.desktop new file mode 100644 index 0000000..0731316 --- /dev/null +++ b/examples/widgets/validators/validators.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Validators +Exec=/opt/usr/bin/validators +Icon=validators +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/wiggly/wiggly.desktop b/examples/widgets/wiggly/wiggly.desktop new file mode 100644 index 0000000..b83e1ab --- /dev/null +++ b/examples/widgets/wiggly/wiggly.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Wiggly +Exec=/opt/usr/bin/wiggly +Icon=wiggly +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/windowflags/windowflags.desktop b/examples/widgets/windowflags/windowflags.desktop new file mode 100644 index 0000000..27fd7bd --- /dev/null +++ b/examples/widgets/windowflags/windowflags.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Window Flags +Exec=/opt/usr/bin/windowflags +Icon=windowflags +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/xml/dombookmarks/dombookmarks.desktop b/examples/xml/dombookmarks/dombookmarks.desktop new file mode 100644 index 0000000..dfaa8a6 --- /dev/null +++ b/examples/xml/dombookmarks/dombookmarks.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=DOM Bookmarks +Exec=/opt/usr/bin/dombookmarks +Icon=dombookmarks +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/xml/htmlinfo/htmlinfo.desktop b/examples/xml/htmlinfo/htmlinfo.desktop new file mode 100644 index 0000000..901a285 --- /dev/null +++ b/examples/xml/htmlinfo/htmlinfo.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=XML HTML Info +Exec=/opt/usr/bin/htmlinfo +Icon=htmlinfo +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/xml/rsslisting/rsslisting.desktop b/examples/xml/rsslisting/rsslisting.desktop new file mode 100644 index 0000000..e45fe4a --- /dev/null +++ b/examples/xml/rsslisting/rsslisting.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=RSS-Listing +Exec=/opt/usr/bin/rsslisting +Icon=rsslisting +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/xml/saxbookmarks/saxbookmarks.desktop b/examples/xml/saxbookmarks/saxbookmarks.desktop new file mode 100644 index 0000000..5f983d2 --- /dev/null +++ b/examples/xml/saxbookmarks/saxbookmarks.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=SAX Bookmarks +Exec=/opt/usr/bin/saxbookmarks +Icon=saxbookmarks +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/xml/streambookmarks/streambookmarks.desktop b/examples/xml/streambookmarks/streambookmarks.desktop new file mode 100644 index 0000000..29961a9 --- /dev/null +++ b/examples/xml/streambookmarks/streambookmarks.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=QXmlStream Bookmarks +Exec=/opt/usr/bin/streambookmarks +Icon=streambookmarks +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/xml/xmlstreamlint/xmlstreamlint.desktop b/examples/xml/xmlstreamlint/xmlstreamlint.desktop new file mode 100644 index 0000000..6f85e36 --- /dev/null +++ b/examples/xml/xmlstreamlint/xmlstreamlint.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=XML Stream Lint +Exec=/opt/usr/bin/xmlstreamlint +Icon=xmlstreamlint +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/xmlpatterns/filetree/filetree.desktop b/examples/xmlpatterns/filetree/filetree.desktop new file mode 100644 index 0000000..b11e0de --- /dev/null +++ b/examples/xmlpatterns/filetree/filetree.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=File System +Exec=/opt/usr/bin/filetree +Icon=filetree +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.desktop b/examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.desktop new file mode 100644 index 0000000..94e617f --- /dev/null +++ b/examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=QObject XML Model +Exec=/opt/usr/bin/qobjectxmlmodel +Icon=qobjectxmlmodel +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/xmlpatterns/recipes/forms/querywidget_mobiles.ui b/examples/xmlpatterns/recipes/forms/querywidget_mobiles.ui new file mode 100644 index 0000000..bdb0817 --- /dev/null +++ b/examples/xmlpatterns/recipes/forms/querywidget_mobiles.ui @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>QueryWidget</class> + <widget class="QMainWindow" name="QueryWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>453</width> + <height>583</height> + </rect> + </property> + <property name="windowTitle"> + <string>Recipes XQuery Example</string> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> + </property> + <property name="tabsClosable"> + <bool>false</bool> + </property> + <widget class="QWidget" name="tab_1"> + <attribute name="title"> + <string>Input Document</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QTextBrowser" name="inputTextEdit"> + <property name="textInteractionFlags"> + <set>Qt::NoTextInteraction</set> + </property> + <property name="openLinks"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Query selection</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QComboBox" name="defaultQueries"/> + </item> + <item> + <widget class="QTextBrowser" name="queryTextEdit"> + <property name="textInteractionFlags"> + <set>Qt::NoTextInteraction</set> + </property> + <property name="openLinks"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>Ouput Document</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QTextBrowser" name="outputTextEdit"> + <property name="textInteractionFlags"> + <set>Qt::NoTextInteraction</set> + </property> + <property name="openLinks"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/examples/xmlpatterns/recipes/recipes.desktop b/examples/xmlpatterns/recipes/recipes.desktop new file mode 100644 index 0000000..db90972 --- /dev/null +++ b/examples/xmlpatterns/recipes/recipes.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Recipes +Exec=/opt/usr/bin/recipes +Icon=recipes +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/xmlpatterns/schema/schema.desktop b/examples/xmlpatterns/schema/schema.desktop new file mode 100644 index 0000000..06d98e0 --- /dev/null +++ b/examples/xmlpatterns/schema/schema.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=XML Schema Validation +Exec=/opt/usr/bin/schema +Icon=schema +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/xmlpatterns/schema/schema_mobiles.ui b/examples/xmlpatterns/schema/schema_mobiles.ui new file mode 100644 index 0000000..009d0aa --- /dev/null +++ b/examples/xmlpatterns/schema/schema_mobiles.ui @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SchemaMainWindow</class> + <widget class="QMainWindow" name="SchemaMainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>187</width> + <height>179</height> + </rect> + </property> + <property name="windowTitle"> + <string>XML Schema Validation</string> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="sizeConstraint"> + <enum>QLayout::SetNoConstraint</enum> + </property> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>1</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>XML Schema</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QComboBox" name="schemaSelection"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxVisibleItems"> + <number>3</number> + </property> + </widget> + </item> + <item> + <widget class="QTextBrowser" name="schemaView"/> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>XML Instance</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="sizeConstraint"> + <enum>QLayout::SetNoConstraint</enum> + </property> + <item> + <widget class="QComboBox" name="instanceSelection"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxVisibleItems"> + <number>3</number> + </property> + </widget> + </item> + <item> + <widget class="QTextBrowser" name="instanceEdit"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>8</pointsize> + </font> + </property> + <property name="readOnly"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="validationStatus"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Not validated</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="validateButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Validate</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/examples/xmlpatterns/trafficinfo/trafficinfo.desktop b/examples/xmlpatterns/trafficinfo/trafficinfo.desktop new file mode 100644 index 0000000..246d34b --- /dev/null +++ b/examples/xmlpatterns/trafficinfo/trafficinfo.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=TrafficInfo +Exec=/opt/usr/bin/trafficinfo +Icon=trafficinfo +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/xmlpatterns/xquery/globalVariables/globalVariables.desktop b/examples/xmlpatterns/xquery/globalVariables/globalVariables.desktop new file mode 100644 index 0000000..d2f5055 --- /dev/null +++ b/examples/xmlpatterns/xquery/globalVariables/globalVariables.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=C++ Source Code Analyzer +Exec=/opt/usr/bin/globalVariables +Icon=globalVariables +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/src/gui/styles/qs60style_feedbackinterface_p.h b/src/gui/styles/qs60style_feedbackinterface_p.h new file mode 100644 index 0000000..81fcdc3 --- /dev/null +++ b/src/gui/styles/qs60style_feedbackinterface_p.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QObject> + +class TactileFeedbackInterface : public QObject +{ + public: + virtual void touchFeedback(QEvent *event, const QWidget *widget) = 0; +}; + +Q_DECLARE_INTERFACE(TactileFeedbackInterface, "com.trolltech.Qt.TactileFeedbackInterface/1.0") diff --git a/src/plugins/s60/feedback/feedback.pro b/src/plugins/s60/feedback/feedback.pro new file mode 100644 index 0000000..1069220 --- /dev/null +++ b/src/plugins/s60/feedback/feedback.pro @@ -0,0 +1,18 @@ +include(../../qpluginbase.pri) + +TARGET = qtactilefeedback$${QT_LIBINFIX} + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/s60/feedback + +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +contains(S60_VERSION, 5.0)|contains(S60_VERSION, symbian3) { + HEADERS += qtactileFeedback.h + SOURCES += qtactileFeedback_s60.cpp + + LIBS += -ltouchfeedback +} + +load(data_caging_paths) + +TARGET.UID3=0x200315B4 diff --git a/src/plugins/s60/feedback/qtactileFeedback.h b/src/plugins/s60/feedback/qtactileFeedback.h new file mode 100644 index 0000000..7c4cc29 --- /dev/null +++ b/src/plugins/s60/feedback/qtactileFeedback.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QEvent> +#include <QWidget> + +#include "private/qs60style_feedbackinterface_p.h" + +class QTactileFeedback : public TactileFeedbackInterface +{ + Q_OBJECT + Q_INTERFACES(TactileFeedbackInterface) + + public: + void touchFeedback(QEvent *event, const QWidget *widget); + }; diff --git a/src/plugins/s60/feedback/qtactileFeedback_s60.cpp b/src/plugins/s60/feedback/qtactileFeedback_s60.cpp new file mode 100644 index 0000000..c2f1d34 --- /dev/null +++ b/src/plugins/s60/feedback/qtactileFeedback_s60.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QObject> +#include <QSlider> +#include <QScrollBar> + +#include <QtCore/qplugin.h> +#include "qtactileFeedback.h" + +#include <touchfeedback.h> + +void QTactileFeedback::touchFeedback(QEvent *event, const QWidget *widget) +{ + //Lets share the global instance for touch feedback (you are NOT allowed to try and delete it!). + MTouchFeedback* feedback = MTouchFeedback::Instance(); + + //If the widget itself is not handling focus, try to use focusProxy widget. + const QWidget *w = ((widget->focusPolicy() == Qt::NoFocus) && (widget->focusProxy())) ? widget->focusProxy() : widget; + + //Only give tactile feedback for enabled widgets that take focus. + if (feedback && w && w->isEnabled() && w->isWidgetType() && w->isVisible()) { + //Scrollbars are 'special' that they don't take focus (nor they have focusProxy), yet we'd like to have tactile feedback for them + if (w->focusPolicy() == Qt::NoFocus) + if (!qobject_cast<const QScrollBar *>(w)) + return; + + //Don't give tactile feedback for widgets that are outside topmost dialog. + QWidget *dialog = QApplication::activeModalWidget(); + if (dialog) { + QList<const QWidget *> allChildren = dialog->findChildren<const QWidget *>(); + if (!allChildren.contains(w)) + return; + } + + //Widget specific tactile feedback. + if (qobject_cast<const QSlider *>(w) || qobject_cast<const QScrollBar *>(w)) + feedback->InstantFeedback(ETouchFeedbackSensitive); + else + feedback->InstantFeedback(ETouchFeedbackBasic); + } +} + +Q_EXPORT_PLUGIN2("feedback", QTactileFeedback); |