mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
It' here just as a backup, long way to go and things will change massively.
So far just the framework, core plugin and welcome plugin. Checking this in just as a backup, nothing more. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@152 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
9f58fd332d
commit
069ee196a3
15
Ground/Build/Build.bat
Normal file
15
Ground/Build/Build.bat
Normal file
@ -0,0 +1,15 @@
|
||||
@echo off
|
||||
rem
|
||||
rem This file is generated
|
||||
rem
|
||||
echo Setting up a MinGW/Qt only environment...
|
||||
|
||||
set QTDIR=C:\Qt\2010.01\qt
|
||||
set PATH=C:\Qt\2010.01\qt\bin
|
||||
set PATH=%PATH%;C:\Qt\2010.01\bin;C:\Qt\2010.01\mingw\bin
|
||||
set PATH=%PATH%;%SystemRoot%\System32
|
||||
set QMAKESPEC=win32-g++
|
||||
|
||||
qmake C:\Users\David\Documents\Code\OpenPilot\ground\openpilotgcs.pro
|
||||
|
||||
mingw32-make.exe
|
8
Ground/Build/run.bat
Normal file
8
Ground/Build/run.bat
Normal file
@ -0,0 +1,8 @@
|
||||
set QTDIR=C:\Qt\2010.01\qt
|
||||
set PATH=C:\Qt\2010.01\qt\bin
|
||||
set PATH=%PATH%;C:\Qt\2010.01\bin;C:\Qt\2010.01\mingw\bin
|
||||
set PATH=%PATH%;%SystemRoot%\System32
|
||||
set QMAKESPEC=win32-g++
|
||||
|
||||
|
||||
bin\openpilotgcs.exe
|
14
Ground/bin/bin.pro
Normal file
14
Ground/bin/bin.pro
Normal file
@ -0,0 +1,14 @@
|
||||
include(../openpilotgcs.pri)
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = $$IDE_APP_WRAPPER
|
||||
OBJECTS_DIR =
|
||||
|
||||
PRE_TARGETDEPS = $$PWD/openpilotgcs
|
||||
|
||||
QMAKE_LINK = cp $$PWD/openpilotgcs $@ && : IGNORE REST
|
||||
|
||||
QMAKE_CLEAN = $$IDE_APP_WRAPPER
|
||||
|
||||
target.path = /bin
|
||||
INSTALLS += target
|
36
Ground/bin/openpilotgcs
Normal file
36
Ground/bin/openpilotgcs
Normal file
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
makeAbsolute() {
|
||||
case "$1" in
|
||||
/*)
|
||||
# already absolute, return it
|
||||
echo "$1"
|
||||
;;
|
||||
*)
|
||||
# relative, prepend $2 made absolute
|
||||
echo `makeAbsolute "$2" "$PWD"`/"$1" | sed 's,/\.$,,'
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if test -L "$0"; then
|
||||
# Try readlink(1)
|
||||
readlink=`type readlink 2>/dev/null` || readlink=
|
||||
if test -n "$readlink"; then
|
||||
# We have readlink(1), so we can use it
|
||||
me=`readlink -nf "$0"`
|
||||
else
|
||||
# No readlink(1), so let's try ls -l
|
||||
me=`ls -l "$0" | sed 's/^.*-> //'`
|
||||
base=`dirname "$0"`
|
||||
me=`makeAbsolute "$me" "$base"`
|
||||
fi
|
||||
else
|
||||
me="$0"
|
||||
fi
|
||||
|
||||
bindir=`dirname "$me"`
|
||||
libdir=`cd "${bindir}/../lib" ; pwd`
|
||||
LD_LIBRARY_PATH="${libdir}/openpilotgcs:${LD_LIBRARY_PATH}"
|
||||
export LD_LIBRARY_PATH
|
||||
exec "${bindir}/openpilotgcs.bin" ${1+"$@"}
|
6
Ground/doc/Build.txt
Normal file
6
Ground/doc/Build.txt
Normal file
@ -0,0 +1,6 @@
|
||||
The simply way to build this is to use QT Creator, this can be downloaded from http://qt.nokia.com/
|
||||
|
||||
Serial port classes:
|
||||
|
||||
http://code.google.com/p/qextserialport/
|
||||
|
1
Ground/doc/TODO.txt
Normal file
1
Ground/doc/TODO.txt
Normal file
@ -0,0 +1 @@
|
||||
Write Ground Station
|
113
Ground/openpilotgcs.pri
Normal file
113
Ground/openpilotgcs.pri
Normal file
@ -0,0 +1,113 @@
|
||||
defineReplace(cleanPath) {
|
||||
win32:1 ~= s|\\\\|/|g
|
||||
contains(1, ^/.*):pfx = /
|
||||
else:pfx =
|
||||
segs = $$split(1, /)
|
||||
out =
|
||||
for(seg, segs) {
|
||||
equals(seg, ..):out = $$member(out, 0, -2)
|
||||
else:!equals(seg, .):out += $$seg
|
||||
}
|
||||
return($$join(out, /, $$pfx))
|
||||
}
|
||||
|
||||
defineReplace(targetPath) {
|
||||
return($$replace(1, /, $$QMAKE_DIR_SEP))
|
||||
}
|
||||
|
||||
# For use in custom compilers which just copy files
|
||||
win32:i_flag = i
|
||||
defineReplace(stripSrcDir) {
|
||||
win32 {
|
||||
!contains(1, ^.:.*):1 = $$OUT_PWD/$$1
|
||||
} else {
|
||||
!contains(1, ^/.*):1 = $$OUT_PWD/$$1
|
||||
}
|
||||
out = $$cleanPath($$1)
|
||||
out ~= s|^$$re_escape($$PWD/)||$$i_flag
|
||||
return($$out)
|
||||
}
|
||||
|
||||
isEmpty(TEST):CONFIG(debug, debug|release) {
|
||||
!debug_and_release|build_pass {
|
||||
TEST = 1
|
||||
}
|
||||
}
|
||||
|
||||
isEmpty(IDE_LIBRARY_BASENAME) {
|
||||
IDE_LIBRARY_BASENAME = lib
|
||||
}
|
||||
|
||||
DEFINES += IDE_LIBRARY_BASENAME=\\\"$$IDE_LIBRARY_BASENAME\\\"
|
||||
|
||||
equals(TEST, 1) {
|
||||
QT +=testlib
|
||||
DEFINES += WITH_TESTS
|
||||
}
|
||||
|
||||
IDE_SOURCE_TREE = $$PWD
|
||||
isEmpty(IDE_BUILD_TREE) {
|
||||
sub_dir = $$_PRO_FILE_PWD_
|
||||
sub_dir ~= s,^$$re_escape($$PWD),,
|
||||
IDE_BUILD_TREE = $$cleanPath($$OUT_PWD)
|
||||
IDE_BUILD_TREE ~= s,$$re_escape($$sub_dir)$,,
|
||||
}
|
||||
IDE_APP_PATH = $$IDE_BUILD_TREE/bin
|
||||
macx {
|
||||
IDE_APP_TARGET = "OpenPilot GCS"
|
||||
IDE_LIBRARY_PATH = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/PlugIns
|
||||
IDE_PLUGIN_PATH = $$IDE_LIBRARY_PATH
|
||||
IDE_LIBEXEC_PATH = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/Resources
|
||||
IDE_DATA_PATH = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/Resources
|
||||
IDE_DOC_PATH = $$IDE_DATA_PATH/doc
|
||||
contains(QT_CONFIG, ppc):CONFIG += ppc x86
|
||||
copydata = 1
|
||||
} else {
|
||||
win32 {
|
||||
contains(TEMPLATE, vc.*)|contains(TEMPLATE_PREFIX, vc):vcproj = 1
|
||||
IDE_APP_TARGET = openpilotgcs
|
||||
} else {
|
||||
IDE_APP_WRAPPER = openpilotgcs
|
||||
IDE_APP_TARGET = openpilotgcs.bin
|
||||
}
|
||||
IDE_LIBRARY_PATH = $$IDE_BUILD_TREE/$$IDE_LIBRARY_BASENAME/openpilotgcs
|
||||
IDE_PLUGIN_PATH = $$IDE_LIBRARY_PATH/plugins
|
||||
IDE_LIBEXEC_PATH = $$IDE_APP_PATH # FIXME
|
||||
IDE_DATA_PATH = $$IDE_BUILD_TREE/share/openpilotgcs
|
||||
IDE_DOC_PATH = $$IDE_BUILD_TREE/share/doc/openpilotgcs
|
||||
!isEqual(IDE_SOURCE_TREE, $$IDE_BUILD_TREE):copydata = 1
|
||||
}
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$IDE_SOURCE_TREE/src/libs
|
||||
|
||||
DEPENDPATH += \
|
||||
$$IDE_SOURCE_TREE/src/libs
|
||||
|
||||
LIBS += -L$$IDE_LIBRARY_PATH
|
||||
|
||||
# DEFINES += QT_NO_CAST_FROM_ASCII
|
||||
DEFINES += QT_NO_CAST_TO_ASCII
|
||||
#DEFINES += QT_USE_FAST_OPERATOR_PLUS
|
||||
#DEFINES += QT_USE_FAST_CONCATENATION
|
||||
|
||||
unix {
|
||||
CONFIG(debug, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared
|
||||
CONFIG(release, debug|release):OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared
|
||||
|
||||
CONFIG(debug, debug|release):MOC_DIR = $${OUT_PWD}/.moc/debug-shared
|
||||
CONFIG(release, debug|release):MOC_DIR = $${OUT_PWD}/.moc/release-shared
|
||||
|
||||
RCC_DIR = $${OUT_PWD}/.rcc
|
||||
UI_DIR = $${OUT_PWD}/.uic
|
||||
}
|
||||
|
||||
linux-g++-* {
|
||||
# Bail out on non-selfcontained libraries. Just a security measure
|
||||
# to prevent checking in code that does not compile on other platforms.
|
||||
QMAKE_LFLAGS += -Wl,--allow-shlib-undefined -Wl,--no-undefined
|
||||
}
|
||||
|
||||
# Handle S60 support: Conditionally built
|
||||
win32:SUPPORT_QT_S60= $$(QTCREATOR_WITH_S60)
|
||||
else:SUPPORT_QT_S60 = $$(QTCREATOR_WITH_S60)
|
13
Ground/openpilotgcs.pro
Normal file
13
Ground/openpilotgcs.pro
Normal file
@ -0,0 +1,13 @@
|
||||
#version check qt
|
||||
contains(QT_VERSION, ^4\.[0-5]\..*) {
|
||||
message("Cannot build OpenPilot GCS with Qt version $${QT_VERSION}.")
|
||||
error("Use at least Qt 4.6.")
|
||||
}
|
||||
|
||||
include(openpilotgcs.pri)
|
||||
|
||||
TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
|
||||
SUBDIRS = src share
|
||||
unix:!macx:!isEmpty(copydata):SUBDIRS += bin
|
13
Ground/share/openpilotgcs/designer/templates.xml
Normal file
13
Ground/share/openpilotgcs/designer/templates.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<designertemplates version="1.0.0">
|
||||
<template name="Widget Form" description="Create new widget form" uifile="templates/Widget.ui">
|
||||
</template>
|
||||
<template name="Mainwindow Form" description="Create new mainwindow form" uifile="templates/Main_Window.ui">
|
||||
</template>
|
||||
<template name="Dialog without buttons" description="Create a dialog without buttons." uifile="templates/Dialog_without_Buttons.ui">
|
||||
</template>
|
||||
<template name="Dialog with buttons bottom" description="Create a dialog with the buttons at the bottom." uifile="templates/Dialog_with_Buttons_Bottom.ui">
|
||||
</template>
|
||||
<template name="Dialog with buttons right" description="Create a dialog with the buttons at the right." uifile="templates/Dialog_with_Buttons_Right.ui">
|
||||
</template>
|
||||
</designertemplates>
|
@ -0,0 +1,71 @@
|
||||
<ui version="4.0" >
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -0,0 +1,71 @@
|
||||
<ui version="4.0" >
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>20</y>
|
||||
<width>81</width>
|
||||
<height>241</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -0,0 +1,18 @@
|
||||
<ui version="4.0" >
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
27
Ground/share/openpilotgcs/designer/templates/Main_Window.ui
Normal file
27
Ground/share/openpilotgcs/designer/templates/Main_Window.ui
Normal file
@ -0,0 +1,27 @@
|
||||
<ui version="4.0" >
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow" >
|
||||
<property name="objectName" >
|
||||
<string notr="true" >MainWindow</string>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QMenuBar" name="menubar" />
|
||||
<widget class="QWidget" name="centralwidget" />
|
||||
<widget class="QStatusBar" name="statusbar" />
|
||||
</widget>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<connections/>
|
||||
</ui>
|
24
Ground/share/openpilotgcs/designer/templates/Widget.ui
Normal file
24
Ground/share/openpilotgcs/designer/templates/Widget.ui
Normal file
@ -0,0 +1,24 @@
|
||||
<ui version="4.0" >
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form" >
|
||||
<property name="objectName" >
|
||||
<string notr="true" >Form</string>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
</widget>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<connections/>
|
||||
</ui>
|
3
Ground/share/openpilotgcs/gdbmacros/LGPL_EXCEPTION.TXT
Normal file
3
Ground/share/openpilotgcs/gdbmacros/LGPL_EXCEPTION.TXT
Normal file
@ -0,0 +1,3 @@
|
||||
Nokia Qt LGPL Exception version 1.0
|
||||
|
||||
As a special exception to the GNU Lesser General Public License version 2.1, the object code form of a "work that uses the Library" may incorporate material from a header file that is part of the Library. You may distribute such object code under terms of your choice, provided that the incorporated material (i) does not exceed more than 5% of the total size of the Library; and (ii) is limited to numerical parameters, data structure layouts, accessors, macros, inline functions and templates.
|
504
Ground/share/openpilotgcs/gdbmacros/LICENSE.LGPL
Normal file
504
Ground/share/openpilotgcs/gdbmacros/LICENSE.LGPL
Normal file
@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
3913
Ground/share/openpilotgcs/gdbmacros/gdbmacros.cpp
Normal file
3913
Ground/share/openpilotgcs/gdbmacros/gdbmacros.cpp
Normal file
@ -0,0 +1,3913 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include <qglobal.h>
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QLinkedList>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QQueue>
|
||||
#include <QtCore/QLocale>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QMetaEnum>
|
||||
#include <QtCore/QMetaObject>
|
||||
#include <QtCore/QMetaProperty>
|
||||
#include <QtCore/QPoint>
|
||||
#include <QtCore/QPointF>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtCore/QRect>
|
||||
#include <QtCore/QRectF>
|
||||
#include <QtCore/QStack>
|
||||
#include <QtCore/QSize>
|
||||
#include <QtCore/QSizeF>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QTextCodec>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
|
||||
#include <QtCore/QModelIndex>
|
||||
|
||||
#if QT_VERSION >= 0x040500
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QSharedDataPointer>
|
||||
#include <QtCore/QSharedData>
|
||||
#include <QtCore/QWeakPointer>
|
||||
#endif
|
||||
|
||||
#ifndef USE_QT_GUI
|
||||
# ifdef QT_GUI_LIB
|
||||
# define USE_QT_GUI 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if USE_QT_GUI
|
||||
# include <QtGui/QApplication>
|
||||
# include <QtGui/QImage>
|
||||
# include <QtGui/QRegion>
|
||||
# include <QtGui/QPixmap>
|
||||
# include <QtGui/QWidget>
|
||||
# include <QtGui/QFont>
|
||||
# include <QtGui/QColor>
|
||||
# include <QtGui/QKeySequence>
|
||||
# include <QtGui/QSizePolicy>
|
||||
#endif
|
||||
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#ifdef QT_BOOTSTRAPPED
|
||||
|
||||
# define NS ""
|
||||
# define NSX "'"
|
||||
# define NSY "'"
|
||||
|
||||
#else
|
||||
|
||||
# include "gdbmacros_p.h"
|
||||
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
|
||||
|
||||
int qtGhVersion = QT_VERSION;
|
||||
|
||||
/*!
|
||||
\class QDumper
|
||||
\brief Helper class for producing "nice" output in Qt Creator's debugger.
|
||||
|
||||
\internal
|
||||
|
||||
The whole "custom dumper" implementation is currently far less modular
|
||||
than it could be. But as the code is still in a flux, making it nicer
|
||||
from a pure archtectural point of view seems still be a waste of resources.
|
||||
|
||||
Some hints:
|
||||
|
||||
New dumpers for non-templated classes should be mentioned in
|
||||
\c{qDumpObjectData440()} in the \c{protocolVersion == 1} branch.
|
||||
|
||||
Templated classes need extra support on the IDE level
|
||||
(see plugins/debugger/gdbengine.cpp) and should not be mentiond in
|
||||
\c{qDumpObjectData440()}.
|
||||
|
||||
In any case, dumper processesing should end up in
|
||||
\c{handleProtocolVersion2and3()} and needs an entry in the big switch there.
|
||||
|
||||
Next step is to create a suitable \c{static void qDumpFoo(QDumper &d)}
|
||||
function. At the bare minimum it should contain something like this:
|
||||
|
||||
|
||||
\c{
|
||||
const Foo &foo = *reinterpret_cast<const Foo *>(d.data);
|
||||
|
||||
d.putItem("value", ...);
|
||||
d.putItem("type", "Foo");
|
||||
d.putItem("numchild", "0");
|
||||
}
|
||||
|
||||
|
||||
'd.putItem(name, value)' roughly expands to:
|
||||
d.put((name)).put("=\"").put(value).put("\"";
|
||||
|
||||
Useful (i.e. understood by the IDE) names include:
|
||||
|
||||
\list
|
||||
\o "name" shows up in the first column in the Locals&Watchers view.
|
||||
\o "value" shows up in the second column.
|
||||
\o "valueencoded" should be set to "1" if the value is base64 encoded.
|
||||
Always base64-encode values that might use unprintable or otherwise
|
||||
"confuse" the protocol (like spaces and quotes). [A-Za-z0-9] is "safe".
|
||||
A value of "3" is used for base64-encoded UCS4, "2" denotes
|
||||
base64-encoded UTF16.
|
||||
\o "numchild" return the number of children in the view. Effectively, only
|
||||
0 and != 0 will be used, so don't try too hard to get the number right.
|
||||
\endlist
|
||||
|
||||
If the current item has children, it might be queried to produce information
|
||||
about these children. In this case the dumper should use something like this:
|
||||
|
||||
\c{
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
[...]
|
||||
d.endChildren();
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
#if defined(QT_BEGIN_NAMESPACE)
|
||||
QT_BEGIN_NAMESPACE
|
||||
#endif
|
||||
|
||||
const char *stdStringTypeC = "std::basic_string<char,std::char_traits<char>,std::allocator<char> >";
|
||||
const char *stdWideStringTypeUShortC = "std::basic_string<unsigned short,std::char_traits<unsigned short>,std::allocator<unsigned short> >";
|
||||
|
||||
#if defined(QT_BEGIN_NAMESPACE)
|
||||
QT_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
|
||||
// This can be mangled typenames of nested templates, each char-by-char
|
||||
// comma-separated integer list...
|
||||
// The output buffer.
|
||||
#ifdef MACROSDEBUG
|
||||
Q_DECL_EXPORT char xDumpInBuffer[10000];
|
||||
Q_DECL_EXPORT char xDumpOutBuffer[1000000];
|
||||
#define inBuffer xDumpInBuffer
|
||||
#define outBuffer xDumpOutBuffer
|
||||
#else
|
||||
Q_DECL_EXPORT char qDumpInBuffer[10000];
|
||||
Q_DECL_EXPORT char qDumpOutBuffer[1000000];
|
||||
#define inBuffer qDumpInBuffer
|
||||
#define outBuffer qDumpOutBuffer
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
static QByteArray strPtrConst = "* const";
|
||||
|
||||
static bool isPointerType(const QByteArray &type)
|
||||
{
|
||||
return type.endsWith('*') || type.endsWith(strPtrConst);
|
||||
}
|
||||
|
||||
static QByteArray stripPointerType(const QByteArray &_type)
|
||||
{
|
||||
QByteArray type = _type;
|
||||
if (type.endsWith('*'))
|
||||
type.chop(1);
|
||||
if (type.endsWith(strPtrConst))
|
||||
type.chop(7);
|
||||
if (type.endsWith(' '))
|
||||
type.chop(1);
|
||||
return type;
|
||||
}
|
||||
|
||||
// This is used to abort evaluation of custom data dumpers in a "coordinated"
|
||||
// way. Abortion will happen at the latest when we try to access a non-initialized
|
||||
// non-trivial object, so there is no way to prevent this from occuring at all
|
||||
// conceptionally. Ideally, if there is API to check memory access, it should
|
||||
// be used to terminate nicely, especially with CDB.
|
||||
// 1) Gdb will catch SIGSEGV and return to the calling frame.
|
||||
// This is just fine provided we only _read_ memory in the custom handlers
|
||||
// below.
|
||||
// 2) For MSVC/CDB, exceptions must be handled in the dumper, which is
|
||||
// achieved using __try/__except. The exception will be reported in the
|
||||
// debugger, which will then execute a 'gN' command, passing handling back
|
||||
// to the __except clause.
|
||||
|
||||
volatile int qProvokeSegFaultHelper;
|
||||
|
||||
static const void *addOffset(const void *p, int offset)
|
||||
{
|
||||
return offset + reinterpret_cast<const char *>(p);
|
||||
}
|
||||
|
||||
static const void *skipvtable(const void *p)
|
||||
{
|
||||
return sizeof(void *) + reinterpret_cast<const char *>(p);
|
||||
}
|
||||
|
||||
static const void *deref(const void *p)
|
||||
{
|
||||
return *reinterpret_cast<const char* const*>(p);
|
||||
}
|
||||
|
||||
static const void *dfunc(const void *p)
|
||||
{
|
||||
return deref(skipvtable(p));
|
||||
}
|
||||
|
||||
static bool isEqual(const char *s, const char *t)
|
||||
{
|
||||
return qstrcmp(s, t) == 0;
|
||||
}
|
||||
|
||||
static bool startsWith(const char *s, const char *t)
|
||||
{
|
||||
while (char c = *t++)
|
||||
if (c != *s++)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool couldBePointer(const void *p)
|
||||
{
|
||||
// we assume valid pointer to be 4-aligned at least.
|
||||
// So use this check only when this is guaranteed.
|
||||
// FIXME: this breaks e.g. in the QString dumper...
|
||||
const quintptr d = quintptr(p);
|
||||
//qDebug() << "CHECKING : " << p << ((d & 3) == 0 && (d > 1000 || d == 0));
|
||||
//return (d & 3) == 0 && (d > 1000 || d == 0);
|
||||
return d > 1000 || d == 0;
|
||||
}
|
||||
|
||||
// Check memory for read access and provoke segfault if nothing else helps.
|
||||
// On Windows, try to be less crash-prone by checking memory using WinAPI
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
# define qCheckAccess(d) do { \
|
||||
if (IsBadReadPtr(d, 1)) \
|
||||
return; \
|
||||
qProvokeSegFaultHelper = *(char*)d; \
|
||||
} while (0)
|
||||
# define qCheckPointer(d) do { \
|
||||
if (d && IsBadReadPtr(d, 1)) \
|
||||
return; \
|
||||
if (d) qProvokeSegFaultHelper = *(char*)d; \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
# define qCheckAccess(d) do { \
|
||||
if (!couldBePointer(d) && d != 0) \
|
||||
return; \
|
||||
qProvokeSegFaultHelper = *(char*)d; \
|
||||
} while (0)
|
||||
# define qCheckPointer(d) do { \
|
||||
if (!couldBePointer(d)) \
|
||||
return; \
|
||||
if (d) \
|
||||
qProvokeSegFaultHelper = *(char*)d; \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef QT_NAMESPACE
|
||||
const char *stripNamespace(const char *type)
|
||||
{
|
||||
static const size_t nslen = strlen(NS);
|
||||
return startsWith(type, NS) ? type + nslen : type;
|
||||
}
|
||||
#else
|
||||
inline const char *stripNamespace(const char *type)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool isSimpleType(const char *type)
|
||||
{
|
||||
switch (type[0]) {
|
||||
case 'c':
|
||||
return isEqual(type, "char");
|
||||
case 'd':
|
||||
return isEqual(type, "double");
|
||||
case 'f':
|
||||
return isEqual(type, "float");
|
||||
case 'i':
|
||||
return isEqual(type, "int");
|
||||
case 'l':
|
||||
return isEqual(type, "long") || startsWith(type, "long ");
|
||||
case 's':
|
||||
return isEqual(type, "short") || startsWith(type, "short ")
|
||||
|| isEqual(type, "signed") || startsWith(type, "signed ");
|
||||
case 'u':
|
||||
return isEqual(type, "unsigned") || startsWith(type, "unsigned ");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool isStringType(const char *type)
|
||||
{
|
||||
return isEqual(type, NS"QString")
|
||||
|| isEqual(type, NS"QByteArray")
|
||||
|| isEqual(type, "std::string")
|
||||
|| isEqual(type, "std::wstring")
|
||||
|| isEqual(type, "wstring");
|
||||
}
|
||||
|
||||
static bool isMovableType(const char *type)
|
||||
{
|
||||
if (isPointerType(type))
|
||||
return true;
|
||||
|
||||
if (isSimpleType(type))
|
||||
return true;
|
||||
|
||||
type = stripNamespace(type);
|
||||
|
||||
switch (type[1]) {
|
||||
case 'B':
|
||||
return isEqual(type, "QBrush")
|
||||
|| isEqual(type, "QBitArray")
|
||||
|| isEqual(type, "QByteArray") ;
|
||||
case 'C':
|
||||
return isEqual(type, "QCustomTypeInfo")
|
||||
|| isEqual(type, "QChar");
|
||||
case 'D':
|
||||
return isEqual(type, "QDate")
|
||||
|| isEqual(type, "QDateTime");
|
||||
case 'F':
|
||||
return isEqual(type, "QFileInfo")
|
||||
|| isEqual(type, "QFixed")
|
||||
|| isEqual(type, "QFixedPoint")
|
||||
|| isEqual(type, "QFixedSize");
|
||||
case 'H':
|
||||
return isEqual(type, "QHashDummyValue");
|
||||
case 'I':
|
||||
return isEqual(type, "QIcon")
|
||||
|| isEqual(type, "QImage");
|
||||
case 'L':
|
||||
return isEqual(type, "QLine")
|
||||
|| isEqual(type, "QLineF")
|
||||
|| isEqual(type, "QLatin1Char")
|
||||
|| isEqual(type, "QLocal");
|
||||
case 'M':
|
||||
return isEqual(type, "QMatrix")
|
||||
|| isEqual(type, "QModelIndex");
|
||||
case 'P':
|
||||
return isEqual(type, "QPoint")
|
||||
|| isEqual(type, "QPointF")
|
||||
|| isEqual(type, "QPen")
|
||||
|| isEqual(type, "QPersistentModelIndex");
|
||||
case 'R':
|
||||
return isEqual(type, "QResourceRoot")
|
||||
|| isEqual(type, "QRect")
|
||||
|| isEqual(type, "QRectF")
|
||||
|| isEqual(type, "QRegExp");
|
||||
case 'S':
|
||||
return isEqual(type, "QSize")
|
||||
|| isEqual(type, "QSizeF")
|
||||
|| isEqual(type, "QString");
|
||||
case 'T':
|
||||
return isEqual(type, "QTime")
|
||||
|| isEqual(type, "QTextBlock");
|
||||
case 'U':
|
||||
return isEqual(type, "QUrl");
|
||||
case 'V':
|
||||
return isEqual(type, "QVariant");
|
||||
case 'X':
|
||||
return isEqual(type, "QXmlStreamAttribute")
|
||||
|| isEqual(type, "QXmlStreamNamespaceDeclaration")
|
||||
|| isEqual(type, "QXmlStreamNotationDeclaration")
|
||||
|| isEqual(type, "QXmlStreamEntityDeclaration");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
struct QDumper
|
||||
{
|
||||
explicit QDumper();
|
||||
~QDumper();
|
||||
|
||||
// direct write to the output
|
||||
QDumper &put(long c);
|
||||
QDumper &put(int i);
|
||||
QDumper &put(double d);
|
||||
QDumper &put(float d);
|
||||
QDumper &put(unsigned long c);
|
||||
QDumper &put(unsigned int i);
|
||||
QDumper &put(const void *p);
|
||||
QDumper &put(qulonglong c);
|
||||
QDumper &put(long long c);
|
||||
QDumper &put(const char *str);
|
||||
QDumper &put(const QByteArray &ba);
|
||||
QDumper &put(const QString &str);
|
||||
QDumper &put(char c);
|
||||
|
||||
// convienience functions for writing key="value" pairs:
|
||||
template <class Value>
|
||||
void putItem(const char *name, const Value &value)
|
||||
{
|
||||
putCommaIfNeeded();
|
||||
put(name).put('=').put('"').put(value).put('"');
|
||||
}
|
||||
|
||||
void putItem(const char *name, const char *value, const char *setvalue)
|
||||
{
|
||||
if (!isEqual(value, setvalue))
|
||||
putItem(name, value);
|
||||
}
|
||||
// convienience functions for writing typical properties.
|
||||
// roughly equivalent to
|
||||
// beginHash();
|
||||
// putItem("name", name);
|
||||
// putItem("value", value);
|
||||
// putItem("type", NS"QString");
|
||||
// putItem("numchild", "0");
|
||||
// putItem("valueencoded", "2");
|
||||
// endHash();
|
||||
void putHash(const char *name, const QString &value);
|
||||
void putHash(const char *name, const QByteArray &value);
|
||||
void putHash(const char *name, int value);
|
||||
void putHash(const char *name, long value);
|
||||
void putHash(const char *name, bool value);
|
||||
void putHash(const char *name, QChar value);
|
||||
void putHash(const char *name, float value);
|
||||
void putHash(const char *name, double value);
|
||||
void putStringValue(const QString &value);
|
||||
|
||||
void beginHash(); // start of data hash output
|
||||
void endHash(); // start of data hash output
|
||||
|
||||
void beginChildren(const char *mainInnerType = 0); // start of children list
|
||||
void endChildren(); // end of children list
|
||||
|
||||
void beginItem(const char *name); // start of named item, ready to accept value
|
||||
void endItem(); // end of named item, used after value output is complete
|
||||
|
||||
// convienience for putting "<n items>"
|
||||
void putItemCount(const char *name, int count);
|
||||
void putCommaIfNeeded();
|
||||
// convienience function for writing the last item of an abbreviated list
|
||||
void putEllipsis();
|
||||
void disarm();
|
||||
|
||||
void putBase64Encoded(const char *buf, int n);
|
||||
void checkFill();
|
||||
|
||||
// the dumper arguments
|
||||
int protocolVersion; // dumper protocol version
|
||||
int token; // some token to show on success
|
||||
const char *outerType; // object type
|
||||
const char *iname; // object name used for display
|
||||
const char *exp; // object expression
|
||||
const char *innerType; // 'inner type' for class templates
|
||||
const void *data; // pointer to raw data
|
||||
bool dumpChildren; // do we want to see children?
|
||||
|
||||
// handling of nested templates
|
||||
void setupTemplateParameters();
|
||||
enum { maxTemplateParameters = 10 };
|
||||
const char *templateParameters[maxTemplateParameters + 1];
|
||||
|
||||
// internal state
|
||||
int extraInt[4];
|
||||
|
||||
bool success; // are we finished?
|
||||
bool full;
|
||||
int pos;
|
||||
|
||||
const char *currentChildType;
|
||||
const char *currentChildNumChild;
|
||||
};
|
||||
|
||||
|
||||
QDumper::QDumper()
|
||||
{
|
||||
success = false;
|
||||
full = false;
|
||||
outBuffer[0] = 'f'; // marks output as 'wrong'
|
||||
pos = 1;
|
||||
currentChildType = 0;
|
||||
currentChildNumChild = 0;
|
||||
}
|
||||
|
||||
QDumper::~QDumper()
|
||||
{
|
||||
outBuffer[pos++] = '\0';
|
||||
if (success)
|
||||
outBuffer[0] = (full ? '+' : 't');
|
||||
}
|
||||
|
||||
void QDumper::setupTemplateParameters()
|
||||
{
|
||||
char *s = const_cast<char *>(innerType);
|
||||
|
||||
int templateParametersCount = 1;
|
||||
templateParameters[0] = s;
|
||||
for (int i = 1; i != maxTemplateParameters + 1; ++i)
|
||||
templateParameters[i] = 0;
|
||||
|
||||
while (*s) {
|
||||
while (*s && *s != '@')
|
||||
++s;
|
||||
if (*s) {
|
||||
*s = '\0';
|
||||
++s;
|
||||
templateParameters[templateParametersCount++] = s;
|
||||
}
|
||||
}
|
||||
while (templateParametersCount < maxTemplateParameters)
|
||||
templateParameters[templateParametersCount++] = 0;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(char c)
|
||||
{
|
||||
checkFill();
|
||||
if (!full)
|
||||
outBuffer[pos++] = c;
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(unsigned long long c)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(outBuffer + pos, "%llu", c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(long long c)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(outBuffer + pos, "%lld", c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(unsigned long c)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(outBuffer + pos, "%lu", c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(float d)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(outBuffer + pos, "%f", d);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(double d)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(outBuffer + pos, "%f", d);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(unsigned int i)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(outBuffer + pos, "%u", i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(long c)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(outBuffer + pos, "%ld", c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(int i)
|
||||
{
|
||||
checkFill();
|
||||
pos += sprintf(outBuffer + pos, "%d", i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(const void *p)
|
||||
{
|
||||
if (p) {
|
||||
// Pointer is 'long long' on WIN_64, only
|
||||
static const char *printFormat = sizeof(void *) == sizeof(long) ? "0x%lx" : "0x%llx";
|
||||
pos += sprintf(outBuffer + pos, printFormat, p);
|
||||
} else {
|
||||
pos += sprintf(outBuffer + pos, "<null>");
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(const char *str)
|
||||
{
|
||||
if (!str)
|
||||
return put("<null>");
|
||||
while (*str)
|
||||
put(*(str++));
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(const QByteArray &ba)
|
||||
{
|
||||
putBase64Encoded(ba.constData(), ba.size());
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDumper &QDumper::put(const QString &str)
|
||||
{
|
||||
putBase64Encoded((const char *)str.constData(), 2 * str.size());
|
||||
return *this;
|
||||
}
|
||||
|
||||
void QDumper::checkFill()
|
||||
{
|
||||
if (pos >= int(sizeof(outBuffer)) - 100)
|
||||
full = true;
|
||||
}
|
||||
|
||||
void QDumper::putCommaIfNeeded()
|
||||
{
|
||||
if (pos == 0)
|
||||
return;
|
||||
char c = outBuffer[pos - 1];
|
||||
if (c == '}' || c == '"' || c == ']')
|
||||
put(',');
|
||||
}
|
||||
|
||||
void QDumper::putBase64Encoded(const char *buf, int n)
|
||||
{
|
||||
const char alphabet[] = "ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef"
|
||||
"ghijklmn" "opqrstuv" "wxyz0123" "456789+/";
|
||||
const char padchar = '=';
|
||||
int padlen = 0;
|
||||
|
||||
//int tmpsize = ((n * 4) / 3) + 3;
|
||||
|
||||
int i = 0;
|
||||
while (i < n) {
|
||||
int chunk = 0;
|
||||
chunk |= int(uchar(buf[i++])) << 16;
|
||||
if (i == n) {
|
||||
padlen = 2;
|
||||
} else {
|
||||
chunk |= int(uchar(buf[i++])) << 8;
|
||||
if (i == n)
|
||||
padlen = 1;
|
||||
else
|
||||
chunk |= int(uchar(buf[i++]));
|
||||
}
|
||||
|
||||
int j = (chunk & 0x00fc0000) >> 18;
|
||||
int k = (chunk & 0x0003f000) >> 12;
|
||||
int l = (chunk & 0x00000fc0) >> 6;
|
||||
int m = (chunk & 0x0000003f);
|
||||
put(alphabet[j]);
|
||||
put(alphabet[k]);
|
||||
put(padlen > 1 ? padchar : alphabet[l]);
|
||||
put(padlen > 0 ? padchar : alphabet[m]);
|
||||
}
|
||||
}
|
||||
|
||||
void QDumper::putStringValue(const QString &str)
|
||||
{
|
||||
if (str.isNull()) {
|
||||
putItem("value", "\"\" (null)");
|
||||
} else {
|
||||
putItem("value", str);
|
||||
putItem("valueencoded", "2");
|
||||
}
|
||||
}
|
||||
|
||||
void QDumper::disarm()
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
|
||||
void QDumper::beginHash()
|
||||
{
|
||||
putCommaIfNeeded();
|
||||
put('{');
|
||||
}
|
||||
|
||||
void QDumper::endHash()
|
||||
{
|
||||
put('}');
|
||||
}
|
||||
|
||||
void QDumper::putEllipsis()
|
||||
{
|
||||
putCommaIfNeeded();
|
||||
put("{name=\"<incomplete>\",value=\"\",type=\"").put(innerType).put("\"}");
|
||||
}
|
||||
|
||||
void QDumper::putItemCount(const char *name, int count)
|
||||
{
|
||||
putCommaIfNeeded();
|
||||
put(name).put("=\"<").put(count).put(" items>\"");
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Some helpers to keep the dumper code short
|
||||
//
|
||||
|
||||
void QDumper::beginItem(const char *name)
|
||||
{
|
||||
putCommaIfNeeded();
|
||||
put(name).put('=').put('"');
|
||||
}
|
||||
|
||||
void QDumper::endItem()
|
||||
{
|
||||
put('"');
|
||||
}
|
||||
|
||||
void QDumper::beginChildren(const char *mainInnerType)
|
||||
{
|
||||
if (mainInnerType) {
|
||||
putItem("childtype", mainInnerType);
|
||||
currentChildType = mainInnerType;
|
||||
if (isSimpleType(mainInnerType) || isStringType(mainInnerType)) {
|
||||
putItem("childnumchild", "0");
|
||||
currentChildNumChild = "0";
|
||||
} else if (isPointerType(mainInnerType)) {
|
||||
putItem("childnumchild", "1");
|
||||
currentChildNumChild = "1";
|
||||
}
|
||||
}
|
||||
|
||||
putCommaIfNeeded();
|
||||
put("children=[");
|
||||
}
|
||||
|
||||
void QDumper::endChildren()
|
||||
{
|
||||
put(']');
|
||||
currentChildType = 0;
|
||||
currentChildNumChild = 0;
|
||||
}
|
||||
|
||||
// simple string property
|
||||
void QDumper::putHash(const char *name, const QString &value)
|
||||
{
|
||||
beginHash();
|
||||
putItem("name", name);
|
||||
putStringValue(value);
|
||||
putItem("type", NS"QString");
|
||||
putItem("numchild", "0");
|
||||
endHash();
|
||||
}
|
||||
|
||||
void QDumper::putHash(const char *name, const QByteArray &value)
|
||||
{
|
||||
beginHash();
|
||||
putItem("name", name);
|
||||
putItem("value", value);
|
||||
putItem("type", NS"QByteArray");
|
||||
putItem("numchild", "0");
|
||||
putItem("valueencoded", "1");
|
||||
endHash();
|
||||
}
|
||||
|
||||
// simple integer property
|
||||
void QDumper::putHash(const char *name, int value)
|
||||
{
|
||||
beginHash();
|
||||
putItem("name", name);
|
||||
putItem("value", value);
|
||||
putItem("type", "int");
|
||||
putItem("numchild", "0");
|
||||
endHash();
|
||||
}
|
||||
|
||||
void QDumper::putHash(const char *name, long value)
|
||||
{
|
||||
beginHash();
|
||||
putItem("name", name);
|
||||
putItem("value", value);
|
||||
putItem("type", "long");
|
||||
putItem("numchild", "0");
|
||||
endHash();
|
||||
}
|
||||
|
||||
void QDumper::putHash(const char *name, float value)
|
||||
{
|
||||
beginHash();
|
||||
putItem("name", name);
|
||||
putItem("value", value);
|
||||
putItem("type", "float");
|
||||
putItem("numchild", "0");
|
||||
endHash();
|
||||
}
|
||||
|
||||
void QDumper::putHash(const char *name, double value)
|
||||
{
|
||||
beginHash();
|
||||
putItem("name", name);
|
||||
putItem("value", value);
|
||||
putItem("type", "double");
|
||||
putItem("numchild", "0");
|
||||
endHash();
|
||||
}
|
||||
|
||||
// simple boolean property
|
||||
void QDumper::putHash(const char *name, bool value)
|
||||
{
|
||||
beginHash();
|
||||
putItem("name", name);
|
||||
putItem("value", (value ? "true" : "false"));
|
||||
putItem("type", "bool");
|
||||
putItem("numchild", "0");
|
||||
endHash();
|
||||
}
|
||||
|
||||
// a single QChar
|
||||
void QDumper::putHash(const char *name, QChar value)
|
||||
{
|
||||
beginHash();
|
||||
putItem("name", name);
|
||||
putStringValue(QString(QLatin1String("'%1' (%2, 0x%3)"))
|
||||
.arg(value).arg(value.unicode()).arg(value.unicode(), 0, 16));
|
||||
putItem("type", NS"QChar");
|
||||
putItem("numchild", "0");
|
||||
endHash();
|
||||
}
|
||||
|
||||
#define DUMPUNKNOWN_MESSAGE "<not in scope>"
|
||||
static void qDumpUnknown(QDumper &d, const char *why = 0)
|
||||
{
|
||||
if (!why)
|
||||
why = DUMPUNKNOWN_MESSAGE;
|
||||
d.putItem("value", why);
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("valueenabled", "false");
|
||||
d.putItem("numchild", "0", d.currentChildNumChild);
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpStdStringValue(QDumper &d, const std::string &str)
|
||||
{
|
||||
d.beginItem("value");
|
||||
d.putBase64Encoded(str.c_str(), str.size());
|
||||
d.endItem();
|
||||
d.putItem("valueencoded", "1");
|
||||
d.putItem("type", "std::string");
|
||||
d.putItem("numchild", "0", d.currentChildNumChild);
|
||||
}
|
||||
|
||||
static void qDumpStdWStringValue(QDumper &d, const std::wstring &str)
|
||||
{
|
||||
d.beginItem("value");
|
||||
d.putBase64Encoded((const char *)str.c_str(), str.size() * sizeof(wchar_t));
|
||||
d.endItem();
|
||||
d.putItem("valueencoded", (sizeof(wchar_t) == 2 ? "2" : "3"));
|
||||
d.putItem("type", "std::wstring", d.currentChildType);
|
||||
d.putItem("numchild", "0", d.currentChildNumChild);
|
||||
}
|
||||
|
||||
// Called by templates, so, not static.
|
||||
static void qDumpInnerQCharValue(QDumper &d, QChar c, const char *field)
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "'?', ucs=%d", c.unicode());
|
||||
if (c.isPrint() && c.unicode() < 127)
|
||||
buf[1] = char(c.unicode());
|
||||
d.putCommaIfNeeded();
|
||||
d.putItem(field, buf);
|
||||
d.putItem("numchild", "0", d.currentChildNumChild);
|
||||
}
|
||||
|
||||
static void qDumpInnerCharValue(QDumper &d, char c, const char *field)
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf, "'?', ascii=%d", c);
|
||||
if (QChar(QLatin1Char(c)).isPrint() && c < 127)
|
||||
buf[1] = c;
|
||||
d.putCommaIfNeeded();
|
||||
d.putItem(field, buf);
|
||||
d.putItem("numchild", "0", d.currentChildNumChild);
|
||||
}
|
||||
|
||||
void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr,
|
||||
const char *field = "value")
|
||||
{
|
||||
type = stripNamespace(type);
|
||||
switch (type[1]) {
|
||||
case 'h':
|
||||
if (isEqual(type, "char"))
|
||||
qDumpInnerCharValue(d, *(char *)addr, field);
|
||||
break;
|
||||
case 'l':
|
||||
if (isEqual(type, "float"))
|
||||
d.putItem(field, *(float*)addr);
|
||||
break;
|
||||
case 'n':
|
||||
if (isEqual(type, "int"))
|
||||
d.putItem(field, *(int*)addr);
|
||||
else if (isEqual(type, "unsigned") || isEqual(type, "unsigned int"))
|
||||
d.putItem(field, *(unsigned int*)addr);
|
||||
else if (isEqual(type, "unsigned char"))
|
||||
qDumpInnerCharValue(d, *(char *)addr, field);
|
||||
else if (isEqual(type, "unsigned long"))
|
||||
d.putItem(field, *(unsigned long*)addr);
|
||||
else if (isEqual(type, "unsigned long long"))
|
||||
d.putItem(field, *(qulonglong*)addr);
|
||||
break;
|
||||
case 'o':
|
||||
if (isEqual(type, "bool")) {
|
||||
switch (*(bool*)addr) {
|
||||
case 0: d.putItem(field, "false"); break;
|
||||
case 1: d.putItem(field, "true"); break;
|
||||
default: d.putItem(field, *(bool*)addr); break;
|
||||
}
|
||||
} else if (isEqual(type, "double"))
|
||||
d.putItem(field, *(double*)addr);
|
||||
else if (isEqual(type, "long"))
|
||||
d.putItem(field, *(long*)addr);
|
||||
else if (isEqual(type, "long long"))
|
||||
d.putItem(field, *(qulonglong*)addr);
|
||||
break;
|
||||
case 'B':
|
||||
if (isEqual(type, "QByteArray")) {
|
||||
d.putCommaIfNeeded();
|
||||
d.put(field).put("encoded=\"1\",");
|
||||
d.putItem(field, *(QByteArray*)addr);
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
if (isEqual(type, "QChar"))
|
||||
qDumpInnerQCharValue(d, *(QChar*)addr, field);
|
||||
break;
|
||||
case 'L':
|
||||
if (startsWith(type, "QList<")) {
|
||||
const QListData *ldata = reinterpret_cast<const QListData*>(addr);
|
||||
d.putItemCount("value", ldata->size());
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("numchild", ldata->size());
|
||||
}
|
||||
break;
|
||||
case 'O':
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
if (isEqual(type, "QObject *")) {
|
||||
if (addr) {
|
||||
const QObject *ob = reinterpret_cast<const QObject *>(addr);
|
||||
d.putItem("addr", ob);
|
||||
d.putItem("value", ob->objectName());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.putItem("type", NS"QObject");
|
||||
d.putItem("displayedtype", ob->metaObject()->className());
|
||||
d.putItem("numchild", 1);
|
||||
} else {
|
||||
d.putItem("value", "0x0");
|
||||
d.putItem("type", NS"QObject *");
|
||||
d.putItem("numchild", 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 'S':
|
||||
if (isEqual(type, "QString")) {
|
||||
d.putCommaIfNeeded();
|
||||
d.putItem(field, *(QString*)addr);
|
||||
d.put(',').put(field).put("encoded=\"2\"");
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
if (isEqual(type, "std::string")
|
||||
|| isEqual(type, stdStringTypeC)) {
|
||||
d.putCommaIfNeeded();
|
||||
qDumpStdStringValue(d, *reinterpret_cast<const std::string*>(addr));
|
||||
} else if (isEqual(type, "std::wstring")
|
||||
|| isEqual(type, stdWideStringTypeUShortC)) {
|
||||
qDumpStdWStringValue(d, *reinterpret_cast<const std::wstring*>(addr));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void qDumpInnerValue(QDumper &d, const char *type, const void *addr)
|
||||
{
|
||||
d.putItem("addr", addr);
|
||||
d.putItem("type", type, d.currentChildType);
|
||||
|
||||
if (!type[0])
|
||||
return;
|
||||
|
||||
return qDumpInnerValueHelper(d, type, addr);
|
||||
}
|
||||
|
||||
static void qDumpInnerValueOrPointer(QDumper &d,
|
||||
const char *type, const char *strippedtype, const void *addr)
|
||||
{
|
||||
if (strippedtype) {
|
||||
if (deref(addr)) {
|
||||
d.putItem("addr", deref(addr));
|
||||
d.putItem("saddr", deref(addr));
|
||||
d.putItem("type", strippedtype, d.currentChildType);
|
||||
qDumpInnerValueHelper(d, strippedtype, deref(addr));
|
||||
} else {
|
||||
d.putItem("addr", addr);
|
||||
d.putItem("type", strippedtype);
|
||||
d.putItem("value", "<null>");
|
||||
d.putItem("numchild", "0");
|
||||
}
|
||||
} else {
|
||||
d.putItem("addr", addr);
|
||||
d.putItem("type", type, d.currentChildType);
|
||||
qDumpInnerValueHelper(d, type, addr);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
struct ModelIndex { int r; int c; void *p; void *m; };
|
||||
|
||||
static void qDumpQAbstractItem(QDumper &d)
|
||||
{
|
||||
QModelIndex mi;
|
||||
{
|
||||
ModelIndex *mm = reinterpret_cast<ModelIndex *>(&mi);
|
||||
mm->r = mm->c = 0;
|
||||
mm->p = mm->m = 0;
|
||||
static const char *printFormat = sizeof(void *) == sizeof(long) ?
|
||||
"%d,%d,0x%lx,0x%lx" : "%d,%d,0x%llx,0x%llx";
|
||||
sscanf(d.templateParameters[0], printFormat, &mm->r, &mm->c, &mm->p, &mm->m);
|
||||
}
|
||||
const QAbstractItemModel *m = mi.model();
|
||||
const int rowCount = m->rowCount(mi);
|
||||
if (rowCount < 0)
|
||||
return;
|
||||
const int columnCount = m->columnCount(mi);
|
||||
if (columnCount < 0)
|
||||
return;
|
||||
d.putItem("type", NS"QAbstractItem");
|
||||
d.beginItem("addr");
|
||||
d.put('$').put(mi.row()).put(',').put(mi.column()).put(',')
|
||||
.put(mi.internalPointer()).put(',').put(mi.model());
|
||||
d.endItem();
|
||||
//d.putItem("value", "(").put(rowCount).put(",").put(columnCount).put(")");
|
||||
d.putItem("value", m->data(mi, Qt::DisplayRole).toString());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.putItem("numchild", rowCount * columnCount);
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
for (int row = 0; row < rowCount; ++row) {
|
||||
for (int column = 0; column < columnCount; ++column) {
|
||||
QModelIndex child = m->index(row, column, mi);
|
||||
d.beginHash();
|
||||
d.beginItem("name");
|
||||
d.put("[").put(row).put(",").put(column).put("]");
|
||||
d.endItem();
|
||||
//d.putItem("numchild", (m->hasChildren(child) ? "1" : "0"));
|
||||
d.putItem("numchild", m->rowCount(child) * m->columnCount(child));
|
||||
d.beginItem("addr");
|
||||
d.put("$").put(child.row()).put(",").put(child.column()).put(",")
|
||||
.put(child.internalPointer()).put(",").put(child.model());
|
||||
d.endItem();
|
||||
d.putItem("type", NS"QAbstractItem");
|
||||
d.putItem("value", m->data(child, Qt::DisplayRole).toString());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.endHash();
|
||||
}
|
||||
}
|
||||
/*
|
||||
d.beginHash();
|
||||
d.putItem("name", "DisplayRole");
|
||||
d.putItem("numchild", 0);
|
||||
d.putItem("value", m->data(mi, Qt::DisplayRole).toString());
|
||||
d.putItem("valueencoded", 2);
|
||||
d.putItem("type", NS"QString");
|
||||
d.endHash();
|
||||
*/
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQAbstractItemModel(QDumper &d)
|
||||
{
|
||||
const QAbstractItemModel &m = *reinterpret_cast<const QAbstractItemModel *>(d.data);
|
||||
|
||||
const int rowCount = m.rowCount();
|
||||
if (rowCount < 0)
|
||||
return;
|
||||
const int columnCount = m.columnCount();
|
||||
if (columnCount < 0)
|
||||
return;
|
||||
|
||||
d.putItem("type", NS"QAbstractItemModel");
|
||||
d.beginItem("value");
|
||||
d.put("(").put(rowCount).put(",").put(columnCount).put(")");
|
||||
d.endItem();
|
||||
d.putItem("numchild", "1");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.beginHash();
|
||||
d.putItem("numchild", "1");
|
||||
d.putItem("name", NS"QObject");
|
||||
d.putItem("addr", d.data);
|
||||
d.putItem("value", m.objectName());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.putItem("type", NS"QObject");
|
||||
d.putItem("displayedtype", m.metaObject()->className());
|
||||
d.endHash();
|
||||
for (int row = 0; row < rowCount; ++row) {
|
||||
for (int column = 0; column < columnCount; ++column) {
|
||||
QModelIndex mi = m.index(row, column);
|
||||
d.beginHash();
|
||||
d.beginItem("name");
|
||||
d.put("[").put(row).put(",").put(column).put("]");
|
||||
d.endItem();
|
||||
d.putItem("value", m.data(mi, Qt::DisplayRole).toString());
|
||||
d.putItem("valueencoded", "2");
|
||||
//d.putItem("numchild", (m.hasChildren(mi) ? "1" : "0"));
|
||||
d.putItem("numchild", m.rowCount(mi) * m.columnCount(mi));
|
||||
d.beginItem("addr");
|
||||
d.put("$").put(mi.row()).put(",").put(mi.column()).put(",");
|
||||
d.put(mi.internalPointer()).put(",").put(mi.model());
|
||||
d.endItem();
|
||||
d.putItem("type", NS"QAbstractItem");
|
||||
d.endHash();
|
||||
}
|
||||
}
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
|
||||
static void qDumpQByteArray(QDumper &d)
|
||||
{
|
||||
qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid
|
||||
const QByteArray &ba = *reinterpret_cast<const QByteArray *>(d.data);
|
||||
|
||||
if (!ba.isEmpty()) {
|
||||
qCheckAccess(ba.constData());
|
||||
qCheckAccess(ba.constData() + ba.size());
|
||||
}
|
||||
|
||||
d.beginItem("value");
|
||||
if (ba.size() <= 100)
|
||||
d.put(ba);
|
||||
else
|
||||
d.put(ba.left(100)).put(" <size: ").put(ba.size()).put(", cut...>");
|
||||
d.endItem();
|
||||
d.putItem("valueencoded", "1");
|
||||
d.putItem("type", NS"QByteArray");
|
||||
d.putItem("numchild", ba.size());
|
||||
if (d.dumpChildren) {
|
||||
d.putItem("childtype", "char");
|
||||
d.putItem("childnumchild", "0");
|
||||
d.beginChildren();
|
||||
char buf[20];
|
||||
for (int i = 0; i != ba.size(); ++i) {
|
||||
unsigned char c = ba.at(i);
|
||||
unsigned char u = (isprint(c) && c != '\'' && c != '"') ? c : '?';
|
||||
sprintf(buf, "%02x (%u '%c')", c, c, u);
|
||||
d.beginHash();
|
||||
d.putItem("value", buf);
|
||||
d.endHash();
|
||||
}
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQChar(QDumper &d)
|
||||
{
|
||||
qDumpInnerQCharValue(d, *reinterpret_cast<const QChar *>(d.data), "value");
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQDateTime(QDumper &d)
|
||||
{
|
||||
#ifdef QT_NO_DATESTRING
|
||||
qDumpUnknown(d);
|
||||
#else
|
||||
const QDateTime &date = *reinterpret_cast<const QDateTime *>(d.data);
|
||||
if (date.isNull()) {
|
||||
d.putItem("value", "(null)");
|
||||
} else {
|
||||
d.putItem("value", date.toString());
|
||||
d.putItem("valueencoded", "2");
|
||||
}
|
||||
d.putItem("type", NS"QDateTime");
|
||||
d.putItem("numchild", "3");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.putHash("isNull", date.isNull());
|
||||
d.putHash("toTime_t", (long)date.toTime_t());
|
||||
d.putHash("toString", date.toString());
|
||||
#if QT_VERSION >= 0x040500
|
||||
d.putHash("toString_(ISO)", date.toString(Qt::ISODate));
|
||||
d.putHash("toString_(SystemLocale)", date.toString(Qt::SystemLocaleDate));
|
||||
d.putHash("toString_(Locale)", date.toString(Qt::LocaleDate));
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
d.beginHash();
|
||||
d.putItem("name", "toUTC");
|
||||
d.putItem("exp", "(("NSX"QDateTime"NSY"*)").put(d.data).put(")"
|
||||
"->toTimeSpec('"NS"Qt::UTC')");
|
||||
d.putItem("type", NS"QDateTime");
|
||||
d.putItem("numchild", "1");
|
||||
d.endHash();
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
d.beginHash();
|
||||
d.putItem("name", "toLocalTime");
|
||||
d.putItem("exp", "(("NSX"QDateTime"NSY"*)").put(d.data).put(")"
|
||||
"->toTimeSpec('"NS"Qt::LocalTime')");
|
||||
d.putItem("type", NS"QDateTime");
|
||||
d.putItem("numchild", "1");
|
||||
d.endHash();
|
||||
#endif
|
||||
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
#endif // ifdef QT_NO_DATESTRING
|
||||
}
|
||||
|
||||
static void qDumpQDir(QDumper &d)
|
||||
{
|
||||
const QDir &dir = *reinterpret_cast<const QDir *>(d.data);
|
||||
d.putItem("value", dir.path());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.putItem("type", NS"QDir");
|
||||
d.putItem("numchild", "3");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.putHash("absolutePath", dir.absolutePath());
|
||||
d.putHash("canonicalPath", dir.canonicalPath());
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQFile(QDumper &d)
|
||||
{
|
||||
const QFile &file = *reinterpret_cast<const QFile *>(d.data);
|
||||
d.putItem("value", file.fileName());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.putItem("type", NS"QFile");
|
||||
d.putItem("numchild", "2");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.putHash("fileName", file.fileName());
|
||||
d.putHash("exists", file.exists());
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQFileInfo(QDumper &d)
|
||||
{
|
||||
const QFileInfo &info = *reinterpret_cast<const QFileInfo *>(d.data);
|
||||
d.putItem("value", info.filePath());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.putItem("type", NS"QFileInfo");
|
||||
d.putItem("numchild", "3");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.putHash("absolutePath", info.absolutePath());
|
||||
d.putHash("absoluteFilePath", info.absoluteFilePath());
|
||||
d.putHash("canonicalPath", info.canonicalPath());
|
||||
d.putHash("canonicalFilePath", info.canonicalFilePath());
|
||||
d.putHash("completeBaseName", info.completeBaseName());
|
||||
d.putHash("completeSuffix", info.completeSuffix());
|
||||
d.putHash("baseName", info.baseName());
|
||||
#ifdef Q_OS_MACX
|
||||
d.putHash("isBundle", info.isBundle());
|
||||
d.putHash("bundleName", info.bundleName());
|
||||
#endif
|
||||
d.putHash("fileName", info.fileName());
|
||||
d.putHash("filePath", info.filePath());
|
||||
d.putHash("group", info.group());
|
||||
d.putHash("owner", info.owner());
|
||||
d.putHash("path", info.path());
|
||||
|
||||
d.putHash("groupid", (long)info.groupId());
|
||||
d.putHash("ownerid", (long)info.ownerId());
|
||||
//QFile::Permissions permissions () const
|
||||
long perms = info.permissions();
|
||||
d.beginHash();
|
||||
d.putItem("name", "permissions");
|
||||
d.putItem("value", " ");
|
||||
d.putItem("type", NS"QFile::Permissions");
|
||||
d.putItem("numchild", 10);
|
||||
d.beginChildren();
|
||||
d.putHash("ReadOwner", bool(perms & QFile::ReadOwner));
|
||||
d.putHash("WriteOwner", bool(perms & QFile::WriteOwner));
|
||||
d.putHash("ExeOwner", bool(perms & QFile::ExeOwner));
|
||||
d.putHash("ReadUser", bool(perms & QFile::ReadUser));
|
||||
d.putHash("WriteUser", bool(perms & QFile::WriteUser));
|
||||
d.putHash("ExeUser", bool(perms & QFile::ExeUser));
|
||||
d.putHash("ReadGroup", bool(perms & QFile::ReadGroup));
|
||||
d.putHash("WriteGroup", bool(perms & QFile::WriteGroup));
|
||||
d.putHash("ExeGroup", bool(perms & QFile::ExeGroup));
|
||||
d.putHash("ReadOther", bool(perms & QFile::ReadOther));
|
||||
d.putHash("WriteOther", bool(perms & QFile::WriteOther));
|
||||
d.putHash("ExeOther", bool(perms & QFile::ExeOther));
|
||||
d.endChildren();
|
||||
d.endHash();
|
||||
//QDir absoluteDir () const
|
||||
//QDir dir () const
|
||||
d.putHash("caching", info.caching());
|
||||
d.putHash("exists", info.exists());
|
||||
d.putHash("isAbsolute", info.isAbsolute());
|
||||
d.putHash("isDir", info.isDir());
|
||||
d.putHash("isExecutable", info.isExecutable());
|
||||
d.putHash("isFile", info.isFile());
|
||||
d.putHash("isHidden", info.isHidden());
|
||||
d.putHash("isReadable", info.isReadable());
|
||||
d.putHash("isRelative", info.isRelative());
|
||||
d.putHash("isRoot", info.isRoot());
|
||||
d.putHash("isSymLink", info.isSymLink());
|
||||
d.putHash("isWritable", info.isWritable());
|
||||
|
||||
d.beginHash();
|
||||
d.putItem("name", "created");
|
||||
d.putItem("value", info.created().toString());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.beginItem("exp");
|
||||
d.put("(("NSX"QFileInfo"NSY"*)").put(d.data).put(")->created()");
|
||||
d.endItem();
|
||||
d.putItem("type", NS"QDateTime");
|
||||
d.putItem("numchild", "1");
|
||||
d.endHash();
|
||||
|
||||
d.beginHash();
|
||||
d.putItem("name", "lastModified");
|
||||
d.putItem("value", info.lastModified().toString());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.beginItem("exp");
|
||||
d.put("(("NSX"QFileInfo"NSY"*)").put(d.data).put(")->lastModified()");
|
||||
d.endItem();
|
||||
d.putItem("type", NS"QDateTime");
|
||||
d.putItem("numchild", "1");
|
||||
d.endHash();
|
||||
|
||||
d.beginHash();
|
||||
d.putItem("name", "lastRead");
|
||||
d.putItem("value", info.lastRead().toString());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.beginItem("exp");
|
||||
d.put("(("NSX"QFileInfo"NSY"*)").put(d.data).put(")->lastRead()");
|
||||
d.endItem();
|
||||
d.putItem("type", NS"QDateTime");
|
||||
d.putItem("numchild", "1");
|
||||
d.endHash();
|
||||
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
bool isOptimizedIntKey(const char *keyType)
|
||||
{
|
||||
return isEqual(keyType, "int")
|
||||
#if defined(Q_BYTE_ORDER) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN
|
||||
|| isEqual(keyType, "short")
|
||||
|| isEqual(keyType, "ushort")
|
||||
#endif
|
||||
|| isEqual(keyType, "uint");
|
||||
}
|
||||
|
||||
int hashOffset(bool optimizedIntKey, bool forKey, unsigned keySize, unsigned valueSize)
|
||||
{
|
||||
// int-key optimization, small value
|
||||
struct NodeOS { void *next; uint k; uint v; } nodeOS;
|
||||
// int-key optimiatzion, large value
|
||||
struct NodeOL { void *next; uint k; void *v; } nodeOL;
|
||||
// no optimization, small value
|
||||
struct NodeNS { void *next; uint h; uint k; uint v; } nodeNS;
|
||||
// no optimization, large value
|
||||
struct NodeNL { void *next; uint h; uint k; void *v; } nodeNL;
|
||||
// complex key
|
||||
struct NodeL { void *next; uint h; void *k; void *v; } nodeL;
|
||||
|
||||
if (forKey) {
|
||||
// offsetof(...,...) not yet in Standard C++
|
||||
const ulong nodeOSk ( (char *)&nodeOS.k - (char *)&nodeOS );
|
||||
const ulong nodeOLk ( (char *)&nodeOL.k - (char *)&nodeOL );
|
||||
const ulong nodeNSk ( (char *)&nodeNS.k - (char *)&nodeNS );
|
||||
const ulong nodeNLk ( (char *)&nodeNL.k - (char *)&nodeNL );
|
||||
const ulong nodeLk ( (char *)&nodeL.k - (char *)&nodeL );
|
||||
if (optimizedIntKey)
|
||||
return valueSize > sizeof(int) ? nodeOLk : nodeOSk;
|
||||
if (keySize > sizeof(int))
|
||||
return nodeLk;
|
||||
return valueSize > sizeof(int) ? nodeNLk : nodeNSk;
|
||||
} else {
|
||||
const ulong nodeOSv ( (char *)&nodeOS.v - (char *)&nodeOS );
|
||||
const ulong nodeOLv ( (char *)&nodeOL.v - (char *)&nodeOL );
|
||||
const ulong nodeNSv ( (char *)&nodeNS.v - (char *)&nodeNS );
|
||||
const ulong nodeNLv ( (char *)&nodeNL.v - (char *)&nodeNL );
|
||||
const ulong nodeLv ( (char *)&nodeL.v - (char *)&nodeL );
|
||||
if (optimizedIntKey)
|
||||
return valueSize > sizeof(int) ? nodeOLv : nodeOSv;
|
||||
if (keySize > sizeof(int))
|
||||
return nodeLv;
|
||||
return valueSize > sizeof(int) ? nodeNLv : nodeNSv;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_CC_MSVC
|
||||
# define MAP_NODE_TYPE_END ">"
|
||||
#else
|
||||
# define MAP_NODE_TYPE_END " >"
|
||||
#endif
|
||||
|
||||
static void qDumpQHash(QDumper &d)
|
||||
{
|
||||
qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid
|
||||
const char *keyType = d.templateParameters[0];
|
||||
const char *valueType = d.templateParameters[1];
|
||||
|
||||
QHashData *h = *reinterpret_cast<QHashData *const*>(d.data);
|
||||
qCheckPointer(h->fakeNext);
|
||||
qCheckPointer(h->buckets);
|
||||
|
||||
unsigned keySize = d.extraInt[0];
|
||||
unsigned valueSize = d.extraInt[1];
|
||||
|
||||
int n = h->size;
|
||||
|
||||
if (n < 0)
|
||||
return;
|
||||
if (n > 0) {
|
||||
qCheckPointer(h->fakeNext);
|
||||
qCheckPointer(*h->buckets);
|
||||
}
|
||||
|
||||
d.putItemCount("value", n);
|
||||
d.putItem("numchild", n);
|
||||
|
||||
if (d.dumpChildren) {
|
||||
if (n > 1000)
|
||||
n = 1000;
|
||||
const bool isSimpleKey = isSimpleType(keyType);
|
||||
const bool isSimpleValue = isSimpleType(valueType);
|
||||
const bool opt = isOptimizedIntKey(keyType);
|
||||
const int keyOffset = hashOffset(opt, true, keySize, valueSize);
|
||||
const int valueOffset = hashOffset(opt, false, keySize, valueSize);
|
||||
|
||||
#if 0
|
||||
d.beginItem("extra");
|
||||
d.put("isSimpleKey: ").put(isSimpleKey);
|
||||
d.put(" isSimpleValue: ").put(isSimpleValue);
|
||||
d.put(" valueType: '").put(isSimpleValue);
|
||||
d.put(" keySize: ").put(keyOffset);
|
||||
d.put(" valueOffset: ").put(valueOffset);
|
||||
d.put(" opt: ").put(opt);
|
||||
d.endItem();
|
||||
#endif
|
||||
QHashData::Node *node = h->firstNode();
|
||||
QHashData::Node *end = reinterpret_cast<QHashData::Node *>(h);
|
||||
int i = 0;
|
||||
|
||||
d.beginChildren();
|
||||
while (node != end) {
|
||||
d.beginHash();
|
||||
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
|
||||
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
|
||||
if (isSimpleKey && isSimpleValue) {
|
||||
d.putItem("type", valueType);
|
||||
d.putItem("addr", addOffset(node, valueOffset));
|
||||
} else {
|
||||
d.putItem("addr", node);
|
||||
d.beginItem("type");
|
||||
d.put(NS"QHashNode<").put(keyType).put(",")
|
||||
.put(valueType).put(MAP_NODE_TYPE_END);
|
||||
d.endItem();
|
||||
}
|
||||
d.endHash();
|
||||
++i;
|
||||
node = QHashData::nextNode(node);
|
||||
}
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQHashNode(QDumper &d)
|
||||
{
|
||||
const QHashData *h = reinterpret_cast<const QHashData *>(d.data);
|
||||
const char *keyType = d.templateParameters[0];
|
||||
const char *valueType = d.templateParameters[1];
|
||||
|
||||
unsigned keySize = d.extraInt[0];
|
||||
unsigned valueSize = d.extraInt[1];
|
||||
bool opt = isOptimizedIntKey(keyType);
|
||||
int keyOffset = hashOffset(opt, true, keySize, valueSize);
|
||||
int valueOffset = hashOffset(opt, false, keySize, valueSize);
|
||||
if (isSimpleType(valueType))
|
||||
qDumpInnerValueHelper(d, valueType, addOffset(h, valueOffset));
|
||||
else
|
||||
d.putItem("value", "");
|
||||
|
||||
d.putItem("numchild", 2);
|
||||
if (d.dumpChildren) {
|
||||
// there is a hash specialization in case the keys are integers or shorts
|
||||
d.beginChildren();
|
||||
d.beginHash();
|
||||
d.putItem("name", "key");
|
||||
d.putItem("type", keyType);
|
||||
d.putItem("addr", addOffset(h, keyOffset));
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
d.putItem("name", "value");
|
||||
d.putItem("type", valueType);
|
||||
d.putItem("addr", addOffset(h, valueOffset));
|
||||
d.endHash();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
#if USE_QT_GUI
|
||||
static void qDumpQImage(QDumper &d)
|
||||
{
|
||||
qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid
|
||||
const QImage &im = *reinterpret_cast<const QImage *>(d.data);
|
||||
d.beginItem("value");
|
||||
d.put("(").put(im.width()).put("x").put(im.height()).put(")");
|
||||
d.endItem();
|
||||
d.putItem("type", NS"QImage");
|
||||
d.putItem("numchild", "1");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.beginHash();
|
||||
d.putItem("name", "data");
|
||||
d.putItem("type", NS "QImageData");
|
||||
d.putItem("addr", d.data);
|
||||
d.endHash();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USE_QT_GUI
|
||||
static void qDumpQImageData(QDumper &d)
|
||||
{
|
||||
const QImage &im = *reinterpret_cast<const QImage *>(d.data);
|
||||
const QByteArray ba(QByteArray::fromRawData((const char*)im.bits(), im.numBytes()));
|
||||
d.putItem("type", NS"QImageData");
|
||||
d.putItem("numchild", "0");
|
||||
#if 1
|
||||
d.putItem("value", "<hover here>");
|
||||
d.putItem("valuetooltipencoded", "1");
|
||||
d.putItem("valuetooltipsize", ba.size());
|
||||
d.putItem("valuetooltip", ba);
|
||||
#else
|
||||
d.putItem("valueencoded", "1");
|
||||
d.putItem("value", ba);
|
||||
#endif
|
||||
d.disarm();
|
||||
}
|
||||
#endif
|
||||
|
||||
static void qDumpQList(QDumper &d)
|
||||
{
|
||||
qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid
|
||||
// This uses the knowledge that QList<T> has only a single member
|
||||
// of type union { QListData p; QListData::Data *d; };
|
||||
|
||||
const QListData &pdata = *reinterpret_cast<const QListData*>(d.data);
|
||||
const int nn = pdata.size();
|
||||
if (nn < 0)
|
||||
return;
|
||||
const bool innerTypeIsPointer = isPointerType(d.innerType);
|
||||
const int n = qMin(nn, 1000);
|
||||
if (nn > 0) {
|
||||
if (pdata.d->begin < 0)
|
||||
return;
|
||||
if (pdata.d->begin > pdata.d->end)
|
||||
return;
|
||||
#if QT_VERSION >= 0x040400
|
||||
if (pdata.d->ref._q_value <= 0)
|
||||
return;
|
||||
#endif
|
||||
qCheckAccess(pdata.d->array);
|
||||
// Additional checks on pointer arrays
|
||||
if (innerTypeIsPointer)
|
||||
for (int i = 0; i != n; ++i)
|
||||
if (const void *p = pdata.d->array + i + pdata.d->begin)
|
||||
qCheckPointer(deref(p));
|
||||
}
|
||||
|
||||
d.putItemCount("value", nn);
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("numchild", n);
|
||||
if (d.dumpChildren) {
|
||||
const unsigned innerSize = d.extraInt[0];
|
||||
QByteArray strippedInnerType = stripPointerType(d.innerType);
|
||||
|
||||
// The exact condition here is:
|
||||
// QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic
|
||||
// but this data is available neither in the compiled binary nor
|
||||
// in the frontend.
|
||||
// So as first approximation only do the 'isLarge' check:
|
||||
bool isInternal = innerSize <= int(sizeof(void*))
|
||||
&& isMovableType(d.innerType);
|
||||
d.putItem("internal", (int)isInternal);
|
||||
d.beginChildren(n ? d.innerType : 0);
|
||||
for (int i = 0; i != n; ++i) {
|
||||
d.beginHash();
|
||||
if (innerTypeIsPointer) {
|
||||
void *p = pdata.d->array + i + pdata.d->begin;
|
||||
d.putItem("saddr", p);
|
||||
if (*(void**)p) {
|
||||
//d.putItem("value","@").put(p);
|
||||
qDumpInnerValue(d, strippedInnerType.data(), deref(p));
|
||||
} else {
|
||||
d.putItem("value", "<null>");
|
||||
d.putItem("numchild", "0");
|
||||
}
|
||||
} else {
|
||||
void *p = pdata.d->array + i + pdata.d->begin;
|
||||
if (isInternal) {
|
||||
//qDumpInnerValue(d, d.innerType, p);
|
||||
d.putItem("addr", p);
|
||||
qDumpInnerValueHelper(d, d.innerType, p);
|
||||
} else {
|
||||
//qDumpInnerValue(d, d.innerType, deref(p));
|
||||
d.putItem("addr", deref(p));
|
||||
qDumpInnerValueHelper(d, d.innerType, deref(p));
|
||||
}
|
||||
}
|
||||
d.endHash();
|
||||
}
|
||||
if (n < nn)
|
||||
d.putEllipsis();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQLinkedList(QDumper &d)
|
||||
{
|
||||
qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid
|
||||
// This uses the knowledge that QLinkedList<T> has only a single member
|
||||
// of type union { QLinkedListData *d; QLinkedListNode<T> *e; };
|
||||
const QLinkedListData *ldata =
|
||||
reinterpret_cast<const QLinkedListData*>(deref(d.data));
|
||||
int nn = ldata->size;
|
||||
if (nn < 0)
|
||||
return;
|
||||
|
||||
int n = nn;
|
||||
d.putItemCount("value", n);
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("numchild", n);
|
||||
if (d.dumpChildren) {
|
||||
//unsigned innerSize = d.extraInt[0];
|
||||
//bool innerTypeIsPointer = isPointerType(d.innerType);
|
||||
QByteArray strippedInnerType = stripPointerType(d.innerType);
|
||||
const char *stripped =
|
||||
isPointerType(d.innerType) ? strippedInnerType.data() : 0;
|
||||
|
||||
if (n > 1000)
|
||||
n = 1000;
|
||||
d.beginChildren(d.innerType);
|
||||
const void *p = deref(ldata);
|
||||
for (int i = 0; i != n; ++i) {
|
||||
d.beginHash();
|
||||
const void *addr = addOffset(p, 2 * sizeof(void*));
|
||||
qDumpInnerValueOrPointer(d, d.innerType, stripped, addr);
|
||||
p = deref(p);
|
||||
d.endHash();
|
||||
}
|
||||
if (n < nn)
|
||||
d.putEllipsis();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQLocale(QDumper &d)
|
||||
{
|
||||
const QLocale &locale = *reinterpret_cast<const QLocale *>(d.data);
|
||||
d.putItem("value", locale.name());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.putItem("type", NS"QLocale");
|
||||
d.putItem("numchild", "8");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
|
||||
d.beginHash();
|
||||
d.putItem("name", "country");
|
||||
d.beginItem("exp");
|
||||
d.put("(("NSX"QLocale"NSY"*)").put(d.data).put(")->country()");
|
||||
d.endItem();
|
||||
d.endHash();
|
||||
|
||||
d.beginHash();
|
||||
d.putItem("name", "language");
|
||||
d.beginItem("exp");
|
||||
d.put("(("NSX"QLocale"NSY"*)").put(d.data).put(")->language()");
|
||||
d.endItem();
|
||||
d.endHash();
|
||||
|
||||
d.beginHash();
|
||||
d.putItem("name", "measurementSystem");
|
||||
d.beginItem("exp");
|
||||
d.put("(("NSX"QLocale"NSY"*)").put(d.data).put(")->measurementSystem()");
|
||||
d.endItem();
|
||||
d.endHash();
|
||||
|
||||
d.beginHash();
|
||||
d.putItem("name", "numberOptions");
|
||||
d.beginItem("exp");
|
||||
d.put("(("NSX"QLocale"NSY"*)").put(d.data).put(")->numberOptions()");
|
||||
d.endItem();
|
||||
d.endHash();
|
||||
|
||||
d.putHash("timeFormat_(short)", locale.timeFormat(QLocale::ShortFormat));
|
||||
d.putHash("timeFormat_(long)", locale.timeFormat(QLocale::LongFormat));
|
||||
|
||||
d.putHash("decimalPoint", locale.decimalPoint());
|
||||
d.putHash("exponential", locale.exponential());
|
||||
d.putHash("percent", locale.percent());
|
||||
d.putHash("zeroDigit", locale.zeroDigit());
|
||||
d.putHash("groupSeparator", locale.groupSeparator());
|
||||
d.putHash("negativeSign", locale.negativeSign());
|
||||
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQMapNode(QDumper &d)
|
||||
{
|
||||
const QMapData *h = reinterpret_cast<const QMapData *>(d.data);
|
||||
const char *keyType = d.templateParameters[0];
|
||||
const char *valueType = d.templateParameters[1];
|
||||
|
||||
qCheckAccess(h->backward);
|
||||
qCheckAccess(h->forward[0]);
|
||||
|
||||
d.putItem("value", "");
|
||||
d.putItem("numchild", 2);
|
||||
if (d.dumpChildren) {
|
||||
unsigned mapnodesize = d.extraInt[2];
|
||||
unsigned valueOff = d.extraInt[3];
|
||||
|
||||
unsigned keyOffset = 2 * sizeof(void*) - mapnodesize;
|
||||
unsigned valueOffset = 2 * sizeof(void*) - mapnodesize + valueOff;
|
||||
|
||||
d.beginChildren();
|
||||
d.beginHash();
|
||||
d.putItem("name", "key");
|
||||
qDumpInnerValue(d, keyType, addOffset(h, keyOffset));
|
||||
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
d.putItem("name", "value");
|
||||
qDumpInnerValue(d, valueType, addOffset(h, valueOffset));
|
||||
d.endHash();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQMap(QDumper &d)
|
||||
{
|
||||
qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid
|
||||
QMapData *h = *reinterpret_cast<QMapData *const*>(d.data);
|
||||
const char *keyType = d.templateParameters[0];
|
||||
const char *valueType = d.templateParameters[1];
|
||||
|
||||
int n = h->size;
|
||||
|
||||
if (n < 0)
|
||||
return;
|
||||
if (n > 0) {
|
||||
qCheckAccess(h->backward);
|
||||
qCheckAccess(h->forward[0]);
|
||||
qCheckPointer(h->backward->backward);
|
||||
qCheckPointer(h->forward[0]->backward);
|
||||
}
|
||||
|
||||
d.putItemCount("value", n);
|
||||
d.putItem("numchild", n);
|
||||
if (d.dumpChildren) {
|
||||
if (n > 1000)
|
||||
n = 1000;
|
||||
|
||||
//unsigned keySize = d.extraInt[0];
|
||||
//unsigned valueSize = d.extraInt[1];
|
||||
unsigned mapnodesize = d.extraInt[2];
|
||||
unsigned valueOff = d.extraInt[3];
|
||||
|
||||
bool isSimpleKey = isSimpleType(keyType);
|
||||
bool isSimpleValue = isSimpleType(valueType);
|
||||
// both negative:
|
||||
int keyOffset = 2 * sizeof(void*) - int(mapnodesize);
|
||||
int valueOffset = 2 * sizeof(void*) - int(mapnodesize) + valueOff;
|
||||
|
||||
d.beginItem("extra");
|
||||
d.put("simplekey: ").put(isSimpleKey).put(" isSimpleValue: ").put(isSimpleValue);
|
||||
d.put(" keyOffset: ").put(keyOffset).put(" valueOffset: ").put(valueOffset);
|
||||
d.put(" mapnodesize: ").put(mapnodesize);
|
||||
d.endItem();
|
||||
d.beginChildren();
|
||||
|
||||
QMapData::Node *node = reinterpret_cast<QMapData::Node *>(h->forward[0]);
|
||||
QMapData::Node *end = reinterpret_cast<QMapData::Node *>(h);
|
||||
int i = 0;
|
||||
|
||||
while (node != end) {
|
||||
d.beginHash();
|
||||
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
|
||||
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
|
||||
if (isSimpleKey && isSimpleValue) {
|
||||
d.putItem("type", valueType);
|
||||
d.putItem("addr", addOffset(node, valueOffset));
|
||||
} else {
|
||||
#if QT_VERSION >= 0x040500
|
||||
d.putItem("addr", node);
|
||||
// actually, any type (even 'char') will do...
|
||||
d.beginItem("type");
|
||||
d.put(NS"QMapNode<").put(keyType).put(",");
|
||||
d.put(valueType).put(MAP_NODE_TYPE_END);
|
||||
d.endItem();
|
||||
#else
|
||||
d.beginItem("type");
|
||||
d.put(NS"QMapData::Node<").put(keyType).put(",");
|
||||
d.put(valueType).put(MAP_NODE_TYPE_END);
|
||||
d.endItem();
|
||||
d.beginItem("exp");
|
||||
d.put("*('"NS"QMapData::Node<").put(keyType).put(",");
|
||||
d.put(valueType).put(" >'*)").put(node);
|
||||
d.endItem();
|
||||
#endif
|
||||
}
|
||||
d.endHash();
|
||||
|
||||
++i;
|
||||
node = node->forward[0];
|
||||
}
|
||||
d.endChildren();
|
||||
}
|
||||
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQMultiMap(QDumper &d)
|
||||
{
|
||||
qDumpQMap(d);
|
||||
}
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
static void qDumpQModelIndex(QDumper &d)
|
||||
{
|
||||
const QModelIndex *mi = reinterpret_cast<const QModelIndex *>(d.data);
|
||||
|
||||
d.putItem("type", NS"QModelIndex");
|
||||
if (mi->isValid()) {
|
||||
d.beginItem("value");
|
||||
d.put("(").put(mi->row()).put(", ").put(mi->column()).put(")");
|
||||
d.endItem();
|
||||
d.putItem("numchild", 5);
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.putHash("row", mi->row());
|
||||
d.putHash("column", mi->column());
|
||||
|
||||
d.beginHash();
|
||||
d.putItem("name", "parent");
|
||||
const QModelIndex parent = mi->parent();
|
||||
d.beginItem("value");
|
||||
if (parent.isValid())
|
||||
d.put("(").put(parent.row()).put(", ").put(parent.column()).put(")");
|
||||
else
|
||||
d.put("<invalid>");
|
||||
d.endItem();
|
||||
d.beginItem("exp");
|
||||
d.put("(("NSX"QModelIndex"NSY"*)").put(d.data).put(")->parent()");
|
||||
d.endItem();
|
||||
d.putItem("type", NS"QModelIndex");
|
||||
d.putItem("numchild", "1");
|
||||
d.endHash();
|
||||
|
||||
d.putHash("internalId", QString::number(mi->internalId(), 10));
|
||||
|
||||
d.beginHash();
|
||||
d.putItem("name", "model");
|
||||
d.putItem("value", static_cast<const void *>(mi->model()));
|
||||
d.putItem("type", NS"QAbstractItemModel*");
|
||||
d.putItem("numchild", "1");
|
||||
d.endHash();
|
||||
|
||||
d.endChildren();
|
||||
}
|
||||
} else {
|
||||
d.putItem("value", "<invalid>");
|
||||
d.putItem("numchild", 0);
|
||||
}
|
||||
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQObject(QDumper &d)
|
||||
{
|
||||
qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid
|
||||
const QObject *ob = reinterpret_cast<const QObject *>(d.data);
|
||||
const QMetaObject *mo = ob->metaObject();
|
||||
d.putItem("value", ob->objectName());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.putItem("type", NS"QObject");
|
||||
d.putItem("displayedtype", mo->className());
|
||||
d.putItem("numchild", 4);
|
||||
if (d.dumpChildren) {
|
||||
int slotCount = 0;
|
||||
int signalCount = 0;
|
||||
for (int i = mo->methodCount(); --i >= 0; ) {
|
||||
QMetaMethod::MethodType mt = mo->method(i).methodType();
|
||||
signalCount += (mt == QMetaMethod::Signal);
|
||||
slotCount += (mt == QMetaMethod::Slot);
|
||||
}
|
||||
d.beginChildren();
|
||||
d.beginHash();
|
||||
d.putItem("name", "properties");
|
||||
// using 'addr' does not work in gdb as 'exp' is recreated as
|
||||
// (type *)addr, and here we have different 'types':
|
||||
// QObject vs QObjectPropertyList!
|
||||
d.putItem("addr", d.data);
|
||||
d.putItem("type", NS"QObjectPropertyList");
|
||||
d.putItemCount("value", mo->propertyCount());
|
||||
d.putItem("numchild", mo->propertyCount());
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
d.putItem("name", "signals");
|
||||
d.putItem("addr", d.data);
|
||||
d.putItem("type", NS"QObjectSignalList");
|
||||
d.putItemCount("value", signalCount);
|
||||
d.putItem("numchild", signalCount);
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
d.putItem("name", "slots");
|
||||
d.putItem("addr", d.data);
|
||||
d.putItem("type", NS"QObjectSlotList");
|
||||
d.putItemCount("value", slotCount);
|
||||
d.putItem("numchild", slotCount);
|
||||
d.endHash();
|
||||
const QObjectList objectChildren = ob->children();
|
||||
if (!objectChildren.empty()) {
|
||||
d.beginHash();
|
||||
d.putItem("name", "children");
|
||||
d.putItem("addr", d.data);
|
||||
d.putItem("type", NS"QObjectChildList");
|
||||
d.putItemCount("value", objectChildren.size());
|
||||
d.putItem("numchild", objectChildren.size());
|
||||
d.endHash();
|
||||
}
|
||||
d.beginHash();
|
||||
d.putItem("name", "parent");
|
||||
qDumpInnerValueHelper(d, NS"QObject *", ob->parent());
|
||||
d.endHash();
|
||||
#if 1
|
||||
d.beginHash();
|
||||
d.putItem("name", "className");
|
||||
d.putItem("value", ob->metaObject()->className());
|
||||
d.putItem("type", "");
|
||||
d.putItem("numchild", "0");
|
||||
d.endHash();
|
||||
#endif
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
|
||||
#if USE_QT_GUI
|
||||
static const char *sizePolicyEnumValue(QSizePolicy::Policy p)
|
||||
{
|
||||
switch (p) {
|
||||
case QSizePolicy::Fixed:
|
||||
return "Fixed";
|
||||
case QSizePolicy::Minimum:
|
||||
return "Minimum";
|
||||
case QSizePolicy::Maximum:
|
||||
return "Maximum";
|
||||
case QSizePolicy::Preferred:
|
||||
return "Preferred";
|
||||
case QSizePolicy::Expanding:
|
||||
return "Expanding";
|
||||
case QSizePolicy::MinimumExpanding:
|
||||
return "MinimumExpanding";
|
||||
case QSizePolicy::Ignored:
|
||||
break;
|
||||
}
|
||||
return "Ignored";
|
||||
}
|
||||
|
||||
static QString sizePolicyValue(const QSizePolicy &sp)
|
||||
{
|
||||
QString rc;
|
||||
QTextStream str(&rc);
|
||||
// Display as in Designer
|
||||
str << '[' << sizePolicyEnumValue(sp.horizontalPolicy())
|
||||
<< ", " << sizePolicyEnumValue(sp.verticalPolicy())
|
||||
<< ", " << sp.horizontalStretch() << ", " << sp.verticalStretch() << ']';
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void qDumpQVariantHelper(const QVariant *v, QString *value,
|
||||
QString *exp, int *numchild)
|
||||
{
|
||||
switch (v->type()) {
|
||||
case QVariant::Invalid:
|
||||
*value = QLatin1String("<invalid>");
|
||||
*numchild = 0;
|
||||
break;
|
||||
case QVariant::String:
|
||||
*value = QLatin1Char('"') + v->toString() + QLatin1Char('"');
|
||||
*numchild = 0;
|
||||
break;
|
||||
#if QT_VERSION >= 0x040500
|
||||
case QVariant::StringList:
|
||||
*exp = QString(QLatin1String("(*('"NS"QStringList'*)%1)"))
|
||||
.arg((quintptr)v);
|
||||
*numchild = v->toStringList().size();
|
||||
break;
|
||||
#endif
|
||||
case QVariant::Int:
|
||||
*value = QString::number(v->toInt());
|
||||
*numchild= 0;
|
||||
break;
|
||||
case QVariant::Double:
|
||||
*value = QString::number(v->toDouble());
|
||||
*numchild = 0;
|
||||
break;
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
case QVariant::Point: {
|
||||
const QPoint p = v->toPoint();
|
||||
*value = QString::fromLatin1("%1, %2").arg(p.x()).arg(p.y());
|
||||
}
|
||||
*numchild = 0;
|
||||
break;
|
||||
case QVariant::Size: {
|
||||
const QSize size = v->toSize();
|
||||
*value = QString::fromLatin1("%1x%2")
|
||||
.arg(size.width()).arg(size.height());
|
||||
}
|
||||
*numchild = 0;
|
||||
break;
|
||||
case QVariant::Rect: {
|
||||
const QRect rect = v->toRect();
|
||||
*value = QString::fromLatin1("%1x%2+%3+%4")
|
||||
.arg(rect.width()).arg(rect.height())
|
||||
.arg(rect.x()).arg(rect.y());
|
||||
}
|
||||
*numchild = 0;
|
||||
break;
|
||||
case QVariant::PointF: {
|
||||
const QPointF p = v->toPointF();
|
||||
*value = QString::fromLatin1("%1, %2").arg(p.x()).arg(p.y());
|
||||
}
|
||||
*numchild = 0;
|
||||
break;
|
||||
|
||||
case QVariant::SizeF: {
|
||||
const QSizeF size = v->toSizeF();
|
||||
*value = QString::fromLatin1("%1x%2")
|
||||
.arg(size.width()).arg(size.height());
|
||||
}
|
||||
*numchild = 0;
|
||||
break;
|
||||
case QVariant::RectF: {
|
||||
const QRectF rect = v->toRectF();
|
||||
*value = QString::fromLatin1("%1x%2+%3+%4")
|
||||
.arg(rect.width()).arg(rect.height())
|
||||
.arg(rect.x()).arg(rect.y());
|
||||
}
|
||||
*numchild = 0;
|
||||
break;
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
#if USE_QT_GUI
|
||||
case QVariant::Font:
|
||||
*value = qvariant_cast<QFont>(*v).toString();
|
||||
break;
|
||||
case QVariant::Color:
|
||||
*value = qvariant_cast<QColor>(*v).name();
|
||||
break;
|
||||
case QVariant::KeySequence:
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
*value = qvariant_cast<QKeySequence>(*v).toString();
|
||||
#else
|
||||
*value = QString::fromLatin1("Disabled by QT_NO_SHORTCUT");
|
||||
#endif
|
||||
break;
|
||||
case QVariant::SizePolicy:
|
||||
*value = sizePolicyValue(qvariant_cast<QSizePolicy>(*v));
|
||||
break;
|
||||
#endif
|
||||
default: {
|
||||
static const char *qTypeFormat = sizeof(void *) == sizeof(long)
|
||||
? "'"NS"%s "NS"qVariantValue<"NS"%s >'(*('"NS"QVariant'*)0x%lx)"
|
||||
: "'"NS"%s "NS"qVariantValue<"NS"%s >'(*('"NS"QVariant'*)0x%llx)";
|
||||
static const char *nonQTypeFormat = sizeof(void *) == sizeof(long)
|
||||
? "'%s "NS"qVariantValue<%s >'(*('"NS"QVariant'*)0x%lx)"
|
||||
: "'%s "NS"qVariantValue<%s >'(*('"NS"QVariant'*)0x%llx)";
|
||||
char buf[1000];
|
||||
const char *format = (v->typeName()[0] == 'Q') ? qTypeFormat : nonQTypeFormat;
|
||||
qsnprintf(buf, sizeof(buf) - 1, format, v->typeName(), v->typeName(), v);
|
||||
*exp = QLatin1String(buf);
|
||||
*numchild = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void qDumpQVariant(QDumper &d, const QVariant *v)
|
||||
{
|
||||
QString value;
|
||||
QString exp;
|
||||
int numchild = 0;
|
||||
qDumpQVariantHelper(v, &value, &exp, &numchild);
|
||||
bool isInvalid = (v->typeName() == 0);
|
||||
if (isInvalid) {
|
||||
d.putItem("value", "(invalid)");
|
||||
} else if (value.isEmpty()) {
|
||||
d.beginItem("value");
|
||||
d.put("(").put(v->typeName()).put(") ");
|
||||
d.endItem();
|
||||
} else {
|
||||
QByteArray ba;
|
||||
ba += '(';
|
||||
ba += v->typeName();
|
||||
ba += ") ";
|
||||
ba += qPrintable(value);
|
||||
d.putItem("value", ba);
|
||||
d.putItem("valueencoded", "5");
|
||||
}
|
||||
d.putItem("type", NS"QVariant");
|
||||
if (isInvalid || !numchild) {
|
||||
d.putItem("numchild", "0");
|
||||
} else {
|
||||
d.putItem("numchild", "1");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.beginHash();
|
||||
d.putItem("name", "value");
|
||||
if (!exp.isEmpty())
|
||||
d.putItem("exp", qPrintable(exp));
|
||||
if (!value.isEmpty()) {
|
||||
d.putItem("value", value);
|
||||
d.putItem("valueencoded", "4");
|
||||
}
|
||||
d.putItem("type", v->typeName());
|
||||
d.putItem("numchild", numchild);
|
||||
d.endHash();
|
||||
d.endChildren();
|
||||
}
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static inline void qDumpQVariant(QDumper &d)
|
||||
{
|
||||
qCheckAccess(d.data);
|
||||
qDumpQVariant(d, reinterpret_cast<const QVariant *>(d.data));
|
||||
}
|
||||
|
||||
// Meta enumeration helpers
|
||||
static inline void dumpMetaEnumType(QDumper &d, const QMetaEnum &me)
|
||||
{
|
||||
QByteArray type = me.scope();
|
||||
if (!type.isEmpty())
|
||||
type += "::";
|
||||
type += me.name();
|
||||
d.putItem("type", type.constData());
|
||||
}
|
||||
|
||||
static inline void dumpMetaEnumValue(QDumper &d, const QMetaProperty &mop,
|
||||
int value)
|
||||
{
|
||||
|
||||
const QMetaEnum me = mop.enumerator();
|
||||
dumpMetaEnumType(d, me);
|
||||
if (const char *enumValue = me.valueToKey(value)) {
|
||||
d.putItem("value", enumValue);
|
||||
} else {
|
||||
d.putItem("value", value);
|
||||
}
|
||||
d.putItem("numchild", 0);
|
||||
}
|
||||
|
||||
static inline void dumpMetaFlagValue(QDumper &d, const QMetaProperty &mop,
|
||||
int value)
|
||||
{
|
||||
const QMetaEnum me = mop.enumerator();
|
||||
dumpMetaEnumType(d, me);
|
||||
const QByteArray flagsValue = me.valueToKeys(value);
|
||||
if (flagsValue.isEmpty()) {
|
||||
d.putItem("value", value);
|
||||
} else {
|
||||
d.putItem("value", flagsValue.constData());
|
||||
}
|
||||
d.putItem("numchild", 0);
|
||||
}
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
static void qDumpQObjectProperty(QDumper &d)
|
||||
{
|
||||
const QObject *ob = (const QObject *)d.data;
|
||||
const QMetaObject *mob = ob->metaObject();
|
||||
// extract "local.Object.property"
|
||||
QString iname = d.iname;
|
||||
const int dotPos = iname.lastIndexOf(QLatin1Char('.'));
|
||||
if (dotPos == -1)
|
||||
return;
|
||||
iname.remove(0, dotPos + 1);
|
||||
const int index = mob->indexOfProperty(iname.toAscii());
|
||||
if (index == -1)
|
||||
return;
|
||||
const QMetaProperty mop = mob->property(index);
|
||||
const QVariant value = mop.read(ob);
|
||||
const bool isInteger = value.type() == QVariant::Int;
|
||||
if (isInteger && mop.isEnumType()) {
|
||||
dumpMetaEnumValue(d, mop, value.toInt());
|
||||
} else if (isInteger && mop.isFlagType()) {
|
||||
dumpMetaFlagValue(d, mop, value.toInt());
|
||||
} else {
|
||||
qDumpQVariant(d, &value);
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQObjectPropertyList(QDumper &d)
|
||||
{
|
||||
const QObject *ob = (const QObject *)d.data;
|
||||
const QMetaObject *mo = ob->metaObject();
|
||||
const int propertyCount = mo->propertyCount();
|
||||
d.putItem("addr", "<synthetic>");
|
||||
d.putItem("type", NS"QObjectPropertyList");
|
||||
d.putItem("numchild", propertyCount);
|
||||
d.putItemCount("value", propertyCount);
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
for (int i = propertyCount; --i >= 0; ) {
|
||||
const QMetaProperty & prop = mo->property(i);
|
||||
d.beginHash();
|
||||
d.putItem("name", prop.name());
|
||||
switch (prop.type()) {
|
||||
case QVariant::String:
|
||||
d.putItem("type", prop.typeName());
|
||||
d.putItem("value", prop.read(ob).toString());
|
||||
d.putItem("valueencoded", "2");
|
||||
d.putItem("numchild", "0");
|
||||
break;
|
||||
case QVariant::Bool:
|
||||
d.putItem("type", prop.typeName());
|
||||
d.putItem("value", (prop.read(ob).toBool() ? "true" : "false"));
|
||||
d.putItem("numchild", "0");
|
||||
break;
|
||||
case QVariant::Int:
|
||||
if (prop.isEnumType()) {
|
||||
dumpMetaEnumValue(d, prop, prop.read(ob).toInt());
|
||||
} else if (prop.isFlagType()) {
|
||||
dumpMetaFlagValue(d, prop, prop.read(ob).toInt());
|
||||
} else {
|
||||
d.putItem("value", prop.read(ob).toInt());
|
||||
d.putItem("numchild", "0");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
d.putItem("addr", d.data);
|
||||
d.putItem("type", NS"QObjectProperty");
|
||||
d.putItem("numchild", "1");
|
||||
break;
|
||||
}
|
||||
d.endHash();
|
||||
}
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQObjectMethodList(QDumper &d)
|
||||
{
|
||||
const QObject *ob = (const QObject *)d.data;
|
||||
const QMetaObject *mo = ob->metaObject();
|
||||
d.putItem("addr", "<synthetic>");
|
||||
d.putItem("type", NS"QObjectMethodList");
|
||||
d.putItem("numchild", mo->methodCount());
|
||||
if (d.dumpChildren) {
|
||||
d.putItem("childtype", NS"QMetaMethod::Method");
|
||||
d.putItem("childnumchild", "0");
|
||||
d.beginChildren();
|
||||
for (int i = 0; i != mo->methodCount(); ++i) {
|
||||
const QMetaMethod & method = mo->method(i);
|
||||
int mt = method.methodType();
|
||||
d.beginHash();
|
||||
d.beginItem("name");
|
||||
d.put(i).put(" ").put(mo->indexOfMethod(method.signature()));
|
||||
d.put(" ").put(method.signature());
|
||||
d.endItem();
|
||||
d.beginItem("value");
|
||||
d.put((mt == QMetaMethod::Signal ? "<Signal>" : "<Slot>"));
|
||||
d.put(" (").put(mt).put(")");
|
||||
d.endItem();
|
||||
d.endHash();
|
||||
}
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static const char *qConnectionType(uint type)
|
||||
{
|
||||
Qt::ConnectionType connType = static_cast<Qt::ConnectionType>(type);
|
||||
const char *output = "unknown";
|
||||
switch (connType) {
|
||||
case Qt::AutoConnection: output = "auto"; break;
|
||||
case Qt::DirectConnection: output = "direct"; break;
|
||||
case Qt::QueuedConnection: output = "queued"; break;
|
||||
case Qt::BlockingQueuedConnection: output = "blockingqueued"; break;
|
||||
case 3: output = "autocompat"; break;
|
||||
#if QT_VERSION >= 0x040600
|
||||
case Qt::UniqueConnection: break; // Can't happen.
|
||||
#endif
|
||||
};
|
||||
return output;
|
||||
};
|
||||
|
||||
#if QT_VERSION >= 0x040400
|
||||
static const ConnectionList &qConnectionList(const QObject *ob, int signalNumber)
|
||||
{
|
||||
static const ConnectionList emptyList;
|
||||
const ObjectPrivate *p = reinterpret_cast<const ObjectPrivate *>(dfunc(ob));
|
||||
if (!p->connectionLists)
|
||||
return emptyList;
|
||||
typedef QVector<ConnectionList> ConnLists;
|
||||
const ConnLists *lists = reinterpret_cast<const ConnLists *>(p->connectionLists);
|
||||
// there's an optimization making the lists only large enough to hold the
|
||||
// last non-empty item
|
||||
if (signalNumber >= lists->size())
|
||||
return emptyList;
|
||||
return lists->at(signalNumber);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Write party involved in a slot/signal element,
|
||||
// avoid to recursion to self.
|
||||
static inline void qDumpQObjectConnectionPart(QDumper &d,
|
||||
const QObject *owner,
|
||||
const QObject *partner,
|
||||
int number, const char *namePostfix)
|
||||
{
|
||||
d.beginHash();
|
||||
d.beginItem("name");
|
||||
d.put(number).put(namePostfix);
|
||||
d.endItem();
|
||||
if (partner == owner) {
|
||||
d.putItem("value", "<this>");
|
||||
d.putItem("type", owner->metaObject()->className());
|
||||
d.putItem("numchild", 0);
|
||||
d.putItem("addr", owner);
|
||||
} else {
|
||||
qDumpInnerValueHelper(d, NS"QObject *", partner);
|
||||
}
|
||||
d.endHash();
|
||||
}
|
||||
|
||||
static void qDumpQObjectSignal(QDumper &d)
|
||||
{
|
||||
unsigned signalNumber = d.extraInt[0];
|
||||
|
||||
d.putItem("addr", "<synthetic>");
|
||||
d.putItem("numchild", "1");
|
||||
d.putItem("type", NS"QObjectSignal");
|
||||
|
||||
#if QT_VERSION >= 0x040400
|
||||
if (d.dumpChildren) {
|
||||
const QObject *ob = reinterpret_cast<const QObject *>(d.data);
|
||||
d.beginChildren();
|
||||
const ConnectionList &connList = qConnectionList(ob, signalNumber);
|
||||
for (int i = 0; i != connList.size(); ++i) {
|
||||
const Connection &conn = connectionAt(connList, i);
|
||||
qDumpQObjectConnectionPart(d, ob, conn.receiver, i, " receiver");
|
||||
d.beginHash();
|
||||
d.beginItem("name");
|
||||
d.put(i).put(" slot");
|
||||
d.endItem();
|
||||
d.putItem("type", "");
|
||||
if (conn.receiver)
|
||||
d.putItem("value", conn.receiver->metaObject()->method(conn.method).signature());
|
||||
else
|
||||
d.putItem("value", "<invalid receiver>");
|
||||
d.putItem("numchild", "0");
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
d.beginItem("name");
|
||||
d.put(i).put(" type");
|
||||
d.endItem();
|
||||
d.putItem("type", "");
|
||||
d.beginItem("value");
|
||||
d.put("<").put(qConnectionType(conn.connectionType)).put(" connection>");
|
||||
d.endItem();
|
||||
d.putItem("numchild", "0");
|
||||
d.endHash();
|
||||
}
|
||||
d.endChildren();
|
||||
d.putItem("numchild", connList.size());
|
||||
}
|
||||
#endif
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQObjectSignalList(QDumper &d)
|
||||
{
|
||||
const QObject *ob = reinterpret_cast<const QObject *>(d.data);
|
||||
const QMetaObject *mo = ob->metaObject();
|
||||
int count = 0;
|
||||
const int methodCount = mo->methodCount();
|
||||
for (int i = methodCount; --i >= 0; )
|
||||
count += (mo->method(i).methodType() == QMetaMethod::Signal);
|
||||
d.putItem("type", NS"QObjectSignalList");
|
||||
d.putItemCount("value", count);
|
||||
d.putItem("addr", d.data);
|
||||
d.putItem("numchild", count);
|
||||
#if QT_VERSION >= 0x040400
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
for (int i = 0; i != methodCount; ++i) {
|
||||
const QMetaMethod & method = mo->method(i);
|
||||
if (method.methodType() == QMetaMethod::Signal) {
|
||||
int k = mo->indexOfSignal(method.signature());
|
||||
const ConnectionList &connList = qConnectionList(ob, k);
|
||||
d.beginHash();
|
||||
d.putItem("name", k);
|
||||
d.putItem("value", method.signature());
|
||||
d.putItem("numchild", connList.size());
|
||||
d.putItem("addr", d.data);
|
||||
d.putItem("type", NS"QObjectSignal");
|
||||
d.endHash();
|
||||
}
|
||||
}
|
||||
d.endChildren();
|
||||
}
|
||||
#endif
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQObjectSlot(QDumper &d)
|
||||
{
|
||||
int slotNumber = d.extraInt[0];
|
||||
|
||||
d.putItem("addr", d.data);
|
||||
d.putItem("numchild", "1");
|
||||
d.putItem("type", NS"QObjectSlot");
|
||||
|
||||
#if QT_VERSION >= 0x040400
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
int numchild = 0;
|
||||
const QObject *ob = reinterpret_cast<const QObject *>(d.data);
|
||||
const ObjectPrivate *p = reinterpret_cast<const ObjectPrivate *>(dfunc(ob));
|
||||
#if QT_VERSION >= 0x040600
|
||||
int s = 0;
|
||||
for (SenderList senderList = p->senders; senderList != 0;
|
||||
senderList = senderList->next, ++s) {
|
||||
const QObject *sender = senderList->sender;
|
||||
int signal = senderList->method; // FIXME: 'method' is wrong.
|
||||
#else
|
||||
for (int s = 0; s != p->senders.size(); ++s) {
|
||||
const QObject *sender = senderAt(p->senders, s);
|
||||
int signal = signalAt(p->senders, s);
|
||||
#endif
|
||||
const ConnectionList &connList = qConnectionList(sender, signal);
|
||||
for (int i = 0; i != connList.size(); ++i) {
|
||||
const Connection &conn = connectionAt(connList, i);
|
||||
if (conn.receiver == ob && conn.method == slotNumber) {
|
||||
++numchild;
|
||||
const QMetaMethod &method = sender->metaObject()->method(signal);
|
||||
qDumpQObjectConnectionPart(d, ob, sender, s, " sender");
|
||||
d.beginHash();
|
||||
d.beginItem("name");
|
||||
d.put(s).put(" signal");
|
||||
d.endItem();
|
||||
d.putItem("type", "");
|
||||
d.putItem("value", method.signature());
|
||||
d.putItem("numchild", "0");
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
d.beginItem("name");
|
||||
d.put(s).put(" type");
|
||||
d.endItem();
|
||||
d.putItem("type", "");
|
||||
d.beginItem("value");
|
||||
d.put("<").put(qConnectionType(conn.method));
|
||||
d.put(" connection>");
|
||||
d.endItem();
|
||||
d.putItem("numchild", "0");
|
||||
d.endHash();
|
||||
}
|
||||
}
|
||||
}
|
||||
d.endChildren();
|
||||
d.putItem("numchild", numchild);
|
||||
}
|
||||
#endif
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQObjectSlotList(QDumper &d)
|
||||
{
|
||||
const QObject *ob = reinterpret_cast<const QObject *>(d.data);
|
||||
#if QT_VERSION >= 0x040400
|
||||
const ObjectPrivate *p = reinterpret_cast<const ObjectPrivate *>(dfunc(ob));
|
||||
#endif
|
||||
const QMetaObject *mo = ob->metaObject();
|
||||
|
||||
int count = 0;
|
||||
const int methodCount = mo->methodCount();
|
||||
for (int i = methodCount; --i >= 0; )
|
||||
count += (mo->method(i).methodType() == QMetaMethod::Slot);
|
||||
|
||||
d.putItem("numchild", count);
|
||||
d.putItemCount("value", count);
|
||||
d.putItem("type", NS"QObjectSlotList");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
#if QT_VERSION >= 0x040400
|
||||
for (int i = 0; i != methodCount; ++i) {
|
||||
const QMetaMethod & method = mo->method(i);
|
||||
if (method.methodType() == QMetaMethod::Slot) {
|
||||
d.beginHash();
|
||||
int k = mo->indexOfSlot(method.signature());
|
||||
d.putItem("name", k);
|
||||
d.putItem("value", method.signature());
|
||||
|
||||
// count senders. expensive...
|
||||
int numchild = 0;
|
||||
#if QT_VERSION >= 0x040600
|
||||
int s = 0;
|
||||
for (SenderList senderList = p->senders; senderList != 0;
|
||||
senderList = senderList->next, ++s) {
|
||||
const QObject *sender = senderList->sender;
|
||||
int signal = senderList->method; // FIXME: 'method' is wrong.
|
||||
#else
|
||||
for (int s = 0; s != p->senders.size(); ++s) {
|
||||
const QObject *sender = senderAt(p->senders, s);
|
||||
int signal = signalAt(p->senders, s);
|
||||
#endif
|
||||
const ConnectionList &connList = qConnectionList(sender, signal);
|
||||
for (int c = 0; c != connList.size(); ++c) {
|
||||
const Connection &conn = connectionAt(connList, c);
|
||||
if (conn.receiver == ob && conn.method == k)
|
||||
++numchild;
|
||||
}
|
||||
}
|
||||
d.putItem("numchild", numchild);
|
||||
d.putItem("addr", d.data);
|
||||
d.putItem("type", NS"QObjectSlot");
|
||||
d.endHash();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQObjectChildList(QDumper &d)
|
||||
{
|
||||
const QObject *ob = reinterpret_cast<const QObject *>(d.data);
|
||||
const QObjectList children = ob->children();
|
||||
const int size = children.size();
|
||||
|
||||
d.putItem("numchild", size);
|
||||
d.putItemCount("value", size);
|
||||
d.putItem("type", NS"QObjectChildList");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
for (int i = 0; i != size; ++i) {
|
||||
d.beginHash();
|
||||
qDumpInnerValueHelper(d, NS"QObject *", children.at(i));
|
||||
d.endHash();
|
||||
}
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
|
||||
#if USE_QT_GUI
|
||||
static void qDumpQPixmap(QDumper &d)
|
||||
{
|
||||
const QPixmap &im = *reinterpret_cast<const QPixmap *>(d.data);
|
||||
d.beginItem("value");
|
||||
d.put("(").put(im.width()).put("x").put(im.height()).put(")");
|
||||
d.endItem();
|
||||
d.putItem("type", NS"QPixmap");
|
||||
d.putItem("numchild", "0");
|
||||
d.disarm();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
static void qDumpQPoint(QDumper &d)
|
||||
{
|
||||
const QPoint &pnt = *reinterpret_cast<const QPoint *>(d.data);
|
||||
d.beginItem("value");
|
||||
d.put("(").put(pnt.x()).put(", ").put(pnt.y()).put(")");
|
||||
d.endItem();
|
||||
d.putItem("type", NS"QPoint");
|
||||
d.putItem("numchild", "2");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.putHash("x", pnt.x());
|
||||
d.putHash("y", pnt.y());
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQPointF(QDumper &d)
|
||||
{
|
||||
const QPointF &pnt = *reinterpret_cast<const QPointF *>(d.data);
|
||||
d.beginItem("value");
|
||||
d.put("(").put(pnt.x()).put(", ").put(pnt.y()).put(")");
|
||||
d.endItem();
|
||||
d.putItem("type", NS"QPointF");
|
||||
d.putItem("numchild", "2");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.putHash("x", pnt.x());
|
||||
d.putHash("y", pnt.y());
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQRect(QDumper &d)
|
||||
{
|
||||
const QRect &rc = *reinterpret_cast<const QRect *>(d.data);
|
||||
d.beginItem("value");
|
||||
d.put("(").put(rc.width()).put("x").put(rc.height());
|
||||
if (rc.x() >= 0)
|
||||
d.put("+");
|
||||
d.put(rc.x());
|
||||
if (rc.y() >= 0)
|
||||
d.put("+");
|
||||
d.put(rc.y());
|
||||
d.put(")");
|
||||
d.endItem();
|
||||
d.putItem("type", NS"QRect");
|
||||
d.putItem("numchild", "4");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.putHash("x", rc.x());
|
||||
d.putHash("y", rc.y());
|
||||
d.putHash("width", rc.width());
|
||||
d.putHash("height", rc.height());
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQRectF(QDumper &d)
|
||||
{
|
||||
const QRectF &rc = *reinterpret_cast<const QRectF *>(d.data);
|
||||
d.beginItem("value");
|
||||
d.put("(").put(rc.width()).put("x").put(rc.height());
|
||||
if (rc.x() >= 0)
|
||||
d.put("+");
|
||||
d.put(rc.x());
|
||||
if (rc.y() >= 0)
|
||||
d.put("+");
|
||||
d.put(rc.y());
|
||||
d.put(")");
|
||||
d.endItem();
|
||||
d.putItem("type", NS"QRectF");
|
||||
d.putItem("numchild", "4");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.putHash("x", rc.x());
|
||||
d.putHash("y", rc.y());
|
||||
d.putHash("width", rc.width());
|
||||
d.putHash("height", rc.height());
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
#endif
|
||||
|
||||
static void qDumpQSet(QDumper &d)
|
||||
{
|
||||
// This uses the knowledge that QHash<T> has only a single member
|
||||
// of union { QHashData *d; QHashNode<Key, T> *e; };
|
||||
QHashData *hd = *(QHashData**)d.data;
|
||||
QHashData::Node *node = hd->firstNode();
|
||||
|
||||
int n = hd->size;
|
||||
if (n < 0)
|
||||
return;
|
||||
if (n > 0) {
|
||||
qCheckAccess(node);
|
||||
qCheckPointer(node->next);
|
||||
}
|
||||
|
||||
d.putItemCount("value", n);
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("numchild", 2 * n);
|
||||
if (d.dumpChildren) {
|
||||
if (n > 100)
|
||||
n = 100;
|
||||
d.beginChildren();
|
||||
int i = 0;
|
||||
for (int bucket = 0; bucket != hd->numBuckets && i <= 10000; ++bucket) {
|
||||
for (node = hd->buckets[bucket]; node->next; node = node->next) {
|
||||
d.beginHash();
|
||||
d.putItem("type", d.innerType);
|
||||
d.beginItem("exp");
|
||||
d.put("(('"NS"QHashNode<").put(d.innerType
|
||||
).put(","NS"QHashDummyValue>'*)"
|
||||
).put(static_cast<const void*>(node)).put(")->key");
|
||||
d.endItem();
|
||||
d.endHash();
|
||||
++i;
|
||||
if (i > 10000) {
|
||||
d.putEllipsis();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
#if QT_VERSION >= 0x040500
|
||||
static void qDumpQSharedPointer(QDumper &d)
|
||||
{
|
||||
const QSharedPointer<int> &ptr =
|
||||
*reinterpret_cast<const QSharedPointer<int> *>(d.data);
|
||||
|
||||
if (ptr.isNull()) {
|
||||
d.putItem("value", "<null>");
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("numchild", 0);
|
||||
d.disarm();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSimpleType(d.innerType))
|
||||
qDumpInnerValueHelper(d, d.innerType, ptr.data());
|
||||
else
|
||||
d.putItem("value", "");
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("numchild", 1);
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.beginHash();
|
||||
d.putItem("name", "data");
|
||||
qDumpInnerValue(d, d.innerType, ptr.data());
|
||||
d.endHash();
|
||||
const int v = sizeof(void *);
|
||||
d.beginHash();
|
||||
const void *weak = addOffset(deref(addOffset(d.data, v)), v);
|
||||
d.putItem("name", "weakref");
|
||||
d.putItem("value", *static_cast<const int *>(weak));
|
||||
d.putItem("type", "int");
|
||||
d.putItem("addr", weak);
|
||||
d.putItem("numchild", "0");
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
const void *strong = addOffset(weak, sizeof(int));
|
||||
d.putItem("name", "strongref");
|
||||
d.putItem("value", *static_cast<const int *>(strong));
|
||||
d.putItem("type", "int");
|
||||
d.putItem("addr", strong);
|
||||
d.putItem("numchild", "0");
|
||||
d.endHash();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
#endif // QT_VERSION >= 0x040500
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
|
||||
static void qDumpQString(QDumper &d)
|
||||
{
|
||||
//qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid
|
||||
const QString &str = *reinterpret_cast<const QString *>(d.data);
|
||||
|
||||
const int size = str.size();
|
||||
if (size < 0)
|
||||
return;
|
||||
if (size) {
|
||||
const QChar *unicode = str.unicode();
|
||||
qCheckAccess(unicode);
|
||||
qCheckAccess(unicode + size);
|
||||
if (!unicode[size].isNull()) // must be '\0' terminated
|
||||
return;
|
||||
}
|
||||
|
||||
d.putStringValue(str);
|
||||
d.putItem("type", NS"QString");
|
||||
//d.putItem("editvalue", str); // handled generically below
|
||||
d.putItem("numchild", "0");
|
||||
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQStringList(QDumper &d)
|
||||
{
|
||||
qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid
|
||||
const QStringList &list = *reinterpret_cast<const QStringList *>(d.data);
|
||||
int n = list.size();
|
||||
if (n < 0)
|
||||
return;
|
||||
if (n > 0) {
|
||||
qCheckAccess(&list.front());
|
||||
qCheckAccess(&list.back());
|
||||
}
|
||||
|
||||
d.putItemCount("value", n);
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("numchild", n);
|
||||
if (d.dumpChildren) {
|
||||
if (n > 1000)
|
||||
n = 1000;
|
||||
d.beginChildren(n ? NS"QString" : 0);
|
||||
for (int i = 0; i != n; ++i) {
|
||||
d.beginHash();
|
||||
d.putStringValue(list.at(i));
|
||||
d.endHash();
|
||||
}
|
||||
if (n < list.size())
|
||||
d.putEllipsis();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQTextCodec(QDumper &d)
|
||||
{
|
||||
qCheckPointer(deref(d.data));
|
||||
const QTextCodec &codec = *reinterpret_cast<const QTextCodec *>(d.data);
|
||||
d.putItem("value", codec.name());
|
||||
d.putItem("valueencoded", "1");
|
||||
d.putItem("type", NS"QTextCodec");
|
||||
d.putItem("numchild", "2");
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.putHash("name", codec.name());
|
||||
d.putHash("mibEnum", codec.mibEnum());
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpQVector(QDumper &d)
|
||||
{
|
||||
qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid
|
||||
QVectorTypedData<int> *dummy = 0;
|
||||
const unsigned typeddatasize = (char*)(&dummy->array) - (char*)dummy;
|
||||
|
||||
QVectorData *v = *reinterpret_cast<QVectorData *const*>(d.data);
|
||||
|
||||
// Try to provoke segfaults early to prevent the frontend
|
||||
// from asking for unavailable child details
|
||||
int nn = v->size;
|
||||
if (nn < 0)
|
||||
return;
|
||||
const bool innerIsPointerType = isPointerType(d.innerType);
|
||||
const unsigned innersize = d.extraInt[0];
|
||||
const int n = qMin(nn, 1000);
|
||||
// Check pointers
|
||||
if (innerIsPointerType && nn > 0)
|
||||
for (int i = 0; i != n; ++i)
|
||||
if (const void *p = addOffset(v, i * innersize + typeddatasize))
|
||||
qCheckPointer(deref(p));
|
||||
|
||||
d.putItemCount("value", n);
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("numchild", nn);
|
||||
if (d.dumpChildren) {
|
||||
QByteArray strippedInnerType = stripPointerType(d.innerType);
|
||||
const char *stripped = innerIsPointerType ? strippedInnerType.data() : 0;
|
||||
d.beginChildren(d.innerType);
|
||||
for (int i = 0; i != n; ++i) {
|
||||
d.beginHash();
|
||||
qDumpInnerValueOrPointer(d, d.innerType, stripped,
|
||||
addOffset(v, i * innersize + typeddatasize));
|
||||
d.endHash();
|
||||
}
|
||||
if (n < nn)
|
||||
d.putEllipsis();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
#if QT_VERSION >= 0x040500
|
||||
static void qDumpQWeakPointer(QDumper &d)
|
||||
{
|
||||
const int v = sizeof(void *);
|
||||
const void *value = deref(addOffset(d.data, v));
|
||||
const void *data = deref(d.data);
|
||||
|
||||
if (value == 0 || data == 0) {
|
||||
d.putItem("value", "<null>");
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("numchild", 0);
|
||||
d.disarm();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSimpleType(d.innerType))
|
||||
qDumpInnerValueHelper(d, d.innerType, value);
|
||||
else
|
||||
d.putItem("value", "");
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("numchild", 1);
|
||||
if (d.dumpChildren) {
|
||||
d.beginChildren();
|
||||
d.beginHash();
|
||||
d.putItem("name", "data");
|
||||
qDumpInnerValue(d, d.innerType, value);
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
const void *weak = addOffset(deref(d.data), v);
|
||||
d.putItem("name", "weakref");
|
||||
d.putItem("value", *static_cast<const int *>(weak));
|
||||
d.putItem("type", "int");
|
||||
d.putItem("addr", weak);
|
||||
d.putItem("numchild", "0");
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
const void *strong = addOffset(weak, sizeof(int));
|
||||
d.putItem("name", "strongref");
|
||||
d.putItem("value", *static_cast<const int *>(strong));
|
||||
d.putItem("type", "int");
|
||||
d.putItem("addr", strong);
|
||||
d.putItem("numchild", "0");
|
||||
d.endHash();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
#endif // QT_VERSION >= 0x040500
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
|
||||
#ifdef Q_CC_MSVC
|
||||
// A friendly list that grants access to its head.
|
||||
template <class T> class FriendlyList : public std::list<T> {
|
||||
public:
|
||||
typedef _Node Node;
|
||||
static const Node *head(const std::list<T> *list) {
|
||||
return static_cast<const FriendlyList *>(list)->_Myhead;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
static void qDumpStdList(QDumper &d)
|
||||
{
|
||||
const std::list<int> &list = *reinterpret_cast<const std::list<int> *>(d.data);
|
||||
#ifdef Q_CC_MSVC
|
||||
/* Extensive checks to avoid _HAS_ITERATOR_DEBUGGING asserts at all cost.
|
||||
* Examine the head element which is present in empty lists as well.
|
||||
* It could be even further checked if the type was known. */
|
||||
const void *head = FriendlyList<int>::head(&list);
|
||||
qCheckAccess(head);
|
||||
const int size = static_cast<int>(list.size());
|
||||
if (size < 0)
|
||||
return;
|
||||
if (size)
|
||||
qCheckAccess(list.begin().operator ->());
|
||||
#else
|
||||
const void *p = d.data;
|
||||
qCheckAccess(p);
|
||||
p = deref(p);
|
||||
qCheckAccess(p);
|
||||
p = deref(p);
|
||||
qCheckAccess(p);
|
||||
p = deref(addOffset(d.data, sizeof(void*)));
|
||||
qCheckAccess(p);
|
||||
p = deref(addOffset(p, sizeof(void*)));
|
||||
qCheckAccess(p);
|
||||
p = deref(addOffset(p, sizeof(void*)));
|
||||
qCheckAccess(p);
|
||||
#endif
|
||||
int nn = 0;
|
||||
std::list<int>::const_iterator it = list.begin();
|
||||
const std::list<int>::const_iterator cend = list.end();
|
||||
for (; nn < 101 && it != cend; ++nn, ++it)
|
||||
qCheckAccess(it.operator->());
|
||||
|
||||
if (nn > 100)
|
||||
d.putItem("value", "<more than 100 items>");
|
||||
else
|
||||
d.putItemCount("value", nn);
|
||||
d.putItem("numchild", nn);
|
||||
|
||||
d.putItem("valueeditable", "false");
|
||||
if (d.dumpChildren) {
|
||||
QByteArray strippedInnerType = stripPointerType(d.innerType);
|
||||
const char *stripped =
|
||||
isPointerType(d.innerType) ? strippedInnerType.data() : 0;
|
||||
d.beginChildren(d.innerType);
|
||||
it = list.begin();
|
||||
for (int i = 0; i < 1000 && it != cend; ++i, ++it) {
|
||||
d.beginHash();
|
||||
qDumpInnerValueOrPointer(d, d.innerType, stripped, it.operator->());
|
||||
d.endHash();
|
||||
}
|
||||
if (it != list.end())
|
||||
d.putEllipsis();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
#ifdef Q_CC_MSVC
|
||||
// A friendly red-black tree that is able to access the node type and head
|
||||
// pointer. The class _Tree is used for the std::map/std::set implementations in
|
||||
// MS VS CC. It has a head element pointer (with left and right) that exists
|
||||
// even if it is empty. Provides a check() function to perform extensive checks
|
||||
// to avoid _HAS_ITERATOR_DEBUGGING asserts at all cost.
|
||||
template <class RedBlackTreeTraits> class FriendlyRedBlackTree : public std::_Tree<RedBlackTreeTraits> {
|
||||
public:
|
||||
static inline void check(const std::_Tree<RedBlackTreeTraits> *fs, bool *ok);
|
||||
};
|
||||
|
||||
template <class RedBlackTreeTraits>
|
||||
void FriendlyRedBlackTree<RedBlackTreeTraits>::check(const std::_Tree<RedBlackTreeTraits> *fs, bool *ok)
|
||||
{
|
||||
*ok = false;
|
||||
const FriendlyRedBlackTree *friendlyTree = static_cast<const FriendlyRedBlackTree*>(fs);
|
||||
// Check the red/black tree
|
||||
const _Node *head = friendlyTree->_Myhead;
|
||||
qCheckAccess(head);
|
||||
if (head->_Color != _Red && head->_Color != _Black)
|
||||
return;
|
||||
const _Node *left = head->_Left;
|
||||
if (left && left != head) {
|
||||
qCheckAccess(left);
|
||||
if (left->_Color != _Red && left->_Color != _Black)
|
||||
return;
|
||||
}
|
||||
const _Node *right= head->_Right;
|
||||
if (right && right != left) {
|
||||
qCheckAccess(right);
|
||||
if (right->_Color != _Red && right->_Color != _Black)
|
||||
return;
|
||||
}
|
||||
*ok = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Dump out an arbitrary map. To iterate the map,
|
||||
* it is cast to a map of <KeyType,Value>. 'int' can be used for both
|
||||
* for all types if the implementation does not depend on the types
|
||||
* which is the case for GNU STL. The implementation used by MS VC, however,
|
||||
* does depend on the key/value type, so, special cases need to be hardcoded. */
|
||||
|
||||
template <class KeyType, class ValueType>
|
||||
static void qDumpStdMapHelper(QDumper &d)
|
||||
{
|
||||
typedef std::map<KeyType, ValueType> DummyType;
|
||||
const DummyType &map = *reinterpret_cast<const DummyType*>(d.data);
|
||||
const char *keyType = d.templateParameters[0];
|
||||
const char *valueType = d.templateParameters[1];
|
||||
const void *p = d.data;
|
||||
qCheckAccess(p);
|
||||
|
||||
const int nn = map.size();
|
||||
if (nn < 0)
|
||||
return;
|
||||
#ifdef Q_CC_MSVC
|
||||
// Additional checks to avoid _HAS_ITERATOR_DEBUGGING asserts
|
||||
typedef std::pair<const KeyType, ValueType> RedBlackTreeEntryType;
|
||||
typedef std::_Tmap_traits<KeyType, ValueType, std::less<KeyType>, std::allocator<RedBlackTreeEntryType>, false>
|
||||
MapRedBlackTreeTraits;
|
||||
bool ok;
|
||||
FriendlyRedBlackTree<MapRedBlackTreeTraits>::check(&map, &ok);
|
||||
if (!ok)
|
||||
return;
|
||||
#endif
|
||||
Q_TYPENAME DummyType::const_iterator it = map.begin();
|
||||
const Q_TYPENAME DummyType::const_iterator cend = map.end();
|
||||
for (int i = 0; i < nn && i < 10 && it != cend; ++i, ++it)
|
||||
qCheckAccess(it.operator->());
|
||||
|
||||
const QByteArray strippedInnerType = stripPointerType(d.innerType);
|
||||
d.putItem("numchild", nn);
|
||||
d.putItemCount("value", nn);
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("valueoffset", d.extraInt[2]);
|
||||
|
||||
// HACK: we need a properly const qualified version of the
|
||||
// std::pair used. We extract it from the allocator parameter
|
||||
// (#4, "std::allocator<std::pair<key, value> >")
|
||||
// as it is there, and, equally importantly, in an order that
|
||||
// gdb accepts when fed with it.
|
||||
char *pairType = (char *)(d.templateParameters[3]) + 15;
|
||||
pairType[strlen(pairType) - 2] = 0;
|
||||
d.putItem("pairtype", pairType);
|
||||
|
||||
if (d.dumpChildren) {
|
||||
bool isSimpleKey = isSimpleType(keyType);
|
||||
bool isSimpleValue = isSimpleType(valueType);
|
||||
int valueOffset = d.extraInt[2];
|
||||
|
||||
d.beginItem("extra");
|
||||
d.put("isSimpleKey: ").put(isSimpleKey);
|
||||
d.put(" isSimpleValue: ").put(isSimpleValue);
|
||||
d.put(" valueType: '").put(valueType);
|
||||
d.put(" valueOffset: ").put(valueOffset);
|
||||
d.endItem();
|
||||
|
||||
d.beginChildren(d.innerType);
|
||||
it = map.begin();
|
||||
for (int i = 0; i < 1000 && it != cend; ++i, ++it) {
|
||||
d.beginHash();
|
||||
const void *node = it.operator->();
|
||||
qDumpInnerValueHelper(d, keyType, node, "key");
|
||||
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
|
||||
if (isSimpleKey && isSimpleValue) {
|
||||
d.putItem("type", valueType);
|
||||
d.putItem("addr", addOffset(node, valueOffset));
|
||||
d.putItem("numchild", 0);
|
||||
} else {
|
||||
d.putItem("addr", node);
|
||||
d.putItem("type", pairType);
|
||||
d.putItem("numchild", 2);
|
||||
}
|
||||
d.endHash();
|
||||
}
|
||||
if (it != map.end())
|
||||
d.putEllipsis();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpStdMap(QDumper &d)
|
||||
{
|
||||
#ifdef Q_CC_MSVC
|
||||
// As the map implementation inherits from a base class
|
||||
// depending on the key, use something equivalent to iterate it.
|
||||
const int keySize = d.extraInt[0];
|
||||
const int valueSize = d.extraInt[1];
|
||||
if (keySize == valueSize) {
|
||||
if (keySize == sizeof(int)) {
|
||||
qDumpStdMapHelper<int,int>(d);
|
||||
return;
|
||||
}
|
||||
if (keySize == sizeof(std::string)) {
|
||||
qDumpStdMapHelper<std::string,std::string>(d);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (keySize == sizeof(int) && valueSize == sizeof(std::string)) {
|
||||
qDumpStdMapHelper<int,std::string>(d);
|
||||
return;
|
||||
}
|
||||
if (keySize == sizeof(std::string) && valueSize == sizeof(int)) {
|
||||
qDumpStdMapHelper<std::string,int>(d);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
qDumpStdMapHelper<int,int>(d);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Dump out an arbitrary set. To iterate the set,
|
||||
* it is cast to a set of <KeyType>. 'int' can be used
|
||||
* for all types if the implementation does not depend on the key type
|
||||
* which is the case for GNU STL. The implementation used by MS VC, however,
|
||||
* does depend on the key type, so, special cases need to be hardcoded. */
|
||||
|
||||
template <class KeyType>
|
||||
static void qDumpStdSetHelper(QDumper &d)
|
||||
{
|
||||
typedef std::set<KeyType> DummyType;
|
||||
const DummyType &set = *reinterpret_cast<const DummyType*>(d.data);
|
||||
const void *p = d.data;
|
||||
qCheckAccess(p);
|
||||
|
||||
const int nn = set.size();
|
||||
if (nn < 0)
|
||||
return;
|
||||
#ifdef Q_CC_MSVC
|
||||
// Additional checks to avoid _HAS_ITERATOR_DEBUGGING asserts
|
||||
typedef std::_Tset_traits<KeyType, std::less<KeyType> , std::allocator<KeyType>, false>
|
||||
SetRedBlackTreeTraits;
|
||||
bool ok;
|
||||
FriendlyRedBlackTree<SetRedBlackTreeTraits>::check(&set, &ok);
|
||||
if (!ok)
|
||||
return;
|
||||
#endif
|
||||
Q_TYPENAME DummyType::const_iterator it = set.begin();
|
||||
const Q_TYPENAME DummyType::const_iterator cend = set.end();
|
||||
for (int i = 0; i < nn && i < 10 && it != cend; ++i, ++it)
|
||||
qCheckAccess(it.operator->());
|
||||
|
||||
d.putItemCount("value", nn);
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("numchild", nn);
|
||||
d.putItem("valueoffset", d.extraInt[0]);
|
||||
|
||||
if (d.dumpChildren) {
|
||||
int valueOffset = 0; // d.extraInt[0];
|
||||
QByteArray strippedInnerType = stripPointerType(d.innerType);
|
||||
const char *stripped =
|
||||
isPointerType(d.innerType) ? strippedInnerType.data() : 0;
|
||||
|
||||
d.beginItem("extra");
|
||||
d.put("valueOffset: ").put(valueOffset);
|
||||
d.endItem();
|
||||
|
||||
d.beginChildren(d.innerType);
|
||||
it = set.begin();
|
||||
for (int i = 0; i < 1000 && it != cend; ++i, ++it) {
|
||||
const void *node = it.operator->();
|
||||
d.beginHash();
|
||||
qDumpInnerValueOrPointer(d, d.innerType, stripped, node);
|
||||
d.endHash();
|
||||
}
|
||||
if (it != set.end())
|
||||
d.putEllipsis();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpStdSet(QDumper &d)
|
||||
{
|
||||
#ifdef Q_CC_MSVC
|
||||
// As the set implementation inherits from a base class
|
||||
// depending on the key, use something equivalent to iterate it.
|
||||
const int innerSize = d.extraInt[0];
|
||||
if (innerSize == sizeof(int)) {
|
||||
qDumpStdSetHelper<int>(d);
|
||||
return;
|
||||
}
|
||||
if (innerSize == sizeof(std::string)) {
|
||||
qDumpStdSetHelper<std::string>(d);
|
||||
return;
|
||||
}
|
||||
if (innerSize == sizeof(std::wstring)) {
|
||||
qDumpStdSetHelper<std::wstring>(d);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
qDumpStdSetHelper<int>(d);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void qDumpStdString(QDumper &d)
|
||||
{
|
||||
const std::string &str = *reinterpret_cast<const std::string *>(d.data);
|
||||
|
||||
const std::string::size_type size = str.size();
|
||||
if (int(size) < 0)
|
||||
return;
|
||||
if (size) {
|
||||
qCheckAccess(str.c_str());
|
||||
qCheckAccess(str.c_str() + size - 1);
|
||||
}
|
||||
qDumpStdStringValue(d, str);
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpStdWString(QDumper &d)
|
||||
{
|
||||
const std::wstring &str = *reinterpret_cast<const std::wstring *>(d.data);
|
||||
const std::wstring::size_type size = str.size();
|
||||
if (int(size) < 0)
|
||||
return;
|
||||
if (size) {
|
||||
qCheckAccess(str.c_str());
|
||||
qCheckAccess(str.c_str() + size - 1);
|
||||
}
|
||||
qDumpStdWStringValue(d, str);
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpStdVector(QDumper &d)
|
||||
{
|
||||
// Correct type would be something like:
|
||||
// std::_Vector_base<int,std::allocator<int, std::allocator<int> >>::_Vector_impl
|
||||
struct VectorImpl {
|
||||
char *start;
|
||||
char *finish;
|
||||
char *end_of_storage;
|
||||
};
|
||||
#ifdef Q_CC_MSVC
|
||||
// Pointers are at end of the structure
|
||||
const char * vcp = static_cast<const char *>(d.data);
|
||||
const VectorImpl *v = reinterpret_cast<const VectorImpl *>(vcp + sizeof(std::vector<int>) - sizeof(VectorImpl));
|
||||
#else
|
||||
const VectorImpl *v = static_cast<const VectorImpl *>(d.data);
|
||||
#endif
|
||||
// Try to provoke segfaults early to prevent the frontend
|
||||
// from asking for unavailable child details
|
||||
int nn = (v->finish - v->start) / d.extraInt[0];
|
||||
if (nn < 0)
|
||||
return;
|
||||
if (nn > 0) {
|
||||
qCheckAccess(v->start);
|
||||
qCheckAccess(v->finish);
|
||||
qCheckAccess(v->end_of_storage);
|
||||
}
|
||||
|
||||
int n = nn;
|
||||
d.putItemCount("value", n);
|
||||
d.putItem("valueeditable", "false");
|
||||
d.putItem("numchild", n);
|
||||
if (d.dumpChildren) {
|
||||
unsigned innersize = d.extraInt[0];
|
||||
QByteArray strippedInnerType = stripPointerType(d.innerType);
|
||||
const char *stripped =
|
||||
isPointerType(d.innerType) ? strippedInnerType.data() : 0;
|
||||
if (n > 1000)
|
||||
n = 1000;
|
||||
d.beginChildren(n ? d.innerType : 0);
|
||||
for (int i = 0; i != n; ++i) {
|
||||
d.beginHash();
|
||||
qDumpInnerValueOrPointer(d, d.innerType, stripped,
|
||||
addOffset(v->start, i * innersize));
|
||||
d.endHash();
|
||||
}
|
||||
if (n < nn)
|
||||
d.putEllipsis();
|
||||
d.endChildren();
|
||||
}
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
static void qDumpStdVectorBool(QDumper &d)
|
||||
{
|
||||
// FIXME
|
||||
return qDumpStdVector(d);
|
||||
}
|
||||
|
||||
static void handleProtocolVersion2and3(QDumper &d)
|
||||
{
|
||||
if (!d.outerType[0]) {
|
||||
qDumpUnknown(d);
|
||||
return;
|
||||
}
|
||||
#ifdef Q_CC_MSVC // Catch exceptions with MSVC/CDB
|
||||
__try {
|
||||
#endif
|
||||
|
||||
d.setupTemplateParameters();
|
||||
d.putItem("iname", d.iname);
|
||||
if (d.data)
|
||||
d.putItem("addr", d.data);
|
||||
|
||||
#ifdef QT_NO_QDATASTREAM
|
||||
if (d.protocolVersion == 3) {
|
||||
QVariant::Type type = QVariant::nameToType(d.outerType);
|
||||
if (type != QVariant::Invalid) {
|
||||
QVariant v(type, d.data);
|
||||
QByteArray ba;
|
||||
QDataStream ds(&ba, QIODevice::WriteOnly);
|
||||
ds << v;
|
||||
d.putItem("editvalue", ba);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *type = stripNamespace(d.outerType);
|
||||
// type[0] is usally 'Q', so don't use it
|
||||
switch (type[1]) {
|
||||
case 'a':
|
||||
if (isEqual(type, "map"))
|
||||
qDumpStdMap(d);
|
||||
break;
|
||||
case 'A':
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
if (isEqual(type, "QAbstractItemModel"))
|
||||
qDumpQAbstractItemModel(d);
|
||||
else if (isEqual(type, "QAbstractItem"))
|
||||
qDumpQAbstractItem(d);
|
||||
#endif
|
||||
break;
|
||||
case 'B':
|
||||
if (isEqual(type, "QByteArray"))
|
||||
qDumpQByteArray(d);
|
||||
break;
|
||||
case 'C':
|
||||
if (isEqual(type, "QChar"))
|
||||
qDumpQChar(d);
|
||||
break;
|
||||
case 'D':
|
||||
if (isEqual(type, "QDateTime"))
|
||||
qDumpQDateTime(d);
|
||||
else if (isEqual(type, "QDir"))
|
||||
qDumpQDir(d);
|
||||
break;
|
||||
case 'e':
|
||||
if (isEqual(type, "vector"))
|
||||
qDumpStdVector(d);
|
||||
else if (isEqual(type, "set"))
|
||||
qDumpStdSet(d);
|
||||
break;
|
||||
case 'F':
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
if (isEqual(type, "QFile"))
|
||||
qDumpQFile(d);
|
||||
else if (isEqual(type, "QFileInfo"))
|
||||
qDumpQFileInfo(d);
|
||||
#endif
|
||||
break;
|
||||
case 'H':
|
||||
if (isEqual(type, "QHash"))
|
||||
qDumpQHash(d);
|
||||
else if (isEqual(type, "QHashNode"))
|
||||
qDumpQHashNode(d);
|
||||
break;
|
||||
case 'i':
|
||||
if (isEqual(type, "list"))
|
||||
qDumpStdList(d);
|
||||
break;
|
||||
case 'I':
|
||||
#if USE_QT_GUI
|
||||
if (isEqual(type, "QImage"))
|
||||
qDumpQImage(d);
|
||||
else if (isEqual(type, "QImageData"))
|
||||
qDumpQImageData(d);
|
||||
#endif
|
||||
break;
|
||||
case 'L':
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
if (isEqual(type, "QList"))
|
||||
qDumpQList(d);
|
||||
else if (isEqual(type, "QLinkedList"))
|
||||
qDumpQLinkedList(d);
|
||||
else if (isEqual(type, "QLocale"))
|
||||
qDumpQLocale(d);
|
||||
#endif
|
||||
break;
|
||||
case 'M':
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
if (isEqual(type, "QMap"))
|
||||
qDumpQMap(d);
|
||||
else if (isEqual(type, "QMapNode"))
|
||||
qDumpQMapNode(d);
|
||||
else if (isEqual(type, "QModelIndex"))
|
||||
qDumpQModelIndex(d);
|
||||
else if (isEqual(type, "QMultiMap"))
|
||||
qDumpQMultiMap(d);
|
||||
#endif
|
||||
break;
|
||||
case 'O':
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
if (isEqual(type, "QObject"))
|
||||
qDumpQObject(d);
|
||||
else if (isEqual(type, "QObjectPropertyList"))
|
||||
qDumpQObjectPropertyList(d);
|
||||
else if (isEqual(type, "QObjectProperty"))
|
||||
qDumpQObjectProperty(d);
|
||||
else if (isEqual(type, "QObjectMethodList"))
|
||||
qDumpQObjectMethodList(d);
|
||||
else if (isEqual(type, "QObjectSignal"))
|
||||
qDumpQObjectSignal(d);
|
||||
else if (isEqual(type, "QObjectSignalList"))
|
||||
qDumpQObjectSignalList(d);
|
||||
else if (isEqual(type, "QObjectSlot"))
|
||||
qDumpQObjectSlot(d);
|
||||
else if (isEqual(type, "QObjectSlotList"))
|
||||
qDumpQObjectSlotList(d);
|
||||
else if (isEqual(type, "QObjectChildList"))
|
||||
qDumpQObjectChildList(d);
|
||||
#endif
|
||||
break;
|
||||
case 'P':
|
||||
#if USE_QT_GUI
|
||||
if (isEqual(type, "QPixmap"))
|
||||
qDumpQPixmap(d);
|
||||
#endif
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
if (isEqual(type, "QPoint"))
|
||||
qDumpQPoint(d);
|
||||
else if (isEqual(type, "QPointF"))
|
||||
qDumpQPointF(d);
|
||||
#endif
|
||||
break;
|
||||
case 'R':
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
if (isEqual(type, "QRect"))
|
||||
qDumpQRect(d);
|
||||
else if (isEqual(type, "QRectF"))
|
||||
qDumpQRectF(d);
|
||||
#endif
|
||||
break;
|
||||
case 'S':
|
||||
if (isEqual(type, "QString"))
|
||||
qDumpQString(d);
|
||||
else if (isEqual(type, "QStringList"))
|
||||
qDumpQStringList(d);
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
else if (isEqual(type, "QSet"))
|
||||
qDumpQSet(d);
|
||||
else if (isEqual(type, "QStack"))
|
||||
qDumpQVector(d);
|
||||
#if QT_VERSION >= 0x040500
|
||||
else if (isEqual(type, "QSharedPointer"))
|
||||
qDumpQSharedPointer(d);
|
||||
#endif
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
break;
|
||||
case 's':
|
||||
if (isEqual(type, "wstring"))
|
||||
qDumpStdWString(d);
|
||||
break;
|
||||
case 't':
|
||||
if (isEqual(type, "std::vector"))
|
||||
qDumpStdVector(d);
|
||||
else if (isEqual(type, "std::vector::bool"))
|
||||
qDumpStdVectorBool(d);
|
||||
else if (isEqual(type, "std::list"))
|
||||
qDumpStdList(d);
|
||||
else if (isEqual(type, "std::map"))
|
||||
qDumpStdMap(d);
|
||||
else if (isEqual(type, "std::set"))
|
||||
qDumpStdSet(d);
|
||||
else if (isEqual(type, "std::string") || isEqual(type, "string"))
|
||||
qDumpStdString(d);
|
||||
else if (isEqual(type, "std::wstring"))
|
||||
qDumpStdWString(d);
|
||||
break;
|
||||
case 'T':
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
if (isEqual(type, "QTextCodec"))
|
||||
qDumpQTextCodec(d);
|
||||
#endif
|
||||
break;
|
||||
case 'V':
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
if (isEqual(type, "QVariantList")) { // resolve typedef
|
||||
d.outerType = "QList";
|
||||
d.innerType = "QVariant";
|
||||
d.extraInt[0] = sizeof(QVariant);
|
||||
qDumpQList(d);
|
||||
} else if (isEqual(type, "QVariant")) {
|
||||
qDumpQVariant(d);
|
||||
} else if (isEqual(type, "QVector")) {
|
||||
qDumpQVector(d);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 'W':
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
#if QT_VERSION >= 0x040500
|
||||
if (isEqual(type, "QWeakPointer"))
|
||||
qDumpQWeakPointer(d);
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
if (!d.success)
|
||||
qDumpUnknown(d);
|
||||
#ifdef Q_CC_MSVC // Catch exceptions with MSVC/CDB
|
||||
} __except(EXCEPTION_EXECUTE_HANDLER) {
|
||||
qDumpUnknown(d, DUMPUNKNOWN_MESSAGE" <exception>");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
#if USE_QT_GUI
|
||||
extern "C" Q_DECL_EXPORT
|
||||
void *watchPoint(int x, int y)
|
||||
{
|
||||
return QApplication::widgetAt(x, y);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Helpers to write out common expression values for CDB
|
||||
#ifdef Q_CC_MSVC
|
||||
// Offsets of a map node value which looks like
|
||||
// "(size_t)&(((QMapNode<int,int> *)0)->value)-0"
|
||||
template <class Key, class Value>
|
||||
inline QDumper & putQMapNodeOffsetExpression(const char *keyType,
|
||||
const char *valueType,
|
||||
QDumper &d)
|
||||
{
|
||||
QMapNode<Key, Value> *mn = 0;
|
||||
const int valueOffset = (char *)&(mn->value) - (char*)mn;
|
||||
d.put("[\"(size_t)&((("NS"QMapNode<");
|
||||
d.put(keyType);
|
||||
d.put(',');
|
||||
d.put(valueType);
|
||||
if (valueType[qstrlen(valueType) - 1] == '>')
|
||||
d.put(' ');
|
||||
d.put("> *)0)->value)-0\",\"");
|
||||
d.put(valueOffset);
|
||||
d.put("\"]");
|
||||
return d;
|
||||
}
|
||||
|
||||
// Helper to write out common expression values for CDB:
|
||||
// Offsets of a std::pair for dumping std::map node value which look like
|
||||
// "(size_t)&(((std::pair<int const ,int> *)0)->second)-0"
|
||||
|
||||
template <class Key, class Value>
|
||||
inline QDumper & putStdPairValueOffsetExpression(const char *keyType,
|
||||
const char *valueType,
|
||||
QDumper &d)
|
||||
{
|
||||
std::pair<Key, Value> *p = 0;
|
||||
const int valueOffset = (char *)&(p->second) - (char*)p;
|
||||
d.put("[\"(size_t)&(((std::pair<");
|
||||
d.put(keyType);
|
||||
d.put(" const ,");
|
||||
d.put(valueType);
|
||||
if (valueType[qstrlen(valueType) - 1] == '>')
|
||||
d.put(' ');
|
||||
d.put("> *)0)->second)-0\",\"");
|
||||
d.put(valueOffset);
|
||||
d.put("\"]");
|
||||
return d;
|
||||
}
|
||||
|
||||
#endif // Q_CC_MSVC
|
||||
|
||||
// Dump out sizes for CDB
|
||||
static inline void dumpSizes(QDumper &d)
|
||||
{
|
||||
// Sort by sizes
|
||||
typedef QMultiMap<size_t, const char *> SizeMap;
|
||||
SizeMap sizeMap;
|
||||
|
||||
sizeMap.insert(sizeof(int), "int");
|
||||
sizeMap.insert(sizeof(char*), "char*");
|
||||
sizeMap.insert(sizeof(QString), NS"QString");
|
||||
sizeMap.insert(sizeof(QStringList), NS"QStringList");
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
sizeMap.insert(sizeof(QObject), NS"QObject");
|
||||
sizeMap.insert(sizeof(QList<int>), NS"QList<int>");
|
||||
sizeMap.insert(sizeof(QLinkedList<int>), NS"QLinkedList<int>");
|
||||
sizeMap.insert(sizeof(QVector<int>), NS"QVector<int>");
|
||||
sizeMap.insert(sizeof(QQueue<int>), NS"QQueue<int>");
|
||||
#endif
|
||||
#if USE_QT_GUI
|
||||
sizeMap.insert(sizeof(QWidget), NS"QWidget");
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
sizeMap.insert(sizeof(std::string), "string");
|
||||
sizeMap.insert(sizeof(std::wstring), "wstring");
|
||||
#endif
|
||||
sizeMap.insert(sizeof(std::string), "std::string");
|
||||
sizeMap.insert(sizeof(std::wstring), "std::wstring");
|
||||
sizeMap.insert(sizeof(std::allocator<int>), "std::allocator");
|
||||
sizeMap.insert(sizeof(std::char_traits<char>), "std::char_traits<char>");
|
||||
sizeMap.insert(sizeof(std::char_traits<unsigned short>), "std::char_traits<unsigned short>");
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
#if QT_VERSION >= 0x040500
|
||||
sizeMap.insert(sizeof(QSharedPointer<int>), NS"QSharedPointer");
|
||||
sizeMap.insert(sizeof(QSharedDataPointer<QSharedData>), NS"QSharedDataPointer");
|
||||
sizeMap.insert(sizeof(QWeakPointer<int>), NS"QWeakPointer");
|
||||
#endif
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
sizeMap.insert(sizeof(QPointer<QObject>), "QPointer");
|
||||
// Common map node types
|
||||
sizeMap.insert(sizeof(QMapNode<int,int >), NS"QMapNode<int,int>");
|
||||
sizeMap.insert(sizeof(QMapNode<int, QString>), NS"QMapNode<int,"NS"QString>");
|
||||
sizeMap.insert(sizeof(QMapNode<int, QVariant>), NS"QMapNode<int,"NS"QVariant>");
|
||||
sizeMap.insert(sizeof(QMapNode<QString, int>), NS"QMapNode<"NS"QString,int>");
|
||||
sizeMap.insert(sizeof(QMapNode<QString, QString>), NS"QMapNode<"NS"QString,"NS"QString>");
|
||||
sizeMap.insert(sizeof(QMapNode<QString, QVariant>), NS"QMapNode<"NS"QString,"NS"QVariant>");
|
||||
// Dump as lists of types preceded by size
|
||||
size_t lastSize = 0;
|
||||
d.put("sizes=[");
|
||||
const SizeMap::const_iterator cend = sizeMap.constEnd();
|
||||
for (SizeMap::const_iterator it = sizeMap.constBegin(); it != cend; ++it) {
|
||||
// new size list
|
||||
if (it.key() != lastSize) {
|
||||
if (lastSize)
|
||||
d.put("],");
|
||||
d.put("[\"");
|
||||
d.put(it.key());
|
||||
lastSize = it.key();
|
||||
d.put('"');
|
||||
}
|
||||
d.put(",\"");
|
||||
d.put(it.value());
|
||||
d.put('"');
|
||||
}
|
||||
d.put("]]");
|
||||
}
|
||||
|
||||
extern "C" Q_DECL_EXPORT
|
||||
void *qDumpObjectData440(
|
||||
int protocolVersion,
|
||||
int token,
|
||||
const void *data,
|
||||
int dumpChildren,
|
||||
int extraInt0,
|
||||
int extraInt1,
|
||||
int extraInt2,
|
||||
int extraInt3)
|
||||
{
|
||||
//sleep(20);
|
||||
if (protocolVersion == 1) {
|
||||
QDumper d;
|
||||
d.protocolVersion = protocolVersion;
|
||||
d.token = token;
|
||||
|
||||
// This is a list of all available dumpers. Note that some templates
|
||||
// currently require special hardcoded handling in the debugger plugin.
|
||||
// They are mentioned here nevertheless. For types that are not listed
|
||||
// here, dumpers won't be used.
|
||||
d.put("dumpers=["
|
||||
"\""NS"QAbstractItem\","
|
||||
"\""NS"QAbstractItemModel\","
|
||||
"\""NS"QByteArray\","
|
||||
"\""NS"QChar\","
|
||||
"\""NS"QDateTime\","
|
||||
"\""NS"QDir\","
|
||||
"\""NS"QFile\","
|
||||
"\""NS"QFileInfo\","
|
||||
"\""NS"QHash\","
|
||||
"\""NS"QHashNode\","
|
||||
//"\""NS"QImage\","
|
||||
//"\""NS"QImageData\","
|
||||
"\""NS"QLinkedList\","
|
||||
"\""NS"QList\","
|
||||
"\""NS"QLocale\","
|
||||
"\""NS"QMap\","
|
||||
"\""NS"QMapNode\","
|
||||
"\""NS"QModelIndex\","
|
||||
"\""NS"QObject\","
|
||||
"\""NS"QObjectMethodList\"," // hack to get nested properties display
|
||||
"\""NS"QObjectProperty\","
|
||||
"\""NS"QObjectPropertyList\","
|
||||
"\""NS"QObjectSignal\","
|
||||
"\""NS"QObjectSignalList\","
|
||||
"\""NS"QObjectSlot\","
|
||||
"\""NS"QObjectSlotList\","
|
||||
"\""NS"QObjectChildList\","
|
||||
"\""NS"QPoint\","
|
||||
"\""NS"QPointF\","
|
||||
"\""NS"QRect\","
|
||||
"\""NS"QRectF\","
|
||||
//"\""NS"QRegion\","
|
||||
"\""NS"QSet\","
|
||||
"\""NS"QStack\","
|
||||
"\""NS"QString\","
|
||||
"\""NS"QStringList\","
|
||||
"\""NS"QTextCodec\","
|
||||
"\""NS"QVariant\","
|
||||
"\""NS"QVariantList\","
|
||||
"\""NS"QVector\","
|
||||
#if QT_VERSION >= 0x040500
|
||||
"\""NS"QMultiMap\","
|
||||
"\""NS"QSharedPointer\","
|
||||
"\""NS"QWeakPointer\","
|
||||
#endif
|
||||
#if USE_QT_GUI
|
||||
"\""NS"QWidget\","
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
"\"basic_string\","
|
||||
"\"list\","
|
||||
"\"map\","
|
||||
"\"set\","
|
||||
"\"vector\","
|
||||
#endif
|
||||
"\"string\","
|
||||
"\"wstring\","
|
||||
"\"std::basic_string\","
|
||||
"\"std::list\","
|
||||
"\"std::map\","
|
||||
"\"std::set\","
|
||||
"\"std::string\","
|
||||
"\"std::vector\","
|
||||
"\"std::wstring\","
|
||||
"]");
|
||||
d.put(",qtversion=["
|
||||
"\"").put(((QT_VERSION >> 16) & 255)).put("\","
|
||||
"\"").put(((QT_VERSION >> 8) & 255)).put("\","
|
||||
"\"").put(((QT_VERSION) & 255)).put("\"]");
|
||||
d.put(",namespace=\""NS"\",");
|
||||
d.put("dumperversion=\"1.3\",");
|
||||
// Dump out size information
|
||||
dumpSizes(d);
|
||||
// Write out common expression values for CDB
|
||||
#ifdef Q_CC_MSVC
|
||||
d.put(",expressions=[");
|
||||
putQMapNodeOffsetExpression<int,int>("int", "int", d).put(',');
|
||||
putQMapNodeOffsetExpression<int,QString>("int", NS"QString", d).put(',');
|
||||
putQMapNodeOffsetExpression<int,QVariant>("int", NS"QVariant", d).put(',');
|
||||
putQMapNodeOffsetExpression<QString,int>(NS"QString", "int", d).put(',');
|
||||
putQMapNodeOffsetExpression<QString,QString>(NS"QString", NS"QString", d).put(',');
|
||||
putQMapNodeOffsetExpression<QString,QVariant>(NS"QString", NS"QVariant", d).put(',');
|
||||
// Std Pairs
|
||||
putStdPairValueOffsetExpression<int,int>("int","int", d).put(',');
|
||||
putStdPairValueOffsetExpression<QString,QString>(NS"QString",NS"QString", d).put(',');
|
||||
putStdPairValueOffsetExpression<int,QString>("int",NS"QString", d).put(',');
|
||||
putStdPairValueOffsetExpression<QString,int>(NS"QString", "int", d).put(',');
|
||||
putStdPairValueOffsetExpression<std::string,std::string>(stdStringTypeC, stdStringTypeC, d).put(',');
|
||||
putStdPairValueOffsetExpression<int,std::string>("int", stdStringTypeC, d).put(',');
|
||||
putStdPairValueOffsetExpression<std::string,int>(stdStringTypeC, "int", d).put(',');
|
||||
putStdPairValueOffsetExpression<std::wstring,std::wstring>(stdWideStringTypeUShortC, stdWideStringTypeUShortC, d).put(',');
|
||||
putStdPairValueOffsetExpression<int,std::wstring>("int", stdWideStringTypeUShortC, d).put(',');
|
||||
putStdPairValueOffsetExpression<std::wstring,int>(stdWideStringTypeUShortC, "int", d);
|
||||
d.put(']');
|
||||
#endif // Q_CC_MSVC
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
else if (protocolVersion == 2 || protocolVersion == 3) {
|
||||
QDumper d;
|
||||
|
||||
d.protocolVersion = protocolVersion;
|
||||
d.token = token;
|
||||
d.data = data;
|
||||
d.dumpChildren = dumpChildren;
|
||||
d.extraInt[0] = extraInt0;
|
||||
d.extraInt[1] = extraInt1;
|
||||
d.extraInt[2] = extraInt2;
|
||||
d.extraInt[3] = extraInt3;
|
||||
|
||||
const char *inbuffer = inBuffer;
|
||||
d.outerType = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
|
||||
d.iname = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
|
||||
d.exp = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
|
||||
d.innerType = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
|
||||
d.iname = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer;
|
||||
#if 0
|
||||
qDebug() << "data=" << d.data << "dumpChildren=" << d.dumpChildren
|
||||
<< " extra=" << d.extraInt[0] << d.extraInt[1] << d.extraInt[2] << d.extraInt[3]
|
||||
<< d.outerType << d.iname << d.exp << d.iname;
|
||||
#endif
|
||||
handleProtocolVersion2and3(d);
|
||||
}
|
||||
|
||||
else {
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
qDebug() << "Unsupported protocol version" << protocolVersion;
|
||||
#endif
|
||||
}
|
||||
return outBuffer;
|
||||
}
|
46
Ground/share/openpilotgcs/gdbmacros/gdbmacros.h
Normal file
46
Ground/share/openpilotgcs/gdbmacros/gdbmacros.h
Normal file
@ -0,0 +1,46 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef GDBMACROS_H
|
||||
#define GDBMACROS_H
|
||||
|
||||
#ifdef MACROSDEBUG
|
||||
Q_DECL_EXPORT extern char xDumpInBuffer[];
|
||||
Q_DECL_EXPORT extern char xDumpOutBuffer[];
|
||||
#else
|
||||
Q_DECL_EXPORT extern char qDumpInBuffer[];
|
||||
Q_DECL_EXPORT extern char qDumpOutBuffer[];
|
||||
#endif
|
||||
|
||||
extern "C" Q_DECL_EXPORT
|
||||
void *qDumpObjectData440(int protocolVersion, int token, const void *data,
|
||||
int dumpChildren, int extraInt0, int extraInt1, int extraInt2, int extraInt3);
|
||||
|
||||
|
||||
#endif // GDBMACROS_H
|
18
Ground/share/openpilotgcs/gdbmacros/gdbmacros.pro
Normal file
18
Ground/share/openpilotgcs/gdbmacros/gdbmacros.pro
Normal file
@ -0,0 +1,18 @@
|
||||
TEMPLATE = lib
|
||||
CONFIG += shared
|
||||
linux-* {
|
||||
CONFIG -= release
|
||||
CONFIG += debug
|
||||
}
|
||||
SOURCES = gdbmacros.cpp
|
||||
false {
|
||||
DEFINES += USE_QT_GUI=0
|
||||
QT = core
|
||||
}
|
||||
else {
|
||||
DEFINES += USE_QT_GUI=1
|
||||
QT = core \
|
||||
gui
|
||||
}
|
||||
exists($$QMAKE_INCDIR_QT/QtCore/private/qobject_p.h):DEFINES += HAS_QOBJECT_P_H
|
||||
HEADERS += gdbmacros_p.h
|
154
Ground/share/openpilotgcs/gdbmacros/gdbmacros_p.h
Normal file
154
Ground/share/openpilotgcs/gdbmacros/gdbmacros_p.h
Normal file
@ -0,0 +1,154 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef GDBMACROS_P_H
|
||||
#define GDBMACROS_P_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
|
||||
#undef NS
|
||||
#ifdef QT_NAMESPACE
|
||||
# define STRINGIFY0(s) #s
|
||||
# define STRINGIFY1(s) STRINGIFY0(s)
|
||||
# define NS STRINGIFY1(QT_NAMESPACE) "::"
|
||||
# define NSX "'" STRINGIFY1(QT_NAMESPACE) "::"
|
||||
# define NSY "'"
|
||||
#else
|
||||
# define NS ""
|
||||
# define NSX "'"
|
||||
# define NSY "'"
|
||||
#endif
|
||||
|
||||
#if defined(QT_BEGIN_NAMESPACE)
|
||||
QT_BEGIN_NAMESPACE
|
||||
#endif
|
||||
|
||||
struct Sender { QObject *sender; int signal; int ref; };
|
||||
|
||||
#if QT_VERSION < 0x040600
|
||||
struct Connection
|
||||
{
|
||||
QObject *receiver;
|
||||
int method;
|
||||
uint connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking
|
||||
QBasicAtomicPointer<int> argumentTypes;
|
||||
};
|
||||
|
||||
typedef QList<Connection> ConnectionList;
|
||||
typedef QList<Sender> SenderList;
|
||||
|
||||
static inline const Connection &connectionAt(const ConnectionList &l, int i) { return l.at(i); }
|
||||
static inline const QObject *senderAt(const SenderList &l, int i) { return l.at(i).sender; }
|
||||
static inline int signalAt(const SenderList &l, int i) { return l.at(i).signal; }
|
||||
#else
|
||||
struct Connection
|
||||
{
|
||||
QObject *sender;
|
||||
QObject *receiver;
|
||||
int method;
|
||||
uint connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking
|
||||
QBasicAtomicPointer<int> argumentTypes;
|
||||
Connection *nextConnectionList;
|
||||
//senders linked list
|
||||
Connection *next;
|
||||
Connection **prev;
|
||||
};
|
||||
|
||||
struct ConnectionList
|
||||
{
|
||||
ConnectionList() : first(0), last(0) { }
|
||||
int size() const
|
||||
{
|
||||
int count = 0;
|
||||
for (Connection *c = first; c != 0; c = c->nextConnectionList)
|
||||
++count;
|
||||
return count;
|
||||
}
|
||||
|
||||
Connection *first;
|
||||
Connection *last;
|
||||
};
|
||||
|
||||
typedef Connection *SenderList;
|
||||
|
||||
static inline const Connection &connectionAt(const ConnectionList &l, int i)
|
||||
{
|
||||
Connection *conn = l.first;
|
||||
for (int cnt = 0; cnt < i; ++cnt)
|
||||
conn = conn->nextConnectionList;
|
||||
return *conn;
|
||||
}
|
||||
#endif
|
||||
|
||||
class ObjectPrivate : public QObjectData
|
||||
{
|
||||
public:
|
||||
ObjectPrivate() {}
|
||||
virtual ~ObjectPrivate() {}
|
||||
|
||||
#if QT_VERSION < 0x040600
|
||||
QList<QObject *> pendingChildInsertedEvents;
|
||||
void *threadData;
|
||||
void *currentSender;
|
||||
void *currentChildBeingDeleted;
|
||||
QList<QPointer<QObject> > eventFilters;
|
||||
|
||||
void *extraData;
|
||||
mutable quint32 connectedSignals;
|
||||
QString objectName;
|
||||
|
||||
void *connectionLists;
|
||||
SenderList senders;
|
||||
int *deleteWatch;
|
||||
#else
|
||||
QString objectName;
|
||||
void *extraData;
|
||||
void *threadData;
|
||||
void *connectionLists;
|
||||
SenderList senders;
|
||||
void *currentSender;
|
||||
mutable quint32 connectedSignals[2];
|
||||
QList<QObject *> pendingChildInsertedEvents;
|
||||
QList<QPointer<QObject> > eventFilters;
|
||||
void *currentChildBeingDeleted;
|
||||
QAtomicPointer<void> sharedRefcount;
|
||||
int *deleteWatch;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // QT_BOOTSTRAPPED
|
||||
|
||||
#if defined(QT_BEGIN_NAMESPACE)
|
||||
QT_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
#endif // GDBMACROS_P_H
|
19
Ground/share/openpilotgcs/gdbmacros/test/dumpertest.pro
Normal file
19
Ground/share/openpilotgcs/gdbmacros/test/dumpertest.pro
Normal file
@ -0,0 +1,19 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2009-05-05T11:16:25
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
TARGET = dumpertest
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += main.cpp \
|
||||
../gdbmacros.cpp
|
||||
|
||||
exists($$QMAKE_INCDIR_QT/QtCore/private/qobject_p.h) {
|
||||
DEFINES+=HAS_QOBJECT_P_H
|
||||
}
|
||||
|
663
Ground/share/openpilotgcs/gdbmacros/test/main.cpp
Normal file
663
Ground/share/openpilotgcs/gdbmacros/test/main.cpp
Normal file
@ -0,0 +1,663 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QLinkedList>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtGui/QAction>
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
// Test uninitialized variables allocing memory
|
||||
bool optTestUninitialized = false;
|
||||
bool optTestAll = false;
|
||||
bool optEmptyContainers = false;
|
||||
unsigned optVerbose = 0;
|
||||
|
||||
// Provide address of type of be tested.
|
||||
// When testing unitialized memory, allocate at random.
|
||||
template <class T>
|
||||
inline T* testAddress(T* in)
|
||||
{
|
||||
unsigned char *mem = 0;
|
||||
if (optTestUninitialized) {
|
||||
mem = new unsigned char[sizeof(T)];
|
||||
for (unsigned int i = 0; i < sizeof(T); i++) {
|
||||
mem[i] = char(rand() % 255u);
|
||||
}
|
||||
} else {
|
||||
mem = reinterpret_cast<unsigned char*>(in);
|
||||
}
|
||||
if (optVerbose) {
|
||||
for (unsigned int i = 0; i < sizeof(T); i++) {
|
||||
unsigned int b = mem[i];
|
||||
printf("%2d %2x %3d\n", i, b, b);
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
return reinterpret_cast<T*>(mem);
|
||||
}
|
||||
|
||||
/* Test program for Dumper development/porting.
|
||||
* Takes the type as first argument. */
|
||||
|
||||
// --------------- Dumper symbols
|
||||
extern char qDumpInBuffer[10000];
|
||||
extern char qDumpOutBuffer[100000];
|
||||
|
||||
extern "C" void *qDumpObjectData440(
|
||||
int protocolVersion,
|
||||
int token,
|
||||
void *data,
|
||||
#ifdef Q_CC_MSVC // CDB cannot handle boolean parameters
|
||||
int dumpChildren,
|
||||
#else
|
||||
bool dumpChildren,
|
||||
#endif
|
||||
int extraInt0, int extraInt1, int extraInt2, int extraInt3);
|
||||
|
||||
static void prepareInBuffer(const char *outerType,
|
||||
const char *iname,
|
||||
const char *expr,
|
||||
const char *innerType)
|
||||
{
|
||||
// Leave trailing '\0'
|
||||
char *ptr = qDumpInBuffer;
|
||||
strcpy(ptr, outerType);
|
||||
ptr += strlen(outerType);
|
||||
ptr++;
|
||||
strcpy(ptr, iname);
|
||||
ptr += strlen(iname);
|
||||
ptr++;
|
||||
strcpy(ptr, expr);
|
||||
ptr += strlen(expr);
|
||||
ptr++;
|
||||
strcpy(ptr, innerType);
|
||||
ptr += strlen(innerType);
|
||||
ptr++;
|
||||
strcpy(ptr, iname);
|
||||
}
|
||||
|
||||
// --------------- Qt types
|
||||
static int dumpQString()
|
||||
{
|
||||
QString test = QLatin1String("hallo");
|
||||
prepareInBuffer("QString", "local.qstring", "local.qstring", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, 0, 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
QString uninitialized;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQSharedPointerQString()
|
||||
{
|
||||
QSharedPointer<QString> test(new QString(QLatin1String("hallo")));
|
||||
prepareInBuffer("QSharedPointer", "local.sharedpointerqstring", "local.local.sharedpointerqstring", "QString");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(QString), 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
QString uninitialized;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQStringList()
|
||||
{
|
||||
QStringList test = QStringList() << QLatin1String("item1") << QLatin1String("item2");
|
||||
prepareInBuffer("QList", "local.qstringlist", "local.qstringlist", "QString");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(QString), 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQIntList()
|
||||
{
|
||||
QList<int> test = QList<int>() << 1 << 2;
|
||||
prepareInBuffer("QList", "local.qintlist", "local.qintlist", "int");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQIntLinkedList()
|
||||
{
|
||||
QLinkedList<int> test = QLinkedList<int>() << 1 << 2;
|
||||
prepareInBuffer("QLinkedList", "local.qintlinkedlist", "local.qlinkedintlist", "int");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQIntVector()
|
||||
{
|
||||
QVector<int> test = QVector<int>() << 42 << 43;
|
||||
prepareInBuffer("QVector", "local.qintvector", "local.qintvector", "int");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQQStringVector()
|
||||
{
|
||||
QVector<QString> test = QVector<QString>() << "42s" << "43s";
|
||||
prepareInBuffer("QVector", "local.qstringvector", "local.qstringvector", "QString");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(QString), 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQMapIntInt()
|
||||
{
|
||||
QMap<int,int> test;
|
||||
QMapNode<int,int> mapNode;
|
||||
const int valueOffset = (char*)&(mapNode.value) - (char*)&mapNode;
|
||||
if (!optEmptyContainers) {
|
||||
test.insert(42, 43);
|
||||
test.insert(43, 44);
|
||||
}
|
||||
prepareInBuffer("QMap", "local.qmapintint", "local.qmapintint", "int@int");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), sizeof(int), sizeof(mapNode), valueOffset);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQMapIntString()
|
||||
{
|
||||
QMap<int,QString> test;
|
||||
QMapNode<int,QString> mapNode;
|
||||
const int valueOffset = (char*)&(mapNode.value) - (char*)&mapNode;
|
||||
if (!optEmptyContainers) {
|
||||
test.insert(42, QLatin1String("fortytwo"));
|
||||
test.insert(43, QLatin1String("fortytree"));
|
||||
}
|
||||
prepareInBuffer("QMap", "local.qmapintqstring", "local.qmapintqstring", "int@QString");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), sizeof(QString), sizeof(mapNode), valueOffset);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQSetInt()
|
||||
{
|
||||
QSet<int> test;
|
||||
if (!optEmptyContainers) {
|
||||
test.insert(42);
|
||||
test.insert(43);
|
||||
}
|
||||
prepareInBuffer("QSet", "local.qsetint", "local.qsetint", "int");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int dumpQMapQStringString()
|
||||
{
|
||||
QMap<QString,QString> test;
|
||||
QMapNode<QString,QString> mapNode;
|
||||
const int valueOffset = (char*)&(mapNode.value) - (char*)&mapNode;
|
||||
if (!optEmptyContainers) {
|
||||
test.insert(QLatin1String("42s"), QLatin1String("fortytwo"));
|
||||
test.insert(QLatin1String("423"), QLatin1String("fortytree"));
|
||||
}
|
||||
prepareInBuffer("QMap", "local.qmapqstringqstring", "local.qmapqstringqstring", "QString@QString");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(QString), sizeof(QString), sizeof(mapNode), valueOffset);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQVariant()
|
||||
{
|
||||
QVariant test = QLatin1String("item");
|
||||
prepareInBuffer("QVariant", "local.qvariant", "local.qvariant", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, 0, 0,0 ,0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputs("\n\n", stdout);
|
||||
test = QVariant(int(42));
|
||||
prepareInBuffer("QVariant", "local.qvariant", "local.qvariant", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, 0, 0,0 ,0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputs("\n\n", stdout);
|
||||
test = QVariant(double(3.141));
|
||||
prepareInBuffer("QVariant", "local.qvariant", "local.qvariant", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, 0, 0,0 ,0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputs("\n\n", stdout);
|
||||
test = QVariant(QStringList(QLatin1String("item1")));
|
||||
prepareInBuffer("QVariant", "local.qvariant", "local.qvariant", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, 0, 0,0 ,0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
test = QVariant(QRect(1,2, 3, 4));
|
||||
prepareInBuffer("QVariant", "local.qvariant", "local.qvariant", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, 0, 0,0 ,0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQVariantList()
|
||||
{
|
||||
QVariantList test;
|
||||
if (!optEmptyContainers) {
|
||||
test.push_back(QVariant(QLatin1String("hallo")));
|
||||
test.push_back(QVariant(42));
|
||||
test.push_back(QVariant(3.141));
|
||||
}
|
||||
// As a list
|
||||
prepareInBuffer("QList", "local.qvariantlist", "local.qvariantlist", "QVariant");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(QVariant), 0,0 ,0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
// As typedef
|
||||
fputs("\n\n", stdout);
|
||||
prepareInBuffer("QVariantList", "local.qvariantlist", "local.qvariantlist", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, 0, 0,0 ,0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --------------- std types
|
||||
|
||||
static int dumpStdString()
|
||||
{
|
||||
std::string test = "hallo";
|
||||
prepareInBuffer("std::string", "local.string", "local.string", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, 0, 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpStdWString()
|
||||
{
|
||||
std::wstring test = L"hallo";
|
||||
prepareInBuffer("std::wstring", "local.wstring", "local.wstring", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, 0, 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpStdStringList()
|
||||
{
|
||||
std::list<std::string> test;
|
||||
if (!optEmptyContainers) {
|
||||
test.push_back("item1");
|
||||
test.push_back("item2");
|
||||
}
|
||||
prepareInBuffer("std::list", "local.stringlist", "local.stringlist", "std::string");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(std::string), sizeof(std::list<std::string>::allocator_type), 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpStdStringQList()
|
||||
{
|
||||
QList<std::string> test;
|
||||
if (!optEmptyContainers) {
|
||||
test.push_back("item1");
|
||||
test.push_back("item2");
|
||||
}
|
||||
prepareInBuffer("QList", "local.stringqlist", "local.stringqlist", "std::string");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(std::string), 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpStdIntList()
|
||||
{
|
||||
std::list<int> test;
|
||||
if (!optEmptyContainers) {
|
||||
test.push_back(1);
|
||||
test.push_back(2);
|
||||
}
|
||||
prepareInBuffer("std::list", "local.intlist", "local.intlist", "int");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), sizeof(std::list<int>::allocator_type), 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpStdIntVector()
|
||||
{
|
||||
std::vector<int> test;
|
||||
if (!optEmptyContainers) {
|
||||
test.push_back(1);
|
||||
test.push_back(2);
|
||||
}
|
||||
prepareInBuffer("std::vector", "local.intvector", "local.intvector", "int");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), sizeof(std::list<int>::allocator_type), 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpStdStringVector()
|
||||
{
|
||||
std::vector<std::string> test;
|
||||
if (!optEmptyContainers) {
|
||||
test.push_back("item1");
|
||||
test.push_back("item2");
|
||||
}
|
||||
prepareInBuffer("std::vector", "local.stringvector", "local.stringvector", "std::string");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(std::string), sizeof(std::list<int>::allocator_type), 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpStdWStringVector()
|
||||
{
|
||||
std::vector<std::wstring> test;
|
||||
if (!optEmptyContainers) {
|
||||
test.push_back(L"item1");
|
||||
test.push_back(L"item2");
|
||||
}
|
||||
prepareInBuffer("std::vector", "local.wstringvector", "local.wstringvector", "std::wstring");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(std::wstring), sizeof(std::list<int>::allocator_type), 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpStdIntSet()
|
||||
{
|
||||
std::set<int> test;
|
||||
if (!optEmptyContainers) {
|
||||
test.insert(1);
|
||||
test.insert(2);
|
||||
}
|
||||
prepareInBuffer("std::set", "local.intset", "local.intset", "int");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), sizeof(std::list<int>::allocator_type), 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpStdStringSet()
|
||||
{
|
||||
std::set<std::string> test;
|
||||
if (!optEmptyContainers) {
|
||||
test.insert("item1");
|
||||
test.insert("item2");
|
||||
}
|
||||
prepareInBuffer("std::set", "local.stringset", "local.stringset", "std::string");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(std::string), sizeof(std::list<int>::allocator_type), 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpStdQStringSet()
|
||||
{
|
||||
std::set<QString> test;
|
||||
if (!optEmptyContainers) {
|
||||
test.insert(QLatin1String("item1"));
|
||||
test.insert(QLatin1String("item2"));
|
||||
}
|
||||
prepareInBuffer("std::set", "local.stringset", "local.stringset", "QString");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(QString), sizeof(std::list<int>::allocator_type), 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpStdMapIntString()
|
||||
{
|
||||
std::map<int,std::string> test;
|
||||
std::map<int,std::string>::value_type entry(42, std::string("fortytwo"));
|
||||
if (!optEmptyContainers) {
|
||||
test.insert(entry);
|
||||
}
|
||||
const int valueOffset = (char*)&(entry.second) - (char*)&entry;
|
||||
prepareInBuffer("std::map", "local.stdmapintstring", "local.stdmapintstring",
|
||||
"int@std::basic_string<char,std::char_traits<char>,std::allocator<char> >@std::less<int>@std::allocator<std::pair<const int,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(int), sizeof(std::string), valueOffset, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpStdMapStringString()
|
||||
{
|
||||
typedef std::map<std::string,std::string> TestType;
|
||||
TestType test;
|
||||
const TestType::value_type entry("K", "V");
|
||||
if (!optEmptyContainers) {
|
||||
test.insert(entry);
|
||||
}
|
||||
const int valueOffset = (char*)&(entry.second) - (char*)&entry;
|
||||
prepareInBuffer("std::map", "local.stdmapstringstring", "local.stdmapstringstring",
|
||||
"std::basic_string<char,std::char_traits<char>,std::allocator<char> >@std::basic_string<char,std::char_traits<char>,std::allocator<char> >@std::less<int>@std::allocator<std::pair<const std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, sizeof(std::string), sizeof(std::string), valueOffset, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int dumpQObject()
|
||||
{
|
||||
// Requires the childOffset to be know, but that is not critical
|
||||
QAction action(0);
|
||||
QObject x;
|
||||
QAction *a2= new QAction(&action);
|
||||
a2->setObjectName(QLatin1String("a2"));
|
||||
action.setObjectName(QLatin1String("action"));
|
||||
QObject::connect(&action, SIGNAL(triggered()), &x, SLOT(deleteLater()));
|
||||
prepareInBuffer("QObject", "local.qobject", "local.qobject", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&action), 1, 0, 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputs("\n\n", stdout);
|
||||
// Property list
|
||||
prepareInBuffer("QObjectPropertyList", "local.qobjectpropertylist", "local.qobjectpropertylist", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&action), 1, 0, 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputs("\n\n", stdout);
|
||||
// Signal list
|
||||
prepareInBuffer("QObjectSignalList", "local.qobjectsignallist", "local.qobjectsignallist", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&action), 1, 0, 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
// Slot list
|
||||
prepareInBuffer("QObjectSlotList", "local.qobjectslotlist", "local.qobjectslotlist", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&action), 1, 0, 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputs("\n\n", stdout);
|
||||
// Signal list
|
||||
prepareInBuffer("QObjectChildList", "local.qobjectchildlist", "local.qobjectchildlist", "");
|
||||
qDumpObjectData440(2, 42, testAddress(&action), 1, 0, 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQObjectList()
|
||||
{
|
||||
// Requires the childOffset to be know, but that is not critical
|
||||
QObject *root = new QObject;
|
||||
root ->setObjectName("root");
|
||||
QTimer *t1 = new QTimer;
|
||||
t1 ->setObjectName("t1");
|
||||
QTimer *t2 = new QTimer;
|
||||
t2 ->setObjectName("t2");
|
||||
QObjectList test;
|
||||
test << root << t1 << t2;
|
||||
prepareInBuffer("QList", "local.qobjectlist", "local.qobjectlist", "QObject *");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), sizeof(QObject*), 0, 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
delete root;
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef int (*DumpFunction)();
|
||||
typedef QMap<QString, DumpFunction> TypeDumpFunctionMap;
|
||||
|
||||
static TypeDumpFunctionMap registerTypes()
|
||||
{
|
||||
TypeDumpFunctionMap rc;
|
||||
rc.insert("QString", dumpQString);
|
||||
rc.insert("QSharedPointer<QString>", dumpQSharedPointerQString);
|
||||
rc.insert("QStringList", dumpQStringList);
|
||||
rc.insert("QList<int>", dumpQIntList);
|
||||
rc.insert("QLinkedList<int>", dumpQIntLinkedList);
|
||||
rc.insert("QList<std::string>", dumpStdStringQList);
|
||||
rc.insert("QVector<int>", dumpQIntVector);
|
||||
rc.insert("QVector<QString>", dumpQQStringVector);
|
||||
rc.insert("QMap<int,QString>", dumpQMapIntString);
|
||||
rc.insert("QMap<QString,QString>", dumpQMapQStringString);
|
||||
rc.insert("QMap<int,int>", dumpQMapIntInt);
|
||||
rc.insert("QSet<int>", dumpQSetInt);
|
||||
rc.insert("string", dumpStdString);
|
||||
rc.insert("wstring", dumpStdWString);
|
||||
rc.insert("list<int>", dumpStdIntList);
|
||||
rc.insert("list<string>", dumpStdStringList);
|
||||
rc.insert("vector<int>", dumpStdIntVector);
|
||||
rc.insert("vector<string>", dumpStdStringVector);
|
||||
rc.insert("vector<wstring>", dumpStdWStringVector);
|
||||
rc.insert("set<int>", dumpStdIntSet);
|
||||
rc.insert("set<string>", dumpStdStringSet);
|
||||
rc.insert("set<QString>", dumpStdQStringSet);
|
||||
rc.insert("map<int,string>", dumpStdMapIntString);
|
||||
rc.insert("map<string,string>", dumpStdMapStringString);
|
||||
rc.insert("QObject", dumpQObject);
|
||||
rc.insert("QObjectList", dumpQObjectList);
|
||||
rc.insert("QVariant", dumpQVariant);
|
||||
rc.insert("QVariantList", dumpQVariantList);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void usage(const char *b, const TypeDumpFunctionMap &tdm)
|
||||
{
|
||||
printf("Usage: %s [-v][-u][-e] <type1> <type2..>\n", b);
|
||||
printf("Usage: %s [-v][-u][-e] -a excluded_type1 <excluded_type2...>\n", b);
|
||||
printf("Options: -u Test uninitialized memory\n");
|
||||
printf(" -e Empty containers\n");
|
||||
printf(" -v Verbose\n");
|
||||
printf(" -a Test all available types\n");
|
||||
printf("Supported types: ");
|
||||
const TypeDumpFunctionMap::const_iterator cend = tdm.constEnd();
|
||||
for (TypeDumpFunctionMap::const_iterator it = tdm.constBegin(); it != cend; ++it) {
|
||||
fputs(qPrintable(it.key()), stdout);
|
||||
fputc(' ', stdout);
|
||||
}
|
||||
fputc('\n', stdout);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("\nQt Creator Debugging Helper testing tool\n\n");
|
||||
printf("Running query protocol\n");
|
||||
qDumpObjectData440(1, 42, 0, 1, 0, 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
fputc('\n', stdout);
|
||||
|
||||
const TypeDumpFunctionMap tdm = registerTypes();
|
||||
const TypeDumpFunctionMap::const_iterator cend = tdm.constEnd();
|
||||
|
||||
if (argc < 2) {
|
||||
usage(argv[0], tdm);
|
||||
return 0;
|
||||
}
|
||||
// Parse args
|
||||
QStringList tests;
|
||||
for (int a = 1; a < argc; a++) {
|
||||
const char *arg = argv[a];
|
||||
if (arg[0] == '-') {
|
||||
switch (arg[1]) {
|
||||
case 'a':
|
||||
optTestAll = true;
|
||||
break;
|
||||
case 'u':
|
||||
optTestUninitialized = true;
|
||||
break;
|
||||
case 'v':
|
||||
optVerbose++;
|
||||
break;
|
||||
case 'e':
|
||||
optEmptyContainers = true;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Invalid option %s\n", arg);
|
||||
usage(argv[0], tdm);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
tests.push_back(QLatin1String(arg));
|
||||
}
|
||||
}
|
||||
// Go
|
||||
int rc = 0;
|
||||
if (optTestAll) {
|
||||
for (TypeDumpFunctionMap::const_iterator it = tdm.constBegin(); it != cend; ++it) {
|
||||
const QString test = it.key();
|
||||
if (tests.contains(test)) {
|
||||
printf("\nSkipping: %s\n", qPrintable(test));
|
||||
} else {
|
||||
printf("\nTesting: %s\n", qPrintable(test));
|
||||
rc += (*it.value())();
|
||||
if (optTestUninitialized)
|
||||
printf("Survived: %s\n", qPrintable(test));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach(const QString &test, tests) {
|
||||
printf("\nTesting: %s\n", qPrintable(test));
|
||||
const TypeDumpFunctionMap::const_iterator it = tdm.constFind(test);
|
||||
if (it == cend) {
|
||||
rc = -1;
|
||||
fprintf(stderr, "\nUnhandled type: %s\n", qPrintable(test));
|
||||
} else {
|
||||
rc = (*it.value())();
|
||||
}
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
50
Ground/share/openpilotgcs/runInTerminal.command
Normal file
50
Ground/share/openpilotgcs/runInTerminal.command
Normal file
@ -0,0 +1,50 @@
|
||||
#! /bin/bash
|
||||
|
||||
### FIXME:
|
||||
# - currentTab and geometry stuff does not work with macX 10.4 (tiger)
|
||||
# - -async is always in effect, i.e., synchronous execution is not implemented
|
||||
|
||||
geom=
|
||||
async=
|
||||
while test -n "$1"; do
|
||||
case $1 in
|
||||
-async)
|
||||
async=1
|
||||
shift;;
|
||||
-geom)
|
||||
shift
|
||||
w=${1%%x*}
|
||||
y=${1#*x}
|
||||
h=${y%%+*}
|
||||
y=${y#*+}
|
||||
x=${y%%+*}
|
||||
y=${y#*+}
|
||||
geom="\
|
||||
set number of columns of currentTab to $w
|
||||
set number of rows of currentTab to $h
|
||||
set position of windows whose tabs contains currentTab to {$x, $y}"
|
||||
shift;;
|
||||
-e)
|
||||
shift
|
||||
break;;
|
||||
*)
|
||||
echo "Invalid call" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
done
|
||||
args=
|
||||
for i in "$@"; do
|
||||
i=${i//\\/\\\\\\\\}
|
||||
i=${i//\"/\\\\\\\"}
|
||||
i=${i//\$/\\\\\\\$}
|
||||
i=${i//\`/\\\\\\\`}
|
||||
args="$args \\\"$i\\\""
|
||||
done
|
||||
osascript <<EOF
|
||||
tell application "Terminal"
|
||||
do script "$args; exit"
|
||||
set currentTab to the result
|
||||
$geom
|
||||
activate
|
||||
end tell
|
||||
EOF
|
495
Ground/share/openpilotgcs/schemes/MS_Visual_C++.kms
Normal file
495
Ground/share/openpilotgcs/schemes/MS_Visual_C++.kms
Normal file
@ -0,0 +1,495 @@
|
||||
<!DOCTYPE KeyboardMappingScheme>
|
||||
<mapping>
|
||||
<shortcut id="Debugger.JumpToLine" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.ToggleBreak" >
|
||||
<key value="F9" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.BreakByFunction" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.BreakAtMain" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.SkipKnownFrames" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.UseCustomDumpers" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.UseFastStart" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.AddToWatch" >
|
||||
<key value="Alt+D, Alt+W" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Mode.Debug" >
|
||||
<key value="Ctrl+3" />
|
||||
</shortcut>
|
||||
<shortcut id="QtScriptEditor.Run" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FindFilter.Files on Disk" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FindFilter.All Projects" >
|
||||
<key value="Ctrl+Shift+F" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.TaskList" >
|
||||
<key value="Alt+1" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.SearchResults" >
|
||||
<key value="Alt+2" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.ApplicationOutput" >
|
||||
<key value="Alt+3" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.Compile" >
|
||||
<key value="Alt+4" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.Perforce" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.General" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Edit.Delete" >
|
||||
<key value="Del" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.WidgetEditor" >
|
||||
<key value="F3" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.SignalsSlotsEditor" >
|
||||
<key value="F4" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.BuddyEditor" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.TabOrderEditor" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.LayoutHorizontally" >
|
||||
<key value="Ctrl+H" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.LayoutVertically" >
|
||||
<key value="Ctrl+L" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.SplitHorizontal" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.SplitVertical" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.LayoutForm" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.LayoutGrid" >
|
||||
<key value="Ctrl+G" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.LayoutBreak" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.LayoutAdjustSize" >
|
||||
<key value="Ctrl+J" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.SimplifyLayout" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.ReturnToEditor" >
|
||||
<key value="Esc" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.New" >
|
||||
<key value="Ctrl+N" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Lower" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Open" >
|
||||
<key value="Ctrl+O" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Raise" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.OpenWith" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Preview" >
|
||||
<key value="Ctrl+Alt+R" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Save" >
|
||||
<key value="Ctrl+S" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.SaveAs" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.SaveAll" >
|
||||
<key value="Ctrl+Shift+S" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Print" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Exit" >
|
||||
<key value="Ctrl+Q" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Undo" >
|
||||
<key value="Ctrl+Z" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Redo" >
|
||||
<key value="Ctrl+Shift+Z" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Cut" >
|
||||
<key value="Ctrl+X" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Copy" >
|
||||
<key value="Ctrl+C" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Paste" >
|
||||
<key value="Ctrl+V" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.SelectAll" >
|
||||
<key value="Ctrl+A" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Goto" >
|
||||
<key value="Ctrl+G" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Options" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.ToggleSidebar" >
|
||||
<key value="Alt+0" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.AboutQtCreator" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.AboutPlugins" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.RevertToSaved" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Menu.Preview.Windows" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Menu.Preview.Motif" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Menu.Preview.CDE" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Menu.Preview.Plastique" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Menu.Preview.Cleanlooks" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.ViewCode" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.FormSettings" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Close" >
|
||||
<key value="Ctrl+W" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.CloseAll" >
|
||||
<key value="Ctrl+Shift+W" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.DuplicateDocument" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.GotoPreviousInHistory" >
|
||||
<key value="Ctrl+Tab" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.GotoNextInHistory" >
|
||||
<key value="Ctrl+Shift+Tab" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Horizontal" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Vertical" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Remove" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.SaveAsDefaultLayout" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.RestoreDefaultLayout" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.GotoPreviousTabGroup" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.GotoNextTabGroup" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.DocumentToPreviousGroup" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.DocumentToNextGroup" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Mode.Output" >
|
||||
<key value="Ctrl+6" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Mode.Welcome" >
|
||||
<key value="Ctrl+1" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Mode.Edit" >
|
||||
<key value="Ctrl+2" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.FindInCurrentDocument" >
|
||||
<key value="Ctrl+F" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.FindNext" >
|
||||
<key value="F3" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.FindPrevious" >
|
||||
<key value="Shift+F3" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.ReplaceNext" >
|
||||
<key value="Ctrl+=" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.ReplacePrevious" >
|
||||
<key value="Ctrl+Shift+=" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.ReplaceAll" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.CaseSensitive" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.WholeWords" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Locate" >
|
||||
<key value="Ctrl+D" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Home" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Previous" >
|
||||
<key value="Backspace" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Next" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.AddBookmark" >
|
||||
<key value="Ctrl+M" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Index" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Contents" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Search" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Context" >
|
||||
<key value="F1" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Mode.Help" >
|
||||
<key value="Ctrl+5" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.IndexShortcut" >
|
||||
<key value="Ctrl+I" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.ContentsShortcut" >
|
||||
<key value="Ctrl+T" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.SearchShortcut" >
|
||||
<key value="Ctrl+S" />
|
||||
</shortcut>
|
||||
<shortcut id="TextEditor.CompleteThis" >
|
||||
<key value="Ctrl+Space" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Mode.Project" >
|
||||
<key value="Ctrl+4" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.NewSession" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.NewProject" >
|
||||
<key value="Ctrl+Shift+N" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Load" >
|
||||
<key value="Ctrl+Shift+O" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.OpenFile" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Unload" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.ClearSession" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.BuildSession" >
|
||||
<key value="F7" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.RebuildSession" >
|
||||
<key value="Ctrl+Shift+F7" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.CleanSession" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Build" >
|
||||
<key value="Ctrl+Shift+B" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Rebuild" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Clean" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Run" >
|
||||
<key value="Ctrl+F5" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.GoToTaskWindow" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.CancelBuild" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Debug" >
|
||||
<key value="F5" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Dependencies" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.AddNewFile" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.AddExistingFiles" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.RemoveFile" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.RenameFile" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.Toggle" >
|
||||
<key value="Ctrl+K, Ctrl+K" />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.MoveUp" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.MoveDown" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.Previous" >
|
||||
<key value="Shift+F2" />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.Next" >
|
||||
<key value="F2" />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.PreviousDocument" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.NextDocument" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="CppTools.SwitchHeaderSource" >
|
||||
<key value="F4" />
|
||||
</shortcut>
|
||||
<shortcut id="CppEditor.JumpToDefinition" >
|
||||
<key value="Ctrl+F12" />
|
||||
</shortcut>
|
||||
<shortcut id="CppEditor.SwitchDeclarationDefinition" >
|
||||
<key value="Ctrl+Shift+F12" />
|
||||
</shortcut>
|
||||
<shortcut id="Qt4Builder.RunQMake" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Qt4Builder.RunQMakeContextMenu" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.Edit" >
|
||||
<key value="Alt+P, Alt+E" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.Add" >
|
||||
<key value="Alt+P, Alt+A" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.Delete" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.Revert" >
|
||||
<key value="Alt+P, Alt+R" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.DiffCurrent" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.DiffProject" >
|
||||
<key value="Alt+P, Alt+D" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.DiffAll" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.Opened" >
|
||||
<key value="Alt+P, Alt+O" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.Submit" >
|
||||
<key value="Alt+P, Alt+S" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.PendingChanges" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.Describe" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.AnnotateCurrent" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.Annotate" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.FilelogCurrent" >
|
||||
<key value="Alt+P, Alt+F" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.Filelog" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.SubmitCurrentLog" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Perforce.DiffSelectedFilesInLog" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.StartExternal" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.AttachExternal" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.Interrupt" >
|
||||
<key value="Shift+F5" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.Reset" >
|
||||
<key value="Ctrl+Shift+F5" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.NextLine" >
|
||||
<key value="F10" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.StepLine" >
|
||||
<key value="F11" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.StepOut" >
|
||||
<key value="Shift+F11" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.NextInstruction" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.StepInstruction" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.RunToLine" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.RunToFunction" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
</mapping>
|
456
Ground/share/openpilotgcs/schemes/Xcode.kms
Normal file
456
Ground/share/openpilotgcs/schemes/Xcode.kms
Normal file
@ -0,0 +1,456 @@
|
||||
<!DOCTYPE KeyboardMappingScheme>
|
||||
<mapping>
|
||||
<shortcut id="QtCreator.ReturnToEditor" >
|
||||
<key value="Esc" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.New" >
|
||||
<key value="Ctrl+N" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Open" >
|
||||
<key value="Ctrl+O" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.OpenWith" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Save" >
|
||||
<key value="Ctrl+S" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.SaveAs" >
|
||||
<key value="Ctrl+Shift+S" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.SaveAll" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Print" >
|
||||
<key value="Ctrl+P" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Exit" >
|
||||
<key value="Ctrl+Q" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Undo" >
|
||||
<key value="Ctrl+Z" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Redo" >
|
||||
<key value="Ctrl+Shift+Z" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Cut" >
|
||||
<key value="Ctrl+X" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Copy" >
|
||||
<key value="Ctrl+C" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Paste" >
|
||||
<key value="Ctrl+V" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.SelectAll" >
|
||||
<key value="Ctrl+A" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Goto" >
|
||||
<key value="Ctrl+L" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Options" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.MinimizeWindow" >
|
||||
<key value="Ctrl+M" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.ZoomWindow" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.ToggleSidebar" >
|
||||
<key value="Ctrl+0" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.AboutQtCreator" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.AboutPlugins" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.RevertToSaved" >
|
||||
<key value="Ctrl+U" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Close" >
|
||||
<key value="Ctrl+Shift+W" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.CloseAll" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.DuplicateDocument" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.GotoPreviousInHistory" >
|
||||
<key value="Alt+Tab" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.GotoNextInHistory" >
|
||||
<key value="Alt+Shift+Tab" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.GoBack" >
|
||||
<key value="Ctrl+Alt+Left" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Horizontal" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Vertical" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Remove" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.SaveAsDefaultLayout" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.RestoreDefaultLayout" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.GotoPreviousTabGroup" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.GotoNextTabGroup" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.DocumentToPreviousGroup" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.DocumentToNextGroup" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Mode.Output" >
|
||||
<key value="Meta+6" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Mode.Welcome" >
|
||||
<key value="Meta+1" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Mode.Edit" >
|
||||
<key value="Meta+2" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.FindInCurrentDocument" >
|
||||
<key value="Ctrl+F" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.EnterFindString" >
|
||||
<key value="Ctrl+E" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.FindNext" >
|
||||
<key value="Ctrl+G" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.FindPrevious" >
|
||||
<key value="Ctrl+Shift+G" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.ReplaceNext" >
|
||||
<key value="Ctrl+=" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.ReplacePrevious" >
|
||||
<key value="Ctrl+Shift+=" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.ReplaceAll" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.CaseSensitive" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Find.WholeWords" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Locate" >
|
||||
<key value="Ctrl+Shift+D" />
|
||||
</shortcut>
|
||||
<shortcut id="TextEditor.CompleteThis" >
|
||||
<key value="Alt+Esc" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Mode.Project" >
|
||||
<key value="Meta+4" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.NewSession" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.NewProject" >
|
||||
<key value="Ctrl+Shift+N" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Load" >
|
||||
<key value="Ctrl+Shift+O" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.OpenFile" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Unload" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.ClearSession" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.BuildSession" >
|
||||
<key value="Ctrl+B" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.RebuildSession" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.CleanSession" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Build" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Rebuild" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Clean" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Run" >
|
||||
<key value="Ctrl+R" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.GoToTaskWindow" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.CancelBuild" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Debug" >
|
||||
<key value="Ctrl+Y" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.Dependencies" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.AddNewFile" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.AddExistingFiles" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.RemoveFile" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="ProjectExplorer.RenameFile" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="CppTools.SwitchHeaderSource" >
|
||||
<key value="Ctrl+Alt+Up" />
|
||||
</shortcut>
|
||||
<shortcut id="CppEditor.JumpToDefinition" >
|
||||
<key value="F2" />
|
||||
</shortcut>
|
||||
<shortcut id="CppEditor.SwitchDeclarationDefinition" >
|
||||
<key value="Shift+F2" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Edit.Delete" >
|
||||
<key value="Del" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.WidgetEditor" >
|
||||
<key value="F3" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.SignalsSlotsEditor" >
|
||||
<key value="F4" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.BuddyEditor" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.TabOrderEditor" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.LayoutHorizontally" >
|
||||
<key value="Ctrl+H" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.LayoutVertically" >
|
||||
<key value="Ctrl+L" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.SplitHorizontal" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.SplitVertical" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.LayoutForm" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.LayoutGrid" >
|
||||
<key value="Ctrl+G" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.LayoutBreak" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.LayoutAdjustSize" >
|
||||
<key value="Ctrl+J" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.SimplifyLayout" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Lower" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Raise" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Preview" >
|
||||
<key value="Ctrl+Alt+R" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Menu.Preview.Windows" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Menu.Preview.Motif" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Menu.Preview.CDE" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Menu.Preview.Plastique" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Menu.Preview.Cleanlooks" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.Menu.Preview.Macintosh (aqua)" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="FormEditor.FormSettings" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Home" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Previous" >
|
||||
<key value="Backspace" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Next" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.AddBookmark" >
|
||||
<key value="Ctrl+D" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Index" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Contents" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Search" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.Context" >
|
||||
<key value="F1" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Mode.Help" >
|
||||
<key value="Meta+5" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.IndexShortcut" >
|
||||
<key value="Ctrl+I" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.ContentsShortcut" >
|
||||
<key value="Ctrl+T" />
|
||||
</shortcut>
|
||||
<shortcut id="Help.SearchShortcut" >
|
||||
<key value="Ctrl+S" />
|
||||
</shortcut>
|
||||
<shortcut id="Qt4Builder.RunQMake" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Qt4Builder.RunQMakeContextMenu" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtScriptEditor.Run" >
|
||||
<key value="Ctrl+R" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.StartExternal" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.AttachExternal" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.Interrupt" >
|
||||
<key value="Ctrl+Alt+P" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.Reset" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.NextLine" >
|
||||
<key value="Ctrl+Shift+O" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.StepLine" >
|
||||
<key value="Ctrl+Shift+I" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.StepOut" >
|
||||
<key value="Ctrl+Shift+T" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.NextInstruction" >
|
||||
<key value="Ctrl+Alt+Shift+O" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.StepInstruction" >
|
||||
<key value="Ctrl+Alt+Shift+I" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.RunToLine" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.RunToFunction" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.JumpToLine" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.ToggleBreak" >
|
||||
<key value="Ctrl+\" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.BreakByFunction" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.BreakAtMain" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.SkipKnownFrames" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.UseCustomDumpers" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.UseFastStart" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.DumpLog" >
|
||||
<key value="Ctrl+Shift+F11" />
|
||||
</shortcut>
|
||||
<shortcut id="Debugger.AddToWatch" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Mode.Debug" >
|
||||
<key value="Meta+3" />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.Toggle" >
|
||||
<key value="Ctrl+D" />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.MoveUp" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.MoveDown" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.Previous" >
|
||||
<key value="Meta+," />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.Next" >
|
||||
<key value="Meta+." />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.PreviousDocument" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="Bookmarks.NextDocument" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.Problems" >
|
||||
<key value="Ctrl+1" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.SearchResults" >
|
||||
<key value="Ctrl+2" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.ApplicationOutput" >
|
||||
<key value="Ctrl+3" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.Compile" >
|
||||
<key value="Ctrl+4" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.Git" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.Perforce" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
<shortcut id="QtCreator.Pane.General" >
|
||||
<key value="" />
|
||||
</shortcut>
|
||||
</mapping>
|
26
Ground/share/openpilotgcs/snippets/class_generic.snp
Normal file
26
Ground/share/openpilotgcs/snippets/class_generic.snp
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE QtCreatorSnippet>
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>Name</variable>
|
||||
<value type="QString" >Class - Generic</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Description</variable>
|
||||
<value type="QString" >This creates a new generic class</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Category</variable>
|
||||
<value type="QString" >Classes</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Shortcut</variable>
|
||||
<value type="QString" >cl</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Contents</variable>
|
||||
<value type="QString" ><![CDATA[class $anchor$MyClass$cursor$
|
||||
{
|
||||
$selection$
|
||||
};]]></value>
|
||||
</data>
|
||||
</qtcreator>
|
29
Ground/share/openpilotgcs/snippets/class_qobject.snp
Normal file
29
Ground/share/openpilotgcs/snippets/class_qobject.snp
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE QtCreatorSnippet>
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>Name</variable>
|
||||
<value type="QString" >Class - QObject</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Description</variable>
|
||||
<value type="QString" >This creates a new class deriving from QObject</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Category</variable>
|
||||
<value type="QString" >Classes</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Shortcut</variable>
|
||||
<value type="QString" >cl</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Contents</variable>
|
||||
<value type="QString" ><![CDATA[class $anchor$MyClass$cursor$ : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
$selection$
|
||||
};]]></value>
|
||||
</data>
|
||||
</qtcreator>
|
29
Ground/share/openpilotgcs/snippets/class_qwidget.snp
Normal file
29
Ground/share/openpilotgcs/snippets/class_qwidget.snp
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE QtCreatorSnippet>
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>Name</variable>
|
||||
<value type="QString" >Class - QWidget</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Description</variable>
|
||||
<value type="QString" >This creates a new class deriving from QWidget</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Category</variable>
|
||||
<value type="QString" >Classes</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Shortcut</variable>
|
||||
<value type="QString" >cl</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Contents</variable>
|
||||
<value type="QString" ><![CDATA[class $anchor$MyClass$cursor$ : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
$selection$
|
||||
};]]></value>
|
||||
</data>
|
||||
</qtcreator>
|
23
Ground/share/openpilotgcs/snippets/comment.snp
Normal file
23
Ground/share/openpilotgcs/snippets/comment.snp
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE QtCreatorSnippet>
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>Name</variable>
|
||||
<value type="QString" >/* ... */ Comment</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Description</variable>
|
||||
<value type="QString" >This creates comment</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Category</variable>
|
||||
<value type="QString" >Other</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Shortcut</variable>
|
||||
<value type="QString" >/*</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Contents</variable>
|
||||
<value type="QString" ><![CDATA[/* $anchor$$selection$$cursor$ */]]></value>
|
||||
</data>
|
||||
</qtcreator>
|
48
Ground/share/openpilotgcs/snippets/for.snp
Normal file
48
Ground/share/openpilotgcs/snippets/for.snp
Normal file
@ -0,0 +1,48 @@
|
||||
<!DOCTYPE QtCreatorSnippet>
|
||||
<qtcreator>
|
||||
|
||||
<data>
|
||||
<variable>Name</variable>
|
||||
<value type="QString" >for loop</value>
|
||||
</data>
|
||||
|
||||
<data>
|
||||
<variable>Description</variable>
|
||||
<value type="QString" >This inserts an incrementing for loop</value>
|
||||
</data>
|
||||
|
||||
<data>
|
||||
<variable>Category</variable>
|
||||
<value type="QString" >Common Statements</value>
|
||||
</data>
|
||||
|
||||
<data>
|
||||
<variable>Shortcut</variable>
|
||||
<value type="QString" >fo</value>
|
||||
</data>
|
||||
|
||||
<data>
|
||||
<variable>Contents</variable>
|
||||
<value type="QString" ><![CDATA[for (%1 %2 = 0; %2 < %3; ++%2) {
|
||||
$anchor$$selection$$cursor$
|
||||
}]]></value>
|
||||
</data>
|
||||
|
||||
<data>
|
||||
<variable>Arguments</variable>
|
||||
<valuemap type="QVariantMap" >
|
||||
<value key="1" type="QString"><![CDATA[<tt>for (<b>TYPE</b> VAR = 0; VAR < CONDITION; ++VAR)...</tt>]]></value>
|
||||
<value key="2" type="QString"><![CDATA[<tt>for (%1 <b>VAR</b> = 0; <b>VAR</b> < 10; ++<b>VAR</b>)...</tt>]]></value>
|
||||
<value key="3" type="QString"><![CDATA[<tt>for (%1 %2 = 0; %2 < <b>CONDITION</b>; ++%2)...</tt>]]></value>
|
||||
</valuemap>
|
||||
</data>
|
||||
|
||||
<data>
|
||||
<variable>ArgumentDefaults</variable>
|
||||
<valuemap type="QVariantMap" >
|
||||
<value key="1" type="QString">int</value>
|
||||
<value key="2" type="QString">i</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
|
||||
</qtcreator>
|
25
Ground/share/openpilotgcs/snippets/foreach.snp
Normal file
25
Ground/share/openpilotgcs/snippets/foreach.snp
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE QtCreatorSnippet>
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>Name</variable>
|
||||
<value type="QString" >foreach statement</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Description</variable>
|
||||
<value type="QString" >This creates a foreach statement</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Category</variable>
|
||||
<value type="QString" >Common Statements</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Shortcut</variable>
|
||||
<value type="QString" >fo</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Contents</variable>
|
||||
<value type="QString" ><![CDATA[foreach ($cursor$) {
|
||||
$selection$
|
||||
}]]></value>
|
||||
</data>
|
||||
</qtcreator>
|
25
Ground/share/openpilotgcs/snippets/if.snp
Normal file
25
Ground/share/openpilotgcs/snippets/if.snp
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE QtCreatorSnippet>
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>Name</variable>
|
||||
<value type="QString" >if Statement</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Description</variable>
|
||||
<value type="QString" >This creates a if statement</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Category</variable>
|
||||
<value type="QString" >Common Statements</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Shortcut</variable>
|
||||
<value type="QString" >if</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Contents</variable>
|
||||
<value type="QString" ><![CDATA[if ($cursor$) {
|
||||
$selection$
|
||||
}]]></value>
|
||||
</data>
|
||||
</qtcreator>
|
27
Ground/share/openpilotgcs/snippets/ifelse.snp
Normal file
27
Ground/share/openpilotgcs/snippets/ifelse.snp
Normal file
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE QtCreatorSnippet>
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>Name</variable>
|
||||
<value type="QString" >if - else Statement</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Description</variable>
|
||||
<value type="QString" >This creates a if...else statement</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Category</variable>
|
||||
<value type="QString" >Common Statements</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Shortcut</variable>
|
||||
<value type="QString" >if</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Contents</variable>
|
||||
<value type="QString" ><![CDATA[if ($cursor$) {
|
||||
$selection$
|
||||
} else {
|
||||
|
||||
}]]></value>
|
||||
</data>
|
||||
</qtcreator>
|
66
Ground/share/openpilotgcs/static.pro
Normal file
66
Ground/share/openpilotgcs/static.pro
Normal file
@ -0,0 +1,66 @@
|
||||
include(../../openpilotgcs.pri)
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = phony_target
|
||||
CONFIG -= qt
|
||||
QT =
|
||||
LIBS =
|
||||
|
||||
isEmpty(vcproj) {
|
||||
QMAKE_LINK = @: IGNORE THIS LINE
|
||||
OBJECTS_DIR =
|
||||
win32:CONFIG -= embed_manifest_exe
|
||||
} else {
|
||||
CONFIG += console
|
||||
PHONY_DEPS = .
|
||||
phony_src.input = PHONY_DEPS
|
||||
phony_src.output = phony.c
|
||||
phony_src.variable_out = GENERATED_SOURCES
|
||||
phony_src.commands = echo int main() { return 0; } > phony.c
|
||||
phony_src.name = CREATE phony.c
|
||||
phony_src.CONFIG += combine
|
||||
QMAKE_EXTRA_COMPILERS += phony_src
|
||||
}
|
||||
|
||||
DATA_DIRS = \
|
||||
snippets \
|
||||
templates \
|
||||
designer \
|
||||
schemes \
|
||||
styles \
|
||||
gdbmacros
|
||||
|
||||
!isEmpty(copydata) {
|
||||
|
||||
for(data_dir, DATA_DIRS) {
|
||||
files = $$files($$PWD/$$data_dir/*.*, true)
|
||||
win32:files ~= s|\\\\|/|g
|
||||
FILES += $$files
|
||||
}
|
||||
|
||||
copy2build.input = FILES
|
||||
copy2build.output = $$IDE_DATA_PATH/${QMAKE_FUNC_FILE_IN_stripSrcDir}
|
||||
isEmpty(vcproj):copy2build.variable_out = PRE_TARGETDEPS
|
||||
win32:copy2build.commands = $$QMAKE_COPY \"${QMAKE_FILE_IN}\" \"${QMAKE_FILE_OUT}\"
|
||||
unix:copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
|
||||
copy2build.name = COPY ${QMAKE_FILE_IN}
|
||||
copy2build.CONFIG += no_link
|
||||
QMAKE_EXTRA_COMPILERS += copy2build
|
||||
|
||||
macx {
|
||||
run_in_term.target = $$IDE_DATA_PATH/runInTerminal.command
|
||||
run_in_term.depends = $$PWD/runInTerminal.command
|
||||
run_in_term.commands = $$QMAKE_COPY \"$<\" \"$@\"
|
||||
QMAKE_EXTRA_TARGETS += run_in_term
|
||||
PRE_TARGETDEPS += $$run_in_term.target
|
||||
QMAKE_CLEAN += $$run_in_term.target
|
||||
}
|
||||
}
|
||||
|
||||
!macx {
|
||||
for(data_dir, DATA_DIRS) {
|
||||
eval($${data_dir}.files = $$quote($$PWD/$$data_dir))
|
||||
eval($${data_dir}.path = /share/openpilotgcs)
|
||||
INSTALLS += $$data_dir
|
||||
}
|
||||
}
|
4
Ground/share/openpilotgcs/styles/default.xml
Normal file
4
Ground/share/openpilotgcs/styles/default.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<style-scheme version="1.0" name="Default">
|
||||
<!-- Empty scheme, relying entirely on built-in defaults. -->
|
||||
</style-scheme>
|
32
Ground/share/openpilotgcs/styles/fakevim.xml
Normal file
32
Ground/share/openpilotgcs/styles/fakevim.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<style-scheme version="1.0" name="FakeVim (dark)">
|
||||
<!--
|
||||
Based on the default vim theme for a dark background, Linux console colors.
|
||||
-->
|
||||
<style name="AddedLine" foreground="#55ffff"/>
|
||||
<style name="RemovedLine" foreground="#ff5555"/>
|
||||
<style name="Comment" foreground="#55ffff"/>
|
||||
<style name="CurrentLine" background="#232323"/>
|
||||
<style name="CurrentLineNumber" foreground="#aaaaaa" bold="true"/>
|
||||
<style name="DiffFile" foreground="#55ff55"/>
|
||||
<style name="DiffLocation" foreground="#ffff55"/>
|
||||
<style name="DisabledCode" foreground="#777777" background="#222222"/>
|
||||
<style name="Doxygen.Comment" foreground="#55ffff"/>
|
||||
<style name="Doxygen.Tag" foreground="#00a0a0"/>
|
||||
<style name="Keyword" foreground="#ffff55"/>
|
||||
<style name="Label" foreground="#ffff55"/>
|
||||
<style name="LineNumber" foreground="#888888" background="#232323"/>
|
||||
<style name="Link" foreground="#0055ff"/>
|
||||
<style name="Number" foreground="#ff55ff"/>
|
||||
<style name="Occurrences" background="#363636"/>
|
||||
<style name="Occurrences.Rename" foreground="#ffaaaa" background="#553636"/>
|
||||
<style name="Operator" foreground="#aaaaaa"/>
|
||||
<style name="Parentheses" foreground="#ff5555" background="#333333"/>
|
||||
<style name="Preprocessor" foreground="#5555ff"/>
|
||||
<style name="SearchResult" background="#555500"/>
|
||||
<style name="SearchScope" background="#222200"/>
|
||||
<style name="Selection" foreground="#000000" background="#aaaaaa"/>
|
||||
<style name="String" foreground="#ff55ff"/>
|
||||
<style name="Text" foreground="#aaaaaa" background="#000000"/>
|
||||
<style name="Type" foreground="#55ff55"/>
|
||||
</style-scheme>
|
35
Ground/share/openpilotgcs/styles/grayscale.xml
Normal file
35
Ground/share/openpilotgcs/styles/grayscale.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<style-scheme version="1.0" name="Grayscale">
|
||||
<style name="AddedLine" foreground="#636363"/>
|
||||
<style name="Comment" foreground="#808080"/>
|
||||
<style name="CurrentLine" foreground="#000000" background="#f2f2f2"/>
|
||||
<style name="DiffFile"/>
|
||||
<style name="DiffLocation"/>
|
||||
<style name="DisabledCode" foreground="#a0a0a4"/>
|
||||
<style name="Doxygen.Comment" foreground="#808080"/>
|
||||
<style name="Doxygen.Tag" foreground="#808080" italic="true"/>
|
||||
<style name="Keyword" bold="true"/>
|
||||
<style name="Label"/>
|
||||
<style name="LineNumber" foreground="#c7c4c1" background="#efebe7"/>
|
||||
<style name="Link" foreground="#0000ff"/>
|
||||
<style name="Number" foreground="#3f3f3f"/>
|
||||
<style name="Operator"/>
|
||||
<style name="Parentheses" background="#e3e3e3" bold="true"/>
|
||||
<style name="Preprocessor" foreground="#5b5b5b"/>
|
||||
<style name="RemovedLine" foreground="#a0a0a4"/>
|
||||
<style name="String" foreground="#636363"/>
|
||||
<style name="Text" foreground="#000000" background="#ffffff"/>
|
||||
<style name="Type"/>
|
||||
<!--
|
||||
Relying on default colors for:
|
||||
|
||||
CurrentLineNumber
|
||||
LineNumber
|
||||
SearchResult
|
||||
SearchScope
|
||||
Selection
|
||||
Occurrences
|
||||
Occurrences.Rename
|
||||
|
||||
-->
|
||||
</style-scheme>
|
@ -0,0 +1,14 @@
|
||||
@PLUGIN_INCLUDES@
|
||||
|
||||
@COLLECTION_PLUGIN_CLASS@::@COLLECTION_PLUGIN_CLASS@(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
@PLUGIN_ADDITIONS@
|
||||
}
|
||||
|
||||
QList<QDesignerCustomWidgetInterface*> @COLLECTION_PLUGIN_CLASS@::customWidgets() const
|
||||
{
|
||||
return m_widgets;
|
||||
}
|
||||
|
||||
@COLLECTION_PLUGIN_EXPORT@
|
@ -0,0 +1,21 @@
|
||||
#ifndef @COLLECTION_INCLUDE_GUARD@
|
||||
#define @COLLECTION_INCLUDE_GUARD@
|
||||
|
||||
#include <QtDesigner/QtDesigner>
|
||||
#include <QtCore/qplugin.h>
|
||||
|
||||
class @COLLECTION_PLUGIN_CLASS@ : public QObject, public QDesignerCustomWidgetCollectionInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
|
||||
|
||||
public:
|
||||
explicit @COLLECTION_PLUGIN_CLASS@(QObject *parent = 0);
|
||||
|
||||
virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const;
|
||||
|
||||
private:
|
||||
QList<QDesignerCustomWidgetInterface*> m_widgets;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,13 @@
|
||||
CONFIG += designer plugin debug_and_release
|
||||
TARGET = $$qtLibraryTarget(@PLUGIN_NAME@)
|
||||
TEMPLATE = lib
|
||||
|
||||
HEADERS =@PLUGIN_HEADERS@
|
||||
SOURCES =@PLUGIN_SOURCES@
|
||||
RESOURCES = @PLUGIN_RESOURCES@
|
||||
LIBS += -L. @WIDGET_LIBS@
|
||||
|
||||
target.path = $$[QT_INSTALL_PLUGINS]/designer
|
||||
INSTALLS += target
|
||||
|
||||
@INCLUSIONS@
|
@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
@ICON_FILES@
|
||||
</qresource>
|
||||
</RCC>
|
@ -0,0 +1,71 @@
|
||||
#include "@WIDGET_HEADER@"
|
||||
#include "@PLUGIN_HEADER@"
|
||||
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
@PLUGIN_CLASS@::@PLUGIN_CLASS@(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
void @PLUGIN_CLASS@::initialize(QDesignerFormEditorInterface * /* core */)
|
||||
{
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
bool @PLUGIN_CLASS@::isInitialized() const
|
||||
{
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
QWidget *@PLUGIN_CLASS@::createWidget(QWidget *parent)
|
||||
{
|
||||
return new @WIDGET_CLASS@(parent);
|
||||
}
|
||||
|
||||
QString @PLUGIN_CLASS@::name() const
|
||||
{
|
||||
return QLatin1String("@WIDGET_CLASS@");
|
||||
}
|
||||
|
||||
QString @PLUGIN_CLASS@::group() const
|
||||
{
|
||||
return QLatin1String("@WIDGET_GROUP@");
|
||||
}
|
||||
|
||||
QIcon @PLUGIN_CLASS@::icon() const
|
||||
{
|
||||
return QIcon(@WIDGET_ICON@);
|
||||
}
|
||||
|
||||
QString @PLUGIN_CLASS@::toolTip() const
|
||||
{
|
||||
return QLatin1String("@WIDGET_TOOLTIP@");
|
||||
}
|
||||
|
||||
QString @PLUGIN_CLASS@::whatsThis() const
|
||||
{
|
||||
return QLatin1String("@WIDGET_WHATSTHIS@");
|
||||
}
|
||||
|
||||
bool @PLUGIN_CLASS@::isContainer() const
|
||||
{
|
||||
return @WIDGET_ISCONTAINER@;
|
||||
}
|
||||
|
||||
QString @PLUGIN_CLASS@::domXml() const
|
||||
{
|
||||
return QLatin1String("@WIDGET_DOMXML@");
|
||||
}
|
||||
|
||||
QString @PLUGIN_CLASS@::includeFile() const
|
||||
{
|
||||
return QLatin1String("@WIDGET_HEADER@");
|
||||
}
|
||||
@SINGLE_PLUGIN_EXPORT@
|
@ -0,0 +1,30 @@
|
||||
#ifndef @SINGLE_INCLUDE_GUARD@
|
||||
#define @SINGLE_INCLUDE_GUARD@
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class @PLUGIN_CLASS@ : public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
@PLUGIN_CLASS@(QObject *parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget *createWidget(QWidget *parent);
|
||||
void initialize(QDesignerFormEditorInterface *core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,6 @@
|
||||
#include "@WIDGET_HEADER@"
|
||||
|
||||
@WIDGET_CLASS@::@WIDGET_CLASS@(QWidget *parent) :
|
||||
@WIDGET_BASE_CLASS@(parent)
|
||||
{
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
#ifndef @WIDGET_INCLUDE_GUARD@
|
||||
#define @WIDGET_INCLUDE_GUARD@
|
||||
|
||||
#include <QtGui/@WIDGET_BASE_CLASS@>
|
||||
|
||||
class @WIDGET_CLASS@ : public @WIDGET_BASE_CLASS@
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@WIDGET_CLASS@(QWidget *parent = 0);
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,2 @@
|
||||
HEADERS +=@WIDGET_HEADERS@
|
||||
SOURCES +=@WIDGET_SOURCES@
|
@ -0,0 +1,4 @@
|
||||
TEMPLATE = lib
|
||||
HEADERS =@WIDGET_HEADERS@
|
||||
SOURCES =@WIDGET_SOURCES@
|
||||
TARGET = @WIDGET_LIBRARY@
|
10
Ground/share/openpilotgcs/templates/qt4project/main.cpp
Normal file
10
Ground/share/openpilotgcs/templates/qt4project/main.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include <%QAPP_INCLUDE%>
|
||||
#include "%INCLUDE%"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
%CLASS% w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
11
Ground/share/openpilotgcs/templates/qt4project/mywidget.cpp
Normal file
11
Ground/share/openpilotgcs/templates/qt4project/mywidget.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include "%INCLUDE%"
|
||||
|
||||
%CLASS%::%CLASS%(QWidget *parent)
|
||||
: %BASECLASS%(parent)
|
||||
{
|
||||
}
|
||||
|
||||
%CLASS%::~%CLASS%()
|
||||
{
|
||||
|
||||
}
|
15
Ground/share/openpilotgcs/templates/qt4project/mywidget.h
Normal file
15
Ground/share/openpilotgcs/templates/qt4project/mywidget.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef %PRE_DEF%
|
||||
#define %PRE_DEF%
|
||||
|
||||
#include <QtGui/%BASECLASS%>
|
||||
|
||||
class %CLASS% : public %BASECLASS%
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
%CLASS%(QWidget *parent = 0);
|
||||
~%CLASS%();
|
||||
};
|
||||
|
||||
#endif // %PRE_DEF%
|
@ -0,0 +1,13 @@
|
||||
#include "%INCLUDE%"
|
||||
#include "%UI_HDR%"
|
||||
|
||||
%CLASS%::%CLASS%(QWidget *parent)
|
||||
: %BASECLASS%(parent), ui(new Ui::%CLASS%)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
%CLASS%::~%CLASS%()
|
||||
{
|
||||
delete ui;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
#ifndef %PRE_DEF%
|
||||
#define %PRE_DEF%
|
||||
|
||||
#include <QtGui/%BASECLASS%>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class %CLASS%;
|
||||
}
|
||||
|
||||
class %CLASS% : public %BASECLASS%
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
%CLASS%(QWidget *parent = 0);
|
||||
~%CLASS%();
|
||||
|
||||
private:
|
||||
Ui::%CLASS% *ui;
|
||||
};
|
||||
|
||||
#endif // %PRE_DEF%
|
20
Ground/share/openpilotgcs/templates/qt4project/widget.ui
Normal file
20
Ground/share/openpilotgcs/templates/qt4project/widget.ui
Normal file
@ -0,0 +1,20 @@
|
||||
<ui version="4.0">
|
||||
<class>%CLASS%</class>
|
||||
<widget class="%BASECLASS%" name="%CLASS%" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>%CLASS%</string>
|
||||
</property>%CENTRAL_WIDGET%
|
||||
</widget>
|
||||
<layoutDefault spacing="6" margin="11" />
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
32
Ground/share/openpilotgcs/translations/README
Normal file
32
Ground/share/openpilotgcs/translations/README
Normal file
@ -0,0 +1,32 @@
|
||||
How To add translations to Qt Creator
|
||||
=====================================
|
||||
|
||||
- Coordinate over the mailing list to avoid duplicate work.
|
||||
|
||||
- Add your language to the LANGUAGES line in translations.pro.
|
||||
Don't qualify it with a country unless it is reasonable to expect
|
||||
country-specific variants.
|
||||
Skip this step if updating an existing translation, obviously.
|
||||
|
||||
- Run "make ts". This will complain if you are not building against
|
||||
Qt 4.6 (or the master branch which will become it).
|
||||
|
||||
If your Qt version is too old, you may create a template by running
|
||||
lconvert --drop-translations qtcreator_de.ts -o qtcreator_<yours>.ts
|
||||
and adjusting the language attribute in the new .ts file. The downside
|
||||
of this method is obviously that you will not be translating the newest
|
||||
Creator sources (unless qtcreator_de.ts was completely up-to-date).
|
||||
Of course, this method is not applicable if you are updating an existing
|
||||
translation.
|
||||
|
||||
You may also request an up-to-date template from us.
|
||||
|
||||
The remaining steps do *not* require Qt 4.6 in any case.
|
||||
|
||||
- Fire up linguist and do the translation.
|
||||
|
||||
- Check in the modified .pro file and _only_ your .ts file.
|
||||
|
||||
- Make a merge request on gitorious.
|
||||
|
||||
- .qm files are generated as part of the regular build.
|
@ -0,0 +1,6 @@
|
||||
let $files := ( "" )
|
||||
let $prefix := string("QT_TRANSLATE_NOOP("MimeType", "")
|
||||
let $suffix := concat("")", codepoints-to-string(10))
|
||||
for $file in $files
|
||||
for $comment in doc($file)/*:mime-info/*:mime-type/*:comment
|
||||
return fn:concat($prefix, data($comment), $suffix)
|
@ -0,0 +1,6 @@
|
||||
let $files := ( $$MIMETYPES_FILES )
|
||||
let $prefix := string(\"QT_TRANSLATE_NOOP("MimeType", "\")
|
||||
let $suffix := concat(\"")\", codepoints-to-string(10))
|
||||
for $file in $files
|
||||
for $comment in doc($file)/*:mime-info/*:mime-type/*:comment
|
||||
return fn:concat($prefix, data($comment), $suffix)
|
16153
Ground/share/openpilotgcs/translations/qtcreator_de.ts
Normal file
16153
Ground/share/openpilotgcs/translations/qtcreator_de.ts
Normal file
File diff suppressed because it is too large
Load Diff
16719
Ground/share/openpilotgcs/translations/qtcreator_es.ts
Normal file
16719
Ground/share/openpilotgcs/translations/qtcreator_es.ts
Normal file
File diff suppressed because it is too large
Load Diff
16661
Ground/share/openpilotgcs/translations/qtcreator_fr.ts
Normal file
16661
Ground/share/openpilotgcs/translations/qtcreator_fr.ts
Normal file
File diff suppressed because it is too large
Load Diff
16700
Ground/share/openpilotgcs/translations/qtcreator_it.ts
Normal file
16700
Ground/share/openpilotgcs/translations/qtcreator_it.ts
Normal file
File diff suppressed because it is too large
Load Diff
16019
Ground/share/openpilotgcs/translations/qtcreator_ja.ts
Normal file
16019
Ground/share/openpilotgcs/translations/qtcreator_ja.ts
Normal file
File diff suppressed because it is too large
Load Diff
15986
Ground/share/openpilotgcs/translations/qtcreator_pl.ts
Normal file
15986
Ground/share/openpilotgcs/translations/qtcreator_pl.ts
Normal file
File diff suppressed because it is too large
Load Diff
16024
Ground/share/openpilotgcs/translations/qtcreator_ru.ts
Normal file
16024
Ground/share/openpilotgcs/translations/qtcreator_ru.ts
Normal file
File diff suppressed because it is too large
Load Diff
19736
Ground/share/openpilotgcs/translations/qtcreator_sl.ts
Normal file
19736
Ground/share/openpilotgcs/translations/qtcreator_sl.ts
Normal file
File diff suppressed because it is too large
Load Diff
65
Ground/share/openpilotgcs/translations/translations.pro
Normal file
65
Ground/share/openpilotgcs/translations/translations.pro
Normal file
@ -0,0 +1,65 @@
|
||||
include(../../../openpilotgcs.pri)
|
||||
|
||||
LANGUAGES = de es fr it ja pl ru sl
|
||||
|
||||
# var, prepend, append
|
||||
defineReplace(prependAll) {
|
||||
for(a,$$1):result += $$2$${a}$$3
|
||||
return($$result)
|
||||
}
|
||||
|
||||
XMLPATTERNS = $$targetPath($$[QT_INSTALL_BINS]/xmlpatterns)
|
||||
LUPDATE = $$targetPath($$[QT_INSTALL_BINS]/lupdate) -locations relative -no-ui-lines -no-sort
|
||||
LRELEASE = $$targetPath($$[QT_INSTALL_BINS]/lrelease)
|
||||
|
||||
TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/qtcreator_,.ts)
|
||||
|
||||
MIME_TR_H = $$IDE_DATA_PATH/translations/mime_tr.h
|
||||
|
||||
contains(QT_VERSION, ^4\.[0-5]\..*) {
|
||||
ts.commands = @echo This Qt version is too old for the ts target. Need Qt 4.6+.
|
||||
} else {
|
||||
for(dir, $$list($$files($$IDE_SOURCE_TREE/src/plugins/*))):MIMETYPES_FILES += $$files($$dir/*.mimetypes.xml)
|
||||
MIMETYPES_FILES = \"$$join(MIMETYPES_FILES, \", \")\"
|
||||
QMAKE_SUBSTITUTES += extract-mimetypes.xq.in
|
||||
ts.commands += \
|
||||
$$XMLPATTERNS -output $$MIME_TR_H $$PWD/extract-mimetypes.xq && \
|
||||
(cd $$IDE_SOURCE_TREE && $$LUPDATE src $$MIME_TR_H -ts $$TRANSLATIONS) && \
|
||||
$$QMAKE_DEL_FILE $$MIME_TR_H
|
||||
}
|
||||
QMAKE_EXTRA_TARGETS += ts
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = phony_target2
|
||||
CONFIG -= qt
|
||||
QT =
|
||||
LIBS =
|
||||
|
||||
updateqm.input = TRANSLATIONS
|
||||
updateqm.output = $$IDE_DATA_PATH/translations/${QMAKE_FILE_BASE}.qm
|
||||
isEmpty(vcproj):updateqm.variable_out = PRE_TARGETDEPS
|
||||
updateqm.commands = $$LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT}
|
||||
updateqm.name = LRELEASE ${QMAKE_FILE_IN}
|
||||
updateqm.CONFIG += no_link
|
||||
QMAKE_EXTRA_COMPILERS += updateqm
|
||||
|
||||
isEmpty(vcproj) {
|
||||
QMAKE_LINK = @: IGNORE THIS LINE
|
||||
OBJECTS_DIR =
|
||||
win32:CONFIG -= embed_manifest_exe
|
||||
} else {
|
||||
CONFIG += console
|
||||
PHONY_DEPS = .
|
||||
phony_src.input = PHONY_DEPS
|
||||
phony_src.output = phony.c
|
||||
phony_src.variable_out = GENERATED_SOURCES
|
||||
phony_src.commands = echo int main() { return 0; } > phony.c
|
||||
phony_src.name = CREATE phony.c
|
||||
phony_src.CONFIG += combine
|
||||
QMAKE_EXTRA_COMPILERS += phony_src
|
||||
}
|
||||
|
||||
qmfiles.files = $$prependAll(LANGUAGES, $$OUT_PWD/qtcreator_,.qm)
|
||||
qmfiles.path = /share/qtcreator/translations
|
||||
qmfiles.CONFIG += no_check_exist
|
||||
INSTALLS += qmfiles
|
2
Ground/share/share.pro
Normal file
2
Ground/share/share.pro
Normal file
@ -0,0 +1,2 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = openpilotgcs/static.pro openpilotgcs/translations
|
191
Ground/src/app/Info.plist
Normal file
191
Ground/src/app/Info.plist
Normal file
@ -0,0 +1,191 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>profile.icns</string>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>pro</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Qt Project File</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Default</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>prifile.icns</string>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>pri</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Qt Project Include File</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Default</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>qrc</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Qt Resource File</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Default</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>ui</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Qt UI File</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>h</string>
|
||||
<string>hpp</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Header File</string>
|
||||
<key>CFBundleTypeOSTypes</key>
|
||||
<array>
|
||||
<string>TEXT</string>
|
||||
<string>utxt</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>cc</string>
|
||||
<string>CC</string>
|
||||
<string>cp</string>
|
||||
<string>CP</string>
|
||||
<string>cpp</string>
|
||||
<string>CPP</string>
|
||||
<string>cxx</string>
|
||||
<string>CXX</string>
|
||||
<string>c++</string>
|
||||
<string>C++</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>C++ Source File</string>
|
||||
<key>CFBundleTypeOSTypes</key>
|
||||
<array>
|
||||
<string>TEXT</string>
|
||||
<string>utxt</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>mm</string>
|
||||
<string>MM</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Objective-C++ Source File</string>
|
||||
<key>CFBundleTypeOSTypes</key>
|
||||
<array>
|
||||
<string>TEXT</string>
|
||||
<string>utxt</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>m</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Objective-C Source File</string>
|
||||
<key>CFBundleTypeOSTypes</key>
|
||||
<array>
|
||||
<string>TEXT</string>
|
||||
<string>utxt</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>c</string>
|
||||
<string>C</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>C Source File</string>
|
||||
<key>CFBundleTypeOSTypes</key>
|
||||
<array>
|
||||
<string>TEXT</string>
|
||||
<string>utxt</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>txt</string>
|
||||
<string>text</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Text File</string>
|
||||
<key>CFBundleTypeOSTypes</key>
|
||||
<array>
|
||||
<string>TEXT</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>*</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>NSStringPboardType</string>
|
||||
<key>CFBundleTypeOSTypes</key>
|
||||
<array>
|
||||
<string>****</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Qt Creator; Copyright Nokia Corporation</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>@ICON@</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>@TYPEINFO@</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>@EXECUTABLE@</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.nokia.qtcreator</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.3.1</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.3.1</string>
|
||||
</dict>
|
||||
</plist>
|
35
Ground/src/app/app.pro
Normal file
35
Ground/src/app/app.pro
Normal file
@ -0,0 +1,35 @@
|
||||
include(../../openpilotgcs.pri)
|
||||
include(../shared/qtsingleapplication/qtsingleapplication.pri)
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = $$IDE_APP_TARGET
|
||||
DESTDIR = $$IDE_APP_PATH
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
include(../rpath.pri)
|
||||
|
||||
win32 {
|
||||
CONFIG(debug, debug|release):LIBS *= -lExtensionSystemd -lAggregationd
|
||||
else:LIBS *= -lExtensionSystem -lAggregation
|
||||
|
||||
RC_FILE = openpilotgcs.rc
|
||||
target.path = /bin
|
||||
INSTALLS += target
|
||||
} else:macx {
|
||||
CONFIG(debug, debug|release):LIBS *= -lExtensionSystem_debug -lAggregation_debug
|
||||
else:LIBS *= -lExtensionSystem -lAggregation
|
||||
LIBS += -framework CoreFoundation
|
||||
ICON = qtcreator.icns
|
||||
QMAKE_INFO_PLIST = Info.plist
|
||||
FILETYPES.files = profile.icns prifile.icns
|
||||
FILETYPES.path = Contents/Resources
|
||||
QMAKE_BUNDLE_DATA += FILETYPES
|
||||
} else {
|
||||
LIBS *= -lExtensionSystem -lAggregation
|
||||
|
||||
target.path = /bin
|
||||
INSTALLS += target
|
||||
}
|
||||
|
||||
OTHER_FILES += openpilotgcs.rc
|
322
Ground/src/app/main.cpp
Normal file
322
Ground/src/app/main.cpp
Normal file
@ -0,0 +1,322 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "qtsingleapplication.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <extensionsystem/pluginspec.h>
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QLibraryInfo>
|
||||
#include <QtCore/QTranslator>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QMainWindow>
|
||||
|
||||
enum { OptionIndent = 4, DescriptionIndent = 24 };
|
||||
|
||||
static const char *appNameC = "OpenPilot GCS";
|
||||
static const char *corePluginNameC = "Core";
|
||||
static const char *fixedOptionsC =
|
||||
" [OPTION]... [FILE]...\n"
|
||||
"Options:\n"
|
||||
" -help Display this help\n"
|
||||
" -version Display program version\n"
|
||||
" -client Attempt to connect to already running instance\n";
|
||||
|
||||
static const char *HELP_OPTION1 = "-h";
|
||||
static const char *HELP_OPTION2 = "-help";
|
||||
static const char *HELP_OPTION3 = "/h";
|
||||
static const char *HELP_OPTION4 = "--help";
|
||||
static const char *VERSION_OPTION = "-version";
|
||||
static const char *CLIENT_OPTION = "-client";
|
||||
|
||||
typedef QList<ExtensionSystem::PluginSpec *> PluginSpecSet;
|
||||
|
||||
// Helpers for displaying messages. Note that there is no console on Windows.
|
||||
#ifdef Q_OS_WIN
|
||||
// Format as <pre> HTML
|
||||
static inline void toHtml(QString &t)
|
||||
{
|
||||
t.replace(QLatin1Char('&'), QLatin1String("&"));
|
||||
t.replace(QLatin1Char('<'), QLatin1String("<"));
|
||||
t.replace(QLatin1Char('>'), QLatin1String(">"));
|
||||
t.insert(0, QLatin1String("<html><pre>"));
|
||||
t.append(QLatin1String("</pre></html>"));
|
||||
}
|
||||
|
||||
static void displayHelpText(QString t) // No console on Windows.
|
||||
{
|
||||
toHtml(t);
|
||||
QMessageBox::information(0, QLatin1String(appNameC), t);
|
||||
}
|
||||
|
||||
static void displayError(const QString &t) // No console on Windows.
|
||||
{
|
||||
QMessageBox::critical(0, QLatin1String(appNameC), t);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void displayHelpText(const QString &t)
|
||||
{
|
||||
qWarning("%s", qPrintable(t));
|
||||
}
|
||||
|
||||
static void displayError(const QString &t)
|
||||
{
|
||||
qCritical("%s", qPrintable(t));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void printVersion(const ExtensionSystem::PluginSpec *coreplugin,
|
||||
const ExtensionSystem::PluginManager &pm)
|
||||
{
|
||||
QString version;
|
||||
QTextStream str(&version);
|
||||
str << '\n' << appNameC << ' ' << coreplugin->version()<< " based on Qt " << qVersion() << "\n\n";
|
||||
pm.formatPluginVersions(str);
|
||||
str << '\n' << coreplugin->copyright() << '\n';
|
||||
displayHelpText(version);
|
||||
}
|
||||
|
||||
static void printHelp(const QString &a0, const ExtensionSystem::PluginManager &pm)
|
||||
{
|
||||
QString help;
|
||||
QTextStream str(&help);
|
||||
str << "Usage: " << a0 << fixedOptionsC;
|
||||
ExtensionSystem::PluginManager::formatOptions(str, OptionIndent, DescriptionIndent);
|
||||
pm.formatPluginOptions(str, OptionIndent, DescriptionIndent);
|
||||
displayHelpText(help);
|
||||
}
|
||||
|
||||
static inline QString msgCoreLoadFailure(const QString &why)
|
||||
{
|
||||
return QCoreApplication::translate("Application", "Failed to load core: %1").arg(why);
|
||||
}
|
||||
|
||||
static inline QString msgSendArgumentFailed()
|
||||
{
|
||||
return QCoreApplication::translate("Application", "Unable to send command line arguments to the already running instance. It appears to be not responding.");
|
||||
}
|
||||
|
||||
// Prepare a remote argument: If it is a relative file, add the current directory
|
||||
// since the the central instance might be running in a different directory.
|
||||
|
||||
static inline QString prepareRemoteArgument(const QString &a)
|
||||
{
|
||||
QFileInfo fi(a);
|
||||
if (!fi.exists())
|
||||
return a;
|
||||
if (fi.isRelative())
|
||||
return fi.absoluteFilePath();
|
||||
return a;
|
||||
}
|
||||
|
||||
// Send the arguments to an already running instance of Qt Creator
|
||||
static bool sendArguments(SharedTools::QtSingleApplication &app, const QStringList &arguments)
|
||||
{
|
||||
if (!arguments.empty()) {
|
||||
// Send off arguments
|
||||
const QStringList::const_iterator acend = arguments.constEnd();
|
||||
for (QStringList::const_iterator it = arguments.constBegin(); it != acend; ++it) {
|
||||
if (!app.sendMessage(prepareRemoteArgument(*it))) {
|
||||
displayError(msgSendArgumentFailed());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Special empty argument means: Show and raise (the slot just needs to be triggered)
|
||||
if (!app.sendMessage(QString())) {
|
||||
displayError(msgSendArgumentFailed());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline QStringList getPluginPaths()
|
||||
{
|
||||
QStringList rc;
|
||||
// Figure out root: Up one from 'bin'
|
||||
QDir rootDir = QApplication::applicationDirPath();
|
||||
rootDir.cdUp();
|
||||
const QString rootDirPath = rootDir.canonicalPath();
|
||||
// 1) "plugins" (Win/Linux)
|
||||
QString pluginPath = rootDirPath;
|
||||
pluginPath += QLatin1Char('/');
|
||||
pluginPath += QLatin1String(IDE_LIBRARY_BASENAME);
|
||||
pluginPath += QLatin1Char('/');
|
||||
pluginPath += QLatin1String("openpilotgcs");
|
||||
pluginPath += QLatin1Char('/');
|
||||
pluginPath += QLatin1String("plugins");
|
||||
rc.push_back(pluginPath);
|
||||
// 2) "PlugIns" (OS X)
|
||||
pluginPath = rootDirPath;
|
||||
pluginPath += QLatin1Char('/');
|
||||
pluginPath += QLatin1String("PlugIns");
|
||||
rc.push_back(pluginPath);
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
# define SHARE_PATH "/../Resources"
|
||||
#else
|
||||
# define SHARE_PATH "/../share/openpilotgcs"
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
// increase the number of file that can be opened in Qt Creator.
|
||||
struct rlimit rl;
|
||||
getrlimit(RLIMIT_NOFILE, &rl);
|
||||
rl.rlim_cur = rl.rlim_max;
|
||||
setrlimit(RLIMIT_NOFILE, &rl);
|
||||
#endif
|
||||
|
||||
SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv);
|
||||
|
||||
QTranslator translator;
|
||||
QTranslator qtTranslator;
|
||||
QString locale = QLocale::system().name();
|
||||
const QString &creatorTrPath = QCoreApplication::applicationDirPath()
|
||||
+ QLatin1String(SHARE_PATH "/translations");
|
||||
if (translator.load(QLatin1String("qtcreator_") + locale, creatorTrPath)) {
|
||||
const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
const QString &qtTrFile = QLatin1String("qt_") + locale;
|
||||
// Binary installer puts Qt tr files into creatorTrPath
|
||||
if (qtTranslator.load(qtTrFile, qtTrPath) || qtTranslator.load(qtTrFile, creatorTrPath)) {
|
||||
app.installTranslator(&translator);
|
||||
app.installTranslator(&qtTranslator);
|
||||
app.setProperty("qtc_locale", locale);
|
||||
} else {
|
||||
translator.load(QString()); // unload()
|
||||
}
|
||||
}
|
||||
|
||||
// Load
|
||||
ExtensionSystem::PluginManager pluginManager;
|
||||
pluginManager.setFileExtension(QLatin1String("pluginspec"));
|
||||
|
||||
const QStringList pluginPaths = getPluginPaths();
|
||||
pluginManager.setPluginPaths(pluginPaths);
|
||||
|
||||
const QStringList arguments = app.arguments();
|
||||
QMap<QString, QString> foundAppOptions;
|
||||
if (arguments.size() > 1) {
|
||||
QMap<QString, bool> appOptions;
|
||||
appOptions.insert(QLatin1String(HELP_OPTION1), false);
|
||||
appOptions.insert(QLatin1String(HELP_OPTION2), false);
|
||||
appOptions.insert(QLatin1String(HELP_OPTION3), false);
|
||||
appOptions.insert(QLatin1String(HELP_OPTION4), false);
|
||||
appOptions.insert(QLatin1String(VERSION_OPTION), false);
|
||||
appOptions.insert(QLatin1String(CLIENT_OPTION), false);
|
||||
QString errorMessage;
|
||||
if (!pluginManager.parseOptions(arguments,
|
||||
appOptions,
|
||||
&foundAppOptions,
|
||||
&errorMessage)) {
|
||||
displayError(errorMessage);
|
||||
printHelp(QFileInfo(app.applicationFilePath()).baseName(), pluginManager);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
const PluginSpecSet plugins = pluginManager.plugins();
|
||||
ExtensionSystem::PluginSpec *coreplugin = 0;
|
||||
foreach (ExtensionSystem::PluginSpec *spec, plugins) {
|
||||
if (spec->name() == QLatin1String(corePluginNameC)) {
|
||||
coreplugin = spec;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!coreplugin) {
|
||||
QString nativePaths = QDir::toNativeSeparators(pluginPaths.join(QLatin1String(",")));
|
||||
const QString reason = QCoreApplication::translate("Application", "Could not find 'Core.pluginspec' in %1").arg(nativePaths);
|
||||
displayError(msgCoreLoadFailure(reason));
|
||||
return 1;
|
||||
}
|
||||
if (coreplugin->hasError()) {
|
||||
displayError(msgCoreLoadFailure(coreplugin->errorString()));
|
||||
return 1;
|
||||
}
|
||||
if (foundAppOptions.contains(QLatin1String(VERSION_OPTION))) {
|
||||
printVersion(coreplugin, pluginManager);
|
||||
return 0;
|
||||
}
|
||||
if (foundAppOptions.contains(QLatin1String(HELP_OPTION1))
|
||||
|| foundAppOptions.contains(QLatin1String(HELP_OPTION2))
|
||||
|| foundAppOptions.contains(QLatin1String(HELP_OPTION3))
|
||||
|| foundAppOptions.contains(QLatin1String(HELP_OPTION4))) {
|
||||
printHelp(QFileInfo(app.applicationFilePath()).baseName(), pluginManager);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const bool isFirstInstance = !app.isRunning();
|
||||
if (!isFirstInstance && foundAppOptions.contains(QLatin1String(CLIENT_OPTION)))
|
||||
return sendArguments(app, pluginManager.arguments()) ? 0 : -1;
|
||||
|
||||
pluginManager.loadPlugins();
|
||||
if (coreplugin->hasError()) {
|
||||
displayError(msgCoreLoadFailure(coreplugin->errorString()));
|
||||
return 1;
|
||||
}
|
||||
{
|
||||
QStringList errors;
|
||||
foreach (ExtensionSystem::PluginSpec *p, pluginManager.plugins())
|
||||
if (p->hasError())
|
||||
errors.append(p->errorString());
|
||||
if (!errors.isEmpty())
|
||||
QMessageBox::warning(0,
|
||||
QCoreApplication::translate("Application", "Qt Creator - Plugin loader messages"),
|
||||
errors.join(QString::fromLatin1("\n\n")));
|
||||
}
|
||||
|
||||
if (isFirstInstance) {
|
||||
// Set up lock and remote arguments for the first instance only.
|
||||
// Silently fallback to unconnected instances for any subsequent
|
||||
// instances.
|
||||
app.initialize();
|
||||
QObject::connect(&app, SIGNAL(messageReceived(QString)), coreplugin->plugin(), SLOT(remoteArgument(QString)));
|
||||
}
|
||||
QObject::connect(&app, SIGNAL(fileOpenRequest(QString)), coreplugin->plugin(), SLOT(remoteArgument(QString)));
|
||||
|
||||
// Do this after the event loop has started
|
||||
QTimer::singleShot(100, &pluginManager, SLOT(startTests()));
|
||||
return app.exec();
|
||||
}
|
||||
|
BIN
Ground/src/app/openpilotgcs.ico
Normal file
BIN
Ground/src/app/openpilotgcs.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 281 KiB |
1
Ground/src/app/openpilotgcs.rc
Normal file
1
Ground/src/app/openpilotgcs.rc
Normal file
@ -0,0 +1 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "openpilotgcs.ico"
|
BIN
Ground/src/app/prifile.icns
Normal file
BIN
Ground/src/app/prifile.icns
Normal file
Binary file not shown.
BIN
Ground/src/app/profile.icns
Normal file
BIN
Ground/src/app/profile.icns
Normal file
Binary file not shown.
BIN
Ground/src/app/qtcreator.icns
Normal file
BIN
Ground/src/app/qtcreator.icns
Normal file
Binary file not shown.
261
Ground/src/libs/aggregation/aggregate.cpp
Normal file
261
Ground/src/libs/aggregation/aggregate.cpp
Normal file
@ -0,0 +1,261 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "aggregate.h"
|
||||
|
||||
#include <QtCore/QWriteLocker>
|
||||
|
||||
/*!
|
||||
\namespace Aggregation
|
||||
\brief The Aggregation namespace contains support for bundling related components,
|
||||
such that each component exposes the properties and behavior of the
|
||||
other components to the outside.
|
||||
|
||||
Components that are bundled to an Aggregate can be "cast" to each other
|
||||
and have a coupled life cycle. See the documentation of Aggregation::Aggregate for
|
||||
details and examples.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class Aggregation::Aggregate
|
||||
\mainclass
|
||||
\threadsafe
|
||||
|
||||
\brief Defines a collection of related components that can be viewed as a unit.
|
||||
|
||||
An Aggregate is a collection of components that are handled as a unit,
|
||||
such that each component exposes the properties and behavior of the
|
||||
other components in the Aggregate to the outside.
|
||||
Specifically that means:
|
||||
\list
|
||||
\o They can be "cast" to each other (using query and query_all methods).
|
||||
\o Their life cycle is coupled, i.e. whenever one is deleted all of them are.
|
||||
\endlist
|
||||
Components can be of any QObject derived type.
|
||||
|
||||
You can use an Aggregate to simulate multiple inheritance by aggregation. Assume we have
|
||||
\code
|
||||
using namespace Aggregation;
|
||||
class MyInterface : public QObject { ........ };
|
||||
class MyInterfaceEx : public QObject { ........ };
|
||||
[...]
|
||||
MyInterface *object = new MyInterface; // this is single inheritance
|
||||
\endcode
|
||||
The query method works like a qobject_cast with normal objects:
|
||||
\code
|
||||
Q_ASSERT(query<MyInterface>(object) == object);
|
||||
Q_ASSERT(query<MyInterfaceEx>(object) == 0);
|
||||
\endcode
|
||||
If we want 'object' to also implement the class MyInterfaceEx,
|
||||
but don't want to or cannot use multiple inheritance, we can do it
|
||||
at any point using an Aggregate:
|
||||
\code
|
||||
MyInterfaceEx *objectEx = new MyInterfaceEx;
|
||||
Aggregate *aggregate = new Aggregate;
|
||||
aggregate->add(object);
|
||||
aggregate->add(objectEx);
|
||||
\endcode
|
||||
The Aggregate bundles the two objects together.
|
||||
If we have any part of the collection we get all parts:
|
||||
\code
|
||||
Q_ASSERT(query<MyInterface>(object) == object);
|
||||
Q_ASSERT(query<MyInterfaceEx>(object) == objectEx);
|
||||
Q_ASSERT(query<MyInterface>(objectEx) == object);
|
||||
Q_ASSERT(query<MyInterfaceEx>(objectEx) == objectEx);
|
||||
\endcode
|
||||
The following deletes all three: object, objectEx and aggregate:
|
||||
\code
|
||||
delete objectEx;
|
||||
// or delete object;
|
||||
// or delete aggregate;
|
||||
\endcode
|
||||
|
||||
Aggregation aware code never uses qobject_cast, but always uses
|
||||
Aggregation::query which behaves like a qobject_cast as a fallback.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn T *Aggregate::component()
|
||||
|
||||
Template method that returns the component with the given type, if there is one.
|
||||
If there are multiple components with that type a random one is returned.
|
||||
|
||||
\sa Aggregate::components()
|
||||
\sa Aggregate::add()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QList<T *> Aggregate::components()
|
||||
|
||||
Template method that returns all components with the given type, if there are any.
|
||||
|
||||
\sa Aggregate::component()
|
||||
\sa Aggregate::add()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn T *Aggregation::query<T *>(Aggregate *obj)
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QList<T *> Aggregation::query_all<T *>(Aggregate *obj)
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\relates Aggregation::Aggregate
|
||||
\fn T *Aggregation::query<T *>(QObject *obj)
|
||||
|
||||
Performs a dynamic cast that is aware of a possible Aggregate that \a obj
|
||||
might belong to. If \a obj itself is of the requested type then it is simply cast
|
||||
and returned. Otherwise, if \a obj belongs to an Aggregate all its components are
|
||||
checked, or if it doesn't belong to an Aggregate null is returned.
|
||||
|
||||
\sa Aggregate::component()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\relates Aggregation::Aggregate
|
||||
\fn QList<T *> Aggregation::query_all<T *>(QObject *obj)
|
||||
|
||||
If \a obj belongs to an Aggregate, all components that can be cast to the given
|
||||
type are returned. Otherwise, \a obj is returned if it is of the requested type.
|
||||
|
||||
\sa Aggregate::components()
|
||||
*/
|
||||
|
||||
using namespace Aggregation;
|
||||
|
||||
/*!
|
||||
\fn Aggregate *Aggregate::parentAggregate(QObject *obj)
|
||||
|
||||
Returns the Aggregate object of \a obj if there is one. Otherwise returns 0.
|
||||
*/
|
||||
Aggregate *Aggregate::parentAggregate(QObject *obj)
|
||||
{
|
||||
QReadLocker locker(&lock());
|
||||
return aggregateMap().value(obj);
|
||||
}
|
||||
|
||||
QHash<QObject *, Aggregate *> &Aggregate::aggregateMap()
|
||||
{
|
||||
static QHash<QObject *, Aggregate *> map;
|
||||
return map;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QReadWriteLock &Aggregate::lock()
|
||||
\internal
|
||||
*/
|
||||
QReadWriteLock &Aggregate::lock()
|
||||
{
|
||||
static QReadWriteLock lock;
|
||||
return lock;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn Aggregate::Aggregate(QObject *parent)
|
||||
|
||||
Creates a new Aggregate with the given \a parent.
|
||||
The \a parent is passed directly passed to the QObject part
|
||||
of the class and is not used beside that.
|
||||
*/
|
||||
Aggregate::Aggregate(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
QWriteLocker locker(&lock());
|
||||
aggregateMap().insert(this, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn Aggregate::~Aggregate()
|
||||
|
||||
Deleting the aggregate automatically deletes all its components.
|
||||
*/
|
||||
Aggregate::~Aggregate()
|
||||
{
|
||||
QWriteLocker locker(&lock());
|
||||
foreach (QObject *component, m_components) {
|
||||
disconnect(component, SIGNAL(destroyed(QObject*)), this, SLOT(deleteSelf(QObject*)));
|
||||
aggregateMap().remove(component);
|
||||
}
|
||||
qDeleteAll(m_components);
|
||||
m_components.clear();
|
||||
aggregateMap().remove(this);
|
||||
}
|
||||
|
||||
void Aggregate::deleteSelf(QObject *obj)
|
||||
{
|
||||
{
|
||||
QWriteLocker locker(&lock());
|
||||
aggregateMap().remove(obj);
|
||||
m_components.removeAll(obj);
|
||||
}
|
||||
delete this;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void Aggregate::add(QObject *component)
|
||||
|
||||
Adds the \a component to the aggregate.
|
||||
|
||||
\sa Aggregate::remove()
|
||||
*/
|
||||
void Aggregate::add(QObject *component)
|
||||
{
|
||||
if (!component)
|
||||
return;
|
||||
QWriteLocker locker(&lock());
|
||||
Aggregate *parentAggregation = aggregateMap().value(component);
|
||||
if (parentAggregation == this)
|
||||
return;
|
||||
if (parentAggregation)
|
||||
parentAggregation->remove(component);
|
||||
m_components.append(component);
|
||||
connect(component, SIGNAL(destroyed(QObject*)), this, SLOT(deleteSelf(QObject*)));
|
||||
aggregateMap().insert(component, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void Aggregate::remove(QObject *component)
|
||||
|
||||
Removes the \a component from the aggregate.
|
||||
|
||||
\sa Aggregate::add()
|
||||
*/
|
||||
void Aggregate::remove(QObject *component)
|
||||
{
|
||||
if (!component)
|
||||
return;
|
||||
QWriteLocker locker(&lock());
|
||||
aggregateMap().remove(component);
|
||||
m_components.removeAll(component);
|
||||
disconnect(component, SIGNAL(destroyed(QObject*)), this, SLOT(deleteSelf(QObject*)));
|
||||
}
|
131
Ground/src/libs/aggregation/aggregate.h
Normal file
131
Ground/src/libs/aggregation/aggregate.h
Normal file
@ -0,0 +1,131 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QAGGREGATION_H
|
||||
#define QAGGREGATION_H
|
||||
|
||||
#include "aggregation_global.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QReadWriteLock>
|
||||
#include <QtCore/QReadLocker>
|
||||
|
||||
namespace Aggregation {
|
||||
|
||||
class AGGREGATION_EXPORT Aggregate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Aggregate(QObject *parent = 0);
|
||||
virtual ~Aggregate();
|
||||
|
||||
void add(QObject *component);
|
||||
void remove(QObject *component);
|
||||
|
||||
template <typename T> T *component() {
|
||||
QReadLocker(&lock());
|
||||
foreach (QObject *component, m_components) {
|
||||
if (T *result = qobject_cast<T *>(component))
|
||||
return result;
|
||||
}
|
||||
return (T *)0;
|
||||
}
|
||||
|
||||
template <typename T> QList<T *> components() {
|
||||
QReadLocker(&lock());
|
||||
QList<T *> results;
|
||||
foreach (QObject *component, m_components) {
|
||||
if (T *result = qobject_cast<T *>(component)) {
|
||||
results << result;
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
static Aggregate *parentAggregate(QObject *obj);
|
||||
static QReadWriteLock &lock();
|
||||
|
||||
private slots:
|
||||
void deleteSelf(QObject *obj);
|
||||
|
||||
private:
|
||||
static QHash<QObject *, Aggregate *> &aggregateMap();
|
||||
|
||||
QList<QObject *> m_components;
|
||||
};
|
||||
|
||||
// get a component via global template function
|
||||
template <typename T> T *query(Aggregate *obj)
|
||||
{
|
||||
if (!obj)
|
||||
return (T *)0;
|
||||
return obj->template component<T>();
|
||||
}
|
||||
|
||||
template <typename T> T *query(QObject *obj)
|
||||
{
|
||||
if (!obj)
|
||||
return (T *)0;
|
||||
T *result = qobject_cast<T *>(obj);
|
||||
if (!result) {
|
||||
QReadLocker(&lock());
|
||||
Aggregate *parentAggregation = Aggregate::parentAggregate(obj);
|
||||
result = (parentAggregation ? query<T>(parentAggregation) : 0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// get all components of a specific type via template function
|
||||
template <typename T> QList<T *> query_all(Aggregate *obj)
|
||||
{
|
||||
if (!obj)
|
||||
return QList<T *>();
|
||||
return obj->template components<T>();
|
||||
}
|
||||
|
||||
template <typename T> QList<T *> query_all(QObject *obj)
|
||||
{
|
||||
if (!obj)
|
||||
return QList<T *>();
|
||||
QReadLocker(&lock());
|
||||
Aggregate *parentAggregation = Aggregate::parentAggregate(obj);
|
||||
QList<T *> results;
|
||||
if (parentAggregation)
|
||||
results = query_all<T>(parentAggregation);
|
||||
else if (T *result = qobject_cast<T *>(obj))
|
||||
results.append(result);
|
||||
return results;
|
||||
}
|
||||
|
||||
} // namespace Aggregation
|
||||
|
||||
#endif // QAGGREGATION_H
|
1
Ground/src/libs/aggregation/aggregation.pri
Normal file
1
Ground/src/libs/aggregation/aggregation.pri
Normal file
@ -0,0 +1 @@
|
||||
LIBS *= -l$$qtLibraryTarget(Aggregation)
|
12
Ground/src/libs/aggregation/aggregation.pro
Normal file
12
Ground/src/libs/aggregation/aggregation.pro
Normal file
@ -0,0 +1,12 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = Aggregation
|
||||
|
||||
include(../../qtcreatorlibrary.pri)
|
||||
|
||||
DEFINES += AGGREGATION_LIBRARY
|
||||
|
||||
HEADERS = aggregate.h \
|
||||
aggregation_global.h
|
||||
|
||||
SOURCES = aggregate.cpp
|
||||
|
41
Ground/src/libs/aggregation/aggregation_global.h
Normal file
41
Ground/src/libs/aggregation/aggregation_global.h
Normal file
@ -0,0 +1,41 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef AGGREGATION_GLOBAL_H
|
||||
#define AGGREGATION_GLOBAL_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(AGGREGATION_LIBRARY)
|
||||
# define AGGREGATION_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define AGGREGATION_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif // AGGREGATION_GLOBAL_H
|
3
Ground/src/libs/aggregation/examples/examples.pro
Normal file
3
Ground/src/libs/aggregation/examples/examples.pro
Normal file
@ -0,0 +1,3 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS = text
|
106
Ground/src/libs/aggregation/examples/text/main.cpp
Normal file
106
Ground/src/libs/aggregation/examples/text/main.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
|
||||
MyMain::MyMain(QWidget *parent, Qt::WFlags flags)
|
||||
: QWidget(parent, flags)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
connect(ui.comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(select(int)));
|
||||
}
|
||||
|
||||
void MyMain::add(IComboEntry *obj)
|
||||
{
|
||||
m_entries.append(obj);
|
||||
ui.comboBox->addItem(obj->title());
|
||||
}
|
||||
|
||||
void MyMain::select(int index)
|
||||
{
|
||||
IComboEntry *entry = m_entries.at(index);
|
||||
// with multiple inheritance we would use qobject_cast here
|
||||
// instead we use query, to get the components if they exist
|
||||
IText1 *t1 = Aggregation::query<IText1>(entry);
|
||||
IText2 *t2 = Aggregation::query<IText2>(entry);
|
||||
IText3 *t3 = Aggregation::query<IText3>(entry);
|
||||
// set the label texts and enable/disable, depending on whether
|
||||
// the respective interface implementations exist
|
||||
ui.text1->setText(t1 ? t1->text() : tr("N/A"));
|
||||
ui.text2->setText(t2 ? t2->text() : tr("N/A"));
|
||||
ui.text3->setText(t3 ? t3->text() : tr("N/A"));
|
||||
ui.text1->setEnabled(t1);
|
||||
ui.text2->setEnabled(t2);
|
||||
ui.text3->setEnabled(t3);
|
||||
}
|
||||
|
||||
MyMain::~MyMain()
|
||||
{
|
||||
// the following deletes all the Aggregate and IComboEntry and ITextX
|
||||
// objects, as well as any other components we might have added
|
||||
qDeleteAll(m_entries);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
MyMain w;
|
||||
// create and set up some objects
|
||||
|
||||
// the first does only implement the required IComboEntry
|
||||
// we don't need an aggregation for this
|
||||
IComboEntry *obj1 = new IComboEntry("Entry without text");
|
||||
|
||||
// the second additionally provides an IText2 implementation
|
||||
// adding a component to the aggregation is done by setting the aggregation as the parent of the component
|
||||
Aggregation::Aggregate *obj2 = new Aggregation::Aggregate;
|
||||
obj2->add(new IComboEntry("Entry with text 2"));
|
||||
obj2->add(new IText2("This is a text for label 2"));
|
||||
|
||||
// and so on... two more objects...
|
||||
Aggregation::Aggregate *obj3 = new Aggregation::Aggregate;
|
||||
obj3->add(new IComboEntry("Entry with text 1 and 2"));
|
||||
obj3->add(new IText1("I love Qt!"));
|
||||
obj3->add(new IText2("There are software companies..."));
|
||||
Aggregation::Aggregate *obj4 = new Aggregation::Aggregate;
|
||||
obj4->add(new IComboEntry("Entry with text 1 and 3"));
|
||||
obj4->add(new IText1("Some text written here."));
|
||||
obj4->add(new IText3("I'm a troll."));
|
||||
|
||||
// the API takes IComboEntries, so we convert the them to it
|
||||
// the MyMain object takes the ownership of the whole aggregations
|
||||
w.add(Aggregation::query<IComboEntry>(obj1));
|
||||
w.add(Aggregation::query<IComboEntry>(obj2));
|
||||
w.add(Aggregation::query<IComboEntry>(obj3));
|
||||
w.add(Aggregation::query<IComboEntry>(obj4));
|
||||
w.show();
|
||||
return app.exec();
|
||||
}
|
59
Ground/src/libs/aggregation/examples/text/main.h
Normal file
59
Ground/src/libs/aggregation/examples/text/main.h
Normal file
@ -0,0 +1,59 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#include "myinterfaces.h"
|
||||
#include "ui_main.h"
|
||||
|
||||
#include <aggregate.h>
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
class MyMain : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MyMain(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
~MyMain();
|
||||
|
||||
void add(IComboEntry *obj);
|
||||
|
||||
private slots:
|
||||
void select(int index);
|
||||
|
||||
private:
|
||||
Ui::mainClass ui;
|
||||
|
||||
QList<IComboEntry *> m_entries;
|
||||
};
|
||||
|
||||
#endif // MAIN_H
|
128
Ground/src/libs/aggregation/examples/text/main.ui
Normal file
128
Ground/src/libs/aggregation/examples/text/main.ui
Normal file
@ -0,0 +1,128 @@
|
||||
<ui version="4.0" >
|
||||
<class>mainClass</class>
|
||||
<widget class="QWidget" name="mainClass" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>399</width>
|
||||
<height>176</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>main</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox" />
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Text1:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="text1" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>N/A</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Text2:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="text2" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>N/A</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string>Text3:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="text3" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>N/A</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
88
Ground/src/libs/aggregation/examples/text/myinterfaces.h
Normal file
88
Ground/src/libs/aggregation/examples/text/myinterfaces.h
Normal file
@ -0,0 +1,88 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MYINTERFACES_H
|
||||
#define MYINTERFACES_H
|
||||
|
||||
#include <aggregate.h>
|
||||
|
||||
#include <QtCore/QString>
|
||||
|
||||
class IComboEntry : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IComboEntry(QString title) : m_title(title) {}
|
||||
virtual ~IComboEntry() {}
|
||||
QString title() const { return m_title; }
|
||||
|
||||
private:
|
||||
QString m_title;
|
||||
};
|
||||
|
||||
class IText1 : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IText1(QString text) : m_text(text) {}
|
||||
virtual ~IText1() {}
|
||||
QString text() const { return m_text; }
|
||||
|
||||
private:
|
||||
QString m_text;
|
||||
};
|
||||
|
||||
class IText2 : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IText2(QString text) : m_text(text) {}
|
||||
QString text() const { return m_text; }
|
||||
|
||||
private:
|
||||
QString m_text;
|
||||
};
|
||||
|
||||
class IText3 : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IText3(QString text) : m_text(text) {}
|
||||
virtual ~IText3() {}
|
||||
QString text() const { return m_text; }
|
||||
|
||||
private:
|
||||
QString m_text;
|
||||
};
|
||||
|
||||
#endif // MYINTERFACES_H
|
14
Ground/src/libs/aggregation/examples/text/text.pro
Normal file
14
Ground/src/libs/aggregation/examples/text/text.pro
Normal file
@ -0,0 +1,14 @@
|
||||
TARGET = text
|
||||
TEMPLATE = app
|
||||
QT += core \
|
||||
gui
|
||||
DEFINES += AGGREGATION_LIBRARY
|
||||
INCLUDEPATH += ../../
|
||||
SOURCES += main.cpp \
|
||||
../../aggregate.cpp
|
||||
HEADERS += main.h \
|
||||
myinterfaces.h \
|
||||
../../aggregate.h \
|
||||
../../aggregation_global.h
|
||||
FORMS += main.ui
|
||||
|
3
Ground/src/libs/extensionsystem/extensionsystem.pri
Normal file
3
Ground/src/libs/extensionsystem/extensionsystem.pri
Normal file
@ -0,0 +1,3 @@
|
||||
include(extensionsystem_dependencies.pri)
|
||||
|
||||
LIBS *= -l$$qtLibraryTarget(ExtensionSystem)
|
33
Ground/src/libs/extensionsystem/extensionsystem.pro
Normal file
33
Ground/src/libs/extensionsystem/extensionsystem.pro
Normal file
@ -0,0 +1,33 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = ExtensionSystem
|
||||
DEFINES += EXTENSIONSYSTEM_LIBRARY
|
||||
include(../../qtcreatorlibrary.pri)
|
||||
include(extensionsystem_dependencies.pri)
|
||||
|
||||
unix:!macx:!freebsd*:LIBS += -ldl
|
||||
|
||||
DEFINES += IDE_TEST_DIR=\\\"$$IDE_SOURCE_TREE\\\"
|
||||
|
||||
HEADERS += pluginerrorview.h \
|
||||
plugindetailsview.h \
|
||||
iplugin.h \
|
||||
iplugin_p.h \
|
||||
extensionsystem_global.h \
|
||||
pluginmanager.h \
|
||||
pluginmanager_p.h \
|
||||
pluginspec.h \
|
||||
pluginspec_p.h \
|
||||
pluginview.h \
|
||||
pluginview_p.h \
|
||||
optionsparser.h
|
||||
SOURCES += pluginerrorview.cpp \
|
||||
plugindetailsview.cpp \
|
||||
iplugin.cpp \
|
||||
pluginmanager.cpp \
|
||||
pluginspec.cpp \
|
||||
pluginview.cpp \
|
||||
optionsparser.cpp
|
||||
FORMS += pluginview.ui \
|
||||
pluginerrorview.ui \
|
||||
plugindetailsview.ui
|
||||
RESOURCES += pluginview.qrc
|
@ -0,0 +1 @@
|
||||
include(../aggregation/aggregation.pri)
|
41
Ground/src/libs/extensionsystem/extensionsystem_global.h
Normal file
41
Ground/src/libs/extensionsystem/extensionsystem_global.h
Normal file
@ -0,0 +1,41 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef EXTENSIONSYSTEM_GLOBAL_H
|
||||
#define EXTENSIONSYSTEM_GLOBAL_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(EXTENSIONSYSTEM_LIBRARY)
|
||||
# define EXTENSIONSYSTEM_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define EXTENSIONSYSTEM_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif // EXTENSIONSYSTEM_GLOBAL_H
|
BIN
Ground/src/libs/extensionsystem/images/error.png
Normal file
BIN
Ground/src/libs/extensionsystem/images/error.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 111 B |
BIN
Ground/src/libs/extensionsystem/images/ok.png
Normal file
BIN
Ground/src/libs/extensionsystem/images/ok.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 103 B |
323
Ground/src/libs/extensionsystem/iplugin.cpp
Normal file
323
Ground/src/libs/extensionsystem/iplugin.cpp
Normal file
@ -0,0 +1,323 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "iplugin.h"
|
||||
#include "iplugin_p.h"
|
||||
#include "pluginmanager.h"
|
||||
#include "pluginspec.h"
|
||||
|
||||
/*!
|
||||
\class ExtensionSystem::IPlugin
|
||||
\mainclass
|
||||
\brief Base class for all plugins.
|
||||
|
||||
The IPlugin class is an abstract class that must be implemented
|
||||
once for each plugin.
|
||||
A plugin consists of two parts: A description file, and a library
|
||||
that at least contains the IPlugin implementation.
|
||||
|
||||
\tableofcontents
|
||||
|
||||
\section1 Plugin Specification
|
||||
The plugin specification file is an xml file that contains all
|
||||
information that are necessary for loading the plugin's library,
|
||||
plus some textual descriptions. The file must be located in
|
||||
(a subdir of) one of the plugin manager's plugin search paths,
|
||||
and must have the \c .xml extension.
|
||||
|
||||
\section2 Main Tag
|
||||
The root tag is \c plugin. It has mandatory attributes \c name
|
||||
and \c version, and an optional \c compatVersion.
|
||||
\table
|
||||
\header
|
||||
\o Tag
|
||||
\o Meaning
|
||||
\row
|
||||
\o plugin
|
||||
\o Root element in a plugin's xml file.
|
||||
\endtable
|
||||
\table
|
||||
\header
|
||||
\o Attribute
|
||||
\o Meaning
|
||||
\row
|
||||
\o name
|
||||
\o This is used as an identifier for the plugin and can e.g.
|
||||
be referenced in other plugin's dependencies. It is
|
||||
also used to construct the name of the plugin library
|
||||
as \c lib[name].[dll|.so|.dylib].
|
||||
\row
|
||||
\o version
|
||||
\o Version string in the form \c {"x.y.z_n"}, used for identifying
|
||||
the plugin.
|
||||
\row
|
||||
\o compatVersion
|
||||
\o Compatibility version. Optional. If not given, it is implicitly
|
||||
set to the same value as \c version. The compatibility version
|
||||
is used to resolve dependencies on this plugin. See
|
||||
\l {Dependencies}{Dependencies} for details.
|
||||
\endtable
|
||||
|
||||
\section2 Plugin-describing Tags
|
||||
These are direct children of the \c plugin tag, and are solely used
|
||||
for more detailed (user centric) description of the plugin. All of these
|
||||
are optional.
|
||||
\table
|
||||
\header
|
||||
\o Tag
|
||||
\o Meaning
|
||||
\row
|
||||
\o vendor
|
||||
\o String that describes the plugin creator/vendor,
|
||||
like \c {MyCompany}.
|
||||
\row
|
||||
\o copyright
|
||||
\o A short copyright notice, like \c {(C) 2007-2008 MyCompany}.
|
||||
\row
|
||||
\o license
|
||||
\o Possibly multi-line license information about the plugin.
|
||||
\row
|
||||
\o description
|
||||
\o Possibly multi-line description of what the plugin is supposed
|
||||
to provide.
|
||||
\row
|
||||
\o url
|
||||
\o Link to further information about the plugin, like
|
||||
\c {http://www.mycompany-online.com/products/greatplugin}.
|
||||
\endtable
|
||||
|
||||
\section2 Dependencies
|
||||
A plugin can have dependencies on other plugins. These are
|
||||
specified in the plugin's xml file as well, to ensure that
|
||||
these other plugins are loaded before this plugin.
|
||||
Dependency information consists of the name of the required plugin
|
||||
(lets denote that as \c {dependencyName}),
|
||||
and the required version of the plugin (\c {dependencyVersion}).
|
||||
A plugin with given \c name, \c version and \c compatVersion matches
|
||||
the dependency if
|
||||
\list
|
||||
\o its \c name matches \c dependencyName, and
|
||||
\o \c {compatVersion <= dependencyVersion <= version}.
|
||||
\endlist
|
||||
|
||||
The xml element that describes dependencies is the \c dependency tag,
|
||||
with required attributes \c name and \c version. It is an
|
||||
optional direct child of the \c plugin tag and can appear multiple times.
|
||||
\table
|
||||
\header
|
||||
\o Tag
|
||||
\o Meaning
|
||||
\row
|
||||
\o dependency
|
||||
\o Describes a dependency on another plugin.
|
||||
\endtable
|
||||
\table
|
||||
\header
|
||||
\o Attribute
|
||||
\o Meaning
|
||||
\row
|
||||
\o name
|
||||
\o The name of the plugin, on which this plugin relies.
|
||||
\row
|
||||
\o version
|
||||
\o The version to which the plugin must be compatible to
|
||||
fill the dependency, in the form \c {"x.y.z_n"}.
|
||||
\endtable
|
||||
|
||||
\section2 Example \c plugin.xml
|
||||
\code
|
||||
<plugin name="test" version="1.0.1" compatVersion="1.0.0">
|
||||
<vendor>MyCompany</vendor>
|
||||
<copyright>(C) 2007 MyCompany</copyright>
|
||||
<license>
|
||||
This is a default license bla
|
||||
blubbblubb
|
||||
end of terms
|
||||
</license>
|
||||
<description>
|
||||
This plugin is just a test.
|
||||
it demonstrates the great use of the plugin spec.
|
||||
</description>
|
||||
<url>http://www.mycompany-online.com/products/greatplugin</url>
|
||||
<dependencyList>
|
||||
<dependency name="SomeOtherPlugin" version="2.3.0_2"/>
|
||||
<dependency name="EvenOther" version="1.0.0"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
\endcode
|
||||
The first dependency could for example be matched by a plugin with
|
||||
\code
|
||||
<plugin name="SomeOtherPlugin" version="3.1.0" compatVersion="2.2.0">
|
||||
</plugin>
|
||||
\endcode
|
||||
since the name matches, and the version \c "2.3.0_2" given in the dependency tag
|
||||
lies in the range of \c "2.2.0" and \c "3.1.0".
|
||||
|
||||
\section2 A Note on Plugin Versions
|
||||
Plugin versions are in the form \c "x.y.z_n" where, x, y, z and n are
|
||||
non-negative integer numbers. You don't have to specify the version
|
||||
in this full form - any left-out part will implicitly be set to zero.
|
||||
So, \c "2.10_2" is equal to \c "2.10.0_2", and "1" is the same as "1.0.0_0".
|
||||
|
||||
\section1 Plugin Implementation
|
||||
Plugins must provide one implementation of the IPlugin class, located
|
||||
in a library that matches the \c name attribute given in their
|
||||
xml description. The IPlugin implementation must be exported and
|
||||
made known to Qt's plugin system via the Q_EXPORT_PLUGIN macro, see the
|
||||
Qt documentation for details on that.
|
||||
|
||||
After the plugins' xml files have been read, and dependencies have been
|
||||
found, the plugin loading is done in three phases:
|
||||
\list 1
|
||||
\o All plugin libraries are loaded in 'root-to-leaf' order of the
|
||||
dependency tree.
|
||||
\o All plugins' initialize methods are called in 'root-to-leaf' order
|
||||
of the dependency tree. This is a good place to put
|
||||
objects in the plugin manager's object pool.
|
||||
\o All plugins' extensionsInitialized methods are called in 'leaf-to-root'
|
||||
order of the dependency tree. At this point, plugins can
|
||||
be sure that all plugins that depend on this plugin have
|
||||
been initialized completely (implying that they have put
|
||||
objects in the object pool, if they want that during the
|
||||
initialization sequence).
|
||||
\endlist
|
||||
If library loading or initialization of a plugin fails, all plugins
|
||||
that depend on that plugin also fail.
|
||||
|
||||
Plugins have access to the plugin manager
|
||||
(and its object pool) via the PluginManager::instance()
|
||||
method.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn bool IPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
Called after the plugin has been loaded and the IPlugin instance
|
||||
has been created. The initialize methods of plugins that depend
|
||||
on this plugin are called after the initialize method of this plugin
|
||||
has been called. Plugins should initialize their internal state in this
|
||||
method. Returns if initialization of successful. If it wasn't successful,
|
||||
the \a errorString should be set to a user-readable message
|
||||
describing the reason.
|
||||
\sa extensionsInitialized()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void IPlugin::extensionsInitialized()
|
||||
Called after the IPlugin::initialize() method has been called,
|
||||
and after both the IPlugin::initialize() and IPlugin::extensionsInitialized()
|
||||
methods of plugins that depend on this plugin have been called.
|
||||
In this method, the plugin can assume that plugins that depend on
|
||||
this plugin are fully 'up and running'. It is a good place to
|
||||
look in the plugin manager's object pool for objects that have
|
||||
been provided by dependent plugins.
|
||||
\sa initialize()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void IPlugin::shutdown()
|
||||
Called during a shutdown sequence in the same order as initialization
|
||||
before the plugins get deleted in reverse order.
|
||||
This method can be used to optimize the shutdown down, e.g. to
|
||||
disconnect from the PluginManager::aboutToRemoveObject() signal
|
||||
if getting the signal (and probably doing lots of stuff to update
|
||||
the internal and visible state) doesn't make sense during shutdown.
|
||||
*/
|
||||
|
||||
using namespace ExtensionSystem;
|
||||
|
||||
/*!
|
||||
\fn IPlugin::IPlugin()
|
||||
\internal
|
||||
*/
|
||||
IPlugin::IPlugin()
|
||||
: d(new Internal::IPluginPrivate())
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn IPlugin::~IPlugin()
|
||||
\internal
|
||||
*/
|
||||
IPlugin::~IPlugin()
|
||||
{
|
||||
PluginManager *pm = PluginManager::instance();
|
||||
foreach (QObject *obj, d->addedObjectsInReverseOrder)
|
||||
pm->removeObject(obj);
|
||||
qDeleteAll(d->addedObjectsInReverseOrder);
|
||||
d->addedObjectsInReverseOrder.clear();
|
||||
delete d;
|
||||
d = 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn PluginSpec *IPlugin::pluginSpec() const
|
||||
Returns the PluginSpec corresponding to this plugin.
|
||||
This is not available in the constructor.
|
||||
*/
|
||||
PluginSpec *IPlugin::pluginSpec() const
|
||||
{
|
||||
return d->pluginSpec;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void IPlugin::addObject(QObject *obj)
|
||||
Convenience method that registers \a obj in the plugin manager's
|
||||
plugin pool by just calling PluginManager::addObject().
|
||||
*/
|
||||
void IPlugin::addObject(QObject *obj)
|
||||
{
|
||||
PluginManager::instance()->addObject(obj);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void IPlugin::addAutoReleasedObject(QObject *obj)
|
||||
Convenience method for registering \a obj in the plugin manager's
|
||||
plugin pool. Usually, registered objects must be removed from
|
||||
the object pool and deleted by hand.
|
||||
Objects added to the pool via addAutoReleasedObject are automatically
|
||||
removed and deleted in reverse order of registration when
|
||||
the IPlugin instance is destroyed.
|
||||
\sa PluginManager::addObject()
|
||||
*/
|
||||
void IPlugin::addAutoReleasedObject(QObject *obj)
|
||||
{
|
||||
d->addedObjectsInReverseOrder.prepend(obj);
|
||||
PluginManager::instance()->addObject(obj);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void IPlugin::removeObject(QObject *obj)
|
||||
Convenience method that unregisters \a obj from the plugin manager's
|
||||
plugin pool by just calling PluginManager::removeObject().
|
||||
*/
|
||||
void IPlugin::removeObject(QObject *obj)
|
||||
{
|
||||
PluginManager::instance()->removeObject(obj);
|
||||
}
|
||||
|
73
Ground/src/libs/extensionsystem/iplugin.h
Normal file
73
Ground/src/libs/extensionsystem/iplugin.h
Normal file
@ -0,0 +1,73 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef IPLUGIN_H
|
||||
#define IPLUGIN_H
|
||||
|
||||
#include "extensionsystem_global.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
namespace ExtensionSystem {
|
||||
|
||||
namespace Internal {
|
||||
class IPluginPrivate;
|
||||
class PluginSpecPrivate;
|
||||
}
|
||||
|
||||
class PluginManager;
|
||||
class PluginSpec;
|
||||
|
||||
class EXTENSIONSYSTEM_EXPORT IPlugin : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IPlugin();
|
||||
virtual ~IPlugin();
|
||||
|
||||
virtual bool initialize(const QStringList &arguments, QString *errorString) = 0;
|
||||
virtual void extensionsInitialized() = 0;
|
||||
virtual void shutdown() { }
|
||||
|
||||
PluginSpec *pluginSpec() const;
|
||||
|
||||
void addObject(QObject *obj);
|
||||
void addAutoReleasedObject(QObject *obj);
|
||||
void removeObject(QObject *obj);
|
||||
|
||||
private:
|
||||
Internal::IPluginPrivate *d;
|
||||
|
||||
friend class Internal::PluginSpecPrivate;
|
||||
};
|
||||
|
||||
} // namespace ExtensionSystem
|
||||
|
||||
#endif // IPLUGIN_H
|
55
Ground/src/libs/extensionsystem/iplugin_p.h
Normal file
55
Ground/src/libs/extensionsystem/iplugin_p.h
Normal file
@ -0,0 +1,55 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef IPLUGIN_P_H
|
||||
#define IPLUGIN_P_H
|
||||
|
||||
#include "iplugin.h"
|
||||
|
||||
#include <QtCore/QString>
|
||||
|
||||
namespace ExtensionSystem {
|
||||
|
||||
class PluginManager;
|
||||
class PluginSpec;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class IPluginPrivate
|
||||
{
|
||||
public:
|
||||
PluginSpec *pluginSpec;
|
||||
|
||||
QList<QObject *> addedObjectsInReverseOrder;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ExtensionSystem
|
||||
|
||||
#endif // IPLUGIN_P_H
|
189
Ground/src/libs/extensionsystem/optionsparser.cpp
Normal file
189
Ground/src/libs/extensionsystem/optionsparser.cpp
Normal file
@ -0,0 +1,189 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "optionsparser.h"
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
using namespace ExtensionSystem;
|
||||
using namespace ExtensionSystem::Internal;
|
||||
|
||||
static const char *END_OF_OPTIONS = "--";
|
||||
const char *OptionsParser::NO_LOAD_OPTION = "-noload";
|
||||
const char *OptionsParser::TEST_OPTION = "-test";
|
||||
|
||||
OptionsParser::OptionsParser(const QStringList &args,
|
||||
const QMap<QString, bool> &appOptions,
|
||||
QMap<QString, QString> *foundAppOptions,
|
||||
QString *errorString,
|
||||
PluginManagerPrivate *pmPrivate)
|
||||
: m_args(args), m_appOptions(appOptions),
|
||||
m_foundAppOptions(foundAppOptions),
|
||||
m_errorString(errorString),
|
||||
m_pmPrivate(pmPrivate),
|
||||
m_it(m_args.constBegin()),
|
||||
m_end(m_args.constEnd()),
|
||||
m_isDependencyRefreshNeeded(false),
|
||||
m_hasError(false)
|
||||
{
|
||||
++m_it; // jump over program name
|
||||
if (m_errorString)
|
||||
m_errorString->clear();
|
||||
if (m_foundAppOptions)
|
||||
m_foundAppOptions->clear();
|
||||
m_pmPrivate->arguments.clear();
|
||||
}
|
||||
|
||||
bool OptionsParser::parse()
|
||||
{
|
||||
while (!m_hasError) {
|
||||
if (!nextToken()) // move forward
|
||||
break;
|
||||
if (checkForEndOfOptions())
|
||||
break;
|
||||
if (checkForNoLoadOption())
|
||||
continue;
|
||||
if (checkForTestOption())
|
||||
continue;
|
||||
if (checkForAppOption())
|
||||
continue;
|
||||
if (checkForPluginOption())
|
||||
continue;
|
||||
if (checkForUnknownOption())
|
||||
break;
|
||||
// probably a file or something
|
||||
m_pmPrivate->arguments << m_currentArg;
|
||||
}
|
||||
if (m_isDependencyRefreshNeeded)
|
||||
m_pmPrivate->resolveDependencies();
|
||||
return !m_hasError;
|
||||
}
|
||||
|
||||
bool OptionsParser::checkForEndOfOptions()
|
||||
{
|
||||
if (m_currentArg != QLatin1String(END_OF_OPTIONS))
|
||||
return false;
|
||||
while (nextToken()) {
|
||||
m_pmPrivate->arguments << m_currentArg;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OptionsParser::checkForTestOption()
|
||||
{
|
||||
if (m_currentArg != QLatin1String(TEST_OPTION))
|
||||
return false;
|
||||
if (nextToken(RequiredToken)) {
|
||||
PluginSpec *spec = m_pmPrivate->pluginByName(m_currentArg);
|
||||
if (!spec) {
|
||||
if (m_errorString)
|
||||
*m_errorString = QCoreApplication::translate("PluginManager",
|
||||
"The plugin '%1' does not exist.").arg(m_currentArg);
|
||||
m_hasError = true;
|
||||
} else {
|
||||
m_pmPrivate->testSpecs.append(spec);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OptionsParser::checkForNoLoadOption()
|
||||
{
|
||||
if (m_currentArg != QLatin1String(NO_LOAD_OPTION))
|
||||
return false;
|
||||
if (nextToken(RequiredToken)) {
|
||||
PluginSpec *spec = m_pmPrivate->pluginByName(m_currentArg);
|
||||
if (!spec) {
|
||||
if (m_errorString)
|
||||
*m_errorString = QCoreApplication::translate("PluginManager",
|
||||
"The plugin '%1' does not exist.").arg(m_currentArg);
|
||||
m_hasError = true;
|
||||
} else {
|
||||
m_pmPrivate->pluginSpecs.removeAll(spec);
|
||||
delete spec;
|
||||
m_isDependencyRefreshNeeded = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OptionsParser::checkForAppOption()
|
||||
{
|
||||
if (!m_appOptions.contains(m_currentArg))
|
||||
return false;
|
||||
QString option = m_currentArg;
|
||||
QString argument;
|
||||
if (m_appOptions.value(m_currentArg) && nextToken(RequiredToken)) {
|
||||
//argument required
|
||||
argument = m_currentArg;
|
||||
}
|
||||
if (m_foundAppOptions)
|
||||
m_foundAppOptions->insert(option, argument);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OptionsParser::checkForPluginOption()
|
||||
{
|
||||
bool requiresParameter;
|
||||
PluginSpec *spec = m_pmPrivate->pluginForOption(m_currentArg, &requiresParameter);
|
||||
if (!spec)
|
||||
return false;
|
||||
spec->addArgument(m_currentArg);
|
||||
if (requiresParameter && nextToken(RequiredToken)) {
|
||||
spec->addArgument(m_currentArg);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OptionsParser::checkForUnknownOption()
|
||||
{
|
||||
if (!m_currentArg.startsWith(QLatin1Char('-')))
|
||||
return false;
|
||||
if (m_errorString)
|
||||
*m_errorString = QCoreApplication::translate("PluginManager",
|
||||
"Unknown option %1").arg(m_currentArg);
|
||||
m_hasError = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OptionsParser::nextToken(OptionsParser::TokenType type)
|
||||
{
|
||||
if (m_it == m_end) {
|
||||
if (type == OptionsParser::RequiredToken) {
|
||||
m_hasError = true;
|
||||
if (m_errorString)
|
||||
*m_errorString = QCoreApplication::translate("PluginManager",
|
||||
"The option %1 requires an argument.").arg(m_currentArg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
m_currentArg = *m_it;
|
||||
++m_it;
|
||||
return true;
|
||||
}
|
84
Ground/src/libs/extensionsystem/optionsparser.h
Normal file
84
Ground/src/libs/extensionsystem/optionsparser.h
Normal file
@ -0,0 +1,84 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef OPTIONSPARSER_H
|
||||
#define OPTIONSPARSER_H
|
||||
|
||||
#include "pluginmanager_p.h"
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QMap>
|
||||
|
||||
namespace ExtensionSystem {
|
||||
namespace Internal {
|
||||
|
||||
class OptionsParser
|
||||
{
|
||||
public:
|
||||
OptionsParser(const QStringList &args,
|
||||
const QMap<QString, bool> &appOptions,
|
||||
QMap<QString, QString> *foundAppOptions,
|
||||
QString *errorString,
|
||||
PluginManagerPrivate *pmPrivate);
|
||||
|
||||
bool parse();
|
||||
|
||||
static const char *NO_LOAD_OPTION;
|
||||
static const char *TEST_OPTION;
|
||||
private:
|
||||
// return value indicates if the option was processed
|
||||
// it doesn't indicate success (--> m_hasError)
|
||||
bool checkForEndOfOptions();
|
||||
bool checkForNoLoadOption();
|
||||
bool checkForTestOption();
|
||||
bool checkForAppOption();
|
||||
bool checkForPluginOption();
|
||||
bool checkForUnknownOption();
|
||||
|
||||
enum TokenType { OptionalToken, RequiredToken };
|
||||
bool nextToken(TokenType type = OptionalToken);
|
||||
|
||||
const QStringList &m_args;
|
||||
const QMap<QString, bool> &m_appOptions;
|
||||
QMap<QString, QString> *m_foundAppOptions;
|
||||
QString *m_errorString;
|
||||
PluginManagerPrivate *m_pmPrivate;
|
||||
|
||||
// state
|
||||
QString m_currentArg;
|
||||
QStringList::const_iterator m_it;
|
||||
QStringList::const_iterator m_end;
|
||||
bool m_isDependencyRefreshNeeded;
|
||||
bool m_hasError;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ExtensionSystem
|
||||
|
||||
#endif // OPTIONSPARSER_H
|
90
Ground/src/libs/extensionsystem/plugindetailsview.cpp
Normal file
90
Ground/src/libs/extensionsystem/plugindetailsview.cpp
Normal file
@ -0,0 +1,90 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "plugindetailsview.h"
|
||||
#include "ui_plugindetailsview.h"
|
||||
#include "pluginspec.h"
|
||||
|
||||
#include <QtCore/QDir>
|
||||
|
||||
/*!
|
||||
\class ExtensionSystem::PluginDetailsView
|
||||
\brief Widget that displays the contents of a PluginSpec.
|
||||
|
||||
Can be used for integration in the application that
|
||||
uses the plugin manager.
|
||||
|
||||
\sa ExtensionSystem::PluginView
|
||||
*/
|
||||
|
||||
using namespace ExtensionSystem;
|
||||
|
||||
/*!
|
||||
\fn PluginDetailsView::PluginDetailsView(QWidget *parent)
|
||||
Constructs a new view with given \a parent widget.
|
||||
*/
|
||||
PluginDetailsView::PluginDetailsView(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_ui(new Internal::Ui::PluginDetailsView())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn PluginDetailsView::~PluginDetailsView()
|
||||
\internal
|
||||
*/
|
||||
PluginDetailsView::~PluginDetailsView()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void PluginDetailsView::update(PluginSpec *spec)
|
||||
Reads the given \a spec and displays its values
|
||||
in this PluginDetailsView.
|
||||
*/
|
||||
void PluginDetailsView::update(PluginSpec *spec)
|
||||
{
|
||||
m_ui->name->setText(spec->name());
|
||||
m_ui->version->setText(spec->version());
|
||||
m_ui->compatVersion->setText(spec->compatVersion());
|
||||
m_ui->vendor->setText(spec->vendor());
|
||||
const QString link = QString::fromLatin1("<a href=\"%1\">%1</a>").arg(spec->url());
|
||||
m_ui->url->setText(link);
|
||||
m_ui->location->setText(QDir::toNativeSeparators(spec->filePath()));
|
||||
m_ui->description->setText(spec->description());
|
||||
m_ui->copyright->setText(spec->copyright());
|
||||
m_ui->license->setText(spec->license());
|
||||
QStringList depStrings;
|
||||
foreach (PluginDependency dep, spec->dependencies()) {
|
||||
depStrings << QString("%1 (%2)").arg(dep.name).arg(dep.version);
|
||||
}
|
||||
m_ui->dependencies->addItems(depStrings);
|
||||
}
|
64
Ground/src/libs/extensionsystem/plugindetailsview.h
Normal file
64
Ground/src/libs/extensionsystem/plugindetailsview.h
Normal file
@ -0,0 +1,64 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef PLUGINDETAILSVIEW_H_
|
||||
#define PLUGINDETAILSVIEW_H_
|
||||
|
||||
#include "extensionsystem_global.h"
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
namespace ExtensionSystem {
|
||||
|
||||
class PluginSpec;
|
||||
|
||||
namespace Internal {
|
||||
namespace Ui {
|
||||
class PluginDetailsView;
|
||||
} // namespace Ui
|
||||
} // namespace Internal
|
||||
|
||||
|
||||
class EXTENSIONSYSTEM_EXPORT PluginDetailsView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PluginDetailsView(QWidget *parent = 0);
|
||||
~PluginDetailsView();
|
||||
|
||||
void update(PluginSpec *spec);
|
||||
|
||||
private:
|
||||
Internal::Ui::PluginDetailsView *m_ui;
|
||||
};
|
||||
|
||||
} // namespace ExtensionSystem
|
||||
|
||||
#endif
|
224
Ground/src/libs/extensionsystem/plugindetailsview.ui
Normal file
224
Ground/src/libs/extensionsystem/plugindetailsview.ui
Normal file
@ -0,0 +1,224 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ExtensionSystem::Internal::PluginDetailsView</class>
|
||||
<widget class="QWidget" name="ExtensionSystem::Internal::PluginDetailsView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>674</width>
|
||||
<height>505</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="name"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Version:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="version"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Compatibility Version:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="compatVersion"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Vendor:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="vendor"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Url:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="url">
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="location">
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QTextEdit" name="description">
|
||||
<property name="tabChangesFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Copyright:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="copyright"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>License:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>17</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QTextEdit" name="license">
|
||||
<property name="tabChangesFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Dependencies:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QListWidget" name="dependencies"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
112
Ground/src/libs/extensionsystem/pluginerrorview.cpp
Normal file
112
Ground/src/libs/extensionsystem/pluginerrorview.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "pluginerrorview.h"
|
||||
#include "ui_pluginerrorview.h"
|
||||
#include "pluginspec.h"
|
||||
|
||||
#include <QtCore/QString>
|
||||
|
||||
/*!
|
||||
\class ExtensionSystem::PluginErrorView
|
||||
\brief Widget that displays the state and error message of a PluginSpec.
|
||||
|
||||
Can be used for integration in the application that
|
||||
uses the plugin manager.
|
||||
|
||||
\sa ExtensionSystem::PluginView
|
||||
*/
|
||||
|
||||
using namespace ExtensionSystem;
|
||||
|
||||
/*!
|
||||
\fn PluginErrorView::PluginErrorView(QWidget *parent)
|
||||
Constructs a new error view with given \a parent widget.
|
||||
*/
|
||||
PluginErrorView::PluginErrorView(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_ui(new Internal::Ui::PluginErrorView())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn PluginErrorView::~PluginErrorView()
|
||||
\internal
|
||||
*/
|
||||
PluginErrorView::~PluginErrorView()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void PluginErrorView::update(PluginSpec *spec)
|
||||
Reads the given \a spec and displays its state and
|
||||
error information in this PluginErrorView.
|
||||
*/
|
||||
void PluginErrorView::update(PluginSpec *spec)
|
||||
{
|
||||
QString text;
|
||||
QString tooltip;
|
||||
switch (spec->state()) {
|
||||
case PluginSpec::Invalid:
|
||||
text = tr("Invalid");
|
||||
tooltip = tr("Description file found, but error on read");
|
||||
break;
|
||||
case PluginSpec::Read:
|
||||
text = tr("Read");
|
||||
tooltip = tr("Description successfully read");
|
||||
break;
|
||||
case PluginSpec::Resolved:
|
||||
text = tr("Resolved");
|
||||
tooltip = tr("Dependencies are successfully resolved");
|
||||
break;
|
||||
case PluginSpec::Loaded:
|
||||
text = tr("Loaded");
|
||||
tooltip = tr("Library is loaded");
|
||||
break;
|
||||
case PluginSpec::Initialized:
|
||||
text = tr("Initialized");
|
||||
tooltip = tr("Plugin's initialization method succeeded");
|
||||
break;
|
||||
case PluginSpec::Running:
|
||||
text = tr("Running");
|
||||
tooltip = tr("Plugin successfully loaded and running");
|
||||
break;
|
||||
case PluginSpec::Stopped:
|
||||
text = tr("Stopped");
|
||||
tooltip = tr("Plugin was shut down");
|
||||
case PluginSpec::Deleted:
|
||||
text = tr("Deleted");
|
||||
tooltip = tr("Plugin ended its life cycle and was deleted");
|
||||
}
|
||||
m_ui->state->setText(text);
|
||||
m_ui->state->setToolTip(tooltip);
|
||||
m_ui->errorString->setText(spec->errorString());
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user