Merge remote branch 'origin/2.2'

Conflicts:
	src/plugins/debugger/disassembleragent.cpp
This commit is contained in:
dt
2011-03-21 17:48:19 +01:00
168 changed files with 3038 additions and 1057 deletions

64
README
View File

@@ -182,8 +182,28 @@ we thank the authors who made this possible:
* Open Source front-end for C++ (license MIT), enhanced for use in Qt Creator * Open Source front-end for C++ (license MIT), enhanced for use in Qt Creator
Roberto Raggi <roberto.raggi@gmail.com> Roberto Raggi <roberto.raggi@gmail.com>
QtCreator/src/shared/cplusplus QtCreator/src/shared/cplusplus
Copyright 2005 Roberto Raggi <roberto@kdevelop.org>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Botan, a C++ crypto library. Version 1.8.8 * Botan, a C++ crypto library. Version 1.8.8
Copyright (C) 1999-2004 The Botan Project. All rights reserved. Copyright (C) 1999-2004 The Botan Project. All rights reserved.
@@ -227,6 +247,7 @@ we thank the authors who made this possible:
The source code of Botan C++ crypto library can be found in The source code of Botan C++ crypto library can be found in
QtCreator/src/libs/3rdparty QtCreator/src/libs/3rdparty
* NetSieben SSH Library is a Secure Shell client library for C++. Version 1.3.2 * NetSieben SSH Library is a Secure Shell client library for C++. Version 1.3.2
Commercial License: For organizations who do not want to release the source Commercial License: For organizations who do not want to release the source
@@ -247,3 +268,46 @@ we thank the authors who made this possible:
The source code of NetSieben Secure Shell C++ Library can be found in The source code of NetSieben Secure Shell C++ Library can be found in
QtCreator/src/libs/3rdparty. QtCreator/src/libs/3rdparty.
* ClassView and ImageViewer plugins
Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved.
Copyright (c) 2010 Denis Mingulov.
Contact: Nokia Corporation (qt-info@nokia.com)
This file is part of Qt Creator.
You may use this file under the terms of the BSD license as follows:
"Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."

46
dist/changes-2.2.0 vendored
View File

@@ -9,14 +9,20 @@ git log --cherry-pick --pretty=oneline origin/master...origin/2.1
General General
* Added support for running user defined external tools (Tools->External) * Added support for running user defined external tools (Tools->External)
* Moved toolchain definitions out of Qt versions. You can now define * Moved toolchain definitions out of Qt versions.
toolchains in Tools->Options->ToolChains. Creator now supports * You can now define toolchains in Tools->Options->ToolChains
more than one instance of each kind of toolchain. * Creator now supports more than one instance of each kind of toolchain
Editing Editing
* Add new Inkpot color scheme * Add new Inkpot color scheme
* Moved 'Open in External Editor' to Tools->External->Text * Moved 'Open in External Editor' to Tools->External->Text
* Add UTF-8 BOM support * Add UTF-8 BOM support
* GLSL Support with:
- syntax checking
- highlighting
- code completion
* Add 'expand/collapse all' context menu entry to Outline pane
* Support for user defined macros was contributed by Nicolas Arnaud-Cormos
Project Support Project Support
* QMake project support should be more robust against syntax errors * QMake project support should be more robust against syntax errors
@@ -29,18 +35,19 @@ Project Support
- this affects working directories and executable paths as well - this affects working directories and executable paths as well
* CMake: Add Ui completion, changes in .ui files are picked up without * CMake: Add Ui completion, changes in .ui files are picked up without
a rebuild. a rebuild.
* Syntax highlighting and completion for QMake project files
Debugging Debugging
* Rewrote debugging engine using the Microsoft Console Debugger (CDB) * Rewrote debugging engine using the Microsoft Console Debugger (CDB)
for debugging executables built with Microsoft Visual Studio, for debugging executables built with Microsoft Visual Studio,
resulting in significant speed-up and better display of data resulting in significant speed-up and better display of data
types, supporting both 32bit and 64bit versions of the types, supporting both 32bit and 64bit versions of the
Debugging Tools for Windows. Debugging Tools for Windows
* Made it possible to pin debugger tooltips. * Made it possible to pin debugger tooltips.
* Reworked global architecture to allow multiple debugging sessions (for * Reworked global architecture to allow multiple debugging sessions (for
different projects, combined Qml/C++ debugging, project 'snapshots', ...) different projects, combined Qml/C++ debugging, project 'snapshots', ...)
* Reworked breakpoint handling: new special breakpoint types for "break * Reworked breakpoint handling: new special breakpoint types for "break
on throw", "break on main", data breakpoints. on throw", "break on main", data breakpoints
* Introduce combined c++/qml debugging (combined stack, cross-step) (gdb only) * Introduce combined c++/qml debugging (combined stack, cross-step) (gdb only)
* Rework per-type and per-item selection of display formats * Rework per-type and per-item selection of display formats
* New dumpers for QTextCursor, QTextDocument, __m128, QScriptValue * New dumpers for QTextCursor, QTextDocument, __m128, QScriptValue
@@ -64,6 +71,7 @@ Debugging
* Handle "live updates" in the memory view * Handle "live updates" in the memory view
* Make memory view writable (gdb only) * Make memory view writable (gdb only)
* Improve starting debugger session directly from the command line * Improve starting debugger session directly from the command line
* Improve debugging helpers dialog
BinEditor: BinEditor:
* Visualize data differences after updates * Visualize data differences after updates
@@ -71,7 +79,6 @@ BinEditor:
* Allow copying also if selection is "backwards" * Allow copying also if selection is "backwards"
* Do not draw blinking cursor when there is a selection * Do not draw blinking cursor when there is a selection
Help Help
C++ Support C++ Support
@@ -80,11 +87,11 @@ C++ Support
* Fix switch statement indentation for GNU and Whitesmiths * Fix switch statement indentation for GNU and Whitesmiths
style, QTCREATORBUG-2994 style, QTCREATORBUG-2994
* Fix indentation of labels * Fix indentation of labels
* Highlighting for virtual functions
* Navigate to correct overloaded function/method
* Snippets for class/struct/loops
QML/JS Support QML/JS Support
* Gui cosmetics in JS debugger: Show stack frame level, only valid
line numbers in stack view, do not show function code, show dummy
child entry for empty arrays
* Add wizard for creating JavaScript files, QTCREATORBUG-3070 * Add wizard for creating JavaScript files, QTCREATORBUG-3070
* Add local-file completion for url properties, QTCREATORBUG-2619 * Add local-file completion for url properties, QTCREATORBUG-2619
* Add warning about invalid files in url properties * Add warning about invalid files in url properties
@@ -106,9 +113,23 @@ QML/JS Support
* Fix quote autoinsertion in string literals, QTCREATORBUG-2155, QTCREATORBUG-3244 * Fix quote autoinsertion in string literals, QTCREATORBUG-2155, QTCREATORBUG-3244
* Fix '{' not being an electric character, QTCREATORBUG-3405 * Fix '{' not being an electric character, QTCREATORBUG-3405
* Fix indentation of 'foo: Namesp.Type {', QTCREATORBUG-3371 * Fix indentation of 'foo: Namesp.Type {', QTCREATORBUG-3371
* .qmlproject format: Allow specifying the 'mainFile' qml file, bump version to 1.1
* Qt Quick UI project: allow user to change run environment
QML/JS Debugging:
* Compile qmljsdebugger code as static library, and link it based on checkbox in qmake step
(replaces QMLJSDEBUGGER_PATH / QMLJSDEBUGGER define)
* Qt Quick Application: Allow debugging also in release builds, improve error diagnostics
* Gui cosmetics in JS debugger: Show stack frame level, only valid
line numbers in stack view, do not show function code, show dummy
child entry for empty arrays
* Added qml tooltips for property inspection at debug time * Added qml tooltips for property inspection at debug time
* Extended QML Observer for inspection and tweaking of item's properties * Extended QML Observer for inspection and tweaking of item's properties
* Added navigation of the object tree in the QML Observer through a crumble path * Added navigation of the object tree in the QML Observer through a crumble path
* Add 'show app on top' option
* Move toolbar from Observer tab to the main toolbar space
* Support setting of breakpoints in .qml files embedded as qrc resources
* Improve 'linkification' of QML errors in Application Output pane
FakeVim: FakeVim:
* Implement Ctrl-N/Ctrl-P * Implement Ctrl-N/Ctrl-P
@@ -132,6 +153,7 @@ Maemo Target
Designer Designer
Version control plugins Version control plugins
* Bazaar support was contributed by Hugues Delorme
Wizards Wizards
* Support new keywords %MONTH% and %DAY% for C++ template file * Support new keywords %MONTH% and %DAY% for C++ template file
@@ -141,10 +163,12 @@ Misc
* Create infrastructure to setup "soft dependencies" between plugins * Create infrastructure to setup "soft dependencies" between plugins
* Add a little tool 'qtpromaker' doing the job of 'qmake -project', but * Add a little tool 'qtpromaker' doing the job of 'qmake -project', but
much faster to make Qt Creator usable to quickly inspect and navigate much faster to make Qt Creator usable to quickly inspect and navigate
"alien" codebases a way to easily set up dummy .pro files is needed. "alien" codebases a way to easily set up dummy .pro files is needed
* Start documenting Qt Creator's coding style guidelines * Start documenting Qt Creator's coding style guidelines
Additional credits go to: Additional credits go to:
* The Inkpot color scheme was based on the Vim color scheme by * The Inkpot color scheme was based on the Vim color scheme by
Ciaran McCreesh, adapted for Qt Creator by Jan Kundrát and Ciaran McCreesh, adapted for Qt Creator by Jan Kundrát and
subsequently updated by Campbell Barton. subsequently updated by Campbell Barton
* Hugues Delorme for the bazaar plugin which he continues to improve
* Nicolas Arnaud-Cormos for the Macro plugin

13
dist/known-issues vendored Normal file
View File

@@ -0,0 +1,13 @@
The Qt Creator Manual lists known issues in Qt Creator:
http://doc.qt.nokia.com/qtcreator-snapshot/creator-known-issues.html
For a complete list of reported issues, see the Qt Bug Tracker:
http://bugreports.qt.nokia.com/
For a list of fixed issues and added features, see the changelog file in the qtcreator\dist folder or the Qt Bug Tracker.

View File

@@ -1,9 +0,0 @@
Mac:
DYLD_IMAGE_SUFFIX does not work on Mac OS X Snow Leopard. So don't use the
corresponding setting in the Projects tab.
See: http://wimleers.com/blog/dyld-image-suffix-causing-havoc-on-mac-os-x-snow-leopard
A possible workaround is:
sudo mv /usr/lib/libSystem.B_debug.dylib /usr/lib/libSystem.B_debug.dylib.backup
sudo cp /usr/lib/libSystem.B.dylib /usr/lib/libSystem.B_debug.dylib.backup

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

@@ -263,6 +263,8 @@
\o Mercurial \o Mercurial
\o Bazaar
\endlist \endlist
The functions available to you in Qt Creator depend on the version control The functions available to you in Qt Creator depend on the version control
@@ -610,6 +612,7 @@
You can use Qt Creator in the following modes: You can use Qt Creator in the following modes:
\list \list
\o \gui Welcome mode for opening projects.
\o \gui{\l{Using the Editor}{Edit}} mode for editing project and source files. \o \gui{\l{Using the Editor}{Edit}} mode for editing project and source files.
\o \gui{\l{Developing Application UI}{Design}} mode for designing and developing \o \gui{\l{Developing Application UI}{Design}} mode for designing and developing
application user interfaces. This mode is available for UI files (.ui or application user interfaces. This mode is available for UI files (.ui or
@@ -644,8 +647,7 @@
\o \gui {Class View} shows the class hierarchy of the currently \o \gui {Class View} shows the class hierarchy of the currently
open projects. open projects.
\o \gui Outline shows the symbol hierachy of a C++ file and the element hierarchy of a QML file. \o \gui Outline shows the symbol hierachy of a C++ file and the element hierarchy of a QML file.
\o \gui {Type Hierarchy} shows the base classes of a class. For \o \gui {Type Hierarchy} shows the base classes of a class.
more information, see \l{Viewing Type Hierarchy}.
\endlist \endlist
@@ -723,6 +725,11 @@
\endlist \endlist
\section2 Viewing Type Hierarchy
To view the base classes of a class, right-click the class and select
\gui {Open Type Hierarchy} or press \key {Ctrl+Shift+T}.
\section1 Viewing Output \section1 Viewing Output
The task pane in Qt Creator can display one of the following panes: The task pane in Qt Creator can display one of the following panes:
@@ -1779,11 +1786,6 @@
To switch between the definition and declaration of a symbol, press \key {Shift+F2} To switch between the definition and declaration of a symbol, press \key {Shift+F2}
or right-click the symbol and select \gui {Switch Between Method Declaration/Definition}. or right-click the symbol and select \gui {Switch Between Method Declaration/Definition}.
\section1 Viewing Type Hierarchy
To view the base classes of a class, right-click the class and select
\gui {Open Type Hierarchy} or press \key {Ctrl+Shift+T}.
\section1 Using Update Code Model \section1 Using Update Code Model
To refresh the internal information in Qt Creator pertaining to your code, To refresh the internal information in Qt Creator pertaining to your code,
@@ -1979,8 +1981,7 @@
\o Select \gui {Tools > External > Configure}. \o Select \gui {Tools > External > Configure}.
\o Select \o Select \gui {Add > Add Tool}
\inlineimage qtcreator-windows-add.png
to add a new tool. You can also select \gui {Add Category} to add a to add a new tool. You can also select \gui {Add Category} to add a
new category. new category.
@@ -2892,17 +2893,17 @@
\list \list
\o Qt Quick Projects \o Qt Quick Project
Use QML to define the user interface and, Use QML to define the user interface and,
optionally, C++ or JavaScript to define the application logic optionally, C++ or JavaScript to define the application logic
\o Qt Widget Projects \o Qt Widget Project
Use \QD forms to define a Qt widget based Use \QD forms to define a Qt widget based
user interface and C++ to define the application logic user interface and C++ to define the application logic
\o Other Projects \o Other Project
\list \list
@@ -2920,6 +2921,12 @@
\endlist \endlist
\o Project from Version Control
Import a project from a supported version control system. For more
information on how version control systems are integrated in
Qt Creator, see \l{Using Version Control Systems}.
\endlist \endlist
To create a new project, select \gui File > \gui{New File or Project} and To create a new project, select \gui File > \gui{New File or Project} and
@@ -3679,7 +3686,7 @@
\gui{Qt Versions}. \gui{Qt Versions}.
\o Qt Creator automatically sets the correct environment variables for \o Qt Creator automatically sets the correct environment variables for
compilation. Select the internal version number of the installed compilation. Select the internal version number of the installed
Microsoft Visual C++ tool chain in the \gui Toolchain list. Microsoft Visual C++ tool chain in the \gui tool chain list.
\image qtcreator-qt4-qtversions-win-msvc.png \image qtcreator-qt4-qtversions-win-msvc.png
@@ -6210,29 +6217,33 @@
Version control systems supported by Qt Creator are: Version control systems supported by Qt Creator are:
\table \table
\header \header
\i \bold{Version Control System} \i Version Control System
\i \bold{Address} \i Address
\i \bold{Notes} \i Notes
\row \row
\i \bold{Git} \i Bazaar
\i \l{http://git-scm.com/} \i \l{http://bazaar.canonical.com/}
\i \i Qt Creator 2.2 and later
\row \row
\i \bold{Subversion} \i CVS
\i \l{http://subversion.tigris.org/}
\i
\row
\i \bold{Perforce}
\i \l{http://www.perforce.com}
\i Server version 2006.1 and later
\row
\i \bold{CVS}
\i \l{http://www.cvshome.org} \i \l{http://www.cvshome.org}
\i \i
\row \row
\i \bold{Mercurial} \i Git
\i \l{http://git-scm.com/}
\i
\row
\i Mercurial
\i \l{http://mercurial.selenic.com/} \i \l{http://mercurial.selenic.com/}
\i Qt Creator 2.0 and later \i Qt Creator 2.0 and later
\row
\i Perforce
\i \l{http://www.perforce.com}
\i Server version 2006.1 and later
\row
\i Subversion
\i \l{http://subversion.apache.org/}
\i
\endtable \endtable
@@ -6297,22 +6308,36 @@
Reviewed-by: Reviewed-by:
Signed-off-by: Signed-off-by:
\endcode \endcode
\endlist
The fields above appear below the submit message. They provide completion The fields above appear below the submit message. They provide completion
for the aliases/public user names specified in the for the aliases/public user names specified in the
\e{User/alias configuration file} as well as a button that opens the \e{User/alias configuration file} as well as a button that opens the
aforementioned user name dialog. aforementioned user name dialog.
\o \gui{SSH prompt command} specifies an ssh-askpass command that you
can use (on Linux) to prompt the user for a password when using SSH.
For example, \c ssh-askpass or \c x11-ssh-askpass, depending on the
ssh-askpass implementation that you use.
\endlist
\section1 Creating VCS Repositories for New Projects \section1 Creating VCS Repositories for New Projects
Qt Creator allows for creating VCS repositories for version Qt Creator allows you to create repositories for version
control systems that support local repository creation, such as control systems that support local repository creation, such as
Git or Mercurial. Git, Mercurial, or Bazaar.
When creating a new project by selecting \gui File > When creating a new project by selecting \gui File >
\gui{New File or Project...}, you can choose a version \gui{New File or Project...}, you can choose a version
control system in the final wizard page. control system in the final wizard page.
You can also select \gui Tools and then select \gui {Create Repository...}
in the submenu for the version control system.
To import a project that is under version control, choose \gui {File >
New File or Project... > Project from Version Control} and select the
version control system that you use. Follow the instructions of the
wizard to import the project.
\section1 Using Version Control Systems \section1 Using Version Control Systems
The \gui{Tools} menu contains a submenu for each supported version The \gui{Tools} menu contains a submenu for each supported version
@@ -6355,8 +6380,7 @@
\section2 Viewing Versioning History and Change Details \section2 Viewing Versioning History and Change Details
Display the versioning history of a file by selecting \gui{Log} Display the versioning history of a file by selecting \gui{Log}
(for Git and Mercurial) or \gui{Filelog} (for CVS, Perforce, and or \gui{Filelog}. Typically, the log output contains the date, the commit
Subversion). Typically, the log output contains the date, the commit
message, and a change or revision identifier. Click on the identifier to message, and a change or revision identifier. Click on the identifier to
display a description of the change including the diff. display a description of the change including the diff.
Right-clicking on an identifier brings up a context menu that lets you Right-clicking on an identifier brings up a context menu that lets you
@@ -6426,6 +6450,68 @@
\endlist \endlist
\section2 Viewing Status
You can select \gui{Status...} to view the status of the project or
repository.
\section2 Updating the Working Tree
You can select \gui Update to update your working tree with the latest
changes from the branch. Some version control systems allow you to choose
between updating the current project and updating all projects.
With Git, you stash your changes and then pull the changes from the
repository.
\section2 Deleting Files
You can select \gui Delete to delete obsolete files from the repository.
With Git, you delete the files from the working tree and then stage the
deleted files for a commit.
\section2 Using Additional Bazaar Functions
Bazaar is a free version control system sponsored by Canonical.
The \gui Bazaar submenu contains the following additional items:
\table
\header
\o Menu Item
\o Description
\row
\i \gui{Pull...}
\i Turn the branch into a mirror of another branch.
\row
\i \gui{Push...}
\i Update a mirror of the branch.
\endtable
\section2 Using Additional CVS Functions
CVS is an open source version control system.
The \gui CVS submenu contains the following additional items:
\table
\header
\o Menu Item
\o Description
\row
\i \gui{Edit}
\i Open a file for editing.
\row
\i \gui{Push...}
\i Push changes to the remote repository.
\row
\i \gui{Unedit}
\i Discard the changes that you made in a file.
\endtable
\section2 Using Additional Git Functions \section2 Using Additional Git Functions
Git is a fast decentralized version control system. Git is available Git is a fast decentralized version control system. Git is available
@@ -6434,7 +6520,9 @@
The \gui Git submenu contains the following additional items: The \gui Git submenu contains the following additional items:
\table \table
\header
\o Menu Item
\o Description
\row \row
\i \gui {Patch > Apply from Editor/Apply from File...} \i \gui {Patch > Apply from Editor/Apply from File...}
\i Patches are rewriting instructions that can be applied to a set of files. \i Patches are rewriting instructions that can be applied to a set of files.
@@ -6453,6 +6541,9 @@
of patches and project files) are displayed in the \gui {Clean Repository} 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 dialog. Select the files to delete and click \gui Delete. This allows you to
clean a build completely. clean a build completely.
\row
\i \gui{Launch gitk}
\i Start the commit viewer for Git, gitk.
\row \row
\i \gui{Branches...} \i \gui{Branches...}
@@ -6472,6 +6563,10 @@
\i \gui{Show Commit...} \i \gui{Show Commit...}
\i Select a commit to view. Enter the SHA of the commit \i Select a commit to view. Enter the SHA of the commit
in the \gui Change field. in the \gui Change field.
\row
\i \gui{Amend Last Commit...}
\i Revert the last commit.
\endtable \endtable
\section3 Using Stashes \section3 Using Stashes
@@ -6483,6 +6578,9 @@
Qt Creator exposes this functionality in the \gui{Tools > Git > Stash} menu. Qt Creator exposes this functionality in the \gui{Tools > Git > Stash} menu.
\table \table
\header
\o Menu Item
\o Description
\row \row
\i \gui{Stashes...} \i \gui{Stashes...}
\i Display a dialog that shows all known stashes with options to restore, \i Display a dialog that shows all known stashes with options to restore,
@@ -6506,9 +6604,14 @@
\section2 Using Additional Mercurial Functionality \section2 Using Additional Mercurial Functionality
Mercurial is a free, distributed source control management tool.
The \gui Mercurial submenu contains the following additional items: The \gui Mercurial submenu contains the following additional items:
\table \table
\header
\o Menu Item
\o Description
\row \row
\i \gui{Import} \i \gui{Import}
\i Apply changes from a patch file. \i Apply changes from a patch file.
@@ -6524,12 +6627,15 @@
\i \gui{Pull} \i \gui{Pull}
\i Pull changes from the remote repository. \i Pull changes from the remote repository.
\row \row
\i \gui{Update} \i \gui{Push}
\i Look at an earlier version of the code. \i Push changes to the remote repository.
\endtable \endtable
\section2 Using Additional Perforce Functions \section2 Using Additional Perforce Functions
Perforce is a fast software configuration management system developed by
Perforce Software.
When you start Qt Creator, it looks for the executable specified When you start Qt Creator, it looks for the executable specified
in the \gui{P4 command} field in \gui{Tools > Options... > Version in the \gui{P4 command} field in \gui{Tools > Options... > Version
Control > Perforce}. If the file is not found, the following error Control > Perforce}. If the file is not found, the following error
@@ -6547,6 +6653,9 @@
The \gui Perforce submenu contains the following additional items: The \gui Perforce submenu contains the following additional items:
\table \table
\header
\o Menu Item
\o Description
\row \row
\i \gui{Describe...} \i \gui{Describe...}
\i View information about changelists and the files in them. \i View information about changelists and the files in them.
@@ -6559,28 +6668,23 @@
\row \row
\i \gui{Pending Changes...} \i \gui{Pending Changes...}
\i Group files for commit. \i Group files for commit.
\row
\i \gui{Update All/Update Current Project}
\i Fetch the current version of the current project or all
projects from the repository.
\endtable \endtable
\section2 Using Additional Subversion Functions \section2 Using Additional Subversion Functions
Subversion is an open source version control system.
The \gui Subversion submenu contains the following additional items: The \gui Subversion submenu contains the following additional items:
\table \table
\header
\o Menu Item
\o Description
\row \row
\i \gui{Describe...} \i \gui{Describe...}
\i Display commit log messages for a revision. \i Display commit log messages for a revision.
\row
\i \gui{Update Project/Update Repository}
\i Update your working copy.
\endtable \endtable
*/ */
@@ -7285,7 +7389,7 @@
\o Retrieves the contents of local variables. \o Retrieves the contents of local variables.
\o Examines \gui Watchers. \o Examines \gui Watchers.
\o Updates the \gui Registers, \gui Modules, and \gui Disassembler \o Updates the \gui Registers, \gui Modules, and \gui Disassembler
views if you are debugging the C++ language. views if you are debugging the C++ based applications.
\endlist \endlist
You can use the \gui Debug mode views to examine the data in more detail. You can use the \gui Debug mode views to examine the data in more detail.
@@ -7298,6 +7402,8 @@
\o To execute a line of code as a whole, press \key{F10}. \o To execute a line of code as a whole, press \key{F10}.
\o To step into a function or a subfunction, press \key{F11}. \o To step into a function or a subfunction, press \key{F11}.
\o To continue running the program, press \key{F5}. \o To continue running the program, press \key{F5}.
\o To run to the selected function when you are stepping into a nested
function, press \key{Ctrl+F6}.
\endlist \endlist
@@ -7318,21 +7424,35 @@
\image qtcreator-debug-breakpoints.png "Breakpoints view" \image qtcreator-debug-breakpoints.png "Breakpoints view"
Typically, breakpoints are associated with a source code file and line, or You can associate breakpoints with:
the start of a function -- both are allowed in Qt Creator.
\list
\o Source code files and lines
\o Functions
\o Addresses
\o Throwing and catching exceptions
\o Some system calls, such as \c fork(), \c vfork(), and \c exec()
\endlist
You can also set watchpoints to monitor the changes in a block of memory
at a particular address when a program is running.
The interruption of a program by a breakpoint can be restricted with The interruption of a program by a breakpoint can be restricted with
certain conditions. certain conditions.
To set a breakpoint: To set a breakpoint at a particular line you want the program to stop,
click the left margin or press \key F9 (\key F8 for Mac OS X).
\list To set breakpoints and watchpoints select \gui {Add Breakpoint...} in
\o At a particular line you want the program to stop, click the the context menu in the \gui Breakpoints view.
left margin or press \key F9 (\key F8 for Mac OS X).
\o At a function that you want the program to interrupt, enter the \image qtcreator-add-breakpoint.png "Add Breakpoints" dialog
function's name in \gui{Set Breakpoint at Function...} located in the
context menu of the \gui{Breakpoints} view.
\endlist
\note You can remove a breakpoint: \note You can remove a breakpoint:
\list \list
@@ -7347,6 +7467,28 @@
while it is running under the debugger's control. Breakpoints are saved while it is running under the debugger's control. Breakpoints are saved
together with a session. together with a session.
\section2 Setting Watchpoints
To set a watchpoint at an address:
\list 1
\o Right-click in the \gui Breakpoints view to open the context menu,
and select \gui {Add Breakpoint...}.
\o In the \gui {Breakpoint type} field, select \gui {Address
(Watchpoint)}.
\o In the \gui Address field, specify the address of the memory block.
\o Select \gui OK.
\endlist
If the address is displayed in the \gui {Locals and Watchers} view, you can
select \gui {Add Watchpoint at Object's Address} in the context menu to set
the watchpoint.
\section1 Viewing Call Stack Trace \section1 Viewing Call Stack Trace
When the program being debugged is interrupted, Qt Creator displays the When the program being debugged is interrupted, Qt Creator displays the
@@ -7436,7 +7578,22 @@
\note The set of watched items is saved in your session. \note The set of watched items is saved in your session.
\section1 Debugging the C++ Language \section1 Directly Interacting with Native Debuggers
In some cases, it is convenient to directly interact with the command
line of the native debugger. In Qt Creator, you can use the left
pane of the \gui {Debugger Log} view for that purpose. When you press
\key {Ctrl+Return}, the contents of the line under the text cursor
are sent directly to the native debugger. Alternatively, you
can use the line edit at the bottom of the view. Output is displayed in the
right pane of the \gui {Debugger Log} view.
\note Usually, you do not need this feature, because Qt Creator provides
you with better ways to handle the task. For example, instead of using the
gdb \c print command from the command line, you can create a watcher item
in the \gui{Locals and Watchers} view and examine the expression there.
\section1 Debugging C++ Based Applications
The following sections describe additional debugging functions that apply The following sections describe additional debugging functions that apply
only to debugging C++. only to debugging C++.
@@ -7996,7 +8153,7 @@
workspaces that you can use in the compiler environment of your choice. workspaces that you can use in the compiler environment of your choice.
Since Qt Creator 1.1, CMake configuration files are supported. Since Qt Creator 1.1, CMake configuration files are supported.
Qt Creator 1.3 supports the Microsoft Toolchain if the CMake version Qt Creator 1.3 supports the Microsoft tool chain if the CMake version
is at least 2.8. is at least 2.8.
\section1 Setting the Path for CMake \section1 Setting the Path for CMake
@@ -10238,6 +10395,9 @@
\row \row
\o Toggle breakpoint \o Toggle breakpoint
\o F9 \o F9
\row
\o Run to selected function
\o Ctrl+F6
\endtable \endtable
@@ -10562,6 +10722,18 @@
paths may fail. For example, remounting parts of a file system paths may fail. For example, remounting parts of a file system
using the --bind mount option. using the --bind mount option.
\o You must use a workaround to use the DYLD_IMAGE_SUFFIX option in the
\gui Projects tab on Mac OS X Snow Leopard. For more information on
the issue, see
\l{http://wimleers.com/blog/dyld-image-suffix-causing-havoc-on-mac-os-x-snow-leopard}{DYLD_IMAGE_SUFFIX causing havoc on Mac OS X Snow Leopard}.
To use the option, enter the following commands in the Terminal
application:
\code
sudo mv /usr/lib/libSystem.B_debug.dylib /usr/lib/libSystem.B_debug.dylib.backup
sudo cp /usr/lib/libSystem.B.dylib /usr/lib/libSystem.B_debug.dylib.backup
\endcode
\endlist \endlist
\section1 Qt Quick Designer Issues \section1 Qt Quick Designer Issues

View File

@@ -53,7 +53,7 @@ ToolBarColorBox::ToolBarColorBox(QWidget *parent) :
QLabel(parent) QLabel(parent)
{ {
m_copyHexColor = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-hicontrast.png")), m_copyHexColor = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-hicontrast.png")),
tr("Copy"), this); tr("Copy Color"), this);
connect(m_copyHexColor, SIGNAL(triggered()), SLOT(copyColorToClipboard())); connect(m_copyHexColor, SIGNAL(triggered()), SLOT(copyColorToClipboard()));
setScaledContents(false); setScaledContents(false);
} }
@@ -116,12 +116,6 @@ void ToolBarColorBox::contextMenuEvent(QContextMenuEvent *ev)
contextMenu.exec(ev->globalPos()); contextMenu.exec(ev->globalPos());
} }
void ToolBarColorBox::mouseDoubleClickEvent(QMouseEvent *)
{
QColorDialog dialog(m_color);
dialog.show();
}
void ToolBarColorBox::copyColorToClipboard() void ToolBarColorBox::copyColorToClipboard()
{ {
QClipboard *clipboard = QApplication::clipboard(); QClipboard *clipboard = QApplication::clipboard();

View File

@@ -52,7 +52,6 @@ public:
protected: protected:
void contextMenuEvent(QContextMenuEvent *ev); void contextMenuEvent(QContextMenuEvent *ev);
void mouseDoubleClickEvent(QMouseEvent *);
void mousePressEvent(QMouseEvent *ev); void mousePressEvent(QMouseEvent *ev);
void mouseMoveEvent(QMouseEvent *ev); void mouseMoveEvent(QMouseEvent *ev);
private slots: private slots:

View File

@@ -541,17 +541,15 @@ bool QDeclarativeViewObserver::showAppOnTop() const
void QDeclarativeViewObserver::setShowAppOnTop(bool appOnTop) void QDeclarativeViewObserver::setShowAppOnTop(bool appOnTop)
{ {
if (data->view) { if (data->view) {
QWidget *rootWidget = data->view; QWidget *window = data->view->window();
while (rootWidget->parentWidget()) Qt::WindowFlags flags = window->windowFlags();
rootWidget = rootWidget->parentWidget();
Qt::WindowFlags flags = rootWidget->windowFlags();
if (appOnTop) if (appOnTop)
flags |= Qt::WindowStaysOnTopHint; flags |= Qt::WindowStaysOnTopHint;
else else
flags &= ~Qt::WindowStaysOnTopHint; flags &= ~Qt::WindowStaysOnTopHint;
rootWidget->setWindowFlags(flags); window->setWindowFlags(flags);
rootWidget->show(); window->show();
} }
data->showAppOnTop = appOnTop; data->showAppOnTop = appOnTop;

View File

@@ -4,6 +4,10 @@ folder_01.source = html
DEPLOYMENTFOLDERS = folder_01 DEPLOYMENTFOLDERS = folder_01
# DEPLOYMENTFOLDERS_END # # DEPLOYMENTFOLDERS_END #
# Define TOUCH_OPTIMIZED_NAVIGATION for touch optimization and flicking
# TOUCH_OPTIMIZED_NAVIGATION #
DEFINES += TOUCH_OPTIMIZED_NAVIGATION
# TARGETUID3 # # TARGETUID3 #
symbian:TARGET.UID3 = 0xE1111234 symbian:TARGET.UID3 = 0xE1111234

View File

@@ -3,7 +3,7 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css"> <style type="text/css">
body { margin: 0; font-size: 2em; } body { margin: 0; font-size: 2em; background-color: white; }
h1 { text-align: center; color: red; } h1 { text-align: center; color: red; }
h1 + h1 { color: green; } h1 + h1 { color: green; }
h1:last-child { color: blue; } h1:last-child { color: blue; }

View File

@@ -18,6 +18,890 @@
#include <QtWebKit/QGraphicsWebView> #include <QtWebKit/QGraphicsWebView>
#include <QtWebKit/QWebFrame> #include <QtWebKit/QWebFrame>
#ifdef TOUCH_OPTIMIZED_NAVIGATION
#include <QtCore/QTimer>
#include <QtGui/QGraphicsSceneMouseEvent>
#include <QtWebKit/QWebElement>
const int KCumlativeDistanceThreshold = 40;
const int KDecelerationCount = 4;
const int KDecelerationTimerSpeed = 10;
const int KFlickScrollThreshold = 400;
const int KJitterBufferThreshold = 200;
const qreal KDecelerationSlowdownFactor = 0.975;
const int KTouchDownStartTime = 200;
const int KHoverTimeoutThreshold = 100;
const int KNodeSearchThreshold = 400;
class WebTouchPhysicsInterface : public QObject
{
Q_OBJECT
public:
WebTouchPhysicsInterface(QObject *parent = 0);
virtual ~WebTouchPhysicsInterface();
static WebTouchPhysicsInterface* getSingleton();
virtual bool inMotion() = 0;
virtual void stop() = 0;
virtual void start(const QPointF &pressPoint, const QWebFrame *frame) = 0;
virtual bool move(const QPointF &pressPoint) = 0;
virtual bool release(const QPointF &pressPoint) = 0;
signals:
void positionChanged(const QPointF &point, const QPoint &startPressPoint);
public slots:
virtual void setRange(const QRectF &range) = 0;
private:
static WebTouchPhysicsInterface* s_instance;
};
WebTouchPhysicsInterface* WebTouchPhysicsInterface::s_instance = 0;
WebTouchPhysicsInterface::WebTouchPhysicsInterface(QObject *parent)
: QObject(parent)
{
}
WebTouchPhysicsInterface::~WebTouchPhysicsInterface()
{
if (s_instance == this)
s_instance = 0;
}
class WebTouchPhysics : public WebTouchPhysicsInterface
{
Q_OBJECT
public:
WebTouchPhysics(QObject *parent = 0);
virtual ~WebTouchPhysics();
virtual bool inMotion();
virtual void stop();
virtual void start(const QPointF &pressPoint, const QWebFrame *frame);
virtual bool move(const QPointF &pressPoint);
virtual bool release(const QPointF &pressPoint);
signals:
void setRange(const QRectF &range);
public slots:
void decelerationTimerFired();
void changePosition(const QPointF &point);
bool isFlick(const QPointF &point, int distance) const;
bool isPan(const QPointF &point, int distance) const;
private:
QPointF m_previousPoint;
QPoint m_startPressPoint;
QPointF m_decelerationSpeed;
QList<QPointF> m_decelerationPoints;
QTimer m_decelerationTimer;
QPointF m_cumlativeDistance;
const QWebFrame* m_frame;
bool m_inMotion;
};
WebTouchPhysicsInterface* WebTouchPhysicsInterface::getSingleton()
{
if (!s_instance)
s_instance = new WebTouchPhysics;
return s_instance;
}
int fastDistance(const QPoint &p, const QPoint &q)
{
return (p.x() - q.x()) * (p.x() - q.x()) + (p.y() - q.y()) * (p.y() - q.y());
}
WebTouchPhysics::WebTouchPhysics(QObject *parent)
: WebTouchPhysicsInterface(parent)
, m_frame(0)
, m_inMotion(false)
{
connect(&m_decelerationTimer, SIGNAL(timeout()), this, SLOT(decelerationTimerFired()));
}
WebTouchPhysics::~WebTouchPhysics()
{
}
bool WebTouchPhysics::inMotion()
{
return m_inMotion;
}
void WebTouchPhysics::stop()
{
m_decelerationTimer.stop();
m_cumlativeDistance = QPoint();
m_previousPoint = QPoint();
m_startPressPoint = QPoint();
m_decelerationPoints.clear();
m_inMotion = false;
}
void WebTouchPhysics::start(const QPointF &pressPoint, const QWebFrame *frame)
{
if (!frame)
return;
m_frame = frame;
m_decelerationPoints.push_front(pressPoint);
m_decelerationTimer.setSingleShot(false);
m_decelerationTimer.setInterval(KDecelerationTimerSpeed);
m_previousPoint = pressPoint;
m_startPressPoint = pressPoint.toPoint();
}
bool WebTouchPhysics::move(const QPointF &pressPoint)
{
int distance = fastDistance(pressPoint.toPoint(), m_startPressPoint);
if (isFlick(pressPoint, distance) || isPan(pressPoint, distance)) {
changePosition(pressPoint);
return true;
}
return false;
}
bool WebTouchPhysics::release(const QPointF &pressPoint)
{
// use the cumulative distance in this case because it seems like a positive user experience
if (m_cumlativeDistance.manhattanLength() > KCumlativeDistanceThreshold) {
m_decelerationSpeed = (m_decelerationPoints.back() - pressPoint) / (m_decelerationPoints.count() + 1);
m_decelerationTimer.start();
return true;
} else {
m_inMotion = false;
return false;
}
}
void WebTouchPhysics::changePosition(const QPointF &point)
{
m_inMotion = true;
QPointF diff = m_previousPoint - point;
emit positionChanged(diff, m_startPressPoint);
m_cumlativeDistance += (point - m_previousPoint);
m_previousPoint = point;
m_decelerationPoints.push_front(point);
if (m_decelerationPoints.count() > KDecelerationCount)
m_decelerationPoints.pop_back();
}
void WebTouchPhysics::decelerationTimerFired()
{
if (!m_frame) {
m_decelerationTimer.stop();
return;
}
if (qAbs(m_decelerationSpeed.x()) < KDecelerationSlowdownFactor
&& qAbs(m_decelerationSpeed.y()) < KDecelerationSlowdownFactor) {
m_inMotion = false;
m_decelerationTimer.stop();
return;
}
m_decelerationSpeed *= KDecelerationSlowdownFactor;
emit positionChanged(QPoint(m_decelerationSpeed.x(), m_decelerationSpeed.y()), m_startPressPoint);
}
bool WebTouchPhysics::isFlick(const QPointF &pressPoint, int distance) const
{
Q_UNUSED(pressPoint)
// this mouse move event is far away from the touch down position in
// less than xx sec, the user must want to scroll quickly.
return !m_inMotion && distance > KFlickScrollThreshold;
}
bool WebTouchPhysics::isPan(const QPointF &pressPoint, int distance) const
{
Q_UNUSED(pressPoint)
return distance > KJitterBufferThreshold;
}
class WebTouchEvent
{
public:
QPoint m_pos;
QEvent::Type m_type;
Qt::MouseButton m_button;
Qt::MouseButtons m_buttons;
bool m_graphicsSceneEvent;
bool m_fired;
bool m_editable;
Qt::KeyboardModifiers m_modifier;
//Graphics scene event members
QPointF m_scenePos;
QPoint m_screenPos;
QPointF m_buttonDownPos;
QPointF m_buttonDownScenePos;
QPoint m_buttonDownScreenPos;
QPointF m_lastPos;
QPointF m_lastScenePos;
QPoint m_lastScreenPos;
WebTouchEvent()
: m_type(QEvent::None)
, m_button(Qt::NoButton)
, m_buttons(Qt::NoButton)
, m_graphicsSceneEvent(false)
, m_fired(false)
, m_editable(false)
, m_modifier(Qt::NoModifier)
{}
WebTouchEvent(const QMouseEvent *mouseEvent)
{
Q_ASSERT(mouseEvent != 0);
m_type = mouseEvent->type();
m_pos = mouseEvent->pos();
m_button = mouseEvent->button();
m_buttons = mouseEvent->buttons();
m_modifier = mouseEvent->modifiers();
m_fired = false;
m_editable = false;
m_graphicsSceneEvent = false;
}
WebTouchEvent(const QGraphicsSceneMouseEvent *graphicsSceneMouseEvent)
{
Q_ASSERT(graphicsSceneMouseEvent != 0);
m_type = graphicsSceneMouseEvent->type();
m_pos = graphicsSceneMouseEvent->pos().toPoint();
m_button = graphicsSceneMouseEvent->button();
m_buttons = graphicsSceneMouseEvent->buttons();
m_modifier = graphicsSceneMouseEvent->modifiers();
m_scenePos = graphicsSceneMouseEvent->scenePos();
m_screenPos = graphicsSceneMouseEvent->screenPos();
m_buttonDownPos = graphicsSceneMouseEvent->buttonDownPos(graphicsSceneMouseEvent->button());
m_buttonDownScenePos = graphicsSceneMouseEvent->buttonDownScenePos(graphicsSceneMouseEvent->button());
m_buttonDownScreenPos = graphicsSceneMouseEvent->buttonDownScreenPos(graphicsSceneMouseEvent->button());
m_lastPos = graphicsSceneMouseEvent->lastPos();
m_lastScenePos = graphicsSceneMouseEvent->lastScenePos();
m_lastScreenPos = graphicsSceneMouseEvent->lastScreenPos();
m_fired = false;
m_editable = false;
m_graphicsSceneEvent = true;
}
};
class WebTouchScroller : public QObject
{
Q_OBJECT
public:
WebTouchScroller(QObject *parent = 0);
virtual ~WebTouchScroller();
signals:
void rangeChanged(const QRectF &range);
public slots:
void setFrame(QWebFrame* frame);
void scroll(const QPointF &delta, const QPoint &scrollStartPoint);
private:
QWebFrame* m_webFrame;
QSize m_range;
};
void qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy, const QPoint &pos)
{
Q_UNUSED(pos)
if (!qFrame)
return;
bool scrollHorizontal = false;
bool scrollVertical = false;
do {
if (qFrame->scrollBarPolicy(Qt::Horizontal) == Qt::ScrollBarAlwaysOn) {
if (dx > 0) // scroll right
scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) < qFrame->scrollBarMaximum(Qt::Horizontal);
else if (dx < 0) // scroll left
scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) > qFrame->scrollBarMinimum(Qt::Horizontal);
} else {
scrollHorizontal = true;
}
if (qFrame->scrollBarPolicy(Qt::Vertical) == Qt::ScrollBarAlwaysOn) {
if (dy > 0) // scroll down
scrollVertical = qFrame->scrollBarValue(Qt::Vertical) < qFrame->scrollBarMaximum(Qt::Vertical);
else if (dy < 0) //scroll up
scrollVertical = qFrame->scrollBarValue(Qt::Vertical) > qFrame->scrollBarMinimum(Qt::Vertical);
} else {
scrollVertical = true;
}
if (scrollHorizontal || scrollVertical) {
qFrame->scroll(dx, dy);
return;
}
qFrame = qFrame->parentFrame();
} while (qFrame);
}
WebTouchScroller::WebTouchScroller(QObject *parent)
: QObject(parent)
, m_webFrame(0)
{
}
WebTouchScroller::~WebTouchScroller()
{
}
void WebTouchScroller::setFrame(QWebFrame* frame)
{
m_webFrame = frame;
}
void WebTouchScroller::scroll(const QPointF &delta, const QPoint &scrollStartPoint)
{
if (!m_webFrame)
return;
qtwebkit_webframe_scrollRecursively(m_webFrame, delta.x(), delta.y(),
scrollStartPoint - m_webFrame->scrollPosition());
}
class WebTouchNavigation : public QObject
{
Q_OBJECT
public:
WebTouchNavigation(QObject *object, QWebPage *webPage);
virtual ~WebTouchNavigation();
protected:
bool eventFilter(QObject *object, QEvent *event);
void handleDownEvent(const WebTouchEvent &event);
void handleMoveEvent(const WebTouchEvent &event);
void handleReleaseEvent(const WebTouchEvent &event);
public slots:
void hoverTimerFired();
void downTimerFired();
void quickDownTimerFired();
void quickUpTimerFired();
private:
void invalidateLastTouchDown();
void generateMouseEvent(const WebTouchEvent &touchEvent);
private:
WebTouchPhysicsInterface* m_physics;
WebTouchScroller* m_scroller;
WebTouchEvent m_touchDown;
QObject* m_viewObject;
QWebPage* m_webPage;
QWebFrame* m_webFrame;
QTimer m_downTimer;
QTimer m_hoverTimer;
QTimer m_quickDownTimer;
QTimer m_quickUpTimer;
bool m_suppressMouseEvents;
};
int xInRect(const QRect &r, int x)
{
int x1 = qMin(x, r.right()-2);
return qMax(x1, r.left()+2);
}
int yInRect(const QRect &r, int y)
{
int y1 = qMin(y, r.bottom()-2);
return qMax(y1, r.top()+2);
}
int wtnFastDistance(const QPoint &p, const QPoint &q)
{
return (p.x() - q.x()) * (p.x() - q.x()) + (p.y() - q.y()) * (p.y() - q.y());
}
QPoint frameViewPosition(QWebFrame *frame)
{
QPoint fp;
QWebFrame* f = frame;
while (1) {
fp += f->pos();
f = f->parentFrame();
if (f) {
fp -= f->scrollPosition();
} else
break;
}
return fp;
}
QPoint closestElement(QObject *viewObject, QWebFrame *frame, WebTouchEvent &touchEvent, int searchThreshold)
{
Q_UNUSED(viewObject)
QPoint adjustedPoint(touchEvent.m_pos);
QWebHitTestResult htr = frame->hitTestContent(adjustedPoint);
if (htr.isContentEditable()) {
QString type = htr.element().attribute("type").toLower();
// Don't summon the vkb for a hidden input element.
// This should never happen anyway.
if (type == "hidden") {
touchEvent.m_editable = false;
return adjustedPoint;
}
// Don't summon the vkb for a disabled input; in fact, close the vkbd.
QString disabled = htr.element().attribute("disabled").toLower();
if (disabled == "disabled" || disabled == "true") {
touchEvent.m_editable = false;
return adjustedPoint;
}
// QtWebKit EditorClientQt already enables these input hints. Thus, this should only be
// enabled if QtWebKit happens to be old. Qt::ImhNoPredictiveText is only enalbed for Symbian / Maemo on WebKit side.
touchEvent.m_editable = true;
return adjustedPoint;
}
if (!htr.element().tagName().toLower().compare("select") && htr.element().hasAttribute("multiple")) {
touchEvent.m_modifier = Qt::ControlModifier;
return adjustedPoint;
}
// If clicked element need receive event, do NOT adjust
// like : achor, input, map, button, textarea
QString tagName = htr.element().tagName().toLower();
if (!htr.linkElement().isNull() ||
!tagName.compare("input") ||
!tagName.compare("map") ||
!tagName.compare("button") ||
!tagName.compare("textarea") ||
htr.element().hasAttribute("onClick"))
return adjustedPoint;
// Attempt to find the closest radio button or checkbox. Their areas can be so
// small that we need to adjust the our position to be exactly on them if in the vicinity.
QString selector = "input[type=\"radio\"], input[type=\"checkbox\"]";
QWebElementCollection elementList = frame->findAllElements(selector);
QWebElementCollection::iterator it(elementList.begin());
// find the origin of current frame position in view based coordinate
QPoint originPoint = frameViewPosition(frame);
// transfer the event position from view based coordinate to the current frame's content based coordinate
QPoint frameScrollPoint = frame->scrollPosition();
QPoint framePoint = adjustedPoint - originPoint + frameScrollPoint;
QPoint adjustedFramePoint = framePoint;
// find the closest element
int maxDist = searchThreshold;
while (it != elementList.end()) {
QRect nRect((*it).geometry());
if (nRect.isValid()) {
QPoint pt(xInRect(nRect, framePoint.x()), yInRect(nRect, framePoint.y()));
int dist = wtnFastDistance(pt, framePoint);
if (dist < maxDist) {
adjustedFramePoint = pt;
maxDist = dist;
}
}
++it;
}
// transfer the adjusted position from the current frame's content based coordinate to view based coordinate
adjustedPoint = adjustedFramePoint - frameScrollPoint + originPoint;
return adjustedPoint;
}
WebTouchNavigation::WebTouchNavigation(QObject *parent, QWebPage *webPage)
: m_viewObject(parent)
, m_webPage(webPage)
, m_suppressMouseEvents(false)
{
Q_ASSERT(m_webPage);
connect(&m_downTimer, SIGNAL(timeout()), this, SLOT(downTimerFired()));
connect(&m_hoverTimer, SIGNAL(timeout()), this, SLOT(hoverTimerFired()));
connect(&m_quickDownTimer, SIGNAL(timeout()), this, SLOT(quickDownTimerFired()));
connect(&m_quickUpTimer, SIGNAL(timeout()), this, SLOT(quickUpTimerFired()));
m_physics = WebTouchPhysicsInterface::getSingleton();
m_physics->setParent(this);
m_scroller = new WebTouchScroller(this);
connect(m_physics, SIGNAL(positionChanged(QPointF, QPoint)), m_scroller, SLOT(scroll(QPointF, QPoint)));
connect(m_scroller, SIGNAL(rangeChanged(QRectF)), m_physics, SLOT(setRange(QRectF)));
}
WebTouchNavigation::~WebTouchNavigation()
{
}
bool WebTouchNavigation::eventFilter(QObject *object, QEvent *event)
{
if (object != m_viewObject)
return false;
bool eventHandled = false;
switch (event->type()) {
case QEvent::MouseButtonPress:
if (static_cast<QMouseEvent*>(event)->buttons() & Qt::LeftButton) {
WebTouchEvent e(static_cast<QMouseEvent*>(event));
handleDownEvent(e);
}
eventHandled = true;
break;
case QEvent::MouseMove:
if (static_cast<QMouseEvent*>(event)->buttons() & Qt::LeftButton) {
WebTouchEvent e(static_cast<QMouseEvent*>(event));
handleMoveEvent(e);
}
eventHandled = true;
break;
case QEvent::MouseButtonRelease:
{
WebTouchEvent e(static_cast<QMouseEvent*>(event));
handleReleaseEvent(e);
eventHandled = true;
}
break;
case QEvent::GraphicsSceneMousePress:
if (static_cast<QGraphicsSceneMouseEvent*>(event)->buttons() & Qt::LeftButton) {
WebTouchEvent e(static_cast<QGraphicsSceneMouseEvent*>(event));
handleDownEvent(e);
}
eventHandled = true;
break;
case QEvent::GraphicsSceneMouseMove:
if (static_cast<QGraphicsSceneMouseEvent *>(event)->buttons() & Qt::LeftButton) {
WebTouchEvent e(static_cast<QGraphicsSceneMouseEvent*>(event));
handleMoveEvent(e);
}
eventHandled = true;
break;
case QEvent::GraphicsSceneMouseRelease:
{
WebTouchEvent e(static_cast<QGraphicsSceneMouseEvent*>(event));
handleReleaseEvent(e);
eventHandled = true;
}
break;
case QEvent::MouseButtonDblClick:
case QEvent::ContextMenu:
case QEvent::CursorChange:
case QEvent::DragEnter:
case QEvent::DragLeave:
case QEvent::DragMove:
case QEvent::Drop:
case QEvent::GrabMouse:
case QEvent::GraphicsSceneContextMenu:
case QEvent::GraphicsSceneDragEnter:
case QEvent::GraphicsSceneDragLeave:
case QEvent::GraphicsSceneDragMove:
case QEvent::GraphicsSceneDrop:
case QEvent::GraphicsSceneHelp:
case QEvent::GraphicsSceneHoverEnter:
case QEvent::GraphicsSceneHoverLeave:
case QEvent::GraphicsSceneHoverMove:
case QEvent::HoverEnter:
case QEvent::HoverLeave:
case QEvent::HoverMove:
case QEvent::Gesture:
case QEvent::GestureOverride:
eventHandled = true;
break;
default:
break;
}
return eventHandled;
}
void WebTouchNavigation::quickDownTimerFired()
{
m_touchDown.m_type = (m_touchDown.m_graphicsSceneEvent) ? QEvent::GraphicsSceneMousePress : QEvent::MouseButtonPress;
m_touchDown.m_pos = closestElement(m_viewObject, m_webFrame, m_touchDown, KNodeSearchThreshold);
m_touchDown.m_button = Qt::LeftButton;
m_touchDown.m_buttons = Qt::NoButton;
generateMouseEvent(m_touchDown);
m_quickUpTimer.setSingleShot(true);
m_quickUpTimer.start(0);
}
void WebTouchNavigation::quickUpTimerFired()
{
m_touchDown.m_type = (m_touchDown.m_graphicsSceneEvent) ? QEvent::GraphicsSceneMouseRelease : QEvent::MouseButtonRelease;
m_touchDown.m_button = Qt::LeftButton;
m_touchDown.m_buttons = Qt::NoButton;
generateMouseEvent(m_touchDown);
}
void WebTouchNavigation::downTimerFired()
{
m_touchDown.m_type = (m_touchDown.m_graphicsSceneEvent) ? QEvent::GraphicsSceneMousePress : QEvent::MouseButtonPress;
m_touchDown.m_pos = closestElement(m_viewObject, m_webFrame, m_touchDown, KNodeSearchThreshold);
m_touchDown.m_button = Qt::LeftButton;
m_touchDown.m_buttons = Qt::NoButton;
generateMouseEvent(m_touchDown);
m_touchDown.m_fired = true;
}
void WebTouchNavigation::hoverTimerFired()
{
m_touchDown.m_type = (m_touchDown.m_graphicsSceneEvent) ? QEvent::GraphicsSceneMouseMove : QEvent::MouseMove;
m_touchDown.m_button = Qt::NoButton;
m_touchDown.m_buttons = Qt::NoButton;
generateMouseEvent(m_touchDown);
}
void WebTouchNavigation::invalidateLastTouchDown()
{
if (m_touchDown.m_fired) {
// send mouse up event invalidate click
m_touchDown.m_type = (m_touchDown.m_graphicsSceneEvent) ? QEvent::GraphicsSceneMouseRelease : QEvent::MouseButtonRelease;
m_touchDown.m_pos = QPoint(-1, -1);
m_touchDown.m_button = Qt::LeftButton;
m_touchDown.m_buttons = Qt::NoButton;
m_touchDown.m_editable = false;
generateMouseEvent(m_touchDown);
}
}
void WebTouchNavigation::handleDownEvent(const WebTouchEvent &event)
{
// Stop previously running physics
m_physics->stop();
m_downTimer.stop();
m_hoverTimer.stop();
m_quickDownTimer.stop();
m_quickUpTimer.stop();
m_webFrame = m_webPage->frameAt(event.m_pos);
if (!m_webFrame)
m_webFrame = m_webPage->currentFrame();
m_scroller->setFrame(m_webFrame);
m_touchDown = event;
m_hoverTimer.setSingleShot(true);
m_hoverTimer.start(KHoverTimeoutThreshold);
m_downTimer.setSingleShot(true);
m_downTimer.start(KTouchDownStartTime);
// Start physics again
m_physics->start(event.m_pos, m_webFrame);
}
void WebTouchNavigation::handleMoveEvent(const WebTouchEvent &event)
{
if (m_physics->move(event.m_pos)) {
// don't send mouse down event.
m_downTimer.stop();
m_hoverTimer.stop();
}
}
void WebTouchNavigation::handleReleaseEvent(const WebTouchEvent &event)
{
if (!m_physics->inMotion() && (m_hoverTimer.isActive() || m_downTimer.isActive())) { // Quick tap
if (m_hoverTimer.isActive()) {
m_touchDown.m_type = (m_touchDown.m_graphicsSceneEvent) ? QEvent::GraphicsSceneMouseMove : QEvent::MouseMove;
m_touchDown.m_button = Qt::NoButton;
m_touchDown.m_buttons = Qt::NoButton;
generateMouseEvent(m_touchDown);
}
m_hoverTimer.stop();
m_downTimer.stop();
m_quickDownTimer.setSingleShot(true);
m_quickDownTimer.start(0);
return;
}
m_hoverTimer.stop();
m_downTimer.stop();
if (m_physics->release(event.m_pos)) {
// Going to kinetic motion. Thus, invalidating last touch down.
invalidateLastTouchDown();
return;
}
if (m_touchDown.m_fired) {
// send mouse up event
m_touchDown.m_type = (m_touchDown.m_graphicsSceneEvent) ? QEvent::GraphicsSceneMouseRelease : QEvent::MouseButtonRelease;
m_touchDown.m_button = Qt::LeftButton;
m_touchDown.m_buttons = Qt::NoButton;
generateMouseEvent(m_touchDown);
}
}
void WebTouchNavigation::generateMouseEvent(const WebTouchEvent &touchEvent)
{
if (!touchEvent.m_editable && m_suppressMouseEvents) //do not suppress mouse events for input box, etc.
return;
if (touchEvent.m_type == QEvent::GraphicsSceneMousePress
|| touchEvent.m_type == QEvent::GraphicsSceneMouseMove
|| touchEvent.m_type == QEvent::GraphicsSceneMouseRelease) {
QGraphicsSceneMouseEvent ievmm(touchEvent.m_type);
ievmm.setPos(touchEvent.m_pos);
ievmm.setScenePos(touchEvent.m_scenePos);
ievmm.setScreenPos(touchEvent.m_screenPos);
ievmm.setButtonDownPos(touchEvent.m_button, touchEvent.m_buttonDownPos);
ievmm.setButtonDownScenePos( touchEvent.m_button, touchEvent.m_buttonDownScenePos);
ievmm.setButtonDownScreenPos( touchEvent.m_button, touchEvent.m_buttonDownScreenPos);
ievmm.setLastPos(touchEvent.m_lastPos);
ievmm.setLastScenePos(touchEvent.m_lastScenePos);
ievmm.setLastScreenPos(touchEvent.m_lastScreenPos);
ievmm.setButtons(touchEvent.m_buttons);
ievmm.setButton( touchEvent.m_button);
ievmm.setModifiers(touchEvent.m_modifier);
m_webPage->event(&ievmm);
} else {
bool inputMethodEnabled = static_cast<QWidget*>(m_viewObject)->testAttribute(Qt::WA_InputMethodEnabled);
if (touchEvent.m_type == QEvent::MouseButtonRelease && inputMethodEnabled) {
if (touchEvent.m_editable) {
QEvent rsipevent(QEvent::RequestSoftwareInputPanel);
QCoreApplication::sendEvent(static_cast<QWidget*>(m_viewObject), &rsipevent);
} else {
static_cast<QWidget*>(m_viewObject)->setAttribute(Qt::WA_InputMethodEnabled, false); // disable input methods if user didn't tap on editable area.
}
}
QMouseEvent ievmm(touchEvent.m_type, touchEvent.m_pos, touchEvent.m_button, touchEvent.m_buttons, touchEvent.m_modifier);
m_webPage->event(&ievmm);
if (touchEvent.m_type == QEvent::MouseButtonRelease && inputMethodEnabled)
static_cast<QWidget*>(m_viewObject)->setAttribute(Qt::WA_InputMethodEnabled, inputMethodEnabled); // re-enable input methods if disabled
}
}
class WebNavigation : public QObject
{
Q_OBJECT
public:
WebNavigation(QObject *parent, QWebPage *webPage);
virtual ~WebNavigation();
private:
QObject *m_viewObject;
QWebPage *m_webPage;
WebTouchNavigation *m_webTouchNavigation;
};
WebNavigation::WebNavigation(QObject *parent, QWebPage *webPage)
: m_viewObject(parent)
, m_webPage(webPage)
, m_webTouchNavigation(0)
{
m_webTouchNavigation = new WebTouchNavigation(m_viewObject, m_webPage);
m_viewObject->installEventFilter(m_webTouchNavigation);
}
WebNavigation::~WebNavigation()
{
delete m_webTouchNavigation;
}
class NavigationControllerPrivate
{
public:
NavigationControllerPrivate(QWidget *parent, QGraphicsWebView *webView);
~NavigationControllerPrivate();
QWebPage *m_webPage;
QWidget *m_webWidget;
QGraphicsWebView *m_graphicsWebView;
WebNavigation *m_webNavigation;
};
NavigationControllerPrivate::NavigationControllerPrivate(QWidget *parent, QGraphicsWebView *webView)
: m_webPage(0)
, m_webWidget(0)
, m_graphicsWebView(webView)
, m_webNavigation(0)
{
Q_UNUSED(parent)
m_graphicsWebView->setAcceptTouchEvents(true);
m_webPage = new QWebPage;
m_graphicsWebView->setPage(m_webPage);
m_webNavigation = new WebNavigation(m_graphicsWebView, m_webPage);
m_webNavigation->setParent(m_graphicsWebView);
}
NavigationControllerPrivate::~NavigationControllerPrivate()
{
if (m_webNavigation)
delete m_webNavigation;
if (m_webPage)
delete m_webPage;
if (m_graphicsWebView)
delete m_graphicsWebView;
}
class NavigationController : public QObject
{
Q_OBJECT
public:
NavigationController(QWidget *parent, QGraphicsWebView *webView);
virtual ~NavigationController();
QWidget *webWidget() const;
QWebPage* webPage() const;
QGraphicsWebView* graphicsWebView() const;
signals:
void pauseNavigation();
void resumeNavigation();
private:
class NavigationControllerPrivate *m_d;
};
NavigationController::NavigationController(QWidget *parent, QGraphicsWebView *webView)
: m_d(new NavigationControllerPrivate(parent, webView))
{
}
NavigationController::~NavigationController()
{
delete m_d;
}
QWebPage* NavigationController::webPage() const
{
return m_d->m_webPage;
}
QGraphicsWebView* NavigationController::graphicsWebView() const
{
return m_d->m_graphicsWebView;
}
#endif // TOUCH_OPTIMIZED_NAVIGATION
class Html5ApplicationViewerPrivate : public QGraphicsView class Html5ApplicationViewerPrivate : public QGraphicsView
{ {
Q_OBJECT Q_OBJECT
@@ -38,6 +922,9 @@ signals:
public: public:
QGraphicsWebView *m_webView; QGraphicsWebView *m_webView;
#ifdef TOUCH_OPTIMIZED_NAVIGATION
NavigationController *m_controller;
#endif // TOUCH_OPTIMIZED_NAVIGATION
}; };
Html5ApplicationViewerPrivate::Html5ApplicationViewerPrivate(QWidget *parent) Html5ApplicationViewerPrivate::Html5ApplicationViewerPrivate(QWidget *parent)
@@ -50,7 +937,14 @@ Html5ApplicationViewerPrivate::Html5ApplicationViewerPrivate(QWidget *parent)
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_webView = new QGraphicsWebView; m_webView = new QGraphicsWebView;
m_webView->setAcceptTouchEvents(true);
m_webView->setAcceptHoverEvents(false);
setAttribute(Qt::WA_AcceptTouchEvents, true);
scene->addItem(m_webView); scene->addItem(m_webView);
scene->setActiveWindow(m_webView);
#ifdef TOUCH_OPTIMIZED_NAVIGATION
m_controller = new NavigationController(parent, m_webView);
#endif // TOUCH_OPTIMIZED_NAVIGATION
connect(m_webView->page()->mainFrame(), connect(m_webView->page()->mainFrame(),
SIGNAL(javaScriptWindowObjectCleared()), SLOT(addToJavaScript())); SIGNAL(javaScriptWindowObjectCleared()), SLOT(addToJavaScript()));
} }

View File

@@ -362,6 +362,7 @@ bool ContextPaneWidget::setType(const QStringList &types)
} }
if (types.contains("Rectangle")) { if (types.contains("Rectangle")) {
m_currentWidget = m_rectangleWidget; m_currentWidget = m_rectangleWidget;
m_rectangleWidget->enabableGradientEditing(!isPropertyChanges());
m_rectangleWidget->show(); m_rectangleWidget->show();
resize(sizeHint()); resize(sizeHint());
return true; return true;

View File

@@ -99,6 +99,10 @@ public:
bool setType(const QStringList &types); bool setType(const QStringList &types);
bool acceptsType(const QStringList &types); bool acceptsType(const QStringList &types);
QWidget* currentWidget() const { return m_currentWidget; } QWidget* currentWidget() const { return m_currentWidget; }
void setIsPropertyChanges(bool b)
{ m_isPropertyChanges = b; }
bool isPropertyChanges() const
{ return m_isPropertyChanges; }
public slots: public slots:
void onTogglePane(); void onTogglePane();
@@ -143,6 +147,7 @@ private:
QString m_colorName; QString m_colorName;
QPoint m_originalPos; QPoint m_originalPos;
bool m_pinned; bool m_pinned;
bool m_isPropertyChanges;
}; };
} //QmlDesigner } //QmlDesigner

View File

@@ -654,11 +654,11 @@ void PreviewLabel::paintEvent(QPaintEvent *event)
if (m_left >= 0) if (m_left >= 0)
p.drawLine(m_left * m_zoom, 4, m_left * m_zoom, height() - 4); p.drawLine(m_left * m_zoom, 4, m_left * m_zoom, height() - 4);
if (m_right >= 0) if (m_right >= 0)
p.drawLine(width() - m_right * m_zoom, 4, width() - m_right * m_zoom, height() - 4); p.drawLine(width() - m_right * m_zoom - 1, 4, width() - m_right * m_zoom - 1, height() - 4);
if (m_top >= 0) if (m_top >= 0)
p.drawLine(4, m_top * m_zoom, width() - 4, m_top * m_zoom); p.drawLine(4, m_top * m_zoom, width() - 4, m_top * m_zoom);
if (m_bottom >= 0) if (m_bottom >= 0)
p.drawLine(4, height() - m_bottom * m_zoom, width() - 4, height() - m_bottom * m_zoom); p.drawLine(4, height() - m_bottom * m_zoom - 1, width() - 4, height() - m_bottom * m_zoom - 1);
} }
{ {
@@ -671,11 +671,11 @@ void PreviewLabel::paintEvent(QPaintEvent *event)
if (m_left >= 0) if (m_left >= 0)
p.drawLine(m_left * m_zoom, 4, m_left * m_zoom, height() - 4); p.drawLine(m_left * m_zoom, 4, m_left * m_zoom, height() - 4);
if (m_right >= 0) if (m_right >= 0)
p.drawLine(width() - m_right * m_zoom, 4, width() - m_right * m_zoom, height() - 4); p.drawLine(width() - m_right * m_zoom - 1, 4, width() - m_right * m_zoom - 1, height() - 4);
if (m_top >= 0) if (m_top >= 0)
p.drawLine(4, m_top * m_zoom, width() - 4, m_top * m_zoom); p.drawLine(4, m_top * m_zoom, width() - 4, m_top * m_zoom);
if (m_bottom >= 0) if (m_bottom >= 0)
p.drawLine(4, height() - m_bottom * m_zoom, width() - 4, height() - m_bottom * m_zoom); p.drawLine(4, height() - m_bottom * m_zoom - 1, width() - 4, height() - m_bottom * m_zoom - 1);
} }
} }
} }
@@ -690,6 +690,8 @@ void PreviewLabel::mousePressEvent(QMouseEvent * event)
if (!m_borderImage) if (!m_borderImage)
return QLabel::mouseMoveEvent(event); return QLabel::mouseMoveEvent(event);
bool bottom = false;
if (event->button() == Qt::LeftButton) { if (event->button() == Qt::LeftButton) {
if (QApplication::overrideCursor()) if (QApplication::overrideCursor())
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
@@ -717,11 +719,15 @@ void PreviewLabel::mousePressEvent(QMouseEvent * event)
event->accept(); event->accept();
m_hooverInfo->setText("Bottom " + QString::number(m_bottom)); m_hooverInfo->setText("Bottom " + QString::number(m_bottom));
m_hooverInfo->show(); m_hooverInfo->show();
bottom = true;
} else { } else {
QLabel::mousePressEvent(event); QLabel::mousePressEvent(event);
} }
m_startPos = event->pos(); m_startPos = event->pos();
m_hooverInfo->move(mapToParent(event->pos()) + QPoint(0, 40)); if (bottom)
m_hooverInfo->move(mapToParent(m_startPos) + QPoint(0, -10));
else
m_hooverInfo->move(mapToParent(m_startPos) + QPoint(0, 40));
m_hooverInfo->resize(m_hooverInfo->sizeHint()); m_hooverInfo->resize(m_hooverInfo->sizeHint());
m_hooverInfo->raise(); m_hooverInfo->raise();
} }
@@ -809,6 +815,7 @@ void PreviewLabel::mouseMoveEvent(QMouseEvent * event)
return QLabel::mouseMoveEvent(event); return QLabel::mouseMoveEvent(event);
QPoint p = event->pos(); QPoint p = event->pos();
bool bottom = false;
if (m_dragging_left) { if (m_dragging_left) {
m_left = p.x() / m_zoom; m_left = p.x() / m_zoom;
m_left = limitPositive(m_left); m_left = limitPositive(m_left);
@@ -832,6 +839,7 @@ void PreviewLabel::mouseMoveEvent(QMouseEvent * event)
m_bottom = limitPositive(m_bottom); m_bottom = limitPositive(m_bottom);
event->accept(); event->accept();
m_hooverInfo->setText("Bottom " + QString::number(m_bottom)); m_hooverInfo->setText("Bottom " + QString::number(m_bottom));
bottom = true;
update(); update();
} else if (rangeCheck(m_left * m_zoom, p.x())) { } else if (rangeCheck(m_left * m_zoom, p.x())) {
QApplication::setOverrideCursor(QCursor(Qt::SizeHorCursor)); QApplication::setOverrideCursor(QCursor(Qt::SizeHorCursor));
@@ -853,6 +861,7 @@ void PreviewLabel::mouseMoveEvent(QMouseEvent * event)
event->accept(); event->accept();
m_hooverInfo->setText("Bottom " + QString::number(m_bottom)); m_hooverInfo->setText("Bottom " + QString::number(m_bottom));
m_hooverInfo->show(); m_hooverInfo->show();
bottom = true;
} else { } else {
if (QApplication::overrideCursor()) if (QApplication::overrideCursor())
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
@@ -860,6 +869,9 @@ void PreviewLabel::mouseMoveEvent(QMouseEvent * event)
m_hooverInfo->hide(); m_hooverInfo->hide();
} }
m_startPos = p; m_startPos = p;
if (bottom)
m_hooverInfo->move(mapToParent(p) + QPoint(0, -10));
else
m_hooverInfo->move(mapToParent(p) + QPoint(0, 40)); m_hooverInfo->move(mapToParent(p) + QPoint(0, 40));
m_hooverInfo->resize(m_hooverInfo->sizeHint()); m_hooverInfo->resize(m_hooverInfo->sizeHint());
m_hooverInfo->raise(); m_hooverInfo->raise();
@@ -889,7 +901,7 @@ PreviewDialog::PreviewDialog(QWidget *parent) : DragWidget(parent)
QHBoxLayout *horizontalLayout = new QHBoxLayout(); QHBoxLayout *horizontalLayout = new QHBoxLayout();
QHBoxLayout *horizontalLayout2 = new QHBoxLayout(); QHBoxLayout *horizontalLayout2 = new QHBoxLayout();
layout->setMargin(0); layout->setMargin(0);
layout->setContentsMargins(2, 2, 2, 6); layout->setContentsMargins(2, 2, 2, 16);
layout->setSpacing(4); layout->setSpacing(4);
QToolButton *toolButton = new QToolButton(this); QToolButton *toolButton = new QToolButton(this);
QIcon icon(style()->standardIcon(QStyle::SP_DockWidgetCloseButton)); QIcon icon(style()->standardIcon(QStyle::SP_DockWidgetCloseButton));

View File

@@ -45,7 +45,8 @@ ContextPaneWidgetRectangle::ContextPaneWidgetRectangle(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::ContextPaneWidgetRectangle), ui(new Ui::ContextPaneWidgetRectangle),
m_gradientLineDoubleClicked(false), m_gradientLineDoubleClicked(false),
m_gradientTimer(-1) m_gradientTimer(-1),
m_enableGradientEditing(true)
{ {
ui->setupUi(this); ui->setupUi(this);
@@ -112,7 +113,7 @@ void ContextPaneWidgetRectangle::setProperties(QmlJS::PropertyReader *propertyRe
ui->gradientLabel->setEnabled(true); ui->gradientLabel->setEnabled(true);
ui->gradientLine->setEnabled(true); ui->gradientLine->setEnabled(true);
if (m_hasGradient) { if (m_hasGradient && isGradientEditingEnabled()) {
bool isBound; bool isBound;
ui->colorGradient->setChecked(true); ui->colorGradient->setChecked(true);
ui->gradientLine->setGradient(propertyReader->parseGradient("gradient", &isBound)); ui->gradientLine->setGradient(propertyReader->parseGradient("gradient", &isBound));
@@ -122,8 +123,8 @@ void ContextPaneWidgetRectangle::setProperties(QmlJS::PropertyReader *propertyRe
ui->colorColorButton->setColor("invalidColor"); ui->colorColorButton->setColor("invalidColor");
} }
} else { } else {
//ui->gradientLine->setEnabled(false); ui->gradientLine->setEnabled(false);
//ui->gradientLabel->setEnabled(false); ui->gradientLabel->setEnabled(false);
setColor(); setColor();
} }
@@ -132,6 +133,12 @@ void ContextPaneWidgetRectangle::setProperties(QmlJS::PropertyReader *propertyRe
m_gradientTimer = -1; m_gradientTimer = -1;
} }
ui->colorGradient->setEnabled(isGradientEditingEnabled());
}
void ContextPaneWidgetRectangle::enabableGradientEditing(bool b)
{
m_enableGradientEditing = b;
} }
void ContextPaneWidgetRectangle::onBorderColorButtonToggled(bool flag) void ContextPaneWidgetRectangle::onBorderColorButtonToggled(bool flag)
@@ -194,6 +201,7 @@ void ContextPaneWidgetRectangle::onGradientClicked()
stops.append(QGradientStop(0, ui->colorColorButton->convertedColor())); stops.append(QGradientStop(0, ui->colorColorButton->convertedColor()));
stops.append(QGradientStop(1, Qt::white)); stops.append(QGradientStop(1, Qt::white));
gradient.setStops(stops); gradient.setStops(stops);
ui->gradientLine->setEnabled(true);
ui->gradientLine->setGradient(gradient); ui->gradientLine->setGradient(gradient);
} }
} }
@@ -201,15 +209,19 @@ void ContextPaneWidgetRectangle::onGradientClicked()
void ContextPaneWidgetRectangle::onColorNoneClicked() void ContextPaneWidgetRectangle::onColorNoneClicked()
{ {
if (ui->colorNone->isChecked()) { if (ui->colorNone->isChecked()) {
ui->colorGradient->setEnabled(isGradientEditingEnabled());
emit removeAndChangeProperty("gradient", "color", "transparent", true); emit removeAndChangeProperty("gradient", "color", "transparent", true);
} }
ui->colorGradient->setEnabled(isGradientEditingEnabled());
} }
void ContextPaneWidgetRectangle::onColorSolidClicked() void ContextPaneWidgetRectangle::onColorSolidClicked()
{ {
if (ui->colorSolid->isChecked()) { if (ui->colorSolid->isChecked()) {
ui->gradientLine->setEnabled(false);
emit removeAndChangeProperty("gradient", "color", "\"black\"", true); emit removeAndChangeProperty("gradient", "color", "\"black\"", true);
} }
ui->colorGradient->setEnabled(isGradientEditingEnabled());
} }
void ContextPaneWidgetRectangle::onBorderNoneClicked() void ContextPaneWidgetRectangle::onBorderNoneClicked()

View File

@@ -57,6 +57,7 @@ public:
explicit ContextPaneWidgetRectangle(QWidget *parent = 0); explicit ContextPaneWidgetRectangle(QWidget *parent = 0);
~ContextPaneWidgetRectangle(); ~ContextPaneWidgetRectangle();
void setProperties(QmlJS::PropertyReader *propertyReader); void setProperties(QmlJS::PropertyReader *propertyReader);
void enabableGradientEditing(bool);
public slots: public slots:
void onBorderColorButtonToggled(bool); void onBorderColorButtonToggled(bool);
@@ -82,12 +83,15 @@ protected:
private: private:
void setColor(); void setColor();
bool isGradientEditingEnabled() const
{ return m_enableGradientEditing; }
Ui::ContextPaneWidgetRectangle *ui; Ui::ContextPaneWidgetRectangle *ui;
bool m_hasBorder; bool m_hasBorder;
bool m_hasGradient; bool m_hasGradient;
bool m_none; bool m_none;
bool m_gradientLineDoubleClicked; bool m_gradientLineDoubleClicked;
int m_gradientTimer; int m_gradientTimer;
bool m_enableGradientEditing;
}; };
} //QmlDesigner } //QmlDesigner

View File

@@ -56,6 +56,8 @@
+------------+-------------------------+---------------+ +------------+-------------------------+---------------+
+summaryLabel| toolwidget | detailsButton | +summaryLabel| toolwidget | detailsButton |
+------------+-------------------------+---------------+ +------------+-------------------------+---------------+
+ additional summary |
+------------+-------------------------+---------------+
| widget | | widget |
+------------+-------------------------+---------------+ +------------+-------------------------+---------------+
\endcode \endcode
@@ -72,6 +74,7 @@ namespace Utils {
QGridLayout *m_grid; QGridLayout *m_grid;
QLabel *m_summaryLabel; QLabel *m_summaryLabel;
QCheckBox *m_summaryCheckBox; QCheckBox *m_summaryCheckBox;
QLabel *m_additionalSummaryLabel;
Utils::FadingPanel *m_toolWidget; Utils::FadingPanel *m_toolWidget;
QWidget *m_widget; QWidget *m_widget;
@@ -88,6 +91,7 @@ namespace Utils {
m_grid(new QGridLayout), m_grid(new QGridLayout),
m_summaryLabel(new QLabel(parent)), m_summaryLabel(new QLabel(parent)),
m_summaryCheckBox(new QCheckBox(parent)), m_summaryCheckBox(new QCheckBox(parent)),
m_additionalSummaryLabel(new QLabel(parent)),
m_toolWidget(0), m_toolWidget(0),
m_widget(0), m_widget(0),
m_state(DetailsWidget::Collapsed), m_state(DetailsWidget::Collapsed),
@@ -108,10 +112,16 @@ namespace Utils {
d->m_summaryCheckBox->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN); d->m_summaryCheckBox->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
d->m_summaryCheckBox->setVisible(false); d->m_summaryCheckBox->setVisible(false);
d->m_additionalSummaryLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
d->m_additionalSummaryLabel->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
d->m_additionalSummaryLabel->setWordWrap(true);
d->m_additionalSummaryLabel->setVisible(false);
d->m_grid->setContentsMargins(0, 0, 0, 0); d->m_grid->setContentsMargins(0, 0, 0, 0);
d->m_grid->setSpacing(0); d->m_grid->setSpacing(0);
d->m_grid->addWidget(d->m_summaryLabel, 0, 0); d->m_grid->addWidget(d->m_summaryLabel, 0, 0);
d->m_grid->addWidget(d->m_detailsButton, 0, 2); d->m_grid->addWidget(d->m_detailsButton, 0, 2);
d->m_grid->addWidget(d->m_additionalSummaryLabel, 1, 0, 1, 3);
setLayout(d->m_grid); setLayout(d->m_grid);
connect(d->m_detailsButton, SIGNAL(toggled(bool)), connect(d->m_detailsButton, SIGNAL(toggled(bool)),
@@ -209,6 +219,17 @@ namespace Utils {
return d->m_summaryLabel->text(); return d->m_summaryLabel->text();
} }
QString DetailsWidget::additionalSummaryText() const
{
return d->m_additionalSummaryLabel->text();
}
void DetailsWidget::setAdditionalSummaryText(const QString &text)
{
d->m_additionalSummaryLabel->setText(text);
d->m_additionalSummaryLabel->setVisible(!text.isEmpty());
}
DetailsWidget::State DetailsWidget::state() const DetailsWidget::State DetailsWidget::state() const
{ {
return d->m_state; return d->m_state;
@@ -269,7 +290,7 @@ namespace Utils {
if (d->m_widget) { if (d->m_widget) {
d->m_widget->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN); d->m_widget->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
d->m_grid->addWidget(d->m_widget, 1, 0, 1, 3); d->m_grid->addWidget(d->m_widget, 2, 0, 1, 3);
} }
updateControls(); updateControls();
} }

View File

@@ -51,6 +51,7 @@ class QTCREATOR_UTILS_EXPORT DetailsWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString summaryText READ summaryText WRITE setSummaryText DESIGNABLE true) Q_PROPERTY(QString summaryText READ summaryText WRITE setSummaryText DESIGNABLE true)
Q_PROPERTY(QString additionalSummaryText READ additionalSummaryText WRITE setAdditionalSummaryText DESIGNABLE true)
Q_PROPERTY(bool useCheckBox READ useCheckBox WRITE setUseCheckBox DESIGNABLE true) Q_PROPERTY(bool useCheckBox READ useCheckBox WRITE setUseCheckBox DESIGNABLE true)
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE true) Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE true)
Q_PROPERTY(State state READ state WRITE setState) Q_PROPERTY(State state READ state WRITE setState)
@@ -69,6 +70,9 @@ public:
void setSummaryText(const QString &text); void setSummaryText(const QString &text);
QString summaryText() const; QString summaryText() const;
void setAdditionalSummaryText(const QString &text);
QString additionalSummaryText() const;
void setState(State state); void setState(State state);
State state() const; State state() const;
@@ -87,6 +91,7 @@ public:
void setUseCheckBox(bool b); void setUseCheckBox(bool b);
/// Sets an icon, only supported if useCheckBox is true /// Sets an icon, only supported if useCheckBox is true
void setIcon(const QIcon &icon); void setIcon(const QIcon &icon);
signals: signals:
void checked(bool); void checked(bool);
private slots: private slots:
@@ -103,6 +108,7 @@ private:
void changeHoverState(bool hovered); void changeHoverState(bool hovered);
DetailsWidgetPrivate *d; DetailsWidgetPrivate *d;
QString m_additionalSummaryText;
}; };
} // namespace Utils } // namespace Utils

View File

@@ -54,7 +54,7 @@ template <typename T> static void setIfPresent(const QVariantMap &map, const QSt
{ {
if (!map.contains(key)) if (!map.contains(key))
return; return;
*val = map.value(key).value<T>(); *val = map.value(key).template value<T>();
} }
/** /**

View File

@@ -409,7 +409,9 @@ void CMakeRunPage::initializePage()
ProjectExplorer::Abi targetAbi = tc->targetAbi(); ProjectExplorer::Abi targetAbi = tc->targetAbi();
QVariant tcVariant = qVariantFromValue(static_cast<void *>(tc)); QVariant tcVariant = qVariantFromValue(static_cast<void *>(tc));
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) { if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvcFlavor) if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
|| targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor)
m_generatorComboBox->addItem(tr("NMake Generator (%1)").arg(tc->displayName()), tcVariant); m_generatorComboBox->addItem(tr("NMake Generator (%1)").arg(tc->displayName()), tcVariant);
else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor)
m_generatorComboBox->addItem(tr("MinGW Generator (%1)").arg(tc->displayName()), tcVariant); m_generatorComboBox->addItem(tr("MinGW Generator (%1)").arg(tc->displayName()), tcVariant);
@@ -450,10 +452,10 @@ void CMakeRunPage::runCMake()
QString generator = QLatin1String("-GCodeBlocks - Unix Makefiles"); QString generator = QLatin1String("-GCodeBlocks - Unix Makefiles");
if (tc->targetAbi().os() == ProjectExplorer::Abi::WindowsOS) { if (tc->targetAbi().os() == ProjectExplorer::Abi::WindowsOS) {
if (tc->targetAbi().osFlavor() == ProjectExplorer::Abi::WindowsMsvcFlavor) if (tc->targetAbi().osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor)
generator = QLatin1String("-GCodeBlocks - NMake Makefiles");
else
generator = QLatin1String("-GCodeBlocks - MinGW Makefiles"); generator = QLatin1String("-GCodeBlocks - MinGW Makefiles");
else
generator = QLatin1String("-GCodeBlocks - NMake Makefiles");
} }

View File

@@ -313,7 +313,7 @@ void MakeStepConfigWidget::updateDetails()
param.setArguments(arguments); param.setArguments(arguments);
m_summaryText = param.summary(displayName()); m_summaryText = param.summary(displayName());
} else { } else {
m_summaryText = tr("<b>Unknown Toolchain</b>"); m_summaryText = tr("<b>Unknown tool chain</b>");
} }
emit updateSummary(); emit updateSummary();
} }

View File

@@ -311,7 +311,7 @@ void ExternalToolModel::revertTool(const QModelIndex &modelIndex)
QModelIndex ExternalToolModel::addCategory() QModelIndex ExternalToolModel::addCategory()
{ {
const QString &categoryBase = tr("New category"); const QString &categoryBase = tr("New Category");
QString category = categoryBase; QString category = categoryBase;
int count = 0; int count = 0;
while (m_tools.contains(category)) { while (m_tools.contains(category)) {
@@ -337,7 +337,7 @@ QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex)
ExternalTool *tool = new ExternalTool; ExternalTool *tool = new ExternalTool;
tool->setDisplayCategory(category); tool->setDisplayCategory(category);
tool->setDisplayName(tr("New tool")); tool->setDisplayName(tr("New Tool"));
tool->setDescription(tr("This tool prints a line of useful text")); tool->setDescription(tr("This tool prints a line of useful text"));
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
tool->setExecutables(QStringList() << "cmd"); tool->setExecutables(QStringList() << "cmd");

View File

@@ -116,7 +116,7 @@
<item row="1" column="1"> <item row="1" column="1">
<widget class="Utils::PathChooser" name="executable"> <widget class="Utils::PathChooser" name="executable">
<property name="expectedKind"> <property name="expectedKind">
<enum>Utils::PathChooser::ExistingCommand</enum> <enum>Utils::PathChooser::Command</enum>
</property> </property>
</widget> </widget>
</item> </item>
@@ -138,7 +138,11 @@
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="Utils::PathChooser" name="workingDirectory"/> <widget class="Utils::PathChooser" name="workingDirectory">
<property name="expectedKind">
<enum>Utils::PathChooser::Directory</enum>
</property>
</widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="outputLabel"> <widget class="QLabel" name="outputLabel">
@@ -162,12 +166,12 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Show in pane</string> <string>Show in Pane</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Replace selection</string> <string>Replace Selection</string>
</property> </property>
</item> </item>
</widget> </widget>
@@ -196,12 +200,12 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Show in pane</string> <string>Show in Pane</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Replace selection</string> <string>Replace Selection</string>
</property> </property>
</item> </item>
</widget> </widget>

View File

@@ -155,7 +155,7 @@ void VariableChooser::handleItemActivated(QListWidgetItem *item)
void VariableChooser::insertVariable(const QString &variable) void VariableChooser::insertVariable(const QString &variable)
{ {
const QString &text = QLatin1String("${") + variable + QLatin1String("}"); const QString &text = QLatin1String("%{") + variable + QLatin1String("}");
if (m_lineEdit) { if (m_lineEdit) {
m_lineEdit->insert(text); m_lineEdit->insert(text);
m_lineEdit->activateWindow(); m_lineEdit->activateWindow();

View File

@@ -230,10 +230,11 @@ void PasteBinDotComProtocol::list()
QTC_ASSERT(!m_listReply, return;) QTC_ASSERT(!m_listReply, return;)
// fire request // fire request
m_listReply = httpGet(QLatin1String("http://") + hostName(true)); const QString url = QLatin1String("http://") + hostName(true) + QLatin1String("/archive");
m_listReply = httpGet(url);
connect(m_listReply, SIGNAL(finished()), this, SLOT(listFinished())); connect(m_listReply, SIGNAL(finished()), this, SLOT(listFinished()));
if (debug) if (debug)
qDebug() << "list: sending " << m_listReply; qDebug() << "list: sending " << url << m_listReply;
} }
static inline void padString(QString *s, int len) static inline void padString(QString *s, int len)
@@ -243,85 +244,186 @@ static inline void padString(QString *s, int len)
s->append(QString(missing, QLatin1Char(' '))); s->append(QString(missing, QLatin1Char(' ')));
} }
/* Quick & dirty: Parse the <div>-elements with the "Recent Posts" listing /* Quick & dirty: Parse out the 'archive' table as of 16.3.2011:
* out of the page.
\code \code
<div class="content_left_title">Recent Posts</div> <table class="maintable" cellspacing="0">
<div class="content_left_box"> <tr class="top">
<div class="clb_top"><a href="http://pastebin.com/id">User</a></div> <th scope="col" align="left">Name / Title</th>
<div class="clb_bottom"><span>Title</div> <th scope="col" align="left">Posted</th>
<th scope="col" align="left">Expires</th>
<th scope="col" align="left">Size</th>
<th scope="col" align="left">Syntax</th>
<th scope="col" align="left">User</th>
</tr>
<tr class="g">
<td class="icon"><a href="/8ZRqkcaP">Untitled</a></td>
<td>2 sec ago</td>
<td>Never</td>
<td>9.41 KB</td>
<td><a href="/archive/text">None</a></td>
<td>a guest</td>
</tr>
<tr>
\endcode */ \endcode */
enum ParseState
{
OutSideTable, WithinTable, WithinTableRow, WithinTableHeaderElement,
WithinTableElement, WithinTableElementAnchor, ParseError
};
static inline ParseState nextOpeningState(ParseState current, const QStringRef &element)
{
switch (current) {
case OutSideTable:
if (element == QLatin1String("table"))
return WithinTable;
return OutSideTable;
case WithinTable:
if (element == QLatin1String("tr"))
return WithinTableRow;
break;
case WithinTableRow:
if (element == QLatin1String("td"))
return WithinTableElement;
if (element == QLatin1String("th"))
return WithinTableHeaderElement;
break;
case WithinTableElement:
if (element == QLatin1String("a"))
return WithinTableElementAnchor;
break;
case WithinTableHeaderElement:
case WithinTableElementAnchor:
case ParseError:
break;
}
return ParseError;
}
static inline ParseState nextClosingState(ParseState current, const QStringRef &element)
{
switch (current) {
case OutSideTable:
return OutSideTable;
case WithinTable:
if (element == QLatin1String("table"))
return OutSideTable;
break;
case WithinTableRow:
if (element == QLatin1String("tr"))
return WithinTable;
break;
case WithinTableElement:
if (element == QLatin1String("td"))
return WithinTableRow;
break;
case WithinTableHeaderElement:
if (element == QLatin1String("th"))
return WithinTableRow;
break;
case WithinTableElementAnchor:
if (element == QLatin1String("a"))
return WithinTableElement;
break;
case ParseError:
break;
}
return ParseError;
}
static inline QStringList parseLists(QIODevice *io) static inline QStringList parseLists(QIODevice *io)
{ {
enum State { OutsideRecentPostList, InsideRecentPostList, enum { maxEntries = 200 }; // Limit the archive, which can grow quite large.
InsideRecentPostBox, InsideRecentPost };
QStringList rc; QStringList rc;
QXmlStreamReader reader(io); QXmlStreamReader reader(io);
ParseState state = OutSideTable;
int tableRow = 0;
int tableColumn = 0;
const QString hrefAttribute = QLatin1String("href");
QString link;
QString user;
QString description;
const QString classAttribute = QLatin1String("class");
const QString divElement = QLatin1String("div");
const QString anchorElement = QLatin1String("a");
const QString spanElement = QLatin1String("span");
State state = OutsideRecentPostList;
while (!reader.atEnd()) { while (!reader.atEnd()) {
switch(reader.readNext()) { switch(reader.readNext()) {
case QXmlStreamReader::StartElement: case QXmlStreamReader::StartElement:
// Inside a <div> of an entry: Anchor or description state = nextOpeningState(state, reader.name());
if (state == InsideRecentPost) {
if (reader.name() == anchorElement) { // Anchor
// Strip host from link
QString link = reader.attributes().value(QLatin1String("href")).toString();
const int slashPos = link.lastIndexOf(QLatin1Char('/'));
if (slashPos != -1)
link.remove(0, slashPos + 1);
const QString user = reader.readElementText();
rc.push_back(link + QLatin1Char(' ') + user);
} else if (reader.name() == spanElement) { // <span> with description
const QString description = reader.readElementText();
QTC_ASSERT(!rc.isEmpty(), return rc; )
padString(&rc.back(), 25);
rc.back() += QLatin1Char(' ');
rc.back() += description;
}
} else if (reader.name() == divElement) { // "<div>" state switching
switch (state) { switch (state) {
// Check on the contents as there are several lists. case WithinTableRow:
case OutsideRecentPostList: tableColumn = 0;
if (reader.attributes().value(classAttribute) == QLatin1String("content_left_title")
&& reader.readElementText() == QLatin1String("Recent Posts"))
state = InsideRecentPostList;
break; break;
case InsideRecentPostList: case OutSideTable:
if (reader.attributes().value(classAttribute) == QLatin1String("content_left_box")) case WithinTable:
state = InsideRecentPostBox; case WithinTableHeaderElement:
break; case WithinTableElement:
case InsideRecentPostBox:
state = InsideRecentPost;
break;
default:
break; break;
case WithinTableElementAnchor: // 'href="/svb5K8wS"'
if (tableColumn == 0) {
link = reader.attributes().value(hrefAttribute).toString();
if (link.startsWith(QLatin1Char('/')))
link.remove(0, 1);
} }
} // divElement break;
case ParseError:
return rc;
} // switch startelement state
break; break;
case QXmlStreamReader::EndElement: case QXmlStreamReader::EndElement:
if (reader.name() == divElement) { state = nextClosingState(state, reader.name());
switch (state) { switch (state) {
case InsideRecentPost: case OutSideTable:
state = InsideRecentPostBox; if (tableRow) // Seen the table, bye.
break;
case InsideRecentPostBox: // Stop parsing when leaving the box.
return rc; return rc;
break; break;
default: case WithinTable:
if (tableRow && !user.isEmpty() && !link.isEmpty() && !description.isEmpty()) {
QString entry = link;
entry += QLatin1Char(' ');
entry += user;
entry += QLatin1Char(' ');
entry += description;
rc.push_back(entry);
if (rc.size() >= maxEntries)
return rc;
}
tableRow++;
user.clear();
link.clear();
description.clear();
break; break;
} case WithinTableRow:
} tableColumn++;
break;
case WithinTableHeaderElement:
case WithinTableElement:
case WithinTableElementAnchor:
break;
case ParseError:
return rc;
} // switch endelement state
break;
case QXmlStreamReader::Characters:
switch (state) {
break;
case WithinTableElement:
if (tableColumn == 5)
user = reader.text().toString();
break;
case WithinTableElementAnchor:
if (tableColumn == 0)
description = reader.text().toString();
break; break;
default: default:
break; break;
} } // switch characters read state
break;
default:
break;
} // switch reader state
} }
return rc; return rc;
} }

View File

@@ -90,7 +90,8 @@ void CppHighlighter::highlightBlock(const QString &text)
Parentheses parentheses; Parentheses parentheses;
parentheses.reserve(20); // assume wizard level ;-) parentheses.reserve(20); // assume wizard level ;-)
bool highlightAsPreprocessor = false; bool expectPreprocessorKeyword = false;
bool onlyHighlightComments = false;
for (int i = 0; i < tokens.size(); ++i) { for (int i = 0; i < tokens.size(); ++i) {
const Token &tk = tokens.at(i); const Token &tk = tokens.at(i);
@@ -135,20 +136,28 @@ void CppHighlighter::highlightBlock(const QString &text)
} }
} }
bool highlightCurrentWordAsPreprocessor = highlightAsPreprocessor; bool highlightCurrentWordAsPreprocessor = expectPreprocessorKeyword;
if (highlightAsPreprocessor) if (expectPreprocessorKeyword)
highlightAsPreprocessor = false; expectPreprocessorKeyword = false;
if (onlyHighlightComments && !tk.isComment())
continue;
if (i == 0 && tk.is(T_POUND)) { if (i == 0 && tk.is(T_POUND)) {
highlightLine(text, tk.begin(), tk.length(), m_formats[CppPreprocessorFormat]); highlightLine(text, tk.begin(), tk.length(), m_formats[CppPreprocessorFormat]);
highlightAsPreprocessor = true; expectPreprocessorKeyword = true;
} else if (highlightCurrentWordAsPreprocessor && } else if (highlightCurrentWordAsPreprocessor &&
(tk.isKeyword() || tk.is(T_IDENTIFIER)) && isPPKeyword(text.midRef(tk.begin(), tk.length()))) (tk.isKeyword() || tk.is(T_IDENTIFIER)) && isPPKeyword(text.midRef(tk.begin(), tk.length()))) {
setFormat(tk.begin(), tk.length(), m_formats[CppPreprocessorFormat]); setFormat(tk.begin(), tk.length(), m_formats[CppPreprocessorFormat]);
const QStringRef ppKeyword = text.midRef(tk.begin(), tk.length());
if (ppKeyword == QLatin1String("error")
|| ppKeyword == QLatin1String("warning")
|| ppKeyword == QLatin1String("pragma")) {
onlyHighlightComments = true;
}
else if (tk.is(T_NUMERIC_LITERAL)) } else if (tk.is(T_NUMERIC_LITERAL))
setFormat(tk.begin(), tk.length(), m_formats[CppNumberFormat]); setFormat(tk.begin(), tk.length(), m_formats[CppNumberFormat]);
else if (tk.is(T_STRING_LITERAL) || tk.is(T_CHAR_LITERAL) || tk.is(T_ANGLE_STRING_LITERAL) || else if (tk.is(T_STRING_LITERAL) || tk.is(T_CHAR_LITERAL) || tk.is(T_ANGLE_STRING_LITERAL) ||

View File

@@ -444,8 +444,6 @@ MultiBreakPointsDialog::MultiBreakPointsDialog(unsigned engineCapabilities, QWid
BreakWindow::BreakWindow(QWidget *parent) BreakWindow::BreakWindow(QWidget *parent)
: QTreeView(parent) : QTreeView(parent)
{ {
m_alwaysResizeColumnsToContents = false;
QAction *act = debuggerCore()->action(UseAlternatingRowColors); QAction *act = debuggerCore()->action(UseAlternatingRowColors);
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
setAttribute(Qt::WA_MacShowFocusRect, false); setAttribute(Qt::WA_MacShowFocusRect, false);
@@ -463,6 +461,9 @@ BreakWindow::BreakWindow(QWidget *parent)
connect(debuggerCore()->action(UseAddressInBreakpointsView), connect(debuggerCore()->action(UseAddressInBreakpointsView),
SIGNAL(toggled(bool)), SIGNAL(toggled(bool)),
SLOT(showAddressColumn(bool))); SLOT(showAddressColumn(bool)));
connect(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths),
SIGNAL(toggled(bool)),
SLOT(setAlwaysResizeColumnsToContents(bool)));
} }
void BreakWindow::showAddressColumn(bool on) void BreakWindow::showAddressColumn(bool on)
@@ -559,12 +560,6 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *adjustColumnAction = QAction *adjustColumnAction =
new QAction(tr("Adjust Column Widths to Contents"), &menu); new QAction(tr("Adjust Column Widths to Contents"), &menu);
QAction *alwaysAdjustAction =
new QAction(tr("Always Adjust Column Widths to Contents"), &menu);
alwaysAdjustAction->setCheckable(true);
alwaysAdjustAction->setChecked(m_alwaysResizeColumnsToContents);
QAction *editBreakpointAction = QAction *editBreakpointAction =
new QAction(tr("Edit Breakpoint..."), &menu); new QAction(tr("Edit Breakpoint..."), &menu);
editBreakpointAction->setEnabled(!selectedIds.isEmpty()); editBreakpointAction->setEnabled(!selectedIds.isEmpty());
@@ -610,7 +605,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(debuggerCore()->action(UseToolTipsInBreakpointsView)); menu.addAction(debuggerCore()->action(UseToolTipsInBreakpointsView));
menu.addAction(debuggerCore()->action(UseAddressInBreakpointsView)); menu.addAction(debuggerCore()->action(UseAddressInBreakpointsView));
menu.addAction(adjustColumnAction); menu.addAction(adjustColumnAction);
menu.addAction(alwaysAdjustAction); menu.addAction(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths));
menu.addSeparator(); menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog)); menu.addAction(debuggerCore()->action(SettingsDialog));
@@ -624,8 +619,6 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
deleteBreakpoints(breakpointsInFile); deleteBreakpoints(breakpointsInFile);
else if (act == adjustColumnAction) else if (act == adjustColumnAction)
resizeColumnsToContents(); resizeColumnsToContents();
else if (act == alwaysAdjustAction)
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
else if (act == editBreakpointAction) else if (act == editBreakpointAction)
editBreakpoints(selectedIds); editBreakpoints(selectedIds);
else if (act == associateBreakpointAction) else if (act == associateBreakpointAction)
@@ -729,7 +722,6 @@ void BreakWindow::resizeColumnsToContents()
void BreakWindow::setAlwaysResizeColumnsToContents(bool on) void BreakWindow::setAlwaysResizeColumnsToContents(bool on)
{ {
m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = on QHeaderView::ResizeMode mode = on
? QHeaderView::ResizeToContents : QHeaderView::Interactive; ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
for (int i = model()->columnCount(); --i >= 0; ) for (int i = model()->columnCount(); --i >= 0; )

View File

@@ -70,8 +70,6 @@ private:
void editBreakpoints(const BreakpointIds &ids); void editBreakpoints(const BreakpointIds &ids);
void associateBreakpoint(const BreakpointIds &ids, int thread); void associateBreakpoint(const BreakpointIds &ids, int thread);
void setBreakpointsEnabled(const BreakpointIds &ids, bool enabled); void setBreakpointsEnabled(const BreakpointIds &ids, bool enabled);
bool m_alwaysResizeColumnsToContents;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -349,7 +349,9 @@ static QString cdbBinary(const DebuggerStartParameters &sp)
if (!sp.debuggerCommand.isEmpty()) { if (!sp.debuggerCommand.isEmpty()) {
// Do not use a GDB binary if we got started for a project with MinGW runtime. // Do not use a GDB binary if we got started for a project with MinGW runtime.
const bool abiMatch = sp.toolChainAbi.os() == ProjectExplorer::Abi::WindowsOS const bool abiMatch = sp.toolChainAbi.os() == ProjectExplorer::Abi::WindowsOS
&& sp.toolChainAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvcFlavor; && (sp.toolChainAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2005Flavor
|| sp.toolChainAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2008Flavor
|| sp.toolChainAbi.osFlavor() == ProjectExplorer::Abi::WindowsMsvc2010Flavor);
if (abiMatch) if (abiMatch)
return sp.debuggerCommand; return sp.debuggerCommand;
} }

View File

@@ -54,38 +54,47 @@ using namespace ProjectExplorer;
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
CommonOptionsPageWidget::CommonOptionsPageWidget(const QSharedPointer<Utils::SavedActionSet> &group, QWidget *parent) : CommonOptionsPageWidget::CommonOptionsPageWidget
QWidget(parent), m_group(group) (const QSharedPointer<Utils::SavedActionSet> &group, QWidget *parent)
: QWidget(parent), m_group(group)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
DebuggerCore *dc = debuggerCore();
m_group->clear(); m_group->clear();
m_group->insert(debuggerCore()->action(ListSourceFiles), m_group->insert(dc->action(ListSourceFiles),
m_ui.checkBoxListSourceFiles); m_ui.checkBoxListSourceFiles);
m_group->insert(debuggerCore()->action(UseAlternatingRowColors), m_group->insert(dc->action(UseAlternatingRowColors),
m_ui.checkBoxUseAlternatingRowColors); m_ui.checkBoxUseAlternatingRowColors);
m_group->insert(debuggerCore()->action(UseToolTipsInMainEditor), m_group->insert(dc->action(UseToolTipsInMainEditor),
m_ui.checkBoxUseToolTipsInMainEditor); m_ui.checkBoxUseToolTipsInMainEditor);
m_group->insert(debuggerCore()->action(CloseBuffersOnExit), m_group->insert(dc->action(CloseBuffersOnExit),
m_ui.checkBoxCloseBuffersOnExit); m_ui.checkBoxCloseBuffersOnExit);
m_group->insert(debuggerCore()->action(SwitchModeOnExit), m_group->insert(dc->action(SwitchModeOnExit),
m_ui.checkBoxSwitchModeOnExit); m_ui.checkBoxSwitchModeOnExit);
m_group->insert(debuggerCore()->action(AutoDerefPointers), 0); m_group->insert(dc->action(AutoDerefPointers), 0);
m_group->insert(debuggerCore()->action(UseToolTipsInLocalsView), 0); m_group->insert(dc->action(UseToolTipsInLocalsView), 0);
m_group->insert(debuggerCore()->action(UseToolTipsInBreakpointsView), 0); m_group->insert(dc->action(AlwaysAdjustLocalsColumnWidths), 0);
m_group->insert(debuggerCore()->action(UseAddressInBreakpointsView), 0); m_group->insert(dc->action(AlwaysAdjustThreadsColumnWidths), 0);
m_group->insert(debuggerCore()->action(UseAddressInStackView), 0); m_group->insert(dc->action(AlwaysAdjustSnapshotsColumnWidths), 0);
m_group->insert(debuggerCore()->action(MaximalStackDepth), m_group->insert(dc->action(AlwaysAdjustBreakpointsColumnWidths), 0);
m_group->insert(dc->action(AlwaysAdjustModulesColumnWidths), 0);
m_group->insert(dc->action(UseToolTipsInBreakpointsView), 0);
m_group->insert(dc->action(UseAddressInBreakpointsView), 0);
m_group->insert(dc->action(UseAddressInStackView), 0);
m_group->insert(dc->action(AlwaysAdjustStackColumnWidths), 0);
m_group->insert(dc->action(MaximalStackDepth),
m_ui.spinBoxMaximalStackDepth); m_ui.spinBoxMaximalStackDepth);
m_group->insert(debuggerCore()->action(ShowStdNamespace), 0); m_group->insert(dc->action(ShowStdNamespace), 0);
m_group->insert(debuggerCore()->action(ShowQtNamespace), 0); m_group->insert(dc->action(ShowQtNamespace), 0);
m_group->insert(debuggerCore()->action(SortStructMembers), 0); m_group->insert(dc->action(SortStructMembers), 0);
m_group->insert(debuggerCore()->action(LogTimeStamps), 0); m_group->insert(dc->action(LogTimeStamps), 0);
m_group->insert(debuggerCore()->action(VerboseLog), 0); m_group->insert(dc->action(VerboseLog), 0);
m_group->insert(debuggerCore()->action(BreakOnThrow), 0); m_group->insert(dc->action(BreakOnThrow), 0);
m_group->insert(debuggerCore()->action(BreakOnCatch), 0); m_group->insert(dc->action(BreakOnCatch), 0);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
Utils::SavedAction *registerAction = debuggerCore()->action(RegisterForPostMortem); Utils::SavedAction *registerAction = dc->action(RegisterForPostMortem);
m_group->insert(registerAction, m_group->insert(registerAction,
m_ui.checkBoxRegisterForPostMortem); m_ui.checkBoxRegisterForPostMortem);
connect(registerAction, SIGNAL(toggled(bool)), connect(registerAction, SIGNAL(toggled(bool)),
@@ -253,26 +262,28 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
m_ui.setupUi(w); m_ui.setupUi(w);
m_ui.dumperLocationChooser->setExpectedKind(Utils::PathChooser::Command); m_ui.dumperLocationChooser->setExpectedKind(Utils::PathChooser::Command);
m_ui.dumperLocationChooser->setPromptDialogTitle(QCoreApplication::translate("Debugger", m_ui.dumperLocationChooser->setPromptDialogTitle(QCoreApplication::translate
"Choose DebuggingHelper Location")); ("Debugger", "Choose DebuggingHelper Location"));
m_ui.dumperLocationChooser->setInitialBrowsePathBackup( m_ui.dumperLocationChooser->setInitialBrowsePathBackup(
ICore::instance()->resourcePath() + "../../lib"); ICore::instance()->resourcePath() + "../../lib");
m_group.clear(); m_group.clear();
m_group.insert(debuggerCore()->action(UseDebuggingHelpers), DebuggerCore *dc = debuggerCore();
m_group.insert(dc->action(UseDebuggingHelpers),
m_ui.debuggingHelperGroupBox); m_ui.debuggingHelperGroupBox);
m_group.insert(debuggerCore()->action(UseCustomDebuggingHelperLocation), m_group.insert(dc->action(UseCustomDebuggingHelperLocation),
m_ui.customLocationGroupBox); m_ui.customLocationGroupBox);
// Suppress Oxygen style's giving flat group boxes bold titles. // Suppress Oxygen style's giving flat group boxes bold titles.
if (oxygenStyle()) if (oxygenStyle())
m_ui.customLocationGroupBox->setStyleSheet(_("QGroupBox::title { font: ; }")); m_ui.customLocationGroupBox->setStyleSheet(_("QGroupBox::title { font: ; }"));
m_group.insert(debuggerCore()->action(CustomDebuggingHelperLocation), m_group.insert(dc->action(CustomDebuggingHelperLocation),
m_ui.dumperLocationChooser); m_ui.dumperLocationChooser);
m_group.insert(debuggerCore()->action(UseCodeModel), m_group.insert(dc->action(UseCodeModel),
m_ui.checkBoxUseCodeModel); m_ui.checkBoxUseCodeModel);
m_group.insert(debuggerCore()->action(ShowThreadNames), m_group.insert(dc->action(ShowThreadNames),
m_ui.checkBoxShowThreadNames); m_ui.checkBoxShowThreadNames);

View File

@@ -107,13 +107,67 @@ DebuggerSettings::DebuggerSettings(QSettings *settings)
// View // View
// //
item = new SavedAction(this); item = new SavedAction(this);
item->setText(tr("Adjust Column Widths to Contents")); item->setText(tr("Always Adjust Column Widths to Contents"));
insertItem(AdjustColumnWidths, item); item->setCheckable(true);
item->setValue(false);
item->setDefaultValue(false);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustLocalsColumnWidths"));
insertItem(AlwaysAdjustLocalsColumnWidths, item);
item = new SavedAction(this); item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents")); item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true); item->setCheckable(true);
insertItem(AlwaysAdjustColumnWidths, item); item->setValue(false);
item->setDefaultValue(false);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustStackColumnWidths"));
insertItem(AlwaysAdjustStackColumnWidths, item);
item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true);
item->setValue(false);
item->setDefaultValue(false);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustThreadsColumnWidths"));
insertItem(AlwaysAdjustThreadsColumnWidths, item);
item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true);
item->setValue(false);
item->setDefaultValue(false);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustRegistersColumnWidths"));
insertItem(AlwaysAdjustRegistersColumnWidths, item);
item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true);
item->setValue(false);
item->setDefaultValue(false);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustSnapshotsColumnWidths"));
insertItem(AlwaysAdjustSnapshotsColumnWidths, item);
item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true);
item->setValue(false);
item->setDefaultValue(false);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustBreakpointsColumnWidths"));
insertItem(AlwaysAdjustBreakpointsColumnWidths, item);
item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true);
item->setValue(false);
item->setDefaultValue(false);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustModulesColumnWidths"));
insertItem(AlwaysAdjustModulesColumnWidths, item);
item = new SavedAction(this); item = new SavedAction(this);
item->setText(tr("Use Alternating Row Colors")); item->setText(tr("Use Alternating Row Colors"));

View File

@@ -90,8 +90,6 @@ enum DebuggerActionCode
{ {
// General // General
SettingsDialog, SettingsDialog,
AdjustColumnWidths,
AlwaysAdjustColumnWidths,
UseAlternatingRowColors, UseAlternatingRowColors,
UseMessageBoxForSignals, UseMessageBoxForSignals,
AutoQuit, AutoQuit,
@@ -128,12 +126,14 @@ enum DebuggerActionCode
MaximalStackDepth, MaximalStackDepth,
ExpandStack, ExpandStack,
CreateFullBacktrace, CreateFullBacktrace,
AlwaysAdjustStackColumnWidths,
// Watchers & Locals // Watchers & Locals
ShowStdNamespace, ShowStdNamespace,
ShowQtNamespace, ShowQtNamespace,
SortStructMembers, SortStructMembers,
AutoDerefPointers, AutoDerefPointers,
AlwaysAdjustLocalsColumnWidths,
// Source List // Source List
ListSourceFiles, ListSourceFiles,
@@ -147,10 +147,23 @@ enum DebuggerActionCode
AllPluginBreakpoints, AllPluginBreakpoints,
SelectedPluginBreakpoints, SelectedPluginBreakpoints,
AdjustBreakpointLocations, AdjustBreakpointLocations,
AlwaysAdjustBreakpointsColumnWidths,
NoPluginBreakpoints, NoPluginBreakpoints,
SelectedPluginBreakpointsPattern, SelectedPluginBreakpointsPattern,
BreakOnThrow, BreakOnThrow,
BreakOnCatch BreakOnCatch,
// Registers
AlwaysAdjustRegistersColumnWidths,
// Snapshots
AlwaysAdjustSnapshotsColumnWidths,
// Threads
AlwaysAdjustThreadsColumnWidths,
// Modules
AlwaysAdjustModulesColumnWidths
}; };
} // namespace Internal } // namespace Internal

View File

@@ -214,6 +214,7 @@ enum ModelRoles
LocalsEditTypeRole, // A QVariant::type describing the item LocalsEditTypeRole, // A QVariant::type describing the item
LocalsIntegerBaseRole, // Number base 16, 10, 8, 2 LocalsIntegerBaseRole, // Number base 16, 10, 8, 2
LocalsExpressionRole, LocalsExpressionRole,
LocalsRawExpressionRole,
LocalsExpandedRole, // The preferred expanded state to the view LocalsExpandedRole, // The preferred expanded state to the view
LocalsTypeFormatListRole, LocalsTypeFormatListRole,
LocalsTypeFormatRole, // Used to communicate alternative formats to the view LocalsTypeFormatRole, // Used to communicate alternative formats to the view

View File

@@ -223,6 +223,7 @@ public slots:
void scheduleResetLocation() void scheduleResetLocation()
{ {
m_stackHandler.scheduleResetLocation(); m_stackHandler.scheduleResetLocation();
m_disassemblerAgent.scheduleResetLocation();
m_locationTimer.setSingleShot(true); m_locationTimer.setSingleShot(true);
m_locationTimer.start(80); m_locationTimer.start(80);
} }

View File

@@ -1474,7 +1474,7 @@ void DebuggerPluginPrivate::startRemoteCdbSession()
Abi hostAbi = Abi::hostAbi(); Abi hostAbi = Abi::hostAbi();
sp.toolChainAbi = ProjectExplorer::Abi(hostAbi.architecture(), sp.toolChainAbi = ProjectExplorer::Abi(hostAbi.architecture(),
ProjectExplorer::Abi::WindowsOS, ProjectExplorer::Abi::WindowsOS,
ProjectExplorer::Abi::WindowsMsvcFlavor, ProjectExplorer::Abi::WindowsMsvc2010Flavor,
ProjectExplorer::Abi::PEFormat, ProjectExplorer::Abi::PEFormat,
true); true);
sp.startMode = AttachToRemote; sp.startMode = AttachToRemote;
@@ -2377,6 +2377,8 @@ static QString formatStartParameters(DebuggerStartParameters &sp)
str << " (built: " << QDir::toNativeSeparators(sp.projectBuildDir) << ')'; str << " (built: " << QDir::toNativeSeparators(sp.projectBuildDir) << ')';
str << '\n'; str << '\n';
} }
if (!sp.qtInstallPath.isEmpty())
str << "Qt: " << QDir::toNativeSeparators(sp.qtInstallPath) << '\n';
if (!sp.qmlServerAddress.isEmpty()) if (!sp.qmlServerAddress.isEmpty())
str << "QML server: " << sp.qmlServerAddress << ':' << sp.qmlServerPort << '\n'; str << "QML server: " << sp.qmlServerAddress << ':' << sp.qmlServerPort << '\n';
if (!sp.remoteChannel.isEmpty()) { if (!sp.remoteChannel.isEmpty()) {
@@ -2459,7 +2461,7 @@ QString DebuggerPluginPrivate::debuggerForAbi(const Abi &abi, DebuggerEngineType
if (searchAbi.os() == ProjectExplorer::Abi::WindowsOS) { if (searchAbi.os() == ProjectExplorer::Abi::WindowsOS) {
switch (et) { switch (et) {
case CdbEngineType: case CdbEngineType:
searchAbi = Abi(abi.architecture(), abi.os(), Abi::WindowsMsvcFlavor, searchAbi = Abi(abi.architecture(), abi.os(), Abi::WindowsMsvc2010Flavor,
abi.binaryFormat(), abi.wordWidth()); abi.binaryFormat(), abi.wordWidth());
break; break;
case GdbEngineType: case GdbEngineType:

View File

@@ -64,6 +64,7 @@
#include <utils/fancymainwindow.h> #include <utils/fancymainwindow.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/buildablehelperlibrary.h>
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -684,6 +685,11 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
sp.dumperLibraryLocations = rc->dumperLibraryLocations(); sp.dumperLibraryLocations = rc->dumperLibraryLocations();
if (const ProjectExplorer::Target *target = runConfiguration->target()) { if (const ProjectExplorer::Target *target = runConfiguration->target()) {
if (QByteArray(target->metaObject()->className()).contains("Qt4")) {
const QString qmake = Utils::BuildableHelperLibrary::findSystemQt(sp.environment);
if (!qmake.isEmpty())
sp.qtInstallPath = findQtInstallPath(qmake);
}
if (const ProjectExplorer::Project *project = target->project()) { if (const ProjectExplorer::Project *project = target->project()) {
sp.projectDir = project->projectDirectory(); sp.projectDir = project->projectDirectory();
if (const ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration()) { if (const ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration()) {

View File

@@ -393,5 +393,24 @@ void DebuggerSourcePathMappingWidget::slotEditTargetFieldChanged()
} }
} }
/* Merge settings for an installed Qt (unless another setting
* is already in the map. */
DebuggerSourcePathMappingWidget::SourcePathMap
DebuggerSourcePathMappingWidget::mergePlatformQtPath(const QString &qtInstallPath,
const SourcePathMap &in)
{
SourcePathMap rc = in;
const size_t buildPathCount = sizeof(qtBuildPaths)/sizeof(const char *);
if (qtInstallPath.isEmpty() || buildPathCount == 0)
return rc;
for (size_t i = 0; i < buildPathCount; i++) {
const QString buildPath = QString::fromLatin1(qtBuildPaths[i]);
if (!rc.contains(buildPath)) // Do not overwrite user settings.
rc.insert(buildPath, qtInstallPath);
}
return rc;
}
} // namespace Internal } // namespace Internal
} // namespace Debugger } // namespace Debugger

View File

@@ -66,6 +66,11 @@ public:
SourcePathMap sourcePathMap() const; SourcePathMap sourcePathMap() const;
void setSourcePathMap(const SourcePathMap &); void setSourcePathMap(const SourcePathMap &);
/* Merge settings for an installed Qt (unless another setting
* is already in the map. */
static SourcePathMap mergePlatformQtPath(const QString &qtInstallPath,
const SourcePathMap &in);
signals: signals:
private slots: private slots:

View File

@@ -96,6 +96,7 @@ public:
QString projectBuildDir; QString projectBuildDir;
QString projectDir; QString projectDir;
QString qtInstallPath;
// Used by remote debugging. // Used by remote debugging.
QString remoteChannel; QString remoteChannel;
QString remoteArchitecture; QString remoteArchitecture;

View File

@@ -86,12 +86,14 @@ public:
QHash<QString, DisassemblerLines> cache; QHash<QString, DisassemblerLines> cache;
QString mimeType; QString mimeType;
bool m_resetLocationScheduled;
}; };
DisassemblerAgentPrivate::DisassemblerAgentPrivate() DisassemblerAgentPrivate::DisassemblerAgentPrivate()
: editor(0), : editor(0),
tryMixed(true), tryMixed(true),
mimeType(_("text/x-qtcreator-generic-asm")) mimeType(_("text/x-qtcreator-generic-asm")),
m_resetLocationScheduled(false)
{ {
locationMark = new ITextMark; locationMark = new ITextMark;
locationMark->setIcon(debuggerCore()->locationMarkIcon()); locationMark->setIcon(debuggerCore()->locationMarkIcon());
@@ -133,12 +135,20 @@ void DisassemblerAgent::cleanup()
d->cache.clear(); d->cache.clear();
} }
void DisassemblerAgent::scheduleResetLocation()
{
d->m_resetLocationScheduled = true;
}
void DisassemblerAgent::resetLocation() void DisassemblerAgent::resetLocation()
{ {
if (!d->editor) if (!d->editor)
return; return;
if (d->m_resetLocationScheduled) {
d->m_resetLocationScheduled = false;
d->editor->markableInterface()->removeMark(d->locationMark); d->editor->markableInterface()->removeMark(d->locationMark);
} }
}
static QString frameKey(const Location &loc) static QString frameKey(const Location &loc)
{ {

View File

@@ -57,6 +57,7 @@ public:
void setTryMixed(bool on); void setTryMixed(bool on);
void setLocation(const Location &location); void setLocation(const Location &location);
const Location &location() const; const Location &location() const;
void scheduleResetLocation();
void resetLocation(); void resetLocation();
void setContents(const DisassemblerLines &contents); void setContents(const DisassemblerLines &contents);
void updateLocationMarker(); void updateLocationMarker();

View File

@@ -92,36 +92,6 @@ void AbstractPlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &respon
} }
void AbstractPlainGdbAdapter::runEngine() void AbstractPlainGdbAdapter::runEngine()
{
QTC_ASSERT(state() == EngineRunRequested, qDebug() << state());
QString fileName;
{
QTemporaryFile symbols(QDir::tempPath() + "/gdb_ns_");
symbols.open();
fileName = symbols.fileName();
}
m_engine->postCommand("maint print msymbols " + fileName.toLocal8Bit(),
CB(handleNamespaceExtraction), fileName);
}
void AbstractPlainGdbAdapter::handleNamespaceExtraction(const GdbResponse &response)
{
QFile file(response.cookie.toString());
file.open(QIODevice::ReadOnly);
QByteArray ba = file.readAll();
file.remove();
int pos = ba.indexOf("7QString9fromAscii");
int pos1 = pos - 1;
while (pos1 > 0 && ba.at(pos1) != 'N' && ba.at(pos1) > '@')
--pos1;
++pos1;
const QByteArray ns = ba.mid(pos1, pos - pos1);
if (!ns.isEmpty())
m_engine->setQtNamespace(ns + "::");
doRunEngine();
}
void AbstractPlainGdbAdapter::doRunEngine()
{ {
m_engine->postCommand("-exec-run", GdbEngine::RunRequest, CB(handleExecRun)); m_engine->postCommand("-exec-run", GdbEngine::RunRequest, CB(handleExecRun));
} }

View File

@@ -52,7 +52,6 @@ public:
protected: protected:
void handleInfoTarget(const GdbResponse &response); void handleInfoTarget(const GdbResponse &response);
void handleNamespaceExtraction(const GdbResponse &response);
private: private:
virtual QByteArray execFilePath() const = 0; virtual QByteArray execFilePath() const = 0;
@@ -61,7 +60,6 @@ private:
virtual QString fromLocalEncoding(const QByteArray &ba) const = 0; virtual QString fromLocalEncoding(const QByteArray &ba) const = 0;
void handleExecRun(const GdbResponse &response); void handleExecRun(const GdbResponse &response);
void handleFileExecAndSymbols(const GdbResponse &response); void handleFileExecAndSymbols(const GdbResponse &response);
void doRunEngine();
}; };
} // namespace Debugger } // namespace Debugger

View File

@@ -72,7 +72,7 @@
enum { debug = 0 }; enum { debug = 0 };
/* Libraries we want to be notified about (pending introduction of a 'notify all' /* Libraries we want to be notified about (pending introduction of a 'notify all'
* setting in TCF TRK, Bug #11842 */ * setting in Coda, Bug #11842 */
static const char *librariesC[] = { static const char *librariesC[] = {
"pipelib.ldd", "rpipe.dll", "libc.dll", "pipelib.ldd", "rpipe.dll", "libc.dll",
"libdl.dll", "libm.dll", "libpthread.dll", "libdl.dll", "libm.dll", "libpthread.dll",
@@ -115,7 +115,7 @@ static inline QString startMsg(const trk::Session &session)
* When continuing in sendTrkContinue(), we delete this thread, since we cannot * When continuing in sendTrkContinue(), we delete this thread, since we cannot
* know whether it will exist at the next stop. * know whether it will exist at the next stop.
* Also note that threads continue running in Symbian even if one crashes. * Also note that threads continue running in Symbian even if one crashes.
* TODO: - Maybe thread reporting will be improved in TCF TRK? * TODO: - Maybe thread reporting will be improved in Coda?
* - Stop all threads once one stops? * - Stop all threads once one stops?
* - Breakpoints do not trigger in threads other than the main thread. */ * - Breakpoints do not trigger in threads other than the main thread. */
@@ -154,9 +154,11 @@ void CodaGdbAdapter::setupTrkDeviceSignals()
connect(m_codaDevice.data(), SIGNAL(error(QString)), connect(m_codaDevice.data(), SIGNAL(error(QString)),
this, SLOT(codaDeviceError(QString))); this, SLOT(codaDeviceError(QString)));
connect(m_codaDevice.data(), SIGNAL(logMessage(QString)), connect(m_codaDevice.data(), SIGNAL(logMessage(QString)),
this, SLOT(trkLogMessage(QString))); this, SLOT(codaLogMessage(QString)));
connect(m_codaDevice.data(), SIGNAL(tcfEvent(Coda::CodaEvent)), connect(m_codaDevice.data(), SIGNAL(tcfEvent(Coda::CodaEvent)),
this, SLOT(codaEvent(Coda::CodaEvent))); this, SLOT(codaEvent(Coda::CodaEvent)));
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)),
this, SLOT(codaDeviceRemoved(SymbianUtils::SymbianDevice)));
} }
CodaGdbAdapter::~CodaGdbAdapter() CodaGdbAdapter::~CodaGdbAdapter()
@@ -179,7 +181,7 @@ void CodaGdbAdapter::setVerbose(int verbose)
m_codaDevice->setVerbose(m_verbose); m_codaDevice->setVerbose(m_verbose);
} }
void CodaGdbAdapter::trkLogMessage(const QString &msg) void CodaGdbAdapter::codaLogMessage(const QString &msg)
{ {
logMessage(_("TRK ") + msg); logMessage(_("TRK ") + msg);
} }
@@ -240,7 +242,7 @@ void CodaGdbAdapter::handleCodaRunControlModuleLoadContextSuspendedEvent(const C
m_session.modules.removeAt(index); m_session.modules.removeAt(index);
m_session.libraries.removeAt(index); m_session.libraries.removeAt(index);
} else { } else {
// Might happen with preliminary version of TCF TRK. // Might happen with preliminary version of Coda.
qWarning("Received unload for module '%s' for which no load was received.", qWarning("Received unload for module '%s' for which no load was received.",
qPrintable(moduleName)); qPrintable(moduleName));
} }
@@ -295,6 +297,17 @@ void CodaGdbAdapter::handleTargetRemote(const GdbResponse &record)
} }
} }
void CodaGdbAdapter::codaDeviceRemoved(const SymbianUtils::SymbianDevice &dev)
{
const DebuggerStartParameters &parameters = startParameters();
if (state() != DebuggerNotReady && !m_codaDevice.isNull() && parameters.remoteChannel == dev.portName()) {
const QString message = QString::fromLatin1("Device '%1' has been disconnected.").arg(dev.friendlyName());
logMessage(message);
m_engine->handleAdapterCrashed(message);
cleanup();
}
}
void CodaGdbAdapter::codaEvent(const CodaEvent &e) void CodaGdbAdapter::codaEvent(const CodaEvent &e)
{ {
if (debug) if (debug)
@@ -968,7 +981,7 @@ void CodaGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
void CodaGdbAdapter::sendRunControlTerminateCommand() void CodaGdbAdapter::sendRunControlTerminateCommand()
{ {
// Requires id of main thread to terminate. // Requires id of main thread to terminate.
// Note that calling 'Settings|set|removeExecutable' crashes TCF TRK, // Note that calling 'Settings|set|removeExecutable' crashes Coda,
// so, it is apparently not required. // so, it is apparently not required.
m_codaDevice->sendRunControlTerminateCommand( m_codaDevice->sendRunControlTerminateCommand(
CodaCallback(this, &CodaGdbAdapter::handleRunControlTerminate), CodaCallback(this, &CodaGdbAdapter::handleRunControlTerminate),
@@ -1085,7 +1098,7 @@ void CodaGdbAdapter::startAdapter()
if (parameters.communicationChannel == if (parameters.communicationChannel ==
DebuggerStartParameters::CommunicationChannelTcpIp) { DebuggerStartParameters::CommunicationChannelTcpIp) {
logMessage(_("Connecting to TCF TRK on %1:%2") logMessage(_("Connecting to Coda on %1:%2")
.arg(codaServerAddress).arg(codaServerPort)); .arg(codaServerAddress).arg(codaServerPort));
codaSocket->connectToHost(codaServerAddress, codaServerPort); codaSocket->connectToHost(codaServerAddress, codaServerPort);
} else { } else {
@@ -1121,7 +1134,7 @@ void CodaGdbAdapter::addThread(unsigned id)
m_session.mainTid = id; m_session.mainTid = id;
} }
// We cannot retrieve register values unless the registers of that // We cannot retrieve register values unless the registers of that
// thread have been retrieved (TCF TRK oddity). // thread have been retrieved (Coda oddity).
const QByteArray contextId = RunControlContext::tcfId(m_session.pid, id); const QByteArray contextId = RunControlContext::tcfId(m_session.pid, id);
m_codaDevice->sendRegistersGetChildrenCommand( m_codaDevice->sendRegistersGetChildrenCommand(
CodaCallback(this, &CodaGdbAdapter::handleRegisterChildren), CodaCallback(this, &CodaGdbAdapter::handleRegisterChildren),

View File

@@ -58,6 +58,10 @@ namespace Coda {
class CodaRunControlModuleLoadContextSuspendedEvent; class CodaRunControlModuleLoadContextSuspendedEvent;
} }
namespace SymbianUtils {
class SymbianDevice;
}
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -154,6 +158,8 @@ private:
Q_SLOT void handleGdbConnection(); Q_SLOT void handleGdbConnection();
Q_SLOT void readGdbServerCommand(); Q_SLOT void readGdbServerCommand();
Q_SLOT void codaDeviceError(const QString &); Q_SLOT void codaDeviceError(const QString &);
Q_SLOT void codaDeviceRemoved(const SymbianUtils::SymbianDevice &dev);
void startGdb(); void startGdb();
Q_SLOT void codaEvent(const Coda::CodaEvent &knownEvent); Q_SLOT void codaEvent(const Coda::CodaEvent &knownEvent);
void handleCodaRunControlModuleLoadContextSuspendedEvent(const Coda::CodaRunControlModuleLoadContextSuspendedEvent &e); void handleCodaRunControlModuleLoadContextSuspendedEvent(const Coda::CodaRunControlModuleLoadContextSuspendedEvent &e);
@@ -171,7 +177,7 @@ private:
void gdbSetCurrentThread(const QByteArray &cmd, const char *why); void gdbSetCurrentThread(const QByteArray &cmd, const char *why);
void logMessage(const QString &msg, int channel = LogDebug); // triggers output() if m_verbose void logMessage(const QString &msg, int channel = LogDebug); // triggers output() if m_verbose
Q_SLOT void trkLogMessage(const QString &msg); Q_SLOT void codaLogMessage(const QString &msg);
QPointer<QTcpServer> m_gdbServer; QPointer<QTcpServer> m_gdbServer;
QPointer<QTcpSocket> m_gdbConnection; QPointer<QTcpSocket> m_gdbConnection;

View File

@@ -67,6 +67,7 @@
#include "stackhandler.h" #include "stackhandler.h"
#include "threadshandler.h" #include "threadshandler.h"
#include "watchhandler.h" #include "watchhandler.h"
#include "debuggersourcepathmappingwidget.h"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# include "dbgwinutils.h" # include "dbgwinutils.h"
@@ -214,6 +215,7 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters,
m_stackNeeded = false; m_stackNeeded = false;
m_preparedForQmlBreak = false; m_preparedForQmlBreak = false;
m_disassembleUsesComma = false; m_disassembleUsesComma = false;
m_qFatalBreakpointNumber = 0;
invalidateSourcesList(); invalidateSourcesList();
@@ -1245,7 +1247,8 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
if (bkptno && frame.isValid() if (bkptno && frame.isValid()
&& !isQmlStepBreakpoint1(bkptno) && !isQmlStepBreakpoint1(bkptno)
&& !isQmlStepBreakpoint2(bkptno)) { && !isQmlStepBreakpoint2(bkptno)
&& !isQFatalBreakpoint(bkptno)) {
// Use opportunity to update the breakpoint marker position. // Use opportunity to update the breakpoint marker position.
BreakHandler *handler = breakHandler(); BreakHandler *handler = breakHandler();
//qDebug() << " PROBLEM: " << m_qmlBreakpointNumbers << bkptno //qDebug() << " PROBLEM: " << m_qmlBreakpointNumbers << bkptno
@@ -1267,7 +1270,8 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
if (lineNumber && !debuggerCore()->boolSetting(OperateByInstruction) if (lineNumber && !debuggerCore()->boolSetting(OperateByInstruction)
&& QFileInfo(fullName).exists() && QFileInfo(fullName).exists()
&& !isQmlStepBreakpoint1(bkptno) && !isQmlStepBreakpoint1(bkptno)
&& !isQmlStepBreakpoint2(bkptno)) && !isQmlStepBreakpoint2(bkptno)
&& !isQFatalBreakpoint(bkptno))
gotoLocation(Location(fullName, lineNumber)); gotoLocation(Location(fullName, lineNumber));
if (!m_commandsToRunOnTemporaryBreak.isEmpty()) { if (!m_commandsToRunOnTemporaryBreak.isEmpty()) {
@@ -2437,6 +2441,8 @@ void GdbEngine::handleBreakList(const GdbMi &table)
needle.number = bkpt.findChild("number").data().toInt(); needle.number = bkpt.findChild("number").data().toInt();
if (isQmlStepBreakpoint2(needle.number)) if (isQmlStepBreakpoint2(needle.number))
continue; continue;
if (isQFatalBreakpoint(needle.number))
continue;
BreakpointId id = breakHandler()->findSimilarBreakpoint(needle); BreakpointId id = breakHandler()->findSimilarBreakpoint(needle);
if (id != BreakpointId(-1)) { if (id != BreakpointId(-1)) {
updateBreakpointDataFromOutput(id, bkpt); updateBreakpointDataFromOutput(id, bkpt);
@@ -4614,14 +4620,20 @@ void GdbEngine::notifyInferiorSetupFailed()
void GdbEngine::handleInferiorPrepared() void GdbEngine::handleInferiorPrepared()
{ {
typedef GlobalDebuggerOptions::SourcePathMap SourcePathMap;
typedef SourcePathMap::const_iterator SourcePathMapIterator;
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
// Apply source path mappings from global options. // Apply source path mappings from global options.
const QSharedPointer<GlobalDebuggerOptions> globalOptions = debuggerCore()->globalDebuggerOptions(); const SourcePathMap sourcePathMap =
if (!globalOptions->sourcePathMap.isEmpty()) { DebuggerSourcePathMappingWidget::mergePlatformQtPath(
typedef GlobalDebuggerOptions::SourcePathMap::const_iterator SourcePathMapIterator; startParameters().qtInstallPath,
const SourcePathMapIterator cend = globalOptions->sourcePathMap.constEnd(); debuggerCore()->globalDebuggerOptions()->sourcePathMap);
for (SourcePathMapIterator it = globalOptions->sourcePathMap.constBegin(); it != cend; ++it) {
if (!sourcePathMap.isEmpty()) {
const SourcePathMapIterator cend = sourcePathMap.constEnd();
for (SourcePathMapIterator it = sourcePathMap.constBegin(); it != cend; ++it) {
QByteArray command = "set substitute-path "; QByteArray command = "set substitute-path ";
command += it.key().toLocal8Bit(); command += it.key().toLocal8Bit();
command += ' '; command += ' ';
@@ -4648,6 +4660,52 @@ void GdbEngine::handleInferiorPrepared()
void GdbEngine::finishInferiorSetup() void GdbEngine::finishInferiorSetup()
{ {
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
// Extract Qt namespace.
QString fileName;
{
QTemporaryFile symbols(QDir::tempPath() + _("/gdb_ns_"));
symbols.open();
fileName = symbols.fileName();
}
postCommand("maint print msymbols " + fileName.toLocal8Bit(),
CB(handleNamespaceExtraction), fileName);
}
void GdbEngine::handleNamespaceExtraction(const GdbResponse &response)
{
QFile file(response.cookie.toString());
file.open(QIODevice::ReadOnly);
QByteArray ba = file.readAll();
//file.remove();
int pos = ba.indexOf("7QString9fromAscii");
int pos1 = pos - 1;
while (pos1 > 0 && ba.at(pos1) != 'N' && ba.at(pos1) > '@')
--pos1;
++pos1;
const QByteArray ns = ba.mid(pos1, pos - pos1);
if (ns.isEmpty()) {
showMessage(_("FOUND NON-NAMESPACED QT"));
} else {
showMessage(_("FOUND NAMESPACED QT: " + ns));
setQtNamespace(ns + "::");
}
postCommand("-break-insert -f '" + qtNamespace() + "qFatal'",
CB(handleBreakOnQFatal));
}
void GdbEngine::handleBreakOnQFatal(const GdbResponse &response)
{
if (response.resultClass == GdbResultDone) {
GdbMi bkpt = response.data.findChild("bkpt");
GdbMi number = bkpt.findChild("number");
int bpnr = number.data().toInt();
if (bpnr) {
m_qFatalBreakpointNumber = bpnr;
postCommand("-break-commands " + number.data() + " return");
}
}
// Continue setup.
notifyInferiorSetupOk(); notifyInferiorSetupOk();
} }
@@ -4678,7 +4736,10 @@ void GdbEngine::handleAdapterCrashed(const QString &msg)
// Don't bother with state transitions - this can happen in any state and // Don't bother with state transitions - this can happen in any state and
// the end result is always the same, so it makes little sense to find a // the end result is always the same, so it makes little sense to find a
// "path" which does not assert. // "path" which does not assert.
if (state() == EngineSetupRequested)
notifyEngineSetupFailed(); notifyEngineSetupFailed();
else
notifyEngineIll();
// No point in being friendly here ... // No point in being friendly here ...
gdbProc()->kill(); gdbProc()->kill();
@@ -4781,6 +4842,11 @@ bool GdbEngine::isQmlStepBreakpoint2(int bpnr) const
return bpnr && m_qmlBreakpointNumbers[2] == bpnr; return bpnr && m_qmlBreakpointNumbers[2] == bpnr;
} }
bool GdbEngine::isQFatalBreakpoint(int bpnr) const
{
return bpnr && m_qFatalBreakpointNumber == bpnr;
}
// //
// Factory // Factory
// //

View File

@@ -137,6 +137,7 @@ private: ////////// Gdb Process Management //////////
void handleGdbExit(const GdbResponse &response); void handleGdbExit(const GdbResponse &response);
void handleRemoteSetupDone(int gdbServerPort, int qmlPort); void handleRemoteSetupDone(int gdbServerPort, int qmlPort);
void handleRemoteSetupFailed(const QString &message); void handleRemoteSetupFailed(const QString &message);
void handleNamespaceExtraction(const GdbResponse &response);
void handleAdapterStarted(); void handleAdapterStarted();
void defaultInferiorShutdown(const char *cmd); void defaultInferiorShutdown(const char *cmd);
@@ -432,6 +433,7 @@ private: ////////// View & Data Stuff //////////
//void handleFetchDisassemblerByMiRangeMixed(const GdbResponse &response); //void handleFetchDisassemblerByMiRangeMixed(const GdbResponse &response);
//void handleFetchDisassemblerByMiRangePlain(const GdbResponse &response); //void handleFetchDisassemblerByMiRangePlain(const GdbResponse &response);
void handleDisassemblerCheck(const GdbResponse &response); void handleDisassemblerCheck(const GdbResponse &response);
void handleBreakOnQFatal(const GdbResponse &response);
DisassemblerLines parseDisassembler(const GdbMi &data); DisassemblerLines parseDisassembler(const GdbMi &data);
DisassemblerLines parseCliDisassembler(const GdbMi &lines); DisassemblerLines parseCliDisassembler(const GdbMi &lines);
DisassemblerLines parseMiDisassembler(const GdbMi &lines); DisassemblerLines parseMiDisassembler(const GdbMi &lines);
@@ -581,11 +583,13 @@ private: ////////// View & Data Stuff //////////
void handleSetQmlStepBreakpoint(const GdbResponse &response); void handleSetQmlStepBreakpoint(const GdbResponse &response);
bool isQmlStepBreakpoint1(int bpnr) const; bool isQmlStepBreakpoint1(int bpnr) const;
bool isQmlStepBreakpoint2(int bpnr) const; bool isQmlStepBreakpoint2(int bpnr) const;
bool isQFatalBreakpoint(int bpnr) const;
// HACK: // HACK:
StackFrame m_targetFrame; StackFrame m_targetFrame;
QByteArray m_currentThread; QByteArray m_currentThread;
QString m_lastWinException; QString m_lastWinException;
int m_qFatalBreakpointNumber;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -59,7 +59,7 @@ namespace Debugger {
namespace Internal { namespace Internal {
ModulesWindow::ModulesWindow(QWidget *parent) ModulesWindow::ModulesWindow(QWidget *parent)
: QTreeView(parent), m_alwaysResizeColumnsToContents(false) : QTreeView(parent)
{ {
QAction *act = debuggerCore()->action(UseAlternatingRowColors); QAction *act = debuggerCore()->action(UseAlternatingRowColors);
setWindowTitle(tr("Modules")); setWindowTitle(tr("Modules"));
@@ -73,6 +73,9 @@ ModulesWindow::ModulesWindow(QWidget *parent)
SLOT(moduleActivated(QModelIndex))); SLOT(moduleActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)), connect(act, SIGNAL(toggled(bool)),
SLOT(setAlternatingRowColorsHelper(bool))); SLOT(setAlternatingRowColorsHelper(bool)));
connect(debuggerCore()->action(AlwaysAdjustModulesColumnWidths),
SIGNAL(toggled(bool)),
SLOT(setAlwaysResizeColumnsToContents(bool)));
} }
void ModulesWindow::moduleActivated(const QModelIndex &index) void ModulesWindow::moduleActivated(const QModelIndex &index)
@@ -165,10 +168,7 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addSeparator(); menu.addSeparator();
QAction *actAdjustColumnWidths = QAction *actAdjustColumnWidths =
menu.addAction(tr("Adjust Column Widths to Contents")); menu.addAction(tr("Adjust Column Widths to Contents"));
QAction *actAlwaysAdjustColumnWidth = menu.addAction(debuggerCore()->action(AlwaysAdjustModulesColumnWidths));
menu.addAction(tr("Always Adjust Column Widths to Contents"));
actAlwaysAdjustColumnWidth->setCheckable(true);
actAlwaysAdjustColumnWidth->setChecked(m_alwaysResizeColumnsToContents);
menu.addSeparator(); menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog)); menu.addAction(debuggerCore()->action(SettingsDialog));
@@ -178,8 +178,6 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
engine->reloadModules(); engine->reloadModules();
else if (act == actAdjustColumnWidths) else if (act == actAdjustColumnWidths)
resizeColumnsToContents(); resizeColumnsToContents();
else if (act == actAlwaysAdjustColumnWidth)
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
else if (act == actShowModuleSources) else if (act == actShowModuleSources)
engine->loadSymbols(name); engine->loadSymbols(name);
else if (act == actLoadSymbolsForAllModules) else if (act == actLoadSymbolsForAllModules)
@@ -206,7 +204,6 @@ void ModulesWindow::resizeColumnsToContents()
void ModulesWindow::setAlwaysResizeColumnsToContents(bool on) void ModulesWindow::setAlwaysResizeColumnsToContents(bool on)
{ {
m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = on QHeaderView::ResizeMode mode = on
? QHeaderView::ResizeToContents : QHeaderView::Interactive; ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
header()->setResizeMode(0, mode); header()->setResizeMode(0, mode);

View File

@@ -55,8 +55,6 @@ private slots:
private: private:
void contextMenuEvent(QContextMenuEvent *ev); void contextMenuEvent(QContextMenuEvent *ev);
void setModel(QAbstractItemModel *model); void setModel(QAbstractItemModel *model);
bool m_alwaysResizeColumnsToContents;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -577,6 +577,7 @@ void QmlCppEngine::slaveEngineStateChanged
notifyInferiorStopOk(); notifyInferiorStopOk();
} else if (state() == EngineRunRequested) { } else if (state() == EngineRunRequested) {
EDEBUG("... AN INFERIOR FAILED STARTUP, OTHER STOPPED EXPECTEDLY"); EDEBUG("... AN INFERIOR FAILED STARTUP, OTHER STOPPED EXPECTEDLY");
notifyEngineRunAndInferiorStopOk();
} else { } else {
EDEBUG("... AN INFERIOR STOPPED SPONTANEOUSLY"); EDEBUG("... AN INFERIOR STOPPED SPONTANEOUSLY");
notifyInferiorSpontaneousStop(); notifyInferiorSpontaneousStop();

View File

@@ -158,7 +158,7 @@ public:
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
RegisterWindow::RegisterWindow(QWidget *parent) RegisterWindow::RegisterWindow(QWidget *parent)
: QTreeView(parent), m_alwaysResizeColumnsToContents(true) : QTreeView(parent)
{ {
QAction *act = debuggerCore()->action(UseAlternatingRowColors); QAction *act = debuggerCore()->action(UseAlternatingRowColors);
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
@@ -170,6 +170,9 @@ RegisterWindow::RegisterWindow(QWidget *parent)
connect(act, SIGNAL(toggled(bool)), connect(act, SIGNAL(toggled(bool)),
SLOT(setAlternatingRowColorsHelper(bool))); SLOT(setAlternatingRowColorsHelper(bool)));
connect(debuggerCore()->action(AlwaysAdjustRegistersColumnWidths),
SIGNAL(toggled(bool)),
SLOT(setAlwaysResizeColumnsToContents(bool)));
} }
void RegisterWindow::resizeEvent(QResizeEvent *ev) void RegisterWindow::resizeEvent(QResizeEvent *ev)
@@ -223,10 +226,7 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addSeparator(); menu.addSeparator();
QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents")); QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents"));
QAction *actAlwaysAdjust = menu.addAction(debuggerCore()->action(AlwaysAdjustRegistersColumnWidths));
menu.addAction(tr("Always Adjust Column Widths to Contents"));
actAlwaysAdjust->setCheckable(true);
actAlwaysAdjust->setChecked(m_alwaysResizeColumnsToContents);
menu.addSeparator(); menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog)); menu.addAction(debuggerCore()->action(SettingsDialog));
@@ -235,8 +235,6 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
if (act == actAdjust) if (act == actAdjust)
resizeColumnsToContents(); resizeColumnsToContents();
else if (act == actAlwaysAdjust)
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
else if (act == actReload) else if (act == actReload)
engine->reloadRegisters(); engine->reloadRegisters();
else if (act == actShowMemory) else if (act == actShowMemory)
@@ -259,7 +257,6 @@ void RegisterWindow::resizeColumnsToContents()
void RegisterWindow::setAlwaysResizeColumnsToContents(bool on) void RegisterWindow::setAlwaysResizeColumnsToContents(bool on)
{ {
m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = on QHeaderView::ResizeMode mode = on
? QHeaderView::ResizeToContents : QHeaderView::Interactive; ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
header()->setResizeMode(0, mode); header()->setResizeMode(0, mode);

View File

@@ -56,8 +56,6 @@ public slots:
private: private:
void resizeEvent(QResizeEvent *ev); void resizeEvent(QResizeEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev); void contextMenuEvent(QContextMenuEvent *ev);
bool m_alwaysResizeColumnsToContents;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -58,7 +58,6 @@ namespace Internal {
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
SnapshotWindow::SnapshotWindow(SnapshotHandler *handler) SnapshotWindow::SnapshotWindow(SnapshotHandler *handler)
: m_alwaysResizeColumnsToContents(false)
{ {
m_snapshotHandler = handler; m_snapshotHandler = handler;
@@ -76,6 +75,9 @@ SnapshotWindow::SnapshotWindow(SnapshotHandler *handler)
SLOT(rowActivated(QModelIndex))); SLOT(rowActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)), connect(act, SIGNAL(toggled(bool)),
SLOT(setAlternatingRowColorsHelper(bool))); SLOT(setAlternatingRowColorsHelper(bool)));
connect(debuggerCore()->action(AlwaysAdjustSnapshotsColumnWidths),
SIGNAL(toggled(bool)),
SLOT(setAlwaysResizeColumnsToContents(bool)));
} }
void SnapshotWindow::rowActivated(const QModelIndex &index) void SnapshotWindow::rowActivated(const QModelIndex &index)
@@ -107,21 +109,14 @@ void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *actCreate = menu.addAction(tr("Create Snapshot")); QAction *actCreate = menu.addAction(tr("Create Snapshot"));
actCreate->setEnabled(idx.data(SnapshotCapabilityRole).toBool()); actCreate->setEnabled(idx.data(SnapshotCapabilityRole).toBool());
menu.addSeparator(); menu.addSeparator();
QAction *actRemove = menu.addAction(tr("Remove Snapshot")); QAction *actRemove = menu.addAction(tr("Remove Snapshot"));
actRemove->setEnabled(idx.isValid()); actRemove->setEnabled(idx.isValid());
menu.addSeparator(); menu.addSeparator();
QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents")); QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents"));
menu.addAction(debuggerCore()->action(AlwaysAdjustSnapshotsColumnWidths));
QAction *actAlwaysAdjust =
menu.addAction(tr("Always Adjust Column Widths to Contents"));
actAlwaysAdjust->setCheckable(true);
actAlwaysAdjust->setChecked(m_alwaysResizeColumnsToContents);
menu.addSeparator(); menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog)); menu.addAction(debuggerCore()->action(SettingsDialog));
@@ -134,8 +129,6 @@ void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
removeSnapshot(idx.row()); removeSnapshot(idx.row());
else if (act == actAdjust) else if (act == actAdjust)
resizeColumnsToContents(); resizeColumnsToContents();
else if (act == actAlwaysAdjust)
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
} }
void SnapshotWindow::removeSnapshot(int i) void SnapshotWindow::removeSnapshot(int i)
@@ -151,7 +144,6 @@ void SnapshotWindow::resizeColumnsToContents()
void SnapshotWindow::setAlwaysResizeColumnsToContents(bool on) void SnapshotWindow::setAlwaysResizeColumnsToContents(bool on)
{ {
m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = QHeaderView::ResizeMode mode =
on ? QHeaderView::ResizeToContents : QHeaderView::Interactive; on ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
for (int i = model()->columnCount(); --i >= 0; ) for (int i = model()->columnCount(); --i >= 0; )

View File

@@ -61,7 +61,6 @@ private:
void keyPressEvent(QKeyEvent *ev); void keyPressEvent(QKeyEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev); void contextMenuEvent(QContextMenuEvent *ev);
bool m_alwaysResizeColumnsToContents;
SnapshotHandler *m_snapshotHandler; SnapshotHandler *m_snapshotHandler;
}; };

View File

@@ -59,7 +59,7 @@ static DebuggerEngine *currentEngine()
} }
StackWindow::StackWindow(QWidget *parent) StackWindow::StackWindow(QWidget *parent)
: QTreeView(parent), m_alwaysResizeColumnsToContents(false) : QTreeView(parent)
{ {
setAttribute(Qt::WA_MacShowFocusRect, false); setAttribute(Qt::WA_MacShowFocusRect, false);
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
@@ -83,6 +83,9 @@ StackWindow::StackWindow(QWidget *parent)
SLOT(reloadFullStack())); SLOT(reloadFullStack()));
connect(debuggerCore()->action(MaximalStackDepth), SIGNAL(triggered()), connect(debuggerCore()->action(MaximalStackDepth), SIGNAL(triggered()),
SLOT(reloadFullStack())); SLOT(reloadFullStack()));
connect(debuggerCore()->action(AlwaysAdjustStackColumnWidths),
SIGNAL(triggered(bool)),
SLOT(setAlwaysResizeColumnsToContents(bool)));
showAddressColumn(false); showAddressColumn(false);
} }
@@ -154,12 +157,7 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(debuggerCore()->action(UseAddressInStackView)); menu.addAction(debuggerCore()->action(UseAddressInStackView));
QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents")); QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents"));
menu.addAction(debuggerCore()->action(AlwaysAdjustStackColumnWidths));
QAction *actAlwaysAdjust =
menu.addAction(tr("Always Adjust Column Widths to Contents"));
actAlwaysAdjust->setCheckable(true);
actAlwaysAdjust->setChecked(m_alwaysResizeColumnsToContents);
menu.addSeparator(); menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog)); menu.addAction(debuggerCore()->action(SettingsDialog));
@@ -172,8 +170,6 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
copyContentsToClipboard(); copyContentsToClipboard();
else if (act == actAdjust) else if (act == actAdjust)
resizeColumnsToContents(); resizeColumnsToContents();
else if (act == actAlwaysAdjust)
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
else if (act == actShowMemory) else if (act == actShowMemory)
engine->openMemoryView(address); engine->openMemoryView(address);
else if (act == actShowDisassembler) else if (act == actShowDisassembler)
@@ -215,7 +211,6 @@ void StackWindow::resizeColumnsToContents()
void StackWindow::setAlwaysResizeColumnsToContents(bool on) void StackWindow::setAlwaysResizeColumnsToContents(bool on)
{ {
m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = QHeaderView::ResizeMode mode =
on ? QHeaderView::ResizeToContents : QHeaderView::Interactive; on ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
for (int i = model()->columnCount(); --i >= 0; ) for (int i = model()->columnCount(); --i >= 0; )

View File

@@ -60,8 +60,6 @@ private:
void setModel(QAbstractItemModel *model); void setModel(QAbstractItemModel *model);
void contextMenuEvent(QContextMenuEvent *ev); void contextMenuEvent(QContextMenuEvent *ev);
void copyContentsToClipboard(); void copyContentsToClipboard();
bool m_alwaysResizeColumnsToContents;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -87,7 +87,7 @@
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="toolChainLabel"> <widget class="QLabel" name="toolChainLabel">
<property name="text"> <property name="text">
<string>&amp;ToolChain:</string> <string>&amp;Tool chain:</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>toolChainComboBox</cstring> <cstring>toolChainComboBox</cstring>

View File

@@ -50,7 +50,7 @@ namespace Debugger {
namespace Internal { namespace Internal {
ThreadsWindow::ThreadsWindow(QWidget *parent) ThreadsWindow::ThreadsWindow(QWidget *parent)
: QTreeView(parent), m_alwaysResizeColumnsToContents(false) : QTreeView(parent)
{ {
QAction *act = debuggerCore()->action(UseAlternatingRowColors); QAction *act = debuggerCore()->action(UseAlternatingRowColors);
@@ -64,9 +64,12 @@ ThreadsWindow::ThreadsWindow(QWidget *parent)
header()->setDefaultAlignment(Qt::AlignLeft); header()->setDefaultAlignment(Qt::AlignLeft);
connect(this, SIGNAL(activated(QModelIndex)), connect(this, SIGNAL(activated(QModelIndex)),
this, SLOT(rowActivated(QModelIndex))); SLOT(rowActivated(QModelIndex)));
connect(act, SIGNAL(toggled(bool)), connect(act, SIGNAL(toggled(bool)),
this, SLOT(setAlternatingRowColorsHelper(bool))); SLOT(setAlternatingRowColorsHelper(bool)));
connect(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths),
SIGNAL(toggled(bool)),
SLOT(setAlwaysResizeColumnsToContents(bool)));
} }
void ThreadsWindow::rowActivated(const QModelIndex &index) void ThreadsWindow::rowActivated(const QModelIndex &index)
@@ -87,10 +90,7 @@ void ThreadsWindow::contextMenuEvent(QContextMenuEvent *ev)
QMenu menu; QMenu menu;
QAction *adjustColumnAction = QAction *adjustColumnAction =
menu.addAction(tr("Adjust Column Widths to Contents")); menu.addAction(tr("Adjust Column Widths to Contents"));
QAction *alwaysAdjustColumnAction = menu.addAction(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths));
menu.addAction(tr("Always Adjust Column Widths to Contents"));
alwaysAdjustColumnAction->setCheckable(true);
alwaysAdjustColumnAction->setChecked(m_alwaysResizeColumnsToContents);
menu.addSeparator(); menu.addSeparator();
menu.addAction(debuggerCore()->action(SettingsDialog)); menu.addAction(debuggerCore()->action(SettingsDialog));
@@ -99,11 +99,8 @@ void ThreadsWindow::contextMenuEvent(QContextMenuEvent *ev)
if (!act) if (!act)
return; return;
if (act == adjustColumnAction) { if (act == adjustColumnAction)
resizeColumnsToContents(); resizeColumnsToContents();
} else if (act == alwaysAdjustColumnAction) {
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
}
} }
void ThreadsWindow::resizeColumnsToContents() void ThreadsWindow::resizeColumnsToContents()
@@ -115,7 +112,6 @@ void ThreadsWindow::resizeColumnsToContents()
void ThreadsWindow::setAlwaysResizeColumnsToContents(bool on) void ThreadsWindow::setAlwaysResizeColumnsToContents(bool on)
{ {
m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = on QHeaderView::ResizeMode mode = on
? QHeaderView::ResizeToContents : QHeaderView::Interactive; ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
header()->setResizeMode(0, mode); header()->setResizeMode(0, mode);

View File

@@ -57,8 +57,6 @@ private slots:
private: private:
void setModel(QAbstractItemModel *model); void setModel(QAbstractItemModel *model);
void contextMenuEvent(QContextMenuEvent *ev); void contextMenuEvent(QContextMenuEvent *ev);
bool m_alwaysResizeColumnsToContents;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -682,6 +682,9 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
case LocalsExpressionRole: case LocalsExpressionRole:
return QVariant(expression(item)); return QVariant(expression(item));
case LocalsRawExpressionRole:
return data.exp;
case LocalsINameRole: case LocalsINameRole:
return data.iname; return data.iname;

View File

@@ -147,16 +147,13 @@ private:
WatchWindow::WatchWindow(Type type, QWidget *parent) WatchWindow::WatchWindow(Type type, QWidget *parent)
: QTreeView(parent), : QTreeView(parent),
m_alwaysResizeColumnsToContents(true),
m_type(type) m_type(type)
{ {
m_grabbing = false; m_grabbing = false;
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
setAttribute(Qt::WA_MacShowFocusRect, false); setAttribute(Qt::WA_MacShowFocusRect, false);
setWindowTitle(tr("Locals and Watchers")); setWindowTitle(tr("Locals and Watchers"));
setAlternatingRowColors(act->isChecked());
setIndentation(indentation() * 9/10); setIndentation(indentation() * 9/10);
setUniformRowHeights(true); setUniformRowHeights(true);
setItemDelegate(new WatchDelegate(this)); setItemDelegate(new WatchDelegate(this));
@@ -164,12 +161,19 @@ WatchWindow::WatchWindow(Type type, QWidget *parent)
setAcceptDrops(true); setAcceptDrops(true);
setDropIndicatorShown(true); setDropIndicatorShown(true);
connect(act, SIGNAL(toggled(bool)), QAction *useColors = debuggerCore()->action(UseAlternatingRowColors);
this, SLOT(setAlternatingRowColorsHelper(bool))); setAlternatingRowColors(useColors->isChecked());
QAction *adjustColumns = debuggerCore()->action(AlwaysAdjustLocalsColumnWidths);
connect(useColors, SIGNAL(toggled(bool)),
SLOT(setAlternatingRowColorsHelper(bool)));
connect(adjustColumns, SIGNAL(triggered(bool)),
SLOT(setAlwaysResizeColumnsToContents(bool)));
connect(this, SIGNAL(expanded(QModelIndex)), connect(this, SIGNAL(expanded(QModelIndex)),
this, SLOT(expandNode(QModelIndex))); SLOT(expandNode(QModelIndex)));
connect(this, SIGNAL(collapsed(QModelIndex)), connect(this, SIGNAL(collapsed(QModelIndex)),
this, SLOT(collapseNode(QModelIndex))); SLOT(collapseNode(QModelIndex)));
} }
void WatchWindow::expandNode(const QModelIndex &idx) void WatchWindow::expandNode(const QModelIndex &idx)
@@ -187,7 +191,7 @@ void WatchWindow::keyPressEvent(QKeyEvent *ev)
if (ev->key() == Qt::Key_Delete && m_type == WatchersType) { if (ev->key() == Qt::Key_Delete && m_type == WatchersType) {
QModelIndex idx = currentIndex(); QModelIndex idx = currentIndex();
QModelIndex idx1 = idx.sibling(idx.row(), 0); QModelIndex idx1 = idx.sibling(idx.row(), 0);
QString exp = idx1.data().toString(); QString exp = idx1.data(LocalsRawExpressionRole).toString();
removeWatchExpression(exp); removeWatchExpression(exp);
} else if (ev->key() == Qt::Key_Return } else if (ev->key() == Qt::Key_Return
&& ev->modifiers() == Qt::ControlModifier && ev->modifiers() == Qt::ControlModifier
@@ -468,12 +472,9 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *actAdjustColumnWidths = QAction *actAdjustColumnWidths =
menu.addAction(tr("Adjust Column Widths to Contents")); menu.addAction(tr("Adjust Column Widths to Contents"));
QAction *actAlwaysAdjustColumnWidth = menu.addAction(debuggerCore()->action(AlwaysAdjustLocalsColumnWidths));
menu.addAction(tr("Always Adjust Column Widths to Contents"));
actAlwaysAdjustColumnWidth->setCheckable(true);
actAlwaysAdjustColumnWidth->setChecked(m_alwaysResizeColumnsToContents);
menu.addSeparator(); menu.addSeparator();
QAction *actClearCodeModelSnapshot QAction *actClearCodeModelSnapshot
= new QAction(tr("Refresh Code Model Snapshot"), &menu); = new QAction(tr("Refresh Code Model Snapshot"), &menu);
actClearCodeModelSnapshot->setEnabled(actionsEnabled actClearCodeModelSnapshot->setEnabled(actionsEnabled
@@ -495,8 +496,6 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
if (act == actAdjustColumnWidths) { if (act == actAdjustColumnWidths) {
resizeColumnsToContents(); resizeColumnsToContents();
} else if (act == actAlwaysAdjustColumnWidth) {
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
} else if (act == actInsertNewWatchItem) { } else if (act == actInsertNewWatchItem) {
watchExpression(QString()); watchExpression(QString());
} else if (act == actOpenMemoryEditAtVariableAddress) { } else if (act == actOpenMemoryEditAtVariableAddress) {
@@ -566,7 +565,6 @@ void WatchWindow::setAlwaysResizeColumnsToContents(bool on)
{ {
if (!header()) if (!header())
return; return;
m_alwaysResizeColumnsToContents = on;
QHeaderView::ResizeMode mode = on QHeaderView::ResizeMode mode = on
? QHeaderView::ResizeToContents : QHeaderView::Interactive; ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
header()->setResizeMode(0, mode); header()->setResizeMode(0, mode);
@@ -594,10 +592,13 @@ void WatchWindow::setModel(QAbstractItemModel *model)
QTreeView::setModel(model); QTreeView::setModel(model);
setRootIsDecorated(true); setRootIsDecorated(true);
if (header()) {
setAlwaysResizeColumnsToContents(
debuggerCore()->boolSetting(AlwaysAdjustLocalsColumnWidths));
header()->setDefaultAlignment(Qt::AlignLeft); header()->setDefaultAlignment(Qt::AlignLeft);
header()->setResizeMode(QHeaderView::ResizeToContents);
if (m_type != LocalsType) if (m_type != LocalsType)
header()->hide(); header()->hide();
}
connect(model, SIGNAL(layoutChanged()), SLOT(resetHelper())); connect(model, SIGNAL(layoutChanged()), SLOT(resetHelper()));
connect(model, SIGNAL(enableUpdates(bool)), SLOT(setUpdatesEnabled(bool))); connect(model, SIGNAL(enableUpdates(bool)), SLOT(setUpdatesEnabled(bool)));

View File

@@ -57,7 +57,6 @@ public:
public slots: public slots:
void resizeColumnsToContents(); void resizeColumnsToContents();
void setAlwaysResizeColumnsToContents(bool on = true);
void setModel(QAbstractItemModel *model); void setModel(QAbstractItemModel *model);
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); } void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
void watchExpression(const QString &exp); void watchExpression(const QString &exp);
@@ -68,6 +67,7 @@ private:
Q_SLOT void expandNode(const QModelIndex &idx); Q_SLOT void expandNode(const QModelIndex &idx);
Q_SLOT void collapseNode(const QModelIndex &idx); Q_SLOT void collapseNode(const QModelIndex &idx);
Q_SLOT void setUpdatesEnabled(bool enable); Q_SLOT void setUpdatesEnabled(bool enable);
Q_SLOT void setAlwaysResizeColumnsToContents(bool on);
void keyPressEvent(QKeyEvent *ev); void keyPressEvent(QKeyEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev); void contextMenuEvent(QContextMenuEvent *ev);
@@ -84,7 +84,6 @@ private:
void setModelData(int role, const QVariant &value = QVariant(), void setModelData(int role, const QVariant &value = QVariant(),
const QModelIndex &index = QModelIndex()); const QModelIndex &index = QModelIndex());
bool m_alwaysResizeColumnsToContents;
Type m_type; Type m_type;
bool m_grabbing; bool m_grabbing;
}; };

View File

@@ -277,21 +277,7 @@ bool FakeVimOptionPage::matches(const QString &s) const
// //
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
struct CommandItem enum { CommandRole = Qt::UserRole };
{
Command *m_cmd;
QString m_regex;
QTreeWidgetItem *m_item;
};
} // namespace Internal
} // namespace FakeVim
Q_DECLARE_METATYPE(FakeVim::Internal::CommandItem *)
namespace FakeVim {
namespace Internal {
class FakeVimExCommandsPage : public Core::CommandMappings class FakeVimExCommandsPage : public Core::CommandMappings
{ {
@@ -299,7 +285,7 @@ class FakeVimExCommandsPage : public Core::CommandMappings
public: public:
FakeVimExCommandsPage(FakeVimPluginPrivate *q) : m_q(q) {} FakeVimExCommandsPage(FakeVimPluginPrivate *q) : m_q(q) {}
~FakeVimExCommandsPage() { qDeleteAll(m_citems); } ~FakeVimExCommandsPage() {}
// IOptionsPage // IOptionsPage
QString id() const { return _(Constants::SETTINGS_EX_CMDS_ID); } QString id() const { return _(Constants::SETTINGS_EX_CMDS_ID); }
@@ -321,8 +307,7 @@ public slots:
void defaultAction(); void defaultAction();
private: private:
void setRegex(const QString &regex); //QList<QTreeWidgetItem *> m_citems;
QList<CommandItem *> m_citems;
FakeVimPluginPrivate *m_q; FakeVimPluginPrivate *m_q;
}; };
@@ -350,11 +335,9 @@ void FakeVimExCommandsPage::initialize()
if (c->action() && c->action()->isSeparator()) if (c->action() && c->action()->isSeparator())
continue; continue;
CommandItem *ci = new CommandItem;
QTreeWidgetItem *item = new QTreeWidgetItem; QTreeWidgetItem *item = new QTreeWidgetItem;
ci->m_cmd = c; item->setData(0, CommandRole, int(c->id()));
ci->m_item = item; //m_citems.append(item);
m_citems.append(ci);
const QString name = uidm->stringForUniqueIdentifier(c->id()); const QString name = uidm->stringForUniqueIdentifier(c->id());
const int pos = name.indexOf(QLatin1Char('.')); const int pos = name.indexOf(QLatin1Char('.'));
@@ -383,16 +366,13 @@ void FakeVimExCommandsPage::initialize()
} else { } else {
item->setText(1, c->shortcut()->whatsThis()); item->setText(1, c->shortcut()->whatsThis());
} }
if (exCommandMap().contains(name)) {
ci->m_regex = exCommandMap()[name].pattern();
} else {
ci->m_regex.clear();
}
item->setText(2, ci->m_regex); QString regex;
item->setData(0, Qt::UserRole, qVariantFromValue(ci)); if (exCommandMap().contains(name))
regex = exCommandMap()[name].pattern();
item->setText(2, regex);
if (ci->m_regex != defaultExCommandMap()[name].pattern()) if (regex != defaultExCommandMap()[name].pattern())
setModified(item, true); setModified(item, true);
} }
@@ -402,12 +382,8 @@ void FakeVimExCommandsPage::initialize()
void FakeVimExCommandsPage::commandChanged(QTreeWidgetItem *current) void FakeVimExCommandsPage::commandChanged(QTreeWidgetItem *current)
{ {
CommandMappings::commandChanged(current); CommandMappings::commandChanged(current);
if (current)
if (!current || !current->data(0, Qt::UserRole).isValid()) targetEdit()->setText(current->text(2));
return;
CommandItem *citem = qVariantValue<CommandItem *>(current->data(0, Qt::UserRole));
targetEdit()->setText(citem->m_regex);
} }
void FakeVimExCommandsPage::targetIdentifierChanged() void FakeVimExCommandsPage::targetIdentifierChanged()
@@ -417,39 +393,34 @@ void FakeVimExCommandsPage::targetIdentifierChanged()
return; return;
UniqueIDManager *uidm = UniqueIDManager::instance(); UniqueIDManager *uidm = UniqueIDManager::instance();
CommandItem *citem = qVariantValue<CommandItem *>(current->data(0, Qt::UserRole)); int id = current->data(0, CommandRole).toInt();
const QString name = uidm->stringForUniqueIdentifier(citem->m_cmd->id()); const QString name = uidm->stringForUniqueIdentifier(id);
const QString regex = targetEdit()->text();
if (current->data(0, Qt::UserRole).isValid()) { if (current->data(0, Qt::UserRole).isValid()) {
citem->m_regex = targetEdit()->text(); current->setText(2, regex);
current->setText(2, citem->m_regex); exCommandMap()[name] = QRegExp(regex);
exCommandMap()[name] = QRegExp(citem->m_regex);
} }
if (citem->m_regex != defaultExCommandMap()[name].pattern()) if (regex != defaultExCommandMap()[name].pattern())
setModified(current, true); setModified(current, true);
else else
setModified(current, false); setModified(current, false);
} }
void FakeVimExCommandsPage::setRegex(const QString &regex)
{
targetEdit()->setText(regex);
}
void FakeVimExCommandsPage::resetTargetIdentifier() void FakeVimExCommandsPage::resetTargetIdentifier()
{ {
UniqueIDManager *uidm = UniqueIDManager::instance();
QTreeWidgetItem *current = commandList()->currentItem(); QTreeWidgetItem *current = commandList()->currentItem();
if (current && current->data(0, Qt::UserRole).isValid()) { if (!current)
CommandItem *citem = qVariantValue<CommandItem *>(current->data(0, Qt::UserRole)); return;
const QString &name = uidm->stringForUniqueIdentifier(citem->m_cmd->id()); UniqueIDManager *uidm = UniqueIDManager::instance();
int id = current->data(0, CommandRole).toInt();
const QString name = uidm->stringForUniqueIdentifier(id);
QString regex;
if (defaultExCommandMap().contains(name)) if (defaultExCommandMap().contains(name))
setRegex(defaultExCommandMap()[name].pattern()); regex = defaultExCommandMap()[name].pattern();
else targetEdit()->setText(regex);
setRegex(QString());
}
} }
void FakeVimExCommandsPage::removeTargetIdentifier() void FakeVimExCommandsPage::removeTargetIdentifier()
@@ -460,17 +431,22 @@ void FakeVimExCommandsPage::removeTargetIdentifier()
void FakeVimExCommandsPage::defaultAction() void FakeVimExCommandsPage::defaultAction()
{ {
UniqueIDManager *uidm = UniqueIDManager::instance(); UniqueIDManager *uidm = UniqueIDManager::instance();
foreach (CommandItem *item, m_citems) { int n = commandList()->topLevelItemCount();
const QString &name = uidm->stringForUniqueIdentifier(item->m_cmd->id()); for (int i = 0; i != n; ++i) {
if (defaultExCommandMap().contains(name)) { QTreeWidgetItem *section = commandList()->topLevelItem(i);
item->m_regex = defaultExCommandMap()[name].pattern(); int m = section->childCount();
} else { for (int j = 0; j != m; ++j) {
item->m_regex.clear(); QTreeWidgetItem *item = section->child(j);
const int id = item->data(0, CommandRole).toInt();
const QString name = uidm->stringForUniqueIdentifier(id);
QString regex;
if (defaultExCommandMap().contains(name))
regex = defaultExCommandMap()[name].pattern();
setModified(item, false);
item->setText(2, regex);
if (item == commandList()->currentItem())
commandChanged(item);
} }
setModified(item->m_item, false);
item->m_item->setText(2, item->m_regex);
if (item->m_item == commandList()->currentItem())
commandChanged(item->m_item);
} }
} }

View File

@@ -516,7 +516,7 @@ void GenericBuildSettingsWidget::updateToolChainList()
QList<ToolChain *> tcs = ToolChainManager::instance()->toolChains(); QList<ToolChain *> tcs = ToolChainManager::instance()->toolChains();
if (!m_target->genericProject()->toolChain()) { if (!m_target->genericProject()->toolChain()) {
m_toolChainChooser->addItem(tr("<Invalid Toolchain>"), qVariantFromValue(static_cast<void *>(0))); m_toolChainChooser->addItem(tr("<Invalid tool chain>"), qVariantFromValue(static_cast<void *>(0)));
m_toolChainChooser->setCurrentIndex(0); m_toolChainChooser->setCurrentIndex(0);
} }
foreach (ToolChain *tc, tcs) { foreach (ToolChain *tc, tcs) {

View File

@@ -124,9 +124,9 @@ void ImageViewerActionHandler::createActions()
d_ptr->context, QKeySequence(tr("Ctrl+0"))); d_ptr->context, QKeySequence(tr("Ctrl+0")));
registerNewAction(FitToScreen, Constants::ACTION_FIT_TO_SCREEN, tr("Fit To Screen"), registerNewAction(FitToScreen, Constants::ACTION_FIT_TO_SCREEN, tr("Fit To Screen"),
d_ptr->context, QKeySequence(tr("Ctrl+="))); d_ptr->context, QKeySequence(tr("Ctrl+=")));
registerNewAction(Background, Constants::ACTION_BACKGROUND, tr("Switch background"), registerNewAction(Background, Constants::ACTION_BACKGROUND, tr("Switch Background"),
d_ptr->context, QKeySequence(tr("Ctrl+["))); d_ptr->context, QKeySequence(tr("Ctrl+[")));
registerNewAction(Outline, Constants::ACTION_OUTLINE, tr("Switch outline"), registerNewAction(Outline, Constants::ACTION_OUTLINE, tr("Switch Outline"),
d_ptr->context, QKeySequence(tr("Ctrl+]"))); d_ptr->context, QKeySequence(tr("Ctrl+]")));
} }

View File

@@ -93,10 +93,24 @@ static QList<Abi> parseCoffHeader(const QByteArray &data)
if (data.size() >= 68) { if (data.size() >= 68) {
// Get Major and Minor Image Version from optional header fields // Get Major and Minor Image Version from optional header fields
quint32 image = (data.at(67) << 24) + (data.at(66) << 16) + (data.at(65) << 8) + data.at(64); quint32 image = (data.at(67) << 24) + (data.at(66) << 16) + (data.at(65) << 8) + data.at(64);
if (image == 1) // Image is 1 for mingw and higher for MSVC (4.something in some encoding) if (image == 1) { // Image is 1 for mingw and higher for MSVC (4.something in some encoding)
flavor = Abi::WindowsMSysFlavor; flavor = Abi::WindowsMSysFlavor;
else } else {
flavor = Abi::WindowsMsvcFlavor; switch (data.at(22)) {
case 8:
flavor = Abi::WindowsMsvc2005Flavor;
break;
case 9:
flavor = Abi::WindowsMsvc2008Flavor;
break;
case 10:
flavor = Abi::WindowsMsvc2010Flavor;
break;
default:
// Keep unknown flavor
break;
}
}
} }
if (arch != Abi::UnknownArchitecture && width != 0) if (arch != Abi::UnknownArchitecture && width != 0)
@@ -196,7 +210,7 @@ Abi::Abi(const Architecture &a, const OS &o,
m_osFlavor = UnknownFlavor; m_osFlavor = UnknownFlavor;
break; break;
case ProjectExplorer::Abi::WindowsOS: case ProjectExplorer::Abi::WindowsOS:
if (m_osFlavor < WindowsMsvcFlavor || m_osFlavor > WindowsCEFlavor) if (m_osFlavor < WindowsMsvc2005Flavor || m_osFlavor > WindowsCEFlavor)
m_osFlavor = UnknownFlavor; m_osFlavor = UnknownFlavor;
break; break;
} }
@@ -258,8 +272,12 @@ Abi::Abi(const QString &abiString) :
m_osFlavor = SymbianEmulatorFlavor; m_osFlavor = SymbianEmulatorFlavor;
else if (abiParts.at(2) == QLatin1String("generic") && m_os == UnixOS) else if (abiParts.at(2) == QLatin1String("generic") && m_os == UnixOS)
m_osFlavor = GenericUnixFlavor; m_osFlavor = GenericUnixFlavor;
else if (abiParts.at(2) == QLatin1String("msvc") && m_os == WindowsOS) else if (abiParts.at(2) == QLatin1String("msvc2005") && m_os == WindowsOS)
m_osFlavor = WindowsMsvcFlavor; m_osFlavor = WindowsMsvc2005Flavor;
else if (abiParts.at(2) == QLatin1String("msvc2008") && m_os == WindowsOS)
m_osFlavor = WindowsMsvc2008Flavor;
else if (abiParts.at(2) == QLatin1String("msvc2010") && m_os == WindowsOS)
m_osFlavor = WindowsMsvc2010Flavor;
else if (abiParts.at(2) == QLatin1String("msys") && m_os == WindowsOS) else if (abiParts.at(2) == QLatin1String("msys") && m_os == WindowsOS)
m_osFlavor = WindowsMSysFlavor; m_osFlavor = WindowsMSysFlavor;
else if (abiParts.at(2) == QLatin1String("ce") && m_os == WindowsOS) else if (abiParts.at(2) == QLatin1String("ce") && m_os == WindowsOS)
@@ -399,8 +417,12 @@ QString Abi::toString(const OSFlavor &of)
return QLatin1String("emulator"); return QLatin1String("emulator");
case ProjectExplorer::Abi::GenericUnixFlavor: case ProjectExplorer::Abi::GenericUnixFlavor:
return QLatin1String("generic"); return QLatin1String("generic");
case ProjectExplorer::Abi::WindowsMsvcFlavor: case ProjectExplorer::Abi::WindowsMsvc2005Flavor:
return QLatin1String("msvc"); return QLatin1String("msvc2005");
case ProjectExplorer::Abi::WindowsMsvc2008Flavor:
return QLatin1String("msvc2008");
case ProjectExplorer::Abi::WindowsMsvc2010Flavor:
return QLatin1String("msvc2010");
case ProjectExplorer::Abi::WindowsMSysFlavor: case ProjectExplorer::Abi::WindowsMSysFlavor:
return QLatin1String("msys"); return QLatin1String("msys");
case ProjectExplorer::Abi::WindowsCEFlavor: case ProjectExplorer::Abi::WindowsCEFlavor:
@@ -445,7 +467,15 @@ Abi Abi::hostAbi()
#if defined (Q_OS_WIN) #if defined (Q_OS_WIN)
os = WindowsOS; os = WindowsOS;
subos = WindowsMsvcFlavor; #if _MSC_VER == 1600
subos = WindowsMsvc2010Flavor;
#elif _MSC_VER == 1500
subos = WindowsMsvc2008Flavor;
#elif _MSC_VER == 1400
subos = WindowsMsvc2005Flavor;
#elif defined (mingw32)
subos = WindowsMSysFlavor;
#endif
format = PEFormat; format = PEFormat;
#elif defined (Q_OS_LINUX) #elif defined (Q_OS_LINUX)
os = LinuxOS; os = LinuxOS;

View File

@@ -85,7 +85,9 @@ public:
GenericUnixFlavor, GenericUnixFlavor,
// Windows // Windows
WindowsMsvcFlavor, WindowsMsvc2005Flavor,
WindowsMsvc2008Flavor,
WindowsMsvc2010Flavor,
WindowsMSysFlavor, WindowsMSysFlavor,
WindowsCEFlavor WindowsCEFlavor
}; };

View File

@@ -477,7 +477,7 @@ QList<ToolChain *> Internal::GccToolChainFactory::autoDetect()
return autoDetectToolchains(QLatin1String("g++"), debuggers, Abi::hostAbi()); return autoDetectToolchains(QLatin1String("g++"), debuggers, Abi::hostAbi());
} }
// Used by the ToolChainManager to restore user-generated ToolChains // Used by the ToolChainManager to restore user-generated tool chains
bool Internal::GccToolChainFactory::canRestore(const QVariantMap &data) bool Internal::GccToolChainFactory::canRestore(const QVariantMap &data)
{ {
return idFromMap(data).startsWith(QLatin1String(Constants::GCC_TOOLCHAIN_ID) + QLatin1Char(':')); return idFromMap(data).startsWith(QLatin1String(Constants::GCC_TOOLCHAIN_ID) + QLatin1Char(':'));
@@ -672,7 +672,9 @@ QString Internal::MingwToolChainFactory::id() const
QList<ToolChain *> Internal::MingwToolChainFactory::autoDetect() QList<ToolChain *> Internal::MingwToolChainFactory::autoDetect()
{ {
return autoDetectToolchains(QLatin1String("gcc"), QStringList(), Abi::hostAbi()); Abi ha = Abi::hostAbi();
return autoDetectToolchains(QLatin1String("g++"), QStringList(),
Abi(ha.architecture(), Abi::WindowsOS, Abi::WindowsMSysFlavor, Abi::PEFormat, ha.wordWidth()));
} }
bool Internal::MingwToolChainFactory::canCreate() bool Internal::MingwToolChainFactory::canCreate()

View File

@@ -67,7 +67,7 @@ public:
bool canCreate(); bool canCreate();
ToolChain *create(); ToolChain *create();
// Used by the ToolChainManager to restore user-generated ToolChains // Used by the ToolChainManager to restore user-generated tool chains
bool canRestore(const QVariantMap &data); bool canRestore(const QVariantMap &data);
ToolChain *restore(const QVariantMap &data); ToolChain *restore(const QVariantMap &data);
@@ -124,7 +124,7 @@ public:
bool canCreate(); bool canCreate();
ToolChain *create(); ToolChain *create();
// Used by the ToolChainManager to restore user-generated ToolChains // Used by the ToolChainManager to restore user-generated tool chains
bool canRestore(const QVariantMap &data); bool canRestore(const QVariantMap &data);
ToolChain *restore(const QVariantMap &data); ToolChain *restore(const QVariantMap &data);
@@ -149,7 +149,7 @@ public:
ToolChain *create(); ToolChain *create();
// Used by the ToolChainManager to restore user-generated ToolChains // Used by the ToolChainManager to restore user-generated tool chains
bool canRestore(const QVariantMap &data); bool canRestore(const QVariantMap &data);
ToolChain *restore(const QVariantMap &data); ToolChain *restore(const QVariantMap &data);

View File

@@ -82,6 +82,44 @@ static QString platformName(MsvcToolChain::Platform t)
return QString(); return QString();
} }
static Abi findAbiOfMsvc(MsvcToolChain::Type type, MsvcToolChain::Platform platform, const QString &version)
{
Abi::Architecture arch = Abi::X86Architecture;
Abi::OSFlavor flavor = Abi::UnknownFlavor;
int wordWidth = 64;
switch (platform)
{
case ProjectExplorer::Internal::MsvcToolChain::s32:
wordWidth = 32;
break;
case ProjectExplorer::Internal::MsvcToolChain::ia64:
arch = Abi::ItaniumArchitecture;
break;
case ProjectExplorer::Internal::MsvcToolChain::s64:
case ProjectExplorer::Internal::MsvcToolChain::amd64:
break;
};
QString msvcVersionString = version;
if (type == MsvcToolChain::WindowsSDK) {
if (version.startsWith("7."))
msvcVersionString = "10.0";
else if (version.startsWith("6.1"))
msvcVersionString = "9.0";
else
msvcVersionString = "8.0";
}
if (msvcVersionString.startsWith("10."))
flavor = Abi::WindowsMsvc2010Flavor;
else if (msvcVersionString.startsWith("9."))
flavor = Abi::WindowsMsvc2008Flavor;
else
flavor = Abi::WindowsMsvc2005Flavor;
return Abi(arch, Abi::WindowsOS, flavor, Abi::PEFormat, wordWidth);
}
static QString generateDisplayName(const QString &name, static QString generateDisplayName(const QString &name,
MsvcToolChain::Type t, MsvcToolChain::Type t,
MsvcToolChain::Platform p) MsvcToolChain::Platform p)
@@ -309,36 +347,25 @@ static Utils::Environment msvcReadEnvironmentSetting(const QString &varsBat,
// MsvcToolChain // MsvcToolChain
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
MsvcToolChain::MsvcToolChain(Type type, const QString &name, Platform platform, MsvcToolChain::MsvcToolChain(const QString &name, const Abi &abi,
const QString &varsBat, const QString &varsBatArg, bool autodetect) : const QString &varsBat, const QString &varsBatArg, bool autodetect) :
ToolChain(QLatin1String(Constants::MSVC_TOOLCHAIN_ID), autodetect), ToolChain(QLatin1String(Constants::MSVC_TOOLCHAIN_ID), autodetect),
m_varsBat(varsBat), m_varsBat(varsBat),
m_varsBatArg(varsBatArg), m_varsBatArg(varsBatArg),
m_lastEnvironment(Utils::Environment::systemEnvironment()), m_lastEnvironment(Utils::Environment::systemEnvironment()),
m_is64bit(true), m_abi(abi)
m_architecture(Abi::X86Architecture)
{ {
Q_ASSERT(!name.isEmpty()); Q_ASSERT(!name.isEmpty());
Q_ASSERT(!m_varsBat.isEmpty()); Q_ASSERT(!m_varsBat.isEmpty());
Q_ASSERT(QFileInfo(m_varsBat).exists()); Q_ASSERT(QFileInfo(m_varsBat).exists());
Q_ASSERT(abi.os() == Abi::WindowsOS);
switch (platform) Q_ASSERT(abi.binaryFormat() == Abi::PEFormat);
{ Q_ASSERT(abi.osFlavor() != Abi::WindowsMSysFlavor);
case ProjectExplorer::Internal::MsvcToolChain::s32:
m_is64bit = false;
break;
case ProjectExplorer::Internal::MsvcToolChain::ia64:
m_architecture = Abi::ItaniumArchitecture;
break;
case ProjectExplorer::Internal::MsvcToolChain::s64:
case ProjectExplorer::Internal::MsvcToolChain::amd64:
break;
};
setId(QString::fromLatin1("%1:%2.%3").arg(Constants::MSVC_TOOLCHAIN_ID).arg(m_varsBat) setId(QString::fromLatin1("%1:%2.%3").arg(Constants::MSVC_TOOLCHAIN_ID).arg(m_varsBat)
.arg(m_varsBatArg)); .arg(m_varsBatArg));
setDisplayName(generateDisplayName(name, type, platform)); setDisplayName(name);
} }
QString MsvcToolChain::typeName() const QString MsvcToolChain::typeName() const
@@ -348,7 +375,7 @@ QString MsvcToolChain::typeName() const
Abi MsvcToolChain::targetAbi() const Abi MsvcToolChain::targetAbi() const
{ {
return Abi(m_architecture, Abi::WindowsOS, Abi::WindowsMsvcFlavor, Abi::PEFormat, m_is64bit ? 64 : 32); return m_abi;
} }
bool MsvcToolChain::isValid() const bool MsvcToolChain::isValid() const
@@ -566,6 +593,7 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect()
if (!defaultSdkPath.isEmpty()) { if (!defaultSdkPath.isEmpty()) {
foreach (const QString &sdkKey, sdkRegistry.childGroups()) { foreach (const QString &sdkKey, sdkRegistry.childGroups()) {
const QString name = sdkRegistry.value(sdkKey + QLatin1String("/ProductName")).toString(); const QString name = sdkRegistry.value(sdkKey + QLatin1String("/ProductName")).toString();
const QString version = sdkRegistry.value(sdkKey + QLatin1String("/ProductVersion")).toString();
const QString folder = sdkRegistry.value(sdkKey + QLatin1String("/InstallationFolder")).toString(); const QString folder = sdkRegistry.value(sdkKey + QLatin1String("/InstallationFolder")).toString();
if (folder.isEmpty()) if (folder.isEmpty())
continue; continue;
@@ -574,13 +602,17 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect()
if (!QFileInfo(sdkVcVarsBat).exists()) if (!QFileInfo(sdkVcVarsBat).exists())
continue; continue;
QList<ToolChain *> tmp; QList<ToolChain *> tmp;
tmp.append(new MsvcToolChain(MsvcToolChain::WindowsSDK, name,MsvcToolChain::s32,
tmp.append(new MsvcToolChain(generateDisplayName(name, MsvcToolChain::WindowsSDK, MsvcToolChain::s32),
findAbiOfMsvc(MsvcToolChain::WindowsSDK, MsvcToolChain::s32, version),
sdkVcVarsBat, QLatin1String("/x86"), true)); sdkVcVarsBat, QLatin1String("/x86"), true));
#ifdef Q_OS_WIN64 #ifdef Q_OS_WIN64
// Add all platforms // Add all platforms
tmp.append(new MsvcToolChain(MsvcToolChain::WindowsSDK, name, MsvcToolChain::s64, tmp.append(new MsvcToolChain(generateDisplayName(name, MsvcToolChain::WindowsSDK, MsvcToolChain::s64),
findAbiOfMsvc(MsvcToolChain::WindowsSDK, MsvcToolChain::s64, version),
sdkVcVarsBat, QLatin1String("/x64"), true)); sdkVcVarsBat, QLatin1String("/x64"), true));
tmp.append(new MsvcToolChain(MsvcToolChain::WindowsSDK, name, MsvcToolChain::ia64, tmp.append(new MsvcToolChain(generateDisplayName(name, MsvcToolChain::WindowsSDK, MsvcToolChain::ia64),
findAbiOfMsvc(MsvcToolChain::WindowsSDK, MsvcToolChain::ia64, version),
sdkVcVarsBat, QLatin1String("/ia64"), true)); sdkVcVarsBat, QLatin1String("/ia64"), true));
#endif #endif
// Make sure the default is front. // Make sure the default is front.
@@ -610,19 +642,24 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect()
// Check existence of various install scripts // Check existence of various install scripts
const QString vcvars32bat = path + QLatin1String("bin\\vcvars32.bat"); const QString vcvars32bat = path + QLatin1String("bin\\vcvars32.bat");
if (QFileInfo(vcvars32bat).isFile()) if (QFileInfo(vcvars32bat).isFile())
results.append(new MsvcToolChain(MsvcToolChain::VS, vsName, MsvcToolChain::s32, results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::s32),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::s32, vsName),
vcvars32bat, QString(), true)); vcvars32bat, QString(), true));
if (version >= 10) { if (version >= 10) {
// Just one common file // Just one common file
const QString vcvarsAllbat = path + QLatin1String("vcvarsall.bat"); const QString vcvarsAllbat = path + QLatin1String("vcvarsall.bat");
if (QFileInfo(vcvarsAllbat).isFile()) { if (QFileInfo(vcvarsAllbat).isFile()) {
results.append(new MsvcToolChain(MsvcToolChain::VS, vsName, MsvcToolChain::s32, results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::s32),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::s32, vsName),
vcvarsAllbat, QLatin1String("x86"), true)); vcvarsAllbat, QLatin1String("x86"), true));
results.append(new MsvcToolChain(MsvcToolChain::VS, vsName, MsvcToolChain::amd64, results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::amd64),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::amd64, vsName),
vcvarsAllbat, QLatin1String("amd64"), true)); vcvarsAllbat, QLatin1String("amd64"), true));
results.append(new MsvcToolChain(MsvcToolChain::VS, vsName, MsvcToolChain::s64, results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::s64),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::s64, vsName),
vcvarsAllbat, QLatin1String("x64"), true)); vcvarsAllbat, QLatin1String("x64"), true));
results.append(new MsvcToolChain(MsvcToolChain::VS, vsName, MsvcToolChain::ia64, results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::ia64),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::ia64, vsName),
vcvarsAllbat, QLatin1String("ia64"), true)); vcvarsAllbat, QLatin1String("ia64"), true));
} else { } else {
qWarning("Unable to find MSVC setup script %s in version %d", qPrintable(vcvarsAllbat), version); qWarning("Unable to find MSVC setup script %s in version %d", qPrintable(vcvarsAllbat), version);
@@ -631,19 +668,23 @@ QList<ToolChain *> MsvcToolChainFactory::autoDetect()
// Amd 64 is the preferred 64bit platform // Amd 64 is the preferred 64bit platform
const QString vcvarsAmd64bat = path + QLatin1String("bin\\amd64\\vcvarsamd64.bat"); const QString vcvarsAmd64bat = path + QLatin1String("bin\\amd64\\vcvarsamd64.bat");
if (QFileInfo(vcvarsAmd64bat).isFile()) if (QFileInfo(vcvarsAmd64bat).isFile())
results.append(new MsvcToolChain(MsvcToolChain::VS, vsName, MsvcToolChain::amd64, results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::amd64),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::amd64, vsName),
vcvarsAmd64bat, QString(), true)); vcvarsAmd64bat, QString(), true));
const QString vcvarsAmd64bat2 = path + QLatin1String("bin\\vcvarsx86_amd64.bat"); const QString vcvarsAmd64bat2 = path + QLatin1String("bin\\vcvarsx86_amd64.bat");
if (QFileInfo(vcvarsAmd64bat2).isFile()) if (QFileInfo(vcvarsAmd64bat2).isFile())
results.append(new MsvcToolChain(MsvcToolChain::VS, vsName, MsvcToolChain::amd64, results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::amd64),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::amd64, vsName),
vcvarsAmd64bat2, QString(), true)); vcvarsAmd64bat2, QString(), true));
const QString vcvars64bat = path + QLatin1String("bin\\vcvars64.bat"); const QString vcvars64bat = path + QLatin1String("bin\\vcvars64.bat");
if (QFileInfo(vcvars64bat).isFile()) if (QFileInfo(vcvars64bat).isFile())
results.append(new MsvcToolChain(MsvcToolChain::VS, vsName, MsvcToolChain::s64, results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::s64),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::s64, vsName),
vcvars64bat, QString(), true)); vcvars64bat, QString(), true));
const QString vcvarsIA64bat = path + QLatin1String("bin\\vcvarsx86_ia64.bat"); const QString vcvarsIA64bat = path + QLatin1String("bin\\vcvarsx86_ia64.bat");
if (QFileInfo(vcvarsIA64bat).isFile()) if (QFileInfo(vcvarsIA64bat).isFile())
results.append(new MsvcToolChain(MsvcToolChain::VS, vsName, MsvcToolChain::ia64, results.append(new MsvcToolChain(generateDisplayName(vsName, MsvcToolChain::VS, MsvcToolChain::ia64),
findAbiOfMsvc(MsvcToolChain::VS, MsvcToolChain::ia64, vsName),
vcvarsIA64bat, QString(), true)); vcvarsIA64bat, QString(), true));
} }
} }

View File

@@ -55,8 +55,8 @@ public:
enum Type { WindowsSDK, VS }; enum Type { WindowsSDK, VS };
enum Platform { s32, s64, ia64, amd64 }; enum Platform { s32, s64, ia64, amd64 };
MsvcToolChain(Type type, const QString &name, Platform platform, const QString &varsBat, MsvcToolChain(const QString &name, const Abi &abi,
const QString &varsBatArg, bool autodetect = false); const QString &varsBat, const QString &varsBatArg, bool autodetect = false);
QString typeName() const; QString typeName() const;
Abi targetAbi() const; Abi targetAbi() const;
@@ -89,8 +89,7 @@ private:
mutable Utils::Environment m_lastEnvironment; // Last checked 'incoming' environment. mutable Utils::Environment m_lastEnvironment; // Last checked 'incoming' environment.
mutable Utils::Environment m_resultEnvironment; // Resulting environment for VC mutable Utils::Environment m_resultEnvironment; // Resulting environment for VC
mutable QList<HeaderPath> m_headerPaths; mutable QList<HeaderPath> m_headerPaths;
bool m_is64bit; Abi m_abi;
Abi::Architecture m_architecture;
}; };
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -1749,25 +1749,25 @@ void ProjectExplorerPlugin::deploySession()
void ProjectExplorerPlugin::cleanProjectOnly() void ProjectExplorerPlugin::cleanProjectOnly()
{ {
queue(QList<Project *>() << session()->startupProject(), queue(QList<Project *>() << session()->startupProject(),
QStringList() << Constants::BUILDSTEPS_CLEAN << Constants::BUILDSTEPS_CLEAN); QStringList() << Constants::BUILDSTEPS_CLEAN);
} }
void ProjectExplorerPlugin::cleanProject() void ProjectExplorerPlugin::cleanProject()
{ {
queue(d->m_session->projectOrder(session()->startupProject()), queue(d->m_session->projectOrder(session()->startupProject()),
QStringList() << Constants::BUILDSTEPS_CLEAN << Constants::BUILDSTEPS_CLEAN); QStringList() << Constants::BUILDSTEPS_CLEAN);
} }
void ProjectExplorerPlugin::cleanProjectContextMenu() void ProjectExplorerPlugin::cleanProjectContextMenu()
{ {
queue(d->m_session->projectOrder(d->m_currentProject), queue(d->m_session->projectOrder(d->m_currentProject),
QStringList() << Constants::BUILDSTEPS_CLEAN << Constants::BUILDSTEPS_CLEAN); QStringList() << Constants::BUILDSTEPS_CLEAN);
} }
void ProjectExplorerPlugin::cleanSession() void ProjectExplorerPlugin::cleanSession()
{ {
queue(d->m_session->projectOrder(), queue(d->m_session->projectOrder(),
QStringList() << Constants::BUILDSTEPS_CLEAN << Constants::BUILDSTEPS_CLEAN); QStringList() << Constants::BUILDSTEPS_CLEAN);
} }
void ProjectExplorerPlugin::runProject() void ProjectExplorerPlugin::runProject()
@@ -2268,8 +2268,13 @@ void ProjectExplorerPlugin::addExistingFiles()
void ProjectExplorerPlugin::addExistingFiles(const QStringList &filePaths) void ProjectExplorerPlugin::addExistingFiles(const QStringList &filePaths)
{ {
ProjectNode *projectNode = qobject_cast<ProjectNode*>(d->m_currentNode->projectNode()); ProjectNode *projectNode = qobject_cast<ProjectNode*>(d->m_currentNode->projectNode());
addExistingFiles(projectNode, filePaths);
}
void ProjectExplorerPlugin::addExistingFiles(ProjectNode *projectNode, const QStringList &filePaths)
{
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
const QString dir = directoryFor(d->m_currentNode); const QString dir = directoryFor(projectNode);
QStringList fileNames = filePaths; QStringList fileNames = filePaths;
QHash<FileType, QString> fileTypeToFiles; QHash<FileType, QString> fileTypeToFiles;
foreach (const QString &fileName, fileNames) { foreach (const QString &fileName, fileNames) {

View File

@@ -61,6 +61,7 @@ class IRunControlFactory;
class Project; class Project;
class Node; class Node;
class BuildConfiguration; class BuildConfiguration;
class ProjectNode;
namespace Internal { namespace Internal {
class ProjectFileFactory; class ProjectFileFactory;
@@ -120,6 +121,7 @@ public:
void runProject(Project *pro, const QString &mode); void runProject(Project *pro, const QString &mode);
void runRunConfiguration(ProjectExplorer::RunConfiguration *rc, const QString &mode); void runRunConfiguration(ProjectExplorer::RunConfiguration *rc, const QString &mode);
void addExistingFiles(ProjectExplorer::ProjectNode *projectNode, const QStringList &filePaths);
void addExistingFiles(const QStringList &filePaths); void addExistingFiles(const QStringList &filePaths);
signals: signals:

View File

@@ -77,7 +77,7 @@ public:
virtual bool isValid() const = 0; virtual bool isValid() const = 0;
/// Returns a list of target ids that this ToolChain is restricted to. /// Returns a list of target ids that this tool chain is restricted to.
/// An empty list is shows that the toolchain is compatible with all targets. /// An empty list is shows that the toolchain is compatible with all targets.
virtual QStringList restrictedToTargets() const; virtual QStringList restrictedToTargets() const;
@@ -96,7 +96,7 @@ public:
virtual bool canClone() const; virtual bool canClone() const;
virtual ToolChain *clone() const = 0; virtual ToolChain *clone() const = 0;
// Used by the toolchainmanager to save user-generated ToolChains. // Used by the toolchainmanager to save user-generated tool chains.
// Make sure to call this method when deriving! // Make sure to call this method when deriving!
virtual QVariantMap toMap() const; virtual QVariantMap toMap() const;
@@ -136,7 +136,7 @@ public:
virtual bool canCreate(); virtual bool canCreate();
virtual ToolChain *create(); virtual ToolChain *create();
// Used by the ToolChainManager to restore user-generated ToolChains // Used by the ToolChainManager to restore user-generated tool chains
virtual bool canRestore(const QVariantMap &data); virtual bool canRestore(const QVariantMap &data);
virtual ToolChain *restore(const QVariantMap &data); virtual ToolChain *restore(const QVariantMap &data);

View File

@@ -98,7 +98,7 @@ void ToolChainManager::restoreToolChains()
{ {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
QList<ToolChainFactory *> factories = pm->getObjects<ToolChainFactory>(); QList<ToolChainFactory *> factories = pm->getObjects<ToolChainFactory>();
// Autodetect ToolChains: // Autodetect tool chains:
foreach (ToolChainFactory *f, factories) { foreach (ToolChainFactory *f, factories) {
QList<ToolChain *> tcs = f->autoDetect(); QList<ToolChain *> tcs = f->autoDetect();
foreach (ToolChain *tc, tcs) foreach (ToolChain *tc, tcs)

View File

@@ -76,14 +76,14 @@ public slots:
signals: signals:
void toolChainAdded(ProjectExplorer::ToolChain *); void toolChainAdded(ProjectExplorer::ToolChain *);
// ToolChain is still valid when this call happens! // Tool chain is still valid when this call happens!
void toolChainRemoved(ProjectExplorer::ToolChain *); void toolChainRemoved(ProjectExplorer::ToolChain *);
private: private:
explicit ToolChainManager(QObject *parent = 0); explicit ToolChainManager(QObject *parent = 0);
// Make sure the this is only called after all // Make sure the this is only called after all
// ToolChain Factories are registered! // Tool chain Factories are registered!
void restoreToolChains(); void restoreToolChains();
void restoreToolChains(const QString &fileName, bool autoDetected = false); void restoreToolChains(const QString &fileName, bool autoDetected = false);

View File

@@ -280,7 +280,7 @@ void ToolChainModel::setDirty(ToolChain *tc)
void ToolChainModel::apply() void ToolChainModel::apply()
{ {
// Remove unused ToolChains: // Remove unused tool chains:
QList<ToolChainNode *> nodes = m_toRemoveList; QList<ToolChainNode *> nodes = m_toRemoveList;
foreach (ToolChainNode *n, nodes) { foreach (ToolChainNode *n, nodes) {
Q_ASSERT(!n->parent); Q_ASSERT(!n->parent);
@@ -442,7 +442,7 @@ QString ToolChainOptionsPage::id() const
QString ToolChainOptionsPage::displayName() const QString ToolChainOptionsPage::displayName() const
{ {
return tr("Toolchains"); return tr("Tool Chains");
} }
QString ToolChainOptionsPage::category() const QString ToolChainOptionsPage::category() const
@@ -452,7 +452,7 @@ QString ToolChainOptionsPage::category() const
QString ToolChainOptionsPage::displayCategory() const QString ToolChainOptionsPage::displayCategory() const
{ {
return tr("Toolchains"); return tr("Tool Chains");
} }
QIcon ToolChainOptionsPage::categoryIcon() const QIcon ToolChainOptionsPage::categoryIcon() const
@@ -517,7 +517,7 @@ QWidget *ToolChainOptionsPage::createPage(QWidget *parent)
if (m_searchKeywords.isEmpty()) { if (m_searchKeywords.isEmpty()) {
QLatin1Char sep(' '); QLatin1Char sep(' ');
QTextStream stream(&m_searchKeywords); QTextStream stream(&m_searchKeywords);
stream << tr("Toolchains"); stream << tr("Tool Chains");
foreach (ToolChainFactory *f, m_factories) foreach (ToolChainFactory *f, m_factories)
stream << sep << f->displayName(); stream << sep << f->displayName();

View File

@@ -40,6 +40,7 @@
#include <QtDebug> #include <QtDebug>
#include <QGraphicsSceneDragDropEvent> #include <QGraphicsSceneDragDropEvent>
#include <nodemetainfo.h> #include <nodemetainfo.h>
#include <nodeproperty.h>
namespace QmlDesigner { namespace QmlDesigner {
@@ -194,6 +195,14 @@ void AbstractFormEditorTool::dragMoveEvent(QGraphicsSceneDragDropEvent * /* even
Q_ASSERT(false); Q_ASSERT(false);
} }
static inline bool checkIfNodeIsAView(const ModelNode &node)
{
return node.metaInfo().isValid() &&
(node.metaInfo().isSubclassOf("QtQuick.ListView", -1, -1) ||
node.metaInfo().isSubclassOf("QtQuick.GridView", -1, -1) ||
node.metaInfo().isSubclassOf("QtQuick.PathView", -1, -1));
}
void AbstractFormEditorTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event) void AbstractFormEditorTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &itemList, QGraphicsSceneMouseEvent *event)
{ {
FormEditorItem *formEditorItem = topFormEditorItem(itemList); FormEditorItem *formEditorItem = topFormEditorItem(itemList);
@@ -202,6 +211,11 @@ void AbstractFormEditorTool::mouseDoubleClickEvent(const QList<QGraphicsItem*> &
if (doubleClickNode.metaInfo().isComponent()) { if (doubleClickNode.metaInfo().isComponent()) {
Core::EditorManager::instance()->openEditor(doubleClickNode.metaInfo().componentFileName()); Core::EditorManager::instance()->openEditor(doubleClickNode.metaInfo().componentFileName());
event->accept(); event->accept();
} else if (checkIfNodeIsAView(doubleClickNode) &&
doubleClickNode.hasNodeProperty("delegate") &&
doubleClickNode.nodeProperty("delegate").modelNode().metaInfo().isComponent()) {
Core::EditorManager::instance()->openEditor(doubleClickNode.nodeProperty("delegate").modelNode().metaInfo().componentFileName());
event->accept();
} }
} }
} }

View File

@@ -15,4 +15,7 @@
<qresource prefix="/icon/selection"> <qresource prefix="/icon/selection">
<file>selectonlycontentitems.png</file> <file>selectonlycontentitems.png</file>
</qresource> </qresource>
<qresource prefix="/icon">
<file>reset.png</file>
</qresource>
</RCC> </RCC>

View File

@@ -166,6 +166,15 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
addAction(m_zoomAction.data()); addAction(m_zoomAction.data());
upperActions.append(m_zoomAction.data()); upperActions.append(m_zoomAction.data());
m_toolBox->addRightSideAction(m_zoomAction.data()); m_toolBox->addRightSideAction(m_zoomAction.data());
m_resetAction = new QAction(tr("Reset view (R)"), this);
m_resetAction->setShortcut(Qt::Key_R);
m_resetAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
m_resetAction->setIcon(QPixmap(":/icon/reset.png"));
connect(m_resetAction.data(), SIGNAL(triggered(bool)), this, SLOT(resetNodeInstanceView()));
addAction(m_resetAction.data());
upperActions.append(m_resetAction.data());
m_toolBox->addRightSideAction(m_resetAction.data());
} }
void FormEditorWidget::enterEvent(QEvent *event) void FormEditorWidget::enterEvent(QEvent *event)
@@ -203,6 +212,12 @@ void FormEditorWidget::changeRootItemHeight(const QString &heighText)
} }
} }
void FormEditorWidget::resetNodeInstanceView()
{
m_formEditorView->setCurrentState(m_formEditorView->baseState());
m_formEditorView->emitCustomNotification(QLatin1String("reset QmlPuppet"));
}
void FormEditorWidget::changeAnchorTool(bool checked) void FormEditorWidget::changeAnchorTool(bool checked)
{ {
if (checked && m_formEditorView->currentState().isBaseState()) if (checked && m_formEditorView->currentState().isBaseState())

View File

@@ -95,6 +95,7 @@ private slots:
void setZoomLevel(double zoomLevel); void setZoomLevel(double zoomLevel);
void changeRootItemWidth(const QString &widthText); void changeRootItemWidth(const QString &widthText);
void changeRootItemHeight(const QString &heightText); void changeRootItemHeight(const QString &heightText);
void resetNodeInstanceView();
private: private:
QWeakPointer<FormEditorView> m_formEditorView; QWeakPointer<FormEditorView> m_formEditorView;
@@ -111,6 +112,7 @@ private:
QWeakPointer<QAction> m_selectOnlyContentItemsAction; QWeakPointer<QAction> m_selectOnlyContentItemsAction;
QWeakPointer<LineEditAction> m_rootWidthAction; QWeakPointer<LineEditAction> m_rootWidthAction;
QWeakPointer<LineEditAction> m_rootHeightAction; QWeakPointer<LineEditAction> m_rootHeightAction;
QWeakPointer<QAction> m_resetAction;
}; };

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

View File

@@ -290,6 +290,9 @@ void ItemLibraryWidget::updateImports()
QList<QToolButton *> ItemLibraryWidget::createToolBarWidgets() QList<QToolButton *> ItemLibraryWidget::createToolBarWidgets()
{ {
QList<QToolButton *> buttons; QList<QToolButton *> buttons;
return buttons; //import managment gets disabled for now (TODO ###)
buttons << new QToolButton(); buttons << new QToolButton();
buttons.first()->setText("I "); buttons.first()->setText("I ");
buttons.first()->setIcon(QIcon(QLatin1String(Core::Constants::ICON_FILTER))); buttons.first()->setIcon(QIcon(QLatin1String(Core::Constants::ICON_FILTER)));

View File

@@ -373,6 +373,7 @@ void PropertyEditor::changeValue(const QString &propertyName)
try { try {
m_selectedNode.setId(newId); m_selectedNode.setId(newId);
} catch (InvalidIdException &e) { //better save then sorry } catch (InvalidIdException &e) { //better save then sorry
value->setValue(m_selectedNode.id());
QMessageBox::warning(0, tr("Invalid Id"), e.description()); QMessageBox::warning(0, tr("Invalid Id"), e.description());
} }
} else { //there is already an id, so we refactor } else { //there is already an id, so we refactor
@@ -531,6 +532,8 @@ void PropertyEditor::otherPropertyChanged(const QmlObjectNode &fxObjectNode, con
if (!m_selectedNode.isValid()) if (!m_selectedNode.isValid())
return; return;
m_locked = true;
if (fxObjectNode.isValid() && m_currentType && fxObjectNode == m_selectedNode && fxObjectNode.currentState().isValid()) { if (fxObjectNode.isValid() && m_currentType && fxObjectNode == m_selectedNode && fxObjectNode.currentState().isValid()) {
AbstractProperty property = fxObjectNode.modelNode().property(propertyName); AbstractProperty property = fxObjectNode.modelNode().property(propertyName);
if (fxObjectNode == m_selectedNode || QmlObjectNode(m_selectedNode).propertyChangeForCurrentState() == fxObjectNode) { if (fxObjectNode == m_selectedNode || QmlObjectNode(m_selectedNode).propertyChangeForCurrentState() == fxObjectNode) {
@@ -540,6 +543,8 @@ void PropertyEditor::otherPropertyChanged(const QmlObjectNode &fxObjectNode, con
setValue(m_selectedNode, property.name(), QmlObjectNode(m_selectedNode).modelValue(property.name())); setValue(m_selectedNode, property.name(), QmlObjectNode(m_selectedNode).modelValue(property.name()));
} }
} }
m_locked = false;
} }
void PropertyEditor::transformChanged(const QmlObjectNode &fxObjectNode, const QString &propertyName) void PropertyEditor::transformChanged(const QmlObjectNode &fxObjectNode, const QString &propertyName)
@@ -836,8 +841,10 @@ void PropertyEditor::instanceInformationsChange(const QVector<ModelNode> &nodeLi
if (!m_selectedNode.isValid()) if (!m_selectedNode.isValid())
return; return;
m_locked = true;
if (nodeList.contains(m_selectedNode)) if (nodeList.contains(m_selectedNode))
m_currentType->m_backendAnchorBinding.setup(QmlItemNode(m_selectedNode)); m_currentType->m_backendAnchorBinding.setup(QmlItemNode(m_selectedNode));
m_locked = false;
} }
void PropertyEditor::nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId) void PropertyEditor::nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId)

View File

@@ -91,6 +91,7 @@ StatesEditorWidget::StatesEditorWidget(StatesEditorView *statesEditorView, State
m_declarativeView->setAcceptDrops(false); m_declarativeView->setAcceptDrops(false);
QVBoxLayout *layout = new QVBoxLayout(this); QVBoxLayout *layout = new QVBoxLayout(this);
setMinimumHeight(160);
layout->setMargin(0); layout->setMargin(0);
layout->setSpacing(0); layout->setSpacing(0);
layout->addWidget(m_declarativeView.data()); layout->addWidget(m_declarativeView.data());

View File

@@ -109,6 +109,7 @@ public:
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList); void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList);
void instancesChildrenChanged(const QVector<ModelNode> &nodeList); void instancesChildrenChanged(const QVector<ModelNode> &nodeList);
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data); void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
void rewriterBeginTransaction(); void rewriterBeginTransaction();
void rewriterEndTransaction(); void rewriterEndTransaction();

View File

@@ -61,6 +61,7 @@ NodeInstanceMetaObject::NodeInstanceMetaObject(const ObjectNodeInstancePointer &
void NodeInstanceMetaObject::createNewProperty(const QString &name) void NodeInstanceMetaObject::createNewProperty(const QString &name)
{ {
int id = createProperty(name.toLatin1(), 0); int id = createProperty(name.toLatin1(), 0);
setValue(id, QVariant());
Q_ASSERT(id >= 0); Q_ASSERT(id >= 0);
Q_UNUSED(id) Q_UNUSED(id)
} }

View File

@@ -496,6 +496,12 @@ void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node, const QString
} }
} }
void NodeInstanceView::customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &, const QList<QVariant> &)
{
if (view && identifier == QLatin1String("reset QmlPuppet"))
restartProcess();
}
void NodeInstanceView::rewriterBeginTransaction() void NodeInstanceView::rewriterBeginTransaction()
{ {

View File

@@ -339,9 +339,14 @@ public:
static Pointer create(Model *model, const QString &type, int maj = -1, int min = -1); static Pointer create(Model *model, const QString &type, int maj = -1, int min = -1);
QSet<QString> prototypeCache() QSet<QString> &prototypeCachePositives()
{ {
return m_prototypeCache; return m_prototypeCachePositives;
}
QSet<QString> &prototypeCacheNegatives()
{
return m_prototypeCacheNegatives;
} }
static void clearCache() static void clearCache()
@@ -370,7 +375,8 @@ private:
QStringList m_localProperties; QStringList m_localProperties;
QString m_defaultPropertyName; QString m_defaultPropertyName;
QList<TypeDescription> m_prototypes; QList<TypeDescription> m_prototypes;
QSet<QString> m_prototypeCache; QSet<QString> m_prototypeCachePositives;
QSet<QString> m_prototypeCacheNegatives;
//storing the pointer would not be save //storing the pointer would not be save
QmlJS::LookupContext *lookupContext() const; QmlJS::LookupContext *lookupContext() const;
@@ -1014,16 +1020,20 @@ bool NodeMetaInfo::isSubclassOf(const QString &type, int majorVersion, int minor
&& availableInVersion(majorVersion, minorVersion)) && availableInVersion(majorVersion, minorVersion))
return true; return true;
if (m_privateData->prototypeCache().contains(Internal::stringIdentifier(type, majorVersion, minorVersion))) if (m_privateData->prototypeCachePositives().contains(Internal::stringIdentifier(type, majorVersion, minorVersion)))
return true; //take a shortcut - optimization return true; //take a shortcut - optimization
if (m_privateData->prototypeCacheNegatives().contains(Internal::stringIdentifier(type, majorVersion, minorVersion)))
return false; //take a shortcut - optimization
foreach (const NodeMetaInfo &superClass, superClasses()) { foreach (const NodeMetaInfo &superClass, superClasses()) {
if (superClass.m_privateData->cleverCheckType(type) if (superClass.m_privateData->cleverCheckType(type)
&& superClass.availableInVersion(majorVersion, minorVersion)) { && superClass.availableInVersion(majorVersion, minorVersion)) {
m_privateData->prototypeCache().insert(Internal::stringIdentifier(type, majorVersion, minorVersion)); m_privateData->prototypeCachePositives().insert(Internal::stringIdentifier(type, majorVersion, minorVersion));
return true; return true;
} }
} }
m_privateData->prototypeCacheNegatives().insert(Internal::stringIdentifier(type, majorVersion, minorVersion));
return false; return false;
} }

View File

@@ -48,7 +48,7 @@ QmlModelNodeFacade::~QmlModelNodeFacade()
bool QmlModelNodeFacade::isValid() const bool QmlModelNodeFacade::isValid() const
{ {
return modelNode().isValid() && qmlModelView() && qmlModelView()->hasInstanceForModelNode(modelNode()) && qmlModelView()->instanceForModelNode(modelNode()).isValid(); return modelNode().isValid() && qmlModelView() && qmlModelView()->nodeInstanceView() && qmlModelView()->hasInstanceForModelNode(modelNode()) && qmlModelView()->instanceForModelNode(modelNode()).isValid();
} }
QmlModelView* QmlModelNodeFacade::qmlModelView() const QmlModelView* QmlModelNodeFacade::qmlModelView() const

Some files were not shown because too many files have changed in this diff Show More