forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.3'
Change-Id: I2c5fc730816231fed253a9a387c390386c594314
This commit is contained in:
2
README
2
README
@@ -170,7 +170,7 @@ http://qt-project.org/wiki/Building_Qt_5_from_Git .
|
||||
able to find all dependent Qt-libraries and plugins when being launched by the
|
||||
system. The easiest way to provide them for Qt 5 is to run the tool windeployqt:
|
||||
|
||||
windeployqt -svg -xml -designercomponents -script -concurrent -network -quick -quickwidgets -test -sql -printsupport -qthelp -qmldir share\qtcreator -qmldir src\plugins\qmlprofiler bin\qtcreator.exe
|
||||
windeployqt -qmldir share\qtcreator -qmldir src\plugins\qmlprofiler bin\qtcreator.exe lib\qtcreator lib\qtcreator\plugins
|
||||
|
||||
Note that unlike on Unix, you cannot overwrite executables that are running.
|
||||
Thus, if you want to work on Qt Creator using Qt Creator, you need a
|
||||
|
||||
85
dist/changes-3.3.0
vendored
85
dist/changes-3.3.0
vendored
@@ -14,33 +14,93 @@ General
|
||||
* Created new wizard engine to add new script based wizards
|
||||
without the need for recompilation
|
||||
* Improved high DPI support
|
||||
* Added Window > Close Window for external windows
|
||||
* Added list of open windows to Window menu
|
||||
* Added basic theming support
|
||||
* Fixed various thread-safety issues in locator
|
||||
|
||||
Editing
|
||||
* Implemented dragging of edited documents between views
|
||||
* Moved the Close Document button next to the document
|
||||
chooser
|
||||
* Implemented dragging of edited documents between splits,
|
||||
and from navigation views onto splits
|
||||
* Added titles to external editor windows
|
||||
* Fixed that File > Close, and the corresponding shortcuts
|
||||
and tool buttons, closed all editors for a document even
|
||||
if multiple editors were visible
|
||||
|
||||
Help
|
||||
* Added Home and Bookmark buttons to external and side-by-side
|
||||
help viewers
|
||||
* Added support for File > Print to external and side-by-side
|
||||
help viewers
|
||||
* Added optionally shown side bar with contents, index, bookmark
|
||||
and search views to external help viewer
|
||||
|
||||
Managing and Building Projects
|
||||
* Added option to specify environment variables per kit
|
||||
(QTCREATORBUG-9898)
|
||||
* Added 256-color ANSI support to application output view
|
||||
(QTCREATORBUG-12623)
|
||||
* Added Select all kits check box to project setup page
|
||||
* Added support for using variables, such as %{Qt:Version},
|
||||
in Qt version and kit display names (QTCREATORBUG-11118)
|
||||
* Changed File > Close Project to a menu that allows selecting
|
||||
a specific project to close, if more than one project is open
|
||||
(QTCREATORBUG-12857)
|
||||
* Fixed that Run menu in project context menu was never shown
|
||||
|
||||
QMake Projects
|
||||
* Implemented asynchronous loading of projects
|
||||
* Added option to use Qt Quick Compiler
|
||||
* Fixed that adding multiple build configurations stopped asking
|
||||
for the configuration name (QTCREATORBUG-12955)
|
||||
* Fixed crash when renaming files in case automatic rewriting
|
||||
of the .pro file is not possible (QTCREATORBUG-12930)
|
||||
|
||||
CMake Projects
|
||||
* Added support for bare metal devices
|
||||
* Added option to override make command (QTCREATORBUG-11788)
|
||||
|
||||
Qbs Projects
|
||||
* Removed experimental status of the plugin
|
||||
* Added support for renaming files (QBS-652)
|
||||
* Fixed crash with simplified project view (QTCREATORBUG-12897)
|
||||
|
||||
Generic Projects
|
||||
* Fixed that project files were shown twice after adding files to empty
|
||||
generic project (QTCREATORBUG-13106)
|
||||
|
||||
Debugging
|
||||
* GDB
|
||||
* Fixed detection of target architecture
|
||||
* CDB
|
||||
* Made it possible to abort the debugging process
|
||||
* Fixed shadowed local variable handling (QTCREATORBUG-13132)
|
||||
|
||||
QML Profiler
|
||||
* Added JavaScript heap profiler
|
||||
* Improved scenegraph profiler
|
||||
* Added drag & drop for reordering categories in timeline (QTCREATORBUG-12337)
|
||||
* Added optional showing and hiding of categories
|
||||
* Added option to add notes to events in timeline for export
|
||||
* Fixed display of binding loops (QTCREATORBUG-12950)
|
||||
* Fixed selection of previous and next item in timeline
|
||||
|
||||
Analyzer
|
||||
|
||||
C++ Support
|
||||
* Added Convert connect() to Qt 5 Style refactoring action
|
||||
* Added smart splitting of string literals when pressing enter within strings
|
||||
* Fixed code completion for pointer in template specialization
|
||||
and initialization (QTCREATORBUG-12638)
|
||||
* Fixed code completion for typedefs of pointer arrays
|
||||
(QTCREATORBUG-12703)
|
||||
* Fixed that hovering over a symbol sometimes jumped to its definition
|
||||
(QTCREATORBUG-12986)
|
||||
* Fixed that include paths were not adjusted when files are renamed
|
||||
|
||||
|
||||
QML Support
|
||||
* Added support for forms
|
||||
|
||||
Qt Quick Designer
|
||||
* Added support for a workflow where .qml code is split into
|
||||
@@ -49,10 +109,16 @@ Qt Quick Designer
|
||||
* Extended anchoring options
|
||||
|
||||
Diff Viewer
|
||||
* Fixed reloading patch files (QTCREATORBUG-13241)
|
||||
|
||||
Version Control Systems
|
||||
* Removed support for Gitorious
|
||||
* Fixed commit editor line wrapping for lines that end with a dash
|
||||
(QTCREATORBUG-8528)
|
||||
|
||||
FakeVim
|
||||
* Fixed issues with Save As
|
||||
(QTCREATORBUG-12810)
|
||||
|
||||
Beautifier
|
||||
|
||||
@@ -63,12 +129,25 @@ Windows
|
||||
OS X
|
||||
|
||||
Android
|
||||
* Removed Necessitas support
|
||||
* Added Gradle build system support
|
||||
* Changed installation of package to use androiddeployqt
|
||||
when using Qt 5.4 or later
|
||||
* Improved error dialog for Android manifest
|
||||
* Split permissions and features check box into separate check boxes
|
||||
in manifest editor
|
||||
* Fixed that passwords used for signing were shown in build log
|
||||
(QTCREATORBUG-12919)
|
||||
|
||||
Remote Linux
|
||||
* Made checks on tool chain and target architecture/OS for deployment
|
||||
options less restrictive
|
||||
|
||||
QNX
|
||||
|
||||
BareMetal
|
||||
|
||||
Tools:
|
||||
* Removed unused zeroconf wrapper
|
||||
|
||||
Credits for these changes go to:
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 33 KiB |
@@ -151,7 +151,7 @@
|
||||
\table
|
||||
|
||||
\header
|
||||
\li Event Type
|
||||
\li Event Category
|
||||
\li Description
|
||||
\li Minimum Qt Version
|
||||
\li Qt Quick Version
|
||||
@@ -183,7 +183,6 @@
|
||||
surpassing a certain size, the memory manager will allocate those
|
||||
separately. Those two modes of operation are shown as events of
|
||||
different colors.
|
||||
|
||||
The second row displays the actual usage of the allocated memory.
|
||||
This is the amount of JavaScript heap the application has actually
|
||||
requested.
|
||||
@@ -191,6 +190,13 @@
|
||||
\li Qt Quick 2
|
||||
\li Yes
|
||||
|
||||
\row
|
||||
\li \gui {Input Events}
|
||||
\li Displays mouse and keyboard events.
|
||||
\li Qt 4.7.4
|
||||
\li Qt Quick 1 or Qt Quick 2
|
||||
\li Yes
|
||||
|
||||
\row
|
||||
\li \gui Painting
|
||||
\li Displays the time spent painting the scene for each frame.
|
||||
@@ -202,7 +208,6 @@
|
||||
\li \gui Animations
|
||||
\li Displays the amount of animations that are active and the frame
|
||||
rate that they are running at.
|
||||
|
||||
Information about render thread animations is displayed for
|
||||
applications that are built with Qt 5.3 or later. Render thread
|
||||
animations are shown in a separate row then.
|
||||
@@ -225,7 +230,6 @@
|
||||
elements. The second stage represents the completion callbacks. Not
|
||||
all elements trigger completion callbacks, though. The stages are
|
||||
shown as separate events in the timeline.
|
||||
|
||||
For Qt Quick 2 applications compiled with versions of Qt before
|
||||
5.2.1 only the creation of top-level elements is shown, as single
|
||||
events.
|
||||
@@ -260,6 +264,207 @@
|
||||
|
||||
\endtable
|
||||
|
||||
\section2 Analyzing Scene Graph Events
|
||||
|
||||
In order to understand the scene graph category, it's important to
|
||||
understand how the Qt Quick scene graph works. See
|
||||
\l {Qt Quick Scene Graph} and \l {Qt Quick Scene Graph Renderer} for a
|
||||
detailed description. The following events are reported in the
|
||||
\gui {Scene Graph} category. Not all events are generated by all render
|
||||
loops. In the Windows and Basic render loops everything runs in the same
|
||||
thread and the distinction between GUI thread and render thread is
|
||||
meaningless.
|
||||
|
||||
If you set the environment variable QSG_RENDER_TIMING, you get a textual
|
||||
output of similar, but slightly different timings from the application
|
||||
being profiled. For easier orientation, the differences are listed below.
|
||||
|
||||
\table
|
||||
\header
|
||||
\li Event Type
|
||||
\li Thread
|
||||
\li Render Loop Types
|
||||
\li Label in output of QSG_RENDER_TIMING
|
||||
\li Description
|
||||
\li Caveats
|
||||
\row
|
||||
\li \gui {Polish}
|
||||
\li GUI
|
||||
\li Threaded, Basic, Windows
|
||||
\li polish
|
||||
\li Final touch-up of items before they are rendered using
|
||||
QQuickItem::updatePolish().
|
||||
\li Versions of Qt prior to Qt 5.4 record no polish times for the basic
|
||||
render loop and incorrect ones for the windows render loop.
|
||||
\row
|
||||
\li \gui {GUI Thread Wait}
|
||||
\li GUI
|
||||
\li Threaded
|
||||
\li lock
|
||||
\li Executing slots connected to the QQuickWindow::afterAnimating()
|
||||
signal and then locking the render thread's mutex before waiting on
|
||||
the same mutex at \gui {GUI Thread Sync}. If this starts long
|
||||
before \gui {Render Thread Sync}, there is \e free time in the GUI
|
||||
thread you could be using for running additional QML or JavaScript.
|
||||
\li None
|
||||
\row
|
||||
\li \gui {GUI Thread Sync}
|
||||
\li GUI
|
||||
\li Threaded
|
||||
\li blockedForSync
|
||||
\li The time the GUI thread is blocked, waiting for the render thread
|
||||
to synchronize the QML state into the scene graph.
|
||||
\li None
|
||||
\row
|
||||
\li \gui {Animations}
|
||||
\li GUI
|
||||
\li Threaded, Windows
|
||||
\li animations
|
||||
\li Advancing animations in the GUI thread. The basic render loop does
|
||||
not drive animations in sync with the rendering. This is why no
|
||||
animation events will be shown when using the basic render loop.
|
||||
Watch the \gui {Animations} category to see animation timing in
|
||||
this case.
|
||||
\li None
|
||||
\row
|
||||
\li \gui {Render Thread Sync}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li Frame rendered ... sync
|
||||
\li Synchronizing the QML state into the scene graph using
|
||||
QQuickItem::updatePaintNode().
|
||||
\li None
|
||||
\row
|
||||
\li \gui {Render}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li Frame rendered ... render
|
||||
\li Total time spent rendering the frame, including preparing and
|
||||
uploading all the necessary data to the GPU. This is the \e gross
|
||||
render time. Do not confuse it with the \e net \gui{Render Render}
|
||||
time below.
|
||||
\li With versions of Qt prior to Qt 5.5, the gross render time and the
|
||||
below breakup of render times may be misaligned by some
|
||||
microseconds due to different, unsynchronized timers being used to
|
||||
measure them. For example \gui {Render Preprocess} might seem to
|
||||
start before \gui {Render Thread Sync} is finished.
|
||||
\row
|
||||
\li \gui {Swap}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li Frame rendered ... swap
|
||||
\li Swapping frames after rendering.
|
||||
\li The output of swap times triggered by setting QSG_RENDER_TIMING is
|
||||
incorrect for the basic render loop and versions of Qt prior to
|
||||
Qt 5.4. The QML profiler shows the correct swap times.
|
||||
\row
|
||||
\li \gui {Render Preprocess}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li time in renderer ... preprocess
|
||||
\li Calling QSGNode::preprocess() on all nodes that need to be
|
||||
preprocessed. This is part of the gross \gui {Render} step.
|
||||
\li May not be properly aligned with \gui {Render} with versions of Qt
|
||||
prior to Qt 5.5.
|
||||
\row
|
||||
\li \gui {Render Update}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li time in renderer ... updates
|
||||
\li Iterating and processing all the nodes in the scene graph to update
|
||||
their geometry, transformations, opacity, and other state. In the
|
||||
\gui {Render Thread Sync} stage, each node is updated separately
|
||||
with state from the GUI thread. In \gui {Render Update}, all the
|
||||
nodes are combined to create the final scene. This is part of the
|
||||
gross \gui {Render} step.
|
||||
\li May not be properly aligned with \gui {Render} with versions of Qt
|
||||
prior to Qt 5.5.
|
||||
\row
|
||||
\li \gui {Render Bind}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li time in renderer ... binding
|
||||
\li Binding the correct framebuffer for OpenGL rendering. This is part
|
||||
of the gross \gui {Render} step.
|
||||
\li May not be properly aligned with \gui {Render} with versions of Qt
|
||||
prior to Qt 5.5.
|
||||
\row
|
||||
\li \gui {Render Render}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li time in renderer ... rendering
|
||||
\li The actual process of sending all the data to the GPU via OpenGL.
|
||||
This is part of the gross \gui {Render} step.
|
||||
\li May not be properly aligned with \gui {Render} with versions of Qt
|
||||
prior to Qt 5.5.
|
||||
\row
|
||||
\li \gui {Material Compile}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li shader compiled
|
||||
\li Compiling GLSL shader programs.
|
||||
\li None
|
||||
\row
|
||||
\li \gui {Glyph Render}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li glyphs ... rendering
|
||||
\li Rendering of font glyphs into textures.
|
||||
\li Versions of Qt prior to Qt 5.4 report incorrect times for these
|
||||
events.
|
||||
\row
|
||||
\li \gui {Glyph Upload}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li glyphs ... upload
|
||||
\li Uploading of glyph textures to the GPU.
|
||||
\li Versions of Qt prior to Qt 5.4 report incorrect times for these
|
||||
events.
|
||||
\row
|
||||
\li \gui {Texture Bind}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li plain texture ... bind
|
||||
\li Binding a texture in the OpenGL context using glBindTextures.
|
||||
\li None
|
||||
\row
|
||||
\li \gui {Texture Convert}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li plain texture ... convert
|
||||
\li Converting the format and downscaling an image to make it suitable
|
||||
for usage as a texture.
|
||||
\li None
|
||||
\row
|
||||
\li \gui {Texture Swizzle}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li plain texture ... swizzle
|
||||
\li Swizzling the texture data on the CPU if necessary.
|
||||
\li None
|
||||
\row
|
||||
\li \gui {Texture Upload}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li plain texture ... upload / atlastexture uploaded
|
||||
\li Uploading the texture data to the GPU.
|
||||
\li None
|
||||
\row
|
||||
\li \gui {Texture Mipmap}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li plain texture ... mipmap
|
||||
\li Mipmapping a texture on the GPU.
|
||||
\li None
|
||||
\row
|
||||
\li \gui {Texture Delete}
|
||||
\li Render
|
||||
\li Threaded, Basic, Windows
|
||||
\li plain texture deleted
|
||||
\li Deleting a texture from the GPU that became unnecessary.
|
||||
\li None
|
||||
\endtable
|
||||
|
||||
\section1 Viewing Events
|
||||
|
||||
The \gui Events view displays the number of times each binding, create,
|
||||
|
||||
@@ -1827,10 +1827,6 @@
|
||||
|
||||
\li String literal
|
||||
|
||||
\row
|
||||
\li #include Header File
|
||||
\li Adds the matching #include statement for a forward-declared class or struct
|
||||
\li Forward-declared class or struct
|
||||
\row
|
||||
\li Add Definition in ...
|
||||
\li Inserts a definition stub for a function declaration either in the header file
|
||||
@@ -1957,9 +1953,9 @@
|
||||
icon appears:
|
||||
\inlineimage qml-toolbar-indicator.png
|
||||
\row
|
||||
\li Add #include for undeclared identifier
|
||||
\li Add #include for undeclared or forward declared identifier
|
||||
\li Adds an #include directive to the current file to make the
|
||||
declaration of a symbol available.
|
||||
definition of a symbol available.
|
||||
\li Undeclared identifier
|
||||
\row
|
||||
\li Reformat Pointers or References
|
||||
|
||||
@@ -221,6 +221,9 @@
|
||||
\inlineimage qtcreator-show-subprojects.png
|
||||
(\gui {Show Subprojects}).
|
||||
|
||||
To visit all parts of a namespace, double-click on the namespace item
|
||||
multiple times.
|
||||
|
||||
\section2 Viewing QML Types
|
||||
|
||||
The \gui Outline view shows the type hierarchy in a QML file.
|
||||
|
||||
@@ -42,11 +42,10 @@
|
||||
|
||||
\li \l{Setting Up a Qbs Project}
|
||||
|
||||
Qt Build Suite (Qbs) is a new build tool for Qt. It is an all-in-one
|
||||
Qt Build Suite (Qbs) is an all-in-one build
|
||||
tool that generates a build graph from a high-level project
|
||||
description (like qmake or CMake do) and executes the commands in
|
||||
the low-level build graph (like make does). Qbs is still
|
||||
experimental, but you can use it to build \QC, for example.
|
||||
the low-level build graph (like make does).
|
||||
|
||||
\li \l{Setting Up an Autotools Project}
|
||||
|
||||
|
||||
@@ -24,33 +24,22 @@
|
||||
|
||||
\title Setting Up a Qbs Project
|
||||
|
||||
The Qt Build Suite (Qbs) and the Qbs plugin are still experimental, and
|
||||
therefore, you must first enable the plugin manually. If you build \QC
|
||||
yourself from our Git repository, you also need to fetch the Qbs submodule
|
||||
to get Qbs support.
|
||||
|
||||
To use Qbs to build a project, you must create a .qbs file for the project.
|
||||
For more information, see the
|
||||
\l{http://qt-project.org/doc/qbs/index.html}{Qbs Manual}.
|
||||
|
||||
\section1 Enabling the Qbs Plugin
|
||||
|
||||
If you use a \QC binary release, you need to enable the plugin by
|
||||
selecting \gui Help > \gui {About Plugins} > \gui {Build Systems}
|
||||
> \gui {QbsProjectManager} and restarting \QC.
|
||||
You can use \QC to create a C or C++ project that is built with Qbs.
|
||||
For more information about Qbs, see
|
||||
the \l{http://qt-project.org/doc/qbs/index.html}{Qbs Manual}.
|
||||
|
||||
\section1 Building Qbs
|
||||
|
||||
To build the Qbs plugin yourself from the \QC git repository:
|
||||
If you build \QC yourself from the \QC Git repository, you also need to
|
||||
fetch the Qbs submodule to get Qbs support:
|
||||
|
||||
\list 1
|
||||
|
||||
\li Fetch the Qbs submodule in your \QC git checkout with
|
||||
\c {git submodule update --init}.
|
||||
|
||||
\li Use Qbs or qmake and make to build \QC again.
|
||||
|
||||
\li Enable the Qbs plugin as described above.
|
||||
\li Run qmake on \QC and build \QC again.
|
||||
|
||||
\endlist
|
||||
|
||||
|
||||
@@ -165,6 +165,7 @@
|
||||
\li \l{Developing Qt Quick Applications}
|
||||
\list
|
||||
\li \l {Creating Qt Quick Projects}
|
||||
\li \l {Qt Quick UI Forms}
|
||||
\li \l {Using Qt Quick Designer}
|
||||
\li \l {Creating Components}
|
||||
\li \l {Creating Buttons}
|
||||
|
||||
@@ -36,6 +36,13 @@
|
||||
\li \l {Creating Qt Quick Projects}
|
||||
|
||||
You can use wizards to create Qt Quick projects.
|
||||
|
||||
\li \l{Qt Quick UI Forms}
|
||||
|
||||
Some of the wizards create Qt Quick projects that contain UI forms
|
||||
(.ui.qml files). The forms use a purely declarative subset of the
|
||||
QML language and you can edit them in the Design mode.
|
||||
|
||||
\li \l {Using Qt Quick Designer}
|
||||
|
||||
You can use the code editor (Edit mode) or the visual editor (Design
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
\contentspage {Qt Creator Manual}
|
||||
\previouspage creator-visual-editor.html
|
||||
\page quick-projects.html
|
||||
\nextpage creator-using-qt-quick-designer.html
|
||||
\nextpage creator-quick-ui-forms.html
|
||||
|
||||
\title Creating Qt Quick Projects
|
||||
|
||||
@@ -102,6 +102,13 @@
|
||||
\li .qml file defines an UI item, such as a component, screen, or the
|
||||
whole application UI.
|
||||
|
||||
\li .qml.ui files defines a form for the application UI. It is created
|
||||
if you select \gui {Qt Quick Controls 1.3}, or later, or
|
||||
\gui {Qt Quick 2.4}, or later. The forms can contain a subset of the
|
||||
QML language. Similarly as with the UI forms for \QD, it is
|
||||
recommended that you use \QMLD to edit the UI forms. For more
|
||||
information, see \l{Qt Quick UI Forms}.
|
||||
|
||||
\endlist
|
||||
|
||||
To use JavaScript and image files in the application, copy them to the
|
||||
|
||||
@@ -24,16 +24,15 @@
|
||||
|
||||
/*!
|
||||
\contentspage {Qt Creator Manual}
|
||||
\previouspage quick-projects.html
|
||||
\previouspage creator-quick-ui-forms.html
|
||||
\page creator-using-qt-quick-designer.html
|
||||
\nextpage quick-components.html
|
||||
|
||||
\title Using Qt Quick Designer
|
||||
|
||||
You can edit .qml files in the \QMLD visual editor or in the code editor.
|
||||
|
||||
In \gui Projects, double-click a .qml file to open it in the code editor.
|
||||
Then select the \gui {Design} mode to edit the file in the visual editor.
|
||||
You can edit \l{Qt Quick UI Forms} (ui.qml files) in \QMLD. \QC opens the
|
||||
UI forms in the \gui Design mode. It is recommended that you use UI forms
|
||||
for components that you want to desing in \QMLD.
|
||||
|
||||
\image qmldesigner-visual-editor.png "Visual editor"
|
||||
|
||||
@@ -185,7 +184,8 @@
|
||||
values that you specify explicitly are highlighted with blue color. In
|
||||
addition, property changes in states are highlighted with blue.
|
||||
|
||||
This allows you to easily see which values are set in the .qml file and
|
||||
This allows you to easily see which values are set in the UI form or
|
||||
QML file and
|
||||
which values are default characteristics of a QML type or a component.
|
||||
|
||||
When editing states, you can easily see which values are explicitly set in
|
||||
@@ -201,7 +201,7 @@
|
||||
\image qmldesigner-properties-explicit-state1.png "Explicitly set properties"
|
||||
|
||||
Resetting a property sets it back to the default value and removes the value
|
||||
from the .qml file.
|
||||
from the UI form or QML file.
|
||||
|
||||
\note As a result, all boolean values can be visualized in four different
|
||||
ways.
|
||||
|
||||
105
doc/src/qtquick/qtquick-ui-forms.qdoc
Normal file
105
doc/src/qtquick/qtquick-ui-forms.qdoc
Normal file
@@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (c) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
**
|
||||
** GNU Free Documentation License
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Free
|
||||
** Documentation License version 1.3 as published by the Free Software
|
||||
** Foundation and appearing in the file included in the packaging of this
|
||||
** file.
|
||||
**
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
// **********************************************************************
|
||||
// NOTE: the sections are not ordered by their logical order to avoid
|
||||
// reshuffling the file each time the index order changes (i.e., often).
|
||||
// Run the fixnavi.pl script to adjust the links to the index order.
|
||||
// **********************************************************************
|
||||
|
||||
/*!
|
||||
|
||||
\contentspage {Qt Creator Manual}
|
||||
\previouspage quick-projects.html
|
||||
\page creator-quick-ui-forms.html
|
||||
\nextpage creator-using-qt-quick-designer.html
|
||||
|
||||
\title Qt Quick UI Forms
|
||||
|
||||
You can use \QC wizards to create UI forms tha have the filename extension
|
||||
\e .ui.qml. The UI forms contain a purely declarative subset of the QML
|
||||
language. It is recommended that you edit the forms in the \gui Design mode.
|
||||
\QC enforces the use of the supported QML features by displaying error
|
||||
messages.
|
||||
|
||||
The following features are not supported:
|
||||
|
||||
\list
|
||||
\li JavaScript blocks
|
||||
\li Function definitions
|
||||
\li Function calls (except \c qsTr)
|
||||
\li Other bindings than pure expressions
|
||||
\li Signal handlers
|
||||
\li States in other items than the root item
|
||||
\li Root items that are not derived from \l QQuickItem or \l Item
|
||||
\endlist
|
||||
|
||||
The following types are not supported:
|
||||
|
||||
\list
|
||||
\li Behavior
|
||||
\li Binding
|
||||
\li Canvas
|
||||
\li Component
|
||||
\li Shader Effect
|
||||
\li Timer
|
||||
\li Transform
|
||||
\li Transition
|
||||
\endlist
|
||||
|
||||
\section1 Using Qt Quick UI Forms
|
||||
|
||||
You can edit the forms in the \gui Design mode. Items that are supposed to
|
||||
be used in QML code have to be exported as properties:
|
||||
|
||||
\code
|
||||
Item {
|
||||
width: 640
|
||||
height: 480
|
||||
|
||||
property alias button: button
|
||||
|
||||
Button {
|
||||
anchors.centerIn: parent
|
||||
id: button
|
||||
text: qsTr("Press Me")
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
The property alias exports the button to the QML code that uses the form.
|
||||
In \QC Enterprise you can use the
|
||||
\inlineimage qmldesigner-export-item-button.png
|
||||
(\gui Export) button in the \gui Navigator to export an item as a property:
|
||||
|
||||
\image qmldesigner-export-item.png
|
||||
|
||||
In the QML file that uses the form, you can use the \c button property alias
|
||||
to implement signal handlers, for example. In the following code snippet,
|
||||
the UI form is called \e MainForm.ui.qml:
|
||||
|
||||
\code
|
||||
MainForm {
|
||||
anchors.fill: parent
|
||||
button.onClicked: messageDialog.show(qsTr("Button pressed"))
|
||||
}
|
||||
\endcode
|
||||
|
||||
You can also assign properties or define behavior or transitions.
|
||||
|
||||
*/
|
||||
@@ -1,9 +1,9 @@
|
||||
!isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included")
|
||||
QTCREATOR_PRI_INCLUDED = 1
|
||||
|
||||
QTCREATOR_VERSION = 3.2.81
|
||||
QTCREATOR_COMPAT_VERSION = 3.2.81
|
||||
BINARY_ARTIFACTS_BRANCH = master
|
||||
QTCREATOR_VERSION = 3.2.82
|
||||
QTCREATOR_COMPAT_VERSION = 3.2.82
|
||||
BINARY_ARTIFACTS_BRANCH = 3.3
|
||||
|
||||
# enable c++11
|
||||
CONFIG += c++11
|
||||
|
||||
@@ -90,9 +90,9 @@ macx {
|
||||
BINDIST_SOURCE = "$$OUT_PWD/bin/Qt Creator.app"
|
||||
BINDIST_INSTALLER_SOURCE = $$BINDIST_SOURCE
|
||||
deployqt.commands = $$PWD/scripts/deployqtHelper_mac.sh \"$${APPBUNDLE}\" \"$$[QT_INSTALL_TRANSLATIONS]\" \"$$[QT_INSTALL_PLUGINS]\" \"$$[QT_INSTALL_IMPORTS]\" \"$$[QT_INSTALL_QML]\"
|
||||
codesign.commands = codesign -s \"$(SIGNING_IDENTITY)\" $(SIGNING_FLAGS) \"$${APPBUNDLE}\"
|
||||
codesign.commands = codesign --deep -s \"$(SIGNING_IDENTITY)\" $(SIGNING_FLAGS) \"$${APPBUNDLE}\"
|
||||
dmg.commands = $$PWD/scripts/makedmg.sh $$OUT_PWD/bin $${BASENAME}.dmg
|
||||
dmg.depends = deployqt
|
||||
#dmg.depends = deployqt
|
||||
QMAKE_EXTRA_TARGETS += codesign dmg
|
||||
} else {
|
||||
BINDIST_SOURCE = "$(INSTALL_ROOT)$$QTC_PREFIX"
|
||||
@@ -113,9 +113,9 @@ isEmpty(INSTALLER_ARCHIVE_FROM_ENV) {
|
||||
INSTALLER_ARCHIVE = $$OUT_PWD/$$(INSTALLER_ARCHIVE)
|
||||
}
|
||||
|
||||
bindist.depends = deployqt
|
||||
#bindist.depends = deployqt
|
||||
bindist.commands = 7z a -mx9 $$OUT_PWD/$${BASENAME}.7z \"$$BINDIST_SOURCE\"
|
||||
bindist_installer.depends = deployqt
|
||||
#bindist_installer.depends = deployqt
|
||||
bindist_installer.commands = 7z a -mx9 $${INSTALLER_ARCHIVE} \"$$BINDIST_INSTALLER_SOURCE\"
|
||||
installer.depends = bindist_installer
|
||||
installer.commands = python -u $$PWD/scripts/packageIfw.py -i \"$(IFW_PATH)\" -v $${QTCREATOR_VERSION} -a \"$${INSTALLER_ARCHIVE}\" "$$INSTALLER_NAME"
|
||||
|
||||
@@ -5,11 +5,11 @@ Project {
|
||||
property bool withAutotests: qbs.buildVariant === "debug"
|
||||
property string ide_version_major: '3'
|
||||
property string ide_version_minor: '2'
|
||||
property string ide_version_release: '81'
|
||||
property string ide_version_release: '82'
|
||||
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release
|
||||
property string ide_compat_version_major: '3'
|
||||
property string ide_compat_version_minor: '2'
|
||||
property string ide_compat_version_release: '81'
|
||||
property string ide_compat_version_release: '82'
|
||||
property string qtcreator_compat_version: ide_compat_version_major + '.' + ide_compat_version_minor + '.' + ide_compat_version_release
|
||||
property path ide_source_tree: path
|
||||
property string ide_app_path: qbs.targetOS.contains("osx") ? "" : "bin"
|
||||
|
||||
@@ -2,57 +2,61 @@
|
||||
[ $# -lt 5 ] && echo "Usage: $(basename $0) <app folder> <qt translations folder> <qt plugin folder> <qt quick imports folder> <qt quick 2 imports folder>" && exit 2
|
||||
[ $(uname -s) != "Darwin" ] && echo "Run this script on Mac OS X" && exit 2;
|
||||
|
||||
echo "Deploying Qt"
|
||||
|
||||
# collect designer plugins
|
||||
designerDestDir="$1/Contents/PlugIns/designer"
|
||||
test -d "$designerDestDir" || mkdir -p "$designerDestDir"
|
||||
for plugin in "$3"/designer/*.dylib; do
|
||||
cp "$plugin" "$designerDestDir"/ || exit 1
|
||||
done
|
||||
if [ ! -d "$designerDestDir" ]; then
|
||||
echo "- Copying designer plugins"
|
||||
mkdir -p "$designerDestDir"
|
||||
for plugin in "$3"/designer/*.dylib; do
|
||||
cp "$plugin" "$designerDestDir"/ || exit 1
|
||||
done
|
||||
fi
|
||||
|
||||
# copy Qt Quick 1 imports
|
||||
importsDir="$1/Contents/Imports/qtquick1"
|
||||
if [ -d "$4" ]; then
|
||||
test -d "$importsDir" || mkdir -p "$importsDir"
|
||||
cp -R "$4"/ "$importsDir"/
|
||||
if [ ! -d "$importsDir" ]; then
|
||||
echo "- Copying Qt Quick 1 imports"
|
||||
mkdir -p "$importsDir"
|
||||
cp -R "$4"/ "$importsDir"/
|
||||
fi
|
||||
fi
|
||||
|
||||
# copy Qt Quick 2 imports
|
||||
imports2Dir="$1/Contents/Imports/qtquick2"
|
||||
if [ -d "$5" ]; then
|
||||
test -d "$imports2Dir" || mkdir -p "$imports2Dir"
|
||||
cp -R "$5"/ "$imports2Dir"/
|
||||
if [ ! -d "$imports2Dir" ]; then
|
||||
echo "- Copying Qt Quick 2 imports"
|
||||
mkdir -p "$imports2Dir"
|
||||
cp -R "$5"/ "$imports2Dir"/
|
||||
fi
|
||||
fi
|
||||
|
||||
qmlpuppetapp="$1/Contents/MacOS/qmlpuppet"
|
||||
if [ -f "$qmlpuppetapp" ]; then
|
||||
qmlpuppetArgument="-executable=$qmlpuppetapp"
|
||||
fi
|
||||
|
||||
qml2puppetapp="$1/Contents/MacOS/qml2puppet"
|
||||
if [ -f "$qml2puppetapp" ]; then
|
||||
qml2puppetArgument="-executable=$qml2puppetapp"
|
||||
fi
|
||||
|
||||
macdeployqt "$1" \
|
||||
"-executable=$1/Contents/Resources/qtpromaker" \
|
||||
"-executable=$1/Contents/Resources/sdktool" \
|
||||
"-executable=$1/Contents/Resources/ios/iostool" \
|
||||
"-executable=$1/Contents/Resources/ios/iossim" \
|
||||
"-executable=$1/Contents/Resources/ios/iossim_1_8_2" \
|
||||
"$qmlpuppetArgument" "$qml2puppetArgument" || exit 1
|
||||
|
||||
# copy qt creator qt.conf
|
||||
cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qt.conf" "$1/Contents/Resources/qt.conf" || exit 1
|
||||
if [ ! -f "$1/Contents/Resources/qt.conf" ]; then
|
||||
echo "- Copying qt.conf"
|
||||
cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qt.conf" "$1/Contents/Resources/qt.conf" || exit 1
|
||||
fi
|
||||
|
||||
# copy ios tools' qt.conf
|
||||
cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/ios_qt.conf" "$1/Contents/Resources/ios/qt.conf" || exit 1
|
||||
if [ ! -f "$1/Contents/Resources/ios/qt.conf" ]; then
|
||||
echo "- Copying ios/qt.conf"
|
||||
cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/ios_qt.conf" "$1/Contents/Resources/ios/qt.conf" || exit 1
|
||||
fi
|
||||
|
||||
# copy Qt translations
|
||||
cp "$2"/*.qm "$1/Contents/Resources/translations/" || exit 1
|
||||
# check for known existing translation to avoid copying multiple times
|
||||
if [ ! -f "$1/Contents/Resources/translations/qt_de.qm" ]; then
|
||||
echo "- Copying Qt translations"
|
||||
cp "$2"/*.qm "$1/Contents/Resources/translations/" || exit 1
|
||||
fi
|
||||
|
||||
# copy libclang if needed
|
||||
if [ $LLVM_INSTALL_DIR ]; then
|
||||
if [ "$LLVM_INSTALL_DIR"/lib/libclang.dylib -nt "$1/Contents/PlugIns"/libclang.dylib ]; then
|
||||
echo "- Copying libclang"
|
||||
cp -f "$LLVM_INSTALL_DIR"/lib/libclang.dylib "$1/Contents/PlugIns/" || exit 1
|
||||
cp -Rf "$LLVM_INSTALL_DIR"/lib/clang "$1/Contents/Resources/cplusplus/" || exit 1
|
||||
fi
|
||||
@@ -60,6 +64,32 @@ if [ $LLVM_INSTALL_DIR ]; then
|
||||
if [ ! -f "$_CLANG_CODEMODEL_LIB" ]; then
|
||||
_CLANG_CODEMODEL_LIB="$1/Contents/PlugIns/libClangCodeModel.dylib"
|
||||
fi
|
||||
# this will just fail when run a second time on libClangCodeModel
|
||||
xcrun install_name_tool -rpath "$LLVM_INSTALL_DIR/lib" "@loader_path/" "$_CLANG_CODEMODEL_LIB" || true
|
||||
fi
|
||||
|
||||
#### macdeployqt
|
||||
|
||||
if [ ! -d "$1/Contents/Frameworks/QtCore.framework" ]; then
|
||||
|
||||
qmlpuppetapp="$1/Contents/MacOS/qmlpuppet"
|
||||
if [ -f "$qmlpuppetapp" ]; then
|
||||
qmlpuppetArgument="-executable=$qmlpuppetapp"
|
||||
fi
|
||||
|
||||
qml2puppetapp="$1/Contents/MacOS/qml2puppet"
|
||||
if [ -f "$qml2puppetapp" ]; then
|
||||
qml2puppetArgument="-executable=$qml2puppetapp"
|
||||
fi
|
||||
|
||||
echo "- Running macdeployqt ($(which macdeployqt))"
|
||||
|
||||
macdeployqt "$1" \
|
||||
"-executable=$1/Contents/Resources/qtpromaker" \
|
||||
"-executable=$1/Contents/Resources/sdktool" \
|
||||
"-executable=$1/Contents/Resources/ios/iostool" \
|
||||
"-executable=$1/Contents/Resources/ios/iossim" \
|
||||
"-executable=$1/Contents/Resources/ios/iossim_1_8_2" \
|
||||
"$qmlpuppetArgument" "$qml2puppetArgument" || exit 1
|
||||
|
||||
fi
|
||||
|
||||
@@ -834,6 +834,14 @@ class DumperBase:
|
||||
return "0x%x" % toInteger(addr)
|
||||
except:
|
||||
warn("CANNOT CONVERT TYPE: %s" % type(addr))
|
||||
try:
|
||||
warn("ADDR: %s" % addr)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
warn("TYPE: %s" % addr.type)
|
||||
except:
|
||||
pass
|
||||
return str(addr)
|
||||
|
||||
def tryPutArrayContents(self, base, n, innerType):
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
Introduce 3 alert levels and sort keywords according importance.
|
||||
Few more keywords has been added.
|
||||
-->
|
||||
<language version="1.09" kateversion="2.3" name="Alerts" section="Other" extensions="" mimetype="" author="Dominik Haumann (dhdev@gmx.de)" license="LGPL" hidden="true">
|
||||
<language version="1.11" kateversion="3.1" name="Alerts" section="Other" extensions="" mimetype="" author="Dominik Haumann (dhdev@gmx.de)" license="LGPL" hidden="true">
|
||||
<highlighting>
|
||||
<list name="alerts_hi">
|
||||
<item> ALERT </item>
|
||||
@@ -59,6 +59,10 @@
|
||||
</list>
|
||||
<contexts>
|
||||
<context attribute="Normal Text" lineEndContext="#pop" name="Normal Text" >
|
||||
<StringDetect attribute="Region Marker" context="#stay" String="{{{" beginRegion="AlertRegion1" />
|
||||
<StringDetect attribute="Region Marker" context="#stay" String="}}}" endRegion="AlertRegion1" />
|
||||
<StringDetect attribute="Region Marker" context="#stay" String="BEGIN" beginRegion="AlertRegion2" />
|
||||
<StringDetect attribute="Region Marker" context="#stay" String="END" endRegion="AlertRegion2" />
|
||||
<keyword attribute="Alert Level 1" context="#stay" String="alerts_hi" />
|
||||
<keyword attribute="Alert Level 2" context="#stay" String="alerts_mid" />
|
||||
<keyword attribute="Alert Level 3" context="#stay" String="alerts_lo" />
|
||||
@@ -69,6 +73,7 @@
|
||||
<itemData name="Alert Level 1" defStyleNum="dsAlert" color="#e85848" selColor="#e85848" backgroundColor="#451e1a" />
|
||||
<itemData name="Alert Level 2" defStyleNum="dsAlert" color="#ca9219" selColor="#ca9219" backgroundColor="#451e1a" />
|
||||
<itemData name="Alert Level 3" defStyleNum="dsAlert" color="#81ca2d" selColor="#81ca2d" />
|
||||
<itemData name="Region Marker" defStyleNum="dsRegionMarker"/>
|
||||
</itemDatas>
|
||||
</highlighting>
|
||||
<general>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<language
|
||||
name="CMake"
|
||||
version="1.30"
|
||||
kateversion="2.4"
|
||||
kateversion="3.4"
|
||||
section="Other"
|
||||
extensions="CMakeLists.txt;*.cmake;*.cmake.in"
|
||||
style="CMake"
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE language SYSTEM "language.dtd">
|
||||
<!DOCTYPE language SYSTEM "language.dtd"
|
||||
[
|
||||
<!-- http://www.w3.org/TR/CSS21/syndata.html#tokenization -->
|
||||
<!ENTITY nmstart "[_a-zA-Z]|(\\[0-9a-fA-F]{1,6})|(\\[^\n\r\f0-9a-fA-F])">
|
||||
<!ENTITY nmchar "[_a-zA-Z0-9-]|(\\[0-9a-fA-F]{1,6})|(\\[^\n\r\f0-9a-fA-F])">
|
||||
]>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -18,7 +23,7 @@ Changelog:
|
||||
|
||||
-->
|
||||
|
||||
<language name="CSS" version="2.08" kateversion="2.4" section="Markup" extensions="*.css" indenter="cstyle" mimetype="text/css" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
|
||||
<language name="CSS" version="2.09" kateversion="3.4" section="Markup" extensions="*.css" indenter="cstyle" mimetype="text/css" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
|
||||
|
||||
<highlighting>
|
||||
<list name="properties">
|
||||
@@ -718,7 +723,7 @@ Changelog:
|
||||
<DetectChar attribute="Property" context="RuleSet" char="{" beginRegion="ruleset" />
|
||||
<!--parse selectors-->
|
||||
<DetectChar attribute="Selector Attr" context="SelAttr" char="[" />
|
||||
<RegExpr attribute="Selector Id" context="#stay" String="#([a-zA-Z0-9\-_]|[\x80-\xFF]|\\[0-9A-Fa-f]{1,6})*" />
|
||||
<RegExpr attribute="Selector Id" context="#stay" String="#(-)?(&nmstart;)(&nmchar;)*" />
|
||||
<RegExpr attribute="Selector Class" context="#stay" String="\.([a-zA-Z0-9\-_]|[\x80-\xFF]|\\[0-9A-Fa-f]{1,6})*" />
|
||||
<RegExpr attribute="Selector Pseudo" context="#stay" String=":lang\([\w_-]+\)" />
|
||||
<DetectChar attribute="Selector Pseudo" context="SelPseudo" char=":" />
|
||||
@@ -792,6 +797,7 @@ Changelog:
|
||||
|
||||
<context attribute="Media" lineEndContext="#stay" name="MQEV">
|
||||
<!-- this should be seperate for different features, for now it is all the same -->
|
||||
<DetectSpaces/>
|
||||
<RegExpr attribute="Value" context="#pop" String="[1-9][0-9.]*\s*/\s*[1-9][0-9.]*" />
|
||||
<RegExpr attribute="Value" context="#pop" String="[0-9.]+(em|ex|ch|rem|vw|vh|vm|px|in|cm|mm|pt|pc|deg|rad|grad|turn|ms|s|Hz|kHz|dpi|dpcm)\b" />
|
||||
<RegExpr attribute="Value" context="#pop" String="[0-9.]+[%]?" />
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
-->
|
||||
|
||||
<language name="Doxygen"
|
||||
version="1.35"
|
||||
version="1.38"
|
||||
kateversion="2.4"
|
||||
section="Markup"
|
||||
extensions="*.dox;*.doxygen"
|
||||
@@ -53,15 +53,19 @@
|
||||
<item> \date </item> <item> @date </item>
|
||||
<item> \deprecated </item> <item> @deprecated </item>
|
||||
<item> \details </item> <item> @details </item>
|
||||
<item> \docbookonly </item> <item> @docbookonly </item>
|
||||
<item> \else </item> <item> @else </item>
|
||||
<item> \endcond </item> <item> @endcond </item>
|
||||
<item> \enddocbookonly </item> <item> @enddocbookonly </item>
|
||||
<item> \endhtmlonly </item> <item> @endhtmlonly </item>
|
||||
<item> \endif </item> <item> @endif </item>
|
||||
<item> \enditernal </item> <item> @enditernal </item>
|
||||
<item> \endinternal </item> <item> @endinternal </item>
|
||||
<item> \endlatexonly </item> <item> @endlatexonly </item>
|
||||
<item> \endlink </item> <item> @endlink </item>
|
||||
<item> \endmanonly </item> <item> @endmanonly </item>
|
||||
<item> \endparblock </item> <item> @endparblock </item>
|
||||
<item> \endrtfonly </item> <item> @endrtfonly </item>
|
||||
<item> \endsecreflist </item> <item> @endsecreflist </item>
|
||||
<item> \endxmlonly </item> <item> @endxmlonly </item>
|
||||
<item> \f[ </item> <item> @f[ </item>
|
||||
<item> \f] </item> <item> @f] </item>
|
||||
@@ -78,6 +82,7 @@
|
||||
<item> \n </item> <item> @n </item>
|
||||
<item> \nosubgrouping </item> <item> @nosubgrouping </item>
|
||||
<item> \only </item> <item> @only </item>
|
||||
<item> \parblock </item> <item> @parblock </item>
|
||||
<item> \post </item> <item> @post </item>
|
||||
<item> \pre </item> <item> @pre </item>
|
||||
<item> \private </item> <item> @pivate </item>
|
||||
@@ -86,16 +91,20 @@
|
||||
<item> \protectedsection </item> <item> @protectedsection </item>
|
||||
<item> \public </item> <item> @public </item>
|
||||
<item> \publicsection </item> <item> @publicsection </item>
|
||||
<item> \pure </item> <item> @pure </item>
|
||||
<item> \remark </item> <item> @remark </item>
|
||||
<item> \remarks </item> <item> @remarks </item>
|
||||
<item> \return </item> <item> @return </item>
|
||||
<item> \returns </item> <item> @returns </item>
|
||||
<item> \result </item> <item> @result </item>
|
||||
<item> \rtfonly </item> <item> @rtfonly </item>
|
||||
<item> \sa </item> <item> @sa </item>
|
||||
<item> \secreflist </item> <item> @secreflist </item>
|
||||
<item> \see </item> <item> @see </item>
|
||||
<item> \short </item> <item> @short </item>
|
||||
<item> \showinitializer </item> <item> @showinitializer </item>
|
||||
<item> \since </item> <item> @since </item>
|
||||
<item> \static </item> <item> @static </item>
|
||||
<item> \tableofcontents </item> <item> @tableofcontents </item>
|
||||
<item> \test </item> <item> @test </item>
|
||||
<item> \version </item> <item> @version </item>
|
||||
@@ -112,6 +121,9 @@
|
||||
<item> \@ </item> <item> @@ </item>
|
||||
<item> \\ </item> <item> @\ </item>
|
||||
<item> \~ </item> <item> @~ </item>
|
||||
<item> \. </item> <item> @. </item>
|
||||
<item> \-- </item> <item> @-- </item>
|
||||
<item> \--- </item> <item> @--- </item>
|
||||
</list>
|
||||
|
||||
<list name="TagWord">
|
||||
@@ -119,6 +131,7 @@
|
||||
<item> \anchor </item> <item> @anchor </item>
|
||||
<item> \b </item> <item> @b </item>
|
||||
<item> \c </item> <item> @c </item>
|
||||
<item> \cite </item> <item> @cite </item>
|
||||
<item> \cond </item> <item> @cond </item>
|
||||
<item> \copybrief </item> <item> @copybrief </item>
|
||||
<item> \copydetails </item> <item> @copydetails </item>
|
||||
@@ -136,11 +149,13 @@
|
||||
<item> \extends </item> <item> @extends </item>
|
||||
<item> \file </item> <item> @file </item>
|
||||
<item> \htmlinclude </item> <item> @htmlinclude </item>
|
||||
<item> \idlexcept </item> <item> @idlexcept </item>
|
||||
<item> \if </item> <item> @if </item>
|
||||
<item> \ifnot </item> <item> @ifnot </item>
|
||||
<item> \implements </item> <item> @implements </item>
|
||||
<item> \include </item> <item> @include </item>
|
||||
<item> \includelineno </item> <item> @includelineno </item>
|
||||
<item> \latexinclude </item> <item> @latexinclude </item>
|
||||
<item> \link </item> <item> @link </item>
|
||||
<item> \memberof </item> <item> @memberof </item>
|
||||
<item> \namespace </item> <item> @namespace </item>
|
||||
@@ -176,6 +191,7 @@
|
||||
<item> \addtogroup </item> <item> @addtogroup </item>
|
||||
<item> \category </item> <item> @category </item>
|
||||
<item> \class </item> <item> @class </item>
|
||||
<item> \diafile </item> <item> @diafile </item>
|
||||
<item> \dotfile </item> <item> @dotfile </item>
|
||||
<item> \defgroup </item> <item> @defgroup </item>
|
||||
<item> \interface </item> <item> @interface </item>
|
||||
@@ -209,6 +225,7 @@
|
||||
<item> \typedef </item> <item> @typedef </item>
|
||||
<item> \until </item> <item> @until </item>
|
||||
<item> \var </item> <item> @var </item>
|
||||
<item> \vhdlflow </item> <item> @vhdlflow </item>
|
||||
</list>
|
||||
<list name="Note">
|
||||
<item> \note </item> <item> @note </item>
|
||||
@@ -276,7 +293,7 @@
|
||||
<keyword attribute="Tags" context="ML_TagWordWord" String="TagWordWord" />
|
||||
<keyword attribute="Tags" context="ML_TagString" String="TagString" />
|
||||
<keyword attribute="Tags" context="ML_TagWordString" String="TagWordString" />
|
||||
<RegExpr attribute="Custom Tags" context="#stay" String="[@\\][^@\\ \t]+" />
|
||||
<RegExpr attribute="Custom Tags" context="#stay" String="[@\\]([^@\\ \t\*]|\*(?!/))+" />
|
||||
<DetectIdentifier />
|
||||
<RegExpr attribute="Tags" context="#stay" String="\\(<|>)" />
|
||||
<Detect2Chars attribute="Comment" context="#stay" char="<" char1="<" />
|
||||
@@ -467,31 +484,31 @@
|
||||
|
||||
</contexts>
|
||||
<itemDatas>
|
||||
<itemData name="Normal Text" defStyleNum="dsNormal" />
|
||||
<itemData name="Tags" defStyleNum="dsKeyword" />
|
||||
<itemData name="Custom Tags" defStyleNum="dsKeyword" />
|
||||
<itemData name="Word" defStyleNum="dsIdentifier" />
|
||||
<itemData name="HTML Tag" defStyleNum="dsKeyword" />
|
||||
<itemData name="Entities" defStyleNum="dsOthers" />
|
||||
<itemData name="Description" defStyleNum="dsString" />
|
||||
<itemData name="Comment" defStyleNum="dsComment" />
|
||||
<itemData name="Region" defStyleNum="dsRegionMarker" />
|
||||
<itemData name="Identifier" defStyleNum="dsIdentifier" />
|
||||
<itemData name="HTML Comment" defStyleNum="dsComment" />
|
||||
<itemData name="Types" defStyleNum="dsDataType" />
|
||||
<itemData name="Code" defStyleNum="dsComment" />
|
||||
<itemData name="Dot Graph" defStyleNum="dsComment" />
|
||||
<itemData name="Formulas" defStyleNum="dsComment" />
|
||||
<itemData name="Message Sequence Chart" defStyleNum="dsComment" />
|
||||
<itemData name="Verbatim" defStyleNum="dsComment" />
|
||||
<itemData name="Note" defStyleNum="dsKeyword" />
|
||||
<itemData name="Warning" defStyleNum="dsKeyword" />
|
||||
<itemData name="Attention" defStyleNum="dsKeyword" />
|
||||
<itemData name="Todo" defStyleNum="dsKeyword" />
|
||||
<itemData name="Normal Text" defStyleNum="dsNormal" />
|
||||
<itemData name="Tags" defStyleNum="dsKeyword" color="#ca60ca" bold="1" italic="0" />
|
||||
<itemData name="Custom Tags" defStyleNum="dsNormal" color="#458C61" bold="1" italic="0" />
|
||||
<itemData name="Word" defStyleNum="dsKeyword" color="#0095ff" bold="1" italic="0" />
|
||||
<itemData name="HTML Tag" defStyleNum="dsKeyword" color="#000000" bold="1" italic="0" />
|
||||
<itemData name="Entities" defStyleNum="dsOthers" color="#4086C0" bold="1" italic="1" />
|
||||
<itemData name="Description" defStyleNum="dsString" color="#ff0000" />
|
||||
<itemData name="Comment" defStyleNum="dsComment" />
|
||||
<itemData name="Region" defStyleNum="dsRegionMarker" />
|
||||
<itemData name="Identifier" defStyleNum="dsOthers" />
|
||||
<itemData name="HTML Comment" defStyleNum="dsComment" />
|
||||
<itemData name="Types" defStyleNum="dsDataType" />
|
||||
<itemData name="Code" defStyleNum="dsComment" />
|
||||
<itemData name="Dot Graph" defStyleNum="dsComment" color="#00A000" selColor="#ffffff" italic="1" />
|
||||
<itemData name="Formulas" defStyleNum="dsComment" color="#00A000" selColor="#ffffff" italic="1" />
|
||||
<itemData name="Message Sequence Chart" defStyleNum="dsComment" color="#00A000" selColor="#ffffff" italic="1" />
|
||||
<itemData name="Verbatim" defStyleNum="dsComment" />
|
||||
<itemData name="Note" defStyleNum="dsKeyword" color="#81ca2d" selColor="#81ca2d" bold="1" italic="0" />
|
||||
<itemData name="Warning" defStyleNum="dsKeyword" color="#ca9219" selColor="#ca9219" bold="1" italic="0" />
|
||||
<itemData name="Attention" defStyleNum="dsKeyword" color="#e85848" selColor="#e85848" bold="1" italic="0" />
|
||||
<itemData name="Todo" defStyleNum="dsKeyword" color="#ca60ca" selColor="#ffffff" bold="1" italic="0" />
|
||||
</itemDatas>
|
||||
</highlighting>
|
||||
<general>
|
||||
<keywords casesensitive="0" weakDeliminator="\$~" />
|
||||
<keywords casesensitive="1" weakDeliminator="\$~" />
|
||||
</general>
|
||||
</language>
|
||||
<!-- kate: indent-width 2; -->
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!ENTITY nmtoken "[\-\w\d\.:_]+">
|
||||
<!ENTITY entref "(#[0-9]+|#[xX][0-9A-Fa-f]+|&nmtoken;);">
|
||||
]>
|
||||
<language name="DTD" version="1.02" kateversion="2.4" section="Markup" extensions="*.dtd" mimetype="application/xml-dtd" author="Andriy Lesyuk (s-andy@in.if.ua)" license="LGPL">
|
||||
<language name="DTD" version="1.02" kateversion="3.4" section="Markup" extensions="*.dtd" mimetype="application/xml-dtd" author="Andriy Lesyuk (s-andy@in.if.ua)" license="LGPL">
|
||||
<highlighting>
|
||||
|
||||
<list name="Category">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<!ENTITY name "[A-Za-z_:][\w.:_-]*">
|
||||
<!ENTITY entref "&(#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
|
||||
]>
|
||||
<language name="HTML" version="1.99" kateversion="2.4" section="Markup" extensions="*.htm;*.html;*.shtml;*.shtm" mimetype="text/html" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL" priority="10">
|
||||
<language name="HTML" version="2.1" kateversion="3.4" section="Markup" extensions="*.htm;*.html;*.shtml;*.shtm" mimetype="text/html" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL" priority="10">
|
||||
|
||||
<highlighting>
|
||||
<contexts>
|
||||
@@ -17,23 +17,41 @@
|
||||
<DetectIdentifier/>
|
||||
<StringDetect attribute="Comment" context="Comment" String="<!--" beginRegion="comment" />
|
||||
<StringDetect attribute="CDATA" context="CDATA" String="<![CDATA[" beginRegion="cdata" />
|
||||
<RegExpr attribute="Doctype" context="Doctype" String="<!DOCTYPE\s+" beginRegion="doctype" />
|
||||
<RegExpr attribute="Doctype" context="Doctype" String="<!DOCTYPE\s+" insensitive="true" beginRegion="doctype" />
|
||||
<RegExpr attribute="Processing Instruction" context="PI" String="<\?[\w:-]*" beginRegion="pi" />
|
||||
<RegExpr attribute="Element" context="CSS" String="<style\b" insensitive="TRUE" beginRegion="style" />
|
||||
<RegExpr attribute="Element" context="JS" String="<script\b" insensitive="TRUE" beginRegion="script" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<pre\b" insensitive="TRUE" beginRegion="pre" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<div\b" insensitive="TRUE" beginRegion="div" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<table\b" insensitive="TRUE" beginRegion="table" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<ul\b" insensitive="TRUE" beginRegion="ul" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<ol\b" insensitive="TRUE" beginRegion="ol" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<dl\b" insensitive="TRUE" beginRegion="dl" />
|
||||
<RegExpr attribute="Element" context="CSS" String="<style\b" insensitive="true" beginRegion="style" />
|
||||
<RegExpr attribute="Element" context="JS" String="<script\b" insensitive="true" beginRegion="script" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<pre\b" insensitive="true" beginRegion="pre" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<div\b" insensitive="true" beginRegion="div" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<table\b" insensitive="true" beginRegion="table" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<ul\b" insensitive="true" beginRegion="ul" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<ol\b" insensitive="true" beginRegion="ol" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<dl\b" insensitive="true" beginRegion="dl" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<article\b" insensitive="true" beginRegion="article" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<aside\b" insensitive="true" beginRegion="aside" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<details\b" insensitive="true" beginRegion="details" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<figure\b" insensitive="true" beginRegion="figure" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<footer\b" insensitive="true" beginRegion="footer" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<header\b" insensitive="true" beginRegion="header" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<main\b" insensitive="true" beginRegion="main" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<nav\b" insensitive="true" beginRegion="nav" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<section\b" insensitive="true" beginRegion="section" />
|
||||
<RegExpr attribute="Element" context="El Open" String="<&name;" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</pre\b" insensitive="TRUE" endRegion="pre" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</div\b" insensitive="TRUE" endRegion="div" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</table\b" insensitive="TRUE" endRegion="table" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</ul\b" insensitive="TRUE" endRegion="ul" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</ol\b" insensitive="TRUE" endRegion="ol" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</dl\b" insensitive="TRUE" endRegion="dl" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</pre\b" insensitive="true" endRegion="pre" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</div\b" insensitive="true" endRegion="div" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</table\b" insensitive="true" endRegion="table" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</ul\b" insensitive="true" endRegion="ul" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</ol\b" insensitive="true" endRegion="ol" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</dl\b" insensitive="true" endRegion="dl" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</article\b" insensitive="true" endRegion="article" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</aside\b" insensitive="true" endRegion="aside" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</details\b" insensitive="true" endRegion="details" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</figure\b" insensitive="true" endRegion="figure" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</footer\b" insensitive="true" endRegion="footer" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</header\b" insensitive="true" endRegion="header" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</main\b" insensitive="true" endRegion="main" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</nav\b" insensitive="true" endRegion="nav" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</section\b" insensitive="true" endRegion="section" />
|
||||
<RegExpr attribute="Element" context="El Close" String="</&name;" />
|
||||
<!-- as long as kde gives DTDs the text/html mimetype--><IncludeRules context="FindDTDRules" />
|
||||
<IncludeRules context="FindEntityRefs" />
|
||||
@@ -139,7 +157,7 @@
|
||||
</context>
|
||||
|
||||
<context name="CSS content" attribute="Other Text" lineEndContext="#stay">
|
||||
<RegExpr attribute="Element" context="El Close 2" String="</style\b" insensitive="TRUE" endRegion="style" />
|
||||
<RegExpr attribute="Element" context="El Close 2" String="</style\b" insensitive="true" endRegion="style" />
|
||||
<IncludeRules context="##CSS" includeAttrib="true"/>
|
||||
</context>
|
||||
|
||||
@@ -151,13 +169,13 @@
|
||||
</context>
|
||||
|
||||
<context name="JS content" attribute="Other Text" lineEndContext="#stay">
|
||||
<RegExpr attribute="Element" context="El Close 2" String="</script\b" insensitive="TRUE" endRegion="script" />
|
||||
<RegExpr attribute="Comment" context="JS comment close" String="//(?=.*</script\b)" insensitive="TRUE" />
|
||||
<IncludeRules context="##JavaScript" includeAttrib="true"/>
|
||||
<RegExpr attribute="Element" context="El Close 2" String="</script\b" insensitive="true" endRegion="script" />
|
||||
<RegExpr attribute="Comment" context="JS comment close" String="//(?=.*</script\b)" insensitive="true" />
|
||||
<IncludeRules context="Normal##JavaScript" includeAttrib="true"/>
|
||||
</context>
|
||||
|
||||
<context name="JS comment close" attribute="Comment" lineEndContext="#pop">
|
||||
<RegExpr attribute="Element" context="El Close 3" String="</script\b" insensitive="TRUE" endRegion="script" />
|
||||
<RegExpr attribute="Element" context="El Close 3" String="</script\b" insensitive="true" endRegion="script" />
|
||||
<IncludeRules context="##Alerts" />
|
||||
</context>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE language SYSTEM "language.dtd">
|
||||
<language name="INI Files" section="Configuration" extensions="*.ini;*.pls;*.kcfgc" mimetype="" version="1.1" kateversion="2.0" author="Jan Janssen (medhefgo@web.de)" license="LGPL">
|
||||
<language name="INI Files" section="Configuration" extensions="*.ini;*.pls;*.kcfgc" mimetype="" version="1.1" kateversion="2.4" author="Jan Janssen (medhefgo@web.de)" license="LGPL">
|
||||
|
||||
<highlighting>
|
||||
<list name="keywords">
|
||||
|
||||
@@ -3766,7 +3766,7 @@
|
||||
<HlCOct attribute="Octal" context="#stay"/>
|
||||
<HlCHex attribute="Hex" context="#stay"/>
|
||||
<Int attribute="Decimal" context="#stay">
|
||||
<StringDetect attribute="Decimal" context="#stay" String="L" insensitive="TRUE"/>
|
||||
<StringDetect attribute="Decimal" context="#stay" String="L" insensitive="true"/>
|
||||
</Int>
|
||||
<HlCChar attribute="Char" context="#stay"/>
|
||||
<RegExpr attribute="Char" context="#stay" String="'\\u[0-9a-fA-F]{4}'"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE language SYSTEM "language.dtd">
|
||||
<language name="Javadoc" version="1.04" kateversion="2.4" section="Markup" extensions="" license="LGPL" author="Alfredo Luiz Foltran Fialho (alfoltran@ig.com.br)">
|
||||
<language name="Javadoc" version="1.05" kateversion="2.4" section="Markup" extensions="" license="LGPL" author="Alfredo Luiz Foltran Fialho (alfoltran@ig.com.br)">
|
||||
<highlighting>
|
||||
<contexts>
|
||||
<context name="Start" attribute="Normal Text" lineEndContext="#stay">
|
||||
@@ -78,12 +78,12 @@
|
||||
<RegExpr attribute="JavadocParam" context="#pop#pop" String="\S*(?=\*/)" />
|
||||
<RegExpr attribute="JavadocParam" context="#pop" String="\S*(\s|$)" />
|
||||
</context>
|
||||
<context attribute="InlineTag" name="InlineTagar">
|
||||
<context attribute="InlineTag" name="InlineTagar" lineEndContext="#stay">
|
||||
<DetectChar attribute="InlineTag" context="#pop" char="}" />
|
||||
<Detect2Chars attribute="JavadocFS" context="#pop#pop#pop" char="*" char1="/" />
|
||||
<IncludeRules context="##HTML"/>
|
||||
</context>
|
||||
<context attribute="InlineTag" name="LiteralTagar">
|
||||
<context attribute="InlineTag" name="LiteralTagar" lineEndContext="#stay">
|
||||
<DetectChar attribute="InlineTag" context="#pop" char="}" />
|
||||
<Detect2Chars attribute="JavadocFS" context="#pop#pop#pop" char="*" char1="/" />
|
||||
</context>
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
<!-- Modified by Rui Santana <santana.rui@gmail.com> -->
|
||||
<!-- v2.0 by Andreas Nordal <andreas.nordal@gmail.com> -->
|
||||
<!-- small priority to allow for example Makefile.cpp to be detected as cpp file -->
|
||||
<!-- v2.1 by Alex Turbov <i.zaufi@gmail.com>
|
||||
improve comments handling -->
|
||||
<language name="Makefile" section="Other"
|
||||
version="2.0" kateversion="2.4"
|
||||
version="2.1" kateversion="3.4"
|
||||
extensions="GNUmakefile;Makefile;makefile;GNUmakefile.*;Makefile.*;makefile.*;*.mk"
|
||||
mimetype="text/x-makefile"
|
||||
author="Per Wigren (wigren@home.se)" license="">
|
||||
@@ -64,7 +66,7 @@
|
||||
<contexts>
|
||||
<context name="normal" attribute="Normal" lineEndContext="#stay">
|
||||
<DetectSpaces/>
|
||||
<RegExpr attribute="Comment" context="#stay" String="#.*$"/>
|
||||
<DetectChar attribute="Comment" context="Comment" char="#"/>
|
||||
<keyword attribute="Keyword" context="#stay" String="keywords"/>
|
||||
<RegExpr attribute="Variable" context="assign" String="[^\s:+?]*\s*(?=:=|=|\+=|\?=)"/>
|
||||
<RegExpr attribute="Section" context="prereq" String="^\.[^.][^:]*:"/>
|
||||
@@ -85,7 +87,7 @@
|
||||
<DetectChar attribute="Operator" context="dollar" char="$"/>
|
||||
<Detect2Chars attribute="Special" context="#stay" char="\" char1="#"/>
|
||||
<Detect2Chars attribute="Special" context="#stay" char="\" char1="\"/>
|
||||
<RegExpr attribute="Comment" context="#stay" String="#.*$"/>
|
||||
<DetectChar attribute="Comment" context="Comment" char="#"/>
|
||||
</context>
|
||||
|
||||
<context name="rule" attribute="Normal" lineEndContext="#stay">
|
||||
@@ -102,7 +104,7 @@
|
||||
<Detect2Chars attribute="Special" context="#stay" char="\" char1="#"/>
|
||||
<Detect2Chars attribute="Special" context="#stay" char="\" char1="\"/>
|
||||
<AnyChar attribute="Operator" context="silent" String="@-" firstNonSpace="1"/>
|
||||
<RegExpr attribute="Comment" context="#stay" String="#.*$"/>
|
||||
<DetectChar attribute="Comment" context="Comment" char="#"/>
|
||||
</context>
|
||||
|
||||
<context name="silent" attribute="Silent" lineEndContext="#pop">
|
||||
@@ -114,7 +116,7 @@
|
||||
<DetectChar attribute="Operator" context="dollar" char="$"/>
|
||||
<Detect2Chars attribute="Special" context="#stay" char="\" char1="#"/>
|
||||
<Detect2Chars attribute="Special" context="#stay" char="\" char1="\"/>
|
||||
<RegExpr attribute="Comment" context="#stay" String="#.*$"/>
|
||||
<DetectChar attribute="Comment" context="Comment" char="#"/>
|
||||
</context>
|
||||
|
||||
<context name="string"" attribute="String" lineEndContext="#pop">
|
||||
@@ -182,6 +184,12 @@
|
||||
<DetectChar attribute="String" context="string'" char="'"/>
|
||||
</context>
|
||||
|
||||
<context attribute="Comment" lineEndContext="#pop" name="Comment">
|
||||
<LineContinue attribute="Comment" context="#stay" />
|
||||
<IncludeRules context="##Alerts" />
|
||||
<IncludeRules context="##Modelines" />
|
||||
</context>
|
||||
|
||||
</contexts>
|
||||
<itemDatas>
|
||||
<itemData name="Normal" defStyleNum="dsNormal" spellChecking="0"/>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
Enhance tr/// and y/// support.
|
||||
-->
|
||||
<language name="Perl" version="1.29" kateversion="2.4" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPL">
|
||||
<language name="Perl" version="1.31" kateversion="2.4" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPL">
|
||||
<highlighting>
|
||||
<list name="keywords">
|
||||
<item> if </item>
|
||||
@@ -346,7 +346,7 @@
|
||||
<keyword attribute="Operator" context="#stay" String="operators" />
|
||||
<keyword attribute="Function" context="#stay" String="functions" />
|
||||
<keyword attribute="Pragma" context="#stay" String="pragmas" />
|
||||
<RegExpr attribute="Pod" context="pod" String="\=(?:head[1-6]|over|back|item|for|begin|end|pod)(\s|$)" column="0" beginRegion="POD"/>
|
||||
<RegExpr attribute="Pod" context="pod" String="\=\w+(\s|$)" column="0" beginRegion="POD"/>
|
||||
<DetectSpaces />
|
||||
<DetectChar attribute="Comment" context="comment" char="#" />
|
||||
|
||||
@@ -620,14 +620,14 @@
|
||||
</context>
|
||||
|
||||
<!-- rules internal stuff wrt regex patterns -->
|
||||
<context name="regex_pattern_internal_rules_1" lineEndContext="#stay">
|
||||
<context name="regex_pattern_internal_rules_1" attribute="Pattern" lineEndContext="#stay">
|
||||
<RegExpr attribute="Comment" context="#stay" String="#.*$" firstNonSpace="true" />
|
||||
<RegExpr attribute="Pattern Character Class" context="#stay" String="\\[anDdSsWw]" />
|
||||
<RegExpr attribute="Pattern Internal Operator" context="#stay" String="\\[ABbEGLlNUuQdQZz]" />
|
||||
<RegExpr attribute="Special Variable" context="#stay" String="\\[\d]+" />
|
||||
<RegExpr attribute="Pattern" context="#stay" String="\\." />
|
||||
</context>
|
||||
<context name="regex_pattern_internal_rules_2" lineEndContext="#stay">
|
||||
<context name="regex_pattern_internal_rules_2" attribute="Pattern" lineEndContext="#stay">
|
||||
<Detect2Chars attribute="Pattern Internal Operator" context="pat_ext" char="(" char1="?" />
|
||||
<DetectChar attribute="Pattern Internal Operator" context="pat_char_class" char="[" />
|
||||
<RegExpr attribute="Pattern Internal Operator" context="#stay" String="[()?^*+|]" />
|
||||
@@ -745,7 +745,7 @@
|
||||
</context>
|
||||
<context name="here_document" attribute="String (interpolated)" lineEndContext="#stay" dynamic="true">
|
||||
<DetectSpaces />
|
||||
<RegExpr attribute="Keyword" context="#pop#pop" String="%1" column="0" dynamic="true" endRegion="HereDocument"/>
|
||||
<RegExpr attribute="Keyword" context="#pop#pop" String="^%1\b" column="0" dynamic="true" endRegion="HereDocument"/>
|
||||
<RegExpr attribute="Keyword" context="here_document" String="\=\s*<<\s*["']?([A-Z0-9_\-]+)["']?" beginRegion="HEREDoc" />
|
||||
<IncludeRules context="ipstring_internal" />
|
||||
</context>
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
|
||||
<!-- Hold the "language" opening tag on a single line, as mentioned in "language.dtd". -->
|
||||
<language name="Ruby" section="Scripts"
|
||||
version="1.27" kateversion="2.4"
|
||||
extensions="*.rb;*.rjs;*.rxml;*.xml.erb;*.js.erb;*.rake;Rakefile;Gemfile;*.gemspec"
|
||||
version="1.28" kateversion="3.3"
|
||||
extensions="*.rb;*.rjs;*.rxml;*.xml.erb;*.js.erb;*.rake;Rakefile;Gemfile;*.gemspec;Vagrantfile"
|
||||
mimetype="application/x-ruby"
|
||||
style="ruby" indenter="ruby"
|
||||
author="Stefan Lang (langstefan@gmx.at), Sebastian Vuorinen (sebastian.vuorinen@helsinki.fi), Robin Pedersen (robinpeder@gmail.com), Miquel Sabaté (mikisabate@gmail.com)" license="LGPL">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE language SYSTEM "language.dtd">
|
||||
<language name="Valgrind Suppression" section="Other" extensions="*.supp;" mimetype="" version="1.0" kateversion="2.0" author="Milian Wolff (mail@milianw.de)" license="LGPL">
|
||||
<language name="Valgrind Suppression" section="Other" extensions="*.supp;" mimetype="" version="1.0" kateversion="2.4" author="Milian Wolff (mail@milianw.de)" license="LGPL">
|
||||
<highlighting>
|
||||
<contexts>
|
||||
<context name="File" attribute="Normal Text" lineEndContext="#stay">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!ENTITY name "(?![0-9])[\w_:][\w.:_-]*">
|
||||
<!ENTITY entref "&(#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
|
||||
]>
|
||||
<language name="XML" version="2.03" kateversion="2.4" section="Markup" extensions="*.docbook;*.xml;*.rc;*.daml;*.rdf;*.rss;*.xspf;*.xsd;*.svg;*.ui;*.kcfg;*.qrc;*.wsdl" mimetype="text/xml;text/book;text/daml;text/rdf;application/rss+xml;application/xspf+xml;image/svg+xml;application/x-designer;application/xml" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
|
||||
<language name="XML" version="2.03" kateversion="3.4" section="Markup" extensions="*.docbook;*.xml;*.rc;*.daml;*.rdf;*.rss;*.xspf;*.xsd;*.svg;*.ui;*.kcfg;*.qrc;*.wsdl" mimetype="text/xml;text/book;text/daml;text/rdf;application/rss+xml;application/xspf+xml;image/svg+xml;application/x-designer;application/xml" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
|
||||
|
||||
<highlighting>
|
||||
<contexts>
|
||||
|
||||
@@ -25,7 +25,7 @@ This code is released under the LGPL as part of kdelibs/kate.
|
||||
|
||||
========================================================================
|
||||
-->
|
||||
<language name="Yacc/Bison" version="1.03" kateversion="2.4" section="Sources" extensions="*.y;*.yy" author="Jan Villat (jan.villat@net2000.ch)" license="LGPL">
|
||||
<language name="Yacc/Bison" version="1.04" kateversion="2.4" section="Sources" extensions="*.y;*.yy" author="Jan Villat (jan.villat@net2000.ch)" license="LGPL">
|
||||
|
||||
<highlighting>
|
||||
<contexts>
|
||||
@@ -100,7 +100,7 @@ This code is released under the LGPL as part of kdelibs/kate.
|
||||
<DetectChar attribute="Data Type" context="#pop" char=">" />
|
||||
</context>
|
||||
|
||||
<context name="Comment" attribute="Comment">
|
||||
<context name="Comment" attribute="Comment" lineEndContext="#stay">
|
||||
<Detect2Chars attribute="Comment" context="CommentStar" char="/" char1="*" />
|
||||
<!-- not sure that strict yacc allows that ... but I saw it in some sources ... -->
|
||||
<Detect2Chars attribute="Comment" context="CommentSlash" char="/" char1="/" />
|
||||
@@ -112,7 +112,7 @@ This code is released under the LGPL as part of kdelibs/kate.
|
||||
<RegExpr attribute="Comment" context="#pop" String="[^\\]$" />
|
||||
</context>
|
||||
|
||||
<context name="StringOrChar" attribute="NormalText">
|
||||
<context name="StringOrChar" attribute="NormalText" lineEndContext="#stay">
|
||||
<DetectChar attribute="String Char" context="Char" char="'" />
|
||||
<DetectChar attribute="String" context="String" char=""" />
|
||||
</context>
|
||||
@@ -131,10 +131,10 @@ This code is released under the LGPL as part of kdelibs/kate.
|
||||
<IncludeRules context="##C++" />
|
||||
<DetectChar attribute="Directive" context="Dol" char="$" />
|
||||
</context>
|
||||
<context name="Dol" attribute="Normal Text" fallthrough="true" fallthroughContext="DolEnd">
|
||||
<context name="Dol" attribute="Normal Text" fallthrough="true" fallthroughContext="DolEnd" lineEndContext="#stay">
|
||||
<RegExpr attribute="Data Type" context="DolEnd" String="<[^>]+>" />
|
||||
</context>
|
||||
<context name="DolEnd" attribute="Normal Text">
|
||||
<context name="DolEnd" attribute="Normal Text" lineEndContext="#stay">
|
||||
<RegExpr attribute="Directive" context="#pop#pop" String="\d+" />
|
||||
<DetectChar attribute="Directive" context="#pop#pop" char="$" />
|
||||
</context>
|
||||
|
||||
@@ -42,8 +42,7 @@
|
||||
namespace QmlDesigner {
|
||||
|
||||
Qt5NodeInstanceServer::Qt5NodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient)
|
||||
: NodeInstanceServer(nodeInstanceClient),
|
||||
m_designerSupport(new DesignerSupport)
|
||||
: NodeInstanceServer(nodeInstanceClient)
|
||||
{
|
||||
DesignerSupport::activateDesignerMode();
|
||||
}
|
||||
@@ -51,8 +50,6 @@ Qt5NodeInstanceServer::Qt5NodeInstanceServer(NodeInstanceClientInterface *nodeIn
|
||||
Qt5NodeInstanceServer::~Qt5NodeInstanceServer()
|
||||
{
|
||||
delete quickView();
|
||||
delete m_designerSupport;
|
||||
m_designerSupport = 0;
|
||||
}
|
||||
|
||||
QQuickView *Qt5NodeInstanceServer::quickView() const
|
||||
@@ -128,21 +125,18 @@ void Qt5NodeInstanceServer::refreshBindings()
|
||||
DesignerSupport::refreshExpressions(context());
|
||||
}
|
||||
|
||||
DesignerSupport *Qt5NodeInstanceServer::designerSupport() const
|
||||
DesignerSupport *Qt5NodeInstanceServer::designerSupport()
|
||||
{
|
||||
return m_designerSupport;
|
||||
return &m_designerSupport;
|
||||
}
|
||||
|
||||
void Qt5NodeInstanceServer::createScene(const CreateSceneCommand &command)
|
||||
{
|
||||
m_designerSupport = new DesignerSupport;
|
||||
NodeInstanceServer::createScene(command);
|
||||
}
|
||||
|
||||
void Qt5NodeInstanceServer::clearScene(const ClearSceneCommand &command)
|
||||
{
|
||||
delete m_designerSupport;
|
||||
m_designerSupport = 0;
|
||||
NodeInstanceServer::clearScene(command);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "nodeinstanceserver.h"
|
||||
#include "designersupport.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QQuickItem;
|
||||
class DesignerSupport;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace QmlDesigner {
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
QQmlEngine *engine() const Q_DECL_OVERRIDE;
|
||||
void refreshBindings() Q_DECL_OVERRIDE;
|
||||
|
||||
DesignerSupport *designerSupport() const;
|
||||
DesignerSupport *designerSupport();
|
||||
|
||||
void createScene(const CreateSceneCommand &command) Q_DECL_OVERRIDE;
|
||||
void clearScene(const ClearSceneCommand &command) Q_DECL_OVERRIDE;
|
||||
@@ -69,7 +69,7 @@ protected:
|
||||
|
||||
private:
|
||||
QPointer<QQuickView> m_quickView;
|
||||
DesignerSupport *m_designerSupport;
|
||||
DesignerSupport m_designerSupport;
|
||||
};
|
||||
|
||||
} // QmlDesigner
|
||||
|
||||
@@ -1,31 +1,18 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick 2.3
|
||||
|
||||
Item {
|
||||
width: 640
|
||||
height: 480
|
||||
Rectangle {
|
||||
property alias mouseArea: mouseArea
|
||||
|
||||
property alias button3: button3
|
||||
property alias button2: button2
|
||||
property alias button1: button1
|
||||
width: 360
|
||||
height: 360
|
||||
|
||||
RowLayout {
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
|
||||
Button {
|
||||
id: button1
|
||||
text: qsTr("Press Me 1")
|
||||
}
|
||||
|
||||
Button {
|
||||
id: button2
|
||||
text: qsTr("Press Me 2")
|
||||
}
|
||||
|
||||
Button {
|
||||
id: button3
|
||||
text: qsTr("Press Me 3")
|
||||
}
|
||||
text: "Hello World"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,8 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQuick.Window 2.2
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
ApplicationWindow {
|
||||
title: qsTr("Hello World")
|
||||
width: 640
|
||||
height: 480
|
||||
|
||||
menuBar: MenuBar {
|
||||
Menu {
|
||||
title: qsTr("&File")
|
||||
MenuItem {
|
||||
text: qsTr("&Open")
|
||||
onTriggered: messageDialog.show(qsTr("Open action triggered"))
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("E&xit")
|
||||
onTriggered: Qt.quit();
|
||||
}
|
||||
}
|
||||
MainForm {
|
||||
mouseArea.onClicked: {
|
||||
Qt.quit();
|
||||
}
|
||||
|
||||
MainForm {
|
||||
anchors.fill: parent
|
||||
button1.onClicked: messageDialog.show(qsTr("Button 1 pressed"))
|
||||
button2.onClicked: messageDialog.show(qsTr("Button 2 pressed"))
|
||||
button3.onClicked: messageDialog.show(qsTr("Button 3 pressed"))
|
||||
}
|
||||
|
||||
MessageDialog {
|
||||
id: messageDialog
|
||||
title: qsTr("May I have your attention please")
|
||||
|
||||
function show(caption) {
|
||||
messageDialog.text = caption;
|
||||
messageDialog.open();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<template openeditor="main.qml" priority="AX"
|
||||
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.Controls.1.3 QtSupport.Wizards.FeatureQtQuick.UiFiles">
|
||||
<displayname>Qt Quick Controls using .ui.qml files</displayname>
|
||||
<description>Creates a Qt Quick 2 UI project that contains a ui file and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.4 or newer.</description>
|
||||
<template openeditor="main.qml" priority="BV"
|
||||
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.UiFiles">
|
||||
<displayname>Qt Quick 2.4</displayname>
|
||||
<description>Creates a Qt Quick 2 UI project that contains a .ui.qml file. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. Requires Qt 5.4 or newer.</description>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
Item {
|
||||
width: 640
|
||||
height: 480
|
||||
|
||||
property alias button3: button3
|
||||
property alias button2: button2
|
||||
property alias button1: button1
|
||||
|
||||
RowLayout {
|
||||
anchors.centerIn: parent
|
||||
|
||||
Button {
|
||||
id: button1
|
||||
text: qsTr("Press Me 1")
|
||||
}
|
||||
|
||||
Button {
|
||||
id: button2
|
||||
text: qsTr("Press Me 2")
|
||||
}
|
||||
|
||||
Button {
|
||||
id: button3
|
||||
text: qsTr("Press Me 3")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQuick.Window 2.2
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
ApplicationWindow {
|
||||
title: qsTr("Hello World")
|
||||
@@ -9,21 +10,32 @@ ApplicationWindow {
|
||||
|
||||
menuBar: MenuBar {
|
||||
Menu {
|
||||
title: qsTr("File")
|
||||
title: qsTr("&File")
|
||||
MenuItem {
|
||||
text: qsTr("&Open")
|
||||
onTriggered: console.log("Open action triggered");
|
||||
onTriggered: messageDialog.show(qsTr("Open action triggered"));
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Exit")
|
||||
text: qsTr("E&xit")
|
||||
onTriggered: Qt.quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Hello World")
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
MainForm {
|
||||
anchors.fill: parent
|
||||
button1.onClicked: messageDialog.show(qsTr("Button 1 pressed"))
|
||||
button2.onClicked: messageDialog.show(qsTr("Button 2 pressed"))
|
||||
button3.onClicked: messageDialog.show(qsTr("Button 3 pressed"))
|
||||
}
|
||||
|
||||
MessageDialog {
|
||||
id: messageDialog
|
||||
title: qsTr("May I have your attention, please?")
|
||||
|
||||
function show(caption) {
|
||||
messageDialog.text = caption;
|
||||
messageDialog.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<template openeditor="main.qml" priority="AW"
|
||||
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.Controls.1.3">
|
||||
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.Controls.1.3 QtSupport.Wizards.FeatureQtQuick.UiFiles">
|
||||
<displayname>Qt Quick Controls 1.3</displayname>
|
||||
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.4 or newer.</description>
|
||||
<description>Creates a Qt Quick 2 UI project that contains a .ui.qml file and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.4 or newer.</description>
|
||||
</template>
|
||||
|
||||
43
share/qtcreator/templates/wizards/classes/python/file.py
Normal file
43
share/qtcreator/templates/wizards/classes/python/file.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
@if '%{Imports}'
|
||||
try:
|
||||
@if '%{ImportQtCore}'
|
||||
from PySide import QtCore
|
||||
@endif
|
||||
@if '%{ImportQtWidgets}'
|
||||
from PySide import QtWidgets
|
||||
@endif
|
||||
@if '%{ImportQtQuick}'
|
||||
from PySide import QtQuick
|
||||
@endif
|
||||
except:
|
||||
@if '%{ImportQtCore}'
|
||||
from PyQt5.QtCore import pyqtSlot as Slot
|
||||
from PyQt5 import QtCore
|
||||
@endif
|
||||
@if '%{ImportQtWidgets}'
|
||||
from PyQt5 import QtWidgets
|
||||
@endif
|
||||
@if '%{ImportQtQuick}'
|
||||
from PyQt5 import QtQuick
|
||||
@endif
|
||||
|
||||
|
||||
@endif
|
||||
@if '%{Base}'
|
||||
class %{Class}(%{Base}):
|
||||
@else
|
||||
class %{Class}:
|
||||
@endif
|
||||
def __init__(self):
|
||||
@if '%{Base}' === 'QWidget'
|
||||
QtWidgets.QWidget.__init__(self)
|
||||
@endif
|
||||
@if '%{Base}' === 'QMainWindow'
|
||||
QtWidgets.QMainWindow.__init__(self)
|
||||
@if '%{Base}' === 'QQuickItem'
|
||||
QtQuick.QQuickItem.__init__(self)
|
||||
@endif
|
||||
pass
|
||||
|
||||
139
share/qtcreator/templates/wizards/classes/python/wizard.json
Normal file
139
share/qtcreator/templates/wizards/classes/python/wizard.json
Normal file
@@ -0,0 +1,139 @@
|
||||
{
|
||||
"version": 1,
|
||||
"kind": "class",
|
||||
"id": "P.PyClass",
|
||||
"category": "U.Python",
|
||||
"trDescription": "Creates new Python class file.",
|
||||
"trDisplayName": "Python Class",
|
||||
"trDisplayCategory": "Python",
|
||||
"icon": "../../global/genericfilewizard.png",
|
||||
"featuresRequired": [ "Plugin.PythonEditor" ],
|
||||
|
||||
"options":
|
||||
[
|
||||
{ "key": "Base", "value":"%{JS: ( '%{BaseCB}' === '' ) ? '%{BaseEdit}' : '%{BaseCB}'}" },
|
||||
{ "key": "Imports", "value": "%{ImportQtCore}%{ImportQtWidgets}%{ImportQtDeclarative}"}
|
||||
],
|
||||
|
||||
"pages":
|
||||
[
|
||||
{
|
||||
"trDisplayName": "Define Class",
|
||||
"trShortTitle": "Details",
|
||||
"typeId": "Fields",
|
||||
"data" :
|
||||
[
|
||||
{
|
||||
"name": "Class",
|
||||
"trDisplayName": "Class name:",
|
||||
"mandatory": true,
|
||||
"type": "LineEdit",
|
||||
"data": { "validator": "^(?:[^\\d\\W]\\w*|)$" }
|
||||
},
|
||||
{
|
||||
"name": "BaseCB",
|
||||
"trDisplayName": "Base class:",
|
||||
"type": "ComboBox",
|
||||
"data":
|
||||
{
|
||||
"items": [ { "trKey": "<Custom>", "value": "" },
|
||||
"QObject", "QWidget", "QMainWindow", "QDeclarativeItem" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "BaseEdit",
|
||||
"type": "LineEdit",
|
||||
"enabled": "%{JS: ( '%{BaseCB}' === '' ) ? 'yes' : ''}",
|
||||
"mandatory": false,
|
||||
"data": { "trText": "%{BaseCB}" }
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"name": "Sp1",
|
||||
"type": "Spacer",
|
||||
"data": { "size": 6 }
|
||||
},
|
||||
{
|
||||
"name": "ImportQtCore",
|
||||
"trDisplayName": "Import QtCore",
|
||||
"type": "CheckBox",
|
||||
"data":
|
||||
{
|
||||
"checkedValue": "QtCore",
|
||||
"uncheckedValue": "",
|
||||
"checked": "%{JS: ('%{Base}' !== '' ) ? 'yes' : ''}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ImportQWidget",
|
||||
"trDisplayName": "Import QtWidgets",
|
||||
"type": "CheckBox",
|
||||
"data":
|
||||
{
|
||||
"checkedValue": "QtWidgets",
|
||||
"uncheckedValue": "",
|
||||
"checked": "%{JS: ('%{Base}' === 'QWidget') ? 'yes' : ''}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ImportQtQuick",
|
||||
"trDisplayName": "Import QtQuick",
|
||||
"type": "CheckBox",
|
||||
"data":
|
||||
{
|
||||
"checkedValue": "QtQuick",
|
||||
"uncheckedValue": "",
|
||||
"checked": "%{JS: ('%{Base}' === 'QQuickItem') ? 'yes' : ''}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Sp2",
|
||||
"type": "Spacer",
|
||||
"data": { "size": 12 }
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"name": "FileName",
|
||||
"type": "LineEdit",
|
||||
"trDisplayName": "Source file:",
|
||||
"mandatory": true,
|
||||
"data": { "trText": "%{JS: Util.fileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-python')}')}" }
|
||||
},
|
||||
{
|
||||
"name": "TargetPath",
|
||||
"type": "PathChooser",
|
||||
"trDisplayName": "Path:",
|
||||
"mandatory": true,
|
||||
"data":
|
||||
{
|
||||
"kind": "existingDirectory",
|
||||
"basePath": "%{InitialPath}",
|
||||
"path": "%{InitialPath}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"trDisplayName": "Project Management",
|
||||
"shortTitle": "Summary",
|
||||
"typeId": "Summary"
|
||||
}
|
||||
],
|
||||
|
||||
"generators":
|
||||
[
|
||||
{
|
||||
"typeId": "File",
|
||||
"data":
|
||||
{
|
||||
"source": "file.py",
|
||||
"target": "%{FileName}",
|
||||
"openInEditor": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import QtQuick 2.4
|
||||
|
||||
%{FormClass} {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import QtQuick 2.4
|
||||
|
||||
Item {
|
||||
width: 400
|
||||
height: 400
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"version": 1,
|
||||
"kind": "file",
|
||||
"id": "R.QtQuickUi",
|
||||
"category": "R.Qt",
|
||||
"trDescription": "Creates a QML file with boilerplate code, starting with \"import QtQuick 2.4\".",
|
||||
"trDisplayName": "QtQuick UI File",
|
||||
"trDisplayCategory": "Qt",
|
||||
"icon": "../../global/genericfilewizard.png",
|
||||
"featuresRequired": [ "Plugin.QmlJSEditor", "QtSupport.Wizards.FeatureQtQuick.UiFiles" ],
|
||||
|
||||
"options" : [
|
||||
{ "key": "QmlFile", "value": "%{Class}.%{JS: Util.preferredSuffix('application/x-qml')}" },
|
||||
{ "key": "UiFile", "value": "%{FormClass}.%{JS: Util.preferredSuffix('application/x-qt.ui+qml')}" }
|
||||
],
|
||||
|
||||
"pages" :
|
||||
[
|
||||
{
|
||||
"trDisplayName": "Define Class",
|
||||
"trShortTitle": "Details",
|
||||
"typeId": "Fields",
|
||||
"data" :
|
||||
[
|
||||
{
|
||||
"name": "Class",
|
||||
"trDisplayName": "Class name:",
|
||||
"mandatory": true,
|
||||
"type": "LineEdit",
|
||||
"data": { "validator": "(?:[A-Z_][a-zA-Z_0-9]*|)" }
|
||||
},
|
||||
|
||||
{
|
||||
"name": "Sp1",
|
||||
"type": "Spacer",
|
||||
"data": { "factor": 2 }
|
||||
},
|
||||
{
|
||||
"name": "FormClass",
|
||||
"trDisplayName": "Ui Class name:",
|
||||
"mandatory": true,
|
||||
"type": "LineEdit",
|
||||
"data": {
|
||||
"validator": "(?:[A-Z_][a-zA-Z_0-9]*|)",
|
||||
"trText": "%{Class}Form"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "TargetPath",
|
||||
"type": "PathChooser",
|
||||
"trDisplayName": "Path:",
|
||||
"mandatory": true,
|
||||
"data":
|
||||
{
|
||||
"kind": "existingDirectory",
|
||||
"basePath": "%{InitialPath}",
|
||||
"path": "%{InitialPath}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"trDisplayName": "Project Management",
|
||||
"trShortTitle": "Summary",
|
||||
"typeId": "Summary"
|
||||
}
|
||||
],
|
||||
"generators" :
|
||||
[
|
||||
{
|
||||
"typeId": "File",
|
||||
"data": [
|
||||
{
|
||||
"source": "file.qml.tpl",
|
||||
"target": "%{TargetPath}/%{QmlFile}",
|
||||
"openInEditor": true
|
||||
},
|
||||
{
|
||||
"source": "fileForm.ui.qml.tpl",
|
||||
"target": "%{TargetPath}/%{UiFile}",
|
||||
"openInEditor": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
1
share/qtcreator/templates/wizards/files/form/file.ui
Normal file
1
share/qtcreator/templates/wizards/files/form/file.ui
Normal file
@@ -0,0 +1 @@
|
||||
%{FormContents}\
|
||||
49
share/qtcreator/templates/wizards/files/form/wizard.json
Normal file
49
share/qtcreator/templates/wizards/files/form/wizard.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"version": 1,
|
||||
"kind": "file",
|
||||
"id": "D.Form",
|
||||
"category": "R.Qt",
|
||||
"trDescription": "Creates a Qt Designer form that you can add to a Qt Widget Project. This is useful if you already have an existing class for the UI business logic.",
|
||||
"trDisplayName": "Qt Designer Form",
|
||||
"trDisplayCategory": "Qt",
|
||||
"icon": "../../global/genericfilewizard.png",
|
||||
"featuresRequired": [ "Plugin.Designer" ],
|
||||
|
||||
"options": [
|
||||
{ "key": "UiClass", "value": "%{JS: QtSupport.uiClassName('%{FormContents}') }" },
|
||||
{ "key": "Extension", "value": "%{JS: Util.preferredSuffix('application/x-designer')}"},
|
||||
{ "key": "InitialFileName", "value": "%{JS: Cpp.classToFileName('%{UiClass}', '%{Extension}') }" }
|
||||
],
|
||||
|
||||
"pages":
|
||||
[
|
||||
{
|
||||
"trDisplayName": "Choose a Form Template",
|
||||
"trShortTitle": "Form Template",
|
||||
"typeId": "Form"
|
||||
},
|
||||
{
|
||||
"trDisplayName": "Location",
|
||||
"trShortTitle": "Location",
|
||||
"typeId": "File"
|
||||
},
|
||||
{
|
||||
"trDisplayName": "Project Management",
|
||||
"trShortTitle": "Summary",
|
||||
"typeId": "Summary"
|
||||
}
|
||||
],
|
||||
|
||||
"generators":
|
||||
[
|
||||
{
|
||||
"typeId": "File",
|
||||
"data":
|
||||
{
|
||||
"source": "file.ui",
|
||||
"target": "%{JS: Cpp.fileName('%{TargetPath}', '%{Extension}')}",
|
||||
"openInEditor": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -123,7 +123,7 @@ if ($optDryRun) {
|
||||
|
||||
my $projectFile = new IO::File('>' . $projectFileName) or die ('Unable to open ' . $projectFileName . ' :' . $!);
|
||||
print $projectFile "TEMPLATE = app\nQT -= core\nCONFIG += console\nTARGET = ", $optProjectName,
|
||||
"\nSOURCES += ", $sourceFileName, ' ',$headerFileName, ' ', $mainSourceFileName,
|
||||
"\nSOURCES += ", $sourceFileName, ' ', $mainSourceFileName,
|
||||
"\nHEADERS += ", $headerFileName,"\n";
|
||||
$projectFile->close();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,8 @@ OutputPaneToggleButtonTextColorChecked=text
|
||||
OutputPaneToggleButtonTextColorUnchecked=text
|
||||
PanelButtonToolBackgroundColorHover=hoverBackground
|
||||
PanelStatusBarBackgroundColor=shadowBackground
|
||||
PanelTextColor=text
|
||||
PanelTextColorLight=text
|
||||
PanelTextColorDark=text
|
||||
PanelsWidgetSeparatorLineColor=0
|
||||
ProgressBarColorError=error
|
||||
ProgressBarColorFinished=ff5aaa3c
|
||||
@@ -92,7 +93,8 @@ Welcome_Link_TextColorActive=fff0f0f0
|
||||
Welcome_Link_TextColorNormal=text
|
||||
Welcome_ProjectItem_BackgroundColorHover=0
|
||||
Welcome_ProjectItem_TextColorFilepath=textDisabled
|
||||
Welcome_SessionItemExpanded_BackgroundColor=selectedBackground
|
||||
Welcome_SessionItemExpanded_BackgroundColorHover=hoverBackground
|
||||
Welcome_SessionItemExpanded_BackgroundColorNormal=selectedBackground
|
||||
Welcome_SessionItem_BackgroundColorHover=hoverBackground
|
||||
Welcome_SessionItem_BackgroundColorNormal=0
|
||||
Welcome_SideBar_BackgroundColor=ff434343
|
||||
@@ -112,18 +114,15 @@ DetailsWidgetHeaderGradient\1\color=0
|
||||
DetailsWidgetHeaderGradient\1\pos=1
|
||||
DetailsWidgetHeaderGradient\size=1
|
||||
|
||||
[IconOverlay]
|
||||
CSourceMimetype=:/cppeditor/images/dark_qt_c.png
|
||||
CppHeaderMimetype=:/cppeditor/images/dark_qt_h.png
|
||||
CppSourceMimetype=:/cppeditor/images/dark_qt_cpp.png
|
||||
PrfMimetype=:/qtsupport/images/dark_qt_project.png
|
||||
PriMimetype=:/qtsupport/images/dark_qt_project.png
|
||||
ProMimetype=:/qtsupport/images/dark_qt_project.png
|
||||
|
||||
#TODO: needs to be ported to new ini format!
|
||||
[StandardIcons]
|
||||
SP_FileIcon=:/core/images/dark_fileicon.png
|
||||
SP_DirIcon=:/core/images/dark_foldericon.png
|
||||
[ImageFiles]
|
||||
IconOverlayCSource=:/cppeditor/images/dark_qt_c.png
|
||||
IconOverlayCppHeader=:/cppeditor/images/dark_qt_h.png
|
||||
IconOverlayCppSource=:/cppeditor/images/dark_qt_cpp.png
|
||||
IconOverlayPrf=:/qtsupport/images/dark_qt_project.png
|
||||
IconOverlayPri=:/qtsupport/images/dark_qt_project.png
|
||||
IconOverlayPro=:/qtsupport/images/dark_qt_project.png
|
||||
StandardPixmapFileIcon=:/core/images/dark_fileicon.png
|
||||
StandardPixmapDirIcon=:/core/images/dark_foldericon.png
|
||||
|
||||
[Style]
|
||||
WidgetStyle=StyleFlat
|
||||
|
||||
@@ -26,7 +26,7 @@ DoubleTabWidget1stEmptyAreaBackgroundColor=ffff0000
|
||||
DoubleTabWidget1stSeparatorColor=ffff0000
|
||||
DoubleTabWidget1stTabActiveTextColor=ff000000
|
||||
DoubleTabWidget1stTabBackgroundColor=ffff0000
|
||||
DoubleTabWidget1stTabInactiveTextColor=ff000000
|
||||
DoubleTabWidget1stTabInactiveTextColor=ffffffff
|
||||
DoubleTabWidget2ndSeparatorColor=ffff0000
|
||||
DoubleTabWidget2ndTabActiveTextColor=ffffffff
|
||||
DoubleTabWidget2ndTabBackgroundColor=ffff0000
|
||||
@@ -56,7 +56,8 @@ OutputFormatter_StdOutTextColor=ff000000
|
||||
OutputPaneButtonFlashColor=ffff0000
|
||||
OutputPaneToggleButtonTextColorChecked=ffffffff
|
||||
OutputPaneToggleButtonTextColorUnchecked=ff000000
|
||||
PanelTextColor=brightText
|
||||
PanelTextColorLight=brightText
|
||||
PanelTextColorDark=darkText
|
||||
PanelButtonToolBackgroundColorHover=25ffffff
|
||||
PanelStatusBarBackgroundColor=ffff0000
|
||||
PanelsWidgetSeparatorLineColor=ffbfbcb8
|
||||
@@ -86,7 +87,8 @@ Welcome_Link_TextColorActive=fff0f0f0
|
||||
Welcome_Link_TextColorNormal=ff328930
|
||||
Welcome_ProjectItem_BackgroundColorHover=fff9f9f9
|
||||
Welcome_ProjectItem_TextColorFilepath=ff6b6b6b
|
||||
Welcome_SessionItemExpanded_BackgroundColor=fff1f1f1
|
||||
Welcome_SessionItemExpanded_BackgroundColorHover=ffe9e9e9
|
||||
Welcome_SessionItemExpanded_BackgroundColorNormal=fff1f1f1
|
||||
Welcome_SessionItem_BackgroundColorHover=fff9f9f9
|
||||
Welcome_SessionItem_BackgroundColorNormal=19f9f9f9
|
||||
Welcome_SideBar_BackgroundColor=ffebebeb
|
||||
@@ -106,13 +108,5 @@ DetailsWidgetHeaderGradient\1\color=ffffff
|
||||
DetailsWidgetHeaderGradient\1\pos=1
|
||||
DetailsWidgetHeaderGradient\size=1
|
||||
|
||||
[IconOverlay]
|
||||
CSourceMimetype=:/cppeditor/images/qt_c.png
|
||||
CppHeaderMimetype=:/cppeditor/images/qt_h.png
|
||||
CppSourceMimetype=:/cppeditor/images/qt_cpp.png
|
||||
PrfMimetype=:/qtsupport/images/qt_project.png
|
||||
PriMimetype=:/qtsupport/images/qt_project.png
|
||||
ProMimetype=:/qtsupport/images/qt_project.png
|
||||
|
||||
[Style]
|
||||
WidgetStyle=StyleDefault
|
||||
|
||||
@@ -66,7 +66,7 @@ Controls.ScrollView {
|
||||
x: 32
|
||||
y: screenDependHeightDistance + 77
|
||||
|
||||
color: creatorTheme.textColorHeading
|
||||
color: creatorTheme.Welcome_TextColorHeading
|
||||
text: qsTr("Sessions")
|
||||
font.pixelSize: 16
|
||||
font.family: "Helvetica"
|
||||
@@ -78,7 +78,7 @@ Controls.ScrollView {
|
||||
x: 406
|
||||
|
||||
y: screenDependHeightDistance + 77
|
||||
color: creatorTheme.textColorHeading
|
||||
color: creatorTheme.Welcome_TextColorHeading
|
||||
text: qsTr("Recent Projects")
|
||||
anchors.left: sessionsTitle.right
|
||||
anchors.leftMargin: 280
|
||||
|
||||
@@ -47,7 +47,7 @@ Item {
|
||||
|
||||
Rectangle {
|
||||
id: splitter
|
||||
color: creatorTheme.dividerColor; // divider between left and right pane
|
||||
color: creatorTheme.Welcome_DividerColor; // divider between left and right pane
|
||||
width: 1
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
@@ -61,60 +61,60 @@ Button {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
antialiasing: true
|
||||
radius: (creatorTheme.widgetStyle === 'flat') ? 0 : 3
|
||||
radius: (creatorTheme.WidgetStyle === 'StyleFlat') ? 0 : 3
|
||||
|
||||
visible: !(button.pressed || button.checked)
|
||||
|
||||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0
|
||||
color: (theme==='dark') ? "#232323" : "#f9f9f9"
|
||||
color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#232323" : "#f9f9f9"
|
||||
}
|
||||
|
||||
GradientStop {
|
||||
position: 0.49
|
||||
color: (theme === 'dark') ? "#232323" : "#f9f9f9"
|
||||
color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#232323" : "#f9f9f9"
|
||||
}
|
||||
|
||||
GradientStop {
|
||||
position: 0.5
|
||||
color: (theme === 'dark') ? "#232323" : "#eeeeee"
|
||||
color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#232323" : "#eeeeee"
|
||||
}
|
||||
|
||||
GradientStop {
|
||||
position: 1
|
||||
color: (theme === 'dark') ? "#232323" : "#eeeeee"
|
||||
color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#232323" : "#eeeeee"
|
||||
}
|
||||
}
|
||||
border.color: creatorTheme.button_BorderColor
|
||||
border.color: creatorTheme.Welcome_Button_BorderColor
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
antialiasing: true
|
||||
radius: (creatorTheme.widgetStyle === 'flat') ? 0 : 3
|
||||
radius: (creatorTheme.WidgetStyle === 'StyleFlat') ? 0 : 3
|
||||
|
||||
visible: button.pressed || button.checked
|
||||
|
||||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0.00;
|
||||
color: (theme === "dark") ? "#151515" : "#4c4c4c"
|
||||
color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#151515" : "#4c4c4c"
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.49;
|
||||
color: (theme === "dark") ? "#151515" : "#4c4c4c"
|
||||
color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#151515" : "#4c4c4c"
|
||||
}
|
||||
GradientStop {
|
||||
position: 0.50;
|
||||
color: (theme === "dark") ? "#151515" : "#424242"
|
||||
color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#151515" : "#424242"
|
||||
}
|
||||
GradientStop {
|
||||
position: 1.00;
|
||||
color: (theme === "dark") ? "#151515" : "#424242"
|
||||
color: (creatorTheme.WidgetStyle === 'StyleFlat') ? "#151515" : "#424242"
|
||||
}
|
||||
}
|
||||
border.color: creatorTheme.button_BorderColor
|
||||
border.color: creatorTheme.Welcome_Button_BorderColor
|
||||
|
||||
}
|
||||
}
|
||||
@@ -124,8 +124,8 @@ Button {
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: button.text
|
||||
color: button.pressed || button.checked
|
||||
? creatorTheme.button_TextColorPressed
|
||||
: creatorTheme.button_TextColorNormal
|
||||
? creatorTheme.Welcome_Button_TextColorPressed
|
||||
: creatorTheme.Welcome_Button_TextColorNormal
|
||||
font.pixelSize: 15
|
||||
font.bold: false
|
||||
smooth: true
|
||||
|
||||
@@ -34,7 +34,7 @@ Rectangle {
|
||||
id: delegate
|
||||
height: 240
|
||||
width: 216
|
||||
color: creatorTheme.backgroundColorNormal
|
||||
color: creatorTheme.Welcome_BackgroundColorNormal
|
||||
|
||||
property alias caption: captionItem.text
|
||||
property alias imageSource: imageItem.source
|
||||
@@ -107,7 +107,7 @@ Rectangle {
|
||||
y: 161
|
||||
width: 200
|
||||
height: 69
|
||||
color: creatorTheme.backgroundColorNormal
|
||||
color: creatorTheme.Welcome_BackgroundColorNormal
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
@@ -117,7 +117,7 @@ Rectangle {
|
||||
id: captionItem
|
||||
x: 16
|
||||
y: 170
|
||||
color: creatorTheme.caption_TextColorNormal
|
||||
color: creatorTheme.Welcome_Caption_TextColorNormal
|
||||
text: qsTr("2D PAINTING EXAMPLE long description")
|
||||
elide: Text.ElideRight
|
||||
anchors.right: parent.right
|
||||
@@ -164,7 +164,7 @@ Rectangle {
|
||||
x: 16
|
||||
y: 198
|
||||
text: qsTr("Tags:")
|
||||
color: creatorTheme.textColorNormal
|
||||
color: creatorTheme.Welcome_TextColorNormal
|
||||
smooth: true
|
||||
font.italic: false
|
||||
font.pixelSize: 11
|
||||
|
||||
@@ -44,7 +44,7 @@ Row {
|
||||
LinkedText {
|
||||
text: title
|
||||
font.pixelSize: 11
|
||||
color: creatorTheme.textColorNormal // 'Qt Account' .. 'User Guide' on lower left
|
||||
color: creatorTheme.Welcome_TextColorNormal // 'Qt Account' .. 'User Guide' on lower left
|
||||
onClicked: {
|
||||
if (openUrl)
|
||||
gettingStarted.openUrl(openUrl);
|
||||
|
||||
@@ -33,8 +33,8 @@ import QtQuick 2.1
|
||||
NativeText {
|
||||
id: root
|
||||
height: 16
|
||||
color: active ? creatorTheme.link_TextColorActive
|
||||
: creatorTheme.link_TextColorNormal
|
||||
color: active ? creatorTheme.Welcome_Link_TextColorActive
|
||||
: creatorTheme.Welcome_Link_TextColorNormal
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
font: fonts.linkFont
|
||||
|
||||
@@ -37,7 +37,7 @@ Item {
|
||||
|
||||
Rectangle { // background shown on hover over project item
|
||||
anchors.fill: parent
|
||||
color: creatorTheme.projectItem_BackgroundColorHover
|
||||
color: creatorTheme.Welcome_ProjectItem_BackgroundColorHover
|
||||
visible: mouseArea.containsMouse
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ Item {
|
||||
NativeText {
|
||||
id: pathText
|
||||
height: 20
|
||||
color: creatorTheme.projectItem_TextColorFilepath
|
||||
color: creatorTheme.Welcome_ProjectItem_TextColorFilepath
|
||||
font: fonts.smallPath
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import QtQuick.Controls 1.0
|
||||
Rectangle {
|
||||
id: projectList
|
||||
height: column.height + 200
|
||||
color: creatorTheme.backgroundColorNormal
|
||||
color: creatorTheme.Welcome_BackgroundColorNormal
|
||||
|
||||
property alias model: repeater.model
|
||||
// Behavior on verticalScrollBar.opacity {
|
||||
|
||||
@@ -37,7 +37,7 @@ Rectangle {
|
||||
|
||||
width: 930
|
||||
height: 27
|
||||
color: creatorTheme.backgroundColorNormal
|
||||
color: creatorTheme.Welcome_BackgroundColorNormal
|
||||
radius: 6
|
||||
border.color: "#cccccc" // FIXME: make themable
|
||||
|
||||
@@ -56,8 +56,8 @@ Rectangle {
|
||||
font.pixelSize: 14
|
||||
placeholderText: qsTr("Search...")
|
||||
style: TextFieldStyle {
|
||||
placeholderTextColor: creatorTheme.textColorNormal
|
||||
textColor: creatorTheme.textColorNormal
|
||||
placeholderTextColor: creatorTheme.Welcome_TextColorNormal
|
||||
textColor: creatorTheme.Welcome_TextColorNormal
|
||||
background: Item {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,9 +68,7 @@ Item {
|
||||
Rectangle {
|
||||
z: -4
|
||||
// background of session item
|
||||
color: (iArea.hovered || text.hovered || area2.hovered)
|
||||
? creatorTheme.sessionItem_BackgroundColorHover
|
||||
: creatorTheme.sessionItem_BackgroundColorNormal
|
||||
color: creatorTheme.Welcome_SessionItem_BackgroundColorHover
|
||||
anchors.fill: parent
|
||||
visible: iArea.containsMouse || text.hovered
|
||||
anchors.topMargin: 1
|
||||
@@ -118,7 +116,7 @@ Item {
|
||||
NativeText {
|
||||
text: projectsName[index]
|
||||
font: fonts.boldDescription
|
||||
color: creatorTheme.textColorNormal
|
||||
color: creatorTheme.Welcome_TextColorNormal
|
||||
}
|
||||
NativeText {
|
||||
x: 4
|
||||
@@ -143,7 +141,7 @@ Item {
|
||||
maximumLineCount: 2
|
||||
elide: Text.ElideRight
|
||||
height: lineCount == 2 ? font.pixelSize * 2 + 4 : font.pixelSize + 2
|
||||
color: creatorTheme.projectItem_TextColorFilepath
|
||||
color: creatorTheme.Welcome_ProjectItem_TextColorFilepath
|
||||
width: delegate.ListView.view.width - 48
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
@@ -226,8 +224,8 @@ Item {
|
||||
id: collapseButton
|
||||
visible: text.hovered || iArea.containsMouse || delegate.expanded
|
||||
|
||||
property color color: iArea.containsMouse ? creatorTheme.sessionItem_BackgroundColorHover
|
||||
: creatorTheme.sessionItemExpanded_BackgroundColor
|
||||
property color color: iArea.containsMouse ? creatorTheme.Welcome_SessionItemExpanded_BackgroundColorHover
|
||||
: creatorTheme.Welcome_SessionItemExpanded_BackgroundColorNormal
|
||||
|
||||
anchors.fill: parent
|
||||
Image {
|
||||
@@ -243,7 +241,7 @@ Item {
|
||||
Rectangle {
|
||||
color: collapseButton.color
|
||||
z: -1
|
||||
radius: creatorTheme.widgetStyle === 'flat' ? 0 : 6
|
||||
radius: creatorTheme.WidgetStyle === 'StyleFlat' ? 0 : 6
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 1
|
||||
anchors.bottomMargin: 1
|
||||
|
||||
@@ -59,13 +59,13 @@ ColumnLayout {
|
||||
Component {
|
||||
id: flatBackground
|
||||
Rectangle {
|
||||
color: creatorTheme.sideBar_BackgroundColor
|
||||
color: creatorTheme.Welcome_SideBar_BackgroundColor
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
id: topLeftLoader
|
||||
anchors.fill: parent
|
||||
sourceComponent: creatorTheme.widgetStyle === 'flat' ? flatBackground : imageBackground;
|
||||
sourceComponent: creatorTheme.WidgetStyle === 'StyleFlat' ? flatBackground : imageBackground;
|
||||
}
|
||||
|
||||
Tabs {
|
||||
@@ -78,7 +78,8 @@ ColumnLayout {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: creatorTheme.widgetStyle === 'flat' ? creatorTheme.sideBar_BackgroundColor : creatorTheme.dividerColor
|
||||
color: creatorTheme.WidgetStyle === 'StyleFlat' ?
|
||||
creatorTheme.Welcome_SideBar_BackgroundColor : creatorTheme.Welcome_DividerColor
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
@@ -87,7 +88,8 @@ ColumnLayout {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: creatorTheme.widgetStyle === 'flat' ? creatorTheme.sideBar_BackgroundColor : creatorTheme.dividerColor
|
||||
color: creatorTheme.WidgetStyle === 'StyleFlat' ?
|
||||
creatorTheme.Welcome_SideBar_BackgroundColor : creatorTheme.Welcome_DividerColor
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
@@ -97,7 +99,8 @@ ColumnLayout {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: creatorTheme.widgetStyle === 'flat' ? creatorTheme.sideBar_BackgroundColor : creatorTheme.dividerColor
|
||||
color: creatorTheme.WidgetStyle === 'StyleFlat' ?
|
||||
creatorTheme.Welcome_SideBar_BackgroundColor : creatorTheme.Welcome_DividerColor
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
@@ -108,7 +111,7 @@ ColumnLayout {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: creatorTheme.sideBar_BackgroundColor
|
||||
color: creatorTheme.Welcome_SideBar_BackgroundColor
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredWidth: innerColumn.width + 20
|
||||
@@ -129,7 +132,7 @@ ColumnLayout {
|
||||
|
||||
NativeText {
|
||||
text: qsTr("New to Qt?")
|
||||
color: creatorTheme.textColorNormal
|
||||
color: creatorTheme.Welcome_TextColorNormal
|
||||
font.pixelSize: 18
|
||||
}
|
||||
|
||||
@@ -139,7 +142,7 @@ ColumnLayout {
|
||||
Layout.preferredWidth: innerColumn.width
|
||||
|
||||
text: qsTr("Learn how to develop your own applications and explore Qt Creator.")
|
||||
color: creatorTheme.textColorNormal
|
||||
color: creatorTheme.Welcome_TextColorNormal
|
||||
font.pixelSize: 12
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
}
|
||||
|
||||
66
src/libs/3rdparty/cplusplus/Literals.cpp
vendored
66
src/libs/3rdparty/cplusplus/Literals.cpp
vendored
@@ -56,23 +56,7 @@ bool Literal::equalTo(const Literal *other) const
|
||||
return ! std::strcmp(chars(), other->chars());
|
||||
}
|
||||
|
||||
Literal::iterator Literal::begin() const
|
||||
{ return _chars; }
|
||||
|
||||
Literal::iterator Literal::end() const
|
||||
{ return _chars + _size; }
|
||||
|
||||
const char *Literal::chars() const
|
||||
{ return _chars; }
|
||||
|
||||
char Literal::at(unsigned index) const
|
||||
{ return _chars[index]; }
|
||||
|
||||
unsigned Literal::size() const
|
||||
{ return _size; }
|
||||
|
||||
unsigned Literal::hashCode() const
|
||||
{ return _hashCode; }
|
||||
|
||||
unsigned Literal::hashCode(const char *chars, unsigned size)
|
||||
{
|
||||
@@ -95,23 +79,6 @@ unsigned Literal::hashCode(const char *chars, unsigned size)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
StringLiteral::StringLiteral(const char *chars, unsigned size)
|
||||
: Literal(chars, size)
|
||||
{ }
|
||||
|
||||
StringLiteral::~StringLiteral()
|
||||
{ }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
enum {
|
||||
NumericLiteralIsInt,
|
||||
NumericLiteralIsFloat,
|
||||
NumericLiteralIsDouble,
|
||||
NumericLiteralIsLongDouble,
|
||||
NumericLiteralIsLong,
|
||||
NumericLiteralIsLongLong
|
||||
};
|
||||
|
||||
NumericLiteral::NumericLiteral(const char *chars, unsigned size)
|
||||
: Literal(chars, size), _flags(0)
|
||||
{
|
||||
@@ -163,40 +130,7 @@ NumericLiteral::NumericLiteral(const char *chars, unsigned size)
|
||||
}
|
||||
}
|
||||
|
||||
NumericLiteral::~NumericLiteral()
|
||||
{ }
|
||||
|
||||
bool NumericLiteral::isHex() const
|
||||
{ return f._isHex; }
|
||||
|
||||
bool NumericLiteral::isUnsigned() const
|
||||
{ return f._isUnsigned; }
|
||||
|
||||
bool NumericLiteral::isInt() const
|
||||
{ return f._type == NumericLiteralIsInt; }
|
||||
|
||||
bool NumericLiteral::isFloat() const
|
||||
{ return f._type == NumericLiteralIsFloat; }
|
||||
|
||||
bool NumericLiteral::isDouble() const
|
||||
{ return f._type == NumericLiteralIsDouble; }
|
||||
|
||||
bool NumericLiteral::isLongDouble() const
|
||||
{ return f._type == NumericLiteralIsLongDouble; }
|
||||
|
||||
bool NumericLiteral::isLong() const
|
||||
{ return f._type == NumericLiteralIsLong; }
|
||||
|
||||
bool NumericLiteral::isLongLong() const
|
||||
{ return f._type == NumericLiteralIsLongLong; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Identifier::Identifier(const char *chars, unsigned size)
|
||||
: Literal(chars, size)
|
||||
{ }
|
||||
|
||||
Identifier::~Identifier()
|
||||
{ }
|
||||
|
||||
void Identifier::accept0(NameVisitor *visitor) const
|
||||
{ visitor->visit(this); }
|
||||
|
||||
47
src/libs/3rdparty/cplusplus/Literals.h
vendored
47
src/libs/3rdparty/cplusplus/Literals.h
vendored
@@ -40,14 +40,14 @@ public:
|
||||
Literal(const char *chars, unsigned size);
|
||||
virtual ~Literal();
|
||||
|
||||
iterator begin() const;
|
||||
iterator end() const;
|
||||
iterator begin() const { return _chars; }
|
||||
iterator end() const { return _chars + _size; }
|
||||
|
||||
char at(unsigned index) const;
|
||||
const char *chars() const;
|
||||
unsigned size() const;
|
||||
char at(unsigned index) const { return _chars[index]; }
|
||||
const char *chars() const { return _chars; }
|
||||
unsigned size() const { return _size; }
|
||||
|
||||
unsigned hashCode() const;
|
||||
unsigned hashCode() const { return _hashCode; }
|
||||
static unsigned hashCode(const char *chars, unsigned size);
|
||||
|
||||
bool equalTo(const Literal *other) const;
|
||||
@@ -66,25 +66,33 @@ public:
|
||||
class CPLUSPLUS_EXPORT StringLiteral: public Literal
|
||||
{
|
||||
public:
|
||||
StringLiteral(const char *chars, unsigned size);
|
||||
virtual ~StringLiteral();
|
||||
StringLiteral(const char *chars, unsigned size)
|
||||
: Literal(chars, size)
|
||||
{ }
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NumericLiteral: public Literal
|
||||
{
|
||||
public:
|
||||
NumericLiteral(const char *chars, unsigned size);
|
||||
virtual ~NumericLiteral();
|
||||
|
||||
bool isInt() const;
|
||||
bool isFloat() const;
|
||||
bool isDouble() const;
|
||||
bool isLongDouble() const;
|
||||
bool isLong() const;
|
||||
bool isLongLong() const;
|
||||
enum {
|
||||
NumericLiteralIsInt,
|
||||
NumericLiteralIsFloat,
|
||||
NumericLiteralIsDouble,
|
||||
NumericLiteralIsLongDouble,
|
||||
NumericLiteralIsLong,
|
||||
NumericLiteralIsLongLong
|
||||
};
|
||||
|
||||
bool isUnsigned() const;
|
||||
bool isHex() const;
|
||||
bool isInt() const { return f._type == NumericLiteralIsInt; }
|
||||
bool isFloat() const { return f._type == NumericLiteralIsFloat; }
|
||||
bool isDouble() const { return f._type == NumericLiteralIsDouble; }
|
||||
bool isLongDouble() const { return f._type == NumericLiteralIsLongDouble; }
|
||||
bool isLong() const { return f._type == NumericLiteralIsLong; }
|
||||
bool isLongLong() const { return f._type == NumericLiteralIsLongLong; }
|
||||
bool isUnsigned() const { return f._isUnsigned; }
|
||||
bool isHex() const { return f._isHex; }
|
||||
|
||||
private:
|
||||
struct Flags {
|
||||
@@ -101,8 +109,9 @@ private:
|
||||
class CPLUSPLUS_EXPORT Identifier: public Literal, public Name
|
||||
{
|
||||
public:
|
||||
Identifier(const char *chars, unsigned size);
|
||||
virtual ~Identifier();
|
||||
Identifier(const char *chars, unsigned size)
|
||||
: Literal(chars, size)
|
||||
{ }
|
||||
|
||||
virtual const Identifier *identifier() const { return this; }
|
||||
|
||||
|
||||
@@ -12,8 +12,7 @@ SUBDIRS = \
|
||||
qmldebug \
|
||||
qmleditorwidgets \
|
||||
glsl \
|
||||
ssh \
|
||||
zeroconf
|
||||
ssh
|
||||
|
||||
for(l, SUBDIRS) {
|
||||
QTC_LIB_DEPENDS =
|
||||
|
||||
@@ -16,6 +16,5 @@ Project {
|
||||
"utils/process_stub.qbs",
|
||||
"utils/process_ctrlc_stub.qbs",
|
||||
"utils/utils.qbs",
|
||||
"zeroconf/zeroconf.qbs",
|
||||
].concat(project.additionalLibs)
|
||||
}
|
||||
|
||||
@@ -31,12 +31,30 @@ ENV_LIBPATH=$$(LIBPATH)
|
||||
contains(ENV_CPU, ^AMD64$) {
|
||||
DIRNAME=$${BASENAME}64
|
||||
CDB_PLATFORM=amd64
|
||||
|
||||
exists($$CDB_PATH/lib/amd64) {
|
||||
LIBS+= -L$$CDB_PATH/lib/amd64 -ldbgeng
|
||||
} else {
|
||||
LIBS+= -L$$CDB_PATH/lib/x64 -ldbgeng
|
||||
}
|
||||
} else:isEmpty(ENV_CPU):contains(ENV_LIBPATH, ^.*amd64.*$) {
|
||||
DIRNAME=$${BASENAME}64
|
||||
CDB_PLATFORM=amd64
|
||||
|
||||
exists($$CDB_PATH/lib/amd64) {
|
||||
LIBS+= -L$$CDB_PATH/lib/amd64 -ldbgeng
|
||||
} else {
|
||||
LIBS+= -L$$CDB_PATH/lib/x64 -ldbgeng
|
||||
}
|
||||
} else {
|
||||
DIRNAME=$${BASENAME}32
|
||||
CDB_PLATFORM=i386
|
||||
|
||||
exists($$CDB_PATH/lib/i386}) {
|
||||
LIBS+= -L$$CDB_PATH/lib/i386 -ldbgeng
|
||||
} else {
|
||||
LIBS+= -L$$CDB_PATH/lib/x86 -ldbgeng
|
||||
}
|
||||
}
|
||||
|
||||
LIBS+=-luser32
|
||||
@@ -47,7 +65,6 @@ TARGET = $$BASENAME
|
||||
message("Compiling Qt Creator CDB extension $$TARGET $$DESTDIR for $$CDB_PLATFORM using $$CDB_PATH")
|
||||
|
||||
INCLUDEPATH += $$CDB_PATH/inc
|
||||
LIBS+= -L$$CDB_PATH/lib/$$CDB_PLATFORM -ldbgeng
|
||||
|
||||
CONFIG -= qt
|
||||
QT -= gui
|
||||
|
||||
@@ -5,6 +5,7 @@ import qbs.FileInfo
|
||||
QtcLibrary {
|
||||
condition: qbs.toolchain.contains("msvc") && cdbPath
|
||||
name: "qtcreatorcdbext"
|
||||
targetName: name
|
||||
property string cdbPath: {
|
||||
var paths = [
|
||||
qbs.getEnv("CDB_PATH"),
|
||||
@@ -24,16 +25,27 @@ QtcLibrary {
|
||||
for (var i = 0; i < c; ++i) {
|
||||
if (File.exists(paths[i])) {
|
||||
// The inc subdir is just used for detection. See qtcreatorcdbext.pro.
|
||||
return paths[i].endsWith("/inc") ? paths[i].substr(0, paths[i] - 4) : paths[i];
|
||||
return paths[i].endsWith("/inc") ? paths[i].substr(0, paths[i].length - 4)
|
||||
: paths[i];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
property string cdbLibPath: {
|
||||
var paths = qbs.architecture.contains("x86_64") ? ["x64", "amd64"] : ["x86", "i386"];
|
||||
var c = paths.length;
|
||||
for (var i = 0; i < c; ++i) {
|
||||
var libPath = FileInfo.joinPaths(cdbPath, "lib", paths[i]);
|
||||
if (File.exists(libPath)) {
|
||||
return libPath;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
property string cdbPlatform: qbs.architecture.contains("x86_64") ? "x64" : "x86"
|
||||
cpp.includePaths: [FileInfo.joinPaths(cdbPath, "inc")]
|
||||
cpp.dynamicLibraries: [
|
||||
"user32.lib",
|
||||
FileInfo.joinPaths(cdbPath, "lib", cdbPlatform, "dbgeng.lib")
|
||||
FileInfo.joinPaths(cdbLibPath, "dbgeng.lib")
|
||||
]
|
||||
cpp.linkerFlags: ["/DEF:" + FileInfo.toWindowsSeparators(
|
||||
FileInfo.joinPaths(product.sourceDirectory,
|
||||
@@ -44,7 +56,7 @@ QtcLibrary {
|
||||
dirName += "64";
|
||||
else
|
||||
dirName += "32";
|
||||
return FileInfo.joinPaths(project.ide_library_path, dirName);
|
||||
return FileInfo.joinPaths(project.libDirName, dirName);
|
||||
}
|
||||
files: [
|
||||
"base64.cpp",
|
||||
|
||||
@@ -279,7 +279,7 @@ extern "C" HRESULT CALLBACK pid(CIDebugClient *client, PCSTR args)
|
||||
|
||||
int token;
|
||||
commandTokens<StringList>(args, &token);
|
||||
dprintf("Qt Creator CDB extension version 3.2 %d bit built %s.\n",
|
||||
dprintf("Qt Creator CDB extension version 3.3 %d bit built %s.\n",
|
||||
sizeof(void *) * 8, __DATE__);
|
||||
if (const ULONG pid = currentProcessId(client))
|
||||
ExtensionContext::instance().report('R', token, 0, "pid", "%u", pid);
|
||||
|
||||
@@ -633,65 +633,6 @@ std::string SymbolGroupValue::pointedToSymbolName(ULONG64 address, const std::st
|
||||
return str.str();
|
||||
}
|
||||
|
||||
/* QtInfo helper: Determine the full name of a Qt Symbol like 'qstrdup' in 'QtCored4'.
|
||||
* as 'QtCored4![namespace::]qstrdup'. In the event someone really uses a different
|
||||
* library prefix or namespaced Qt, this should be found.
|
||||
* The crux is here that the underlying IDebugSymbols::StartSymbolMatch()
|
||||
* does not accept module wildcards (as opposed to the 'x' command where
|
||||
* 'x QtCo*!*qstrdup' would be acceptable and fast). OTOH, doing a wildcard search
|
||||
* like '*qstrdup' is very slow and should be done only if there is really a
|
||||
* different namespace or lib prefix.
|
||||
* Parameter 'modulePatternC' is used to do a search on the modules returned
|
||||
* (due to the amiguities and artifacts that appear like 'QGuid4!qstrdup'). */
|
||||
|
||||
static inline std::string resolveQtSymbol(const char *symbolC,
|
||||
const char *moduleNameC,
|
||||
const SymbolGroupValueContext &ctx)
|
||||
{
|
||||
enum { debugResolveQtSymbol = 0 };
|
||||
typedef std::list<std::string> StringList;
|
||||
typedef StringList::const_iterator StringListConstIt;
|
||||
|
||||
if (debugResolveQtSymbol)
|
||||
DebugPrint() << ">resolveQtSymbol" << symbolC << " def=" << moduleNameC << " defModName="
|
||||
<< moduleNameC;
|
||||
const SubStringPredicate modulePattern(moduleNameC);
|
||||
// First try a match with the default module name 'QtCored4!qstrdup' or
|
||||
// 'Qt5Cored!qstrdup' for speed reasons.
|
||||
for (int qtVersion = 4; qtVersion < 6; qtVersion++) {
|
||||
std::ostringstream str;
|
||||
str << "Qt";
|
||||
if (qtVersion >= 5)
|
||||
str << qtVersion;
|
||||
str << moduleNameC << 'd';
|
||||
if (qtVersion == 4)
|
||||
str << qtVersion;
|
||||
str << '!' << symbolC;
|
||||
const std::string defaultPattern = str.str();
|
||||
const StringList defaultMatches = SymbolGroupValue::resolveSymbolName(defaultPattern.c_str(), ctx);
|
||||
if (debugResolveQtSymbol)
|
||||
DebugPrint() << "resolveQtSymbol: defaultMatches=" << qtVersion
|
||||
<< DebugSequence<StringListConstIt>(defaultMatches.begin(), defaultMatches.end());
|
||||
const StringListConstIt defaultIt = std::find_if(defaultMatches.begin(), defaultMatches.end(), modulePattern);
|
||||
if (defaultIt != defaultMatches.end()) {
|
||||
if (debugResolveQtSymbol)
|
||||
DebugPrint() << "<resolveQtSymbol return1 " << *defaultIt;
|
||||
return *defaultIt;
|
||||
}
|
||||
}
|
||||
// Fail, now try a search with '*qstrdup' in all modules. This might return several matches
|
||||
// like 'QtCored4!qstrdup', 'QGuid4!qstrdup'
|
||||
const std::string wildCardPattern = std::string(1, '*') + symbolC;
|
||||
const StringList allMatches = SymbolGroupValue::resolveSymbolName(wildCardPattern.c_str(), ctx);
|
||||
if (debugResolveQtSymbol)
|
||||
DebugPrint() << "resolveQtSymbol: allMatches= (" << wildCardPattern << ") -> " << DebugSequence<StringListConstIt>(allMatches.begin(), allMatches.end());
|
||||
const StringListConstIt allIt = std::find_if(allMatches.begin(), allMatches.end(), modulePattern);
|
||||
const std::string rc = allIt != allMatches.end() ? *allIt : std::string();
|
||||
if (debugResolveQtSymbol)
|
||||
DebugPrint() << "<resolveQtSymbol return2 " << rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QtInfo
|
||||
|
||||
@@ -708,35 +649,71 @@ const QtInfo &QtInfo::get(const SymbolGroupValueContext &ctx)
|
||||
if (!rc.libInfix.empty())
|
||||
return rc;
|
||||
|
||||
do {
|
||||
// Lookup qstrdup() to hopefully get module (potential libinfix) and namespace
|
||||
// Typically, this resolves to 'QtGuid4!qstrdup' and 'QtCored4!qstrdup'...
|
||||
const std::string qualifiedSymbol = resolveQtSymbol("qstrdup", "Core", ctx);
|
||||
const std::string::size_type libPos = qualifiedSymbol.find("Core");
|
||||
const std::string::size_type exclPos = qualifiedSymbol.find('!'); // Resolved: 'QtCored4!qstrdup'
|
||||
if (libPos == std::string::npos || exclPos == std::string::npos) {
|
||||
rc.libInfix = "d4";
|
||||
rc.version = 4;
|
||||
typedef std::list<std::string> StringList;
|
||||
typedef StringList::const_iterator StringListConstIt;
|
||||
|
||||
// Lookup qstrdup() to hopefully get module (potential libinfix) and namespace
|
||||
// Typically, this resolves to 'QtGuid4!qstrdup' and 'QtCored4!qstrdup'...
|
||||
const char* qstrdupSymbol = "qstrdup";
|
||||
StringList modulePatterns;
|
||||
modulePatterns.push_back("Qt5Cored!");
|
||||
modulePatterns.push_back("QtCored4!");
|
||||
modulePatterns.push_back("*");
|
||||
std::string qualifiedSymbol;
|
||||
std::string::size_type exclPos;
|
||||
std::string::size_type libPos;
|
||||
for (StringListConstIt modulePattern = modulePatterns.begin(), total = modulePatterns.end();
|
||||
modulePattern != total; ++modulePattern) {
|
||||
const std::string pattern = *modulePattern + qstrdupSymbol;
|
||||
const StringList &allMatches = SymbolGroupValue::resolveSymbolName(pattern.c_str(), ctx);
|
||||
const StringListConstIt match = *modulePattern == "*" ? allMatches.begin()
|
||||
: std::find_if(allMatches.begin(), allMatches.end(), SubStringPredicate(modulePattern->c_str()));
|
||||
if (match == allMatches.end())
|
||||
continue;
|
||||
qualifiedSymbol = *match;
|
||||
exclPos = qualifiedSymbol.find('!'); // Resolved: 'QtCored4!qstrdup'
|
||||
libPos = qualifiedSymbol.find("Core");
|
||||
if (exclPos != std::string::npos && libPos != std::string::npos)
|
||||
break;
|
||||
}
|
||||
|
||||
if (exclPos != std::string::npos) {
|
||||
if (libPos != std::string::npos) {
|
||||
// found the core module
|
||||
// determine the qt version from the module name
|
||||
if (isdigit(qualifiedSymbol.at(2)))
|
||||
rc.version = qualifiedSymbol.at(2) - '0';
|
||||
else
|
||||
rc.version = qualifiedSymbol.at(exclPos - 1) - '0';
|
||||
rc.libInfix = qualifiedSymbol.substr(libPos + 4, exclPos - libPos - 4);
|
||||
} else {
|
||||
// Found the Qt symbol but in an unexpected module, most probably
|
||||
// it is a static build.
|
||||
rc.isStatic = true;
|
||||
rc.libInfix = qualifiedSymbol.substr(0, exclPos);
|
||||
// The Qt version cannot be determined by the module name. Looking up
|
||||
// qInstallMessageHandler which is in Qt since 5.0 to determine the version.
|
||||
const std::string pattern = rc.libInfix + "!qInstallMessageHandler";
|
||||
const StringList &allMatches = SymbolGroupValue::resolveSymbolName(pattern.c_str(), ctx);
|
||||
const StringListConstIt match = std::find_if(allMatches.begin(), allMatches.end(),
|
||||
SubStringPredicate(rc.libInfix.c_str()));
|
||||
rc.version = match == allMatches.end() ? 4 : 5;
|
||||
}
|
||||
rc.libInfix = qualifiedSymbol.substr(libPos + 4, exclPos - libPos - 4);
|
||||
// 'Qt5Cored!qstrdup' or 'QtCored4!qstrdup'.
|
||||
if (isdigit(qualifiedSymbol.at(2)))
|
||||
rc.version = qualifiedSymbol.at(2) - '0';
|
||||
else
|
||||
rc.version = qualifiedSymbol.at(exclPos - 1) - '0';
|
||||
// Any namespace? 'QtCored4!nsp::qstrdup'
|
||||
const std::string::size_type nameSpaceStart = exclPos + 1;
|
||||
const std::string::size_type colonPos = qualifiedSymbol.find(':', nameSpaceStart);
|
||||
if (colonPos != std::string::npos)
|
||||
rc.nameSpace = qualifiedSymbol.substr(nameSpaceStart, colonPos - nameSpaceStart);
|
||||
} else {
|
||||
// Can't find a basic Qt symbol so use a fallback
|
||||
rc.libInfix = "d4";
|
||||
rc.version = 4;
|
||||
}
|
||||
|
||||
} while (false);
|
||||
rc.qObjectType = rc.prependQtCoreModule("QObject");
|
||||
rc.qObjectPrivateType = rc.prependQtCoreModule("QObjectPrivate");
|
||||
rc.qWindowPrivateType = rc.prependQtGuiModule("QWindowPrivate");
|
||||
rc.qWidgetPrivateType =
|
||||
rc.prependQtModule("QWidgetPrivate", rc.version >= 5 ? Widgets : Gui);
|
||||
rc.qWidgetPrivateType = rc.prependQtModule("QWidgetPrivate", rc.version >= 5 ? Widgets : Gui);
|
||||
if (SymbolGroupValue::verbose)
|
||||
DebugPrint() << rc;
|
||||
return rc;
|
||||
@@ -744,6 +721,8 @@ const QtInfo &QtInfo::get(const SymbolGroupValueContext &ctx)
|
||||
|
||||
std::string QtInfo::moduleName(Module m) const
|
||||
{
|
||||
if (isStatic)
|
||||
return libInfix;
|
||||
// Must match the enumeration
|
||||
static const char* modNames[] =
|
||||
{"Core", "Gui", "Widgets", "Network", "Script", "Qml" };
|
||||
|
||||
@@ -188,7 +188,7 @@ struct QtInfo
|
||||
Core, Gui, Widgets, Network, Script, Qml
|
||||
};
|
||||
|
||||
QtInfo() : version(0) {}
|
||||
QtInfo() : version(0), isStatic(false) {}
|
||||
|
||||
static const QtInfo &get(const SymbolGroupValueContext &ctx);
|
||||
|
||||
@@ -217,6 +217,7 @@ struct QtInfo
|
||||
std::string moduleName(Module m) const;
|
||||
|
||||
int version;
|
||||
bool isStatic;
|
||||
std::string nameSpace;
|
||||
std::string libInfix;
|
||||
// Fully qualified types with module and namespace
|
||||
|
||||
@@ -143,9 +143,10 @@ auto equal(R (S::*function)() const, T value)
|
||||
// transform taking a member function pointer
|
||||
template<typename T, typename R, typename S>
|
||||
Q_REQUIRED_RESULT
|
||||
auto transform(const QList<T> &container, R (S::*p)() const) -> QList<R>
|
||||
auto transform(const QList<T> &container, R (S::*p)() const)
|
||||
-> QList<typename std::remove_cv<typename std::remove_reference<R>::type>::type>
|
||||
{
|
||||
QList<R> result;
|
||||
QList<typename std::remove_cv<typename std::remove_reference<R>::type>::type> result;
|
||||
result.reserve(container.size());
|
||||
std::transform(container.begin(), container.end(),
|
||||
std::back_inserter(result),
|
||||
@@ -164,9 +165,9 @@ T &&declval();
|
||||
template<typename T, typename F>
|
||||
Q_REQUIRED_RESULT
|
||||
auto transform(const QList<T> &container, F function)
|
||||
-> QList<typename std::remove_reference<decltype(function(declval<T>()))>::type>
|
||||
-> QList<typename std::remove_cv<typename std::remove_reference<decltype(function(declval<T>()))>::type>::type>
|
||||
{
|
||||
QList<typename std::remove_reference<decltype(function(declval<T>()))>::type> result;
|
||||
QList<typename std::remove_cv<typename std::remove_reference<decltype(function(declval<T>()))>::type>::type> result;
|
||||
result.reserve(container.size());
|
||||
std::transform(container.begin(), container.end(),
|
||||
std::back_inserter(result),
|
||||
|
||||
@@ -134,15 +134,11 @@ QString BuildableHelperLibrary::qtVersionForQMake(const QString &qmakePath, bool
|
||||
|
||||
QStringList BuildableHelperLibrary::possibleQMakeCommands()
|
||||
{
|
||||
// On windows no one has renamed qmake, right?
|
||||
if (HostOsInfo::isWindowsHost())
|
||||
return QStringList(QLatin1String("qmake.exe"));
|
||||
|
||||
// On unix some distributions renamed qmake to avoid clashes
|
||||
QStringList result;
|
||||
result << QLatin1String("qmake") << QLatin1String("qmake-qt4") << QLatin1String("qmake4")
|
||||
<< QLatin1String("qmake-qt5") << QLatin1String("qmake5") ;
|
||||
return result;
|
||||
// On Windows it is always "qmake.exe"
|
||||
// On Unix some distributions renamed qmake with a postfix to avoid clashes
|
||||
// On OS X, Qt 4 binary packages also has renamed qmake. There are also symbolic links that are
|
||||
// named "qmake", but the file dialog always checks against resolved links (native Cocoa issue)
|
||||
return QStringList(QLatin1String("qmake*"));
|
||||
}
|
||||
|
||||
// Copy helper source files to a target directory, replacing older files.
|
||||
|
||||
@@ -47,12 +47,12 @@ class QTCREATOR_UTILS_EXPORT FileWizardPage : public WizardPage
|
||||
|
||||
public:
|
||||
explicit FileWizardPage(QWidget *parent = 0);
|
||||
virtual ~FileWizardPage();
|
||||
~FileWizardPage();
|
||||
|
||||
QString fileName() const;
|
||||
QString path() const;
|
||||
|
||||
virtual bool isComplete() const;
|
||||
bool isComplete() const;
|
||||
|
||||
void setFileNameLabel(const QString &label);
|
||||
void setPathLabel(const QString &label);
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "macroexpander.h"
|
||||
#include "qtcprocess.h"
|
||||
|
||||
#include "algorithm.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
@@ -43,13 +46,67 @@ const char kPathPostfix[] = ":Path";
|
||||
const char kFileNamePostfix[] = ":FileName";
|
||||
const char kFileBaseNamePostfix[] = ":FileBaseName";
|
||||
|
||||
class MacroExpanderPrivate
|
||||
class MacroExpanderPrivate : public AbstractMacroExpander
|
||||
{
|
||||
public:
|
||||
MacroExpanderPrivate() : m_accumulating(false) {}
|
||||
|
||||
bool resolveMacro(const QString &name, QString *ret)
|
||||
{
|
||||
bool found;
|
||||
*ret = value(name.toUtf8(), &found);
|
||||
if (found)
|
||||
return true;
|
||||
|
||||
found = Utils::anyOf(m_subProviders, [name, ret] (const MacroExpanderProvider &p) -> bool {
|
||||
MacroExpander *expander = p ? p() : 0;
|
||||
return expander && expander->resolveMacro(name, ret);
|
||||
});
|
||||
|
||||
if (found)
|
||||
return true;
|
||||
|
||||
found = Utils::anyOf(m_extraResolvers, [name, ret] (const MacroExpander::ResolverFunction &resolver) {
|
||||
return resolver(name, ret);
|
||||
});
|
||||
|
||||
if (found)
|
||||
return true;
|
||||
|
||||
return this == globalMacroExpander()->d ? false : globalMacroExpander()->d->resolveMacro(name, ret);
|
||||
}
|
||||
|
||||
QString value(const QByteArray &variable, bool *found)
|
||||
{
|
||||
MacroExpander::StringFunction sf = m_map.value(variable);
|
||||
if (sf) {
|
||||
if (found)
|
||||
*found = true;
|
||||
return sf();
|
||||
}
|
||||
|
||||
for (auto it = m_prefixMap.constBegin(); it != m_prefixMap.constEnd(); ++it) {
|
||||
if (variable.startsWith(it.key())) {
|
||||
MacroExpander::PrefixFunction pf = it.value();
|
||||
if (found)
|
||||
*found = true;
|
||||
return pf(QString::fromUtf8(variable.mid(it.key().count())));
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
*found = false;
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
QHash<QByteArray, MacroExpander::StringFunction> m_map;
|
||||
QHash<QByteArray, MacroExpander::PrefixFunction> m_prefixMap;
|
||||
QVector<MacroExpander::ResolverFunction> m_extraResolvers;
|
||||
QMap<QByteArray, QString> m_descriptions;
|
||||
QString m_displayName;
|
||||
QVector<MacroExpanderProvider> m_subProviders;
|
||||
QVector<MacroExpander *> m_subExpanders; // Not owned
|
||||
bool m_accumulating;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
@@ -180,38 +237,18 @@ MacroExpander::~MacroExpander()
|
||||
/*!
|
||||
* \internal
|
||||
*/
|
||||
bool MacroExpander::resolveMacro(const QString &name, QString *ret)
|
||||
bool MacroExpander::resolveMacro(const QString &name, QString *ret) const
|
||||
{
|
||||
bool found;
|
||||
*ret = value(name.toUtf8(), &found);
|
||||
return found;
|
||||
return d->resolveMacro(name, ret);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns the value of the given \a variable. If \a found is given, it is
|
||||
* set to true if the variable has a value at all, false if not.
|
||||
*/
|
||||
QString MacroExpander::value(const QByteArray &variable, bool *found)
|
||||
QString MacroExpander::value(const QByteArray &variable, bool *found) const
|
||||
{
|
||||
StringFunction sf = d->m_map.value(variable);
|
||||
if (sf) {
|
||||
if (found)
|
||||
*found = true;
|
||||
return sf();
|
||||
}
|
||||
|
||||
for (auto it = d->m_prefixMap.constBegin(); it != d->m_prefixMap.constEnd(); ++it) {
|
||||
if (variable.startsWith(it.key())) {
|
||||
PrefixFunction pf = it.value();
|
||||
if (found)
|
||||
*found = true;
|
||||
return pf(QString::fromUtf8(variable.mid(it.key().count())));
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
*found = false;
|
||||
|
||||
return QString();
|
||||
return d->value(variable, found);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -221,9 +258,21 @@ QString MacroExpander::value(const QByteArray &variable, bool *found)
|
||||
* \sa MacroExpander
|
||||
* \sa macroExpander()
|
||||
*/
|
||||
QString MacroExpander::expandedString(const QString &stringWithVariables)
|
||||
QString MacroExpander::expand(const QString &stringWithVariables) const
|
||||
{
|
||||
return Utils::expandMacros(stringWithVariables, this);
|
||||
QString res = stringWithVariables;
|
||||
Utils::expandMacros(&res, d);
|
||||
return res;
|
||||
}
|
||||
|
||||
QByteArray MacroExpander::expand(const QByteArray &stringWithVariables) const
|
||||
{
|
||||
return expand(QString::fromLatin1(stringWithVariables)).toLatin1();
|
||||
}
|
||||
|
||||
QString MacroExpander::expandProcessArgs(const QString &argsWithVariables) const
|
||||
{
|
||||
return QtcProcess::expandMacros(argsWithVariables, d);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -302,13 +351,18 @@ void MacroExpander::registerFileVariables(const QByteArray &prefix,
|
||||
[base]() -> QString { QString tmp = base(); return tmp.isEmpty() ? QString() : QFileInfo(tmp).baseName(); });
|
||||
}
|
||||
|
||||
void MacroExpander::registerExtraResolver(const MacroExpander::ResolverFunction &value)
|
||||
{
|
||||
d->m_extraResolvers.append(value);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns all registered variable names.
|
||||
*
|
||||
* \sa registerVariable()
|
||||
* \sa registerFileVariables()
|
||||
*/
|
||||
QList<QByteArray> MacroExpander::variables()
|
||||
QList<QByteArray> MacroExpander::variables() const
|
||||
{
|
||||
return d->m_descriptions.keys();
|
||||
}
|
||||
@@ -316,11 +370,27 @@ QList<QByteArray> MacroExpander::variables()
|
||||
/*!
|
||||
* Returns the description that was registered for the \a variable.
|
||||
*/
|
||||
QString MacroExpander::variableDescription(const QByteArray &variable)
|
||||
QString MacroExpander::variableDescription(const QByteArray &variable) const
|
||||
{
|
||||
return d->m_descriptions.value(variable);
|
||||
}
|
||||
|
||||
MacroExpanders MacroExpander::subExpanders() const
|
||||
{
|
||||
MacroExpanders expanders;
|
||||
foreach (const MacroExpanderProvider &provider, d->m_subProviders)
|
||||
if (provider)
|
||||
if (MacroExpander *expander = provider())
|
||||
expanders.append(expander);
|
||||
|
||||
return expanders;
|
||||
}
|
||||
|
||||
AbstractMacroExpander *MacroExpander::abstractExpander() const
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
||||
QString MacroExpander::displayName() const
|
||||
{
|
||||
return d->m_displayName;
|
||||
@@ -331,6 +401,20 @@ void MacroExpander::setDisplayName(const QString &displayName)
|
||||
d->m_displayName = displayName;
|
||||
}
|
||||
|
||||
void MacroExpander::registerSubProvider(const MacroExpanderProvider &provider)
|
||||
{
|
||||
d->m_subProviders.append(provider);
|
||||
}
|
||||
|
||||
bool MacroExpander::isAccumulating() const
|
||||
{
|
||||
return d->m_accumulating;
|
||||
}
|
||||
|
||||
void MacroExpander::setAccumulating(bool on)
|
||||
{
|
||||
d->m_accumulating = on;
|
||||
}
|
||||
|
||||
class GlobalMacroExpander : public MacroExpander
|
||||
{
|
||||
|
||||
@@ -35,23 +35,37 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace Utils {
|
||||
|
||||
namespace Internal { class MacroExpanderPrivate; }
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT MacroExpander : public AbstractMacroExpander
|
||||
class MacroExpander;
|
||||
typedef std::function<MacroExpander *()> MacroExpanderProvider;
|
||||
typedef QVector<MacroExpander *> MacroExpanders;
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT MacroExpander
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS("MacroExpander")
|
||||
|
||||
public:
|
||||
explicit MacroExpander();
|
||||
~MacroExpander();
|
||||
virtual ~MacroExpander();
|
||||
|
||||
bool resolveMacro(const QString &name, QString *ret);
|
||||
virtual bool resolveMacro(const QString &name, QString *ret) const;
|
||||
|
||||
QString value(const QByteArray &variable, bool *found = 0);
|
||||
virtual QString value(const QByteArray &variable, bool *found = 0) const;
|
||||
|
||||
QString expandedString(const QString &stringWithVariables);
|
||||
QString expand(const QString &stringWithVariables) const;
|
||||
QByteArray expand(const QByteArray &stringWithVariables) const;
|
||||
|
||||
QString expandProcessArgs(const QString &argsWithVariables) const;
|
||||
|
||||
typedef std::function<QString(QString)> PrefixFunction;
|
||||
typedef std::function<bool(QString, QString *)> ResolverFunction;
|
||||
typedef std::function<QString()> StringFunction;
|
||||
typedef std::function<int()> IntFunction;
|
||||
|
||||
@@ -67,16 +81,27 @@ public:
|
||||
void registerFileVariables(const QByteArray &prefix,
|
||||
const QString &heading, const StringFunction &value);
|
||||
|
||||
QList<QByteArray> variables();
|
||||
QString variableDescription(const QByteArray &variable);
|
||||
void registerExtraResolver(const ResolverFunction &value);
|
||||
|
||||
QList<QByteArray> variables() const;
|
||||
QString variableDescription(const QByteArray &variable) const;
|
||||
|
||||
MacroExpanders subExpanders() const;
|
||||
AbstractMacroExpander *abstractExpander() const;
|
||||
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &displayName);
|
||||
|
||||
void registerSubProvider(const MacroExpanderProvider &provider);
|
||||
|
||||
bool isAccumulating() const;
|
||||
void setAccumulating(bool on);
|
||||
|
||||
private:
|
||||
MacroExpander(const MacroExpander &) Q_DECL_EQ_DELETE;
|
||||
void operator=(const MacroExpander &) Q_DECL_EQ_DELETE;
|
||||
|
||||
friend class Internal::MacroExpanderPrivate;
|
||||
Internal::MacroExpanderPrivate *d;
|
||||
};
|
||||
|
||||
|
||||
@@ -115,7 +115,6 @@ void OutputFormatter::initFormats()
|
||||
{
|
||||
if (!plainTextEdit())
|
||||
return;
|
||||
QPalette p = plainTextEdit()->palette();
|
||||
|
||||
QFont boldFont = m_font;
|
||||
boldFont.setBold(true);
|
||||
|
||||
@@ -41,6 +41,16 @@ namespace Utils {
|
||||
|
||||
static Theme *m_creatorTheme = 0;
|
||||
|
||||
ThemePrivate::ThemePrivate()
|
||||
: widgetStyle(Theme::StyleDefault)
|
||||
{
|
||||
const QMetaObject &m = Theme::staticMetaObject;
|
||||
colors.resize (m.enumerator(m.indexOfEnumerator("Color")).keyCount());
|
||||
imageFiles.resize (m.enumerator(m.indexOfEnumerator("ImageFile")).keyCount());
|
||||
gradients.resize (m.enumerator(m.indexOfEnumerator("Gradient")).keyCount());
|
||||
flags.resize (m.enumerator(m.indexOfEnumerator("Flag")).keyCount());
|
||||
}
|
||||
|
||||
Theme *creatorTheme()
|
||||
{
|
||||
return m_creatorTheme;
|
||||
@@ -48,7 +58,9 @@ Theme *creatorTheme()
|
||||
|
||||
void setCreatorTheme(Theme *theme)
|
||||
{
|
||||
// TODO: memory management of theme object
|
||||
if (m_creatorTheme == theme)
|
||||
return;
|
||||
delete m_creatorTheme;
|
||||
m_creatorTheme = theme;
|
||||
}
|
||||
|
||||
@@ -63,13 +75,6 @@ Theme::~Theme()
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Theme::drawIndicatorBranch(QPainter *painter, const QRect &rect, QStyle::State state) const
|
||||
{
|
||||
Q_UNUSED(painter);
|
||||
Q_UNUSED(rect);
|
||||
Q_UNUSED(state);
|
||||
}
|
||||
|
||||
Theme::WidgetStyle Theme::widgetStyle() const
|
||||
{
|
||||
return d->widgetStyle;
|
||||
@@ -80,53 +85,20 @@ bool Theme::flag(Theme::Flag f) const
|
||||
return d->flags[f];
|
||||
}
|
||||
|
||||
QColor Theme::color(Theme::ColorRole role) const
|
||||
QColor Theme::color(Theme::Color role) const
|
||||
{
|
||||
return d->colors[role].first;
|
||||
}
|
||||
|
||||
QGradientStops Theme::gradient(Theme::GradientRole role) const
|
||||
QString Theme::imageFile(Theme::ImageFile imageFile, const QString &fallBack) const
|
||||
{
|
||||
return d->gradientStops[role];
|
||||
const QString &file = d->imageFiles.at(imageFile);
|
||||
return file.isEmpty() ? fallBack : file;
|
||||
}
|
||||
|
||||
QString Theme::iconOverlay(Theme::MimeType mimetype) const
|
||||
QGradientStops Theme::gradient(Theme::Gradient role) const
|
||||
{
|
||||
return d->iconOverlays[mimetype];
|
||||
}
|
||||
|
||||
QString Theme::dpiSpecificImageFile(const QString &fileName) const
|
||||
{
|
||||
return dpiSpecificImageFile(fileName, QLatin1String(""));
|
||||
}
|
||||
|
||||
QString Theme::dpiSpecificImageFile(const QString &fileName, const QString &themePrefix) const
|
||||
{
|
||||
// See QIcon::addFile()
|
||||
const QFileInfo fi(fileName);
|
||||
|
||||
bool at2x = (qApp->devicePixelRatio() > 1.0);
|
||||
|
||||
const QString at2xFileName = fi.path() + QStringLiteral("/")
|
||||
+ fi.completeBaseName() + QStringLiteral("@2x.") + fi.suffix();
|
||||
const QString themedAt2xFileName = fi.path() + QStringLiteral("/") + themePrefix
|
||||
+ fi.completeBaseName() + QStringLiteral("@2x.") + fi.suffix();
|
||||
const QString themedFileName = fi.path() + QStringLiteral("/") + themePrefix
|
||||
+ fi.completeBaseName() + QStringLiteral(".") + fi.suffix();
|
||||
|
||||
if (at2x) {
|
||||
if (QFile::exists(themedAt2xFileName))
|
||||
return themedAt2xFileName;
|
||||
else if (QFile::exists(themedFileName))
|
||||
return themedFileName;
|
||||
else if (QFile::exists(at2xFileName))
|
||||
return at2xFileName;
|
||||
return fileName;
|
||||
} else {
|
||||
if (QFile::exists(themedFileName))
|
||||
return themedFileName;
|
||||
return fileName;
|
||||
}
|
||||
return d->gradients[role];
|
||||
}
|
||||
|
||||
QPair<QColor, QString> Theme::readNamedColor(const QString &color) const
|
||||
@@ -143,11 +115,6 @@ QPair<QColor, QString> Theme::readNamedColor(const QString &color) const
|
||||
return qMakePair(QColor::fromRgba(rgba), QString());
|
||||
}
|
||||
|
||||
QString Theme::imageFile(const QString &fileName) const
|
||||
{
|
||||
return fileName;
|
||||
}
|
||||
|
||||
QString Theme::fileName() const
|
||||
{
|
||||
return d->fileName;
|
||||
@@ -158,6 +125,32 @@ void Theme::setName(const QString &name)
|
||||
d->name = name;
|
||||
}
|
||||
|
||||
QVariantHash Theme::values() const
|
||||
{
|
||||
QVariantHash result;
|
||||
const QMetaObject &m = *metaObject();
|
||||
{
|
||||
const QMetaEnum e = m.enumerator(m.indexOfEnumerator("Color"));
|
||||
for (int i = 0, total = e.keyCount(); i < total; ++i) {
|
||||
const QString key = QLatin1String(e.key(i));
|
||||
const QPair<QColor, QString> &var = d->colors.at(i);
|
||||
result.insert(key, var.first);
|
||||
}
|
||||
}
|
||||
{
|
||||
const QMetaEnum e = m.enumerator(m.indexOfEnumerator("Flag"));
|
||||
for (int i = 0, total = e.keyCount(); i < total; ++i) {
|
||||
const QString key = QLatin1String(e.key(i));
|
||||
result.insert(key, flag(static_cast<Theme::Flag>(i)));
|
||||
}
|
||||
}
|
||||
{
|
||||
const QMetaEnum e = m.enumerator(m.indexOfEnumerator("WidgetStyle"));
|
||||
result.insert(QLatin1String("WidgetStyle"), QLatin1String(e.valueToKey(widgetStyle())));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static QColor readColor(const QString &color)
|
||||
{
|
||||
bool ok = true;
|
||||
@@ -191,7 +184,7 @@ void Theme::writeSettings(const QString &filename) const
|
||||
}
|
||||
{
|
||||
settings.beginGroup(QLatin1String("Colors"));
|
||||
const QMetaEnum e = m.enumerator(m.indexOfEnumerator("ColorRole"));
|
||||
const QMetaEnum e = m.enumerator(m.indexOfEnumerator("Color"));
|
||||
for (int i = 0, total = e.keyCount(); i < total; ++i) {
|
||||
const QString key = QLatin1String(e.key(i));
|
||||
const QPair<QColor, QString> var = d->colors[i];
|
||||
@@ -203,11 +196,22 @@ void Theme::writeSettings(const QString &filename) const
|
||||
settings.endGroup();
|
||||
}
|
||||
{
|
||||
settings.beginGroup(QLatin1String("Gradients"));
|
||||
const QMetaEnum e = m.enumerator(m.indexOfEnumerator("GradientRole"));
|
||||
settings.beginGroup(QLatin1String("ImageFiles"));
|
||||
const QMetaEnum e = m.enumerator(m.indexOfEnumerator("ImageFile"));
|
||||
for (int i = 0, total = e.keyCount(); i < total; ++i) {
|
||||
const QString key = QLatin1String(e.key(i));
|
||||
QGradientStops stops = gradient(static_cast<Theme::GradientRole>(i));
|
||||
const QString &var = d->imageFiles.at(i);
|
||||
if (!var.isEmpty())
|
||||
settings.setValue(key, var);
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
{
|
||||
settings.beginGroup(QLatin1String("Gradients"));
|
||||
const QMetaEnum e = m.enumerator(m.indexOfEnumerator("Gradient"));
|
||||
for (int i = 0, total = e.keyCount(); i < total; ++i) {
|
||||
const QString key = QLatin1String(e.key(i));
|
||||
QGradientStops stops = gradient(static_cast<Theme::Gradient>(i));
|
||||
settings.beginWriteArray(key);
|
||||
int k = 0;
|
||||
foreach (const QGradientStop stop, stops) {
|
||||
@@ -220,15 +224,6 @@ void Theme::writeSettings(const QString &filename) const
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
{
|
||||
settings.beginGroup(QLatin1String("IconOverlay"));
|
||||
const QMetaEnum e = m.enumerator(m.indexOfEnumerator("MimeType"));
|
||||
for (int i = 0, total = e.keyCount(); i < total; ++i) {
|
||||
const QString key = QLatin1String(e.key(i));
|
||||
settings.setValue(key, iconOverlay(static_cast<Theme::MimeType>(i)));
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
{
|
||||
settings.beginGroup(QLatin1String("Flags"));
|
||||
const QMetaEnum e = m.enumerator(m.indexOfEnumerator("Flag"));
|
||||
@@ -272,7 +267,7 @@ void Theme::readSettings(QSettings &settings)
|
||||
}
|
||||
{
|
||||
settings.beginGroup(QLatin1String("Colors"));
|
||||
QMetaEnum e = m.enumerator(m.indexOfEnumerator("ColorRole"));
|
||||
QMetaEnum e = m.enumerator(m.indexOfEnumerator("Color"));
|
||||
for (int i = 0, total = e.keyCount(); i < total; ++i) {
|
||||
const QString key = QLatin1String(e.key(i));
|
||||
QTC_ASSERT(settings.contains(key), return);;
|
||||
@@ -280,9 +275,18 @@ void Theme::readSettings(QSettings &settings)
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
{
|
||||
settings.beginGroup(QLatin1String("ImageFiles"));
|
||||
QMetaEnum e = m.enumerator(m.indexOfEnumerator("ImageFile"));
|
||||
for (int i = 0, total = e.keyCount(); i < total; ++i) {
|
||||
const QString key = QLatin1String(e.key(i));
|
||||
d->imageFiles[i] = settings.value(key).toString();
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
{
|
||||
settings.beginGroup(QLatin1String("Gradients"));
|
||||
QMetaEnum e = m.enumerator(m.indexOfEnumerator("GradientRole"));
|
||||
QMetaEnum e = m.enumerator(m.indexOfEnumerator("Gradient"));
|
||||
for (int i = 0, total = e.keyCount(); i < total; ++i) {
|
||||
const QString key = QLatin1String(e.key(i));
|
||||
QGradientStops stops;
|
||||
@@ -296,17 +300,7 @@ void Theme::readSettings(QSettings &settings)
|
||||
stops.append(qMakePair(pos, c));
|
||||
}
|
||||
settings.endArray();
|
||||
d->gradientStops[i] = stops;
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
{
|
||||
settings.beginGroup(QLatin1String("IconOverlay"));
|
||||
QMetaEnum e = m.enumerator(m.indexOfEnumerator("MimeType"));
|
||||
for (int i = 0, total = e.keyCount(); i < total; ++i) {
|
||||
const QString key = QLatin1String(e.key(i));
|
||||
QTC_ASSERT(settings.contains(key), return);;
|
||||
d->iconOverlays[i] = settings.value(key).toString();
|
||||
d->gradients[i] = stops;
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
@@ -322,14 +316,6 @@ void Theme::readSettings(QSettings &settings)
|
||||
}
|
||||
}
|
||||
|
||||
QIcon Theme::standardIcon(QStyle::StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const
|
||||
{
|
||||
Q_UNUSED(standardPixmap);
|
||||
Q_UNUSED(opt);
|
||||
Q_UNUSED(widget);
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
QPalette Theme::palette(const QPalette &base) const
|
||||
{
|
||||
if (!flag(DerivePaletteFromTheme))
|
||||
|
||||
@@ -46,9 +46,9 @@ class QTCREATOR_UTILS_EXPORT Theme : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_ENUMS(ColorRole)
|
||||
Q_ENUMS(GradientRole)
|
||||
Q_ENUMS(MimeType)
|
||||
Q_ENUMS(Color)
|
||||
Q_ENUMS(ImageFile)
|
||||
Q_ENUMS(Gradient)
|
||||
Q_ENUMS(Flag)
|
||||
Q_ENUMS(WidgetStyle)
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
Theme(QObject *parent = 0);
|
||||
~Theme();
|
||||
|
||||
enum ColorRole {
|
||||
enum Color {
|
||||
BackgroundColorAlternate,
|
||||
BackgroundColorDark,
|
||||
BackgroundColorHover,
|
||||
@@ -103,7 +103,8 @@ public:
|
||||
OutputPaneToggleButtonTextColorChecked,
|
||||
OutputPaneToggleButtonTextColorUnchecked,
|
||||
PanelButtonToolBackgroundColorHover,
|
||||
PanelTextColor,
|
||||
PanelTextColorLight,
|
||||
PanelTextColorDark,
|
||||
PanelsWidgetSeparatorLineColor,
|
||||
PanelStatusBarBackgroundColor,
|
||||
ProgressBarTitleColor,
|
||||
@@ -149,22 +150,32 @@ public:
|
||||
|
||||
Welcome_SessionItem_BackgroundColorNormal,
|
||||
Welcome_SessionItem_BackgroundColorHover,
|
||||
Welcome_SessionItemExpanded_BackgroundColor
|
||||
Welcome_SessionItemExpanded_BackgroundColorNormal,
|
||||
Welcome_SessionItemExpanded_BackgroundColorHover
|
||||
};
|
||||
|
||||
enum GradientRole {
|
||||
enum Gradient {
|
||||
DetailsWidgetHeaderGradient,
|
||||
Welcome_Button_GradientNormal,
|
||||
Welcome_Button_GradientPressed
|
||||
};
|
||||
|
||||
enum MimeType {
|
||||
CppSourceMimetype,
|
||||
CSourceMimetype,
|
||||
CppHeaderMimetype,
|
||||
ProMimetype,
|
||||
PriMimetype,
|
||||
PrfMimetype
|
||||
enum ImageFile {
|
||||
ProjectExplorerHeader,
|
||||
ProjectExplorerSource,
|
||||
ProjectExplorerForm,
|
||||
ProjectExplorerResource,
|
||||
ProjectExplorerQML,
|
||||
ProjectExplorerOtherFiles,
|
||||
ProjectFileIcon,
|
||||
IconOverlayCSource,
|
||||
IconOverlayCppHeader,
|
||||
IconOverlayCppSource,
|
||||
IconOverlayPri,
|
||||
IconOverlayPrf,
|
||||
IconOverlayPro,
|
||||
StandardPixmapFileIcon,
|
||||
StandardPixmapDirIcon
|
||||
};
|
||||
|
||||
enum Flag {
|
||||
@@ -183,18 +194,16 @@ public:
|
||||
|
||||
WidgetStyle widgetStyle() const;
|
||||
bool flag(Flag f) const;
|
||||
QColor color(ColorRole role) const;
|
||||
QGradientStops gradient(GradientRole role) const;
|
||||
QString iconOverlay(MimeType mimetype) const;
|
||||
QColor color(Color role) const;
|
||||
QString imageFile(ImageFile imageFile, const QString &fallBack) const;
|
||||
QGradientStops gradient(Gradient role) const;
|
||||
QPalette palette(const QPalette &base) const;
|
||||
QString dpiSpecificImageFile(const QString &fileName) const;
|
||||
void drawIndicatorBranch(QPainter *painter, const QRect &rect, QStyle::State state) const;
|
||||
QIcon standardIcon(QStyle::StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const;
|
||||
QString imageFile(const QString &fileName) const;
|
||||
|
||||
QString fileName() const;
|
||||
void setName(const QString &name);
|
||||
|
||||
QVariantHash values() const;
|
||||
|
||||
void writeSettings(const QString &filename) const;
|
||||
void readSettings(QSettings &settings);
|
||||
ThemePrivate *d;
|
||||
@@ -202,9 +211,6 @@ public:
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
protected:
|
||||
QString dpiSpecificImageFile(const QString &fileName, const QString &themePrefix) const;
|
||||
|
||||
private:
|
||||
QPair<QColor, QString> readNamedColor(const QString &color) const;
|
||||
};
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Thorben Kroeger <thorbenkroeger@gmail.com>.
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://www.qt.io/licensing. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** 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 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "theme_p.h"
|
||||
|
||||
#include <QMetaEnum>
|
||||
|
||||
namespace Utils {
|
||||
|
||||
ThemePrivate::ThemePrivate()
|
||||
: widgetStyle(Theme::StyleDefault)
|
||||
{
|
||||
const QMetaObject &m = Theme::staticMetaObject;
|
||||
colors.resize (m.enumerator(m.indexOfEnumerator("ColorRole")).keyCount());
|
||||
gradientStops.resize (m.enumerator(m.indexOfEnumerator("GradientRole")).keyCount());
|
||||
iconOverlays.resize (m.enumerator(m.indexOfEnumerator("MimeType")).keyCount());
|
||||
flags.resize (m.enumerator(m.indexOfEnumerator("Flag")).keyCount());
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
@@ -47,8 +47,8 @@ public:
|
||||
QString fileName;
|
||||
QString name;
|
||||
QVector<QPair<QColor, QString> > colors;
|
||||
QVector<QString> iconOverlays;
|
||||
QVector<QGradientStops> gradientStops;
|
||||
QVector<QString> imageFiles;
|
||||
QVector<QGradientStops> gradients;
|
||||
QVector<bool> flags;
|
||||
Theme::WidgetStyle widgetStyle;
|
||||
QMap<QString, QColor> palette;
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Thorben Kroeger <thorbenkroeger@gmail.com>.
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://www.qt.io/licensing. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** 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 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "welcometheme.h"
|
||||
|
||||
#include "theme.h"
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
#define IMPL_COLOR_PROPERTY(propName, enumName) \
|
||||
QColor WelcomeTheme::propName () const { \
|
||||
return creatorTheme()->color(Theme::enumName); \
|
||||
}
|
||||
|
||||
#define GRADIENT(x) \
|
||||
QGradient grad; \
|
||||
grad.setStops(creatorTheme()->gradient(Theme::x)); \
|
||||
return grad;
|
||||
|
||||
WelcomeTheme::WelcomeTheme(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QString WelcomeTheme::widgetStyle() const
|
||||
{
|
||||
switch (creatorTheme()->widgetStyle()) {
|
||||
case Theme::StyleDefault:
|
||||
return QLatin1String("default");
|
||||
case Theme::StyleFlat:
|
||||
return QLatin1String("flat");
|
||||
}
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
void WelcomeTheme::notifyThemeChanged()
|
||||
{
|
||||
emit themeChanged();
|
||||
}
|
||||
|
||||
IMPL_COLOR_PROPERTY(textColorNormal , Welcome_TextColorNormal )
|
||||
IMPL_COLOR_PROPERTY(textColorHeading , Welcome_TextColorHeading )
|
||||
IMPL_COLOR_PROPERTY(backgroundColorNormal , Welcome_BackgroundColorNormal )
|
||||
IMPL_COLOR_PROPERTY(dividerColor , Welcome_DividerColor )
|
||||
IMPL_COLOR_PROPERTY(button_BorderColor , Welcome_Button_BorderColor )
|
||||
IMPL_COLOR_PROPERTY(button_TextColorNormal , Welcome_Button_TextColorNormal )
|
||||
IMPL_COLOR_PROPERTY(button_TextColorPressed, Welcome_Button_TextColorPressed)
|
||||
IMPL_COLOR_PROPERTY(link_TextColorNormal , Welcome_Link_TextColorNormal )
|
||||
IMPL_COLOR_PROPERTY(link_TextColorActive , Welcome_Link_TextColorActive )
|
||||
IMPL_COLOR_PROPERTY(link_BackgroundColor , Welcome_Link_BackgroundColor )
|
||||
IMPL_COLOR_PROPERTY(caption_TextColorNormal, Welcome_Caption_TextColorNormal)
|
||||
IMPL_COLOR_PROPERTY(sideBar_BackgroundColor, Welcome_SideBar_BackgroundColor)
|
||||
IMPL_COLOR_PROPERTY(projectItem_TextColorFilepath, Welcome_ProjectItem_TextColorFilepath)
|
||||
IMPL_COLOR_PROPERTY(projectItem_BackgroundColorHover, Welcome_ProjectItem_BackgroundColorHover)
|
||||
IMPL_COLOR_PROPERTY(sessionItem_BackgroundColorNormal, Welcome_SessionItem_BackgroundColorNormal)
|
||||
IMPL_COLOR_PROPERTY(sessionItemExpanded_BackgroundColor, Welcome_SessionItemExpanded_BackgroundColor)
|
||||
IMPL_COLOR_PROPERTY(sessionItem_BackgroundColorHover, Welcome_SessionItem_BackgroundColorHover)
|
||||
|
||||
QGradient WelcomeTheme::button_GradientNormal () const { GRADIENT(Welcome_Button_GradientNormal); }
|
||||
QGradient WelcomeTheme::button_GradientPressed () const { GRADIENT(Welcome_Button_GradientPressed); }
|
||||
@@ -1,87 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Thorben Kroeger <thorbenkroeger@gmail.com>.
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://www.qt.io/licensing. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** 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 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef WELCOMETHEME_H
|
||||
#define WELCOMETHEME_H
|
||||
|
||||
#include "../utils_global.h"
|
||||
|
||||
#include <QStyle>
|
||||
|
||||
#define DECLARE_COLOR_PROPERTY(propName) \
|
||||
Q_PROPERTY(QColor propName READ propName NOTIFY themeChanged) \
|
||||
QColor propName () const;
|
||||
|
||||
/*!
|
||||
* Expose theme properties to QML (for welcomeplugin)
|
||||
*/
|
||||
class QTCREATOR_UTILS_EXPORT WelcomeTheme : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WelcomeTheme(QObject *parent);
|
||||
|
||||
DECLARE_COLOR_PROPERTY(textColorNormal)
|
||||
DECLARE_COLOR_PROPERTY(textColorHeading)
|
||||
DECLARE_COLOR_PROPERTY(backgroundColorNormal)
|
||||
DECLARE_COLOR_PROPERTY(dividerColor)
|
||||
DECLARE_COLOR_PROPERTY(button_BorderColor)
|
||||
DECLARE_COLOR_PROPERTY(button_TextColorNormal)
|
||||
DECLARE_COLOR_PROPERTY(button_TextColorPressed)
|
||||
DECLARE_COLOR_PROPERTY(link_TextColorNormal)
|
||||
DECLARE_COLOR_PROPERTY(link_TextColorActive)
|
||||
DECLARE_COLOR_PROPERTY(link_BackgroundColor)
|
||||
DECLARE_COLOR_PROPERTY(sideBar_BackgroundColor)
|
||||
DECLARE_COLOR_PROPERTY(caption_TextColorNormal)
|
||||
DECLARE_COLOR_PROPERTY(projectItem_TextColorFilepath)
|
||||
DECLARE_COLOR_PROPERTY(projectItem_BackgroundColorHover)
|
||||
DECLARE_COLOR_PROPERTY(sessionItem_BackgroundColorNormal)
|
||||
DECLARE_COLOR_PROPERTY(sessionItemExpanded_BackgroundColor)
|
||||
DECLARE_COLOR_PROPERTY(sessionItem_BackgroundColorHover)
|
||||
|
||||
Q_PROPERTY(QGradient button_GradientNormal READ button_GradientNormal NOTIFY themeChanged)
|
||||
Q_PROPERTY(QGradient button_GradientPressed READ button_GradientPressed NOTIFY themeChanged)
|
||||
|
||||
Q_PROPERTY(QString widgetStyle READ widgetStyle CONSTANT)
|
||||
|
||||
QString widgetStyle() const;
|
||||
|
||||
QGradient button_GradientNormal () const;
|
||||
QGradient button_GradientPressed () const;
|
||||
|
||||
public slots:
|
||||
void notifyThemeChanged();
|
||||
|
||||
signals:
|
||||
void themeChanged();
|
||||
};
|
||||
|
||||
#endif // WELCOMETHEME_H
|
||||
@@ -186,7 +186,7 @@ int TreeModel::columnCount(const QModelIndex &idx) const
|
||||
{
|
||||
checkIndex(idx);
|
||||
if (!idx.isValid())
|
||||
return m_root->rowCount();
|
||||
return m_root->columnCount();
|
||||
if (idx.column() > 0)
|
||||
return 0;
|
||||
return itemFromIndex(idx)->columnCount();
|
||||
|
||||
@@ -93,9 +93,7 @@ SOURCES += $$PWD/environment.cpp \
|
||||
$$PWD/treeviewcombobox.cpp \
|
||||
$$PWD/proxycredentialsdialog.cpp \
|
||||
$$PWD/macroexpander.cpp \
|
||||
$$PWD/theme/theme.cpp \
|
||||
$$PWD/theme/theme_p.cpp \
|
||||
$$PWD/theme/welcometheme.cpp
|
||||
$$PWD/theme/theme.cpp
|
||||
|
||||
win32:SOURCES += $$PWD/consoleprocess_win.cpp
|
||||
else:SOURCES += $$PWD/consoleprocess_unix.cpp
|
||||
@@ -194,8 +192,7 @@ HEADERS += \
|
||||
$$PWD/proxycredentialsdialog.h \
|
||||
$$PWD/macroexpander.h \
|
||||
$$PWD/theme/theme.h \
|
||||
$$PWD/theme/theme_p.h \
|
||||
$$PWD/theme/welcometheme.h
|
||||
$$PWD/theme/theme_p.h
|
||||
|
||||
FORMS += $$PWD/filewizardpage.ui \
|
||||
$$PWD/projectintropage.ui \
|
||||
|
||||
@@ -210,10 +210,7 @@ QtcLibrary {
|
||||
files: [
|
||||
"theme.cpp",
|
||||
"theme.h",
|
||||
"theme_p.cpp",
|
||||
"theme_p.h",
|
||||
"welcometheme.cpp",
|
||||
"welcometheme.h",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
#ifndef fooclienthfoo
|
||||
#define fooclienthfoo
|
||||
|
||||
/***
|
||||
This file is part of avahi.
|
||||
|
||||
avahi 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.
|
||||
|
||||
avahi 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 avahi; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <avahi-common/cdecl.h>
|
||||
#include <avahi-common/address.h>
|
||||
#include <avahi-common/strlst.h>
|
||||
#include <avahi-common/defs.h>
|
||||
#include <avahi-common/watch.h>
|
||||
#include <avahi-common/gccmacro.h>
|
||||
|
||||
/** \file client.h Definitions and functions for the client API over D-Bus */
|
||||
|
||||
AVAHI_C_DECL_BEGIN
|
||||
|
||||
/** A connection context */
|
||||
typedef struct AvahiClient AvahiClient;
|
||||
|
||||
/** States of a client object, a superset of AvahiServerState */
|
||||
typedef enum {
|
||||
AVAHI_CLIENT_S_REGISTERING = AVAHI_SERVER_REGISTERING, /**< Server state: REGISTERING */
|
||||
AVAHI_CLIENT_S_RUNNING = AVAHI_SERVER_RUNNING, /**< Server state: RUNNING */
|
||||
AVAHI_CLIENT_S_COLLISION = AVAHI_SERVER_COLLISION, /**< Server state: COLLISION */
|
||||
AVAHI_CLIENT_FAILURE = 100, /**< Some kind of error happened on the client side */
|
||||
AVAHI_CLIENT_CONNECTING = 101 /**< We're still connecting. This state is only entered when AVAHI_CLIENT_NO_FAIL has been passed to avahi_client_new() and the daemon is not yet available. */
|
||||
} AvahiClientState;
|
||||
|
||||
typedef enum {
|
||||
AVAHI_CLIENT_IGNORE_USER_CONFIG = 1, /**< Don't read user configuration */
|
||||
AVAHI_CLIENT_NO_FAIL = 2 /**< Don't fail if the daemon is not available when avahi_client_new() is called, instead enter AVAHI_CLIENT_CONNECTING state and wait for the daemon to appear */
|
||||
} AvahiClientFlags;
|
||||
|
||||
/** The function prototype for the callback of an AvahiClient */
|
||||
typedef void (*AvahiClientCallback) (
|
||||
AvahiClient *s,
|
||||
AvahiClientState state /**< The new state of the client */,
|
||||
void* userdata /**< The user data that was passed to avahi_client_new() */);
|
||||
|
||||
/** @{ \name Construction and destruction */
|
||||
|
||||
/** Creates a new client instance */
|
||||
AvahiClient* avahi_client_new (
|
||||
const AvahiPoll *poll_api /**< The abstract event loop API to use */,
|
||||
AvahiClientFlags flags /**< Some flags to modify the behaviour of the client library */,
|
||||
AvahiClientCallback callback /**< A callback that is called whenever the state of the client changes. This may be NULL. Please note that this function is called for the first time from within the avahi_client_new() context! Thus, in the callback you should not make use of global variables that are initialized only after your call to avahi_client_new(). A common mistake is to store the AvahiClient pointer returned by avahi_client_new() in a global variable and assume that this global variable already contains the valid pointer when the callback is called for the first time. A work-around for this is to always use the AvahiClient pointer passed to the callback function instead of the global pointer. */,
|
||||
void *userdata /**< Some arbitrary user data pointer that will be passed to the callback function */,
|
||||
int *error /**< If creation of the client fails, this integer will contain the error cause. May be NULL if you aren't interested in the reason why avahi_client_new() failed. */);
|
||||
|
||||
/** Free a client instance. This will automatically free all
|
||||
* associated browser, resolve and entry group objects. All pointers
|
||||
* to such objects become invalid! */
|
||||
void avahi_client_free(AvahiClient *client);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Properties */
|
||||
|
||||
/** Get the version of the server */
|
||||
const char* avahi_client_get_version_string (AvahiClient*);
|
||||
|
||||
/** Get host name */
|
||||
const char* avahi_client_get_host_name (AvahiClient*);
|
||||
|
||||
/** Set host name. \since 0.6.13 */
|
||||
int avahi_client_set_host_name(AvahiClient*, const char *name);
|
||||
|
||||
/** Get domain name */
|
||||
const char* avahi_client_get_domain_name (AvahiClient*);
|
||||
|
||||
/** Get FQDN domain name */
|
||||
const char* avahi_client_get_host_name_fqdn (AvahiClient*);
|
||||
|
||||
/** Get state */
|
||||
AvahiClientState avahi_client_get_state(AvahiClient *client);
|
||||
|
||||
/** @{ \name Error Handling */
|
||||
|
||||
/** Get the last error number. See avahi_strerror() for converting this error code into a human readable string. */
|
||||
int avahi_client_errno (AvahiClient*);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** \cond fulldocs */
|
||||
/** Return the local service cookie. returns AVAHI_SERVICE_COOKIE_INVALID on failure. */
|
||||
uint32_t avahi_client_get_local_service_cookie(AvahiClient *client);
|
||||
/** \endcond */
|
||||
|
||||
/** @{ \name Libc NSS Support */
|
||||
|
||||
/** Return 1 if gethostbyname() supports mDNS lookups, 0 otherwise. \since 0.6.5 */
|
||||
int avahi_nss_support(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
AVAHI_C_DECL_END
|
||||
|
||||
#endif
|
||||
@@ -1,314 +0,0 @@
|
||||
#ifndef fooclientlookuphfoo
|
||||
#define fooclientlookuphfoo
|
||||
|
||||
/***
|
||||
This file is part of avahi.
|
||||
|
||||
avahi 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.
|
||||
|
||||
avahi 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 avahi; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <avahi-common/cdecl.h>
|
||||
#include <avahi-common/address.h>
|
||||
#include <avahi-common/strlst.h>
|
||||
#include <avahi-common/defs.h>
|
||||
#include <avahi-common/watch.h>
|
||||
#include <avahi-common/gccmacro.h>
|
||||
|
||||
#include <avahi-client/client.h>
|
||||
|
||||
/** \file avahi-client/lookup.h Lookup Client API */
|
||||
|
||||
/** \example client-browse-services.c Example how to browse for DNS-SD
|
||||
* services using the client interface to avahi-daemon. */
|
||||
|
||||
AVAHI_C_DECL_BEGIN
|
||||
|
||||
/** @{ \name Domain Browser */
|
||||
|
||||
/** A domain browser object */
|
||||
typedef struct AvahiDomainBrowser AvahiDomainBrowser;
|
||||
|
||||
/** The function prototype for the callback of an AvahiDomainBrowser */
|
||||
typedef void (*AvahiDomainBrowserCallback) (
|
||||
AvahiDomainBrowser *b,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
AvahiBrowserEvent event,
|
||||
const char *domain,
|
||||
AvahiLookupResultFlags flags,
|
||||
void *userdata);
|
||||
|
||||
/** Browse for domains on the local network */
|
||||
AvahiDomainBrowser* avahi_domain_browser_new (
|
||||
AvahiClient *client,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
const char *domain,
|
||||
AvahiDomainBrowserType btype,
|
||||
AvahiLookupFlags flags,
|
||||
AvahiDomainBrowserCallback callback,
|
||||
void *userdata);
|
||||
|
||||
/** Get the parent client of an AvahiDomainBrowser object */
|
||||
AvahiClient* avahi_domain_browser_get_client (AvahiDomainBrowser *);
|
||||
|
||||
/** Cleans up and frees an AvahiDomainBrowser object */
|
||||
int avahi_domain_browser_free (AvahiDomainBrowser *);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Service Browser */
|
||||
|
||||
/** A service browser object */
|
||||
typedef struct AvahiServiceBrowser AvahiServiceBrowser;
|
||||
|
||||
/** The function prototype for the callback of an AvahiServiceBrowser */
|
||||
typedef void (*AvahiServiceBrowserCallback) (
|
||||
AvahiServiceBrowser *b,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
AvahiBrowserEvent event,
|
||||
const char *name,
|
||||
const char *type,
|
||||
const char *domain,
|
||||
AvahiLookupResultFlags flags,
|
||||
void *userdata);
|
||||
|
||||
/** Browse for services of a type on the network. In most cases you
|
||||
* probably want to pass AVAHI_IF_UNSPEC and AVAHI_PROTO_UNSPED in
|
||||
* interface, resp. protocol to browse on all local networks. The
|
||||
* specified callback will be called whenever a new service appears
|
||||
* or is removed from the network. Please note that events may be
|
||||
* collapsed to minimize traffic (i.e. a REMOVED followed by a NEW for
|
||||
* the same service data is dropped because redundant). If you want to
|
||||
* subscribe to service data changes, you should use
|
||||
* avahi_service_resolver_new() and keep it open, in which case you
|
||||
* will be notified via AVAHI_RESOLVE_FOUND everytime the service data
|
||||
* changes. */
|
||||
AvahiServiceBrowser* avahi_service_browser_new (
|
||||
AvahiClient *client,
|
||||
AvahiIfIndex interface, /**< In most cases pass AVAHI_IF_UNSPEC here */
|
||||
AvahiProtocol protocol, /**< In most cases pass AVAHI_PROTO_UNSPEC here */
|
||||
const char *type, /**< A service type such as "_http._tcp" */
|
||||
const char *domain, /**< A domain to browse in. In most cases you want to pass NULL here for the default domain (usually ".local") */
|
||||
AvahiLookupFlags flags,
|
||||
AvahiServiceBrowserCallback callback,
|
||||
void *userdata);
|
||||
|
||||
/** Get the parent client of an AvahiServiceBrowser object */
|
||||
AvahiClient* avahi_service_browser_get_client (AvahiServiceBrowser *);
|
||||
|
||||
/** Cleans up and frees an AvahiServiceBrowser object */
|
||||
int avahi_service_browser_free (AvahiServiceBrowser *);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** \cond fulldocs */
|
||||
/** A service type browser object */
|
||||
typedef struct AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
|
||||
|
||||
/** The function prototype for the callback of an AvahiServiceTypeBrowser */
|
||||
typedef void (*AvahiServiceTypeBrowserCallback) (
|
||||
AvahiServiceTypeBrowser *b,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
AvahiBrowserEvent event,
|
||||
const char *type,
|
||||
const char *domain,
|
||||
AvahiLookupResultFlags flags,
|
||||
void *userdata);
|
||||
|
||||
/** Browse for service types on the local network */
|
||||
AvahiServiceTypeBrowser* avahi_service_type_browser_new (
|
||||
AvahiClient *client,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
const char *domain,
|
||||
AvahiLookupFlags flags,
|
||||
AvahiServiceTypeBrowserCallback callback,
|
||||
void *userdata);
|
||||
|
||||
/** Get the parent client of an AvahiServiceTypeBrowser object */
|
||||
AvahiClient* avahi_service_type_browser_get_client (AvahiServiceTypeBrowser *);
|
||||
|
||||
/** Cleans up and frees an AvahiServiceTypeBrowser object */
|
||||
int avahi_service_type_browser_free (AvahiServiceTypeBrowser *);
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/** @{ \name Service Resolver */
|
||||
|
||||
/** A service resolver object */
|
||||
typedef struct AvahiServiceResolver AvahiServiceResolver;
|
||||
|
||||
/** The function prototype for the callback of an AvahiServiceResolver */
|
||||
typedef void (*AvahiServiceResolverCallback) (
|
||||
AvahiServiceResolver *r,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
AvahiResolverEvent event,
|
||||
const char *name,
|
||||
const char *type,
|
||||
const char *domain,
|
||||
const char *host_name,
|
||||
const AvahiAddress *a,
|
||||
uint16_t port,
|
||||
AvahiStringList *txt,
|
||||
AvahiLookupResultFlags flags,
|
||||
void *userdata);
|
||||
|
||||
/** Create a new service resolver object. Please make sure to pass all
|
||||
* the service data you received via avahi_service_browser_new()'s
|
||||
* callback function, especially interface and protocol. The protocol
|
||||
* argument specifies the protocol (IPv4 or IPv6) to use as transport
|
||||
* for the queries which are sent out by this resolver. The
|
||||
* aprotocol argument specifies the adress family (IPv4 or IPv6) of
|
||||
* the address of the service we are looking for. Generally, on
|
||||
* "protocol" you should only pass what was supplied to you as
|
||||
* parameter to your AvahiServiceBrowserCallback. In "aprotocol" you
|
||||
* should pass what your application code can deal with when
|
||||
* connecting to the service. Or, more technically speaking: protocol
|
||||
* specifies if the mDNS queries should be sent as UDP/IPv4
|
||||
* resp. UDP/IPv6 packets. aprotocol specifies whether the query is for a A
|
||||
* resp. AAAA resource record. */
|
||||
AvahiServiceResolver * avahi_service_resolver_new(
|
||||
AvahiClient *client,
|
||||
AvahiIfIndex interface, /**< Pass the interface argument you received in AvahiServiceBrowserCallback here. */
|
||||
AvahiProtocol protocol, /**< Pass the protocol argument you received in AvahiServiceBrowserCallback here. */
|
||||
const char *name, /**< Pass the name argument you received in AvahiServiceBrowserCallback here. */
|
||||
const char *type, /**< Pass the type argument you received in AvahiServiceBrowserCallback here. */
|
||||
const char *domain, /**< Pass the domain argument you received in AvahiServiceBrowserCallback here. */
|
||||
AvahiProtocol aprotocol, /**< The desired address family of the service address to resolve. AVAHI_PROTO_UNSPEC if your application can deal with both IPv4 and IPv6 */
|
||||
AvahiLookupFlags flags,
|
||||
AvahiServiceResolverCallback callback,
|
||||
void *userdata);
|
||||
|
||||
/** Get the parent client of an AvahiServiceResolver object */
|
||||
AvahiClient* avahi_service_resolver_get_client (AvahiServiceResolver *);
|
||||
|
||||
/** Free a service resolver object */
|
||||
int avahi_service_resolver_free(AvahiServiceResolver *r);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** \cond fulldocs */
|
||||
/** A service resolver object */
|
||||
typedef struct AvahiHostNameResolver AvahiHostNameResolver;
|
||||
|
||||
/** The function prototype for the callback of an AvahiHostNameResolver */
|
||||
typedef void (*AvahiHostNameResolverCallback) (
|
||||
AvahiHostNameResolver *r,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
AvahiResolverEvent event,
|
||||
const char *name,
|
||||
const AvahiAddress *a,
|
||||
AvahiLookupResultFlags flags,
|
||||
void *userdata);
|
||||
|
||||
/** Create a new hostname resolver object */
|
||||
AvahiHostNameResolver * avahi_host_name_resolver_new(
|
||||
AvahiClient *client,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
const char *name,
|
||||
AvahiProtocol aprotocol,
|
||||
AvahiLookupFlags flags,
|
||||
AvahiHostNameResolverCallback callback,
|
||||
void *userdata);
|
||||
|
||||
/** Get the parent client of an AvahiHostNameResolver object */
|
||||
AvahiClient* avahi_host_name_resolver_get_client (AvahiHostNameResolver *);
|
||||
|
||||
/** Free a hostname resolver object */
|
||||
int avahi_host_name_resolver_free(AvahiHostNameResolver *r);
|
||||
|
||||
/** An address resolver object */
|
||||
typedef struct AvahiAddressResolver AvahiAddressResolver;
|
||||
|
||||
/** The function prototype for the callback of an AvahiAddressResolver */
|
||||
typedef void (*AvahiAddressResolverCallback) (
|
||||
AvahiAddressResolver *r,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
AvahiResolverEvent event,
|
||||
const AvahiAddress *a,
|
||||
const char *name,
|
||||
AvahiLookupResultFlags flags,
|
||||
void *userdata);
|
||||
|
||||
/** Create a new address resolver object from an AvahiAddress object */
|
||||
AvahiAddressResolver* avahi_address_resolver_new(
|
||||
AvahiClient *client,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
const AvahiAddress *a,
|
||||
AvahiLookupFlags flags,
|
||||
AvahiAddressResolverCallback callback,
|
||||
void *userdata);
|
||||
|
||||
/** Get the parent client of an AvahiAddressResolver object */
|
||||
AvahiClient* avahi_address_resolver_get_client (AvahiAddressResolver *);
|
||||
|
||||
/** Free a AvahiAddressResolver resolver object */
|
||||
int avahi_address_resolver_free(AvahiAddressResolver *r);
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/** @{ \name Record Browser */
|
||||
|
||||
/** A record browser object */
|
||||
typedef struct AvahiRecordBrowser AvahiRecordBrowser;
|
||||
|
||||
/** The function prototype for the callback of an AvahiRecordBrowser */
|
||||
typedef void (*AvahiRecordBrowserCallback) (
|
||||
AvahiRecordBrowser *b,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
AvahiBrowserEvent event,
|
||||
const char *name,
|
||||
uint16_t clazz,
|
||||
uint16_t type,
|
||||
const void *rdata,
|
||||
size_t size,
|
||||
AvahiLookupResultFlags flags,
|
||||
void *userdata);
|
||||
|
||||
/** Browse for records of a type on the local network */
|
||||
AvahiRecordBrowser* avahi_record_browser_new(
|
||||
AvahiClient *client,
|
||||
AvahiIfIndex interface,
|
||||
AvahiProtocol protocol,
|
||||
const char *name,
|
||||
uint16_t clazz,
|
||||
uint16_t type,
|
||||
AvahiLookupFlags flags,
|
||||
AvahiRecordBrowserCallback callback,
|
||||
void *userdata);
|
||||
|
||||
/** Get the parent client of an AvahiRecordBrowser object */
|
||||
AvahiClient* avahi_record_browser_get_client(AvahiRecordBrowser *);
|
||||
|
||||
/** Cleans up and frees an AvahiRecordBrowser object */
|
||||
int avahi_record_browser_free(AvahiRecordBrowser *);
|
||||
|
||||
/** @} */
|
||||
|
||||
AVAHI_C_DECL_END
|
||||
|
||||
#endif
|
||||
@@ -1,119 +0,0 @@
|
||||
#ifndef fooaddresshfoo
|
||||
#define fooaddresshfoo
|
||||
|
||||
/***
|
||||
This file is part of avahi.
|
||||
|
||||
avahi 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.
|
||||
|
||||
avahi 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 avahi; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
/** \file address.h Definitions and functions to manipulate IP addresses. */
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <avahi-common/cdecl.h>
|
||||
|
||||
AVAHI_C_DECL_BEGIN
|
||||
|
||||
/** Protocol family specification, takes the values AVAHI_PROTO_INET, AVAHI_PROTO_INET6, AVAHI_PROTO_UNSPEC */
|
||||
typedef int AvahiProtocol;
|
||||
|
||||
/** Numeric network interface index. Takes OS dependent values and the special constant AVAHI_IF_UNSPEC */
|
||||
typedef int AvahiIfIndex;
|
||||
|
||||
/** Values for AvahiProtocol */
|
||||
enum {
|
||||
AVAHI_PROTO_INET = 0, /**< IPv4 */
|
||||
AVAHI_PROTO_INET6 = 1, /**< IPv6 */
|
||||
AVAHI_PROTO_UNSPEC = -1 /**< Unspecified/all protocol(s) */
|
||||
};
|
||||
|
||||
/** Special values for AvahiIfIndex */
|
||||
enum {
|
||||
AVAHI_IF_UNSPEC = -1 /**< Unspecified/all interface(s) */
|
||||
};
|
||||
|
||||
/** Maximum size of an address in string form */
|
||||
#define AVAHI_ADDRESS_STR_MAX 40 /* IPv6 Max = 4*8 + 7 + 1 for NUL */
|
||||
|
||||
/** Return TRUE if the specified interface index is valid */
|
||||
#define AVAHI_IF_VALID(ifindex) (((ifindex) >= 0) || ((ifindex) == AVAHI_IF_UNSPEC))
|
||||
|
||||
/** Return TRUE if the specified protocol is valid */
|
||||
#define AVAHI_PROTO_VALID(protocol) (((protocol) == AVAHI_PROTO_INET) || ((protocol) == AVAHI_PROTO_INET6) || ((protocol) == AVAHI_PROTO_UNSPEC))
|
||||
|
||||
/** An IPv4 address */
|
||||
typedef struct AvahiIPv4Address {
|
||||
uint32_t address; /**< Address data in network byte order. */
|
||||
} AvahiIPv4Address;
|
||||
|
||||
/** An IPv6 address */
|
||||
typedef struct AvahiIPv6Address {
|
||||
uint8_t address[16]; /**< Address data */
|
||||
} AvahiIPv6Address;
|
||||
|
||||
/** Protocol (address family) independent address structure */
|
||||
typedef struct AvahiAddress {
|
||||
AvahiProtocol proto; /**< Address family */
|
||||
|
||||
union {
|
||||
AvahiIPv6Address ipv6; /**< Address when IPv6 */
|
||||
AvahiIPv4Address ipv4; /**< Address when IPv4 */
|
||||
uint8_t data[1]; /**< Type-independent data field */
|
||||
} data;
|
||||
} AvahiAddress;
|
||||
|
||||
/** @{ \name Comparison */
|
||||
|
||||
/** Compare two addresses. Returns 0 when equal, a negative value when a < b, a positive value when a > b. */
|
||||
int avahi_address_cmp(const AvahiAddress *a, const AvahiAddress *b);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name String conversion */
|
||||
|
||||
/** Convert the specified address *a to a human readable character string, use AVAHI_ADDRESS_STR_MAX to allocate an array of the right size */
|
||||
char *avahi_address_snprint(char *ret_s, size_t length, const AvahiAddress *a);
|
||||
|
||||
/** Convert the specified human readable character string to an
|
||||
* address structure. Set af to AVAHI_UNSPEC for automatic address
|
||||
* family detection. */
|
||||
AvahiAddress *avahi_address_parse(const char *s, AvahiProtocol af, AvahiAddress *ret_addr);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** \cond fulldocs */
|
||||
/** Generate the DNS reverse lookup name for an IPv4 or IPv6 address. */
|
||||
char* avahi_reverse_lookup_name(const AvahiAddress *a, char *ret_s, size_t length);
|
||||
/** \endcond */
|
||||
|
||||
/** @{ \name Protocol/address family handling */
|
||||
|
||||
/** Map AVAHI_PROTO_xxx constants to Unix AF_xxx constants */
|
||||
int avahi_proto_to_af(AvahiProtocol proto);
|
||||
|
||||
/** Map Unix AF_xxx constants to AVAHI_PROTO_xxx constants */
|
||||
AvahiProtocol avahi_af_to_proto(int af);
|
||||
|
||||
/** Return a textual representation of the specified protocol number. i.e. "IPv4", "IPv6" or "UNSPEC" */
|
||||
const char* avahi_proto_to_string(AvahiProtocol proto);
|
||||
|
||||
/** @} */
|
||||
|
||||
AVAHI_C_DECL_END
|
||||
|
||||
#endif
|
||||
@@ -1,38 +0,0 @@
|
||||
#ifndef foocdeclhfoo
|
||||
#define foocdeclhfoo
|
||||
|
||||
/***
|
||||
This file is part of avahi.
|
||||
|
||||
avahi 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.
|
||||
|
||||
avahi 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 avahi; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
/** \file cdecl.h C++ compatibility */
|
||||
#ifdef __cplusplus
|
||||
/** If using C++ this macro enables C mode, otherwise does nothing */
|
||||
#define AVAHI_C_DECL_BEGIN extern "C" {
|
||||
/** If using C++ this macro switches back to C++ mode, otherwise does nothing */
|
||||
#define AVAHI_C_DECL_END }
|
||||
|
||||
#else
|
||||
/** If using C++ this macro enables C mode, otherwise does nothing */
|
||||
#define AVAHI_C_DECL_BEGIN
|
||||
/** If using C++ this macro switches back to C++ mode, otherwise does nothing */
|
||||
#define AVAHI_C_DECL_END
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,356 +0,0 @@
|
||||
#ifndef foodefshfoo
|
||||
#define foodefshfoo
|
||||
|
||||
/***
|
||||
This file is part of avahi.
|
||||
|
||||
avahi 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.
|
||||
|
||||
avahi 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 avahi; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
/** \file defs.h Some common definitions */
|
||||
|
||||
#include <avahi-common/cdecl.h>
|
||||
|
||||
/** \mainpage
|
||||
*
|
||||
* \section choose_api Choosing an API
|
||||
*
|
||||
* Avahi provides three programming APIs for integration of
|
||||
* mDNS/DNS-SD features into your C progams:
|
||||
*
|
||||
* \li <b>avahi-core</b>: an API for embedding a complete mDNS/DNS-SD stack
|
||||
* into your software. This is intended for developers of embedded
|
||||
* appliances only. We dissuade from using this API in normal desktop
|
||||
* applications since it is not a good idea to run multiple mDNS
|
||||
* stacks simultaneously on the same host.
|
||||
* \li <b>the D-Bus API</b>: an extensive D-Bus interface for browsing and
|
||||
* registering mDNS/DNS-SD services using avahi-daemon. We recommend
|
||||
* using this API for software written in any language other than
|
||||
* C (e.g. Python).
|
||||
* \li <b>avahi-client</b>: a simplifying C wrapper around the D-Bus API. We
|
||||
* recommend using this API in C or C++ progams. The D-Bus internals
|
||||
* are hidden completely.
|
||||
* \li <b>avahi-gobject</b>: an object-oriented C wrapper based on
|
||||
* GLib's GObject. We recommd using this API for GNOME/Gtk programs.
|
||||
*
|
||||
* All three APIs are very similar, however avahi-core is the most powerful.
|
||||
*
|
||||
* In addition to the three APIs described above Avahi supports two
|
||||
* compatibility libraries:
|
||||
*
|
||||
* \li <b>avahi-compat-libdns_sd</b>: the original Bonjour API as documented
|
||||
* in the header file "dns_sd.h" by Apple Computer, Inc.
|
||||
*
|
||||
* \li <b>avahi-compat-howl</b>: the HOWL API as released with HOWL 0.9.8 by
|
||||
* Porchdog Software.
|
||||
*
|
||||
* Please note that these compatibility layers are incomplete and
|
||||
* generally a waste of resources. We strongly encourage everyone to
|
||||
* use our native APIs for newly written programs and to port older
|
||||
* programs to avahi-client!
|
||||
*
|
||||
* The native APIs (avahi-client and avahi-core) can be integrated
|
||||
* into external event loops. We provide adapters for the following
|
||||
* event loop implementations:
|
||||
*
|
||||
* \li <b>avahi-glib</b>: The GLIB main loop as used by GTk+/GNOME
|
||||
*
|
||||
* \li <b>avahi-qt</b>: The Qt main loop as used by Qt/KDE
|
||||
*
|
||||
* Finally, we provide a high-level Gtk+ GUI dialog called
|
||||
* <b>avahi-ui</b> for user-friendly browsing for services.
|
||||
*
|
||||
* The doxygen-generated API documentation covers avahi-client
|
||||
* (including its auxiliary APIs), the event loop adapters and
|
||||
* avahi-ui. For the other APIs please consult the original
|
||||
* documentation (for the compatibility APIs) or the header files.
|
||||
*
|
||||
* Please note that the doxygen-generated API documentation of the
|
||||
* native Avahi API is not complete. A few definitions that are part
|
||||
* of the Avahi API have been removed from this documentation, either
|
||||
* because they are only relevant in a very few low-level applications
|
||||
* or because they are considered obsolete. Please consult the C header
|
||||
* files for all definitions that are part of the Avahi API. Please
|
||||
* note that these hidden definitions are considered part of the Avahi
|
||||
* API and will stay available in the API in the future.
|
||||
*
|
||||
* \section error_reporting Error Reporting
|
||||
*
|
||||
* Some notes on the Avahi error handling:
|
||||
*
|
||||
* - Error codes are negative integers and defined as AVAHI_ERR_xx
|
||||
* - If a function returns some kind of non-negative integer value on
|
||||
* success, a failure is indicated by returning the error code
|
||||
* directly.
|
||||
* - If a function returns a pointer of some kind on success, a
|
||||
* failure is indicated by returning NULL
|
||||
* - The last error number may be retrieved by calling
|
||||
* avahi_client_errno()
|
||||
* - Just like the libc errno variable the Avahi errno is NOT reset to
|
||||
* AVAHI_OK if a function call succeeds.
|
||||
* - You may convert a numeric error code into a human readable string
|
||||
* using avahi_strerror()
|
||||
* - The constructor function avahi_client_new() returns the error
|
||||
* code in a call-by-reference argument
|
||||
*
|
||||
* \section event_loop Event Loop Abstraction
|
||||
*
|
||||
* Avahi uses a simple event loop abstraction layer. A table AvahiPoll
|
||||
* which contains function pointers for user defined timeout and I/O
|
||||
* condition event source implementations needs to be passed to
|
||||
* avahi_client_new(). An adapter for this abstraction layer is
|
||||
* available for the GLib main loop in the object AvahiGLibPoll. A
|
||||
* simple stand-alone implementation is available under the name
|
||||
* AvahiSimplePoll. An adpater for the Qt main loop is available from
|
||||
* avahi_qt_poll_get().
|
||||
*
|
||||
* \section good_publish How to Register Services
|
||||
*
|
||||
* - Subscribe to server state changes. Pass a callback function
|
||||
* pointer to avahi_client_new(). It will be called
|
||||
* whenever the server state changes.
|
||||
* - Only register your services when the server is in state
|
||||
* AVAHI_SERVER_RUNNING. If you register your services in other server
|
||||
* states they might not be accessible since the local host name might not necessarily
|
||||
* be established.
|
||||
* - Remove your services when the server enters
|
||||
* AVAHI_SERVER_COLLISION or AVAHI_SERVER_REGISTERING state. Your
|
||||
* services may not be reachable anymore since the local host name is
|
||||
* no longer established or is currently in the process of being
|
||||
* established.
|
||||
* - When registering services, use the following algorithm:
|
||||
* - Create a new entry group (i.e. avahi_entry_group_new())
|
||||
* - Add your service(s)/additional RRs/subtypes (e.g. avahi_entry_group_add_service())
|
||||
* - Commit the entry group (i.e. avahi_entry_group_commit())
|
||||
* - Subscribe to entry group state changes.
|
||||
* - If the entry group enters AVAHI_ENTRY_GROUP_COLLISION state the
|
||||
* services of the entry group are automatically removed from the
|
||||
* server. You may immediately add your services back to the entry
|
||||
* group (but with new names, perhaps using
|
||||
* avahi_alternative_service_name()) and commit again. Please do not
|
||||
* free the entry group and create a new one. This would inhibit some
|
||||
* traffic limiting algorithms in mDNS.
|
||||
* - When you need to modify your services (i.e. change the TXT data
|
||||
* or the port number), use the AVAHI_PUBLISH_UPDATE flag. Please do
|
||||
* not free the entry group and create a new one. This would inhibit
|
||||
* some traffic limiting algorithms in mDNS. When changing just the
|
||||
* TXT data avahi_entry_group_update_txt() is a shortcut for
|
||||
* AVAHI_PUBLISH_UPDATE. Please note that you cannot use
|
||||
* AVAHI_PUBLISH_UPDATE when changing the service name! Renaming a
|
||||
* DNS-SD service is identical to deleting and creating a new one, and
|
||||
* that's exactly what you should do in that case. First call
|
||||
* avahi_entry_group_reset() to remove it and then read it normally.
|
||||
*
|
||||
* \section good_browse How to Browse for Services
|
||||
*
|
||||
* - For normal applications you need to call avahi_service_browser_new()
|
||||
* for the service type you want to browse for. Use
|
||||
* avahi_service_resolver_new() to acquire service data for a service
|
||||
* name.
|
||||
* - You can use avahi_domain_browser_new() to get a list of announced
|
||||
* browsing domains. Please note that not all domains whith services
|
||||
* on the LAN are mandatorily announced.
|
||||
* - There is no need to subscribe to server state changes.
|
||||
*
|
||||
* \section daemon_dies How to Write a Client That Can Deal with Daemon Restarts
|
||||
*
|
||||
* With Avahi it is possible to write client applications that can
|
||||
* deal with Avahi daemon restarts. To accomplish that make sure to
|
||||
* pass AVAHI_CLIENT_NO_FAIL to avahi_client_new()'s flags
|
||||
* parameter. That way avahi_client_new() will succeed even when the
|
||||
* daemon is not running. In that case the object will enter
|
||||
* AVAHI_CLIENT_CONNECTING state. As soon as the daemon becomes
|
||||
* available the object will enter one of the AVAHI_CLIENT_S_xxx
|
||||
* states. Make sure to not create browsers or entry groups before the
|
||||
* client object has entered one of those states. As usual you will be
|
||||
* informed about state changes with the callback function supplied to
|
||||
* avahi_client_new(). If the client is forced to disconnect from the
|
||||
* server it will enter AVAHI_CLIENT_FAILURE state with
|
||||
* avahi_client_errno() == AVAHI_ERR_DISCONNECTED. Free the
|
||||
* AvahiClient object in that case (and all its associated objects
|
||||
* such as entry groups and browser objects prior to that) and
|
||||
* reconnect to the server anew - again with passing
|
||||
* AVAHI_CLIENT_NO_FAIL to avahi_client_new().
|
||||
*
|
||||
* We encourage implementing this in all software where service
|
||||
* discovery is not an integral part of application. e.g. use it in
|
||||
* all kinds of background daemons, but not necessarily in software
|
||||
* like iChat compatible IM software.
|
||||
*
|
||||
* For now AVAHI_CLIENT_NO_FAIL cannot deal with D-Bus daemon restarts.
|
||||
*
|
||||
* \section domains How to Deal Properly with Browsing Domains
|
||||
*
|
||||
* Due to the introduction of wide-area DNS-SD the correct handling of
|
||||
* domains becomes more important for Avahi enabled applications. All
|
||||
* applications that offer the user a list of services discovered with
|
||||
* Avahi should offer some kind of editable drop down box where the
|
||||
* user can either enter his own domain or select one of those offered
|
||||
* by AvahiDomainBrowser. The default domain to browse should be the
|
||||
* one returned by avahi_client_get_domain_name(). The list of domains
|
||||
* returned by AvahiDomainBrowser is assembled by the browsing domains
|
||||
* configured in the daemon's configuration file, the domains
|
||||
* announced inside the default domain, the domains set with the
|
||||
* environment variable $AVAHI_BROWSE_DOMAINS (colon-seperated) on the
|
||||
* client side and the domains set in the XDG configuration file
|
||||
* ~/.config/avahi/browse-domains on the client side (seperated by
|
||||
* newlines). File managers offering some kind of "Network
|
||||
* Neighborhood" folder should show the entries of the default domain
|
||||
* right inside that and offer subfolders for the browsing domains
|
||||
* returned by AvahiDomainBrowser.
|
||||
*/
|
||||
|
||||
AVAHI_C_DECL_BEGIN
|
||||
|
||||
/** @{ \name States */
|
||||
|
||||
/** States of a server object */
|
||||
typedef enum {
|
||||
AVAHI_SERVER_INVALID, /**< Invalid state (initial) */
|
||||
AVAHI_SERVER_REGISTERING, /**< Host RRs are being registered */
|
||||
AVAHI_SERVER_RUNNING, /**< All host RRs have been established */
|
||||
AVAHI_SERVER_COLLISION, /**< There is a collision with a host RR. All host RRs have been withdrawn, the user should set a new host name via avahi_server_set_host_name() */
|
||||
AVAHI_SERVER_FAILURE /**< Some fatal failure happened, the server is unable to proceed */
|
||||
} AvahiServerState;
|
||||
|
||||
/** States of an entry group object */
|
||||
typedef enum {
|
||||
AVAHI_ENTRY_GROUP_UNCOMMITED, /**< The group has not yet been commited, the user must still call avahi_entry_group_commit() */
|
||||
AVAHI_ENTRY_GROUP_REGISTERING, /**< The entries of the group are currently being registered */
|
||||
AVAHI_ENTRY_GROUP_ESTABLISHED, /**< The entries have successfully been established */
|
||||
AVAHI_ENTRY_GROUP_COLLISION, /**< A name collision for one of the entries in the group has been detected, the entries have been withdrawn */
|
||||
AVAHI_ENTRY_GROUP_FAILURE /**< Some kind of failure happened, the entries have been withdrawn */
|
||||
} AvahiEntryGroupState;
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Flags */
|
||||
|
||||
/** Some flags for publishing functions */
|
||||
typedef enum {
|
||||
AVAHI_PUBLISH_UNIQUE = 1, /**< For raw records: The RRset is intended to be unique */
|
||||
AVAHI_PUBLISH_NO_PROBE = 2, /**< For raw records: Though the RRset is intended to be unique no probes shall be sent */
|
||||
AVAHI_PUBLISH_NO_ANNOUNCE = 4, /**< For raw records: Do not announce this RR to other hosts */
|
||||
AVAHI_PUBLISH_ALLOW_MULTIPLE = 8, /**< For raw records: Allow multiple local records of this type, even if they are intended to be unique */
|
||||
/** \cond fulldocs */
|
||||
AVAHI_PUBLISH_NO_REVERSE = 16, /**< For address records: don't create a reverse (PTR) entry */
|
||||
AVAHI_PUBLISH_NO_COOKIE = 32, /**< For service records: do not implicitly add the local service cookie to TXT data */
|
||||
/** \endcond */
|
||||
AVAHI_PUBLISH_UPDATE = 64, /**< Update existing records instead of adding new ones */
|
||||
/** \cond fulldocs */
|
||||
AVAHI_PUBLISH_USE_WIDE_AREA = 128, /**< Register the record using wide area DNS (i.e. unicast DNS update) */
|
||||
AVAHI_PUBLISH_USE_MULTICAST = 256 /**< Register the record using multicast DNS */
|
||||
/** \endcond */
|
||||
} AvahiPublishFlags;
|
||||
|
||||
/** Some flags for lookup functions */
|
||||
typedef enum {
|
||||
/** \cond fulldocs */
|
||||
AVAHI_LOOKUP_USE_WIDE_AREA = 1, /**< Force lookup via wide area DNS */
|
||||
AVAHI_LOOKUP_USE_MULTICAST = 2, /**< Force lookup via multicast DNS */
|
||||
/** \endcond */
|
||||
AVAHI_LOOKUP_NO_TXT = 4, /**< When doing service resolving, don't lookup TXT record */
|
||||
AVAHI_LOOKUP_NO_ADDRESS = 8 /**< When doing service resolving, don't lookup A/AAAA record */
|
||||
} AvahiLookupFlags;
|
||||
|
||||
/** Some flags for lookup callback functions */
|
||||
typedef enum {
|
||||
AVAHI_LOOKUP_RESULT_CACHED = 1, /**< This response originates from the cache */
|
||||
AVAHI_LOOKUP_RESULT_WIDE_AREA = 2, /**< This response originates from wide area DNS */
|
||||
AVAHI_LOOKUP_RESULT_MULTICAST = 4, /**< This response originates from multicast DNS */
|
||||
AVAHI_LOOKUP_RESULT_LOCAL = 8, /**< This record/service resides on and was announced by the local host. Only available in service and record browsers and only on AVAHI_BROWSER_NEW. */
|
||||
AVAHI_LOOKUP_RESULT_OUR_OWN = 16, /**< This service belongs to the same local client as the browser object. Only available in avahi-client, and only for service browsers and only on AVAHI_BROWSER_NEW. */
|
||||
AVAHI_LOOKUP_RESULT_STATIC = 32 /**< The returned data has been defined statically by some configuration option */
|
||||
} AvahiLookupResultFlags;
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Events */
|
||||
|
||||
/** Type of callback event when browsing */
|
||||
typedef enum {
|
||||
AVAHI_BROWSER_NEW, /**< The object is new on the network */
|
||||
AVAHI_BROWSER_REMOVE, /**< The object has been removed from the network */
|
||||
AVAHI_BROWSER_CACHE_EXHAUSTED, /**< One-time event, to notify the user that all entries from the caches have been sent */
|
||||
AVAHI_BROWSER_ALL_FOR_NOW, /**< One-time event, to notify the user that more records will probably not show up in the near future, i.e. all cache entries have been read and all static servers been queried */
|
||||
AVAHI_BROWSER_FAILURE /**< Browsing failed due to some reason which can be retrieved using avahi_server_errno()/avahi_client_errno() */
|
||||
} AvahiBrowserEvent;
|
||||
|
||||
/** Type of callback event when resolving */
|
||||
typedef enum {
|
||||
AVAHI_RESOLVER_FOUND, /**< RR found, resolving successful */
|
||||
AVAHI_RESOLVER_FAILURE /**< Resolving failed due to some reason which can be retrieved using avahi_server_errno()/avahi_client_errno() */
|
||||
} AvahiResolverEvent;
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Other definitions */
|
||||
|
||||
/** The type of domain to browse for */
|
||||
typedef enum {
|
||||
AVAHI_DOMAIN_BROWSER_BROWSE, /**< Browse for a list of available browsing domains */
|
||||
AVAHI_DOMAIN_BROWSER_BROWSE_DEFAULT, /**< Browse for the default browsing domain */
|
||||
AVAHI_DOMAIN_BROWSER_REGISTER, /**< Browse for a list of available registering domains */
|
||||
AVAHI_DOMAIN_BROWSER_REGISTER_DEFAULT, /**< Browse for the default registering domain */
|
||||
AVAHI_DOMAIN_BROWSER_BROWSE_LEGACY, /**< Legacy browse domain - see DNS-SD spec for more information */
|
||||
AVAHI_DOMAIN_BROWSER_MAX
|
||||
} AvahiDomainBrowserType;
|
||||
|
||||
/** @} */
|
||||
|
||||
/** \cond fulldocs */
|
||||
/** For every service a special TXT item is implicitly added, which
|
||||
* contains a random cookie which is private to the local daemon. This
|
||||
* can be used by clients to determine if two services on two
|
||||
* different subnets are effectively the same. */
|
||||
#define AVAHI_SERVICE_COOKIE "org.freedesktop.Avahi.cookie"
|
||||
|
||||
/** In invalid cookie as special value */
|
||||
#define AVAHI_SERVICE_COOKIE_INVALID (0)
|
||||
/** \endcond fulldocs */
|
||||
|
||||
/** @{ \name DNS RR definitions */
|
||||
|
||||
/** DNS record types, see RFC 1035 */
|
||||
enum {
|
||||
AVAHI_DNS_TYPE_A = 0x01,
|
||||
AVAHI_DNS_TYPE_NS = 0x02,
|
||||
AVAHI_DNS_TYPE_CNAME = 0x05,
|
||||
AVAHI_DNS_TYPE_SOA = 0x06,
|
||||
AVAHI_DNS_TYPE_PTR = 0x0C,
|
||||
AVAHI_DNS_TYPE_HINFO = 0x0D,
|
||||
AVAHI_DNS_TYPE_MX = 0x0F,
|
||||
AVAHI_DNS_TYPE_TXT = 0x10,
|
||||
AVAHI_DNS_TYPE_AAAA = 0x1C,
|
||||
AVAHI_DNS_TYPE_SRV = 0x21
|
||||
};
|
||||
|
||||
/** DNS record classes, see RFC 1035 */
|
||||
enum {
|
||||
AVAHI_DNS_CLASS_IN = 0x01 /**< Probably the only class we will ever use */
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
||||
/** The default TTL for RRs which contain a host name of some kind. */
|
||||
#define AVAHI_DEFAULT_TTL_HOST_NAME (120)
|
||||
|
||||
/** The default TTL for all other records. */
|
||||
#define AVAHI_DEFAULT_TTL (75*60)
|
||||
|
||||
AVAHI_C_DECL_END
|
||||
|
||||
#endif
|
||||
@@ -1,107 +0,0 @@
|
||||
#ifndef fooerrorhfoo
|
||||
#define fooerrorhfoo
|
||||
|
||||
/***
|
||||
This file is part of avahi.
|
||||
|
||||
avahi 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.
|
||||
|
||||
avahi 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 avahi; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
/** \file error.h Error codes and auxiliary functions */
|
||||
|
||||
#include <avahi-common/cdecl.h>
|
||||
|
||||
AVAHI_C_DECL_BEGIN
|
||||
|
||||
/** Error codes used by avahi */
|
||||
enum {
|
||||
AVAHI_OK = 0, /**< OK */
|
||||
AVAHI_ERR_FAILURE = -1, /**< Generic error code */
|
||||
AVAHI_ERR_BAD_STATE = -2, /**< Object was in a bad state */
|
||||
AVAHI_ERR_INVALID_HOST_NAME = -3, /**< Invalid host name */
|
||||
AVAHI_ERR_INVALID_DOMAIN_NAME = -4, /**< Invalid domain name */
|
||||
AVAHI_ERR_NO_NETWORK = -5, /**< No suitable network protocol available */
|
||||
AVAHI_ERR_INVALID_TTL = -6, /**< Invalid DNS TTL */
|
||||
AVAHI_ERR_IS_PATTERN = -7, /**< RR key is pattern */
|
||||
AVAHI_ERR_COLLISION = -8, /**< Name collision */
|
||||
AVAHI_ERR_INVALID_RECORD = -9, /**< Invalid RR */
|
||||
|
||||
AVAHI_ERR_INVALID_SERVICE_NAME = -10, /**< Invalid service name */
|
||||
AVAHI_ERR_INVALID_SERVICE_TYPE = -11, /**< Invalid service type */
|
||||
AVAHI_ERR_INVALID_PORT = -12, /**< Invalid port number */
|
||||
AVAHI_ERR_INVALID_KEY = -13, /**< Invalid key */
|
||||
AVAHI_ERR_INVALID_ADDRESS = -14, /**< Invalid address */
|
||||
AVAHI_ERR_TIMEOUT = -15, /**< Timeout reached */
|
||||
AVAHI_ERR_TOO_MANY_CLIENTS = -16, /**< Too many clients */
|
||||
AVAHI_ERR_TOO_MANY_OBJECTS = -17, /**< Too many objects */
|
||||
AVAHI_ERR_TOO_MANY_ENTRIES = -18, /**< Too many entries */
|
||||
AVAHI_ERR_OS = -19, /**< OS error */
|
||||
|
||||
AVAHI_ERR_ACCESS_DENIED = -20, /**< Access denied */
|
||||
AVAHI_ERR_INVALID_OPERATION = -21, /**< Invalid operation */
|
||||
AVAHI_ERR_DBUS_ERROR = -22, /**< An unexpected D-Bus error occured */
|
||||
AVAHI_ERR_DISCONNECTED = -23, /**< Daemon connection failed */
|
||||
AVAHI_ERR_NO_MEMORY = -24, /**< Memory exhausted */
|
||||
AVAHI_ERR_INVALID_OBJECT = -25, /**< The object passed to this function was invalid */
|
||||
AVAHI_ERR_NO_DAEMON = -26, /**< Daemon not running */
|
||||
AVAHI_ERR_INVALID_INTERFACE = -27, /**< Invalid interface */
|
||||
AVAHI_ERR_INVALID_PROTOCOL = -28, /**< Invalid protocol */
|
||||
AVAHI_ERR_INVALID_FLAGS = -29, /**< Invalid flags */
|
||||
|
||||
AVAHI_ERR_NOT_FOUND = -30, /**< Not found */
|
||||
AVAHI_ERR_INVALID_CONFIG = -31, /**< Configuration error */
|
||||
AVAHI_ERR_VERSION_MISMATCH = -32, /**< Verson mismatch */
|
||||
AVAHI_ERR_INVALID_SERVICE_SUBTYPE = -33, /**< Invalid service subtype */
|
||||
AVAHI_ERR_INVALID_PACKET = -34, /**< Invalid packet */
|
||||
AVAHI_ERR_INVALID_DNS_ERROR = -35, /**< Invlaid DNS return code */
|
||||
AVAHI_ERR_DNS_FORMERR = -36, /**< DNS Error: Form error */
|
||||
AVAHI_ERR_DNS_SERVFAIL = -37, /**< DNS Error: Server Failure */
|
||||
AVAHI_ERR_DNS_NXDOMAIN = -38, /**< DNS Error: No such domain */
|
||||
AVAHI_ERR_DNS_NOTIMP = -39, /**< DNS Error: Not implemented */
|
||||
|
||||
AVAHI_ERR_DNS_REFUSED = -40, /**< DNS Error: Operation refused */
|
||||
AVAHI_ERR_DNS_YXDOMAIN = -41,
|
||||
AVAHI_ERR_DNS_YXRRSET = -42,
|
||||
AVAHI_ERR_DNS_NXRRSET = -43,
|
||||
AVAHI_ERR_DNS_NOTAUTH = -44, /**< DNS Error: Not authorized */
|
||||
AVAHI_ERR_DNS_NOTZONE = -45,
|
||||
AVAHI_ERR_INVALID_RDATA = -46, /**< Invalid RDATA */
|
||||
AVAHI_ERR_INVALID_DNS_CLASS = -47, /**< Invalid DNS class */
|
||||
AVAHI_ERR_INVALID_DNS_TYPE = -48, /**< Invalid DNS type */
|
||||
AVAHI_ERR_NOT_SUPPORTED = -49, /**< Not supported */
|
||||
|
||||
AVAHI_ERR_NOT_PERMITTED = -50, /**< Operation not permitted */
|
||||
AVAHI_ERR_INVALID_ARGUMENT = -51, /**< Invalid argument */
|
||||
AVAHI_ERR_IS_EMPTY = -52, /**< Is empty */
|
||||
AVAHI_ERR_NO_CHANGE = -53, /**< The requested operation is invalid because it is redundant */
|
||||
|
||||
/****
|
||||
**** IF YOU ADD A NEW ERROR CODE HERE, PLEASE DON'T FORGET TO ADD
|
||||
**** IT TO THE STRING ARRAY IN avahi_strerror() IN error.c AND
|
||||
**** TO THE ARRAY IN dbus.c AND FINALLY TO dbus.h!
|
||||
****
|
||||
**** Also remember to update the MAX value below.
|
||||
****/
|
||||
|
||||
AVAHI_ERR_MAX = -54
|
||||
};
|
||||
|
||||
/** Return a human readable error string for the specified error code */
|
||||
const char *avahi_strerror(int error);
|
||||
|
||||
AVAHI_C_DECL_END
|
||||
|
||||
#endif
|
||||
@@ -1,74 +0,0 @@
|
||||
#ifndef foogccmacrohfoo
|
||||
#define foogccmacrohfoo
|
||||
|
||||
/***
|
||||
This file is part of avahi.
|
||||
|
||||
avahi 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.
|
||||
|
||||
avahi 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 avahi; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
/** \file gccmacro.h Defines some macros for GCC extensions */
|
||||
|
||||
#include <avahi-common/cdecl.h>
|
||||
|
||||
AVAHI_C_DECL_BEGIN
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
|
||||
#define AVAHI_GCC_ALLOC_SIZE(x) __attribute__ ((__alloc_size__(x)))
|
||||
#define AVAHI_GCC_ALLOC_SIZE2(x,y) __attribute__ ((__alloc_size__(x,y)))
|
||||
#else
|
||||
/** Macro for usage of GCC's alloc_size attribute */
|
||||
#define AVAHI_GCC_ALLOC_SIZE(x)
|
||||
#define AVAHI_GCC_ALLOC_SIZE2(x,y)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
#define AVAHI_GCC_SENTINEL __attribute__ ((sentinel))
|
||||
#else
|
||||
/** Macro for usage of GCC's sentinel compilation warnings */
|
||||
#define AVAHI_GCC_SENTINEL
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define AVAHI_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b)))
|
||||
#else
|
||||
/** Macro for usage of GCC's printf compilation warnings */
|
||||
#define AVAHI_GCC_PRINTF_ATTR(a,b)
|
||||
#endif
|
||||
|
||||
/** Same as AVAHI_GCC_PRINTF_ATTR but hard coded to arguments 1 and 2 */
|
||||
#define AVAHI_GCC_PRINTF_ATTR12 AVAHI_GCC_PRINTF_ATTR(1,2)
|
||||
|
||||
/** Same as AVAHI_GCC_PRINTF_ATTR but hard coded to arguments 2 and 3 */
|
||||
#define AVAHI_GCC_PRINTF_ATTR23 AVAHI_GCC_PRINTF_ATTR(2,3)
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define AVAHI_GCC_NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
/** Macro for no-return functions */
|
||||
#define AVAHI_GCC_NORETURN
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define AVAHI_GCC_UNUSED __attribute__ ((unused))
|
||||
#else
|
||||
/** Macro for not used parameter */
|
||||
#define AVAHI_GCC_UNUSED
|
||||
#endif
|
||||
|
||||
AVAHI_C_DECL_END
|
||||
|
||||
#endif
|
||||
@@ -1,96 +0,0 @@
|
||||
#ifndef foomallochfoo
|
||||
#define foomallochfoo
|
||||
|
||||
/***
|
||||
This file is part of avahi.
|
||||
|
||||
avahi 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.
|
||||
|
||||
avahi 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 avahi; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
/** \file malloc.h Memory allocation */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <avahi-common/cdecl.h>
|
||||
#include <avahi-common/gccmacro.h>
|
||||
|
||||
AVAHI_C_DECL_BEGIN
|
||||
|
||||
/** Allocate some memory, just like the libc malloc() */
|
||||
void *avahi_malloc(size_t size) AVAHI_GCC_ALLOC_SIZE(1);
|
||||
|
||||
/** Similar to avahi_malloc() but set the memory to zero */
|
||||
void *avahi_malloc0(size_t size) AVAHI_GCC_ALLOC_SIZE(1);
|
||||
|
||||
/** Free some memory */
|
||||
void avahi_free(void *p);
|
||||
|
||||
/** Similar to libc's realloc() */
|
||||
void *avahi_realloc(void *p, size_t size) AVAHI_GCC_ALLOC_SIZE(2);
|
||||
|
||||
/** Internal helper for avahi_new() */
|
||||
static inline void* AVAHI_GCC_ALLOC_SIZE2(1,2) avahi_new_internal(unsigned n, size_t k) {
|
||||
assert(n < INT_MAX/k);
|
||||
return avahi_malloc(n*k);
|
||||
}
|
||||
|
||||
/** Allocate n new structures of the specified type. */
|
||||
#define avahi_new(type, n) ((type*) avahi_new_internal((n), sizeof(type)))
|
||||
|
||||
/** Internal helper for avahi_new0() */
|
||||
static inline void* AVAHI_GCC_ALLOC_SIZE2(1,2) avahi_new0_internal(unsigned n, size_t k) {
|
||||
assert(n < INT_MAX/k);
|
||||
return avahi_malloc0(n*k);
|
||||
}
|
||||
|
||||
/** Same as avahi_new() but set the memory to zero */
|
||||
#define avahi_new0(type, n) ((type*) avahi_new0_internal((n), sizeof(type)))
|
||||
|
||||
/** Just like libc's strdup() */
|
||||
char *avahi_strdup(const char *s);
|
||||
|
||||
/** Just like libc's strndup() */
|
||||
char *avahi_strndup(const char *s, size_t l);
|
||||
|
||||
/** Duplicate the given memory block into a new one allocated with avahi_malloc() */
|
||||
void *avahi_memdup(const void *s, size_t l) AVAHI_GCC_ALLOC_SIZE(2);
|
||||
|
||||
/** Wraps allocator functions */
|
||||
typedef struct AvahiAllocator {
|
||||
void* (*malloc)(size_t size) AVAHI_GCC_ALLOC_SIZE(1);
|
||||
void (*free)(void *p);
|
||||
void* (*realloc)(void *p, size_t size) AVAHI_GCC_ALLOC_SIZE(2);
|
||||
void* (*calloc)(size_t nmemb, size_t size) AVAHI_GCC_ALLOC_SIZE2(1,2); /**< May be NULL */
|
||||
} AvahiAllocator;
|
||||
|
||||
/** Change the allocator. May be NULL to return to default (libc)
|
||||
* allocators. The structure is not copied! */
|
||||
void avahi_set_allocator(const AvahiAllocator *a);
|
||||
|
||||
/** Like sprintf() but store the result in a freshly allocated buffer. Free this with avahi_free() */
|
||||
char *avahi_strdup_printf(const char *fmt, ... ) AVAHI_GCC_PRINTF_ATTR12;
|
||||
|
||||
/** \cond fulldocs */
|
||||
/** Same as avahi_strdup_printf() but take a va_list instead of varargs */
|
||||
char *avahi_strdup_vprintf(const char *fmt, va_list ap);
|
||||
/** \endcond */
|
||||
|
||||
AVAHI_C_DECL_END
|
||||
|
||||
#endif
|
||||
@@ -1,85 +0,0 @@
|
||||
#ifndef foosimplewatchhfoo
|
||||
#define foosimplewatchhfoo
|
||||
|
||||
/***
|
||||
This file is part of avahi.
|
||||
|
||||
avahi 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.
|
||||
|
||||
avahi 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 avahi; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
/** \file simple-watch.h Simple poll() based main loop implementation */
|
||||
|
||||
#include <sys/poll.h>
|
||||
#include <avahi-common/cdecl.h>
|
||||
#include <avahi-common/watch.h>
|
||||
|
||||
AVAHI_C_DECL_BEGIN
|
||||
|
||||
/** A main loop object. Main loops of this type aren't very flexible
|
||||
* since they only support a single wakeup type. Nevertheless it
|
||||
* should suffice for small test and example applications. */
|
||||
typedef struct AvahiSimplePoll AvahiSimplePoll;
|
||||
|
||||
/** Create a new main loop object */
|
||||
AvahiSimplePoll *avahi_simple_poll_new(void);
|
||||
|
||||
/** Free a main loop object */
|
||||
void avahi_simple_poll_free(AvahiSimplePoll *s);
|
||||
|
||||
/** Return the abstracted poll API object for this main loop
|
||||
* object. The is will return the same pointer each time it is
|
||||
* called. */
|
||||
const AvahiPoll* avahi_simple_poll_get(AvahiSimplePoll *s);
|
||||
|
||||
/** Run a single main loop iteration of this main loop. If sleep_time
|
||||
is < 0 this will block until any of the registered events happens,
|
||||
then it will execute the attached callback function. If sleep_time is
|
||||
0 the routine just checks if any event is pending. If yes the attached
|
||||
callback function is called, otherwise the function returns
|
||||
immediately. If sleep_time > 0 the function will block for at most the
|
||||
specified time in msecs. Returns -1 on error, 0 on success and 1 if a
|
||||
quit request has been scheduled. Usually this function should be called
|
||||
in a loop until it returns a non-zero value*/
|
||||
int avahi_simple_poll_iterate(AvahiSimplePoll *s, int sleep_time);
|
||||
|
||||
/** Request that the main loop quits. If this is called the next
|
||||
call to avahi_simple_poll_iterate() will return 1 */
|
||||
void avahi_simple_poll_quit(AvahiSimplePoll *s);
|
||||
|
||||
/** Prototype for a poll() type function */
|
||||
typedef int (*AvahiPollFunc)(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata);
|
||||
|
||||
/** Replace the internally used poll() function. By default the system's poll() will be used */
|
||||
void avahi_simple_poll_set_func(AvahiSimplePoll *s, AvahiPollFunc func, void *userdata);
|
||||
|
||||
/** The first stage of avahi_simple_poll_iterate(), use this function only if you know what you do */
|
||||
int avahi_simple_poll_prepare(AvahiSimplePoll *s, int timeout);
|
||||
|
||||
/** The second stage of avahi_simple_poll_iterate(), use this function only if you know what you do */
|
||||
int avahi_simple_poll_run(AvahiSimplePoll *s);
|
||||
|
||||
/** The third and final stage of avahi_simple_poll_iterate(), use this function only if you know what you do */
|
||||
int avahi_simple_poll_dispatch(AvahiSimplePoll *s);
|
||||
|
||||
/** Call avahi_simple_poll_iterate() in a loop and return if it returns non-zero */
|
||||
int avahi_simple_poll_loop(AvahiSimplePoll *s);
|
||||
|
||||
/** Wakeup the main loop. (for threaded environments) */
|
||||
void avahi_simple_poll_wakeup(AvahiSimplePoll *s);
|
||||
|
||||
AVAHI_C_DECL_END
|
||||
|
||||
#endif
|
||||
@@ -1,180 +0,0 @@
|
||||
#ifndef footxtlisthfoo
|
||||
#define footxtlisthfoo
|
||||
|
||||
/***
|
||||
This file is part of avahi.
|
||||
|
||||
avahi 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.
|
||||
|
||||
avahi 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 avahi; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
/** \file strlst.h Implementation of a data type to store lists of strings */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <avahi-common/cdecl.h>
|
||||
#include <avahi-common/gccmacro.h>
|
||||
|
||||
AVAHI_C_DECL_BEGIN
|
||||
|
||||
/** Linked list of strings that can contain any number of binary
|
||||
* characters, including NUL bytes. An empty list is created by
|
||||
* assigning a NULL to a pointer to AvahiStringList. The string list
|
||||
* is stored in reverse order, so that appending to the string list is
|
||||
* effectively a prepending to the linked list. This object is used
|
||||
* primarily for storing DNS TXT record data. */
|
||||
typedef struct AvahiStringList {
|
||||
struct AvahiStringList *next; /**< Pointer to the next linked list element */
|
||||
size_t size; /**< Size of text[] */
|
||||
uint8_t text[1]; /**< Character data */
|
||||
} AvahiStringList;
|
||||
|
||||
/** @{ \name Construction and destruction */
|
||||
|
||||
/** Create a new string list by taking a variable list of NUL
|
||||
* terminated strings. The strings are copied using g_strdup(). The
|
||||
* argument list must be terminated by a NULL pointer. */
|
||||
AvahiStringList *avahi_string_list_new(const char *txt, ...) AVAHI_GCC_SENTINEL;
|
||||
|
||||
/** \cond fulldocs */
|
||||
/** Same as avahi_string_list_new() but pass a va_list structure */
|
||||
AvahiStringList *avahi_string_list_new_va(va_list va);
|
||||
/** \endcond */
|
||||
|
||||
/** Create a new string list from a string array. The strings are
|
||||
* copied using g_strdup(). length should contain the length of the
|
||||
* array, or -1 if the array is NULL terminated*/
|
||||
AvahiStringList *avahi_string_list_new_from_array(const char **array, int length);
|
||||
|
||||
/** Free a string list */
|
||||
void avahi_string_list_free(AvahiStringList *l);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Adding strings */
|
||||
|
||||
/** Append a NUL terminated string to the specified string list. The
|
||||
* passed string is copied using g_strdup(). Returns the new list
|
||||
* start. */
|
||||
AvahiStringList *avahi_string_list_add(AvahiStringList *l, const char *text);
|
||||
|
||||
/** Append a new NUL terminated formatted string to the specified string list */
|
||||
AvahiStringList *avahi_string_list_add_printf(AvahiStringList *l, const char *format, ...) AVAHI_GCC_PRINTF_ATTR23;
|
||||
|
||||
/** \cond fulldocs */
|
||||
/** Append a new NUL terminated formatted string to the specified string list */
|
||||
AvahiStringList *avahi_string_list_add_vprintf(AvahiStringList *l, const char *format, va_list va);
|
||||
/** \endcond */
|
||||
|
||||
/** Append an arbitrary length byte string to the list. Returns the
|
||||
* new list start. */
|
||||
AvahiStringList *avahi_string_list_add_arbitrary(AvahiStringList *l, const uint8_t *text, size_t size);
|
||||
|
||||
/** Append a new entry to the string list. The string is not filled
|
||||
with data. The caller should fill in string data afterwards by writing
|
||||
it to l->text, where l is the pointer returned by this function. This
|
||||
function exists solely to optimize a few operations where otherwise
|
||||
superfluous string copying would be necessary. */
|
||||
AvahiStringList*avahi_string_list_add_anonymous(AvahiStringList *l, size_t size);
|
||||
|
||||
/** Same as avahi_string_list_add(), but takes a variable number of
|
||||
* NUL terminated strings. The argument list must be terminated by a
|
||||
* NULL pointer. Returns the new list start. */
|
||||
AvahiStringList *avahi_string_list_add_many(AvahiStringList *r, ...) AVAHI_GCC_SENTINEL;
|
||||
|
||||
/** \cond fulldocs */
|
||||
/** Same as avahi_string_list_add_many(), but use a va_list
|
||||
* structure. Returns the new list start. */
|
||||
AvahiStringList *avahi_string_list_add_many_va(AvahiStringList *r, va_list va);
|
||||
/** \endcond */
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name String list operations */
|
||||
|
||||
/** Convert the string list object to a single character string,
|
||||
* seperated by spaces and enclosed in "". avahi_free() the result! This
|
||||
* function doesn't work well with strings that contain NUL bytes. */
|
||||
char* avahi_string_list_to_string(AvahiStringList *l);
|
||||
|
||||
/** \cond fulldocs */
|
||||
/** Serialize the string list object in a way that is compatible with
|
||||
* the storing of DNS TXT records. Strings longer than 255 bytes are truncated. */
|
||||
size_t avahi_string_list_serialize(AvahiStringList *l, void * data, size_t size);
|
||||
|
||||
/** Inverse of avahi_string_list_serialize() */
|
||||
int avahi_string_list_parse(const void *data, size_t size, AvahiStringList **ret);
|
||||
/** \endcond */
|
||||
|
||||
/** Compare to string lists */
|
||||
int avahi_string_list_equal(const AvahiStringList *a, const AvahiStringList *b);
|
||||
|
||||
/** Copy a string list */
|
||||
AvahiStringList *avahi_string_list_copy(const AvahiStringList *l);
|
||||
|
||||
/** Reverse the string list. */
|
||||
AvahiStringList* avahi_string_list_reverse(AvahiStringList *l);
|
||||
|
||||
/** Return the number of elements in the string list */
|
||||
unsigned avahi_string_list_length(const AvahiStringList *l);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name Accessing items */
|
||||
|
||||
/** Returns the next item in the string list */
|
||||
AvahiStringList *avahi_string_list_get_next(AvahiStringList *l);
|
||||
|
||||
/** Returns the text for the current item */
|
||||
uint8_t *avahi_string_list_get_text(AvahiStringList *l);
|
||||
|
||||
/** Returns the size of the current text */
|
||||
size_t avahi_string_list_get_size(AvahiStringList *l);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @{ \name DNS-SD TXT pair handling */
|
||||
|
||||
/** Find the string list entry for the given DNS-SD TXT key */
|
||||
AvahiStringList *avahi_string_list_find(AvahiStringList *l, const char *key);
|
||||
|
||||
/** Return the DNS-SD TXT key and value for the specified string list
|
||||
* item. If size is not NULL it will be filled with the length of
|
||||
* value. (for strings containing NUL bytes). If the entry doesn't
|
||||
* contain a value *value will be set to NULL. You need to
|
||||
* avahi_free() the strings returned in *key and *value. */
|
||||
int avahi_string_list_get_pair(AvahiStringList *l, char **key, char **value, size_t *size);
|
||||
|
||||
/** Add a new DNS-SD TXT key value pair to the string list. value may
|
||||
* be NULL in case you want to specify a key without a value */
|
||||
AvahiStringList *avahi_string_list_add_pair(AvahiStringList *l, const char *key, const char *value);
|
||||
|
||||
/** Same as avahi_string_list_add_pair() but allow strings containing NUL bytes in *value. */
|
||||
AvahiStringList *avahi_string_list_add_pair_arbitrary(AvahiStringList *l, const char *key, const uint8_t *value, size_t size);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** \cond fulldocs */
|
||||
/** Try to find a magic service cookie in the specified DNS-SD string
|
||||
* list. Or return AVAHI_SERVICE_COOKIE_INVALID if none is found. */
|
||||
uint32_t avahi_string_list_get_service_cookie(AvahiStringList *l);
|
||||
/** \endcond */
|
||||
|
||||
AVAHI_C_DECL_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
#ifndef foowatchhfoo
|
||||
#define foowatchhfoo
|
||||
|
||||
/***
|
||||
This file is part of avahi.
|
||||
|
||||
avahi 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.
|
||||
|
||||
avahi 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 avahi; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
/** \file watch.h Simplistic main loop abstraction */
|
||||
|
||||
#include <sys/poll.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <avahi-common/cdecl.h>
|
||||
|
||||
AVAHI_C_DECL_BEGIN
|
||||
|
||||
/** An I/O watch object */
|
||||
typedef struct AvahiWatch AvahiWatch;
|
||||
|
||||
/** A timeout watch object */
|
||||
typedef struct AvahiTimeout AvahiTimeout;
|
||||
|
||||
/** An event polling abstraction object */
|
||||
typedef struct AvahiPoll AvahiPoll;
|
||||
|
||||
/** Type of watch events */
|
||||
typedef enum {
|
||||
AVAHI_WATCH_IN = POLLIN, /**< Input event */
|
||||
AVAHI_WATCH_OUT = POLLOUT, /**< Output event */
|
||||
AVAHI_WATCH_ERR = POLLERR, /**< Error event */
|
||||
AVAHI_WATCH_HUP = POLLHUP /**< Hangup event */
|
||||
} AvahiWatchEvent;
|
||||
|
||||
/** Called whenever an I/O event happens on an I/O watch */
|
||||
typedef void (*AvahiWatchCallback)(AvahiWatch *w, int fd, AvahiWatchEvent event, void *userdata);
|
||||
|
||||
/** Called when the timeout is reached */
|
||||
typedef void (*AvahiTimeoutCallback)(AvahiTimeout *t, void *userdata);
|
||||
|
||||
/** Defines an abstracted event polling API. This may be used to
|
||||
connect Avahi to other main loops. This is loosely based on Unix
|
||||
poll(2). A consumer will call watch_new() for all file descriptors it
|
||||
wants to listen for events on. In addition he can call timeout_new()
|
||||
to define time based events .*/
|
||||
struct AvahiPoll {
|
||||
|
||||
/** Some abstract user data usable by the provider of the API */
|
||||
void* userdata;
|
||||
|
||||
/** Create a new watch for the specified file descriptor and for
|
||||
* the specified events. The API will call the callback function
|
||||
* whenever any of the events happens. */
|
||||
AvahiWatch* (*watch_new)(const AvahiPoll *api, int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void *userdata);
|
||||
|
||||
/** Update the events to wait for. It is safe to call this function from an AvahiWatchCallback */
|
||||
void (*watch_update)(AvahiWatch *w, AvahiWatchEvent event);
|
||||
|
||||
/** Return the events that happened. It is safe to call this function from an AvahiWatchCallback */
|
||||
AvahiWatchEvent (*watch_get_events)(AvahiWatch *w);
|
||||
|
||||
/** Free a watch. It is safe to call this function from an AvahiWatchCallback */
|
||||
void (*watch_free)(AvahiWatch *w);
|
||||
|
||||
/** Set a wakeup time for the polling loop. The API will call the
|
||||
callback function when the absolute time *tv is reached. If tv is
|
||||
NULL, the timeout is disabled. After the timeout expired the
|
||||
callback function will be called and the timeout is disabled. You
|
||||
can reenable it by calling timeout_update() */
|
||||
AvahiTimeout* (*timeout_new)(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata);
|
||||
|
||||
/** Update the absolute expiration time for a timeout, If tv is
|
||||
* NULL, the timeout is disabled. It is safe to call this function from an AvahiTimeoutCallback */
|
||||
void (*timeout_update)(AvahiTimeout *, const struct timeval *tv);
|
||||
|
||||
/** Free a timeout. It is safe to call this function from an AvahiTimeoutCallback */
|
||||
void (*timeout_free)(AvahiTimeout *t);
|
||||
};
|
||||
|
||||
AVAHI_C_DECL_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,570 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://www.qt.io/licensing. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** 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 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "servicebrowser.h"
|
||||
#include "servicebrowser_p.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QDebug>
|
||||
#include <QLibrary>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#define AVAHI_LIB
|
||||
#endif
|
||||
|
||||
#ifdef AVAHI_LIB
|
||||
|
||||
#include <avahi-client/client.h>
|
||||
#include <avahi-client/lookup.h>
|
||||
|
||||
#include <avahi-common/simple-watch.h>
|
||||
#include <avahi-common/malloc.h>
|
||||
#include <avahi-common/error.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <sys/poll.h>
|
||||
|
||||
namespace ZeroConf {
|
||||
namespace Internal {
|
||||
|
||||
extern "C" void cAvahiResolveReply(
|
||||
AvahiServiceResolver * r, AvahiIfIndex interface, AvahiProtocol /*protocol*/,
|
||||
AvahiResolverEvent event, const char *name, const char *type, const char *domain,
|
||||
const char *hostName, const AvahiAddress *address, uint16_t port, AvahiStringList *txt,
|
||||
AvahiLookupResultFlags /*flags*/, void* context);
|
||||
extern "C" void cAvahiResolveEmptyReply(
|
||||
AvahiServiceResolver * r, AvahiIfIndex, AvahiProtocol, AvahiResolverEvent, const char *,
|
||||
const char *, const char *, const char *, const AvahiAddress *, uint16_t,
|
||||
AvahiStringList *, AvahiLookupResultFlags, void*);
|
||||
extern "C" void cAvahiClientReply (AvahiClient * /*s*/, AvahiClientState state, void* context);
|
||||
extern "C" void cAvahiBrowseReply(
|
||||
AvahiServiceBrowser * /*b*/, AvahiIfIndex interface, AvahiProtocol /*protocol*/,
|
||||
AvahiBrowserEvent event, const char *name, const char *type, const char *domain,
|
||||
AvahiLookupResultFlags /*flags*/, void* context);
|
||||
extern "C" int cAvahiPollFunction(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata);
|
||||
|
||||
extern "C" {
|
||||
typedef const AvahiPoll* (*AvahiSimplePollGet)(AvahiSimplePoll *s);
|
||||
typedef AvahiSimplePoll *(*AvahiSimplePollNewPtr)(void);
|
||||
typedef int (*AvahiSimplePollIteratePtr)(AvahiSimplePoll *s, int sleep_time);
|
||||
typedef void (*AvahiSimplePollQuitPtr)(AvahiSimplePoll *s);
|
||||
typedef void (*AvahiSimplePollFreePtr)(AvahiSimplePoll *s);
|
||||
typedef void (*AvahiSimplePollSetFuncPtr)(AvahiSimplePoll *s, AvahiPollFunc func, void *userdata);
|
||||
typedef AvahiClient* (*AvahiClientNewPtr)(
|
||||
const AvahiPoll *poll_api, AvahiClientFlags flags, AvahiClientCallback callback,
|
||||
void *userdata, int *error);
|
||||
typedef void (*AvahiClientFreePtr)(AvahiClient *client);
|
||||
typedef AvahiServiceBrowser* (*AvahiServiceBrowserNewPtr)(
|
||||
AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, const char *type,
|
||||
const char *domain, AvahiLookupFlags flags, AvahiServiceBrowserCallback callback,
|
||||
void *userdata);
|
||||
typedef int (*AvahiServiceBrowserFreePtr)(AvahiServiceBrowser *);
|
||||
|
||||
typedef AvahiServiceResolver * (*AvahiServiceResolverNewPtr)(
|
||||
AvahiClient *client, AvahiIfIndex interface, AvahiProtocol protocol, const char *name,
|
||||
const char *type, const char *domain, AvahiProtocol aprotocol, AvahiLookupFlags flags,
|
||||
AvahiServiceResolverCallback callback, void *userdata);
|
||||
typedef int (*AvahiServiceResolverFreePtr)(AvahiServiceResolver *r);
|
||||
}
|
||||
|
||||
class AvahiZConfLib;
|
||||
|
||||
struct MyAvahiConnection
|
||||
{
|
||||
AvahiClient *client;
|
||||
AvahiSimplePoll *simple_poll;
|
||||
AvahiZConfLib *lib;
|
||||
MyAvahiConnection() : client(0), simple_poll(0), lib(0)
|
||||
{ }
|
||||
};
|
||||
|
||||
// represents an avahi library
|
||||
class AvahiZConfLib : public ZConfLib {
|
||||
private:
|
||||
AvahiSimplePollGet m_simplePollGet;
|
||||
AvahiSimplePollNewPtr m_simplePollNew;
|
||||
AvahiSimplePollIteratePtr m_simplePollIterate;
|
||||
AvahiSimplePollQuitPtr m_simplePollQuit;
|
||||
AvahiSimplePollFreePtr m_simplePollFree;
|
||||
AvahiSimplePollSetFuncPtr m_simplePollSetFunc;
|
||||
AvahiClientNewPtr m_clientNew;
|
||||
AvahiClientFreePtr m_clientFree;
|
||||
AvahiServiceBrowserNewPtr m_serviceBrowserNew;
|
||||
AvahiServiceBrowserFreePtr m_serviceBrowserFree;
|
||||
AvahiServiceResolverNewPtr m_serviceResolverNew;
|
||||
AvahiServiceResolverFreePtr m_serviceResolverFree;
|
||||
QLibrary nativeLib;
|
||||
public:
|
||||
|
||||
AvahiZConfLib(const QString &libName = QLatin1String("avahi-client"),
|
||||
const QString &version = QLatin1String("3"),
|
||||
const ZConfLib::Ptr &fallBack = ZConfLib::Ptr(0)) :
|
||||
ZConfLib(fallBack), nativeLib(libName, version)
|
||||
{
|
||||
#ifndef ZCONF_AVAHI_STATIC_LINKING
|
||||
// dynamic linking
|
||||
if (!nativeLib.load()) {
|
||||
setError(true,
|
||||
ZConfLib::tr("AvahiZConfLib could not load the native library \"%1\": %2").arg(libName, nativeLib.errorString()));
|
||||
}
|
||||
m_simplePollGet = reinterpret_cast<AvahiSimplePollGet>(nativeLib.resolve("avahi_simple_poll_get"));
|
||||
m_simplePollNew = reinterpret_cast<AvahiSimplePollNewPtr>(nativeLib.resolve("avahi_simple_poll_new"));
|
||||
m_simplePollIterate = reinterpret_cast<AvahiSimplePollIteratePtr>(nativeLib.resolve("avahi_simple_poll_iterate"));
|
||||
m_simplePollQuit = reinterpret_cast<AvahiSimplePollQuitPtr>(nativeLib.resolve("avahi_simple_poll_quit"));
|
||||
m_simplePollFree = reinterpret_cast<AvahiSimplePollFreePtr>(nativeLib.resolve("avahi_simple_poll_free"));
|
||||
m_simplePollSetFunc = reinterpret_cast<AvahiSimplePollSetFuncPtr>(nativeLib.resolve("avahi_simple_poll_set_func"));
|
||||
m_clientNew = reinterpret_cast<AvahiClientNewPtr>(nativeLib.resolve("avahi_client_new"));
|
||||
m_clientFree = reinterpret_cast<AvahiClientFreePtr>(nativeLib.resolve("avahi_client_free"));
|
||||
m_serviceBrowserNew = reinterpret_cast<AvahiServiceBrowserNewPtr>(nativeLib.resolve("avahi_service_browser_new"));
|
||||
m_serviceBrowserFree = reinterpret_cast<AvahiServiceBrowserFreePtr>(nativeLib.resolve("avahi_service_browser_free"));
|
||||
m_serviceResolverNew = reinterpret_cast<AvahiServiceResolverNewPtr>(nativeLib.resolve("avahi_service_resolver_new"));
|
||||
m_serviceResolverFree = reinterpret_cast<AvahiServiceResolverFreePtr>(nativeLib.resolve("avahi_service_resolver_free"));
|
||||
#else
|
||||
m_simplePollGet = reinterpret_cast<AvahiSimplePollGet>(&avahi_simple_poll_get);
|
||||
m_simplePollNew = reinterpret_cast<AvahiSimplePollNewPtr>(&avahi_simple_poll_new);
|
||||
m_simplePollIterate = reinterpret_cast<AvahiSimplePollIteratePtr>(&avahi_simple_poll_iterate);
|
||||
m_simplePollQuit = reinterpret_cast<AvahiSimplePollQuitPtr>(&avahi_simple_poll_quit);
|
||||
m_simplePollFree = reinterpret_cast<AvahiSimplePollFreePtr>(&avahi_simple_poll_free);
|
||||
m_simplePollSetFunc = reinterpret_cast<AvahiSimplePollSetFuncPtr>(&avahi_simple_poll_set_func);
|
||||
m_clientNew = reinterpret_cast<AvahiClientNewPtr>(&avahi_client_new);
|
||||
m_clientFree = reinterpret_cast<AvahiClientFreePtr>(&avahi_client_free);
|
||||
m_serviceBrowserNew = reinterpret_cast<AvahiServiceBrowserNewPtr>(&avahi_service_browser_new);
|
||||
m_serviceBrowserFree = reinterpret_cast<AvahiServiceBrowserFreePtr>(&avahi_service_browser_free);
|
||||
m_serviceResolverNew = reinterpret_cast<AvahiServiceResolverNewPtr>(&avahi_service_resolver_new);
|
||||
m_serviceResolverFree = reinterpret_cast<AvahiServiceResolverFreePtr>(&avahi_service_resolver_free);
|
||||
#endif
|
||||
if (DEBUG_ZEROCONF) {
|
||||
if (!m_simplePollGet) qDebug() << name() << " has null m_simplePollGet";
|
||||
if (!m_simplePollNew) qDebug() << name() << " has null m_simplePollNew";
|
||||
if (!m_simplePollIterate) qDebug() << name() << " has null m_simplePollIterate";
|
||||
if (!m_simplePollQuit) qDebug() << name() << " has null m_simplePollQuit";
|
||||
if (!m_simplePollFree) qDebug() << name() << " has null m_simplePollFree";
|
||||
if (!m_simplePollSetFunc) qDebug() << name() << " has null m_simplePollSetFunc";
|
||||
if (!m_clientNew) qDebug() << name() << " has null m_clientNew";
|
||||
if (!m_clientFree) qDebug() << name() << " has null m_clientFree";
|
||||
if (!m_serviceBrowserNew) qDebug() << name() << " has null m_serviceBrowserNew";
|
||||
if (!m_serviceBrowserFree) qDebug() << name() << " has null m_serviceBrowserFree";
|
||||
if (!m_serviceResolverNew) qDebug() << name() << " has null m_serviceResolverNew";
|
||||
if (!m_serviceResolverFree) qDebug() << name() << " has null m_serviceResolverFree";
|
||||
}
|
||||
}
|
||||
|
||||
~AvahiZConfLib() {
|
||||
}
|
||||
|
||||
QString name(){
|
||||
return QString::fromLatin1("Avahi Library");
|
||||
}
|
||||
|
||||
// bool tryStartDaemon();
|
||||
void refDeallocate(DNSServiceRef /*sdRef*/) {
|
||||
}
|
||||
|
||||
void browserDeallocate(BrowserRef *sdRef) {
|
||||
if (sdRef && (*sdRef) && m_serviceBrowserFree) {
|
||||
m_serviceBrowserFree(*reinterpret_cast<AvahiServiceBrowser **>(sdRef));
|
||||
*sdRef = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void destroyConnection(ConnectionRef *sdRef) {
|
||||
MyAvahiConnection **connection = reinterpret_cast<MyAvahiConnection **>(sdRef);
|
||||
if (connection && (*connection)) {
|
||||
if ((*connection)->client && m_clientFree)
|
||||
m_clientFree((*connection)->client);
|
||||
|
||||
if ((*connection)->simple_poll && m_simplePollFree)
|
||||
m_simplePollFree((*connection)->simple_poll);
|
||||
delete(*connection);
|
||||
*connection = 0;
|
||||
}
|
||||
}
|
||||
|
||||
DNSServiceErrorType resolve(ConnectionRef cRef, DNSServiceRef *sdRef, uint32_t interfaceIndex,
|
||||
ZK_IP_Protocol protocol, const char *name, const char *regtype,
|
||||
const char *domain, ServiceGatherer *gatherer)
|
||||
{
|
||||
if (!sdRef) {
|
||||
qDebug() << "Error: sdRef is null in resolve";
|
||||
return kDNSServiceErr_Unknown;
|
||||
}
|
||||
MyAvahiConnection *connection = reinterpret_cast<MyAvahiConnection *>(cRef);
|
||||
if (!m_serviceResolverNew)
|
||||
return kDNSServiceErr_Unknown;
|
||||
AvahiProtocol avahiProtocol = AVAHI_PROTO_UNSPEC;
|
||||
switch (protocol) {
|
||||
case ZK_PROTO_IPv4:
|
||||
avahiProtocol = AVAHI_PROTO_INET;
|
||||
break;
|
||||
case ZK_PROTO_IPv6:
|
||||
avahiProtocol = AVAHI_PROTO_INET6;
|
||||
break;
|
||||
case ZK_PROTO_IPv4_OR_IPv6:
|
||||
avahiProtocol = AVAHI_PROTO_UNSPEC;
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Zeroconf: unexpected value " << static_cast<int>(protocol) <<
|
||||
" for protocol in avahiLib.resolve";
|
||||
}
|
||||
AvahiServiceResolver *resolver = m_serviceResolverNew(
|
||||
connection->client, interfaceIndex, avahiProtocol, name, regtype, domain,
|
||||
avahiProtocol, AvahiLookupFlags(0), &cAvahiResolveReply, gatherer);
|
||||
//*sdRef = reinterpret_cast<DNSServiceRef>(resolver); // add for restart?
|
||||
if (!resolver)
|
||||
return kDNSServiceErr_Unknown; // avahi_strerror(avahi_client_errno(connection->client));
|
||||
return kDNSServiceErr_NoError;
|
||||
}
|
||||
|
||||
DNSServiceErrorType queryRecord(ConnectionRef, DNSServiceRef *, uint32_t,
|
||||
const char *, ServiceGatherer *)
|
||||
{
|
||||
return kDNSServiceErr_NoError;
|
||||
}
|
||||
|
||||
DNSServiceErrorType getAddrInfo(ConnectionRef, DNSServiceRef *, uint32_t,
|
||||
DNSServiceProtocol, const char *, ServiceGatherer *)
|
||||
{
|
||||
return kDNSServiceErr_NoError;
|
||||
}
|
||||
|
||||
DNSServiceErrorType reconfirmRecord(ConnectionRef cRef, uint32_t interfaceIndex,
|
||||
const char *name, const char *type, const char *domain,
|
||||
const char * /*fullname */)
|
||||
{
|
||||
MyAvahiConnection *connection = reinterpret_cast<MyAvahiConnection *>(cRef);
|
||||
if (!connection)
|
||||
return kDNSServiceErr_Unknown;
|
||||
AvahiServiceResolver *resolver = m_serviceResolverNew(
|
||||
connection->client, interfaceIndex, AVAHI_PROTO_INET, name, type, domain,
|
||||
AVAHI_PROTO_INET, AvahiLookupFlags(AVAHI_LOOKUP_USE_WIDE_AREA|
|
||||
AVAHI_LOOKUP_USE_MULTICAST),
|
||||
&cAvahiResolveEmptyReply, this);
|
||||
return ((resolver == 0)?kDNSServiceErr_Unknown:kDNSServiceErr_NoError);
|
||||
}
|
||||
|
||||
DNSServiceErrorType browse(ConnectionRef cRef, BrowserRef *sdRef, uint32_t interfaceIndex,
|
||||
const char *regtype, const char *domain,
|
||||
ServiceBrowserPrivate *browser)
|
||||
{
|
||||
if (!sdRef) {
|
||||
qDebug() << "Error: sdRef is null in browse";
|
||||
return kDNSServiceErr_Unknown;
|
||||
}
|
||||
if (!m_serviceBrowserNew)
|
||||
return kDNSServiceErr_Unknown;
|
||||
MyAvahiConnection *connection = reinterpret_cast<MyAvahiConnection *>(cRef);
|
||||
AvahiServiceBrowser *sb = m_serviceBrowserNew(
|
||||
connection->client,
|
||||
((interfaceIndex == 0)?static_cast<uint32_t>(AVAHI_IF_UNSPEC):
|
||||
static_cast<uint32_t>(interfaceIndex)),
|
||||
AVAHI_PROTO_UNSPEC, regtype, domain, AvahiLookupFlags(0),
|
||||
&cAvahiBrowseReply, browser);
|
||||
*sdRef = reinterpret_cast<BrowserRef>(sb);
|
||||
if (!sb) {
|
||||
return kDNSServiceErr_Unknown;
|
||||
//avahi_strerror(avahi_client_errno(client));
|
||||
}
|
||||
browser->activateAutoRefresh();
|
||||
return kDNSServiceErr_NoError;
|
||||
}
|
||||
|
||||
DNSServiceErrorType getProperty(const char * /*property*/,
|
||||
void * /*result*/,
|
||||
uint32_t * /*size*/
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
RunLoopStatus processOneEvent(MainConnection *, ConnectionRef cRef, qint64 maxLockMs) {
|
||||
if (!m_simplePollIterate)
|
||||
return ProcessedFailure;
|
||||
MyAvahiConnection *connection = reinterpret_cast<MyAvahiConnection *>(cRef);
|
||||
if (!connection)
|
||||
return ProcessedError;
|
||||
if (m_simplePollIterate(connection->simple_poll, static_cast<int>(maxLockMs)))
|
||||
return ProcessedError;
|
||||
return ProcessedOk;
|
||||
}
|
||||
|
||||
RunLoopStatus processOneEventBlock(ConnectionRef cRef) {
|
||||
return processOneEvent(NULL,cRef,-1);
|
||||
}
|
||||
|
||||
DNSServiceErrorType createConnection(MainConnection *mainConnection, ConnectionRef *sdRef) {
|
||||
if (!m_simplePollNew || !m_clientNew || !m_simplePollSetFunc)
|
||||
return kDNSServiceErr_Unknown;
|
||||
if (sdRef == 0) {
|
||||
qDebug() << "Error: sdRef is null in createConnection";
|
||||
return kDNSServiceErr_Unknown;
|
||||
}
|
||||
MyAvahiConnection *connection = new MyAvahiConnection;
|
||||
connection->lib = this;
|
||||
/* Allocate main loop object */
|
||||
connection->simple_poll = m_simplePollNew();
|
||||
if (!connection->simple_poll) {
|
||||
delete connection;
|
||||
return kDNSServiceErr_Unknown;
|
||||
}
|
||||
m_simplePollSetFunc(connection->simple_poll, &cAvahiPollFunction, mainConnection);
|
||||
/* Allocate a new client */
|
||||
int error;
|
||||
connection->client = m_clientNew(m_simplePollGet(connection->simple_poll),
|
||||
AvahiClientFlags(0), &cAvahiClientReply,
|
||||
connection, &error);
|
||||
if (!connection->client) {
|
||||
if (m_simplePollFree)
|
||||
m_simplePollFree(connection->simple_poll);
|
||||
delete connection;
|
||||
setError(true, ZConfLib::tr("%1 cannot create a client. The daemon is probably not running.").arg(name()));
|
||||
return kDNSServiceErr_Unknown;
|
||||
}
|
||||
*sdRef = reinterpret_cast<ConnectionRef>(connection);
|
||||
return ((isOk())?kDNSServiceErr_NoError:kDNSServiceErr_Unknown);
|
||||
}
|
||||
|
||||
void stopConnection(ConnectionRef cRef)
|
||||
{
|
||||
MyAvahiConnection *connection = reinterpret_cast<MyAvahiConnection *>(cRef);
|
||||
if (m_simplePollQuit && connection)
|
||||
m_simplePollQuit(connection->simple_poll);
|
||||
}
|
||||
|
||||
int refSockFD(ConnectionRef) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void serviceResolverFree(AvahiServiceResolver *r) {
|
||||
if (m_serviceResolverFree)
|
||||
m_serviceResolverFree(r);
|
||||
}
|
||||
};
|
||||
|
||||
ZConfLib::Ptr ZConfLib::createAvahiLib(const QString &libName, const QString &version,
|
||||
const ZConfLib::Ptr &fallback)
|
||||
{
|
||||
return ZConfLib::Ptr(new AvahiZConfLib(libName, version, fallback));
|
||||
}
|
||||
|
||||
extern "C" void cAvahiResolveReply(
|
||||
AvahiServiceResolver * r, AvahiIfIndex interface, AvahiProtocol /*protocol*/,
|
||||
AvahiResolverEvent event, const char * /*name*/, const char * /*type*/,
|
||||
const char * /*domain*/, const char *hostName, const AvahiAddress *address, uint16_t port,
|
||||
AvahiStringList *txt, AvahiLookupResultFlags /*flags*/, void* context)
|
||||
{
|
||||
enum { defaultTtl = 0 };
|
||||
ServiceGatherer *sg = reinterpret_cast<ServiceGatherer *>(context);
|
||||
if (!sg){
|
||||
qDebug() << "context was null in cAvahiResolveReply";
|
||||
return;
|
||||
}
|
||||
AvahiStringList *txtAtt = 0;
|
||||
const unsigned char emptyTxt[1]="";
|
||||
switch (event) {
|
||||
case AVAHI_RESOLVER_FAILURE:
|
||||
sg->serviceResolveReply(0, interface, kDNSServiceErr_Timeout, 0, QString(), 0, 0);
|
||||
break;
|
||||
case AVAHI_RESOLVER_FOUND:
|
||||
sg->serviceResolveReply(
|
||||
kDNSServiceFlagsAdd | ((txtAtt || address)?kDNSServiceFlagsMoreComing:0),
|
||||
interface, kDNSServiceErr_NoError, hostName, QString::number(port), 0, emptyTxt);
|
||||
txtAtt = txt;
|
||||
while (txtAtt) {
|
||||
sg->txtFieldReply(
|
||||
kDNSServiceFlagsAdd | ((txtAtt->next || address)?kDNSServiceFlagsMoreComing:0),
|
||||
kDNSServiceErr_NoError, static_cast<unsigned short>(txtAtt->size),
|
||||
txtAtt->text, ~0);
|
||||
txtAtt = txtAtt->next;
|
||||
}
|
||||
if (address){
|
||||
sockaddr_in ipv4;
|
||||
sockaddr_in6 ipv6;
|
||||
//#ifdef HAVE_SA_LEN
|
||||
switch (address->proto){
|
||||
case (AVAHI_PROTO_INET):
|
||||
memset(&ipv4, 0, sizeof(ipv4));
|
||||
ipv4.sin_family = AF_INET;
|
||||
memcpy(&(ipv4.sin_addr),&(address->data.ipv4.address), sizeof(ipv4.sin_addr));
|
||||
sg->addrReply(kDNSServiceFlagsAdd, kDNSServiceErr_NoError, hostName,
|
||||
reinterpret_cast<sockaddr*>(&ipv4), defaultTtl);
|
||||
break;
|
||||
case (AVAHI_PROTO_INET6):
|
||||
memset(&ipv6, 0, sizeof(ipv6));
|
||||
ipv6.sin6_family = AF_INET6;
|
||||
memcpy(&(ipv6.sin6_addr), &(address->data.ipv6.address), sizeof(ipv6.sin6_addr));
|
||||
sg->addrReply(kDNSServiceFlagsAdd, kDNSServiceErr_NoError, hostName,
|
||||
reinterpret_cast<sockaddr*>(&ipv6), defaultTtl);
|
||||
break;
|
||||
default:
|
||||
if (DEBUG_ZEROCONF)
|
||||
qDebug() << "Warning: ignoring address with protocol " << address->proto
|
||||
<< " for service " << sg->fullName();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Error: unexpected avahi event " << event << " in cAvahiResolveReply";
|
||||
break;
|
||||
}
|
||||
ZConfLib::Ptr libBase = sg->serviceBrowser->mainConnection->lib;
|
||||
AvahiZConfLib *lib = dynamic_cast<AvahiZConfLib *>(libBase.data());
|
||||
if (lib)
|
||||
lib->serviceResolverFree(r);
|
||||
}
|
||||
|
||||
extern "C" void cAvahiResolveEmptyReply(
|
||||
AvahiServiceResolver * r, AvahiIfIndex, AvahiProtocol, AvahiResolverEvent, const char *,
|
||||
const char *, const char *, const char *, const AvahiAddress *, uint16_t, AvahiStringList *,
|
||||
AvahiLookupResultFlags, void* context)
|
||||
{
|
||||
AvahiZConfLib *lib = reinterpret_cast<AvahiZConfLib *>(context);
|
||||
if (lib)
|
||||
lib->serviceResolverFree(r);
|
||||
}
|
||||
|
||||
extern "C" void cAvahiClientReply (AvahiClient * /*s*/, AvahiClientState state, void* context)
|
||||
{
|
||||
MyAvahiConnection *connection = reinterpret_cast<MyAvahiConnection *>(context);
|
||||
ZConfLib *lib = connection->lib;
|
||||
if (!lib) {
|
||||
qDebug() << "Error: context was null in cAvahiClientReply, ignoring state " << state;
|
||||
return;
|
||||
}
|
||||
if (DEBUG_ZEROCONF)
|
||||
qDebug() << "cAvahiClientReply called with state " << state;
|
||||
switch (state){
|
||||
case (AVAHI_CLIENT_S_REGISTERING):
|
||||
/* Server state: REGISTERING */
|
||||
break;
|
||||
case (AVAHI_CLIENT_S_RUNNING):
|
||||
/* Server state: RUNNING */
|
||||
lib->setError(false, QString());
|
||||
break;
|
||||
case (AVAHI_CLIENT_S_COLLISION):
|
||||
/* Server state: COLLISION */
|
||||
lib->setError(true, ZConfLib::tr("cAvahiClient, server collision."));
|
||||
break;
|
||||
case (AVAHI_CLIENT_FAILURE):
|
||||
lib->setError(true, ZConfLib::tr("cAvahiClient, an error occurred on the client side."));
|
||||
break;
|
||||
case (AVAHI_CLIENT_CONNECTING):
|
||||
lib->setError(false, ZConfLib::tr("cAvahiClient, still connecting, no server available."));
|
||||
break;
|
||||
default:
|
||||
lib->setError(true, ZConfLib::tr("Unexpected state %1 in cAvahiClientReply.")
|
||||
.arg(state));
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void cAvahiBrowseReply(
|
||||
AvahiServiceBrowser * /*b*/, AvahiIfIndex interface, AvahiProtocol avahiProtocol,
|
||||
AvahiBrowserEvent event, const char *name, const char *type, const char *domain,
|
||||
AvahiLookupResultFlags /*flags*/, void* context)
|
||||
{
|
||||
ZK_IP_Protocol protocol = ZK_PROTO_IPv4_OR_IPv6;
|
||||
switch (avahiProtocol) {
|
||||
case AVAHI_PROTO_INET:
|
||||
protocol = ZK_PROTO_IPv4;
|
||||
break;
|
||||
case AVAHI_PROTO_INET6:
|
||||
protocol = ZK_PROTO_IPv6;
|
||||
break;
|
||||
case AVAHI_PROTO_UNSPEC:
|
||||
protocol = ZK_PROTO_IPv4_OR_IPv6;
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Error unexpected protocol value " << avahiProtocol << " in cAvahiBrowseReply";
|
||||
}
|
||||
|
||||
ServiceBrowserPrivate *browser = reinterpret_cast<ServiceBrowserPrivate *>(context);
|
||||
if (browser == 0)
|
||||
qDebug() << "Error context is null in cAvahiBrowseReply";
|
||||
switch (event) {
|
||||
case AVAHI_BROWSER_FAILURE:
|
||||
browser->browseReply(kDNSServiceFlagsMoreComing, 0, protocol, kDNSServiceErr_Unknown,
|
||||
0, 0, 0);
|
||||
break;
|
||||
case AVAHI_BROWSER_NEW:
|
||||
browser->browseReply(kDNSServiceFlagsAdd|kDNSServiceFlagsMoreComing,
|
||||
static_cast<uint32_t>(interface), protocol, kDNSServiceErr_NoError,
|
||||
name, type, domain);
|
||||
break;
|
||||
case AVAHI_BROWSER_REMOVE:
|
||||
browser->browseReply(kDNSServiceFlagsMoreComing, static_cast<uint32_t>(interface),
|
||||
protocol, kDNSServiceErr_NoError, name, type, domain);
|
||||
break;
|
||||
case AVAHI_BROWSER_ALL_FOR_NOW:
|
||||
browser->updateFlowStatusForFlags(0);
|
||||
break;
|
||||
case AVAHI_BROWSER_CACHE_EXHAUSTED:
|
||||
browser->updateFlowStatusForFlags(0);
|
||||
break;
|
||||
default:
|
||||
browser->mainConnection->lib->setError(true, ZConfLib::tr(
|
||||
"Unexpected state %1 in cAvahiBrowseReply.")
|
||||
.arg(event));
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" int cAvahiPollFunction(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata)
|
||||
{
|
||||
MainConnection *mainConnection = static_cast<MainConnection *>(userdata);
|
||||
QMutex *lock = 0;
|
||||
if (mainConnection)
|
||||
lock = mainConnection->mainThreadLock();
|
||||
if (lock)
|
||||
lock->unlock();
|
||||
int res=poll(ufds,nfds,timeout);
|
||||
if (lock)
|
||||
lock->lock();
|
||||
return res;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ZeroConf
|
||||
|
||||
#else // no native lib
|
||||
|
||||
namespace ZeroConf {
|
||||
namespace Internal {
|
||||
|
||||
ZConfLib::Ptr ZConfLib::createAvahiLib(const QString &/*lib*/, const QString &/*version*/,
|
||||
const ZConfLib::Ptr &fallback)
|
||||
{
|
||||
return fallback;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ZeroConf
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,324 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://www.qt.io/licensing. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** 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 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "syssocket.h" // this should be the first header included
|
||||
|
||||
#include "servicebrowser.h"
|
||||
#include "servicebrowser_p.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QLibrary>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef NO_DNS_SD_LIB
|
||||
|
||||
#ifdef Q_OS_MACX
|
||||
#define ZCONF_MDNS_STATIC_LINKING
|
||||
#endif
|
||||
|
||||
#ifdef ZCONF_MDNS_STATIC_LINKING
|
||||
extern "C" {
|
||||
#include "dns_sd_funct.h"
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
namespace ZeroConf {
|
||||
namespace Internal {
|
||||
|
||||
extern "C" {
|
||||
typedef void (DNSSD_API *RefDeallocatePtr)(DNSServiceRef sdRef);
|
||||
typedef DNSServiceErrorType (DNSSD_API *ResolvePtr)(DNSServiceRef *sdRef, DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex, const char *name,
|
||||
const char *regtype, const char *domain,
|
||||
DNSServiceResolveReply callBack, void *context);
|
||||
typedef DNSServiceErrorType (DNSSD_API *QueryRecordPtr)(DNSServiceRef *sdRef, DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex, const char *fullname,
|
||||
uint16_t rrtype, uint16_t rrclass,
|
||||
DNSServiceQueryRecordReply callBack, void *context);
|
||||
typedef DNSServiceErrorType (DNSSD_API *GetAddrInfoPtr)(DNSServiceRef *sdRef, DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex, DNSServiceProtocol protocol,
|
||||
const char *hostname, DNSServiceGetAddrInfoReply callBack,
|
||||
void *context);
|
||||
typedef DNSServiceErrorType (DNSSD_API *ReconfirmRecordPtr)(DNSServiceFlags flags, uint32_t interfaceIndex,
|
||||
const char *fullname, uint16_t rrtype,
|
||||
uint16_t rrclass, uint16_t rdlen, const void *rdata);
|
||||
typedef DNSServiceErrorType (DNSSD_API *BrowsePtr)(DNSServiceRef *sdRef, DNSServiceFlags flags,
|
||||
uint32_t interfaceIndex, const char *regtype, const char *domain,
|
||||
DNSServiceBrowseReply callBack, void *context);
|
||||
typedef DNSServiceErrorType (DNSSD_API *GetPropertyPtr)(const char *property, void *result, uint32_t *size);
|
||||
typedef DNSServiceErrorType (DNSSD_API *ProcessResultPtr)(DNSServiceRef sdRef);
|
||||
typedef DNSServiceErrorType (DNSSD_API *CreateConnectionPtr)(DNSServiceRef *sdRef);
|
||||
typedef int (DNSSD_API *RefSockFDPtr)(DNSServiceRef sdRef);
|
||||
}
|
||||
|
||||
// represents a zero conf library exposing the dns-sd interface
|
||||
class DnsSdZConfLib : public ZConfLib {
|
||||
Q_DECLARE_TR_FUNCTIONS(ZeroConf)
|
||||
private:
|
||||
RefDeallocatePtr m_refDeallocate;
|
||||
ResolvePtr m_resolve;
|
||||
QueryRecordPtr m_queryRecord;
|
||||
GetAddrInfoPtr m_getAddrInfo;
|
||||
ReconfirmRecordPtr m_reconfirmRecord;
|
||||
BrowsePtr m_browse;
|
||||
GetPropertyPtr m_getProperty;
|
||||
ProcessResultPtr m_processResult;
|
||||
CreateConnectionPtr m_createConnection;
|
||||
RefSockFDPtr m_refSockFD;
|
||||
QLibrary dnsSdLib;
|
||||
public:
|
||||
|
||||
DnsSdZConfLib(QString libName = QLatin1String("dns_sd"), ZConfLib::Ptr fallBack = ZConfLib::Ptr(0)) : ZConfLib(fallBack), dnsSdLib(libName)
|
||||
{
|
||||
#ifndef ZCONF_MDNS_STATIC_LINKING
|
||||
// dynamic linking
|
||||
if (!dnsSdLib.load()) {
|
||||
m_isOk = false;
|
||||
m_errorMsg = tr("Could not load native library.");
|
||||
}
|
||||
m_refDeallocate = reinterpret_cast<RefDeallocatePtr>(dnsSdLib.resolve("DNSServiceRefDeallocate"));
|
||||
m_resolve = reinterpret_cast<ResolvePtr>(dnsSdLib.resolve("DNSServiceResolve"));
|
||||
m_queryRecord = reinterpret_cast<QueryRecordPtr>(dnsSdLib.resolve("DNSServiceQueryRecord"));
|
||||
m_getAddrInfo = reinterpret_cast<GetAddrInfoPtr>(dnsSdLib.resolve("DNSServiceGetAddrInfo"));
|
||||
m_reconfirmRecord = reinterpret_cast<ReconfirmRecordPtr>(dnsSdLib.resolve("DNSServiceReconfirmRecord"));
|
||||
m_browse = reinterpret_cast<BrowsePtr>(dnsSdLib.resolve("DNSServiceBrowse"));
|
||||
m_getProperty = reinterpret_cast<GetPropertyPtr>(dnsSdLib.resolve("DNSServiceGetProperty"));
|
||||
m_processResult = reinterpret_cast<ProcessResultPtr>(dnsSdLib.resolve("DNSServiceProcessResult")) ;
|
||||
m_createConnection = reinterpret_cast<CreateConnectionPtr>(dnsSdLib.resolve("DNSServiceCreateConnection"));
|
||||
m_refSockFD = reinterpret_cast<RefSockFDPtr>(dnsSdLib.resolve("DNSServiceRefSockFD"));
|
||||
#else
|
||||
// static linking
|
||||
m_refDeallocate = reinterpret_cast<RefDeallocatePtr>(&DNSServiceRefDeallocate);
|
||||
m_resolve = reinterpret_cast<ResolvePtr>(&DNSServiceResolve);
|
||||
m_queryRecord = reinterpret_cast<QueryRecordPtr>(DNSServiceQueryRecord);
|
||||
m_getAddrInfo = reinterpret_cast<GetAddrInfoPtr>(&DNSServiceGetAddrInfo);
|
||||
m_reconfirmRecord = reinterpret_cast<ReconfirmRecordPtr>(&DNSServiceReconfirmRecord);
|
||||
m_browse = reinterpret_cast<BrowsePtr>(&DNSServiceBrowse);
|
||||
m_getProperty = reinterpret_cast<GetPropertyPtr>(&DNSServiceGetProperty);
|
||||
m_processResult = reinterpret_cast<ProcessResultPtr>(&DNSServiceProcessResult) ;
|
||||
m_createConnection = reinterpret_cast<CreateConnectionPtr>(&DNSServiceCreateConnection);
|
||||
m_refSockFD = reinterpret_cast<RefSockFDPtr>(&DNSServiceRefSockFD);
|
||||
#endif
|
||||
if (m_isOk && m_getAddrInfo == 0) {
|
||||
m_isOk = false;
|
||||
#ifdef Q_OS_LINUX
|
||||
m_errorMsg = tr("Skipping over Avahi compatibility lib (or obsolete mdnsd).");
|
||||
#else
|
||||
m_errorMsg = tr("Warning: Detected an obsolete version of Apple Bonjour. Disable, uninstall, or upgrade it, or zeroconf will fail.");
|
||||
#endif
|
||||
}
|
||||
if (DEBUG_ZEROCONF){
|
||||
if (m_refDeallocate == 0) qDebug() << QLatin1String("DnsSdZConfLib.m_refDeallocate == 0");
|
||||
if (m_resolve == 0) qDebug() << QLatin1String("DnsSdZConfLib.m_resolve == 0");
|
||||
if (m_queryRecord == 0) qDebug() << QLatin1String("DnsSdZConfLib.m_queryRecord == 0");
|
||||
if (m_getAddrInfo == 0) qDebug() << QLatin1String("DnsSdZConfLib.m_getAddrInfo == 0");
|
||||
if (m_reconfirmRecord == 0) qDebug() << QLatin1String("DnsSdZConfLib.m_reconfirmRecord == 0");
|
||||
if (m_browse == 0) qDebug() << QLatin1String("DnsSdZConfLib.m_browse == 0");
|
||||
if (m_getProperty == 0) qDebug() << QLatin1String("DnsSdZConfLib.m_getProperty == 0");
|
||||
if (m_processResult == 0) qDebug() << QLatin1String("DnsSdZConfLib.m_processResult == 0");
|
||||
if (m_createConnection == 0) qDebug() << QLatin1String("DnsSdZConfLib.m_createConnection == 0");
|
||||
if (m_refSockFD == 0) qDebug() << QLatin1String("DnsSdZConfLib.m_refSockFD == 0");
|
||||
}
|
||||
}
|
||||
|
||||
~DnsSdZConfLib() {
|
||||
}
|
||||
|
||||
QString name(){
|
||||
return QString::fromLatin1("Dns_sd (Apple Bonjour) Library");
|
||||
}
|
||||
|
||||
// bool tryStartDaemon();
|
||||
void refDeallocate(DNSServiceRef sdRef) {
|
||||
if (m_refDeallocate == 0) return;
|
||||
m_refDeallocate(sdRef);
|
||||
}
|
||||
|
||||
void browserDeallocate(BrowserRef *bRef) {
|
||||
if (m_refDeallocate == 0) return;
|
||||
if (bRef) {
|
||||
m_refDeallocate(*reinterpret_cast<DNSServiceRef *>(bRef));
|
||||
*bRef = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void stopConnection(ConnectionRef cRef)
|
||||
{
|
||||
int sock = refSockFD(cRef);
|
||||
if (sock>0)
|
||||
shutdown(sock, SHUT_RDWR);
|
||||
}
|
||||
|
||||
void destroyConnection(ConnectionRef *sdRef) {
|
||||
if (m_refDeallocate == 0) return;
|
||||
if (sdRef) {
|
||||
m_refDeallocate(*reinterpret_cast<DNSServiceRef *>(sdRef));
|
||||
*sdRef = 0;
|
||||
}
|
||||
}
|
||||
|
||||
DNSServiceErrorType resolve(ConnectionRef cRef, DNSServiceRef *sdRef,
|
||||
uint32_t interfaceIndex, ZK_IP_Protocol /* protocol */, const char *name,
|
||||
const char *regtype, const char *domain,
|
||||
ServiceGatherer *gatherer)
|
||||
{
|
||||
if (m_resolve == 0) return kDNSServiceErr_Unsupported;
|
||||
*sdRef = reinterpret_cast<DNSServiceRef>(cRef);
|
||||
return m_resolve(sdRef, kDNSServiceFlagsShareConnection /* | kDNSServiceFlagsSuppressUnusable*/ | kDNSServiceFlagsTimeout,
|
||||
interfaceIndex, name, regtype, domain, &cServiceResolveReply, gatherer
|
||||
);
|
||||
}
|
||||
|
||||
DNSServiceErrorType queryRecord(ConnectionRef cRef, DNSServiceRef *sdRef,
|
||||
uint32_t interfaceIndex, const char *fullname,
|
||||
ServiceGatherer *gatherer)
|
||||
{
|
||||
if (m_queryRecord == 0) return kDNSServiceErr_Unsupported;
|
||||
*sdRef = reinterpret_cast<DNSServiceRef>(cRef);
|
||||
return m_queryRecord(sdRef, kDNSServiceFlagsShareConnection
|
||||
/* | kDNSServiceFlagsSuppressUnusable*/ | kDNSServiceFlagsTimeout,
|
||||
interfaceIndex, fullname,
|
||||
kDNSServiceType_TXT, kDNSServiceClass_IN, &cTxtRecordReply, gatherer);
|
||||
}
|
||||
|
||||
DNSServiceErrorType getAddrInfo(ConnectionRef cRef, DNSServiceRef *sdRef,
|
||||
uint32_t interfaceIndex, DNSServiceProtocol protocol,
|
||||
const char *hostname, ServiceGatherer *gatherer)
|
||||
{
|
||||
enum { longTTL = 100 };
|
||||
if (m_getAddrInfo == 0) {
|
||||
#ifdef Q_OS_UNIX
|
||||
// try to use getaddrinfo (for example on linux with avahi)
|
||||
struct addrinfo req, *ans; int err;
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.ai_flags = 0;
|
||||
req.ai_family = AF_UNSPEC;
|
||||
req.ai_socktype = SOCK_STREAM;
|
||||
req.ai_protocol = 0;
|
||||
if ((err = getaddrinfo(hostname, 0, &req, &ans)) != 0) {
|
||||
qDebug() << "getaddrinfo for " << hostname << " failed with " << gai_strerror(err);
|
||||
return kDNSServiceErr_Unsupported; // use another error here???
|
||||
}
|
||||
for (struct addrinfo *ansAtt = ans; ansAtt != 0; ansAtt = ansAtt->ai_next){
|
||||
gatherer->addrReply(kDNSServiceFlagsAdd, kDNSServiceErr_NoError,
|
||||
hostname, ansAtt->ai_addr, longTTL);
|
||||
}
|
||||
freeaddrinfo(ans);
|
||||
return kDNSServiceErr_NoError;
|
||||
#else
|
||||
return kDNSServiceErr_Unsupported;
|
||||
#endif
|
||||
}
|
||||
*sdRef = reinterpret_cast<DNSServiceRef>(cRef);
|
||||
return m_getAddrInfo(sdRef, kDNSServiceFlagsShareConnection
|
||||
/*| kDNSServiceFlagsSuppressUnusable */ | kDNSServiceFlagsTimeout,
|
||||
interfaceIndex, protocol, hostname, &cAddrReply, gatherer);
|
||||
}
|
||||
|
||||
DNSServiceErrorType reconfirmRecord(ConnectionRef /*cRef*/, uint32_t /*interfaceIndex*/,
|
||||
const char * /*name*/, const char * /*type*/,
|
||||
const char * /*domain*/, const char * /*fullname*/)
|
||||
{
|
||||
if (m_reconfirmRecord == 0) return kDNSServiceErr_Unsupported;
|
||||
// reload and force update with in the callback with
|
||||
// m_reconfirmRecord(flags, interfaceIndex, fullname, rrtype,
|
||||
// rrclass, rdlen, rdata);
|
||||
return kDNSServiceErr_Unsupported;
|
||||
}
|
||||
|
||||
DNSServiceErrorType browse(ConnectionRef cRef, BrowserRef *bRef,
|
||||
uint32_t interfaceIndex, const char *regtype,
|
||||
const char *domain, ServiceBrowserPrivate *browser)
|
||||
{
|
||||
if (m_browse == 0) return kDNSServiceErr_Unsupported;
|
||||
DNSServiceRef *sdRef = reinterpret_cast<DNSServiceRef *>(bRef);
|
||||
*sdRef = reinterpret_cast<DNSServiceRef>(cRef);
|
||||
return m_browse(sdRef, kDNSServiceFlagsShareConnection /*| kDNSServiceFlagsSuppressUnusable*/,
|
||||
interfaceIndex, regtype, domain, &cBrowseReply, browser);
|
||||
}
|
||||
|
||||
DNSServiceErrorType getProperty(const char *property, void *result, uint32_t *size)
|
||||
{
|
||||
if (m_getProperty == 0)
|
||||
return kDNSServiceErr_Unsupported;
|
||||
return m_getProperty(property, result, size);
|
||||
}
|
||||
|
||||
RunLoopStatus processOneEventBlock(ConnectionRef cRef)
|
||||
{
|
||||
if (m_processResult == 0)
|
||||
return ProcessedFailure;
|
||||
if (m_processResult(reinterpret_cast<DNSServiceRef>(cRef)) != kDNSServiceErr_NoError)
|
||||
return ProcessedError;
|
||||
return ProcessedOk;
|
||||
}
|
||||
|
||||
DNSServiceErrorType createConnection(MainConnection *, ConnectionRef *sdRef)
|
||||
{
|
||||
if (m_createConnection == 0) return kDNSServiceErr_Unsupported;
|
||||
return m_createConnection(reinterpret_cast<DNSServiceRef *>(sdRef));
|
||||
}
|
||||
|
||||
int refSockFD(ConnectionRef sdRef)
|
||||
{
|
||||
if (m_refSockFD == 0) return kDNSServiceErr_Unsupported;
|
||||
return m_refSockFD(reinterpret_cast<DNSServiceRef>(sdRef));
|
||||
}
|
||||
};
|
||||
|
||||
ZConfLib::Ptr ZConfLib::createDnsSdLib(const QString &libName, const ZConfLib::Ptr &fallback) {
|
||||
return ZConfLib::Ptr(new DnsSdZConfLib(libName, fallback));
|
||||
}
|
||||
} // namespace Internal
|
||||
} // namespace ZeroConf
|
||||
|
||||
#else // NO_DNS_SD_LIB
|
||||
|
||||
namespace ZeroConf {
|
||||
namespace Internal {
|
||||
|
||||
ZConfLib::Ptr ZConfLib::createDnsSdLib(const QString &/*extraPaths*/, const ZConfLib::Ptr &fallback) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ZeroConf
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user