Beginning Nokia Apps Development Qt and HTIVIL5 for Symbian and MeeGo Ray Rischpater Daniel Zucker Apress
Contents Contents at a Glance... I Foreword About the Authors About the Technical Reviewers Acknowledgments Introduction iv ix x xi xii xiii Part I: Design 1 Chapter 1: Introducing Nokia's Software Platform 3 Why Nokia? 3 Introducing Nokia's Hardware Platforms 4 Series 40 4 Symbian 4 MeeGo 5 Choosing a Development Platform 5 Qt 6 HTML5 7 Hybrid Applications 8 Distributing Your Application 8 Wrapping Up 9 Chapter 2: Designing Your Application 11 Designing for Mobile 11 User Context 12 Mobile Interaction Considerations 12 Technical Considerations 13 Cultural Considerations 14 The Design Process 15 Getting Started 15 Design Research 16
II CONTENTS Conceptual Design 17 Interaction Design and Prototyping 17 Documentation 18 Flowella 20 Visual and Information Design 27 Testing and Evaluation 30 Additional Topics: Gestalt and Unity 31 Usability Guidelines 32 Navigation 32 Entering Information 33 Information Presentation 34 Connectivity 34 Usability for Enterprise Applications 34 Usability and Security 34 Advertising 35 Platform Components 35 Checklists 35 Summary 36 Part II: Develop 37 Chapter 3: Working with the Nokia Qt SDK 39 Choosing an IDE 39 Introducing the Nokia Qt SDK 39 Getting Started with the Nokia Qt SDK 41 Installing the Nokia Qt SDK 41 Finding Your Way around the Nokia Qt SDK 44 Creating a Qt Application 45 Compiling and Running Your Code on a Device 52 Debugging Your Application 54 Wrapping Up 57 Chapter 4: Beginning Qt Development 59 Understanding the Qt Object Model 59 Understanding Signals and Slots 60 Making the Most of Hierarchical Ownership 61 Defining Object Properties 62 Casting at Run Time 63 Managing Resources and Localization 63 Understanding Qt's Collection Classes 65 Using Signals and Slots 66 Performing Input and Output 68 Managing Multiple Threads 69 Using Item Views with the Model-View-Controller Paradigm 71 Understanding Qt's Model Classes 72 Using Qt's View Classes 75 Putting It All Together 76 Implementing the Application User Interface 77 Using the Network to Obtain Data 80 Parsing the USGS Data Feed 81 vi
M CONTENTS Displaying the Results 85 Wrapping Up 86 II Chapter 5: Doing More with Qt 87 Using Application Resources 87 Including Resources in Your Applications 88 Accessing Application Resources 89 Incorporating User Actions 89 Introducing the Qt Main Window 90 Attaching Actions to the Main Window 92 Implementing a Custom Widget 92 Subclassing QWidget 93 Specifying Your Widget's Size Hints and Policies 94 Handling Incoming Events 95 Handling Incoming Gestures 97 Painting Your Widget's Contents 99 Integrating Qt Objects with Web Content 101 Linking Your Application with QtWebKit 102 Displaying Web Content with QtWebKit 102 Embedding C++ Objects in QtWebKit's JavaScript Runtime 104 Embedding Qt Widgets into QtWebKit Pages 106 Extending Application Functionality with Qt Mobility 107 Using the Qt Mobility APIs 109 Managing Bearer Networks 112 Obtaining and Working with Device Location Information 113 Sending and Receiving Messages 115 Playing and Recording Multimedia 118 Obtaining System Information 121 Putting It All Together 122 Looking inside the Application Controller 124 Changes to the Network Request 128 Determining the Device Position 129 Drawing the Map 131 Wrapping Up 137 Chapter 6: Introducing Qt Quick 139 Declaring Your User Interface 139 Introducing QML 141 Handling Signals in QML 143 Performing Animations in QML 145 Reviewing the Available Qt Quick Elements 146 Programming for the Web with QML 149 Creating the User Interface 151 Downloading the Data 154 Integrating C++ with QML 154 Displaying QML within a C++ Application 155 Mingling QObjects with QML 155 Wrapping Up, 158 vii
il CONTENTS Chapter 7: Developing with HTML5 159 HTML5 Is an Industry Standard 160 Hello World in HTML5 160 Hello World on a Handset 162 Using the HTML5 Application Cache 163 Hybrid Apps 165 Accessing Your HTML5 Content from the Local File System 165 Storing the HTML5 Content as an Application Resource 166 More HTML5 Features 167 Canvas 167 Transitions and Transformations 172 Local Storage 174 Putting It All Together: Implementing Shake in HTML5 176 Adding Ul Components to the Views 180 Fetching and Parsing the Data 182 Packaging the App 183 Links for further information 183 Wrapping Up 184 Part III: Distribute 185 Chapter 8: Testing Your Application 187 Preparing to Test 187 Using Qt's Test Framework 189 Introducing the QTestTest Framework 190 Unit Testing the Qua keevent Class 192 Testing Signals and Slots Using QTest 195 Testing User Interface Code Using QTestEventList 196 Wrapping Up 198 Chapter 9: Deploying Your Application.. 199 Preparing a Deployment Checklist 199 Packaging Your Application 200 Including Other Files within Your Application on Symbian Devices 200 Including Other Files within Your Application on MeeGo Devices 201 Including an Application Icon with Symbian Applications 202 Including an Application Icon with MeeGo Applications 202 Providing a UID for Qt Applications on Symbian 203 Providing a Desktop File for MeeGo 204 Putting It All Together 204 Signing Your Qt Application for Symbian Devices 205 Publishing with the Ovi Store 207 Registering with the Ovi Store 207 Publishing Your Application 208 QA in the Ovi Store 210 Marketing Your Application through the Ovi Store 211 Wrapping Up 213 II Index 215 will