diff options
108 files changed, 1577 insertions, 1005 deletions
diff --git a/doc/images/qml-observer-bar-copy-color.png b/doc/images/qml-observer-bar-copy-color.png Binary files differnew file mode 100644 index 0000000000..5fed826dc2 --- /dev/null +++ b/doc/images/qml-observer-bar-copy-color.png diff --git a/doc/images/qml-observer-bar-observe.png b/doc/images/qml-observer-bar-observe.png Binary files differnew file mode 100644 index 0000000000..8189f5e5cf --- /dev/null +++ b/doc/images/qml-observer-bar-observe.png diff --git a/doc/images/qml-observer-bar-reload.png b/doc/images/qml-observer-bar-reload.png Binary files differnew file mode 100644 index 0000000000..482e531af9 --- /dev/null +++ b/doc/images/qml-observer-bar-reload.png diff --git a/doc/images/qml-observer-view.png b/doc/images/qml-observer-view.png Binary files differnew file mode 100644 index 0000000000..7a19eff062 --- /dev/null +++ b/doc/images/qml-observer-view.png diff --git a/doc/images/qml-observer.png b/doc/images/qml-observer.png Binary files differnew file mode 100644 index 0000000000..70c7c26812 --- /dev/null +++ b/doc/images/qml-observer.png diff --git a/doc/images/qml-script-console.png b/doc/images/qml-script-console.png Binary files differnew file mode 100644 index 0000000000..9393bc3b13 --- /dev/null +++ b/doc/images/qml-script-console.png diff --git a/doc/images/qmldesigner-borderimage.png b/doc/images/qmldesigner-borderimage.png Binary files differindex 3fc10dfe0e..c28386bd47 100644 --- a/doc/images/qmldesigner-borderimage.png +++ b/doc/images/qmldesigner-borderimage.png diff --git a/doc/images/qmldesigner-states.png b/doc/images/qmldesigner-states.png Binary files differnew file mode 100644 index 0000000000..7e222e8812 --- /dev/null +++ b/doc/images/qmldesigner-states.png diff --git a/doc/images/qmldesigner-visual-editor.png b/doc/images/qmldesigner-visual-editor.png Binary files differindex 2bb23b8401..5813c83027 100644 --- a/doc/images/qmldesigner-visual-editor.png +++ b/doc/images/qmldesigner-visual-editor.png diff --git a/doc/images/qtcreator-maemo-deb-package.png b/doc/images/qtcreator-maemo-deb-package.png Binary files differindex 17b5f074fd..4983314d2c 100644 --- a/doc/images/qtcreator-maemo-deb-package.png +++ b/doc/images/qtcreator-maemo-deb-package.png diff --git a/doc/maemodev.qdoc b/doc/maemodev.qdoc index 3647ba4a22..e6ef2755f3 100644 --- a/doc/maemodev.qdoc +++ b/doc/maemodev.qdoc @@ -127,7 +127,7 @@ To install and configure Mad Developer: \list 1 - \o On the Nokia N900, select \gui{Download} > \gui{Development} > \gui{mad-developer} + \o On the Nokia N900, select \gui{App Manager > Download} > \gui{Development} > \gui{mad-developer} to install the Mad Developer software package. \o Click \gui {Mad Developer} to start the Mad Developer application. diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc index 272d6e6e60..12e466edcc 100644 --- a/doc/qtcreator.qdoc +++ b/doc/qtcreator.qdoc @@ -125,6 +125,7 @@ \o \l{Setting Up Debugger} \o \l{Debugger Modes of Operation} \o \l{Using Debugging Helpers} + \o \l{Debugging Qt Quick Projects} \endlist \o \l{Using the Maemo Emulator} \o \l{Using Version Control Systems} @@ -444,7 +445,7 @@ \list \o Windows XP Service Pack 2 \o Windows Vista - \o (K)Ubuntu Linux 7.04 (32-bit and 64-bit) or later, with the following: + \o (K)Ubuntu Linux 8.04 (32-bit and 64-bit) or later, with the following: \list \o g++ \o make @@ -516,7 +517,7 @@ \o Mac OS X \o Yes \o No - \o No + \o Yes \endtable */ @@ -993,10 +994,6 @@ editor. Then select the \gui {Design} mode to edit the file in the visual editor. - \note The visual \QMLD editor is provided as an experimental plugin that you must - enable to be able to edit QML files in the \gui Design mode. Enabling the - visual editor can negatively affect the overall stability of Qt Creator. - To enable or disable the \QMLD visual editor, select \gui {Help > About Plugins... > Qt Quick > QmlDesigner}. You must restart Qt Creator to enable or disable the visual editor. @@ -1007,8 +1004,10 @@ \list - \o \gui {Navigator} pane displays the items in the scene. You can + \o \gui {Navigator} pane displays the items in the editor. You can show and hide items to focus on specific parts of the application. + To view lists of files or projects, instead, select \gui {File System}, + \gui {Open Documents}, or \gui Projects in the menu. \o \gui {Library} pane displays lists of predefined \gui {Items} and imported \gui {Resources} that you can use to design applications. The @@ -4261,7 +4260,7 @@ \section1 Using Version Control Systems - The \gui{Tools} menu contains a sub-menu for each supported version + The \gui{Tools} menu contains a submenu for each supported version control system. The \gui{Version Control} output pane displays the commands @@ -4345,73 +4344,71 @@ editor, you can go back to it by closing the diff view. You can also check a diff view from the editor combo box showing the \gui{Opened files}. - \section2 Reverting Changes - To discard local changes to a file or project, use the \gui Revert - function or the \gui {Undo Changes/Undo Repository Changes} function - (for Git). The changes discarded depend on the version control system. + All supported version control system support reverting your project to + known states. This functionality is generally called \e reverting. + + The changes discarded depend on the version control system. + + A version control system can replace the \gui Revert menu option with other + options. + + \section3 Reverting Changes Using Git + + The Git version control system has an index that is used to stage + changes. The index is commited on the next commit. Git allows you to revert + back to the state of the last commit as well as to the state staged in the + index. + + \list + + \o \gui{Undo Unstaged Changes} reverts all changes and resets the working + directory to the state of the index. - For example, in Perforce, select \gui{Revert File/Revert Project} - to discard changes made to open files, reverting them to the - revisions last synchronized from the repository. Select - \gui{Revert Unchanged} to revert files if their contents or file - type have not changed after they were opened for editing. + \o \gui{Undo Uncommitted Changes} reverts all changes, discarding the index. + This returns your working copy to the state it was in right after the last commit. + + \endlist \section2 Using Additional Git Functions - The \gui Git sub-menu contains the following additional items: + Git is a fast decentralized version control system. Git is available + for Windows, Linux and Mac. + + The \gui Git submenu contains the following additional items: \table \row - \i \gui {Apply Patch/Apply Patch...} - \i Apply changes to a file or project from a diff file. You can - either apply a patch file that is open in Qt Creator or select + \i \gui {Patch > Apply from Editor/Apply from File...} + \i Patches are rewriting instructions that can be applied to a set of files. + You can either apply a patch file that is open in Qt Creator or select the patch file to apply from the file system. \row - \i \gui{Stash Snapshot...} - \i Save a snapshot of your current - work under a name for later reference. For example, if you - want to try out something and find out later that it does not work, - you can discard it and return to the state of the snapshot. - \row - \i \gui{Stash} - \i Stash local changes prior to executing a \gui{Pull}. - \row - \i \gui{Stash Pop} - \i Remove a single stashed state from the stash list and apply it on - top of the current working tree state. - \row \i \gui{Pull} \i Pull changes from the remote repository. If there are locally - modified files, you are prompted to stash those changes. - The \gui Git options page contains an option to do - a rebase operation while pulling. + modified files, you are prompted to stash those changes. Select \gui{Tools > + Options... > Version Control > Git} and select the \gui {Pull with rebase} + check box to perform a rebase operation while pulling. \row - \i \gui{Clean Repository.../Clean Project...} - \i Collect all files that are not under version control - with the exception of patches and project files - and show them as a checkable list in a dialog - prompting for deletion. This lets you completely clean a build. + \i \gui{Clean.../Clean Project...} + \i All files that are not under version control (with the exception + of patches and project files) are displayed in the \gui {Clean Repository} + dialog. Select the files to delete and click \gui Delete. This allows you to + clean a build completely. \row \i \gui{Branches...} - \i Displays the branch dialog showing the local branches at the - top and remote branches at the bottom. To switch to the local - branch, double-click on it. Double-clicking on a remote - branch first creates a local branch with the same name that - tracks the remote branch, and then switches to it. + \i Display the \gui Branch dialog that shows the local branches at the + top and remote branches at the bottom. To switch to a local branch, + double-click it. Double-clicking on a remote branch first creates a local + branch with the same name that tracks the remote branch, and then switches + to it. \image qtcreator-vcs-gitbranch.png - - \row - \i \gui{Stashes...} - \i Displays a dialog showing the stashes created by - \gui{Stash Snapshot...} with options to restore, - display or delete them. \row \i \gui {Stage File for Commit} \i Mark new or modified files for committing to the repository. @@ -4422,9 +4419,39 @@ in the \gui Change field. \endtable - \section2 Using Additional Mercurial Functions + \section3 Using Stashes + + With Git, you can put your current set of changes onto a virtual shelf called a \e stash. + Stashes are useful, for example, to put aside a set of changes to work on higher + priority tasks or to pull in new chages from another repository. + + Qt Creator exposes this functionality in the \gui{Tools > Git > Stash} menu. + + \table + \row + \i \gui{Stashes...} + \i Display a dialog that shows all known stashes with options to restore, + display or delete them. + \row + \i \gui{Stash} + \i Stash all local changes. The working copy is then reset to + the state it had right after the last commit. + \row + \i \gui{Stash Snapshot...} + \i Save a snapshot of your current work under a name for later reference. The + working copy is unchanged. + + For example, if you want to try something and find out later that it does not work, + you can discard it and return to the state of the snapshot. + \row + \i \gui{Stash Pop} + \i Remove a single stashed state from the stash list and apply it on + top of the current working tree state. + \endtable + + \section2 Using Additional Mercurial Functionality - The \gui Mercurial sub-menu contains the following additional items: + The \gui Mercurial submenu contains the following additional items: \table \row @@ -4453,7 +4480,7 @@ Control > Perforce}. If you do not use Perforce and want to turn off the check, clear this field. - The \gui Perforce sub-menu contains the following additional items: + The \gui Perforce submenu contains the following additional items: \table \row @@ -4475,10 +4502,9 @@ \endtable - \section2 Using Additional Subversion Functions - The \gui Subversion sub-menu contains the following additional items: + The \gui Subversion submenu contains the following additional items: \table \row @@ -4726,15 +4752,14 @@ Qt Creator does not include a debugger. It provides a debugger plugin that acts as an interface between the Qt Creator core and external native debuggers such as the GNU Symbolic Debugger (gdb), the Microsoft Console Debugger (CDB), - and an internal Java Script debugger. You can use the native debuggers to - debug the C++ language. + and a QML/Java Script debugger. The following sections describe debugging with Qt Creator: \list \o \l{Debugging the Example Application} uses an example application to illustrate - how to debug applications in the \gui Debug mode. + how to debug Qt C++ applications in the \gui Debug mode. \o \l{Interacting with the Debugger} describes the views and functions available in the \gui Debug mode. @@ -4749,6 +4774,8 @@ \o \l{Using Debugging Helpers} describes how to get more detailed data on complex data. + \o \l{Debugging Qt Quick Projects} describes how to debug Qt Quick projects. + \endlist */ @@ -4787,6 +4814,8 @@ \endlist + \note Debugging QML and Java Script is supported only in plain mode. + When you click the \gui {Start Debugging} button, the debugger is launched in the appropriate operating mode (plain, terminal, or TRK), based on the build and run settings for the active project. Select \gui Debug menu options @@ -4870,6 +4899,9 @@ \title Setting Up Debugger + \note The information in this section applies only to debugging the C++ + language. + Typically, the interaction between Qt Creator and the native debugger is set up automatically and you do not need to do anything. However, you might have an unsupported gdb version installed, your Linux environment might not have gdb @@ -5021,7 +5053,9 @@ package (Version 6.11.1.404 for the 32-bit or the 64-bit version of Qt Creator, respectively), which is freely available for download from the \l{http://msdn.microsoft.com/en-us/default.aspx} - {Microsoft Developer Network}. + {Microsoft Developer Network}. The Qt Creator help browser does + not allow you to download files, and therefore, you must copy the above links to + a browser. \note Visual Studio does not include the Debugging tools needed, and therefore, you must install them separately. @@ -5092,7 +5126,8 @@ \title Interacting with the Debugger In \gui Debug mode, you can use several views to interact with the - program you are debugging. Frequently used views are shown by + program you are debugging. The availability of views depends on whether + you are debugging C++ or QML. Frequently used views are shown by default and rarely used ones are hidden. To change the default settings, select \gui {Window > Views}, and then select views to display or hide. @@ -5119,31 +5154,13 @@ Select \gui Debug menu options to launch the debugger in other modes. For more information, see \l{Debugger Modes of Operation}. + \note Debugging QML and Java Script is supported only in plain mode. + Once the program starts running, it behaves and performs as usual. - You can interrupt a running program by selecting \gui{Debug} > + You can interrupt a running C++ program by selecting \gui{Debug} > \gui {Interrupt}. The program is automatically interrupted as soon as a breakpoint is hit. - \section2 Starting the Debugger from the Command Line - - You can use the Qt Creator debugger interface from the command line. To - attach it to a running process, specify the process ID as a parameter for - the \c {-debug} option. To examine a core file, specify the file name. - Qt Creator executes all the necessary steps, such as searching for - the binary that belongs to a core file. - - For example: - - \list - - \o \c {C:\qtcreator-2.1\bin>qtcreator -debug 2000} - - \o \c {C:\qtcreator-2.1\bin>qtcreator -debug core.2000} - - \endlist - - For more information, see \l{Using Command Line Options}. - \section1 Using the Debugger Once the program stops, Qt Creator: @@ -5154,10 +5171,9 @@ \o Retrieves the contents of local variables. \o Examines \gui Watchers. \o Updates the \gui Registers, \gui Modules, and \gui Disassembler - views. + views if you are debugging the C++ language. \endlist - You can use the \gui Debug mode views to examine the data in more detail. You can use the following keyboard shortcuts: @@ -5166,7 +5182,7 @@ \o To finish debugging, press \key{Shift+F5}. \o To execute a line of code as a whole, press \key{F10}. - \o To step into a function or a sub-function, press \key{F11}. + \o To step into a function or a subfunction, press \key{F11}. \o To continue running the program, press \key{F5}. \endlist @@ -5174,14 +5190,6 @@ It is also possible to continue executing the program until the current function completes or jump to an arbitrary position in the current function. - \section2 Stepping into Frameworks in Mac OS - - In Mac OS X, external libraries are usually built into so-called Frameworks, - which may contain both release and debug versions of the library. When you run - applications on the Mac OS desktop, the release version of Frameworks is used - by default. To step into Frameworks, select the \gui {Use debug versions of - Frameworks} option in the project run settings for \gui Desktop and - \gui {Qt Simulator} targets. \section1 Setting Breakpoints @@ -5225,7 +5233,6 @@ while it is running under the debugger's control. Breakpoints are saved together with a session. - \section1 Viewing Call Stack Trace When the program being debugged is interrupted, Qt Creator displays the @@ -5247,42 +5254,6 @@ view, making it seem like the program was interrupted before entering the function. - - \section1 Viewing Threads - - If a multi-threaded program is interrupted, the \gui Thread view or the - combobox named \gui Thread in the debugger's status bar can be used to - switch from one thread to another. The \gui Stack view adjusts itself - accordingly. - - - \section1 Viewing Modules and Source Files - - The \gui{Modules} view and \gui{Source Files} views display information - that the debugger plugin has about modules and source files included in - the project. The \gui{Modules} view lists the modules in the project and - symbols within the modules. In addition, it indicates where the module - was loaded. - - The \gui{Source Files} view lists all the source files included in the project. - If you cannot step into an instruction, you can check whether the source file is - actually part of the project, or whether it was compiled - elsewhere. The view shows the path to each file in the file system. - - By default, the \gui{Modules} view and \gui{Source Files} view are hidden. - - - \section1 Viewing Disassembled Code and Register State - - The \gui{Disassembler} view displays disassembled code for the current - function. The \gui{Registers} view displays the current state of the CPU's - registers. - - The \gui{Disassembler} view and the \gui{Registers} view are both useful - for low-level commands for checking single instructions, such as \gui{Step Into} - and \gui{Step Over}. By default, both \gui{Disassembler} and - \gui{Registers} view are hidden. - \section1 Locals and Watchers Whenever a program stops under the control of the debugger, it retrieves @@ -5351,6 +5322,74 @@ \note The set of watched items is saved in your session. + \section1 Debugging the C++ Language + + The following sections describe additional debugging functions that apply + only to debugging C++. + + \section2 Starting the Debugger from the Command Line + + You can use the Qt Creator debugger interface from the command line. To + attach it to a running process, specify the process ID as a parameter for + the \c {-debug} option. To examine a core file, specify the file name. + Qt Creator executes all the necessary steps, such as searching for + the binary that belongs to a core file. + + For example: + + \list + + \o \c {C:\qtcreator-2.1\bin>qtcreator -debug 2000} + + \o \c {C:\qtcreator-2.1\bin>qtcreator -debug core.2000} + + \endlist + + For more information, see \l{Using Command Line Options}. + + \section2 Stepping into Frameworks in Mac OS + + In Mac OS X, external libraries are usually built into so-called Frameworks, + which may contain both release and debug versions of the library. When you run + applications on the Mac OS desktop, the release version of Frameworks is used + by default. To step into Frameworks, select the \gui {Use debug versions of + Frameworks} option in the project run settings for \gui Desktop and + \gui {Qt Simulator} targets. + + \section2 Viewing Threads + + If a multi-threaded program is interrupted, the \gui Thread view or the + combobox named \gui Thread in the debugger's status bar can be used to + switch from one thread to another. The \gui Stack view adjusts itself + accordingly. + + \section2 Viewing Modules and Source Files + + The \gui{Modules} view and \gui{Source Files} views display information + that the debugger plugin has about modules and source files included in + the project. The \gui{Modules} view lists the modules in the project and + symbols within the modules. In addition, it indicates where the module + was loaded. + + The \gui{Source Files} view lists all the source files included in the project. + If you cannot step into an instruction, you can check whether the source file is + actually part of the project, or whether it was compiled + elsewhere. The view shows the path to each file in the file system. + + By default, the \gui{Modules} view and \gui{Source Files} view are hidden. + + + \section2 Viewing Disassembled Code and Register State + + The \gui{Disassembler} view displays disassembled code for the current + function. The \gui{Registers} view displays the current state of the CPU's + registers. + + The \gui{Disassembler} view and the \gui{Registers} view are both useful + for low-level commands for checking single instructions, such as \gui{Step Into} + and \gui{Step Over}. By default, both \gui{Disassembler} and + \gui{Registers} view are hidden. + */ @@ -5363,7 +5402,9 @@ \title Debugging the Example Application This section uses the \l{Creating a Qt C++ Application}{TextFinder} example to - illustrate how to debug applications in the \gui Debug mode. TextFinder + illustrate how to debug Qt C++ applications in the \gui Debug mode. + + TextFinder reads a text file into QString and then displays it with QTextEdit. To look at the example QString, \c{line}, and see the @@ -5441,7 +5482,7 @@ \contentspage index.html \previouspage creator-debugger-operating-modes.html \page creator-debugging-helpers.html - \nextpage creator-maemo-emulator.html + \nextpage creator-debugging-qml.html \title Using Debugging Helpers @@ -5453,7 +5494,7 @@ with Qt Creator, but they enhance the user's ability to quickly examine complex data significantly. - \section1 Debugging Helpers based on C++ + \section1 Debugging Helpers Based on C++ This is the first and original approach to display complex data types. While it has been superseded on most platforms by the more @@ -5472,7 +5513,7 @@ library is built for each Qt version. - \section1 Debugging Helpers based on Python + \section1 Debugging Helpers Based on Python On platforms featuring a Python-enabled version of the gdb debugger, the data extraction is done by a Python script. This is more robust @@ -5744,6 +5785,17 @@ d.putName("value") d.putItemHelper(Item(value, item.iname, "value")) \endcode + + \section1 Debugging Helpers for QML + + The debugging helpers for QML provide you with code completion for custom modules + (\c qmldump) and debugging Qt Quick UI projects (\c qmlobserver). + + You have to build the QML Observer once for each Qt version that you want to debug + with. Select \gui{Tools > Options... > Qt4 > Qt Versions}. + + \note QML Observer requires Qt 4.7.1 or later. + */ @@ -5854,6 +5906,134 @@ /*! \contentspage index.html + \previouspage creator-debugging-helpers.html + \page creator-debugging-qml.html + \nextpage creator-maemo-emulator.html + + \title Debugging Qt Quick Projects + + \note You need Qt 4.7.1 or later to debug Qt Quick projects. + + \section1 Setting Up QML Debugging + + The process of setting up debugging for Qt Quick projects depends on the type of + the project: Qt Quick UI or Qt Quick Application. + + To debug Qt Quick UI projects, you must compile the debugging helpers. For more + information, see \l{Debugging Helpers for QML}. + + To debug Qt Quick Applications, you must modify the project file to comment in the + following line: + + \c {DEFINES += QMLJSDEBUGGER}. + + Then you must rebuild the project. + + To enable QML debugging for both types of projects, select \gui Projects, and + then select the \gui QML check box in the run settings. + + \section1 Starting QML Debugging + + To start the application, choose \gui {Debug > Start Debugging + > Start Debugging} or press \key F5. Once the application starts running, it behaves + and performs as usual. You can then perform the following tasks: + + \list + + \o Debug Java Script functions + + \o Preview QML changes at runtime + + \o Inspect QML at runtime + + \endlist + + \section1 Debugging Java Script Functions + + You can use the Qt Creator \gui Debug mode to inspect the state of your + application while debugging. You can interact with the debugger in several + ways, as described in the following sections: + + \list + + \o \l{Setting Breakpoints} + + \o \l{Viewing Call Stack Trace} + + \o \l{Locals and Watchers} + + \endlist + + \section1 Executing Java Script Expressions + + When the application is interrupted by a breakpoint, you can use the \gui {QML + Script Console} to execute Java Script expressions in the current context. To + open it, choose \gui {Window > View > QML Script Console}. + + \image qml-script-console.png "QML Script Console view" + + You can type Java Script expressions and use them to get information about the + state or your application. For example, property values. + + You can see the current value of a property by hovering over it in the code editor. + + \section1 Previewing QML Changes at Runtime + + If you change property values or add properties in the code editor, the changes + are updated in the running application when you save them. If live preview is not supported + for an element, a message appears. Click \gui Reload to preview the changes. + + Reloading is enabled by default. To disable it, click + \inlineimage qml-observer-bar-reload.png "Apply Changes on Save button" + in the \gui {QML Observer} view. + + \section1 Inspecting QML at Runtime + + While the application is running, you can use the \gui {QML Observer} view to + explore the object structure, debug animations, and inspect colors. + To open the \gui {QML Observer} view, choose \gui {Window > View > QML Observer}. + + \image qml-observer-view.png "QML Observer view" + + When you debug complex applications, you can use the observe + mode to jump to the position in code where an element is defined. To switch to + the observe mode, click + \inlineimage qml-observer-bar-observe.png + in the \gui {QML Observer} view. + + Click elements in the running application to jump to their definitions in the code. + Double-click elements to browse the element hierarchy. The hierarchy is displayed + as bread crumbs in the \gui {QML Observer} view. + + You can also right-click an element in the running application to view the element + hierarchy as a context menu. Select an element to jump to its definition in code. + + To zoom in and out of the application, click the \gui Zoom button. + + To inspect colors, click the \gui {Color Picker} button. You can also the click + \inlineimage qml-observer-bar-copy-color.png "Copy Color button" + to copy the color definition to the clipboard. + + \section1 Debugging Animations + + \image qml-observer.png + + To play and pause animations in the running application, click the \gui {Play/Pause Animations} + button in the \gui {QML Observer} view or \gui {Debugging > Animations > Pause} or press + \key {Ctrl+.}. + + To step through an animation, select \gui {Debugging > Animations > Pause & Step} + or press \key {Ctrl+,}. + + To set step duration in milliseconds, select \gui {Debugging > Animations > Set Step}. + To change the speed at which animations are played, select a value in \gui {Debugging + > Animations}. + +*/ + + +/*! + \contentspage index.html \previouspage creator-project-cmake.html \page creator-project-generic.html \nextpage creator-developing-maemo.html @@ -6044,9 +6224,9 @@ /*! \contentspage index.html - \previouspage quick-projects.html + \previouspage creator-using-qt-quick-designer.html \page quick-components.html - \nextpage quick-screens.html + \nextpage quick-buttons.html \title Creating Components @@ -6055,7 +6235,7 @@ through properties, signals, and slots, and is generally defined in its own QML file. You can import components to screens and applications. - You can create the following QML components: + You can use the following QML elements to create components: \list @@ -6079,6 +6259,268 @@ \endlist + \section1 Creating Components in Qt Quick Designer + + \list 1 + + \o Select \gui {File > New File or Project > Files and Classes > QML + > Choose...} to create a new .qml file. + + \o Click \gui Design to open the .qml file in \QMLD. + + \o Drag and drop an item from the \gui Library pane to the editor. + + \o Edit item properties in the \gui Properties pane. + + The available properties depend on the item. + + \endlist + + The following sections contain examples of how to create some common components: + + \list + + \o \l{Creating Buttons} + + \o \l{Creating Scalable Buttons and Borders} + + \endlist + +*/ + + +/*! + \contentspage index.html + \previouspage quick-components.html + \page quick-buttons.html + \nextpage quick-scalable-image.html + + \title Creating Buttons + + To create a button component: + + \list 1 + + \o Select \gui {File > New File or Project > QML > QML File > Choose...} to + create a QML file called Button.qml (for example). + + \note Components are listed in the \gui Library pane only if the filename + begins with a capital letter. + + \o Click \gui {Design} to edit the file in the visual editor. + + \o In the \gui Navigator pane, click \gui Rectangle to set properties + for it. + + \o In the \gui Properties pane, modify the appearance of the button. + + \list a + + \o In the \gui Size field, set the width (\gui W) of the button to 60 + and the height of the button (\gui H) to 20. + + \o In the \gui Color field, select the button color. + + \o In the \gui Radius field, use the slider to set the radius of the + rectangle and produce rounded corners for the button. + + \endlist + + \o Drag and drop a \gui {Text} item on top of the \gui Rectangle. This + creates a nested element where \gui Rectangle is the parent element of + \gui Text. Elements are positioned relative to their parents. + + \o In the \gui Properties pane, edit the properties of the \gui Text item. + + \list a + + \o In the \gui Text field, type \bold Button. + + You can select the text color, font, size, and style in the \gui Font + section. + + \o In the \gui Alignment field, select the center buttons to align + the text to the center of the button. + + \o Click \gui {Layout}, and then click the + \inlineimage qmldesigner-anchor-fill-screen.png + button to anchor the text to the whole button area. + + \endlist + + \o Press \key {Ctrl+S} to save the button. + + \image qmldesigner-button.png "Button component" + + \endlist + + \note To view the button, you must add it to a Qt Quick Application or Qt Quick UI + project. + + To create a graphical button that scales beautifully without using vector graphics, + use the \l{http://doc.qt.nokia.com/4.7/qml-borderimage.html}{Border Image} + element. For more information, see \l{Creating Scalable Buttons and Borders}. + + */ + + + /*! + + \contentspage index.html + \previouspage quick-buttons.html + \page quick-scalable-image.html + \nextpage quick-screens.html + + \title Creating Scalable Buttons and Borders + + You can use the \l{http://doc.qt.nokia.com/4.7/qml-borderimage.html}{Border Image} + element to display an image, such as a PNG file, as a border and a background. + + Use two Border Image elements and suitable graphics to make it look like the button + is pushed down when it is clicked. One of the Border Image elements is visible by default. + You can specify that it is hidden and the other one becomes visible when the mouse + is clicked. + + Add a MouseArea that covers the whole area and emits the clicked signal (\c {parent.clicked()}) + when it detects a mouse click. + + You can add text to the button and set it up as a property. The text can then be initialized + from the outside, making the button a reusable UI component. The font size is also available + in case the default size is too big. You can scale down the button text and use smooth text + rendering for some extra quality. + + \image qmldesigner-borderimage.png "Graphical button" + + To create a graphical button: + + \list 1 + + \o Select \gui {File > New File or Project > QML > QML File > Choose...} to create + a QML file called Button.qml (for example). + + \o Double-click the file to open it in the code editor. + + \o Replace the \gui Rectangle with an \gui Item, as illustrated by the + following code snippet: + + \code + + Item { + + } + + \endcode + + \o Specify properties and set expressions for the \gui Item, as + illustrated by the following code snippet: + + \code + + property string text: "" + property int fontSize: 44 + + signal clicked + + \endcode + + You will point to the properties and expression later. + + \o Click \gui {Design} to edit the file in the visual editor. + + \o Drag and drop two \gui BorderImage items from the \gui Library pane to + the scene. + + \o Drag and drop a \gui Text item to the scene. + + \o Drag and drop a \gui MouseArea to the screen. + + \o Click \gui Design to return to the visual editor. + + \o In the \gui Navigator pane, select \gui border_image1 to specify + settings for it in the \gui Properties pane: + + \list a + + \o Select \gui {Set Expression} in the menu next to the \gui Visibility + check box. + + \o Enter the following expression to specify that the image is visible + when the mouse is not pressed down: \c {!mouse_area1.pressed}. + + \o In the \gui Source field, select the image file for the + button, for example button_up.png. + + \o Click \gui {Layout}, and then click the + \inlineimage qmldesigner-anchor-fill-screen.png + button to anchor the border image to the \gui Item. + + \endlist + + \o Select \gui border_image2 to specify similar settings for it: + + \list a + + \o Set the following epression for \gui Visibility, to specify that + the the image is visible when the mouse is pressed down: + \c {mouse_area1.pressed}. + + \o In the \gui Source field, select the image file for the + button when it is clicked, for example button_down.png. + + \o Click \gui {Layout}, and then click the + \inlineimage qmldesigner-anchor-fill-screen.png + button to anchor the border image to the \gui Item. + + \endlist + + \o Select \gui text1 to specify font size and color, and text + scaling and rendering: + + \list a + + \o In the \gui Color field, use the color picker to select + the font color, or enter a value in the field. + + \o In the \gui Text field, select \gui {Set Expression} and + enter a pointer to the \c {text} property that you specified + earlier: \c {parent.txt}. + + \o Select the \gui Aliasing check box to enable smooth text + rendering. + + \o In the \gui Size field, select \gui {Pixels} to specify + the font size in pixels. By default, the size is specified in + points. + + \o In the \gui Size field, select \gui {Set Expression} and + enter a pointer to the \c {fontSize} property that you specified + earlier. + + \o Click \gui {Layout}, and then click the + \inlineimage qmldesigner-center-in.png "Anchor buttons" + buttons to inherit the vertical and horizontal centering from + the parent. + + \o Click \gui Advanced to specify scaling for the text in the + \gui Scale field. + + \o Select \gui {Set Expression} and enter the following expression: + \c {if (!mousearea1.pressed) { 1 } else { 0.95 }}. + + \note You can enter long and complicated expressions also in the + code editor. + + \endlist + + \o In the code editor, add to the \c MouseArea item + a pointer to the \c clicked expression that you added earlier: + \c {onClicked: parent.clicked()}. + + \endlist + + \note To view the button, you must add it to a Qt Quick Application or Qt + Quick UI project. + */ @@ -6092,6 +6534,28 @@ \title Creating Screens You can use predefined QML elements and your own components to create screens. + Typically, the main qml file in a Qt Quick project specifies the main window of an + application. + + \section1 Adding Components to Screens + + \list 1 + + \o Select \gui {File > New File or Project > Qt Quick Project > Qt Quick UI} + or \gui {Qt Quick Application} to create a Qt Quick project. + + \o Drag and drop components from the \gui Library pane to the editor. + + The QML files in the project folder are displayed in \gui {QML Elements}. + + \o Select components in the \gui Navigator pane to edit their properties + in the \gui Properties pane. + + For example, you can anchor components to a position on the screen. + + \endlist + + \section1 Organizing Items on Screens You can create the following types of views to organize items provided by \l{http://doc.qt.nokia.com/4.7/qdeclarativemodels.html}{data models}: @@ -6106,6 +6570,8 @@ In the code editor, write the code to use the data models. + \section1 Using States + Use states and transitions to navigate between screens. @@ -6113,6 +6579,13 @@ their properties and behavior and the available actions. For example, you can use states to create two screens. + To add states, click the empty slot in the \gui States pane. Then modify the new state + in the visual editor. + + \image qmldesigner-states.png "States pane" + + The properties that you change in a state are highlighted with blue color. + In the code editor, you can see the changes recorded as changes to the base state. */ @@ -7431,12 +7904,12 @@ items with names consisting of plain characters, numbers, underscores, and hyphens. - \o There is no IDE support for adding or removing sub-projects. Project + \o There is no IDE support for adding or removing subprojects. Project hierarchies (SUBDIRS template) have to be created manually. \o Creating new CMake projects with Qt Creator is not supported. - \o Building and packaging sub-projects is not supported for Maemo devices. + \o Building and packaging subprojects is not supported for Maemo devices. \o You must create projects for Maemo targets on the same partition where you installed Nokia Qt SDK, Qt Creator, and MADDE. diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py index 63b7c17c14..b2f23993fb 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.py +++ b/share/qtcreator/gdbmacros/gdbmacros.py @@ -815,28 +815,34 @@ def qdump__QObject(d, item): d.putValue("...") d.putNumChild(0) - # Connections. - with SubItem(d): - connectionCount = 0 - d.putName("connections") - d.putItemCount(connectionCount) - d.putType(" ") - d.putNumChild(connectionCount) - if connectionCount: - d.putField("childtype", "") - d.putField("childnumchild", "0") - - if d.isExpandedIName(item.iname + ".connections"): - with Children(d): - connectionLists = d_ptr["connectionLists"] - warn("CONNECTIONLISTS: %s " % connectionLists) + # Connections. + with SubItem(d): + d.putName("connections") + d.putType(" ") + connections = d_ptr["connectionLists"] + connectionListCount = 0 + if not isNull(connections): + connectionListCount = connections["d"]["size"] + d.putItemCount(connectionListCount) + d.putNumChild(connectionListCount) + if d.isExpandedIName(item.iname + ".connections"): + with Children(d): + vectorType = connections.type.target().fields()[0].type + innerType = vectorType.template_argument(0) + # Should check: innerType == ns::QObjectPrivate::ConnectionList + p = gdb.Value(connections["p"]["array"]).cast(innerType.pointer()) + pp = 0 + for i in xrange(connectionListCount): + first = p.dereference()["first"] + while not isNull(first): + d.putItem(Item(first.dereference(), item.iname + ".connections", pp)) + first = first["next"] + # We need to enforce some upper limit. + pp += 1 + if pp > 1000: + break + p += 1 - for connection in xrange(connectionCount): - with SubItem(d): - d.putField("iname", "%s.connections.%d" - % (item.iname, connection)) - d.putName("connection %d" % connection) - d.putValue("") # Signals signalCount = metaData[13] @@ -858,6 +864,7 @@ def qdump__QObject(d, item): d.putName("signal %d" % signal) d.putType(" ") d.putValue(extractCString(metaStringData, offset)) + d.putNumChild(0) # FIXME: List the connections here. # Slots with SubItem(d): @@ -878,6 +885,7 @@ def qdump__QObject(d, item): d.putName("slot %d" % slot) d.putType(" ") d.putValue(extractCString(metaStringData, offset)) + d.putNumChild(0) # FIXME: List the connections here. # Active connection with SubItem(d): @@ -1660,14 +1668,19 @@ def qdump__QTextCodec(d, item): def qdump__QTextCursor(d, item): - p = item.value["d"]["d"].dereference() - d.putValue(p["position"]) - d.putNumChild(1) - if d.isExpanded(item): - with Children(d): - d.putIntItem("position", p["position"]) - d.putIntItem("anchor", p["anchor"]) - d.putCallItem("selected", item, "selectedText()") + dd = item.value["d"]["d"] + if isNull(dd): + d.putValue("(invalid)") + d.putNumChild(0) + else: + p = dd.dereference() + d.putValue(p["position"]) + d.putNumChild(1) + if d.isExpanded(item): + with Children(d): + d.putIntItem("position", p["position"]) + d.putIntItem("anchor", p["anchor"]) + d.putCallItem("selected", item, "selectedText()") def qdump__QTextDocument(d, item): @@ -2064,7 +2077,14 @@ def qdump__std__string(d, item): baseType = item.value.type.unqualified().strip_typedefs() if baseType.code == gdb.TYPE_CODE_REF: baseType = baseType.target().unqualified().strip_typedefs() - charType = baseType.template_argument(0) + # We might encounter 'std::string' or 'std::basic_string<>' + # or even 'std::locale::string' on MinGW due to some type lookup glitch. + if str(baseType) == 'std::string' or str(baseType) == 'std::locale::string': + charType = lookupType("char") + elif str(baseType) == 'std::wstring': + charType = lookupType("wchar_t") + else: + charType = baseType.template_argument(0) repType = lookupType("%s::_Rep" % baseType).pointer() rep = (data.cast(repType) - 1).dereference() size = rep['_M_length'] diff --git a/share/qtcreator/qml/qmljsdebugger/editor/selectiontool.cpp b/share/qtcreator/qml/qmljsdebugger/editor/selectiontool.cpp index fdc8b2dc2e..971a7cb71b 100644 --- a/share/qtcreator/qml/qmljsdebugger/editor/selectiontool.cpp +++ b/share/qtcreator/qml/qmljsdebugger/editor/selectiontool.cpp @@ -351,6 +351,9 @@ void SelectionTool::wheelEvent(QWheelEvent *event) QList<QGraphicsItem*> itemList = QDeclarativeViewObserverPrivate::get(observer())->selectableItems(event->pos()); + if (itemList.isEmpty()) + return; + int selectedIdx = 0; if (!observer()->selectedItems().isEmpty()) { selectedIdx = itemList.indexOf(observer()->selectedItems().first()); diff --git a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h index 02aee970a2..fbfdf2a39d 100644 --- a/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h +++ b/share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h @@ -60,7 +60,6 @@ public: QToolBar *toolbar() const; static QString idStringForObject(QObject *obj); QRectF adjustToScreenBoundaries(const QRectF &boundingRectInSceneSpace); - void setDebugMode(bool isDebugMode); public Q_SLOTS: void setDesignModeBehavior(bool value); diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp index d48d4eff53..20c9c44162 100644 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp @@ -37,7 +37,6 @@ #include "boundingrecthighlighter.h" #include "subcomponenteditortool.h" #include "qmltoolbar.h" -#include "jsdebuggeragent.h" #include "qt_private/qdeclarativedebughelper_p.h" @@ -60,7 +59,6 @@ QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeVie designModeBehavior(false), executionPaused(false), slowdownFactor(1.0f), - jsDebuggerAgent(0), toolbar(0) { } @@ -718,9 +716,11 @@ void QDeclarativeViewObserverPrivate::_q_onCurrentObjectsChanged(QList<QObject*> gfxObjects << gfxObj; } } - setSelectedItemsForTools(items); - clearHighlight(); - highlight(gfxObjects, QDeclarativeViewObserverPrivate::IgnoreContext); + if (designModeBehavior) { + setSelectedItemsForTools(items); + clearHighlight(); + highlight(gfxObjects, QDeclarativeViewObserverPrivate::IgnoreContext); + } } QString QDeclarativeViewObserver::idStringForObject(QObject *obj) @@ -789,11 +789,6 @@ void QDeclarativeViewObserverPrivate::createToolbar() QObject::connect(q, SIGNAL(marqueeSelectToolActivated()), toolbar, SLOT(activateMarqueeSelectTool())); } -void QDeclarativeViewObserver::setDebugMode(bool isDebugMode) -{ - if (isDebugMode && !data->jsDebuggerAgent) - data->jsDebuggerAgent = new JSDebuggerAgent(data->view->engine()); -} } //namespace QmlJSDebugger diff --git a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h index 516877dd58..4f90a28cde 100644 --- a/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h +++ b/share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver_p.h @@ -86,8 +86,6 @@ public: bool executionPaused; qreal slowdownFactor; - JSDebuggerAgent *jsDebuggerAgent; - QmlToolbar *toolbar; void clearEditorItems(); diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri index 6abc94f3ac..50135803cd 100644 --- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri +++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri @@ -9,14 +9,16 @@ contains(CONFIG, dll) { } ## Input +!contains(DEFINES, NO_JSDEBUGGER) { HEADERS += \ include/jsdebuggeragent.h \ include/qmljsdebugger_global.h SOURCES += \ jsdebuggeragent.cpp +} -contains(DEFINES, QMLOBSERVER) { +!contains(DEFINES, NO_QMLOBSERVER) { include($$PWD/editor/editor.pri) HEADERS += \ diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro index 1fc040262e..013795a1db 100644 --- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro +++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro @@ -2,8 +2,6 @@ TEMPLATE = lib CONFIG+=dll TARGET = QmlJSDebugger -DEFINES += QMLOBSERVER - unix:QMAKE_CXXFLAGS_DEBUG += -O3 include(../../../../src/qtcreatorlibrary.pri) diff --git a/share/qtcreator/qml/qmlobserver/main.cpp b/share/qtcreator/qml/qmlobserver/main.cpp index 6733265b2f..2adfc2605f 100644 --- a/share/qtcreator/qml/qmlobserver/main.cpp +++ b/share/qtcreator/qml/qmlobserver/main.cpp @@ -184,7 +184,9 @@ int main(int argc, char ** argv) #if defined (Q_OS_WIN) // Debugging output is not visible by default on Windows - // therefore show modal dialog with errors instead. - atexit(showWarnings); + + // (Disabled in QmlObserver: We're usually running inside QtCreator anyway, see also QTCREATORBUG-2748) +// atexit(showWarnings); #endif #if defined (Q_WS_X11) || defined (Q_WS_MAC) @@ -417,10 +419,6 @@ int main(int argc, char ** argv) viewer->setDesignModeBehavior(designModeBehavior); - // FIXME debug mode is always on for qml observer - debuggerModeBehavior = true; - viewer->setDebugMode(debuggerModeBehavior); - foreach (QString lib, imports) viewer->addLibraryPath(lib); diff --git a/share/qtcreator/qml/qmlobserver/qmlobserver.pro b/share/qtcreator/qml/qmlobserver/qmlobserver.pro index d05ca7ee1e..379ca5fb04 100644 --- a/share/qtcreator/qml/qmlobserver/qmlobserver.pro +++ b/share/qtcreator/qml/qmlobserver/qmlobserver.pro @@ -1,5 +1,4 @@ TEMPLATE = app -DEFINES += QMLOBSERVER ### FIXME: only debug plugins are now supported. CONFIG -= release diff --git a/share/qtcreator/qml/qmlobserver/qmlruntime.cpp b/share/qtcreator/qml/qmlobserver/qmlruntime.cpp index d15814c717..36d83d9a00 100644 --- a/share/qtcreator/qml/qmlobserver/qmlruntime.cpp +++ b/share/qtcreator/qml/qmlobserver/qmlruntime.cpp @@ -619,6 +619,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) canvas = new QDeclarativeView(this); observer = new QmlJSDebugger::QDeclarativeViewObserver(canvas, this); + new QmlJSDebugger::JSDebuggerAgent(canvas->engine()); if (!(flags & Qt::FramelessWindowHint)) { m_crumblePathWidget = new CrumblePath(canvas); #ifndef Q_WS_MAC @@ -699,11 +700,6 @@ void QDeclarativeViewer::setDesignModeBehavior(bool value) observer->setDesignModeBehavior(value); } -void QDeclarativeViewer::setDebugMode(bool on) -{ - observer->setDebugMode(on); -} - void QDeclarativeViewer::enableExperimentalGestures() { canvas->viewport()->grabGesture(Qt::TapGesture,Qt::DontStartGestureOnChildren|Qt::ReceivePartialGestures|Qt::IgnoredGesturesPropagateToParent); diff --git a/share/qtcreator/qml/qmlobserver/qmlruntime.h b/share/qtcreator/qml/qmlobserver/qmlruntime.h index eb43579659..630c30c324 100644 --- a/share/qtcreator/qml/qmlobserver/qmlruntime.h +++ b/share/qtcreator/qml/qmlobserver/qmlruntime.h @@ -117,7 +117,6 @@ public: public slots: void setDesignModeBehavior(bool value); - void setDebugMode(bool on); void sceneResized(QSize size); bool open(const QString&); void openFile(); diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/ExtendedPane.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/ExtendedPane.qml index a764d9dcce..5e4ba4f58a 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/ExtendedPane.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/ExtendedPane.qml @@ -7,7 +7,6 @@ QScrollArea { horizontalScrollBarPolicy: "Qt::ScrollBarAlwaysOff"; id: extendedPane; visible: false; - content: properyEditorExtended; QFrame { id: properyEditorExtended layout: QVBoxLayout { diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/ItemPane.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/ItemPane.qml index b4247773de..5689950fe2 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/ItemPane.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/ItemPane.qml @@ -43,7 +43,6 @@ PropertyFrame { horizontalScrollBarPolicy: "Qt::ScrollBarAlwaysOff"; id: standardPane; - content: properyEditorStandard; QFrame { //minimumHeight: 1100 id: properyEditorStandard diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/LayoutPane.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/LayoutPane.qml index 2e4dd0dfb2..efa89e20ea 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/LayoutPane.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/LayoutPane.qml @@ -7,7 +7,6 @@ QScrollArea { horizontalScrollBarPolicy: "Qt::ScrollBarAlwaysOff"; id: layoutPane; visible: false; - content: properyEditorLayout; QFrame { id: properyEditorLayout; layout: QVBoxLayout { diff --git a/share/qtcreator/snippets/qml.xml b/share/qtcreator/snippets/qml.xml index 653b444801..a7f2110caa 100644 --- a/share/qtcreator/snippets/qml.xml +++ b/share/qtcreator/snippets/qml.xml @@ -3,9 +3,8 @@ <snippet>property <tab>type</tab> <tab>name</tab>: <tab>value</tab> </snippet> <snippet>Item { - id: <tab>name</tab> - - } + id: <tab>name</tab> +} </snippet> <snippet>BorderImage { id: <tab>name</tab> @@ -82,15 +81,5 @@ </snippet> <snippet>ColorAnimation { from: <tab>"white"</tab>; to: <tab>"black"</tab>; duration: <tab>200</tab> } </snippet> -<snippet description="Colorize">effect: Colorize { color: "<tab>"red"</tab>" } -</snippet> -<snippet description="Blur">effect: Blur { blurRadius: "<tab>200</tab>" } -</snippet> -<snippet description="DropShadow">effect: DropShadow { - blurRadius: <tab>3</tab> - offset.x: <tab>2</tab> - offset.y: <tab>2</tab> - } -</snippet> </snippets> diff --git a/share/qtcreator/templates/mobileapp/mainwindow.h b/share/qtcreator/templates/mobileapp/mainwindow.h index dc9813dbb7..ce2919bf42 100644 --- a/share/qtcreator/templates/mobileapp/mainwindow.h +++ b/share/qtcreator/templates/mobileapp/mainwindow.h @@ -9,6 +9,7 @@ namespace Ui { class MainWindow : public QMainWindow { + Q_OBJECT public: enum Orientation { LockPortrait, diff --git a/share/qtcreator/templates/qmlapp/app.pro b/share/qtcreator/templates/qmlapp/app.pro index 8cfa591bb9..65afd998cb 100644 --- a/share/qtcreator/templates/qmlapp/app.pro +++ b/share/qtcreator/templates/qmlapp/app.pro @@ -27,10 +27,9 @@ symbian:TARGET.UID3 = 0xE1111234 # and 0x2002CCCF value if protected UID is given to the application #symbian:DEPLOYMENT.installer_header = 0x2002CCCF -# Define QMLJSDEBUGGER to enable basic debugging (setting breakpoints etc) -# Define QMLOBSERVER for advanced features (requires experimental QmlInspector plugin!) -#DEFINES += QMLJSDEBUGGER -#DEFINES += QMLOBSERVER +# Define QMLJSDEBUGGER to allow debugging of QML +# (This might significantly increase build time) +# DEFINES += QMLJSDEBUGGER # The .cpp file which was generated for your project. Feel free to hack it. SOURCES += main.cpp diff --git a/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp b/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp index 2e4adfc3b2..3e2ed95be8 100644 --- a/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -7,10 +7,10 @@ #include <QtDeclarative/QDeclarativeEngine> #include <QtDeclarative/QDeclarativeContext> -#if defined(QMLJSDEBUGGER) +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) #include <jsdebuggeragent.h> #endif -#if defined(QMLOBSERVER) +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) #include <qdeclarativeviewobserver.h> #endif @@ -53,10 +53,10 @@ QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : { connect(engine(), SIGNAL(quit()), SLOT(close())); setResizeMode(QDeclarativeView::SizeRootObjectToView); -#ifdef QMLJSDEBUGGER +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) new QmlJSDebugger::JSDebuggerAgent(engine()); #endif -#ifdef QMLOBSERVER +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) new QmlJSDebugger::QDeclarativeViewObserver(this, parent); #endif } diff --git a/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.pri b/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.pri index 319587d782..5c8ff0585f 100644 --- a/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.pri +++ b/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.pri @@ -7,10 +7,6 @@ SOURCES += $$PWD/qmlapplicationviewer.cpp HEADERS += $$PWD/qmlapplicationviewer.h INCLUDEPATH += $$PWD -contains(DEFINES, QMLOBSERVER) { - DEFINES *= QMLJSDEBUGGER -} - defineTest(minQtVersion) { maj = $$1 min = $$2 diff --git a/share/qtcreator/templates/shared/app.desktop b/share/qtcreator/templates/shared/app.desktop index e9d9304f6b..8ecd3ce3af 100644 --- a/share/qtcreator/templates/shared/app.desktop +++ b/share/qtcreator/templates/shared/app.desktop @@ -4,7 +4,7 @@ Version=1.0 Type=Application Terminal=false Name=thisApp -Exec=/opt/bin/thisApp +Exec=/opt/usr/bin/thisApp Icon=thisApp X-Window-Icon= X-HildonDesk-ShowInToolbar=true diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index 47bbc7da08..e7fee473f7 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -2461,7 +2461,7 @@ Sollen sie überschrieben werden?</translation> </message> <message> <source>Edit Breakpoint...</source> - <translation>Haltepunkts bearbeiten...</translation> + <translation>Haltepunkt bearbeiten...</translation> </message> <message> <source>Associate Breakpoint With All Threads</source> @@ -15638,6 +15638,18 @@ Sie können die Änderungen in einem Stash ablegen oder rücksetzen.</translatio <source><b>Debugging details:</b> Use gdbserver</source> <translation><b>Debuggereinstellung:</b> Benutze Gdb-Server</translation> </message> + <message> + <source>Cancel Fetch Operation</source> + <translation>Abfragen der Umgebung abbrechen</translation> + </message> + <message> + <source>Device error</source> + <translation>Gerätefehler</translation> + </message> + <message> + <source>Fetching environment failed: %1</source> + <translation>Das Abfragen der Umgebung schlug fehl: %1</translation> + </message> <message numerus="yes"> <source>%n local directories to be mounted on the device.</source> <extracomment>Note: Only mountCount>1 will occur here as 0, 1 are handled above.</extracomment> @@ -18073,6 +18085,10 @@ Es wird versucht eine Paketdatei zu erstellen, es können aber Probleme auftrete </message> <message> <source><b>Package Manager Icon:</b></source> + <translation type="obsolete"><b>Paketverwaltungs-Icon:</b></translation> + </message> + <message> + <source><b>Package Manager icon:</b></source> <translation><b>Paketverwaltungs-Icon:</b></translation> </message> </context> @@ -18850,15 +18866,15 @@ Ids müssen außerdem mit einem Kleinbuchstaben beginnen.</translation> <name>MaemoDeployableListWidget</name> <message> <source>Form</source> - <translation>Form</translation> + <translation type="obsolete">Form</translation> </message> <message> <source>Add File to Package</source> - <translation>Datei zu Paket hinzufügen</translation> + <translation type="obsolete">Datei zu Paket hinzufügen</translation> </message> <message> <source>Remove File from Package</source> - <translation>Datei aus Paket entfernen</translation> + <translation type="obsolete">Datei aus Paket entfernen</translation> </message> </context> <context> @@ -18881,7 +18897,11 @@ Ids müssen außerdem mit einem Kleinbuchstaben beginnen.</translation> </message> <message> <source><b>Files to install:</b></source> - <translation><b>Zu installierende Dateien:</b></translation> + <translation type="obsolete"><b>Zu installierende Dateien:</b></translation> + </message> + <message> + <source><b>Files to install for subproject:</b></source> + <translation><b>Zu installierende Dateien des Unterprojektes:</b></translation> </message> </context> <context> @@ -20469,15 +20489,15 @@ Weder der Pfad zur Bibliothek noch der Pfad zu den Headerdateien wird zur .pro-D <name>Qt4ProjectManager::Internal::MaemoDeployableListWidget</name> <message> <source>Choose a local file</source> - <translation>Lokale Datei</translation> + <translation type="obsolete">Lokale Datei</translation> </message> <message> <source>Error adding file</source> - <translation>Fehler beim Hinzufügen der Datei</translation> + <translation type="obsolete">Fehler beim Hinzufügen der Datei</translation> </message> <message> <source>Error removing file</source> - <translation>Fehler beim Entfernen der Datei</translation> + <translation type="obsolete">Fehler beim Entfernen der Datei</translation> </message> </context> <context> @@ -20611,6 +20631,12 @@ Weder der Pfad zur Bibliothek noch der Pfad zu den Headerdateien wird zur .pro-D <source>Error running remote process: %1</source> <translation>Fehler bei Ausführung des Prozesses auf dem Gerät: %1</translation> </message> + <message> + <source> +Remote stderr was: '%1'</source> + <translation> +Fehlerausgabe: '%1'</translation> + </message> </context> <context> <name>Qt4ProjectManager::Internal::MaemoPackageCreationFactory</name> @@ -21295,18 +21321,34 @@ Bitte prüfen Sie die Zugriffsrechte des Ordners.</translation> <context> <name>Debugger::DebuggerEnginePrivate</name> <message> + <source>Remove Breakpoint</source> + <translation>Haltepunkt löschen</translation> + </message> + <message> <source>Remove Breakpoint %1</source> <translation>Haltepunkt %1 löschen</translation> </message> <message> + <source>Disable Breakpoint</source> + <translation>Haltepunkt deaktivieren</translation> + </message> + <message> <source>Disable Breakpoint %1</source> <translation>Haltepunkt %1 deaktivieren</translation> </message> <message> + <source>Enable Breakpoint</source> + <translation>Haltepunkt aktivieren</translation> + </message> + <message> <source>Enable Breakpoint %1</source> <translation>Haltepunkt %1 aktivieren</translation> </message> <message> + <source>Edit Breakpoint...</source> + <translation>Haltepunkt bearbeiten...</translation> + </message> + <message> <source>Edit Breakpoint %1...</source> <translation>Haltepunkt %1 bearbeiten...</translation> </message> diff --git a/src/libs/3rdparty/botan/src/src.pro b/src/libs/3rdparty/botan/src/src.pro index 37b9f01df9..24b3c982e0 100644 --- a/src/libs/3rdparty/botan/src/src.pro +++ b/src/libs/3rdparty/botan/src/src.pro @@ -3,6 +3,8 @@ TARGET = Botan CONFIG += dll +PRECOMPILED_HEADER = ../../precompiled_headers/botan_pch.h + include(../../../../qtcreatorlibrary.pri) DEPENDPATH += . diff --git a/src/libs/3rdparty/precompiled_headers/botan_pch.h b/src/libs/3rdparty/precompiled_headers/botan_pch.h new file mode 100644 index 0000000000..f0a3ccf406 --- /dev/null +++ b/src/libs/3rdparty/precompiled_headers/botan_pch.h @@ -0,0 +1,73 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +#if defined __cplusplus +#include <QtCore/QtGlobal> + +#ifdef Q_WS_WIN +# define _POSIX_ +# include <limits.h> +# undef _POSIX_ +#endif + +#include <botan/stream_cipher.h> +#include <botan/pubkey_enums.h> +#include <botan/filters.h> +#include <botan/libstate.h> +#include <botan/pubkey.h> +#include <botan/rotate.h> +#include <botan/util.h> +#include <botan/xor_buf.h> +#include <botan/look_pk.h> +#include <botan/mac.h> +#include <botan/secmem.h> +#include <botan/pipe.h> +#include <botan/oids.h> +#include <botan/exceptn.h> +#include <botan/der_enc.h> +#include <botan/ber_dec.h> +#include <botan/types.h> +#include <botan/rng.h> +#include <botan/numthry.h> +#include <botan/bigint.h> +#include <botan/botan.h> +#include <botan/hash.h> +#include <botan/loadstor.h> +#include <botan/parsing.h> +#include <botan/block_cipher.h> + +#include <map> +#include <fstream> +#include <memory> +#include <algorithm> +#include <iostream> +#include <vector> +#include <string> + +#endif diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp index 1cdf8e2b5e..bc56065463 100644 --- a/src/libs/qmljs/qmljsbind.cpp +++ b/src/libs/qmljs/qmljsbind.cpp @@ -241,7 +241,7 @@ bool Bind::visit(UiObjectDefinition *ast) // think anchors { ... } bool isGroupedBinding = false; for (UiQualifiedId *it = ast->qualifiedTypeNameId; it; it = it->next) { - if (!it->next) + if (!it->next && it->name) isGroupedBinding = it->name->asString().at(0).isLower(); } diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp index 75379474f2..dfc3025c02 100644 --- a/src/libs/qmljs/qmljsdocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -358,6 +358,7 @@ LibraryInfo::LibraryInfo(const QmlDirParser &parser) : _valid(true) , _components(parser.components()) , _plugins(parser.plugins()) + , _dumped(false) { } diff --git a/src/libs/qmljs/qmljsdocument.h b/src/libs/qmljs/qmljsdocument.h index d4810e9a94..1424961dc6 100644 --- a/src/libs/qmljs/qmljsdocument.h +++ b/src/libs/qmljs/qmljsdocument.h @@ -122,6 +122,7 @@ class QMLJS_EXPORT LibraryInfo QList<QmlDirParser::Plugin> _plugins; typedef QList<const Interpreter::FakeMetaObject *> FakeMetaObjectList; FakeMetaObjectList _metaObjects; + bool _dumped; public: LibraryInfo(); @@ -142,6 +143,12 @@ public: bool isValid() const { return _valid; } + + bool isDumped() const + { return _dumped; } + + void setDumped(bool dumped) + { _dumped = dumped; } }; class QMLJS_EXPORT Snapshot diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index 642e2a0652..ed39a810c3 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -129,6 +129,7 @@ signals: void documentUpdated(QmlJS::Document::Ptr doc); void documentChangedOnDisk(QmlJS::Document::Ptr doc); void aboutToRemoveFiles(const QStringList &files); + void libraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info); }; } // namespace QmlJS diff --git a/src/libs/qmljs/qmljsrewriter.cpp b/src/libs/qmljs/qmljsrewriter.cpp index 17293b34f6..aad4b650ab 100644 --- a/src/libs/qmljs/qmljsrewriter.cpp +++ b/src/libs/qmljs/qmljsrewriter.cpp @@ -256,7 +256,8 @@ QString Rewriter::flatten(UiQualifiedId *first) if (current != first) flatId += '.'; - flatId += current->name->asString(); + if (current->name) + flatId += current->name->asString(); } return flatId; diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp index 2fbdc0403c..e1b4283330 100644 --- a/src/libs/qmljs/qmljsscopebuilder.cpp +++ b/src/libs/qmljs/qmljsscopebuilder.cpp @@ -228,7 +228,7 @@ void ScopeBuilder::setQmlScopeObject(Node *node) if (initializer) { for (UiObjectMemberList *m = initializer->members; m; m = m->next) { if (UiScriptBinding *scriptBinding = cast<UiScriptBinding *>(m->member)) { - if (scriptBinding->qualifiedId + if (scriptBinding->qualifiedId && scriptBinding->qualifiedId->name && scriptBinding->qualifiedId->name->asString() == QLatin1String("target") && ! scriptBinding->qualifiedId->next) { // ### make Evaluate understand statements. @@ -256,6 +256,8 @@ const Value *ScopeBuilder::scopeObjectLookup(AST::UiQualifiedId *id) foreach (const ObjectValue *scopeObject, _context->scopeChain().qmlScopeObjects) { const ObjectValue *object = scopeObject; for (UiQualifiedId *it = id; it; it = it->next) { + if (!it->name) + return 0; result = object->property(it->name->asString(), _context); if (!result) break; diff --git a/src/plugins/coreplugin/progressmanager/futureprogress.cpp b/src/plugins/coreplugin/progressmanager/futureprogress.cpp index 83690dcca1..bb86782bdd 100644 --- a/src/plugins/coreplugin/progressmanager/futureprogress.cpp +++ b/src/plugins/coreplugin/progressmanager/futureprogress.cpp @@ -84,20 +84,24 @@ void FadeWidgetHack::paintEvent(QPaintEvent *) struct FutureProgressPrivate { explicit FutureProgressPrivate(FutureProgress *q); + void tryToFadeAway(); + QFutureWatcher<void> m_watcher; Internal::ProgressBar *m_progress; QWidget *m_widget; QHBoxLayout *m_widgetLayout; QString m_type; - bool m_keep; + FutureProgress::KeepOnFinishType m_keep; bool m_waitingForUserInteraction; Internal::FadeWidgetHack *m_faderWidget; + FutureProgress *m_q; + bool m_isFading; }; FutureProgressPrivate::FutureProgressPrivate(FutureProgress *q) : m_progress(new Internal::ProgressBar), m_widget(0), m_widgetLayout(new QHBoxLayout), - m_keep(false), m_waitingForUserInteraction(false), - m_faderWidget(new Internal::FadeWidgetHack(q)) + m_keep(FutureProgress::DontKeepOnFinish), m_waitingForUserInteraction(false), + m_faderWidget(new Internal::FadeWidgetHack(q)), m_q(q), m_isFading(false) { } @@ -224,7 +228,7 @@ void FutureProgress::setStarted() bool FutureProgress::eventFilter(QObject *, QEvent *e) { - if (d->m_waitingForUserInteraction + if (d->m_keep != KeepOnFinish && d->m_waitingForUserInteraction && (e->type() == QEvent::MouseMove || e->type() == QEvent::KeyPress)) { qApp->removeEventFilter(this); QTimer::singleShot(notificationTimeout, this, SLOT(fadeAway())); @@ -248,14 +252,26 @@ void FutureProgress::setFinished() d->m_progress->setError(false); } emit finished(); - if (d->m_keep) { - d->m_waitingForUserInteraction = true; - qApp->installEventFilter(this); - } else if (!d->m_progress->hasError()) { - QTimer::singleShot(shortNotificationTimeout, this, SLOT(fadeAway())); + d->tryToFadeAway(); +} + +void FutureProgressPrivate::tryToFadeAway() +{ + if (m_isFading) + return; + if (m_keep == FutureProgress::KeepOnFinishTillUserInteraction) { + m_waitingForUserInteraction = true; + //eventfilter is needed to get user interaction + //events to start QTimer::singleShot later + qApp->installEventFilter(m_q); + m_isFading = true; + } else if (m_keep == FutureProgress::DontKeepOnFinish && !m_progress->hasError()) { + QTimer::singleShot(shortNotificationTimeout, m_q, SLOT(fadeAway())); + m_isFading = true; } } + void FutureProgress::setProgressRange(int min, int max) { d->m_progress->setRange(min, max); @@ -343,9 +359,17 @@ QString FutureProgress::type() const return d->m_type; } -void FutureProgress::setKeepOnFinish(bool keep) +void FutureProgress::setKeepOnFinish(KeepOnFinishType keepType) { - d->m_keep = keep; + if (d->m_keep == keepType) { + return; + } + d->m_keep = keepType; + + //if it is not finished tryToFadeAway is called by setFinished at the end + if (d->m_watcher.isFinished()) { + d->tryToFadeAway(); + } } bool FutureProgress::keepOnFinish() const diff --git a/src/plugins/coreplugin/progressmanager/futureprogress.h b/src/plugins/coreplugin/progressmanager/futureprogress.h index 31517a0174..97de028783 100644 --- a/src/plugins/coreplugin/progressmanager/futureprogress.h +++ b/src/plugins/coreplugin/progressmanager/futureprogress.h @@ -46,6 +46,11 @@ class CORE_EXPORT FutureProgress : public QWidget Q_OBJECT public: + enum KeepOnFinishType { + DontKeepOnFinish = 0, + KeepOnFinishTillUserInteraction = 1, + KeepOnFinish = 2 + }; explicit FutureProgress(QWidget *parent = 0); virtual ~FutureProgress(); @@ -60,7 +65,7 @@ public: void setType(const QString &type); QString type() const; - void setKeepOnFinish(bool keep); + void setKeepOnFinish(KeepOnFinishType keepType); bool keepOnFinish() const; bool hasError() const; diff --git a/src/plugins/coreplugin/progressmanager/progressview.cpp b/src/plugins/coreplugin/progressmanager/progressview.cpp index 35d3032860..eef9e56a28 100644 --- a/src/plugins/coreplugin/progressmanager/progressview.cpp +++ b/src/plugins/coreplugin/progressmanager/progressview.cpp @@ -69,7 +69,11 @@ FutureProgress *ProgressView::addTask(const QFuture<void> &future, m_layout->insertWidget(0, progress); m_taskList.append(progress); progress->setType(type); - progress->setKeepOnFinish(flags & ProgressManager::KeepOnFinish); + if (flags.testFlag(ProgressManager::KeepOnFinish)) { + progress->setKeepOnFinish(FutureProgress::KeepOnFinishTillUserInteraction); + } else { + progress->setKeepOnFinish(FutureProgress::DontKeepOnFinish); + } connect(progress, SIGNAL(removeMe()), this, SLOT(slotRemoveTask())); return progress; } diff --git a/src/plugins/coreplugin/rssfetcher.cpp b/src/plugins/coreplugin/rssfetcher.cpp index ed657ba991..114c6df41a 100644 --- a/src/plugins/coreplugin/rssfetcher.cpp +++ b/src/plugins/coreplugin/rssfetcher.cpp @@ -40,6 +40,7 @@ #include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkProxyFactory> #include <QtNetwork/QNetworkAccessManager> +#include <QtNetwork/QNetworkConfiguration> #include <QtCore/QXmlStreamReader> @@ -142,6 +143,7 @@ void RssFetcher::fetch(const QUrl &url) req.setRawHeader("User-Agent", agentStr.toLatin1()); if (!m_networkAccessManager) { m_networkAccessManager = new QNetworkAccessManager; + m_networkAccessManager->setConfiguration(QNetworkConfiguration()); connect(m_networkAccessManager, SIGNAL(finished(QNetworkReply*)), SLOT(fetchingFinished(QNetworkReply*))); } diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 3a68ad24ca..8df0b90f3c 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -40,6 +40,7 @@ #include <texteditor/basetextmark.h> #include <utils/qtcassert.h> +#include <QtCore/QDir> #include <QtCore/QByteArray> #include <QtCore/QFileInfo> @@ -50,6 +51,8 @@ namespace Internal { static DebuggerPlugin *plugin() { return DebuggerPlugin::instance(); } +static Breakpoints m_bp; + ////////////////////////////////////////////////////////////////// // // BreakHandler @@ -65,8 +68,6 @@ BreakHandler::BreakHandler(Debugger::DebuggerEngine *engine) //m_emptyIcon(_(":/debugger/images/debugger_empty_14.png")), m_watchpointIcon(_(":/debugger/images/watchpoint.png")), m_engine(engine), - m_bp(0), - m_masterList(false), m_lastFound(0), m_lastFoundQueried(false) { @@ -75,11 +76,6 @@ BreakHandler::BreakHandler(Debugger::DebuggerEngine *engine) BreakHandler::~BreakHandler() { - if (m_bp && m_masterList) { - qDeleteAll(*m_bp); - m_bp->clear(); - delete m_bp; - } clear(); } @@ -104,15 +100,14 @@ bool BreakHandler::hasPendingBreakpoints() const BreakpointData *BreakHandler::at(int index) const { QTC_ASSERT(index < size(), return 0); - QTC_ASSERT(m_bp,/**/); - return m_bp->at(index); + return m_bp.at(index); } void BreakHandler::removeAt(int index) { - QTC_ASSERT(m_bp,/**/); BreakpointData *data = at(index); - m_bp->removeAt(index); + QTC_ASSERT(data, return); + m_bp.removeAt(index); delete data; } @@ -125,10 +120,9 @@ void BreakHandler::clear() BreakpointData *BreakHandler::findSimilarBreakpoint(const BreakpointData *needle) const { - QTC_ASSERT(m_bp, /**/); // Search a breakpoint we might refer to. for (int index = 0; index != size(); ++index) { - BreakpointData *data = (*m_bp)[index]; + BreakpointData *data = m_bp[index]; if (data->isSimilarTo(needle)) return data; } @@ -345,7 +339,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const // str = data->markerFileName; str = str.isEmpty() ? empty : str; if (data->useFullPath) - str = "/.../" + str; + str = QDir::toNativeSeparators(QLatin1String("/.../") + str); return str; } break; @@ -523,9 +517,8 @@ void BreakHandler::reinsertBreakpoint(BreakpointData *data) void BreakHandler::append(BreakpointData *data) { - QTC_ASSERT(m_bp, return); data->m_handler = this; - m_bp->append(data); + m_bp.append(data); } Breakpoints BreakHandler::takeRemovedBreakpoints() @@ -551,9 +544,9 @@ Breakpoints BreakHandler::takeDisabledBreakpoints() void BreakHandler::removeBreakpointHelper(int index) { - QTC_ASSERT(m_bp, return); - BreakpointData *data = m_bp->at(index); - m_bp->removeAt(index); + BreakpointData *data = at(index); + QTC_ASSERT(data, return); + m_bp.removeAt(index); data->removeMarker(); m_removed.append(data); } @@ -568,8 +561,7 @@ void BreakHandler::removeBreakpoint(int index) void BreakHandler::removeBreakpoint(BreakpointData *data) { - QTC_ASSERT(m_bp, return); - removeBreakpointHelper(m_bp->indexOf(data)); + removeBreakpointHelper(indexOf(data)); emit layoutChanged(); } @@ -614,8 +606,7 @@ void BreakHandler::removeAllBreakpoints() BreakpointData *BreakHandler::findBreakpoint(quint64 address) const { - QTC_ASSERT(m_bp, return 0); - foreach (BreakpointData *data, *m_bp) + foreach (BreakpointData *data, m_bp) if (data->address == address) return data; return 0; @@ -624,8 +615,7 @@ BreakpointData *BreakHandler::findBreakpoint(quint64 address) const BreakpointData *BreakHandler::findBreakpoint(const QString &fileName, int lineNumber, bool useMarkerPosition) { - QTC_ASSERT(m_bp, return 0); - foreach (BreakpointData *data, *m_bp) + foreach (BreakpointData *data, m_bp) if (data->isLocatedAt(fileName, lineNumber, useMarkerPosition)) return data; return 0; @@ -668,19 +658,11 @@ void BreakHandler::saveSessionData() saveBreakpoints(); } -void BreakHandler::initMasterList() -{ - if (m_bp) { - delete m_bp; - } - m_masterList = true; - m_bp = new Breakpoints; -} - void BreakHandler::loadSessionData() { QTC_ASSERT(m_engine->isSessionEngine(), return); - initMasterList(); + qDeleteAll(m_bp); + m_bp.clear(); loadBreakpoints(); updateMarkers(); } @@ -708,20 +690,11 @@ bool BreakHandler::isActive() const return m_engine->isActive(); } -bool BreakHandler::isMasterList() const -{ - return m_masterList; -} - void BreakHandler::initializeFromTemplate(BreakHandler *other) { - QTC_ASSERT(other->isMasterList(), return); - QTC_ASSERT(!isMasterList(), return); - QTC_ASSERT(other->m_bp, return); - - m_bp = other->m_bp; + Q_UNUSED(other) m_inserted.clear(); - foreach(BreakpointData *data, *m_bp) { + foreach(BreakpointData *data, m_bp) { if (m_engine->acceptsBreakpoint(data)) { data->m_handler = this; m_inserted.append(data); @@ -731,15 +704,22 @@ void BreakHandler::initializeFromTemplate(BreakHandler *other) void BreakHandler::storeToTemplate(BreakHandler *other) { - QTC_ASSERT(m_bp, return); - foreach (BreakpointData *data, *m_bp) { + foreach (BreakpointData *data, m_bp) { data->m_handler = other; data->clear(); } - m_bp = 0; - other->saveSessionData(); } +int BreakHandler::size() const +{ + return m_bp.size(); +} + +int BreakHandler::indexOf(BreakpointData *data) +{ + return m_bp.indexOf(data); +} + } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h index f14d674f98..39de2c9044 100644 --- a/src/plugins/debugger/breakhandler.h +++ b/src/plugins/debugger/breakhandler.h @@ -64,11 +64,11 @@ public: QAbstractItemModel *model() { return this; } BreakpointData *at(int index) const; - int size() const { return m_bp?m_bp->size():0; } + int size() const; bool hasPendingBreakpoints() const; void removeAt(int index); // This also deletes the marker. void clear(); // This also deletes all the marker. - int indexOf(BreakpointData *data) { return m_bp?m_bp->indexOf(data):-1; } + int indexOf(BreakpointData *data); // Find a breakpoint matching approximately the data in needle. BreakpointData *findSimilarBreakpoint(const BreakpointData *needle) const; BreakpointData *findBreakpointByNumber(int bpNumber) const; @@ -76,7 +76,6 @@ public: bool watchPointAt(quint64 address) const; void updateMarkers(); bool isActive() const; - bool isMasterList() const; Breakpoints takeRemovedBreakpoints(); // Owned. Breakpoints takeEnabledBreakpoints(); // Not owned. @@ -120,8 +119,6 @@ private: void removeBreakpointHelper(int index); void append(BreakpointData *data); - void initMasterList(); - const QIcon m_breakpointIcon; const QIcon m_disabledBreakpointIcon; const QIcon m_pendingBreakPointIcon; @@ -129,14 +126,11 @@ private: const QIcon m_watchpointIcon; Debugger::DebuggerEngine *m_engine; // Not owned. - Breakpoints *m_bp; Breakpoints m_inserted; // Lately inserted breakpoints. Breakpoints m_removed; // Lately removed breakpoints. Breakpoints m_enabled; // Lately enabled breakpoints. Breakpoints m_disabled; // Lately disabled breakpoints. - bool m_masterList; - // Hack for BreakWindow::findSimilarBreakpoint mutable BreakpointData *m_lastFound; mutable bool m_lastFoundQueried; diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp index 11175b010c..1235e8ce14 100644 --- a/src/plugins/debugger/breakpoint.cpp +++ b/src/plugins/debugger/breakpoint.cpp @@ -289,7 +289,7 @@ QString BreakpointData::toToolTip() const << "<tr><td>" << BreakHandler::tr("Internal Number:") << "</td><td>—</td><td>" << bpNumber << "</td></tr>" << "<tr><td>" << BreakHandler::tr("File Name:") - << "</td><td>" << fileName << "</td><td>" << QDir::toNativeSeparators(bpFileName) << "</td></tr>" + << "</td><td>" << QDir::toNativeSeparators(fileName) << "</td><td>" << QDir::toNativeSeparators(bpFileName) << "</td></tr>" << "<tr><td>" << BreakHandler::tr("Function Name:") << "</td><td>" << funcName << "</td><td>" << bpFuncName << "</td></tr>" << "<tr><td>" << BreakHandler::tr("Line Number:") << "</td><td>"; diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 35833637a7..9e59a1abf4 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -387,7 +387,11 @@ void DebuggerEnginePrivate::handleContextMenuRequest(const QVariant ¶meters) if (data) { // existing breakpoint const QString number = QString::fromAscii(data->bpNumber); - QAction *act = new QAction(tr("Remove Breakpoint %1").arg(number), menu); + QAction *act; + if (number.isEmpty()) + act = new QAction(tr("Remove Breakpoint"), menu); + else + act = new QAction(tr("Remove Breakpoint %1").arg(number), menu); act->setData(args); connect(act, SIGNAL(triggered()), this, SLOT(breakpointSetRemoveMarginActionTriggered())); @@ -395,14 +399,24 @@ void DebuggerEnginePrivate::handleContextMenuRequest(const QVariant ¶meters) QAction *act2; if (data->enabled) - act2 = new QAction(tr("Disable Breakpoint %1").arg(number), menu); + if (number.isEmpty()) + act2 = new QAction(tr("Disable Breakpoint"), menu); + else + act2 = new QAction(tr("Disable Breakpoint %1").arg(number), menu); else - act2 = new QAction(tr("Enable Breakpoint %1").arg(number), menu); + if (number.isEmpty()) + act2 = new QAction(tr("Enable Breakpoint"), menu); + else + act2 = new QAction(tr("Enable Breakpoint %1").arg(number), menu); act2->setData(args); connect(act2, SIGNAL(triggered()), this, SLOT(breakpointEnableDisableMarginActionTriggered())); menu->addAction(act2); - QAction *editAction = new QAction(tr("Edit Breakpoint %1...").arg(number), menu); + QAction *editAction; + if (number.isEmpty()) + editAction = new QAction(tr("Edit Breakpoint..."), menu); + else + editAction = new QAction(tr("Edit Breakpoint %1...").arg(number), menu); connect(editAction, SIGNAL(triggered()), this, SLOT(slotEditBreakpoint())); editAction->setData(qVariantFromValue(data)); menu->addAction(editAction); @@ -768,7 +782,7 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) Core::FutureProgress *fp = Core::ICore::instance()->progressManager() ->addTask(d->m_progress.future(), tr("Launching"), _("Debugger.Launcher")); - fp->setKeepOnFinish(false); + fp->setKeepOnFinish(Core::FutureProgress::DontKeepOnFinish); d->m_progress.reportStarted(); } QTC_ASSERT(runControl, notifyEngineSetupFailed(); return); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index f00f908a79..7a605bcf07 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -999,7 +999,7 @@ public: QComboBox *m_threadBox; QDockWidget *m_breakDock; - QDockWidget *m_consoleDock; + //QDockWidget *m_consoleDock; QDockWidget *m_modulesDock; QDockWidget *m_outputDock; QDockWidget *m_registerDock; @@ -1013,7 +1013,7 @@ public: DebuggerActions m_actions; BreakWindow *m_breakWindow; - ConsoleWindow *m_consoleWindow; + //ConsoleWindow *m_consoleWindow; QTreeView *m_returnWindow; QTreeView *m_localsWindow; QTreeView *m_watchersWindow; @@ -1047,7 +1047,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) m_threadBox = 0; m_breakDock = 0; - m_consoleDock = 0; + //m_consoleDock = 0; m_modulesDock = 0; m_outputDock = 0; m_registerDock = 0; @@ -1126,8 +1126,8 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er m_breakWindow = new BreakWindow; m_breakWindow->setObjectName(QLatin1String("CppDebugBreakpoints")); - m_consoleWindow = new ConsoleWindow; - m_consoleWindow->setObjectName(QLatin1String("CppDebugConsole")); + //m_consoleWindow = new ConsoleWindow; + //m_consoleWindow->setObjectName(QLatin1String("CppDebugConsole")); m_modulesWindow = new ModulesWindow; m_modulesWindow->setObjectName(QLatin1String("CppDebugModules")); m_logWindow = new LogWindow; @@ -1294,9 +1294,9 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er m_breakDock = m_uiSwitcher->createDockWidget(CppLanguage, m_breakWindow); m_breakDock->setObjectName(QString(DOCKWIDGET_BREAK)); - m_consoleDock = m_uiSwitcher->createDockWidget(CppLanguage, m_consoleWindow, - Qt::TopDockWidgetArea); - m_consoleDock->setObjectName(QString(DOCKWIDGET_OUTPUT)); + //m_consoleDock = m_uiSwitcher->createDockWidget(CppLanguage, m_consoleWindow, + // Qt::TopDockWidgetArea); + //m_consoleDock->setObjectName(QString(DOCKWIDGET_OUTPUT)); m_modulesDock = m_uiSwitcher->createDockWidget(CppLanguage, m_modulesWindow, Qt::TopDockWidgetArea); @@ -2096,22 +2096,22 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine, bool notify) notifyCurrentEngine(RequestActivationRole, true); } -static void changeFontSize(QWidget *widget, int size) +static void changeFontSize(QWidget *widget, qreal size) { QFont font = widget->font(); - font.setPointSize(size); + font.setPointSizeF(size); widget->setFont(font); } void DebuggerPluginPrivate::fontSettingsChanged (const TextEditor::FontSettings &settings) { - int size = settings.fontZoom() * settings.fontSize() / 100; + qreal size = settings.fontZoom() * settings.fontSize() / 100.; changeFontSize(m_breakWindow, size); changeFontSize(m_logWindow, size); changeFontSize(m_localsWindow, size); changeFontSize(m_modulesWindow, size); - changeFontSize(m_consoleWindow, size); + //changeFontSize(m_consoleWindow, size); changeFontSize(m_registerWindow, size); changeFontSize(m_returnWindow, size); changeFontSize(m_sourceFilesWindow, size); @@ -2150,7 +2150,7 @@ void DebuggerPluginPrivate::setBusyCursor(bool busy) m_busy = busy; QCursor cursor(busy ? Qt::BusyCursor : Qt::ArrowCursor); m_breakWindow->setCursor(cursor); - m_consoleWindow->setCursor(cursor); + //m_consoleWindow->setCursor(cursor); m_localsWindow->setCursor(cursor); m_modulesWindow->setCursor(cursor); m_logWindow->setCursor(cursor); @@ -2178,7 +2178,7 @@ void DebuggerPluginPrivate::setSimpleDockWidgetArrangement } foreach (QDockWidget *dockWidget, dockWidgets) { - if (dockWidget == m_outputDock || dockWidget == m_consoleDock) { + if (dockWidget == m_outputDock /*|| dockWidget == m_consoleDock*/) { mw->addDockWidget(Qt::TopDockWidgetArea, dockWidget); } else { mw->addDockWidget(Qt::BottomDockWidgetArea, dockWidget); @@ -2701,7 +2701,7 @@ void DebuggerPlugin::showMessage(const QString &msg, int channel, int timeout) { //qDebug() << "PLUGIN OUTPUT: " << channel << msg; LogWindow *ow = d->m_logWindow; - ConsoleWindow *cw = d->m_consoleWindow; + //ConsoleWindow *cw = d->m_consoleWindow; QTC_ASSERT(ow, return); switch (channel) { case StatusBar: @@ -2721,7 +2721,7 @@ void DebuggerPlugin::showMessage(const QString &msg, int channel, int timeout) break; default: ow->showOutput(channel, msg); - cw->showOutput(channel, msg); + //cw->showOutput(channel, msg); break; } } diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 990b154eb6..03b2853f93 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -537,6 +537,9 @@ bool DebuggerRunControl::checkDebugConfiguration(int toolChain, bool success = true; + if (!(DebuggerPlugin::instance()->activeLanguages() & CppLanguage)) + return success; + switch(toolChain) { case ProjectExplorer::ToolChain::GCC: case ProjectExplorer::ToolChain::LINUX_ICC: diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 168b660478..5ceaf13f38 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4154,11 +4154,9 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr postCommand("set width 0"); postCommand("set height 0"); - // Work around http://bugreports.qt.nokia.com/browse/QTCREATORBUG-2004 - postCommand("maintenance set internal-warning quit no"); - postCommand("maintenance set internal-error quit no"); - - if (m_isMacGdb) { + if (false && m_isMacGdb) { + // FIXME: m_isMacGdb is only known after handleShowVersion! + // also, setting load-rules seems to be only possible after 'file' postCommand("-gdb-set inferior-auto-start-cfm off"); postCommand("-gdb-set sharedLibrary load-rules " "dyld \".*libSystem.*\" all " @@ -4170,6 +4168,10 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr "dyld \".*libobjc.*\" all " "dyld \".*CarbonDataFormatters.*\" all"); } else { + // Work around http://bugreports.qt.nokia.com/browse/QTCREATORBUG-2004 + postCommand("maintenance set internal-warning quit no", ConsoleCommand); + postCommand("maintenance set internal-error quit no", ConsoleCommand); + // We know that we don't have Python on Mac. loadPythonDumpers(); } diff --git a/src/plugins/git/clonewizardpage.cpp b/src/plugins/git/clonewizardpage.cpp index db4dd17e2a..644ec060b7 100644 --- a/src/plugins/git/clonewizardpage.cpp +++ b/src/plugins/git/clonewizardpage.cpp @@ -62,7 +62,7 @@ bool CloneWizardPagePrivate::urlIsLocal(const QString &url) { if (url.startsWith(QLatin1String("file://")) || url.startsWith(QLatin1Char('/')) - || url.at(0).isLetter() && url.at(1) == QChar(':') && url.at(2) == QChar('\\')) + || (url.at(0).isLetter() && url.at(1) == QChar(':') && url.at(2) == QChar('\\'))) return true; return false; } diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index b608c35bd4..854ef23c16 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -402,7 +402,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) globalcontext, true, &GitClient::status); createRepositoryAction(actionManager, gitContainer, - tr("Reset..."), QLatin1String("Git.UndoRepository"), + tr("Undo Uncommited Changes..."), QLatin1String("Git.UndoRepository"), globalcontext, false, SLOT(undoRepositoryChanges())); @@ -622,10 +622,10 @@ void GitPlugin::undoRepositoryChanges() { const VCSBase::VCSBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return) - const QString msg = tr("Revert all pending changes to the repository\n%1?").arg(QDir::toNativeSeparators(state.topLevel())); + const QString msg = tr("Undo all pending changes to the repository\n%1?").arg(QDir::toNativeSeparators(state.topLevel())); const QMessageBox::StandardButton answer = QMessageBox::question(m_core->mainWindow(), - tr("Revert"), msg, + tr("Undo Changes"), msg, QMessageBox::Yes|QMessageBox::No, QMessageBox::No); if (answer == QMessageBox::No) diff --git a/src/plugins/git/settingspage.ui b/src/plugins/git/settingspage.ui index b474e19a08..386de3f01b 100644 --- a/src/plugins/git/settingspage.ui +++ b/src/plugins/git/settingspage.ui @@ -131,14 +131,14 @@ <item row="5" column="0" colspan="2"> <widget class="QCheckBox" name="omitAnnotationDataCheckBox"> <property name="text"> - <string>Omit date from annotation output</string> + <string>Omit date from blame output</string> </property> </widget> </item> <item row="6" column="0" colspan="2"> <widget class="QCheckBox" name="spaceIgnorantBlameCheckBox"> <property name="text"> - <string>Ignore whitespace changes in annotation and diff</string> + <string>Ignore whitespace changes in blame and diff</string> </property> </widget> </item> diff --git a/src/plugins/locator/locatorwidget.cpp b/src/plugins/locator/locatorwidget.cpp index 7ada35794f..87759ff57e 100644 --- a/src/plugins/locator/locatorwidget.cpp +++ b/src/plugins/locator/locatorwidget.cpp @@ -29,17 +29,10 @@ #include <qglobal.h> -namespace Locator { -struct FilterEntry; -} - -QT_BEGIN_NAMESPACE -unsigned int qHash(const Locator::FilterEntry &entry); -QT_END_NAMESPACE - #include "locatorwidget.h" #include "locatorplugin.h" #include "locatorconstants.h" +#include "ilocatorfilter.h" #include <extensionsystem/pluginmanager.h> #include <coreplugin/icore.h> @@ -117,20 +110,18 @@ private: }; } // namespace Internal -} // namespace Locator - -using namespace Locator; -using namespace Locator::Internal; -QT_BEGIN_NAMESPACE uint qHash(const FilterEntry &entry) { if (entry.internalData.canConvert(QVariant::String)) - return qHash(entry.internalData.toString()); - return qHash(entry.internalData.constData()); + return QT_PREPEND_NAMESPACE(qHash)(entry.internalData.toString()); + return QT_PREPEND_NAMESPACE(qHash)(entry.internalData.constData()); } -QT_END_NAMESPACE +} // namespace Locator + +using namespace Locator; +using namespace Locator::Internal; // =========== LocatorModel =========== diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 56803bdeb8..c9a968f08a 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -270,17 +270,11 @@ void CustomExecutableConfigurationWidget::termToggled(bool on) void CustomExecutableConfigurationWidget::changed() { - const QString &executable = m_runConfiguration->rawExecutable(); - QString text = tr("No Executable specified."); - if (!executable.isEmpty()) - text = tr("Running executable: <b>%1</b> %2"). - arg(executable, - Utils::Environment::joinArgumentList(m_runConfiguration->commandLineArguments())); - // We triggered the change, don't update us if (m_ignoreChange) return; - m_executableChooser->setPath(executable); + + m_executableChooser->setPath(m_runConfiguration->rawExecutable()); m_commandLineArgumentsLineEdit->setText(Utils::Environment::joinArgumentList(m_runConfiguration->baseCommandLineArguments())); m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory()); m_useTerminalCheck->setChecked(m_runConfiguration->runMode() == LocalApplicationRunConfiguration::Console); @@ -376,7 +370,7 @@ QString CustomExecutableRunConfiguration::executable() const return QString(); } } - return m_executable; + return exec; } QString CustomExecutableRunConfiguration::rawExecutable() const diff --git a/src/plugins/projectexplorer/outputformatter.cpp b/src/plugins/projectexplorer/outputformatter.cpp index 6c7ab905e4..e42796ddd5 100644 --- a/src/plugins/projectexplorer/outputformatter.cpp +++ b/src/plugins/projectexplorer/outputformatter.cpp @@ -88,7 +88,7 @@ void OutputFormatter::clearLastLine() cursor.removeSelectedText(); } -static QColor mix_colors(QColor a, QColor b) +QColor OutputFormatter::mixColors(const QColor &a, const QColor &b) { return QColor((a.red() + 2 * b.red()) / 3, (a.green() + 2 * b.green()) / 3, (a.blue() + 2* b.blue()) / 3, (a.alpha() + 2 * b.alpha()) / 3); @@ -107,11 +107,11 @@ void OutputFormatter::initFormats() // NormalMessageFormat m_formats[NormalMessageFormat].setFont(boldFont); - m_formats[NormalMessageFormat].setForeground(mix_colors(p.color(QPalette::Text), QColor(Qt::blue))); + m_formats[NormalMessageFormat].setForeground(mixColors(p.color(QPalette::Text), QColor(Qt::blue))); // ErrorMessageFormat m_formats[ErrorMessageFormat].setFont(boldFont); - m_formats[ErrorMessageFormat].setForeground(mix_colors(p.color(QPalette::Text), QColor(Qt::red))); + m_formats[ErrorMessageFormat].setForeground(mixColors(p.color(QPalette::Text), QColor(Qt::red))); // StdOutFormat m_formats[StdOutFormat].setFont(font); @@ -119,7 +119,7 @@ void OutputFormatter::initFormats() // StdErrFormat m_formats[StdErrFormat].setFont(font); - m_formats[StdErrFormat].setForeground(mix_colors(p.color(QPalette::Text), QColor(Qt::red))); + m_formats[StdErrFormat].setForeground(mixColors(p.color(QPalette::Text), QColor(Qt::red))); } void OutputFormatter::handleLink(const QString &href) diff --git a/src/plugins/projectexplorer/outputformatter.h b/src/plugins/projectexplorer/outputformatter.h index 81001e16cf..283e7a3a76 100644 --- a/src/plugins/projectexplorer/outputformatter.h +++ b/src/plugins/projectexplorer/outputformatter.h @@ -34,6 +34,7 @@ #include <QtCore/QObject> #include <QtCore/QString> +#include <QtGui/QColor> QT_FORWARD_DECLARE_CLASS(QMouseEvent); QT_FORWARD_DECLARE_CLASS(QPlainTextEdit); @@ -71,6 +72,8 @@ protected: void clearLastLine(); QTextCharFormat format(Format format); + static QColor mixColors(const QColor &a, const QColor &b); + private: QPlainTextEdit *m_plainTextEdit; QTextCharFormat *m_formats; diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 52d6a545b1..39ec9976de 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -749,6 +749,8 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) : m_semanticHighlighter->setModelManager(m_modelManager); connect(m_modelManager, SIGNAL(documentUpdated(QmlJS::Document::Ptr)), this, SLOT(onDocumentUpdated(QmlJS::Document::Ptr))); + connect(m_modelManager, SIGNAL(libraryInfoUpdated(QString,QmlJS::LibraryInfo)), + this, SLOT(forceSemanticRehighlight())); connect(this->document(), SIGNAL(modificationChanged(bool)), this, SLOT(modificationChanged(bool))); } diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index d3f9de96a0..ff7f106c7b 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -468,7 +468,7 @@ private: bool checkBindingName(UiQualifiedId *id) { - if (id && !id->next && containsOffset(id->identifierToken)) { + if (id && id->name && !id->next && containsOffset(id->identifierToken)) { _result.second = id->name->asString(); return true; } diff --git a/src/plugins/qmljseditor/qmljsmodelmanager.cpp b/src/plugins/qmljseditor/qmljsmodelmanager.cpp index f30357ff64..27cf5c1ced 100644 --- a/src/plugins/qmljseditor/qmljsmodelmanager.cpp +++ b/src/plugins/qmljseditor/qmljsmodelmanager.cpp @@ -69,11 +69,6 @@ ModelManager::ModelManager(QObject *parent): qRegisterMetaType<QmlJS::Document::Ptr>("QmlJS::Document::Ptr"); qRegisterMetaType<QmlJS::LibraryInfo>("QmlJS::LibraryInfo"); - connect(this, SIGNAL(documentUpdated(QmlJS::Document::Ptr)), - this, SLOT(onDocumentUpdated(QmlJS::Document::Ptr))); - connect(this, SIGNAL(libraryInfoUpdated(QString,QmlJS::LibraryInfo)), - this, SLOT(onLibraryInfoUpdated(QString,QmlJS::LibraryInfo))); - loadQmlTypeDescriptions(); m_defaultImportPaths << environmentImportPaths(); @@ -215,24 +210,22 @@ void ModelManager::updateProjectInfo(const ProjectInfo &pinfo) void ModelManager::emitDocumentChangedOnDisk(Document::Ptr doc) { emit documentChangedOnDisk(doc); } -void ModelManager::emitDocumentUpdated(Document::Ptr doc) -{ emit documentUpdated(doc); } - -void ModelManager::onDocumentUpdated(Document::Ptr doc) +void ModelManager::updateDocument(Document::Ptr doc) { - QMutexLocker locker(&m_mutex); - - _snapshot.insert(doc); + { + QMutexLocker locker(&m_mutex); + _snapshot.insert(doc); + } + emit documentUpdated(doc); } -void ModelManager::emitLibraryInfoUpdated(const QString &path, const LibraryInfo &info) -{ emit libraryInfoUpdated(path, info); } - -void ModelManager::onLibraryInfoUpdated(const QString &path, const LibraryInfo &info) +void ModelManager::updateLibraryInfo(const QString &path, const LibraryInfo &info) { - QMutexLocker locker(&m_mutex); - - _snapshot.insertLibraryInfo(path, info); + { + QMutexLocker locker(&m_mutex); + _snapshot.insertLibraryInfo(path, info); + } + emit libraryInfoUpdated(path, info); } static QStringList qmlFilesInDirectory(const QString &path) @@ -318,7 +311,7 @@ static void findNewLibraryImports(const Document::Ptr &doc, const Snapshot &snap qmldirParser.setSource(qmldirData); qmldirParser.parse(); - modelManager->emitLibraryInfoUpdated(QFileInfo(qmldirFile).absolutePath(), + modelManager->updateLibraryInfo(QFileInfo(qmldirFile).absolutePath(), LibraryInfo(qmldirParser)); // scan the qml files in the library @@ -405,7 +398,7 @@ void ModelManager::parse(QFutureInterface<void> &future, files.append(file); } - modelManager->emitDocumentUpdated(doc); + modelManager->updateDocument(doc); if (emitDocChangedOnDisk) modelManager->emitDocumentChangedOnDisk(doc); } @@ -472,6 +465,8 @@ void ModelManager::onLoadPluginTypes(const QString &libraryPath, const QString & const QString canonicalLibraryPath = QDir::cleanPath(libraryPath); if (m_runningQmldumps.values().contains(canonicalLibraryPath)) return; + if (_snapshot.libraryInfo(canonicalLibraryPath).isDumped()) + return; ProjectExplorer::Project *activeProject = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject(); if (!activeProject) @@ -526,36 +521,33 @@ void ModelManager::qmlPluginTypeDumpDone(int exitCode) process->deleteLater(); const QString libraryPath = m_runningQmldumps.take(process); + LibraryInfo libraryInfo = _snapshot.libraryInfo(libraryPath); + libraryInfo.setDumped(true); if (exitCode != 0) { Core::MessageManager *messageManager = Core::MessageManager::instance(); messageManager->printToOutputPane(qmldumpErrorMessage(libraryPath, process->readAllStandardError())); - return; } const QByteArray output = process->readAllStandardOutput(); QMap<QString, Interpreter::FakeMetaObject *> newObjects; const QString error = Interpreter::CppQmlTypesLoader::parseQmlTypeXml(output, &newObjects); - if (!error.isEmpty()) - return; - - // convert from QList<T *> to QList<const T *> - QList<const Interpreter::FakeMetaObject *> objectsList; - QMapIterator<QString, Interpreter::FakeMetaObject *> it(newObjects); - while (it.hasNext()) { - it.next(); - objectsList.append(it.value()); - } - - QMutexLocker locker(&m_mutex); - if (!libraryPath.isEmpty()) { - LibraryInfo libraryInfo = _snapshot.libraryInfo(libraryPath); + if (exitCode == 0 && error.isEmpty()) { + // convert from QList<T *> to QList<const T *> + QList<const Interpreter::FakeMetaObject *> objectsList; + QMapIterator<QString, Interpreter::FakeMetaObject *> it(newObjects); + while (it.hasNext()) { + it.next(); + objectsList.append(it.value()); + } libraryInfo.setMetaObjects(objectsList); - _snapshot.insertLibraryInfo(libraryPath, libraryInfo); - } else { - Interpreter::CppQmlTypesLoader::builtinObjects.append(objectsList); + if (libraryPath.isEmpty()) + Interpreter::CppQmlTypesLoader::builtinObjects.append(objectsList); } + + if (!libraryPath.isEmpty()) + updateLibraryInfo(libraryPath, libraryInfo); } void ModelManager::qmlPluginTypeDumpError(QProcess::ProcessError) @@ -569,4 +561,10 @@ void ModelManager::qmlPluginTypeDumpError(QProcess::ProcessError) Core::MessageManager *messageManager = Core::MessageManager::instance(); messageManager->printToOutputPane(qmldumpErrorMessage(libraryPath, process->readAllStandardError())); + + if (!libraryPath.isEmpty()) { + LibraryInfo libraryInfo = _snapshot.libraryInfo(libraryPath); + libraryInfo.setDumped(true); + updateLibraryInfo(libraryPath, libraryInfo); + } } diff --git a/src/plugins/qmljseditor/qmljsmodelmanager.h b/src/plugins/qmljseditor/qmljsmodelmanager.h index bc829e6010..842ba4a4fd 100644 --- a/src/plugins/qmljseditor/qmljsmodelmanager.h +++ b/src/plugins/qmljseditor/qmljsmodelmanager.h @@ -65,8 +65,8 @@ public: virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const; virtual void updateProjectInfo(const ProjectInfo &pinfo); - void emitDocumentUpdated(QmlJS::Document::Ptr doc); - void emitLibraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info); + void updateDocument(QmlJS::Document::Ptr doc); + void updateLibraryInfo(const QString &path, const QmlJS::LibraryInfo &info); void emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc); virtual QStringList importPaths() const; @@ -75,12 +75,8 @@ public: Q_SIGNALS: void projectPathChanged(const QString &projectPath); - void libraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info); private Q_SLOTS: - // this should be executed in the GUI thread. - void onDocumentUpdated(QmlJS::Document::Ptr doc); - void onLibraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info); void onLoadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri); void qmlPluginTypeDumpDone(int exitCode); void qmlPluginTypeDumpError(QProcess::ProcessError error); diff --git a/src/plugins/qmljsinspector/qmljsinspector.cpp b/src/plugins/qmljsinspector/qmljsinspector.cpp index 47a4783bd8..7d00423d97 100644 --- a/src/plugins/qmljsinspector/qmljsinspector.cpp +++ b/src/plugins/qmljsinspector/qmljsinspector.cpp @@ -724,6 +724,8 @@ void InspectorUi::setupToolbar(bool doConnect) connect(m_clientProxy, SIGNAL(selectedColorChanged(QColor)), m_toolbar, SLOT(setSelectedColor(QColor))); connect(m_clientProxy, SIGNAL(animationSpeedChanged(qreal)), m_toolbar, SLOT(setAnimationSpeed(qreal))); + + enable(); } else { disconnect(m_clientProxy, SIGNAL(connected()), this, SLOT(enable())); disconnect(m_clientProxy, SIGNAL(disconnected()), this, SLOT(disable())); @@ -744,11 +746,7 @@ void InspectorUi::setupToolbar(bool doConnect) disconnect(m_clientProxy, SIGNAL(selectedColorChanged(QColor)), m_toolbar, SLOT(setSelectedColor(QColor))); disconnect(m_clientProxy, SIGNAL(animationSpeedChanged(qreal)), m_toolbar, SLOT(setAnimationSpeed(qreal))); - } - if (m_clientProxy && m_clientProxy->isConnected()) { - enable(); - } else { disable(); } } diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index 83486bbaf9..e74f2683b2 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -38,6 +38,7 @@ #include <extensionsystem/pluginmanager.h> #include <projectexplorer/filewatcher.h> #include <qt4projectmanager/qmldumptool.h> +#include <qt4projectmanager/qtversionmanager.h> #include <qmljs/qmljsmodelmanagerinterface.h> #include <QTextStream> @@ -171,6 +172,21 @@ QStringList QmlProject::importPaths() const QStringList importPaths; if (m_projectItem) importPaths = m_projectItem.data()->importPaths(); + + // add the default import path for the target Qt version + if (activeTarget()) { + const QmlProjectRunConfiguration *runConfig = + qobject_cast<QmlProjectRunConfiguration*>(activeTarget()->activeRunConfiguration()); + if (runConfig) { + const Qt4ProjectManager::QtVersion *qtVersion = runConfig->qtVersion(); + if (qtVersion && qtVersion->isValid()) { + const QString qtVersionImportPath = qtVersion->versionInfo().value("QT_INSTALL_IMPORTS"); + if (!qtVersionImportPath.isEmpty()) + importPaths += qtVersionImportPath; + } + } + } + return importPaths; } diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index aa7dab53ff..bb8c8db76c 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -46,6 +46,7 @@ #include <qt4projectmanager/qtversionmanager.h> #include <qt4projectmanager/qt4projectmanagerconstants.h> #include <qt4projectmanager/qmlobservertool.h> +#include <qt4projectmanager/qtoutputformatter.h> #include <QFormLayout> #include <QComboBox> @@ -165,6 +166,15 @@ int QmlProjectRunConfiguration::qtVersionId() const return m_qtVersionId; } +void QmlProjectRunConfiguration::setQtVersionId(int id) +{ + if (m_qtVersionId == id) + return; + + m_qtVersionId = id; + qmlTarget()->qmlProject()->refresh(QmlProject::Configuration); +} + Qt4ProjectManager::QtVersion *QmlProjectRunConfiguration::qtVersion() const { if (m_qtVersionId == -1) @@ -249,6 +259,10 @@ QWidget *QmlProjectRunConfiguration::createConfigurationWidget() return detailsWidget; } +ProjectExplorer::OutputFormatter *QmlProjectRunConfiguration::createOutputFormatter() const +{ + return new Qt4ProjectManager::QtOutputFormatter(qmlTarget()->qmlProject()); +} QString QmlProjectRunConfiguration::mainScript() const { @@ -311,7 +325,7 @@ void QmlProjectRunConfiguration::onQtVersionSelectionChanged() { QVariant data = m_qtVersionComboBox.data()->itemData(m_qtVersionComboBox.data()->currentIndex()); QTC_ASSERT(data.isValid() && data.canConvert(QVariant::Int), return) - m_qtVersionId = data.toInt(); + setQtVersionId(data.toInt()); updateEnabled(); } @@ -348,7 +362,7 @@ QVariantMap QmlProjectRunConfiguration::toMap() const bool QmlProjectRunConfiguration::fromMap(const QVariantMap &map) { - m_qtVersionId = map.value(QLatin1String(Constants::QML_VIEWER_QT_KEY), -1).toInt(); + setQtVersionId(map.value(QLatin1String(Constants::QML_VIEWER_QT_KEY), -1).toInt()); m_qmlViewerArgs = map.value(QLatin1String(Constants::QML_VIEWER_ARGUMENTS_KEY)).toString(); m_scriptFile = map.value(QLatin1String(Constants::QML_MAINSCRIPT_KEY), M_CURRENT_FILE).toString(); @@ -411,14 +425,15 @@ void QmlProjectRunConfiguration::updateQtVersions() // if (!qtVersions->isValidId(m_qtVersionId) || !isValidVersion(qtVersions->version(m_qtVersionId))) { - m_qtVersionId = -1; + int newVersionId = -1; // take first one you find foreach (Qt4ProjectManager::QtVersion *version, qtVersions->validVersions()) { if (isValidVersion(version)) { - m_qtVersionId = version->uniqueId(); + newVersionId = version->uniqueId(); break; } } + setQtVersionId(newVersionId); } updateEnabled(); diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h index 7381fa1b54..5942a76c0a 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h @@ -83,6 +83,8 @@ public: // RunConfiguration virtual QWidget *createConfigurationWidget(); + ProjectExplorer::OutputFormatter *createOutputFormatter() const; + QVariantMap toMap() const; public slots: @@ -111,6 +113,7 @@ protected: private: void ctor(); static bool isValidVersion(Qt4ProjectManager::QtVersion *version); + void setQtVersionId(int id); // absolute path to current file (if being used) QString m_currentFileFilename; diff --git a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp index 9bee8580ac..1bbe67b45b 100644 --- a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp +++ b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp @@ -129,7 +129,6 @@ GettingStartedWelcomePageWidget::GettingStartedWelcomePageWidget(QWidget *parent ui->prevFeatureBtn->setEnabled(false); connect(ui->nextFeatureBtn, SIGNAL(clicked()), this, SLOT(slotNextFeature())); connect(ui->prevFeatureBtn, SIGNAL(clicked()), this, SLOT(slotPrevFeature())); - QTimer::singleShot(0, this, SLOT(slotSetPrivateQmlExamples())); } GettingStartedWelcomePageWidget::~GettingStartedWelcomePageWidget() @@ -140,28 +139,35 @@ GettingStartedWelcomePageWidget::~GettingStartedWelcomePageWidget() delete ui; } -void GettingStartedWelcomePageWidget::slotSetPrivateQmlExamples() -{ - if (!ui->qmlExamplesButton->menu()) { - const QString resPath = Core::ICore::instance()->resourcePath(); - updateQmlExamples(resPath, resPath); - } - } -void GettingStartedWelcomePageWidget::updateCppExamples(const QString &examplePath, - const QString &sourcePath, - const QString &demoXml) +void GettingStartedWelcomePageWidget::updateExamples(const QString &examplePath, + const QString &demosPath, + const QString &sourcePath) { + QString demoXml = demosPath + "/qtdemo/xml/examples.xml"; + if (!QFile::exists(demoXml)) { + demoXml = sourcePath + "/demos/qtdemo/xml/examples.xml"; + if (!QFile::exists(demoXml)) + return; + } QFile description(demoXml); if (!description.open(QFile::ReadOnly)) return; - ui->cppExamplesButton->setEnabled(true);; - ui->cppExamplesButton->setText(tr("Choose an Example...")); + const QString dropDownLabel = tr("Choose an Example..."); + + ui->qmlExamplesButton->setEnabled(true); + ui->qmlExamplesButton->setText(dropDownLabel); + + QMenu *qmlMenu = new QMenu(ui->qmlExamplesButton); + ui->qmlExamplesButton->setMenu(qmlMenu); - QMenu *menu = new QMenu(ui->cppExamplesButton); - ui->cppExamplesButton->setMenu(menu); + ui->cppExamplesButton->setEnabled(true); + ui->cppExamplesButton->setText(dropDownLabel); + + QMenu *cppMenu = new QMenu(ui->cppExamplesButton); + ui->cppExamplesButton->setMenu(cppMenu); QMenu *subMenu = 0; bool inExamples = false; @@ -170,104 +176,62 @@ void GettingStartedWelcomePageWidget::updateCppExamples(const QString &examplePa while (!reader.atEnd()) { switch (reader.readNext()) { - case QXmlStreamReader::StartElement: + case QXmlStreamReader::StartElement: if (reader.name() == QLatin1String("category")) { QString name = reader.attributes().value(QLatin1String("name")).toString(); if (name.contains(QLatin1String("tutorial"))) break; dirName = reader.attributes().value(QLatin1String("dirname")).toString(); - subMenu = menu->addMenu(name); + subMenu = new QMenu(name); inExamples = true; } if (inExamples && reader.name() == QLatin1String("example")) { const QChar slash = QLatin1Char('/'); const QString name = reader.attributes().value(QLatin1String("name")).toString(); + const bool isQml = reader.attributes().value(QLatin1String("qml")).toString() == "true"; const QString fn = reader.attributes().value(QLatin1String("filename")).toString(); - const QString relativeProPath = slash + dirName + slash + fn + slash + fn + QLatin1String(".pro"); + const QString extension = isQml ? QLatin1String(".qmlproject") : QLatin1String(".pro"); + const QString relativeProPath = slash + dirName + slash + fn + slash + fn + extension; + QString fileName = examplePath + relativeProPath; if (!QFile::exists(fileName)) fileName = sourcePath + QLatin1String("/examples") + relativeProPath; + QString dirName1 = dirName; dirName1.replace(slash, QLatin1Char('-')); QString helpPath = QLatin1String("qthelp://com.trolltech.qt/qdoc/") + - dirName1 + - QLatin1Char('-') + fn + QLatin1String(".html"); + dirName1 + + QLatin1Char('-') + fn + QLatin1String(".html"); + + QAction *exampleAction; + if (isQml) + exampleAction = qmlMenu->addAction(name); + else + exampleAction = subMenu->addAction(name); - QAction *exampleAction = subMenu->addAction(name); connect(exampleAction, SIGNAL(triggered()), SLOT(slotOpenExample())); exampleAction->setProperty(ExamplePathPropertyName, fileName); exampleAction->setProperty(HelpPathPropertyName, helpPath); + } break; - case QXmlStreamReader::EndElement: - if (reader.name() == QLatin1String("category")) + case QXmlStreamReader::EndElement: + if (reader.name() == QLatin1String("category")) { + if (subMenu->actions().isEmpty()) + delete subMenu; + else + cppMenu->addMenu(subMenu); + inExamples = false; + } break; - default: + default: break; } } } -void GettingStartedWelcomePageWidget::updateQmlExamples(const QString &examplePath, - const QString &sourcePath) -{ - ui->qmlExamplesButton->setText(tr("Choose an Example...")); - - QStringList roots; - roots << (examplePath + QLatin1String("/declarative")) - << (sourcePath + QLatin1String("/examples/declarative")); - QMap<QString, QString> exampleProjects; - - foreach (const QString &root, roots) { - QList<QFileInfo> examples = QDir(root).entryInfoList(QStringList(), QDir::AllDirs|QDir::NoDotAndDotDot, QDir::Name); - foreach(const QFileInfo &example, examples) { - const QString fileName = example.fileName(); - if (exampleProjects.contains(fileName)) - continue; - const QString exampleProject = example.absoluteFilePath() - + QLatin1Char('/') + fileName - + QLatin1String(".qmlproject"); - if (!QFile::exists(exampleProject)) - continue; - exampleProjects.insert(fileName, exampleProject); - } - } - - if (!exampleProjects.isEmpty()) { - QMenu *menu = new QMenu(ui->qmlExamplesButton); - ui->qmlExamplesButton->setMenu(menu); - - QMapIterator<QString, QString> it(exampleProjects); - while (it.hasNext()) { - it.next(); - QAction *exampleAction = menu->addAction(it.key()); - connect(exampleAction, SIGNAL(triggered()), SLOT(slotOpenExample())); - exampleAction->setProperty(ExamplePathPropertyName, it.value()); - // FIXME once we have help for QML examples - // exampleAction->setProperty(HelpPathPropertyName, helpPath); - } - } - - ui->qmlExamplesButton->setEnabled(!exampleProjects.isEmpty()); -} - -void GettingStartedWelcomePageWidget::updateExamples(const QString &examplePath, - const QString &demosPath, - const QString &sourcePath) -{ - QString demoxml = demosPath + "/qtdemo/xml/examples.xml"; - if (!QFile::exists(demoxml)) { - demoxml = sourcePath + "/demos/qtdemo/xml/examples.xml"; - if (!QFile::exists(demoxml)) - return; - } - updateCppExamples(examplePath, sourcePath, demoxml); - updateQmlExamples(examplePath, sourcePath); -} - - namespace { void copyRecursive(const QDir& from, const QDir& to, const QString& dir) { diff --git a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.h b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.h index 8a575e7950..ea0fec1d49 100644 --- a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.h +++ b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.h @@ -94,7 +94,6 @@ private slots: void slotNextFeature(); void slotPrevFeature(); void slotCreateNewProject(); - void slotSetPrivateQmlExamples(); void addToFeatures(const RssItem&); void showFeature(int feature = -1); @@ -103,11 +102,6 @@ signals: private: QStringList tipsOfTheDay(); - void updateCppExamples(const QString &examplePath, - const QString &sourcePath, - const QString &demoXml); - void updateQmlExamples(const QString &examplePath, - const QString &sourcePath); Ui::GettingStartedWelcomePageWidget *ui; int m_currentTip; int m_currentFeature; diff --git a/src/plugins/qt4projectmanager/qmldumptool.cpp b/src/plugins/qt4projectmanager/qmldumptool.cpp index 7ca1712282..442598850f 100644 --- a/src/plugins/qt4projectmanager/qmldumptool.cpp +++ b/src/plugins/qt4projectmanager/qmldumptool.cpp @@ -161,7 +161,8 @@ static QtVersion *qtVersionForProject(ProjectExplorer::Project *project) if (project && project->id() == QLatin1String("QmlProjectManager.QmlProject")) { // We cannot access the QmlProject interfaces here, therefore use the metatype system - QTC_ASSERT(project->activeTarget() && project->activeTarget()->activeRunConfiguration(), return 0); + if (!project->activeTarget() || !project->activeTarget()->activeRunConfiguration()) + return 0; QVariant variant = project->activeTarget()->activeRunConfiguration()->property("qtVersionId"); QTC_ASSERT(variant.isValid() && variant.canConvert(QVariant::Int), return 0); QtVersion *version = QtVersionManager::instance()->version(variant.toInt()); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp index 8af100e278..10cb5e38b5 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp @@ -161,7 +161,7 @@ QVariant MaemoDeployableListModel::data(const QModelIndex &index, int role) cons const MaemoDeployable &d = deployableAt(index.row()); if (index.column() == 0 && role == Qt::DisplayRole) - return d.localFilePath; + return QDir::toNativeSeparators(d.localFilePath); if (role == Qt::DisplayRole || role == Qt::EditRole) return d.remoteDir; return QVariant(); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.cpp deleted file mode 100644 index ee872e08e6..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** 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 Qt Creator. -** -** $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 "maemodeployablelistwidget.h" -#include "ui_maemodeployablelistwidget.h" - -#include "maemodeployablelistmodel.h" - -#include <utils/qtcassert.h> - -#include <QtCore/QDir> -#include <QtCore/QFile> -#include <QtCore/QFileInfo> -#include <QtGui/QFileDialog> -#include <QtGui/QMessageBox> - -namespace Qt4ProjectManager { -namespace Internal { - -MaemoDeployableListWidget::MaemoDeployableListWidget(QWidget *parent, - MaemoDeployableListModel *model) - : QWidget(parent), m_ui(new Ui::MaemoDeployableListWidget), m_model(model) -{ - m_ui->setupUi(this); - m_ui->addFileButton->hide(); - m_ui->removeFileButton->hide(); - m_ui->deployablesView->setWordWrap(false); - m_ui->deployablesView->setModel(m_model); - connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - m_ui->deployablesView, SLOT(resizeColumnsToContents())); - connect(m_model, SIGNAL(rowsInserted(QModelIndex, int, int)), - m_ui->deployablesView, SLOT(resizeColumnsToContents())); - connect(m_ui->deployablesView->selectionModel(), - SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, - SLOT(enableOrDisableRemoveButton())); - m_ui->deployablesView->resizeColumnsToContents(); - m_ui->deployablesView->resizeRowsToContents(); - m_ui->deployablesView->horizontalHeader()->setStretchLastSection(true); - enableOrDisableRemoveButton(); -} - -MaemoDeployableListWidget::~MaemoDeployableListWidget() -{ - delete m_ui; -} - -void MaemoDeployableListWidget::addFile() -{ - const QString title = tr("Choose a local file"); - const QString localFile = QFileDialog::getOpenFileName(this, title, m_model->projectDir()); // TODO: Support directories. - if (localFile.isEmpty()) - return; - const MaemoDeployable - deployable(QDir::toNativeSeparators(QFileInfo(localFile).absoluteFilePath()), - "/"); - QString errorString; - if (!m_model->addDeployable(deployable, &errorString)) { - QMessageBox::information(this, tr("Error adding file"), errorString); - } else { - const QModelIndex newIndex - = m_model->index(m_model->rowCount() - 1, 1); - m_ui->deployablesView->selectionModel()->clear(); - m_ui->deployablesView->scrollTo(newIndex); - m_ui->deployablesView->edit(newIndex); - } -} - -void MaemoDeployableListWidget::removeFile() -{ - const QModelIndexList selectedRows - = m_ui->deployablesView->selectionModel()->selectedRows(); - if (selectedRows.isEmpty()) - return; - const int row = selectedRows.first().row(); - if (row != 0) { - QString errorString; - if (!m_model->removeDeployableAt(row, &errorString)) { - QMessageBox::information(this, tr("Error removing file"), - errorString); - } - } -} - -void MaemoDeployableListWidget::enableOrDisableRemoveButton() -{ - const QModelIndexList selectedRows - = m_ui->deployablesView->selectionModel()->selectedRows(); - m_ui->removeFileButton->setEnabled(!selectedRows.isEmpty() - && selectedRows.first().row() != 0); -} - -} // namespace Internal -} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.h deleted file mode 100644 index 2652afabbb..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** 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 Qt Creator. -** -** $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$ -** -****************************************************************************/ - -#ifndef MAEMODEPLOYABLELISTWIDGET_H -#define MAEMODEPLOYABLELISTWIDGET_H - -#include <QtGui/QWidget> - -QT_BEGIN_NAMESPACE -namespace Ui { - class MaemoDeployableListWidget; -} -QT_END_NAMESPACE - -namespace Qt4ProjectManager { -namespace Internal { -class MaemoDeployableListModel; - -class MaemoDeployableListWidget : public QWidget -{ - Q_OBJECT - -public: - MaemoDeployableListWidget(QWidget *parent, MaemoDeployableListModel *model); - ~MaemoDeployableListWidget(); - MaemoDeployableListModel *model() const { return m_model; } - -private slots: - void addFile(); - void removeFile(); - void enableOrDisableRemoveButton(); - -private: - Ui::MaemoDeployableListWidget *m_ui; - MaemoDeployableListModel * const m_model; -}; - -} // namespace Internal -} // namespace Qt4ProjectManager - -#endif // MAEMODEPLOYABLELISTWIDGET_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.ui deleted file mode 100644 index 412b53bd8a..0000000000 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.ui +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MaemoDeployableListWidget</class> - <widget class="QWidget" name="MaemoDeployableListWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>491</width> - <height>289</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QTableView" name="deployablesView"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>1</horstretch> - <verstretch>1</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>400</width> - <height>200</height> - </size> - </property> - <property name="selectionMode"> - <enum>QAbstractItemView::SingleSelection</enum> - </property> - <property name="selectionBehavior"> - <enum>QAbstractItemView::SelectRows</enum> - </property> - <property name="showGrid"> - <bool>false</bool> - </property> - <attribute name="horizontalHeaderVisible"> - <bool>true</bool> - </attribute> - <attribute name="horizontalHeaderCascadingSectionResizes"> - <bool>false</bool> - </attribute> - <attribute name="verticalHeaderVisible"> - <bool>false</bool> - </attribute> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QToolButton" name="addFileButton"> - <property name="toolTip"> - <string>Add File to Package</string> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="../../coreplugin/core.qrc"> - <normaloff>:/core/images/plus.png</normaloff>:/core/images/plus.png</iconset> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="removeFileButton"> - <property name="toolTip"> - <string>Remove File from Package</string> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="../../coreplugin/core.qrc"> - <normaloff>:/core/images/minus.png</normaloff>:/core/images/minus.png</iconset> - </property> - </widget> - </item> - <item> - <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> - </item> - </layout> - </widget> - <resources> - <include location="../../coreplugin/core.qrc"/> - </resources> - <connections> - <connection> - <sender>addFileButton</sender> - <signal>clicked()</signal> - <receiver>MaemoDeployableListWidget</receiver> - <slot>addFile()</slot> - <hints> - <hint type="sourcelabel"> - <x>475</x> - <y>32</y> - </hint> - <hint type="destinationlabel"> - <x>488</x> - <y>242</y> - </hint> - </hints> - </connection> - <connection> - <sender>removeFileButton</sender> - <signal>clicked()</signal> - <receiver>MaemoDeployableListWidget</receiver> - <slot>removeFile()</slot> - <hints> - <hint type="sourcelabel"> - <x>456</x> - <y>66</y> - </hint> - <hint type="destinationlabel"> - <x>490</x> - <y>182</y> - </hint> - </hints> - </connection> - </connections> - <slots> - <slot>addFile()</slot> - <slot>removeFile()</slot> - </slots> -</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp index e297450cf9..d1e9d5d3d4 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp @@ -79,18 +79,19 @@ void MaemoDeployables::createModels() || qt4BuildConfiguration()->qt4Target()->project()->activeTarget()->id() != QLatin1String(Qt4ProjectManager::Constants::MAEMO_DEVICE_TARGET_ID)) return; - disconnect(qt4BuildConfiguration()->qt4Target()->qt4Project(), - SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)), - m_updateTimer, SLOT(start())); + const Qt4ProFileNode *const rootNode + = qt4BuildConfiguration()->qt4Target()->qt4Project()->rootProjectNode(); + if (!rootNode) // Happens on project creation by wizard. + return; m_updateTimer->stop(); m_proFileOption = QSharedPointer<ProFileOption>(new ProFileOption); m_proFileOption->properties = qt4BuildConfiguration()->qtVersion()->versionInfo(); m_proFileOption->target_mode = ProFileOption::TARG_UNIX_MODE; - const Qt4ProFileNode *const rootNode - = qt4BuildConfiguration()->qt4Target()->qt4Project()->rootProjectNode(); - if (!rootNode) // Happens on project creation by wizard. - return; + disconnect(qt4BuildConfiguration()->qt4Target()->qt4Project(), + SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)), + m_updateTimer, SLOT(start())); + beginResetModel(); qDeleteAll(m_listModels); m_listModels.clear(); createModels(rootNode); @@ -118,7 +119,7 @@ void MaemoDeployables::createModels() } } - emit modelsCreated(); + endResetModel(); connect(qt4BuildConfiguration()->qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)), m_updateTimer, SLOT(start())); @@ -209,5 +210,26 @@ const Qt4BuildConfiguration *MaemoDeployables::qt4BuildConfiguration() const return bc; } +int MaemoDeployables::rowCount(const QModelIndex &parent) const +{ + return parent.isValid() ? 0 : modelCount(); +} + +QVariant MaemoDeployables::data(const QModelIndex &index, int role) const +{ + if (!index.isValid() || index.row() < 0 || index.row() >= modelCount() + || index.column() != 0) + return QVariant(); + const MaemoDeployableListModel *const model = m_listModels.at(index.row()); + if (role == Qt::ForegroundRole && !model->hasTargetPath()) { + QBrush brush; + brush.setColor(Qt::red); + return brush; + } + if (role == Qt::DisplayRole) + return QFileInfo(model->proFilePath()).fileName(); + return QVariant(); +} + } // namespace Qt4ProjectManager } // namespace Internal diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h index b056427aae..c7c3921841 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h @@ -45,9 +45,9 @@ #include "maemodeployable.h" #include "maemodeployablelistmodel.h" +#include <QtCore/QAbstractListModel> #include <QtCore/QHash> #include <QtCore/QList> -#include <QtCore/QObject> #include <QtCore/QSharedPointer> QT_FORWARD_DECLARE_CLASS(QTimer); @@ -61,7 +61,7 @@ namespace Internal { class Qt4BuildConfiguration; class Qt4ProFileNode; -class MaemoDeployables : public QObject +class MaemoDeployables : public QAbstractListModel { Q_OBJECT public: @@ -76,12 +76,12 @@ public: MaemoDeployableListModel *modelAt(int i) const { return m_listModels.at(i); } const ProjectExplorer::BuildStep *buildStep() const { return m_buildStep; } -signals: - void modelsCreated(); - private: typedef QHash<QString, MaemoDeployableListModel::ProFileUpdateSetting> UpdateSettingsMap; + virtual int rowCount(const QModelIndex &parent) const; + virtual QVariant data(const QModelIndex &index, int role) const; + Q_SLOT void createModels(); Q_SLOT void init(); void createModels(const Qt4ProFileNode *proFileNode); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp index e017a2697a..15482ed2d9 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp @@ -3,13 +3,13 @@ #include "maemodeploystep.h" #include "maemodeployablelistmodel.h" -#include "maemodeployablelistwidget.h" #include "maemodeployables.h" #include "maemodeviceconfiglistmodel.h" #include "maemorunconfiguration.h" #include <projectexplorer/buildconfiguration.h> #include <projectexplorer/target.h> +#include <utils/qtcassert.h> namespace Qt4ProjectManager { namespace Internal { @@ -20,10 +20,19 @@ MaemoDeployStepWidget::MaemoDeployStepWidget(MaemoDeployStep *step) : m_step(step) { ui->setupUi(this); - - connect(m_step->deployables(), SIGNAL(modelsCreated()), this, - SLOT(handleModelsCreated())); - handleModelsCreated(); + ui->tableView->setTextElideMode(Qt::ElideMiddle); + ui->modelComboBox->setModel(m_step->deployables()); + connect(m_step->deployables(), SIGNAL(modelAboutToBeReset()), + SLOT(handleModelListToBeReset())); + + // Queued connection because of race condition with combo box's reaction + // to modelReset(). + connect(m_step->deployables(), SIGNAL(modelReset()), + SLOT(handleModelListReset()), Qt::QueuedConnection); + + connect(ui->modelComboBox, SIGNAL(currentIndexChanged(int)), + SLOT(setModel(int))); + handleModelListReset(); } MaemoDeployStepWidget::~MaemoDeployStepWidget() @@ -77,18 +86,6 @@ QString MaemoDeployStepWidget::displayName() const return QString(); } - -void MaemoDeployStepWidget::handleModelsCreated() -{ - ui->tabWidget->clear(); - for (int i = 0; i < m_step->deployables()->modelCount(); ++i) { - MaemoDeployableListModel * const model - = m_step->deployables()->modelAt(i); - ui->tabWidget->addTab(new MaemoDeployableListWidget(this, model), - model->projectName()); - } -} - void MaemoDeployStepWidget::setCurrentDeviceConfig(int index) { m_step->deviceConfigModel()->setCurrentIndex(index); @@ -99,5 +96,29 @@ void MaemoDeployStepWidget::setDeployToSysroot(bool doDeploy) m_step->setDeployToSysrootEnabled(doDeploy); } +void MaemoDeployStepWidget::handleModelListToBeReset() +{ + ui->tableView->setModel(0); +} + +void MaemoDeployStepWidget::handleModelListReset() +{ + QTC_ASSERT(m_step->deployables()->modelCount() == ui->modelComboBox->count(), return); + if (m_step->deployables()->modelCount() > 0) { + if (ui->modelComboBox->currentIndex() == -1) + ui->modelComboBox->setCurrentIndex(0); + else + setModel(ui->modelComboBox->currentIndex()); + } +} + +void MaemoDeployStepWidget::setModel(int row) +{ + if (row != -1) { + ui->tableView->setModel(m_step->deployables()->modelAt(row)); + ui->tableView->resizeRowsToContents(); + } +} + } // namespace Internal } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h index 133e79f778..28c0f00d30 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h @@ -23,10 +23,12 @@ public: private: Q_SLOT void handleDeviceUpdate(); - Q_SLOT void handleModelsCreated(); Q_SLOT void handleDeviceConfigModelChanged(); Q_SLOT void setCurrentDeviceConfig(int index); Q_SLOT void setDeployToSysroot(bool doDeloy); + Q_SLOT void setModel(int row); + Q_SLOT void handleModelListToBeReset(); + Q_SLOT void handleModelListReset(); virtual void init(); virtual QString summaryText() const; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui index 0f803b4d5e..9c35f1be74 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>460</width> - <height>277</height> + <width>662</width> + <height>418</height> </rect> </property> <property name="windowTitle"> @@ -15,58 +15,118 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <layout class="QFormLayout" name="formLayout"> - <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> <widget class="QLabel" name="deviceConfigLabel"> <property name="text"> <string>Device configuration:</string> </property> </widget> </item> - <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QComboBox" name="deviceConfigComboBox"/> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> + <item> + <widget class="QComboBox" name="deviceConfigComboBox"/> </item> - <item row="1" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_2"/> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> </item> - <item row="1" column="0"> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> <widget class="QCheckBox" name="deployToSysrootCheckBox"> <property name="text"> <string>Also deploy to sysroot</string> </property> </widget> </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> </layout> </item> <item> - <widget class="QLabel" name="installLabel"> - <property name="toolTip"> - <string>These show the INSTALLS settings from the project file(s).</string> - </property> - <property name="text"> - <string><b>Files to install:</b></string> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> </widget> </item> <item> - <widget class="QTabWidget" name="tabWidget"/> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="installLabel"> + <property name="toolTip"> + <string>These show the INSTALLS settings from the project file(s).</string> + </property> + <property name="text"> + <string><b>Files to install for subproject:</b></string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="modelComboBox"> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToContents</enum> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <widget class="QTableView" name="tableView"> + <property name="showGrid"> + <bool>false</bool> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + <attribute name="horizontalHeaderDefaultSectionSize"> + <number>400</number> + </attribute> + <attribute name="horizontalHeaderMinimumSectionSize"> + <number>100</number> + </attribute> + <attribute name="horizontalHeaderStretchLastSection"> + <bool>true</bool> + </attribute> + <attribute name="verticalHeaderVisible"> + <bool>false</bool> + </attribute> + </widget> </item> </layout> </widget> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.cpp index eab38d78f5..9275ec81d3 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.cpp @@ -84,8 +84,9 @@ void MaemoDeviceEnvReader::start() void MaemoDeviceEnvReader::stop() { m_stop = true; - disconnect(m_connection.data(), 0, this, 0); + if (m_connection) + disconnect(m_connection.data(), 0, this, 0); if (m_remoteProcess) { disconnect(m_remoteProcess.data()); m_remoteProcess->closeChannel(); @@ -109,6 +110,7 @@ void MaemoDeviceEnvReader::executeRemoteCall() SLOT(remoteErrorOutput(QByteArray))); m_remoteOutput.clear(); + m_remoteErrorOutput.clear(); m_remoteProcess->start(); } @@ -116,7 +118,7 @@ void MaemoDeviceEnvReader::handleConnectionFailure() { emit error(tr("Could not connect to host: %1") .arg(m_connection->errorString())); - emit finished(); + setFinished(); } void MaemoDeviceEnvReader::handleCurrentDeviceConfigChanged() @@ -124,7 +126,7 @@ void MaemoDeviceEnvReader::handleCurrentDeviceConfigChanged() m_devConfig = m_runConfig->deviceConfig(); m_env.clear(); - emit finished(); + setFinished(); } void MaemoDeviceEnvReader::remoteProcessFinished(int exitCode) @@ -143,10 +145,15 @@ void MaemoDeviceEnvReader::remoteProcessFinished(int exitCode) QString::SkipEmptyParts)); } } else { - emit error(tr("Error running remote process: %1") - .arg(m_remoteProcess->errorString())); + QString errorMsg = tr("Error running remote process: %1") + .arg(m_remoteProcess->errorString()); + if (!m_remoteErrorOutput.isEmpty()) { + errorMsg += tr("\nRemote stderr was: '%1'") + .arg(QString::fromUtf8(m_remoteErrorOutput)); + } + emit error(errorMsg); } - emit finished(); + setFinished(); } void MaemoDeviceEnvReader::remoteOutput(const QByteArray &data) @@ -156,8 +163,14 @@ void MaemoDeviceEnvReader::remoteOutput(const QByteArray &data) void MaemoDeviceEnvReader::remoteErrorOutput(const QByteArray &data) { - emit error(data); + m_remoteErrorOutput += data; +} + +void MaemoDeviceEnvReader::setFinished() +{ + stop(); + emit finished(); } - } // Internal +} // Internal } // Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.h index e5ad89e463..d31c6b0427 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeviceenvreader.h @@ -77,8 +77,11 @@ private slots: void remoteErrorOutput(const QByteArray &data); private: + void setFinished(); + bool m_stop; QString m_remoteOutput; + QByteArray m_remoteErrorOutput; Utils::Environment m_env; MaemoDeviceConfig m_devConfig; MaemoRunConfiguration *m_runConfig; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp index 476346c926..77749cc402 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp @@ -64,6 +64,7 @@ namespace { const QLatin1String PackagingEnabledKey("Packaging Enabled"); + const QLatin1String MagicFileName(".qtcreator"); } using namespace ProjectExplorer::Constants; @@ -168,7 +169,7 @@ bool MaemoPackageCreationStep::createPackage(QProcess *buildProc) = buildConfiguration()->target()->project()->projectDirectory(); const bool inSourceBuild = QFileInfo(buildDirectory()) == QFileInfo(projectDir); - if (!inSourceBuild && !copyDebianFiles()) + if (!copyDebianFiles(inSourceBuild)) return false; if (!runCommand(buildProc, QLatin1String("dpkg-buildpackage -nc -uc -us"))) @@ -209,13 +210,26 @@ bool MaemoPackageCreationStep::createPackage(QProcess *buildProc) buildProc->start(packagingCommand(maemoToolChain(), QLatin1String("dh_clean"))); buildProc->waitForFinished(); + buildProc->terminate(); } return true; } -bool MaemoPackageCreationStep::copyDebianFiles() +bool MaemoPackageCreationStep::copyDebianFiles(bool inSourceBuild) { const QString debianDirPath = buildDirectory() + QLatin1String("/debian"); + const QString magicFilePath + = debianDirPath + QLatin1Char('/') + MagicFileName; + if (inSourceBuild && QFileInfo(debianDirPath).isDir() + && !QFileInfo(magicFilePath).exists()) { + raiseError(tr("Packaging failed: Foreign debian directory detected."), + tr("You are not using a shadow build and there is a debian " + "directory in your project root ('%1'). Qt Creator will not " + "overwrite that directory. Please remove it or use the " + "shadow build feature.") + .arg(QDir::toNativeSeparators(debianDirPath))); + return false; + } if (!removeDirectory(debianDirPath)) { raiseError(tr("Packaging failed."), tr("Could not remove directory '%1'.").arg(debianDirPath)); @@ -251,6 +265,14 @@ bool MaemoPackageCreationStep::copyDebianFiles() if (harmattanWorkaroundNeeded && fileName == QLatin1String("rules")) addWorkaroundForHarmattanBug(destFile); } + + QFile magicFile(magicFilePath); + if (!magicFile.open(QIODevice::WriteOnly)) { + raiseError(tr("Error: Could not create create file '%1'.") + .arg(QDir::toNativeSeparators(magicFilePath))); + return false; + } + return true; } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h index 457295ab8f..ed5fe6efb9 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h @@ -81,6 +81,7 @@ public: static QString packageName(const ProjectExplorer::Project *project); static QString packageFileName(const ProjectExplorer::Project *project, const QString &version); + static bool removeDirectory(const QString &dirPath); static const QLatin1String DefaultVersionNumber; @@ -105,8 +106,7 @@ private: virtual bool fromMap(const QVariantMap &map); bool createPackage(QProcess *buildProc); - bool copyDebianFiles(); - bool removeDirectory(const QString &dirPath); + bool copyDebianFiles(bool inSourceBuild); bool runCommand(QProcess *buildProc, const QString &command); QString maddeRoot() const; QString targetRoot() const; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.ui b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.ui index f4a16ed39b..795021c7d3 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.ui +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>471</width> + <width>505</width> <height>162</height> </rect> </property> @@ -193,7 +193,7 @@ <item row="2" column="0"> <widget class="QLabel" name="packageManagerIconLabel"> <property name="text"> - <string><b>Package Manager Icon:</b></string> + <string><b>Package Manager icon:</b></string> </property> </widget> </item> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.ui b/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.ui index 60eaa627eb..7cd4b6a497 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.ui +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.ui @@ -95,7 +95,7 @@ <enum>Qt::Horizontal</enum> </property> <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + <set>QDialogButtonBox::Ok</set> </property> </widget> </item> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp index 18e734f265..fcb737ced8 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp @@ -129,7 +129,7 @@ QWidget *MaemoRunConfiguration::createConfigurationWidget() return new MaemoRunConfigurationWidget(this); } -ProjectExplorer::OutputFormatter *MaemoRunConfiguration::createConfigurationWidget() const +ProjectExplorer::OutputFormatter *MaemoRunConfiguration::createOutputFormatter() const { return new QtOutputFormatter(qt4Target()->qt4Project()); } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h index 42e3283594..5ca8db29d9 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h @@ -78,7 +78,7 @@ public: bool isEnabled(ProjectExplorer::BuildConfiguration *config) const; QWidget *createConfigurationWidget(); - ProjectExplorer::OutputFormatter *createConfigurationWidget() const; + ProjectExplorer::OutputFormatter *createOutputFormatter() const; Qt4Target *qt4Target() const; Qt4BuildConfiguration *activeQt4BuildConfiguration() const; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp index ddc20d8ce5..f5bbb17e71 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.cpp @@ -51,6 +51,7 @@ #include <qt4projectmanager/qt4target.h> #include <utils/detailswidget.h> +#include <QtCore/QCoreApplication> #include <QtGui/QComboBox> #include <QtGui/QFileDialog> #include <QtGui/QFormLayout> @@ -59,6 +60,7 @@ #include <QtGui/QHeaderView> #include <QtGui/QLabel> #include <QtGui/QLineEdit> +#include <QtGui/QMessageBox> #include <QtGui/QPushButton> #include <QtGui/QRadioButton> #include <QtGui/QTableView> @@ -66,6 +68,11 @@ namespace Qt4ProjectManager { namespace Internal { +namespace { +const QString FetchEnvButtonText + = QCoreApplication::translate("Qt4ProjectManager::Internal::MaemoRunConfigurationWidget", + "Fetch Device Environment"); +} // anonymous namespace MaemoRunConfigurationWidget::MaemoRunConfigurationWidget( MaemoRunConfiguration *runConfiguration, QWidget *parent) @@ -155,7 +162,7 @@ void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout) connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this, SLOT(updateTargetInformation())); connect(m_runConfiguration->deployStep()->deployables(), - SIGNAL(modelsCreated()), this, SLOT(handleDeploySpecsChanged())); + SIGNAL(modelReset()), this, SLOT(handleDeploySpecsChanged())); handleDeploySpecsChanged(); } @@ -246,7 +253,7 @@ void MaemoRunConfigurationWidget::addEnvironmentWidgets(QVBoxLayout *mainLayout) m_baseEnvironmentComboBox->setCurrentIndex(m_runConfiguration->baseEnvironmentBase()); baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox); - m_fetchEnv = new QPushButton(tr("Fetch Device Environment")); + m_fetchEnv = new QPushButton(FetchEnvButtonText); baseEnvironmentLayout->addWidget(m_fetchEnv); baseEnvironmentLayout->addStretch(10); @@ -267,8 +274,10 @@ void MaemoRunConfigurationWidget::addEnvironmentWidgets(QVBoxLayout *mainLayout) connect(m_runConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)), this, SLOT(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>))); - connect(m_fetchEnv, SIGNAL(pressed()), this, SLOT(fetchEnvironment())); + connect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); connect(m_deviceEnvReader, SIGNAL(finished()), this, SLOT(fetchEnvironmentFinished())); + connect(m_deviceEnvReader, SIGNAL(error(QString)), this, + SLOT(fetchEnvironmentError(QString))); } void MaemoRunConfigurationWidget::argumentsEdited(const QString &text) @@ -278,7 +287,8 @@ void MaemoRunConfigurationWidget::argumentsEdited(const QString &text) void MaemoRunConfigurationWidget::updateTargetInformation() { - m_localExecutableLabel->setText(m_runConfiguration->localExecutableFilePath()); + m_localExecutableLabel + ->setText(QDir::toNativeSeparators(m_runConfiguration->localExecutableFilePath())); } void MaemoRunConfigurationWidget::handleDeploySpecsChanged() @@ -387,16 +397,33 @@ void MaemoRunConfigurationWidget::handleDebuggingTypeChanged(bool useGdb) void MaemoRunConfigurationWidget::fetchEnvironment() { + disconnect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); + connect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(stopFetchEnvironment())); + m_fetchEnv->setText(tr("Cancel Fetch Operation")); m_deviceEnvReader->start(); - m_fetchEnv->setEnabled(false); +} + +void MaemoRunConfigurationWidget::stopFetchEnvironment() +{ + m_deviceEnvReader->stop(); + fetchEnvironmentFinished(); } void MaemoRunConfigurationWidget::fetchEnvironmentFinished() { - m_fetchEnv->setEnabled(true); + disconnect(m_fetchEnv, SIGNAL(clicked()), this, + SLOT(stopFetchEnvironment())); + connect(m_fetchEnv, SIGNAL(clicked()), this, SLOT(fetchEnvironment())); + m_fetchEnv->setText(FetchEnvButtonText); m_runConfiguration->setSystemEnvironment(m_deviceEnvReader->deviceEnvironment()); } +void MaemoRunConfigurationWidget::fetchEnvironmentError(const QString &error) +{ + QMessageBox::warning(this, tr("Device error"), + tr("Fetching environment failed: %1").arg(error)); +} + void MaemoRunConfigurationWidget::userChangesEdited() { m_ignoreChange = true; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h index be686ac000..e97c10712e 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfigurationwidget.h @@ -85,6 +85,8 @@ private slots: void handleDebuggingTypeChanged(bool useGdb); void fetchEnvironment(); void fetchEnvironmentFinished(); + void fetchEnvironmentError(const QString &error); + void stopFetchEnvironment(); void userChangesEdited(); void baseEnvironmentSelected(int index); void baseEnvironmentChanged(); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp index 2c33f67426..e16489d0d2 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp @@ -62,6 +62,8 @@ namespace Internal { namespace { const QByteArray IconFieldName("XB-Maemo-Icon-26:"); +const QLatin1String PackagingDirName("qtc_packaging"); +const QLatin1String DebianDirNameFremantle("debian_fremantle"); } // anonymous namespace @@ -85,7 +87,7 @@ MaemoTemplatesManager::MaemoTemplatesManager(QObject *parent) : QObject(parent) SLOT(handleActiveProjectChanged(ProjectExplorer::Project*))); connect(session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)), this, SLOT(handleProjectToBeRemoved(ProjectExplorer::Project*))); - handleActiveProjectChanged(session->startupProject()); + handleActiveProjectChanged(session->startupProject()); } void MaemoTemplatesManager::handleActiveProjectChanged(ProjectExplorer::Project *project) @@ -113,7 +115,7 @@ bool MaemoTemplatesManager::handleTarget(ProjectExplorer::Target *target) const Qt4Target * const qt4Target = qobject_cast<Qt4Target *>(target); const MaemoDeployStep * const deployStep = MaemoGlobal::buildStep<MaemoDeployStep>(qt4Target->activeDeployConfiguration()); - connect(deployStep->deployables(), SIGNAL(modelsCreated()), this, + connect(deployStep->deployables(), SIGNAL(modelReset()), this, SLOT(handleProFileUpdated()), Qt::QueuedConnection); Project * const project = target->project(); @@ -140,8 +142,14 @@ bool MaemoTemplatesManager::createDebianTemplatesIfNecessary(const ProjectExplor { Project * const project = target->project(); QDir projectDir(project->projectDirectory()); - if (projectDir.exists(QLatin1String("debian"))) + if (QFileInfo(debianDirPath(project)).exists()) return true; + if (!projectDir.exists(PackagingDirName) + && !projectDir.mkdir(PackagingDirName)) { + raiseError(tr("Error creating Maemo packaging directory '%1'.") + .arg(PackagingDirName)); + return false; + } QProcess dh_makeProc; QString error; @@ -154,11 +162,14 @@ bool MaemoTemplatesManager::createDebianTemplatesIfNecessary(const ProjectExplor return false; } if (!MaemoPackageCreationStep::preparePackagingProcess(&dh_makeProc, tc, - projectDir.path(), &error)) { + projectDir.path() + QLatin1Char('/') + PackagingDirName, &error)) { raiseError(error); return false; } + const QString dhMakeDebianDir = projectDir.path() + QLatin1Char('/') + + PackagingDirName + QLatin1String("/debian"); + MaemoPackageCreationStep::removeDirectory(dhMakeDebianDir); const QString command = QLatin1String("dh_make -s -n -p ") + MaemoPackageCreationStep::packageName(project) + QLatin1Char('_') + MaemoPackageCreationStep::DefaultVersionNumber; @@ -177,21 +188,23 @@ bool MaemoTemplatesManager::createDebianTemplatesIfNecessary(const ProjectExplor return false; } + if (!QFile::rename(dhMakeDebianDir, debianDirPath(project))) { + raiseError(tr("Unable to move new debian directory to '%1'.") + .arg(QDir::toNativeSeparators(debianDirPath(project)))); + MaemoPackageCreationStep::removeDirectory(dhMakeDebianDir); + return false; + } + QDir debianDir(debianDirPath(project)); const QStringList &files = debianDir.entryList(QDir::Files); - QStringList filesToAddToProject; foreach (const QString &fileName, files) { if (fileName.endsWith(QLatin1String(".ex"), Qt::CaseInsensitive) || fileName.compare(QLatin1String("README.debian"), Qt::CaseInsensitive) == 0 || fileName.compare(QLatin1String("dirs"), Qt::CaseInsensitive) == 0 || fileName.compare(QLatin1String("docs"), Qt::CaseInsensitive) == 0) { debianDir.remove(fileName); - } else - filesToAddToProject << debianDir.absolutePath() - + QLatin1Char('/') + fileName; + } } - qobject_cast<Qt4Project *>(project)->rootProjectNode() - ->addFiles(UnknownFileType, filesToAddToProject); return adaptRulesFile(project) && adaptControlFile(project); } @@ -247,7 +260,7 @@ bool MaemoTemplatesManager::adaptControlFile(const Project *project) adaptControlFileField(controlContents, "Priority", "optional"); const int buildDependsOffset = controlContents.indexOf("Build-Depends:"); if (buildDependsOffset == -1) { - qWarning("Weird: no Build-Depends field in debian/control file."); + qDebug("Unexpected: no Build-Depends field in debian control file."); } else { int buildDependsNewlineOffset = controlContents.indexOf('\n', buildDependsOffset); @@ -559,8 +572,8 @@ QStringList MaemoTemplatesManager::debianFiles(const Project *project) const QString MaemoTemplatesManager::debianDirPath(const Project *project) const { - return project->projectDirectory() + QLatin1Char('/') - + QLatin1String("/debian"); + return project->projectDirectory() + QLatin1Char('/') + PackagingDirName + + QLatin1Char('/') + DebianDirNameFremantle; } QString MaemoTemplatesManager::changeLogFilePath(const Project *project) const diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri b/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri index 185e248d49..d6869e1b08 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri +++ b/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri @@ -19,7 +19,6 @@ HEADERS += \ $$PWD/maemoprofilewrapper.h \ $$PWD/maemodeployables.h \ $$PWD/maemodeployable.h \ - $$PWD/maemodeployablelistwidget.h \ $$PWD/maemodeploystep.h \ $$PWD/maemodeploystepwidget.h \ $$PWD/maemodeploystepfactory.h \ @@ -54,7 +53,6 @@ SOURCES += \ $$PWD/maemoqemumanager.cpp \ $$PWD/maemoprofilewrapper.cpp \ $$PWD/maemodeployables.cpp \ - $$PWD/maemodeployablelistwidget.cpp \ $$PWD/maemodeploystep.cpp \ $$PWD/maemodeploystepwidget.cpp \ $$PWD/maemodeploystepfactory.cpp \ @@ -75,7 +73,6 @@ FORMS += \ $$PWD/maemosettingswidget.ui \ $$PWD/maemosshconfigdialog.ui \ $$PWD/maemopackagecreationwidget.ui \ - $$PWD/maemodeployablelistwidget.ui \ $$PWD/maemodeploystepwidget.ui \ $$PWD/maemoprofilesupdatedialog.ui diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index 408a259ba8..7758d40080 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -426,6 +426,10 @@ void Qt4Project::updateCppCodeModel() QStringList predefinedFrameworkPaths; QByteArray predefinedMacros; + QString qtFrameworkPath = activeBC->qtVersion()->frameworkInstallPath(); + if (!qtFrameworkPath.isEmpty()) + predefinedFrameworkPaths.append(qtFrameworkPath); + ToolChain *tc = activeBC->toolChain(); if (tc) { predefinedMacros = tc->predefinedMacros(); @@ -587,6 +591,14 @@ void Qt4Project::updateQmlJSCodeModel() foreach (Qt4ProFileNode *node, proFiles) { projectInfo.importPaths.append(node->variableValue(QmlImportPathVar)); } + if (activeTarget() && activeTarget()->activeBuildConfiguration()) { + const QtVersion *qtVersion = activeTarget()->activeBuildConfiguration()->qtVersion(); + if (qtVersion->isValid()) { + const QString qtVersionImportPath = qtVersion->versionInfo().value("QT_INSTALL_IMPORTS"); + if (!qtVersionImportPath.isEmpty()) + projectInfo.importPaths += qtVersionImportPath; + } + } projectInfo.importPaths.removeDuplicates(); if (projectInfo.qmlDumpPath.isNull()) { @@ -1252,7 +1264,11 @@ void CentralizedFolderWatcher::folderChanged(const QString &folder) if (!tmp.isEmpty()) { if (debugCFW) qDebug()<<"found new recursive dirs"<<tmp; - m_watcher.addPaths(tmp.toList()); + + QSet<QString> alreadyAdded = m_watcher.directories().toSet(); + tmp.subtract(alreadyAdded); + if (!tmp.isEmpty()) + m_watcher.addPaths(tmp.toList()); m_recursiveWatchedFolders += tmp; } } diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp index a159022eb0..ada2ba1af9 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp @@ -240,12 +240,12 @@ void Qt4ProjectConfigWidget::qtVersionsChanged() if (validVersions.at(i) == qtVersion) m_ui->qtVersionComboBox->setCurrentIndex(i); } - m_ui->qtVersionComboBox->setEnabled(validVersions.count() > 1); } if (!qtVersion->isValid()) { m_ui->qtVersionComboBox->addItem(tr("Invalid Qt version"), -1); m_ui->qtVersionComboBox->setCurrentIndex(m_ui->qtVersionComboBox->count() - 1); } + m_ui->qtVersionComboBox->setEnabled(m_ui->qtVersionComboBox->count() > 1); m_ignoreChange = false; updateToolChainCombo(); diff --git a/src/plugins/qt4projectmanager/qtoutputformatter.cpp b/src/plugins/qt4projectmanager/qtoutputformatter.cpp index bffae06e0b..017adc442e 100644 --- a/src/plugins/qt4projectmanager/qtoutputformatter.cpp +++ b/src/plugins/qt4projectmanager/qtoutputformatter.cpp @@ -39,7 +39,7 @@ using namespace ProjectExplorer; using namespace Qt4ProjectManager; -QtOutputFormatter::QtOutputFormatter(Qt4Project *project) +QtOutputFormatter::QtOutputFormatter(ProjectExplorer::Project *project) : OutputFormatter() , m_qmlError(QLatin1String("(file:///.+:\\d+:\\d+):")) , m_qtError(QLatin1String("Object::.*in (.*:\\d+)")) @@ -77,14 +77,6 @@ LinkResult QtOutputFormatter::matchLine(const QString &line) const void QtOutputFormatter::appendApplicationOutput(const QString &txt, bool onStdErr) { - // Do the initialization lazily, as we don't have a plaintext edit - // in the ctor - if (!m_linkFormat.isValid()) { - m_linkFormat.setForeground(plainTextEdit()->palette().link().color()); - m_linkFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline); - m_linkFormat.setAnchor(true); - } - QTextCursor cursor(plainTextEdit()->document()); cursor.movePosition(QTextCursor::End); cursor.beginEditBlock(); @@ -166,10 +158,18 @@ void QtOutputFormatter::appendApplicationOutput(const QString &txt, bool onStdEr void QtOutputFormatter::appendLine(QTextCursor &cursor, LinkResult lr, const QString &line, bool onStdErr) { - cursor.insertText(line.left(lr.start), format(onStdErr ? StdErrFormat : StdOutFormat)); - m_linkFormat.setAnchorHref(lr.href); - cursor.insertText(line.mid(lr.start, lr.end - lr.start), m_linkFormat); - cursor.insertText(line.mid(lr.end), format(onStdErr ? StdErrFormat : StdOutFormat)); + const QTextCharFormat normalFormat = format(onStdErr ? StdErrFormat : StdOutFormat); + cursor.insertText(line.left(lr.start), normalFormat); + + QTextCharFormat linkFormat = normalFormat; + const QColor textColor = plainTextEdit()->palette().color(QPalette::Text); + linkFormat.setForeground(mixColors(textColor, QColor(Qt::blue))); + linkFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline); + linkFormat.setAnchor(true); + linkFormat.setAnchorHref(lr.href); + cursor.insertText(line.mid(lr.start, lr.end - lr.start), linkFormat); + + cursor.insertText(line.mid(lr.end), normalFormat); } void QtOutputFormatter::handleLink(const QString &href) @@ -210,7 +210,7 @@ void QtOutputFormatter::handleLink(const QString &href) QFileInfo fi(fileName); if (fi.isRelative()) { // Yeah fileName is relative, no suprise - Qt4Project *pro = m_project.data(); + ProjectExplorer::Project *pro = m_project.data(); if (pro) { QString baseName = fi.fileName(); foreach (const QString &file, pro->files(Project::AllFiles)) { diff --git a/src/plugins/qt4projectmanager/qtoutputformatter.h b/src/plugins/qt4projectmanager/qtoutputformatter.h index 9adda9f6c5..a62b1c1d7a 100644 --- a/src/plugins/qt4projectmanager/qtoutputformatter.h +++ b/src/plugins/qt4projectmanager/qtoutputformatter.h @@ -27,17 +27,22 @@ ** **************************************************************************/ -#ifndef QMLOUTPUTFORMATTER_H -#define QMLOUTPUTFORMATTER_H +#ifndef QTOUTPUTFORMATTER_H +#define QTOUTPUTFORMATTER_H + +#include "qt4projectmanager_global.h" #include <projectexplorer/outputformatter.h> #include <QtCore/QRegExp> #include <QtCore/QSharedPointer> #include <QtGui/QTextCharFormat> +namespace ProjectExplorer { +class Project; +} // namespace ProjectExplorer + namespace Qt4ProjectManager { -class Qt4Project; struct LinkResult { @@ -46,10 +51,10 @@ struct LinkResult QString href; }; -class QtOutputFormatter: public ProjectExplorer::OutputFormatter +class QT4PROJECTMANAGER_EXPORT QtOutputFormatter: public ProjectExplorer::OutputFormatter { public: - QtOutputFormatter(Qt4Project *project); + QtOutputFormatter(ProjectExplorer::Project *project); virtual void appendApplicationOutput(const QString &text, bool onStdErr); @@ -63,13 +68,12 @@ private: QRegExp m_qtError; QRegExp m_qtAssert; QRegExp m_qtTestFail; - QWeakPointer<Qt4Project> m_project; - QTextCharFormat m_linkFormat; + QWeakPointer<ProjectExplorer::Project> m_project; QString m_lastLine; QString m_deferedText; }; -} // namespace QmlProjectManager +} // namespace Qt4ProjectManager -#endif // QMLOUTPUTFORMATTER_H +#endif // QTOUTPUTFORMATTER_H diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index 0e596a0bc0..6173c3f038 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -1089,6 +1089,7 @@ static bool queryQMakeVariables(const QString &binary, QHash<QString, QString> * "QT_INSTALL_BINS", "QT_INSTALL_DOCS", "QT_INSTALL_PREFIX", + "QT_INSTALL_IMPORTS", "QMAKEFEATURES" }; QStringList args; @@ -1723,6 +1724,16 @@ QString QtVersion::headerInstallPath() const return m_versionInfo["QT_INSTALL_HEADERS"]; } +QString QtVersion::frameworkInstallPath() const +{ +#ifdef Q_OS_MAC + updateVersionInfo(); + return m_versionInfo["QT_INSTALL_LIBS"]; +#else + return QString(); +#endif +} + bool QtVersion::hasExamples() const { updateVersionInfo(); diff --git a/src/plugins/qt4projectmanager/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h index ba6dbabab4..b10b023289 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.h +++ b/src/plugins/qt4projectmanager/qtversionmanager.h @@ -135,6 +135,7 @@ public: QString demosPath() const; QString headerInstallPath() const; + QString frameworkInstallPath() const; // All valid Ids are >= 0 int uniqueId() const; diff --git a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp index deb753b07f..8ada0a6ddd 100644 --- a/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/abstractmobileappwizard.cpp @@ -87,6 +87,7 @@ Core::GeneratedFiles AbstractMobileAppWizard::generateFiles(const QWizard *wizar = qobject_cast<const AbstractMobileAppWizardDialog*>(wizard); app()->setSymbianTargetUid(wdlg->m_optionsPage->symbianUid()); app()->setSymbianSvgIcon(wdlg->m_optionsPage->symbianSvgIcon()); + app()->setMaemoPngIcon(wdlg->m_optionsPage->maemoPngIcon()); app()->setOrientation(wdlg->m_optionsPage->orientation()); app()->setNetworkEnabled(wdlg->m_optionsPage->networkEnabled()); return app()->generateFiles(errorMessage); diff --git a/src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp b/src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp index 93198f4453..807f427492 100644 --- a/src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp +++ b/src/plugins/qt4projectmanager/wizards/qmlstandaloneapp.cpp @@ -477,7 +477,7 @@ bool QmlStandaloneApp::updateFiles(const QList<QmlAppGeneratedFileInfo> &list, Q return true; } -const int QmlStandaloneApp::StubVersion = 8; +const int QmlStandaloneApp::StubVersion = 9; } // namespace Internal } // namespace Qt4ProjectManager diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 7259b1b615..c8d82f8a6c 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -4724,7 +4724,7 @@ void BaseTextEditor::changeEvent(QEvent *e) || e->type() == QEvent::FontChange) { if (d->m_extraArea) { QFont f = d->m_extraArea->font(); - f.setPointSize(font().pointSize()); + f.setPointSizeF(font().pointSizeF()); d->m_extraArea->setFont(f); slotUpdateExtraAreaWidth(); d->m_extraArea->update(); diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp index 540f2d53a8..6d8b994e90 100644 --- a/src/plugins/texteditor/fontsettings.cpp +++ b/src/plugins/texteditor/fontsettings.cpp @@ -172,7 +172,7 @@ QTextCharFormat FontSettings::toTextCharFormat(const QString &category) const if (category == textCategory) { tf.setFontFamily(m_family); - tf.setFontPointSize(m_fontSize * m_fontZoom / 100); + tf.setFontPointSize(m_fontSize * m_fontZoom / 100.); tf.setFontStyleStrategy(m_antialias ? QFont::PreferAntialias : QFont::NoAntialias); } diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp index 74060a2e2e..ea1a0b0a2c 100644 --- a/src/plugins/texteditor/plaintexteditor.cpp +++ b/src/plugins/texteditor/plaintexteditor.cpp @@ -63,7 +63,8 @@ PlainTextEditorEditable::PlainTextEditorEditable(PlainTextEditor *editor) PlainTextEditor::PlainTextEditor(QWidget *parent) : BaseTextEditor(parent), m_isMissingSyntaxDefinition(false), - m_ignoreMissingSyntaxDefinition(false) + m_ignoreMissingSyntaxDefinition(false), + m_indenter(new NormalIndenter) // Currently only "normal" indentation is supported. { setRevisionsVisible(true); setMarksVisible(true); @@ -199,11 +200,6 @@ void PlainTextEditor::configure(const Core::MimeType &mimeType) setFontSettings(TextEditorSettings::instance()->fontSettings()); - // @todo: Indentation specification through the definition files is not really being used - // because Kate recommends to configure indentation through another feature. Maybe we should - // provide something similar in Creator? For now, only normal indentation is supported. - m_indenter.reset(new NormalIndenter); - emit configured(editableInterface()); } diff --git a/src/plugins/texteditor/plaintexteditor.h b/src/plugins/texteditor/plaintexteditor.h index 7d7917ff9f..45ae953271 100644 --- a/src/plugins/texteditor/plaintexteditor.h +++ b/src/plugins/texteditor/plaintexteditor.h @@ -96,8 +96,8 @@ private: bool m_isMissingSyntaxDefinition; bool m_ignoreMissingSyntaxDefinition; - Utils::CommentDefinition m_commentDefinition; QScopedPointer<Indenter> m_indenter; + Utils::CommentDefinition m_commentDefinition; }; } // namespace TextEditor diff --git a/src/plugins/texteditor/snippetsparser.cpp b/src/plugins/texteditor/snippetsparser.cpp index 040d662dca..ce3cf21704 100644 --- a/src/plugins/texteditor/snippetsparser.cpp +++ b/src/plugins/texteditor/snippetsparser.cpp @@ -77,7 +77,7 @@ const QList<CompletionItem> &SnippetsParser::execute(ICompletionCollector *colle item.text += QLatin1Char(' '); item.text += description; } - item.data = QVariant::fromValue(data); + item.data = QVariant::fromValue(data.trimmed()); QString infotip = data; while (infotip.size() && infotip.at(infotip.size()-1).isSpace()) diff --git a/src/qtcreatorlibrary.pri b/src/qtcreatorlibrary.pri index a1663e5b4c..35f2af4f24 100644 --- a/src/qtcreatorlibrary.pri +++ b/src/qtcreatorlibrary.pri @@ -1,5 +1,8 @@ include(../qtcreator.pri) +# use precompiled header for libraries by default +isEmpty(PRECOMPILED_HEADER):PRECOMPILED_HEADER = $$PWD/shared/qtcreator_pch.h + win32 { DLLDESTDIR = $$IDE_APP_PATH } diff --git a/src/qtcreatorplugin.pri b/src/qtcreatorplugin.pri index 76a068687a..f18f4f5b9c 100644 --- a/src/qtcreatorplugin.pri +++ b/src/qtcreatorplugin.pri @@ -1,5 +1,8 @@ include(../qtcreator.pri) +# use gui precompiled header for plugins by default +isEmpty(PRECOMPILED_HEADER):PRECOMPILED_HEADER = $$PWD/shared/qtcreator_gui_pch.h + isEmpty(PROVIDER) { PROVIDER = Nokia } diff --git a/src/shared/qtcreator_gui_pch.h b/src/shared/qtcreator_gui_pch.h new file mode 100644 index 0000000000..333265c6ed --- /dev/null +++ b/src/shared/qtcreator_gui_pch.h @@ -0,0 +1,52 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +/* + * This is a precompiled header file for use in Xcode / Mac GCC / + * GCC >= 3.4 / VC to greatly speed the building of Qt Creator. + */ + +#include "qtcreator_pch.h" + +#if defined __cplusplus + +#include <QtCore/QEvent> +#include <QtCore/QTimer> +#include <QtGui/QApplication> +#include <QtGui/QBitmap> +#include <QtGui/QCursor> +#include <QtGui/QDesktopWidget> +#include <QtGui/QImage> +#include <QtGui/QLayout> +#include <QtGui/QPainter> +#include <QtGui/QPixmap> +#include <QtGui/QStyle> +#include <QtGui/QWidget> + +#endif diff --git a/src/shared/qtcreator_pch.h b/src/shared/qtcreator_pch.h new file mode 100644 index 0000000000..60f9c49ace --- /dev/null +++ b/src/shared/qtcreator_pch.h @@ -0,0 +1,58 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 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. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +/* + * This is a precompiled header file for use in Xcode / Mac GCC / + * GCC >= 3.4 / VC to greatly speed the building of Qt Creator. + */ + +#if defined __cplusplus +#include <QtCore/QtGlobal> + +#ifdef Q_WS_WIN +# define _POSIX_ +# include <limits.h> +# undef _POSIX_ +#endif + +#include <QtCore/QCoreApplication> +#include <QtCore/QList> +#include <QtCore/QVariant> +#include <QtCore/QObject> +#include <QtCore/QRegExp> +#include <QtCore/QString> +#include <QtCore/QStringList> +#include <QtCore/QTextCodec> +#include <QtCore/QPointer> +#include <QtCore/QScopedPointer> +#include <QtCore/QSharedPointer> +#include <QtCore/QDebug> + +#include <stdlib.h> +#endif |