Merge remote branch 'origin/2.0'

Conflicts:
	src/plugins/debugger/moduleshandler.cpp
	src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp
	src/plugins/qt4projectmanager/qt-maemo/maemopackagecontents.cpp
	src/plugins/qt4projectmanager/qt-maemo/maemosshthread.cpp
This commit is contained in:
con
2010-05-20 09:28:00 +02:00
117 changed files with 1073 additions and 533 deletions

View File

@@ -54,6 +54,10 @@
\o \l{Finding and Replacing} \o \l{Finding and Replacing}
\o \l{Refactoring} \o \l{Refactoring}
\o \l{Searching With the Locator} \o \l{Searching With the Locator}
\o \l{Pasting and Fetching Code Snippets}
\o \l{Configuring the Editor}
\o \l{Using FakeVim Mode}
\o \l{Using an External Editor}
\endlist \endlist
\o \l{Managing Projects} \o \l{Managing Projects}
\list \list
@@ -388,6 +392,9 @@
\endlist \endlist
Output panes are available in all \l{Qt Creator modes}{modes}. Output panes are available in all \l{Qt Creator modes}{modes}.
Click the name of an output pane to open the pane. To maximize
an open output pane, click the \gui {Maximize Output Pane} button
or press \key {Alt+9}.
\section2 Build Issues \section2 Build Issues
@@ -620,28 +627,6 @@
checking, code completion, context sensitive help and in-line error checking, code completion, context sensitive help and in-line error
indicators while you are typing. indicators while you are typing.
\section1 Configuring the Editor
Qt Creator allows you to configure the text editor to suit your specific
needs. To configure the editor, select \gui Tools > \gui{Options...} >
\gui{Text Editor}
You can perform the following configuration actions:
\list
\o Set the font preferences and apply syntax highlighting in
\gui{Font & Colors}.
\o Set tabs, indentation, the handling of whitespace, and mouse operations in
\gui Behavior.
\o Set various display properties, for example,
\l{Highlighting and folding blocks}{highlighting and folding blocks},
text wrapping or \l{Moving to symbol definition or declaration}
{moving to symbol definition or declaration}
in \gui Display.
\o Configure \l{Completing Code}{code completion} in \gui Completion.
\endlist
\section1 Using the Editor Toolbar \section1 Using the Editor Toolbar
The editor toolbar is located at the top of the editor view. The editor The editor toolbar is located at the top of the editor view. The editor
@@ -716,6 +701,11 @@
\gui{Text Editor} > \gui Display > \gui{Display folding markers}. This \gui{Text Editor} > \gui Display > \gui{Display folding markers}. This
option is enabled by default. option is enabled by default.
When the cursor is on a brace, the matching brace is animated
by default. To turn off the animation and just highlight the block and
the braces, select \gui {Tools > Options... > Text Editor > Display} and
deselect \gui {Animate matching parentheses}.
\section1 Checking Code Syntax \section1 Checking Code Syntax
@@ -760,6 +750,10 @@
\gui{Autocomplete common prefix} in the code completion preferences. \gui{Autocomplete common prefix} in the code completion preferences.
Select \gui Tools > \gui{Options...} > \gui{Text Editor} > \gui Completion. Select \gui Tools > \gui{Options...} > \gui{Text Editor} > \gui Completion.
By default, code completion considers only the first letter case-sensitive.
To apply full or no case-sensitivity, select the option in the
\gui {Case-sensitivity} field.
The following table lists available types for code completion and icon The following table lists available types for code completion and icon
used for each. used for each.
@@ -856,8 +850,16 @@
\note In Qt Creator indexing updates the code automatically. Use \note In Qt Creator indexing updates the code automatically. Use
\gui{Update code model} only as an emergency command. \gui{Update code model} only as an emergency command.
*/
\section1 Pasting and Fetching Code Snippets
/*!
\contentspage index.html
\previouspage creator-editor-locator.html
\page creator-editor-codepasting.html
\nextpage creator-editor-options.html
\title Pasting and Fetching Code Snippets
In Qt Creator, you can paste snippets of code to a server or fetch In Qt Creator, you can paste snippets of code to a server or fetch
snippets of code from the server. To paste and fetch snippets of code, snippets of code from the server. To paste and fetch snippets of code,
@@ -890,7 +892,16 @@
If they have the project currently opened in Qt Creator, they can apply and test If they have the project currently opened in Qt Creator, they can apply and test
the change by choosing \gui{Tools} > \gui{Git} > \gui{Apply Patch}. the change by choosing \gui{Tools} > \gui{Git} > \gui{Apply Patch}.
\section1 Using FakeVim Mode */
/*!
\contentspage index.html
\previouspage creator-editor-options.html
\page creator-editor-fakevim.html
\nextpage creator-editor-external.html
\title Using FakeVim Mode
In the \gui{FakeVim} mode, you can run the main editor in a manner similar In the \gui{FakeVim} mode, you can run the main editor in a manner similar
to the Vim editor. To run the editor in the \gui{FakeVim} mode, select to the Vim editor. To run the editor in the \gui{FakeVim} mode, select
@@ -906,14 +917,26 @@
Qt Creator core, select \gui{Tools} > \gui{Options...} > \gui{FakeVim} > Qt Creator core, select \gui{Tools} > \gui{Options...} > \gui{FakeVim} >
\gui{Ex Command Mapping}. \gui{Ex Command Mapping}.
To make changes to the Vim style settings, select \gui{Tools} > To make changes to the Vim-style settings, select \gui{Tools} >
\gui{Options...} > \gui{General}. \gui{Options...} > \gui FakeVim > \gui{General}.
To use a Vim-style color scheme, select \gui {Tools > Options... >
Text Editor > Fonts & Color}. In the \gui {Color Scheme} list, select
\gui {Vim (dark)}.
To quit the FakeVim mode, click \gui {Quit FakeVim} or press To quit the FakeVim mode, click \gui {Quit FakeVim} or press
\key{Alt+V,Alt+V}. \key{Alt+V,Alt+V}.
*/
\section1 Using an External Editor
/*!
\contentspage index.html
\previouspage creator-editor-fakevim.html
\page creator-editor-external.html
\nextpage creator-project-managing.html
\title Using an External Editor
To open the file you are currently viewing in an external editor, select To open the file you are currently viewing in an external editor, select
\gui Edit > \gui Advanced > \gui{Open in External Editor}. \gui Edit > \gui Advanced > \gui{Open in External Editor}.
@@ -947,6 +970,134 @@
*/ */
/*!
\contentspage index.html
\previouspage creator-editor-codepasting.html
\page creator-editor-options.html
\nextpage creator-editor-fakevim.html
\title Configuring the Editor
Qt Creator allows you to configure the text editor to suit your specific
needs. To configure the editor, select \gui Tools > \gui{Options...} >
\gui{Text Editor}.
You can perform the following configuration actions:
\list
\o Set the font preferences and apply syntax highlighting in
\gui{Font & Colors}.
\o Set tabs, indentation, the handling of whitespace, and mouse operations in
\gui Behavior.
\o Set various display properties, for example,
\l{Highlighting and folding blocks}{highlighting and folding blocks},
text wrapping or \l{Moving to symbol definition or declaration}
{moving to symbol definition or declaration}
in \gui Display.
\o Configure \l{Completing Code}{code completion} in \gui Completion.
\endlist
\section2 Configuring Fonts
You can select the font family and size. You can specify a zoom setting in
percentage for viewing the text. You can also zoom in or out by pressing
\key {Ctrl++} or \key {Ctrl +-}, or by pressing \key Ctrl and rolling
the mouse button up or down. To disable the mouse wheel function, select
\gui {Tools > Options... > Text Editor > Behavior} and deselect the
\gui {Enable scroll wheel zooming} check box.
Antialiasing is used by default to make text look smoother and more
readable on the screen. Deselect the \gui Antialias check box to
turn off antialiasing.
\section2 Defining Color Schemes
You can select one of the predefined color schemes for syntax highlighting
or create customized color schemes. To create a color scheme:
\list 1
\o Select \gui {Tools > Options... > Text Editor > Fonts & Color > Copy}.
\o Enter a name for the color scheme and click \gui OK.
\o In the \gui Foreground field, specify the color of the selected
code element.
\o In the \gui Background field, select the background
color for the code element.
The backgound of the \gui Text element determines the background of the
code editor.
\endlist
When you copy code from Qt Creator, it is copied in both plain text and HTML
format. The latter makes sure that syntax highlighting is preserved when
pasting to a rich-text editor.
\section2 Indenting Code
When you type code, it is indented automatically according to the selected
options. Select a block to indent it when you press \key Tab.
Press \key {Shift+Tab} to decrease the indentation.
When you press \gui Backspace the indentation is decreased by one level,
instead of one space, by default.
By default, the tab-length in code editor is 8 spaces, but you can change
it. The code editor can also determine whether tabs or spaces are used
on the previous or next line and copy the style.
You can determine whether the block indent style includes braces,
or you can use the GNU indent style. The GNU style places braces on a separate
line, indented by 2 spaces, except when they open a function definition, where
they are not indented.
The following code snippet illustrates excluding braces from the indented block:
\code
void foobar(bool zoo)
{
if (zoo)
{
foo();
}
}
\endcode
The following code snippet illustrates including braces in the indented block:
\code
void foobar(bool zoo)
{
if (zoo)
{
foo();
}
}
\endcode
The following code snippet illustrates the GNU style:
\code
void foobar(bool zoo)
{
if (zoo)
{
foo();
}
}
\endcode
*/
/*! /*!
\contentspage index.html \contentspage index.html
\previouspage creator-editor-using.html \previouspage creator-editor-using.html
@@ -1139,7 +1290,7 @@
/*! /*!
\contentspage index.html \contentspage index.html
\previouspage creator-editor-locator.html \previouspage creator-editor-external.html
\page creator-project-managing.html \page creator-project-managing.html
\nextpage creator-project-creating.html \nextpage creator-project-creating.html
@@ -1702,7 +1853,7 @@
/*! /*!
\contentspage index.html \contentspage index.html
\previouspage creator-developing-symbian.html \previouspage creator-project-managing-sessions.html
\page creator-building-running.html \page creator-building-running.html
\nextpage creator-building-targets.html \nextpage creator-building-targets.html
@@ -1941,6 +2092,24 @@
For more information on how to define capabilities for a project, see For more information on how to define capabilities for a project, see
\l{http://doc.qt.nokia.com/4.7-snapshot/qmake-platform-notes.html#capabilities}{Capabilities}. \l{http://doc.qt.nokia.com/4.7-snapshot/qmake-platform-notes.html#capabilities}{Capabilities}.
\section3 Application UID
A UID is a globally unique identifier that is used to
uniquely identify, for example, an object or file type. In Symbian development,
objects are identified by compound identifiers that are constructed from three
UIDs, namely UID1, UID2, and UID3. UID1 and UID2 specify the category of an
object, whereas UID3 identifies a particular object, such as an application.
When you create a \gui {Mobile Qt Application}, Qt Creator adds a UID3 suitable for
development and debugging automatically to the application .pro file. However, to
distribute your application and get it Symbian signed, you must apply for a UID
from Symbian, who manages the allocation of UIDs. You can request UIDs either one
at a time or as preallocated blocks on the \l{https://www.symbiansigned.com/app/page}{Symbian Signed}
web site.
Replace the testing UID with the distribution UID in the .pro file before you
build the final installation package. For more information, see
\l{http://doc.qt.nokia.com/4.7-snapshot/qmake-platform-notes.html#unique-identifiers}{Unique Identifiers}.
\section2 Building and Running for Symbian Emulator \section2 Building and Running for Symbian Emulator
@@ -2145,7 +2314,7 @@
\contentspage index.html \contentspage index.html
\previouspage creator-editor-settings.html \previouspage creator-editor-settings.html
\page creator-build-dependencies.html \page creator-build-dependencies.html
\nextpage creator-project-managing-sessions.html \nextpage creator-visual-editor.html
\title Specifying Dependencies \title Specifying Dependencies
@@ -2890,7 +3059,7 @@
\contentspage index.html \contentspage index.html
\previouspage creator-editor-refactoring.html \previouspage creator-editor-refactoring.html
\page creator-editor-locator.html \page creator-editor-locator.html
\nextpage creator-project-managing.html \nextpage creator-editor-codepasting.html
\title Searching With the Locator \title Searching With the Locator
@@ -3064,9 +3233,9 @@
/*! /*!
\contentspage index.html \contentspage index.html
\previouspage creator-build-dependencies.html \previouspage creator-developing-symbian.html
\page creator-project-managing-sessions.html \page creator-project-managing-sessions.html
\nextpage creator-visual-editor.html \nextpage creator-building-running.html
\title Managing Sessions \title Managing Sessions
@@ -4497,7 +4666,7 @@
/*! /*!
\contentspage index.html \contentspage index.html
\previouspage creator-project-managing-sessions.html \previouspage creator-build-dependencies.html
\page creator-visual-editor.html \page creator-visual-editor.html
\nextpage creator-usability.html \nextpage creator-usability.html
@@ -5527,7 +5696,7 @@
\contentspage index.html \contentspage index.html
\previouspage creator-developing-maemo.html \previouspage creator-developing-maemo.html
\page creator-developing-symbian.html \page creator-developing-symbian.html
\nextpage creator-building-running.html \nextpage creator-project-managing-sessions.html
\title Setting Up Development Environment for Symbian \title Setting Up Development Environment for Symbian
@@ -6052,6 +6221,9 @@
\row \row
\o Cut line \o Cut line
\o Shift+Del \o Shift+Del
\row
\o Join lines
\o Ctrl+J
\row \row
\o Decrease font size \o Decrease font size
\o Ctrl+- (Ctrl+Roll mouse wheel down) \o Ctrl+- (Ctrl+Roll mouse wheel down)
@@ -6059,7 +6231,7 @@
\o Increase font size \o Increase font size
\o Ctrl++ (Ctrl+Roll mouse wheel up) \o Ctrl++ (Ctrl+Roll mouse wheel up)
\row \row
\o Toggle vim-style editing \o Toggle Vim-style editing
\o Alt+V, Alt+V \o Alt+V, Alt+V
\row \row
\o Split \o Split

View File

@@ -1370,12 +1370,12 @@
<type name="Qt.AnchorAnimation" version="4.7" extends="Qt.Animation"> <type name="Qt.AnchorAnimation" version="4.7" extends="Qt.Animation">
<property name="targets" type="Qt.Item" isList="true"/> <property name="targets" type="Qt.Item" isList="true"/>
<property name="duration" type="int"/> <property name="duration" type="int"/>
<property name="easing" type="QEasingCurve"/> <property name="easing" type="Qt.Easing"/>
<signal name="durationChanged"> <signal name="durationChanged">
<param type="int"/> <param type="int"/>
</signal> </signal>
<signal name="easingChanged"> <signal name="easingChanged">
<param type="QEasingCurve"/> <param type="Qt.Easing"/>
</signal> </signal>
</type> </type>
<type name="Qt.AnchorChanges" version="4.7" extends="QDeclarativeStateOperation"> <type name="Qt.AnchorChanges" version="4.7" extends="QDeclarativeStateOperation">
@@ -1457,10 +1457,6 @@
<enumerator name="Loading" value="2"/> <enumerator name="Loading" value="2"/>
<enumerator name="Error" value="3"/> <enumerator name="Error" value="3"/>
</enum> </enum>
<property name="isNull" type="bool"/>
<property name="isReady" type="bool"/>
<property name="isError" type="bool"/>
<property name="isLoading" type="bool"/>
<property name="progress" type="qreal"/> <property name="progress" type="qreal"/>
<property name="status" type="Status"/> <property name="status" type="Status"/>
<property name="url" type="QUrl"/> <property name="url" type="QUrl"/>
@@ -1474,6 +1470,7 @@
</type> </type>
<type name="Qt.Connections" version="4.7" extends="Qt.QtObject"> <type name="Qt.Connections" version="4.7" extends="Qt.QtObject">
<property name="target" type="Qt.QtObject"/> <property name="target" type="Qt.QtObject"/>
<property name="ignoreUnknownSignals" type="bool"/>
<signal name="targetChanged"/> <signal name="targetChanged"/>
</type> </type>
<type name="Qt.DoubleValidator" version="4.7" extends="QValidator"> <type name="Qt.DoubleValidator" version="4.7" extends="QValidator">
@@ -1555,7 +1552,7 @@
<enumerator name="SineCurve" value="43"/> <enumerator name="SineCurve" value="43"/>
<enumerator name="CosineCurve" value="44"/> <enumerator name="CosineCurve" value="44"/>
</enum> </enum>
<property name="type" type="QDeclarativeEasingValueType.Type"/> <property name="type" type="Type"/>
<property name="amplitude" type="qreal"/> <property name="amplitude" type="qreal"/>
<property name="overshoot" type="qreal"/> <property name="overshoot" type="qreal"/>
<property name="period" type="qreal"/> <property name="period" type="qreal"/>
@@ -1566,7 +1563,7 @@
<enumerator name="DragOverBounds" value="1"/> <enumerator name="DragOverBounds" value="1"/>
<enumerator name="DragAndOvershootBounds" value="2"/> <enumerator name="DragAndOvershootBounds" value="2"/>
</enum> </enum>
<enum name="FlickDirection"> <enum name="FlickableDirection">
<enumerator name="AutoFlickDirection" value="0"/> <enumerator name="AutoFlickDirection" value="0"/>
<enumerator name="HorizontalFlick" value="1"/> <enumerator name="HorizontalFlick" value="1"/>
<enumerator name="VerticalFlick" value="2"/> <enumerator name="VerticalFlick" value="2"/>
@@ -1583,8 +1580,13 @@
<property name="maximumFlickVelocity" type="qreal"/> <property name="maximumFlickVelocity" type="qreal"/>
<property name="flickDeceleration" type="qreal"/> <property name="flickDeceleration" type="qreal"/>
<property name="moving" type="bool"/> <property name="moving" type="bool"/>
<property name="movingHorizontally" type="bool"/>
<property name="movingVertically" type="bool"/>
<property name="flicking" type="bool"/> <property name="flicking" type="bool"/>
<property name="flickDirection" type="FlickDirection"/> <property name="flickingHorizontally" type="bool"/>
<property name="flickingVertically" type="bool"/>
<property name="flickDirection" type="FlickableDirection"/>
<property name="flickableDirection" type="FlickableDirection"/>
<property name="interactive" type="bool"/> <property name="interactive" type="bool"/>
<property name="pressDelay" type="int"/> <property name="pressDelay" type="int"/>
<property name="atXEnd" type="bool"/> <property name="atXEnd" type="bool"/>
@@ -1599,22 +1601,26 @@
<signal name="contentXChanged"/> <signal name="contentXChanged"/>
<signal name="contentYChanged"/> <signal name="contentYChanged"/>
<signal name="movingChanged"/> <signal name="movingChanged"/>
<signal name="movingHorizontallyChanged"/>
<signal name="movingVerticallyChanged"/>
<signal name="flickingChanged"/> <signal name="flickingChanged"/>
<signal name="movementStarted"/> <signal name="flickingHorizontallyChanged"/>
<signal name="movementEnded"/> <signal name="flickingVerticallyChanged"/>
<signal name="flickStarted"/>
<signal name="flickEnded"/>
<signal name="horizontalVelocityChanged"/> <signal name="horizontalVelocityChanged"/>
<signal name="verticalVelocityChanged"/> <signal name="verticalVelocityChanged"/>
<signal name="isAtBoundaryChanged"/> <signal name="isAtBoundaryChanged"/>
<signal name="pageChanged"/> <signal name="pageChanged"/>
<signal name="flickDirectionChanged"/> <signal name="flickableDirectionChanged"/>
<signal name="interactiveChanged"/> <signal name="interactiveChanged"/>
<signal name="overShootChanged"/> <signal name="overShootChanged"/>
<signal name="boundsBehaviorChanged"/> <signal name="boundsBehaviorChanged"/>
<signal name="maximumFlickVelocityChanged"/> <signal name="maximumFlickVelocityChanged"/>
<signal name="flickDecelerationChanged"/> <signal name="flickDecelerationChanged"/>
<signal name="pressDelayChanged"/> <signal name="pressDelayChanged"/>
<signal name="movementStarted"/>
<signal name="movementEnded"/>
<signal name="flickStarted"/>
<signal name="flickEnded"/>
</type> </type>
<type name="Qt.Flipable" version="4.7" defaultProperty="data" extends="Qt.Item"> <type name="Qt.Flipable" version="4.7" defaultProperty="data" extends="Qt.Item">
<enum name="Side"> <enum name="Side">
@@ -1865,18 +1871,30 @@
<method name="forceFocus"/> <method name="forceFocus"/>
</type> </type>
<type name="Qt.KeyNavigation" version="4.7" extends="Qt.QtObject"> <type name="Qt.KeyNavigation" version="4.7" extends="Qt.QtObject">
<enum name="Priority">
<enumerator name="BeforeItem" value="0"/>
<enumerator name="AfterItem" value="1"/>
</enum>
<property name="left" type="Qt.Item"/> <property name="left" type="Qt.Item"/>
<property name="right" type="Qt.Item"/> <property name="right" type="Qt.Item"/>
<property name="up" type="Qt.Item"/> <property name="up" type="Qt.Item"/>
<property name="down" type="Qt.Item"/> <property name="down" type="Qt.Item"/>
<property name="tab" type="Qt.Item"/> <property name="tab" type="Qt.Item"/>
<property name="backtab" type="Qt.Item"/> <property name="backtab" type="Qt.Item"/>
<property name="priority" type="Priority"/>
<signal name="changed"/> <signal name="changed"/>
<signal name="priorityChanged"/>
</type> </type>
<type name="Qt.Keys" version="4.7" extends="Qt.QtObject"> <type name="Qt.Keys" version="4.7" extends="Qt.QtObject">
<enum name="Priority">
<enumerator name="BeforeItem" value="0"/>
<enumerator name="AfterItem" value="1"/>
</enum>
<property name="enabled" type="bool"/> <property name="enabled" type="bool"/>
<property name="forwardTo" type="Qt.Item" isList="true"/> <property name="forwardTo" type="Qt.Item" isList="true"/>
<property name="priority" type="Priority"/>
<signal name="enabledChanged"/> <signal name="enabledChanged"/>
<signal name="priorityChanged"/>
<signal name="pressed"> <signal name="pressed">
<param name="event" type="QDeclarativeKeyEvent"/> <param name="event" type="QDeclarativeKeyEvent"/>
</signal> </signal>
@@ -2126,14 +2144,8 @@
<enumerator name="Loading" value="2"/> <enumerator name="Loading" value="2"/>
<enumerator name="Error" value="3"/> <enumerator name="Error" value="3"/>
</enum> </enum>
<enum name="ResizeMode">
<enumerator name="NoResize" value="0"/>
<enumerator name="SizeLoaderToItem" value="1"/>
<enumerator name="SizeItemToLoader" value="2"/>
</enum>
<property name="source" type="QUrl"/> <property name="source" type="QUrl"/>
<property name="sourceComponent" type="Qt.Component"/> <property name="sourceComponent" type="Qt.Component"/>
<property name="resizeMode" type="ResizeMode"/>
<property name="item" type="QGraphicsObject"/> <property name="item" type="QGraphicsObject"/>
<property name="status" type="Status"/> <property name="status" type="Status"/>
<property name="progress" type="qreal"/> <property name="progress" type="qreal"/>
@@ -2141,7 +2153,7 @@
<signal name="sourceChanged"/> <signal name="sourceChanged"/>
<signal name="statusChanged"/> <signal name="statusChanged"/>
<signal name="progressChanged"/> <signal name="progressChanged"/>
<signal name="resizeModeChanged"/> <signal name="loaded"/>
</type> </type>
<type name="Qt.MouseArea" version="4.7" defaultProperty="data" extends="Qt.Item"> <type name="Qt.MouseArea" version="4.7" defaultProperty="data" extends="Qt.Item">
<property name="mouseX" type="qreal"/> <property name="mouseX" type="qreal"/>
@@ -2157,6 +2169,7 @@
<signal name="pressedChanged"/> <signal name="pressedChanged"/>
<signal name="enabledChanged"/> <signal name="enabledChanged"/>
<signal name="acceptedButtonsChanged"/> <signal name="acceptedButtonsChanged"/>
<signal name="hoverEnabledChanged"/>
<signal name="positionChanged"> <signal name="positionChanged">
<param name="mouse" type="QDeclarativeMouseEvent"/> <param name="mouse" type="QDeclarativeMouseEvent"/>
</signal> </signal>
@@ -2180,6 +2193,7 @@
</signal> </signal>
<signal name="entered"/> <signal name="entered"/>
<signal name="exited"/> <signal name="exited"/>
<signal name="canceled"/>
</type> </type>
<type name="Qt.NumberAnimation" version="4.7" extends="Qt.PropertyAnimation"> <type name="Qt.NumberAnimation" version="4.7" extends="Qt.PropertyAnimation">
<property name="from" type="qreal"/> <property name="from" type="qreal"/>
@@ -2274,6 +2288,8 @@
<signal name="highlightChanged"/> <signal name="highlightChanged"/>
<signal name="highlightItemChanged"/> <signal name="highlightItemChanged"/>
<signal name="highlightMoveDurationChanged"/> <signal name="highlightMoveDurationChanged"/>
<method name="incrementCurrentIndex"/>
<method name="decrementCurrentIndex"/>
</type> </type>
<type name="Qt.PauseAnimation" version="4.7" extends="Qt.Animation"> <type name="Qt.PauseAnimation" version="4.7" extends="Qt.Animation">
<property name="duration" type="int"/> <property name="duration" type="int"/>
@@ -2303,7 +2319,7 @@
<property name="duration" type="int"/> <property name="duration" type="int"/>
<property name="from" type="QVariant"/> <property name="from" type="QVariant"/>
<property name="to" type="QVariant"/> <property name="to" type="QVariant"/>
<property name="easing" type="QEasingCurve"/> <property name="easing" type="Qt.Easing"/>
<property name="target" type="Qt.QtObject"/> <property name="target" type="Qt.QtObject"/>
<property name="property" type="string"/> <property name="property" type="string"/>
<property name="properties" type="string"/> <property name="properties" type="string"/>
@@ -2319,7 +2335,7 @@
<param type="QVariant"/> <param type="QVariant"/>
</signal> </signal>
<signal name="easingChanged"> <signal name="easingChanged">
<param type="QEasingCurve"/> <param type="Qt.Easing"/>
</signal> </signal>
<signal name="propertiesChanged"> <signal name="propertiesChanged">
<param type="string"/> <param type="string"/>
@@ -3094,7 +3110,7 @@
<property name="contentsMargin" type="qreal"/> <property name="contentsMargin" type="qreal"/>
</type> </type>
<type name="Qt.widgets.QGraphicsLinearLayoutStretchItem" version="4.7" extends="Qt.QtObject"/> <type name="Qt.widgets.QGraphicsLinearLayoutStretchItem" version="4.7" extends="Qt.QtObject"/>
<type name="org.webkit.WebView" version="1.0" defaultProperty="data" extends="QDeclarativePaintedItem"> <type name="org.webkit.WebView" version="1.0" defaultProperty="data" extends="Qt.Item">
<enum name="Status"> <enum name="Status">
<enumerator name="Null" value="0"/> <enumerator name="Null" value="0"/>
<enumerator name="Ready" value="1"/> <enumerator name="Ready" value="1"/>
@@ -3121,6 +3137,8 @@
<property name="newWindowComponent" type="Qt.Component"/> <property name="newWindowComponent" type="Qt.Component"/>
<property name="newWindowParent" type="Qt.Item"/> <property name="newWindowParent" type="Qt.Item"/>
<property name="renderingEnabled" type="bool"/> <property name="renderingEnabled" type="bool"/>
<property name="contentsSize" type="QSize"/>
<property name="contentsScale" type="qreal"/>
<signal name="preferredWidthChanged"/> <signal name="preferredWidthChanged"/>
<signal name="preferredHeightChanged"/> <signal name="preferredHeightChanged"/>
<signal name="urlChanged"/> <signal name="urlChanged"/>
@@ -3139,6 +3157,10 @@
<signal name="newWindowComponentChanged"/> <signal name="newWindowComponentChanged"/>
<signal name="newWindowParentChanged"/> <signal name="newWindowParentChanged"/>
<signal name="renderingEnabledChanged"/> <signal name="renderingEnabledChanged"/>
<signal name="contentsSizeChanged">
<param type="QSize"/>
</signal>
<signal name="contentsScaleChanged"/>
<signal name="loadStarted"/> <signal name="loadStarted"/>
<signal name="loadFinished"/> <signal name="loadFinished"/>
<signal name="loadFailed"/> <signal name="loadFailed"/>

View File

@@ -70,14 +70,14 @@ GroupBox {
property variant pureValue: backendValues.scale.value; property variant pureValue: backendValues.scale.value;
onPureValueChanged: { onPureValueChanged: {
if (value != pureValue * 100) if (value != pureValue * 100)
value = pureValue * 100; value = pureValue * 10;
} }
minimum: 1; minimum: 1;
maximum: 100; maximum: 100;
singleStep: 1; singleStep: 1;
onValueChanged: { onValueChanged: {
if ((value > 5) && (value < 100)) if ((value > 5) && (value < 100))
backendValues.scale.value = value / 100; backendValues.scale.value = value / 10;
} }
} }
} }

View File

@@ -21,6 +21,13 @@ GroupBox {
baseStateFlag: isBaseState; baseStateFlag: isBaseState;
checkable: true; checkable: true;
} }
}
}
QWidget {
layout: HorizontalLayout {
Label {
text: ""
}
CheckBox { CheckBox {
id: clipCheckBox; id: clipCheckBox;
text: qsTr("Clip") text: qsTr("Clip")

View File

@@ -24,7 +24,8 @@ QLabel {
padding: 0; padding: 0;
background: none; background: none;
color: #dedede; color: #dedede;
font: bold font: bold;
font-size: 11px;
} }
QScrollArea { QScrollArea {
@@ -38,7 +39,7 @@ QGroupBox
background-color: #4f4f4f; background-color: #4f4f4f;
border: 1px solid #4F4F4F; border: 1px solid #4F4F4F;
color: white; color: white;
font: bold font: bold ;
} }
QLineEdit QLineEdit

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -37,6 +37,7 @@ leave room for the Qt 4 target page.
<wizard version="1" kind="project" <wizard version="1" kind="project"
class="qt4project" firstpage="10" class="qt4project" firstpage="10"
id="QmlRuntimePlugin" category="F.Projects"> id="QmlRuntimePlugin" category="F.Projects">
<icon>lib.png</icon>
<description>Creates a C++ plugin to extend the funtionality of the QML runtime.</description> <description>Creates a C++ plugin to extend the funtionality of the QML runtime.</description>
<displayname>QML Runtime Plug-in</displayname> <displayname>QML Runtime Plug-in</displayname>
<displaycategory>QML Runtime Plug-in</displaycategory> <displaycategory>QML Runtime Plug-in</displaycategory>

View File

@@ -14499,7 +14499,7 @@ Die folgenden Encodings scheinen der Datei zu entsprechen:</translation>
<message> <message>
<location/> <location/>
<source>Color Scheme</source> <source>Color Scheme</source>
<translation>Farbschema:</translation> <translation>Farbschema</translation>
</message> </message>
<message> <message>
<location/> <location/>

View File

@@ -585,6 +585,17 @@ void PluginManager::profilingReport(const char *what, const PluginSpec *spec)
d->profilingReport(what, spec); d->profilingReport(what, spec);
} }
/*!
\fn void PluginManager::loadQueue()
Returns a list of plugins in load order.
*/
QList<PluginSpec *> PluginManager::loadQueue()
{
return d->loadQueue();
}
//============PluginManagerPrivate=========== //============PluginManagerPrivate===========
/*! /*!
@@ -786,13 +797,10 @@ bool PluginManagerPrivate::loadQueue(PluginSpec *spec, QList<PluginSpec *> &queu
circularityCheckQueue.append(spec); circularityCheckQueue.append(spec);
// check if we have the dependencies // check if we have the dependencies
if (spec->state() == PluginSpec::Invalid || spec->state() == PluginSpec::Read) { if (spec->state() == PluginSpec::Invalid || spec->state() == PluginSpec::Read) {
if (!spec->isDisabledIndirectly() && spec->isEnabled()) { queue.append(spec);
spec->d->hasError = true;
spec->d->errorString += "\n";
spec->d->errorString += PluginManager::tr("Cannot load plugin because dependencies are not resolved");
}
return false; return false;
} }
// add dependencies // add dependencies
foreach (PluginSpec *depSpec, spec->dependencySpecs()) { foreach (PluginSpec *depSpec, spec->dependencySpecs()) {
if (!loadQueue(depSpec, queue, circularityCheckQueue)) { if (!loadQueue(depSpec, queue, circularityCheckQueue)) {
@@ -814,7 +822,11 @@ bool PluginManagerPrivate::loadQueue(PluginSpec *spec, QList<PluginSpec *> &queu
*/ */
void PluginManagerPrivate::loadPlugin(PluginSpec *spec, PluginSpec::State destState) void PluginManagerPrivate::loadPlugin(PluginSpec *spec, PluginSpec::State destState)
{ {
if (spec->hasError() || spec->isDisabledIndirectly()) if (spec->hasError() || spec->state() != destState-1)
return;
// don't load disabled plugins.
if ((spec->isDisabledIndirectly() || !spec->isEnabled()) && destState == PluginSpec::Loaded)
return; return;
switch (destState) { switch (destState) {
@@ -927,6 +939,9 @@ void PluginManagerPrivate::resolveDependencies()
foreach (PluginSpec *spec, pluginSpecs) { foreach (PluginSpec *spec, pluginSpecs) {
spec->d->resolveDependencies(pluginSpecs); spec->d->resolveDependencies(pluginSpecs);
} }
foreach (PluginSpec *spec, loadQueue()) {
spec->d->disableIndirectlyIfDependencyDisabled();
}
} }
// Look in argument descriptions of the specs for the option. // Look in argument descriptions of the specs for the option.

View File

@@ -91,6 +91,7 @@ public:
} }
// Plugin operations // Plugin operations
QList<PluginSpec *> loadQueue();
void loadPlugins(); void loadPlugins();
QStringList pluginPaths() const; QStringList pluginPaths() const;
void setPluginPaths(const QStringList &paths); void setPluginPaths(const QStringList &paths);

View File

@@ -500,6 +500,11 @@ void PluginSpec::setEnabled(bool value)
d->enabled = value; d->enabled = value;
} }
void PluginSpec::setDisabledIndirectly(bool value)
{
d->disabledIndirectly = value;
}
/*! /*!
\fn bool PluginSpecPrivate::reportError(const QString &err) \fn bool PluginSpecPrivate::reportError(const QString &err)
\internal \internal
@@ -799,11 +804,7 @@ bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
foreach (PluginSpec *spec, specs) { foreach (PluginSpec *spec, specs) {
if (spec->provides(dependency.name, dependency.version)) { if (spec->provides(dependency.name, dependency.version)) {
found = spec; found = spec;
if (!spec->isEnabled() || spec->isDisabledIndirectly())
disabledIndirectly = true;
spec->d->addProvidesForPlugin(q); spec->d->addProvidesForPlugin(q);
break; break;
} }
} }
@@ -822,12 +823,26 @@ bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
dependencySpecs = resolvedDependencies; dependencySpecs = resolvedDependencies;
if (enabled && !disabledIndirectly)
state = PluginSpec::Resolved; state = PluginSpec::Resolved;
return true; return true;
} }
void PluginSpecPrivate::disableIndirectlyIfDependencyDisabled()
{
disabledIndirectly = false;
if (!enabled)
return;
foreach (PluginSpec *dependencySpec, dependencySpecs) {
if (dependencySpec->isDisabledIndirectly() || !dependencySpec->isEnabled()) {
disabledIndirectly = true;
break;
}
}
}
/*! /*!
\fn bool PluginSpecPrivate::loadLibrary() \fn bool PluginSpecPrivate::loadLibrary()
\internal \internal

View File

@@ -92,6 +92,7 @@ public:
QString filePath() const; QString filePath() const;
void setEnabled(bool value); void setEnabled(bool value);
void setDisabledIndirectly(bool value);
QStringList arguments() const; QStringList arguments() const;
void setArguments(const QStringList &arguments); void setArguments(const QStringList &arguments);

View File

@@ -92,6 +92,8 @@ public:
// add/remove from providesSpecs // add/remove from providesSpecs
void addProvidesForPlugin(PluginSpec *dependent); void addProvidesForPlugin(PluginSpec *dependent);
void removeProvidesForPlugin(PluginSpec *dependent); void removeProvidesForPlugin(PluginSpec *dependent);
void disableIndirectlyIfDependencyDisabled();
private: private:
PluginSpec *q; PluginSpec *q;

View File

@@ -177,8 +177,7 @@ void PluginView::updateList()
defaultCollectionItem->setToolTip(C_LOAD, tr("Load on Startup")); defaultCollectionItem->setToolTip(C_LOAD, tr("Load on Startup"));
defaultCollectionItem->setData(0, Qt::UserRole, qVariantFromValue(defaultCollection)); defaultCollectionItem->setData(0, Qt::UserRole, qVariantFromValue(defaultCollection));
foreach (PluginSpec *spec, m_specToItem.keys()) updatePluginDependencies();
toggleRelatedPlugins(spec, spec->isEnabled() && !spec->isDisabledIndirectly());
m_ui->categoryWidget->clear(); m_ui->categoryWidget->clear();
if (!m_items.isEmpty()) { if (!m_items.isEmpty()) {
@@ -301,7 +300,7 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column)
if (column == C_LOAD) { if (column == C_LOAD) {
spec->setEnabled(loadOnStartup); spec->setEnabled(loadOnStartup);
toggleRelatedPlugins(spec, loadOnStartup); updatePluginDependencies();
if (item->parent()) { if (item->parent()) {
PluginCollection *collection = item->parent()->data(0, Qt::UserRole).value<PluginCollection *>(); PluginCollection *collection = item->parent()->data(0, Qt::UserRole).value<PluginCollection *>();
@@ -332,33 +331,36 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column)
spec->setEnabled(loadOnStartup); spec->setEnabled(loadOnStartup);
Qt::CheckState state = (loadOnStartup ? Qt::Checked : Qt::Unchecked); Qt::CheckState state = (loadOnStartup ? Qt::Checked : Qt::Unchecked);
child->setData(C_LOAD, Qt::CheckStateRole, state); child->setData(C_LOAD, Qt::CheckStateRole, state);
toggleRelatedPlugins(spec, loadOnStartup);
} else { } else {
child->setData(C_LOAD, Qt::CheckStateRole, Qt::Checked); child->setData(C_LOAD, Qt::CheckStateRole, Qt::Checked);
child->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); child->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
} }
} }
updatePluginDependencies();
emit pluginSettingsChanged(collection->plugins().first()); emit pluginSettingsChanged(collection->plugins().first());
} }
m_allowCheckStateUpdate = true; m_allowCheckStateUpdate = true;
} }
void PluginView::toggleRelatedPlugins(PluginSpec *modifiedPlugin, bool isPluginEnabled) void PluginView::updatePluginDependencies()
{ {
foreach (PluginSpec *spec, PluginManager::instance()->loadQueue()) {
for(int i = 0; i < modifiedPlugin->providesForSpecs().length(); ++i) { bool disableIndirectly = false;
PluginSpec *spec = modifiedPlugin->providesForSpecs().at(i); foreach(const PluginSpec *depSpec, spec->dependencySpecs()) {
if (!depSpec->isEnabled() || depSpec->isDisabledIndirectly()) {
disableIndirectly = true;
break;
}
}
QTreeWidgetItem *childItem = m_specToItem.value(spec); QTreeWidgetItem *childItem = m_specToItem.value(spec);
childItem->setDisabled(disableIndirectly);
if (disableIndirectly == spec->isDisabledIndirectly())
continue;
spec->setDisabledIndirectly(disableIndirectly);
if (childItem->isDisabled() != !isPluginEnabled) {
childItem->setDisabled(!isPluginEnabled);
if (childItem->parent() && !childItem->parent()->isExpanded()) if (childItem->parent() && !childItem->parent()->isExpanded())
childItem->parent()->setExpanded(true); childItem->parent()->setExpanded(true);
toggleRelatedPlugins(spec, isPluginEnabled);
} }
} }
}

View File

@@ -77,7 +77,7 @@ private slots:
private: private:
enum ParsedState { ParsedNone = 1, ParsedPartial = 2, ParsedAll = 4, ParsedWithErrors = 8}; enum ParsedState { ParsedNone = 1, ParsedPartial = 2, ParsedAll = 4, ParsedWithErrors = 8};
QIcon iconForState(int state); QIcon iconForState(int state);
void toggleRelatedPlugins(PluginSpec *spec, bool isPluginEnabled = true); void updatePluginDependencies();
int parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &groupState, QList<PluginSpec*> plugins); int parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &groupState, QList<PluginSpec*> plugins);
Internal::Ui::PluginView *m_ui; Internal::Ui::PluginView *m_ui;

View File

@@ -34,7 +34,6 @@
#include "parser/qmljsast_p.h" #include "parser/qmljsast_p.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QCoreApplication>
#include <QtGui/QColor> #include <QtGui/QColor>
#include <QtGui/QApplication> #include <QtGui/QApplication>
@@ -64,13 +63,27 @@ public:
return _message; return _message;
} }
virtual void visit(const NumberValue *) virtual void visit(const NumberValue *value)
{ {
// ### Consider enums: elide: "ElideLeft" is valid, but currently elide is a NumberValue. if (const QmlEnumValue *enumValue = dynamic_cast<const QmlEnumValue *>(value)) {
if (StringLiteral *stringLiteral = cast<StringLiteral *>(_ast)) {
const QString valueName = stringLiteral->value->asString();
if (!enumValue->keys().contains(valueName)) {
_message.message = Check::tr("unknown value for enum");
}
} else if (_rhsValue->asUndefinedValue()) {
_message.kind = DiagnosticMessage::Warning;
_message.message = Check::tr("value might be 'undefined'");
} else if (! _rhsValue->asStringValue() && ! _rhsValue->asNumberValue()) {
_message.message = Check::tr("enum value is not a string or number");
}
} else {
if (/*cast<StringLiteral *>(_ast) if (/*cast<StringLiteral *>(_ast)
||*/ _ast->kind == Node::Kind_TrueLiteral ||*/ _ast->kind == Node::Kind_TrueLiteral
|| _ast->kind == Node::Kind_FalseLiteral) { || _ast->kind == Node::Kind_FalseLiteral) {
_message.message = QCoreApplication::translate("QmlJS::Check", "numerical value expected"); _message.message = Check::tr("numerical value expected");
}
} }
} }
@@ -81,7 +94,7 @@ public:
if (cast<StringLiteral *>(_ast) if (cast<StringLiteral *>(_ast)
|| cast<NumericLiteral *>(_ast) || cast<NumericLiteral *>(_ast)
|| (unaryMinus && cast<NumericLiteral *>(unaryMinus->expression))) { || (unaryMinus && cast<NumericLiteral *>(unaryMinus->expression))) {
_message.message = QCoreApplication::translate("QmlJS::Check", "boolean value expected"); _message.message = Check::tr("boolean value expected");
} }
} }
@@ -93,23 +106,7 @@ public:
|| (unaryMinus && cast<NumericLiteral *>(unaryMinus->expression)) || (unaryMinus && cast<NumericLiteral *>(unaryMinus->expression))
|| _ast->kind == Node::Kind_TrueLiteral || _ast->kind == Node::Kind_TrueLiteral
|| _ast->kind == Node::Kind_FalseLiteral) { || _ast->kind == Node::Kind_FalseLiteral) {
_message.message = QCoreApplication::translate("QmlJS::Check", "string value expected"); _message.message = Check::tr("string value expected");
}
}
virtual void visit(const EasingCurveNameValue *)
{
if (StringLiteral *stringLiteral = cast<StringLiteral *>(_ast)) {
const QString curveName = stringLiteral->value->asString();
if (!EasingCurveNameValue::curveNames().contains(curveName)) {
_message.message = QCoreApplication::translate("QmlJS::Check", "unknown easing-curve name");
}
} else if (_rhsValue->asUndefinedValue()) {
_message.kind = DiagnosticMessage::Warning;
_message.message = QCoreApplication::translate("QmlJS::Check", "value might be 'undefined'");
} else if (! _rhsValue->asStringValue()) {
_message.message = QCoreApplication::translate("QmlJS::Check", "easing-curve name is not a string");
} }
} }
@@ -134,7 +131,7 @@ public:
ok = QColor::isValidColor(colorString); ok = QColor::isValidColor(colorString);
} }
if (!ok) if (!ok)
_message.message = QCoreApplication::translate("QmlJS::Check", "not a valid color"); _message.message = Check::tr("not a valid color");
} else { } else {
visit((StringValue *)0); visit((StringValue *)0);
} }
@@ -143,7 +140,7 @@ public:
virtual void visit(const AnchorLineValue *) virtual void visit(const AnchorLineValue *)
{ {
if (! (_rhsValue->asAnchorLineValue() || _rhsValue->asUndefinedValue())) if (! (_rhsValue->asAnchorLineValue() || _rhsValue->asUndefinedValue()))
_message.message = QCoreApplication::translate("QmlJS::Check", "expected anchor line"); _message.message = Check::tr("expected anchor line");
} }
DiagnosticMessage _message; DiagnosticMessage _message;
@@ -211,7 +208,7 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
if (! _context.lookupType(_doc.data(), typeId)) { if (! _context.lookupType(_doc.data(), typeId)) {
if (! _ignoreTypeErrors) if (! _ignoreTypeErrors)
error(typeId->identifierToken, error(typeId->identifierToken,
QCoreApplication::translate("QmlJS::Check", "unknown type")); Check::tr("unknown type"));
// suppress subsequent errors about scope object lookup by clearing // suppress subsequent errors about scope object lookup by clearing
// the scope object list // the scope object list
// ### todo: better way? // ### todo: better way?
@@ -236,7 +233,7 @@ bool Check::visit(UiScriptBinding *ast)
ExpressionStatement *expStmt = cast<ExpressionStatement *>(ast->statement); ExpressionStatement *expStmt = cast<ExpressionStatement *>(ast->statement);
if (!expStmt) { if (!expStmt) {
error(loc, QCoreApplication::translate("QmlJS::Check", "expected id")); error(loc, Check::tr("expected id"));
return false; return false;
} }
@@ -245,14 +242,14 @@ bool Check::visit(UiScriptBinding *ast)
id = idExp->name->asString(); id = idExp->name->asString();
} else if (StringLiteral *strExp = cast<StringLiteral *>(expStmt->expression)) { } else if (StringLiteral *strExp = cast<StringLiteral *>(expStmt->expression)) {
id = strExp->value->asString(); id = strExp->value->asString();
warning(loc, QCoreApplication::translate("QmlJS::Check", "using string literals for ids is discouraged")); warning(loc, Check::tr("using string literals for ids is discouraged"));
} else { } else {
error(loc, QCoreApplication::translate("QmlJS::Check", "expected id")); error(loc, Check::tr("expected id"));
return false; return false;
} }
if (id.isEmpty() || ! id[0].isLower()) { if (id.isEmpty() || ! id[0].isLower()) {
error(loc, QCoreApplication::translate("QmlJS::Check", "ids must be lower case")); error(loc, Check::tr("ids must be lower case"));
return false; return false;
} }
} }
@@ -325,7 +322,7 @@ const Value *Check::checkScopeObjectMember(const UiQualifiedId *id)
} }
if (!value) { if (!value) {
error(id->identifierToken, error(id->identifierToken,
QCoreApplication::translate("QmlJS::Check", "'%1' is not a valid property name").arg(propertyName)); Check::tr("'%1' is not a valid property name").arg(propertyName));
} }
// can't look up members for attached properties // can't look up members for attached properties
@@ -338,7 +335,7 @@ const Value *Check::checkScopeObjectMember(const UiQualifiedId *id)
const ObjectValue *objectValue = value_cast<const ObjectValue *>(value); const ObjectValue *objectValue = value_cast<const ObjectValue *>(value);
if (! objectValue) { if (! objectValue) {
error(idPart->identifierToken, error(idPart->identifierToken,
QCoreApplication::translate("QmlJS::Check", "'%1' does not have members").arg(propertyName)); Check::tr("'%1' does not have members").arg(propertyName));
return 0; return 0;
} }
@@ -354,7 +351,7 @@ const Value *Check::checkScopeObjectMember(const UiQualifiedId *id)
value = objectValue->lookupMember(propertyName, &_context); value = objectValue->lookupMember(propertyName, &_context);
if (! value) { if (! value) {
error(idPart->identifierToken, error(idPart->identifierToken,
QCoreApplication::translate("QmlJS::Check", "'%1' is not a member of '%2'").arg( Check::tr("'%1' is not a member of '%2'").arg(
propertyName, objectValue->className())); propertyName, objectValue->className()));
return 0; return 0;
} }

View File

@@ -36,10 +36,14 @@
#include <qmljs/qmljsscopebuilder.h> #include <qmljs/qmljsscopebuilder.h>
#include <qmljs/parser/qmljsastvisitor_p.h> #include <qmljs/parser/qmljsastvisitor_p.h>
#include <QtCore/QCoreApplication>
namespace QmlJS { namespace QmlJS {
class QMLJS_EXPORT Check: protected AST::Visitor class QMLJS_EXPORT Check: protected AST::Visitor
{ {
Q_DECLARE_TR_FUNCTIONS(QmlJS::Check)
public: public:
Check(Document::Ptr doc, const Snapshot &snapshot, const QStringList &importPaths); Check(Document::Ptr doc, const Snapshot &snapshot, const QStringList &importPaths);
virtual ~Check(); virtual ~Check();

View File

@@ -25,6 +25,10 @@ CompletionContextFinder::CompletionContextFinder(const QTextCursor &cursor)
initialize(cursor.document()->begin(), lastBlock); initialize(cursor.document()->begin(), lastBlock);
m_startTokenIndex = yyLinizerState.tokens.size() - 1; m_startTokenIndex = yyLinizerState.tokens.size() - 1;
// Initialize calls readLine - which skips empty lines. We should only adjust
// the start token index if the linizer still is in the same block as the cursor.
if (yyLinizerState.iter == cursor.block()) {
for (; m_startTokenIndex >= 0; --m_startTokenIndex) { for (; m_startTokenIndex >= 0; --m_startTokenIndex) {
const Token &token = yyLinizerState.tokens.at(m_startTokenIndex); const Token &token = yyLinizerState.tokens.at(m_startTokenIndex);
if (token.end() <= cursor.positionInBlock()) if (token.end() <= cursor.positionInBlock())
@@ -33,6 +37,7 @@ CompletionContextFinder::CompletionContextFinder(const QTextCursor &cursor)
if (m_startTokenIndex == yyLinizerState.tokens.size() - 1 && yyLinizerState.insertedSemicolon) if (m_startTokenIndex == yyLinizerState.tokens.size() - 1 && yyLinizerState.insertedSemicolon)
--m_startTokenIndex; --m_startTokenIndex;
}
getQmlObjectTypeName(m_startTokenIndex); getQmlObjectTypeName(m_startTokenIndex);
checkBinding(); checkBinding();

View File

@@ -14,9 +14,6 @@ class QMLJS_EXPORT CompletionContextFinder : public LineInfo
public: public:
CompletionContextFinder(const QTextCursor &cursor); CompletionContextFinder(const QTextCursor &cursor);
//bool inQmlObjectDefinition();
bool inQmlBindingRhs();
QStringList qmlObjectTypeName() const; QStringList qmlObjectTypeName() const;
bool isInQmlContext() const; bool isInQmlContext() const;

View File

@@ -326,6 +326,8 @@ public:
class QmlXmlReader class QmlXmlReader
{ {
Q_DECLARE_TR_FUNCTIONS(QmlJS::Interpreter::QmlXmlReader)
public: public:
QmlXmlReader(QIODevice *dev) QmlXmlReader(QIODevice *dev)
: _xml(dev) : _xml(dev)
@@ -339,7 +341,7 @@ public:
if (_xml.name() == "module") if (_xml.name() == "module")
readModule(); readModule();
else else
_xml.raiseError(QCoreApplication::translate("QmlJS::Interpreter::QmlXmlReader", "The file is not module file.")); _xml.raiseError(tr("The file is not module file."));
} }
return !_xml.error(); return !_xml.error();
@@ -351,7 +353,7 @@ public:
private: private:
void unexpectedElement(const QStringRef &child, const QString &parent) { void unexpectedElement(const QStringRef &child, const QString &parent) {
_xml.raiseError(QCoreApplication::translate("QmlJS::Interpreter::QmlXmlReader", "Unexpected element <%1> in <%2>").arg(child.toString(), parent)); _xml.raiseError(tr("Unexpected element <%1> in <%2>").arg(child.toString(), parent));
} }
void ignoreAttr(const QXmlStreamAttribute &attr) { void ignoreAttr(const QXmlStreamAttribute &attr) {
@@ -360,11 +362,11 @@ private:
} }
void invalidAttr(const QString &value, const QString &attrName, const QString &tag) { void invalidAttr(const QString &value, const QString &attrName, const QString &tag) {
_xml.raiseError(QCoreApplication::translate("QmlJS::Interpreter::QmlXmlReader", "invalid value '%1' for attribute %2 in <%3>").arg(value, attrName, tag)); _xml.raiseError(tr("invalid value '%1' for attribute %2 in <%3>").arg(value, attrName, tag));
} }
void noValidAttr(const QString &attrName, const QString &tag) { void noValidAttr(const QString &attrName, const QString &tag) {
_xml.raiseError(QCoreApplication::translate("QmlJS::Interpreter::QmlXmlReader", "<%1> has no valid %2 attribute").arg(tag, attrName)); _xml.raiseError(tr("<%1> has no valid %2 attribute").arg(tag, attrName));
} }
void readModule() void readModule()
@@ -846,15 +848,6 @@ const Value *QmlObjectValue::propertyValue(const FakeMetaProperty &prop) const
value = engine()->colorValue(); value = engine()->colorValue();
} else if (typeName == QLatin1String("QDeclarativeAnchorLine")) { } else if (typeName == QLatin1String("QDeclarativeAnchorLine")) {
value = engine()->anchorLineValue(); value = engine()->anchorLineValue();
} else if (typeName == QLatin1String("QEasingCurve")) {
// ### cache
ObjectValue *object = engine()->newObject(/*prototype =*/ 0);
object->setClassName(QLatin1String("EasingCurve"));
object->setProperty("type", engine()->easingCurveNameValue());
object->setProperty("period", engine()->numberValue());
object->setProperty("amplitude", engine()->numberValue());
object->setProperty("overshoot", engine()->numberValue());
value = object;
} }
// might be an enum // might be an enum
@@ -1199,10 +1192,6 @@ void ValueVisitor::visit(const Reference *)
{ {
} }
void ValueVisitor::visit(const EasingCurveNameValue *)
{
}
void ValueVisitor::visit(const ColorValue *) void ValueVisitor::visit(const ColorValue *)
{ {
} }
@@ -1267,11 +1256,6 @@ const Reference *Value::asReference() const
return 0; return 0;
} }
const EasingCurveNameValue *Value::asEasingCurveNameValue() const
{
return 0;
}
const ColorValue *Value::asColorValue() const const ColorValue *Value::asColorValue() const
{ {
return 0; return 0;
@@ -1411,13 +1395,6 @@ Context::~Context()
{ {
} }
void Context::build(const QList<Node *> &astPath, QmlJS::Document::Ptr doc,
const QmlJS::Snapshot &snapshot, const QStringList &importPaths)
{
Link link(this, doc, snapshot, importPaths);
ScopeBuilder(doc, this).push(astPath);
}
Engine *Context::engine() const Engine *Context::engine() const
{ {
return _engine; return _engine;
@@ -1557,67 +1534,6 @@ const Value *Reference::value(Context *) const
return _engine->undefinedValue(); return _engine->undefinedValue();
} }
void EasingCurveNameValue::accept(ValueVisitor *visitor) const
{
visitor->visit(this);
}
QSet<QString> EasingCurveNameValue::_curveNames;
QSet<QString> EasingCurveNameValue::curveNames()
{
if (_curveNames.isEmpty()) {
_curveNames = QSet<QString>()
<< "Linear"
<< "InQuad"
<< "OutQuad"
<< "InOutQuad"
<< "OutInQuad"
<< "InCubic"
<< "OutCubic"
<< "InOutCubic"
<< "OutInCubic"
<< "InQuart"
<< "OutQuart"
<< "InOutQuart"
<< "OutInQuart"
<< "InQuint"
<< "OutQuint"
<< "InOutQuint"
<< "OutInQuint"
<< "InSine"
<< "OutSine"
<< "InOutSine"
<< "OutInSine"
<< "InExpo"
<< "OutExpo"
<< "InOutExpo"
<< "OutInExpo"
<< "InCirc"
<< "OutCirc"
<< "InOutCirc"
<< "OutInCirc"
<< "InElastic"
<< "OutElastic"
<< "InOutElastic"
<< "OutInElastic"
<< "InBack"
<< "OutBack"
<< "InOutBack"
<< "OutInBack"
<< "InBounce"
<< "OutBounce"
<< "InOutBounce"
<< "OutInBounce";
}
return _curveNames;
}
const EasingCurveNameValue *EasingCurveNameValue::asEasingCurveNameValue() const
{
return this;
}
void ColorValue::accept(ValueVisitor *visitor) const void ColorValue::accept(ValueVisitor *visitor) const
{ {
visitor->visit(this); visitor->visit(this);
@@ -1999,7 +1915,7 @@ QStringList MetaTypeSystem::load(const QFileInfoList &xmlFiles)
} }
file.close(); file.close();
} else { } else {
errorMsgs.append(QCoreApplication::translate("QmlJS::Interpreter::QmlXmlReader", "%1: %2").arg(xmlFile.absoluteFilePath(), errorMsgs.append(QmlXmlReader::tr("%1: %2").arg(xmlFile.absoluteFilePath(),
file.errorString())); file.errorString()));
} }
} }
@@ -2337,11 +2253,6 @@ void TypeId::visit(const FunctionValue *object)
_result = QLatin1String("Function"); _result = QLatin1String("Function");
} }
void TypeId::visit(const EasingCurveNameValue *)
{
_result = QLatin1String("string");
}
void TypeId::visit(const ColorValue *) void TypeId::visit(const ColorValue *)
{ {
_result = QLatin1String("string"); _result = QLatin1String("string");
@@ -2412,11 +2323,6 @@ const StringValue *Engine::stringValue() const
return &_stringValue; return &_stringValue;
} }
const EasingCurveNameValue *Engine::easingCurveNameValue() const
{
return &_easingCurveNameValue;
}
const ColorValue *Engine::colorValue() const const ColorValue *Engine::colorValue() const
{ {
return &_colorValue; return &_colorValue;

View File

@@ -60,7 +60,6 @@ class StringValue;
class ObjectValue; class ObjectValue;
class FunctionValue; class FunctionValue;
class Reference; class Reference;
class EasingCurveNameValue;
class ColorValue; class ColorValue;
class AnchorLineValue; class AnchorLineValue;
@@ -88,7 +87,6 @@ public:
virtual void visit(const ObjectValue *); virtual void visit(const ObjectValue *);
virtual void visit(const FunctionValue *); virtual void visit(const FunctionValue *);
virtual void visit(const Reference *); virtual void visit(const Reference *);
virtual void visit(const EasingCurveNameValue *);
virtual void visit(const ColorValue *); virtual void visit(const ColorValue *);
virtual void visit(const AnchorLineValue *); virtual void visit(const AnchorLineValue *);
}; };
@@ -113,7 +111,6 @@ public:
virtual const ObjectValue *asObjectValue() const; virtual const ObjectValue *asObjectValue() const;
virtual const FunctionValue *asFunctionValue() const; virtual const FunctionValue *asFunctionValue() const;
virtual const Reference *asReference() const; virtual const Reference *asReference() const;
virtual const EasingCurveNameValue *asEasingCurveNameValue() const;
virtual const ColorValue *asColorValue() const; virtual const ColorValue *asColorValue() const;
virtual const AnchorLineValue *asAnchorLineValue() const; virtual const AnchorLineValue *asAnchorLineValue() const;
@@ -172,12 +169,6 @@ template <> Q_INLINE_TEMPLATE const Reference *value_cast(const Value *v)
else return 0; else return 0;
} }
template <> Q_INLINE_TEMPLATE const EasingCurveNameValue *value_cast(const Value *v)
{
if (v) return v->asEasingCurveNameValue();
else return 0;
}
template <> Q_INLINE_TEMPLATE const ColorValue *value_cast(const Value *v) template <> Q_INLINE_TEMPLATE const ColorValue *value_cast(const Value *v)
{ {
if (v) return v->asColorValue(); if (v) return v->asColorValue();
@@ -289,9 +280,6 @@ public:
Context(Engine *engine); Context(Engine *engine);
~Context(); ~Context();
void build(const QList<AST::Node *> &astPath, const Document::Ptr doc,
const Snapshot &snapshot, const QStringList &importPaths);
Engine *engine() const; Engine *engine() const;
const ScopeChain &scopeChain() const; const ScopeChain &scopeChain() const;
ScopeChain &scopeChain(); ScopeChain &scopeChain();
@@ -342,18 +330,6 @@ private:
Engine *_engine; Engine *_engine;
}; };
class QMLJS_EXPORT EasingCurveNameValue: public Value
{
static QSet<QString> _curveNames;
public:
static QSet<QString> curveNames();
// Value interface
virtual const EasingCurveNameValue *asEasingCurveNameValue() const;
virtual void accept(ValueVisitor *) const;
};
class QMLJS_EXPORT ColorValue: public Value class QMLJS_EXPORT ColorValue: public Value
{ {
public: public:
@@ -639,7 +615,6 @@ protected:
virtual void visit(const StringValue *); virtual void visit(const StringValue *);
virtual void visit(const ObjectValue *object); virtual void visit(const ObjectValue *object);
virtual void visit(const FunctionValue *object); virtual void visit(const FunctionValue *object);
virtual void visit(const EasingCurveNameValue *);
virtual void visit(const ColorValue *); virtual void visit(const ColorValue *);
virtual void visit(const AnchorLineValue *); virtual void visit(const AnchorLineValue *);
}; };
@@ -658,7 +633,6 @@ public:
const NumberValue *numberValue() const; const NumberValue *numberValue() const;
const BooleanValue *booleanValue() const; const BooleanValue *booleanValue() const;
const StringValue *stringValue() const; const StringValue *stringValue() const;
const EasingCurveNameValue *easingCurveNameValue() const;
const ColorValue *colorValue() const; const ColorValue *colorValue() const;
const AnchorLineValue *anchorLineValue() const; const AnchorLineValue *anchorLineValue() const;
@@ -744,7 +718,6 @@ private:
NumberValue _numberValue; NumberValue _numberValue;
BooleanValue _booleanValue; BooleanValue _booleanValue;
StringValue _stringValue; StringValue _stringValue;
EasingCurveNameValue _easingCurveNameValue;
ColorValue _colorValue; ColorValue _colorValue;
AnchorLineValue _anchorLineValue; AnchorLineValue _anchorLineValue;
QList<Value *> _registeredValues; QList<Value *> _registeredValues;

View File

@@ -8,7 +8,6 @@
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QCoreApplication>
using namespace QmlJS; using namespace QmlJS;
using namespace QmlJS::Interpreter; using namespace QmlJS::Interpreter;
@@ -211,7 +210,7 @@ void Link::importFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc,
importNamespace->setProperty(targetName, importedDoc->bind()->rootObjectValue()); importNamespace->setProperty(targetName, importedDoc->bind()->rootObjectValue());
} else { } else {
error(doc, import->fileNameToken, error(doc, import->fileNameToken,
QCoreApplication::translate("QmlJS::Link", "could not find file or directory")); tr("could not find file or directory"));
} }
} }
@@ -253,7 +252,7 @@ void Link::importNonFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc, A
const int dotIdx = versionString.indexOf(QLatin1Char('.')); const int dotIdx = versionString.indexOf(QLatin1Char('.'));
if (dotIdx == -1) { if (dotIdx == -1) {
error(doc, import->versionToken, error(doc, import->versionToken,
QCoreApplication::translate("QmlJS::Link", "expected two numbers separated by a dot")); tr("expected two numbers separated by a dot"));
return; return;
} else { } else {
majorVersion = versionString.left(dotIdx).toInt(); majorVersion = versionString.left(dotIdx).toInt();
@@ -261,7 +260,7 @@ void Link::importNonFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc, A
} }
} else { } else {
error(doc, locationFromRange(import->firstSourceLocation(), import->lastSourceLocation()), error(doc, locationFromRange(import->firstSourceLocation(), import->lastSourceLocation()),
QCoreApplication::translate("QmlJS::Link", "package import requires a version number")); tr("package import requires a version number"));
return; return;
} }
@@ -307,7 +306,7 @@ void Link::importNonFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc, A
} }
error(doc, locationFromRange(import->firstSourceLocation(), import->lastSourceLocation()), error(doc, locationFromRange(import->firstSourceLocation(), import->lastSourceLocation()),
QCoreApplication::translate("QmlJS::Link", "package not found")); tr("package not found"));
} }
UiQualifiedId *Link::qualifiedTypeNameId(Node *node) UiQualifiedId *Link::qualifiedTypeNameId(Node *node)

View File

@@ -8,6 +8,7 @@
#include <QtCore/QList> #include <QtCore/QList>
#include <QtCore/QHash> #include <QtCore/QHash>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include <QtCore/QCoreApplication>
namespace QmlJS { namespace QmlJS {
@@ -18,6 +19,8 @@ class NameId;
*/ */
class QMLJS_EXPORT Link class QMLJS_EXPORT Link
{ {
Q_DECLARE_TR_FUNCTIONS(QmlJS::Link)
public: public:
// Link all documents in snapshot // Link all documents in snapshot
Link(Interpreter::Context *context, const Document::Ptr &doc, const Snapshot &snapshot, Link(Interpreter::Context *context, const Document::Ptr &doc, const Snapshot &snapshot,

View File

@@ -33,6 +33,7 @@ void ScopeBuilder::push(AST::Node *node)
// JS scopes // JS scopes
if (FunctionDeclaration *fun = cast<FunctionDeclaration *>(node)) { if (FunctionDeclaration *fun = cast<FunctionDeclaration *>(node)) {
ObjectValue *functionScope = _doc->bind()->findFunctionScope(fun); ObjectValue *functionScope = _doc->bind()->findFunctionScope(fun);
if (functionScope)
_context->scopeChain().jsScopes += functionScope; _context->scopeChain().jsScopes += functionScope;
} }
@@ -106,14 +107,7 @@ void ScopeBuilder::setQmlScopeObject(Node *node)
// check if the object has a Qt.PropertyChanges ancestor // check if the object has a Qt.PropertyChanges ancestor
prototype = scopeObject->prototype(_context); prototype = scopeObject->prototype(_context);
while (prototype) { prototype = isPropertyChangesObject(_context, prototype);
if (const QmlObjectValue *qmlMetaObject = dynamic_cast<const QmlObjectValue *>(prototype)) {
if (qmlMetaObject->className() == QLatin1String("PropertyChanges")
&& qmlMetaObject->packageName() == QLatin1String("Qt"))
break;
}
prototype = prototype->prototype(_context);
}
// find the target script binding // find the target script binding
if (prototype) { if (prototype) {
UiObjectInitializer *initializer = 0; UiObjectInitializer *initializer = 0;
@@ -169,3 +163,19 @@ const Value *ScopeBuilder::scopeObjectLookup(AST::UiQualifiedId *id)
return result; return result;
} }
const ObjectValue *ScopeBuilder::isPropertyChangesObject(Context *context,
const ObjectValue *object)
{
const ObjectValue *prototype = object;
while (prototype) {
if (const QmlObjectValue *qmlMetaObject = dynamic_cast<const QmlObjectValue *>(prototype)) {
if (qmlMetaObject->className() == QLatin1String("PropertyChanges")
&& qmlMetaObject->packageName() == QLatin1String("Qt"))
return prototype;
}
prototype = prototype->prototype(context);
}
return 0;
}

View File

@@ -14,6 +14,7 @@ namespace AST {
namespace Interpreter { namespace Interpreter {
class Context; class Context;
class Value; class Value;
class ObjectValue;
} }
class QMLJS_EXPORT ScopeBuilder class QMLJS_EXPORT ScopeBuilder
@@ -26,6 +27,8 @@ public:
void push(const QList<AST::Node *> &nodes); void push(const QList<AST::Node *> &nodes);
void pop(); void pop();
static const Interpreter::ObjectValue *isPropertyChangesObject(Interpreter::Context *context, const Interpreter::ObjectValue *object);
private: private:
void setQmlScopeObject(AST::Node *node); void setQmlScopeObject(AST::Node *node);
const Interpreter::Value *scopeObjectLookup(AST::UiQualifiedId *id); const Interpreter::Value *scopeObjectLookup(AST::UiQualifiedId *id);

View File

@@ -59,5 +59,11 @@
<file>images/darkclose.png</file> <file>images/darkclose.png</file>
<file>images/arrowdown.png</file> <file>images/arrowdown.png</file>
<file>images/arrowup.png</file> <file>images/arrowup.png</file>
<file>images/category_fakevim.png</file>
<file>images/category_locator.png</file>
<file>images/category_cpaster.png</file>
<file>images/category_cpp.png</file>
<file>images/category_vcs.png</file>
<file>images/category_qml.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -56,7 +56,6 @@ ICore* ICore::instance()
} }
CoreImpl::CoreImpl(MainWindow *mainwindow) CoreImpl::CoreImpl(MainWindow *mainwindow)
: m_preferredWizardKinds(IWizard::ProjectWizard)
{ {
m_instance = this; m_instance = this;
m_mainwindow = mainwindow; m_mainwindow = mainwindow;
@@ -69,11 +68,6 @@ QStringList CoreImpl::showNewItemDialog(const QString &title,
return m_mainwindow->showNewItemDialog(title, wizards, defaultLocation); return m_mainwindow->showNewItemDialog(title, wizards, defaultLocation);
} }
void CoreImpl::setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds)
{
m_preferredWizardKinds = kinds;
}
bool CoreImpl::showOptionsDialog(const QString &group, const QString &page, QWidget *parent) bool CoreImpl::showOptionsDialog(const QString &group, const QString &page, QWidget *parent)
{ {
return m_mainwindow->showOptionsDialog(group, page, parent); return m_mainwindow->showOptionsDialog(group, page, parent);

View File

@@ -47,8 +47,6 @@ public:
QStringList showNewItemDialog(const QString &title, QStringList showNewItemDialog(const QString &title,
const QList<IWizard *> &wizards, const QList<IWizard *> &wizards,
const QString &defaultLocation = QString()); const QString &defaultLocation = QString());
void setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds);
IWizard::WizardKinds newItemDialogPreferredWizardKinds() { return m_preferredWizardKinds; }
bool showOptionsDialog(const QString &group = QString(), bool showOptionsDialog(const QString &group = QString(),
const QString &page = QString(), const QString &page = QString(),
QWidget *parent = 0); QWidget *parent = 0);
@@ -93,8 +91,6 @@ public:
private: private:
MainWindow *m_mainwindow; MainWindow *m_mainwindow;
friend class MainWindow; friend class MainWindow;
IWizard::WizardKinds m_preferredWizardKinds;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -50,6 +50,8 @@ Q_DECLARE_METATYPE(Core::IWizard*)
namespace { namespace {
const int ICON_SIZE = 22;
class TwoLevelProxyModel : public QAbstractProxyModel class TwoLevelProxyModel : public QAbstractProxyModel
{ {
// Q_OBJECT // Q_OBJECT
@@ -150,8 +152,7 @@ using namespace Core::Internal;
NewDialog::NewDialog(QWidget *parent) : NewDialog::NewDialog(QWidget *parent) :
QDialog(parent), QDialog(parent),
m_ui(new Core::Internal::Ui::NewDialog), m_ui(new Core::Internal::Ui::NewDialog),
m_okButton(0), m_okButton(0)
m_preferredWizardKinds(0)
{ {
typedef QMap<QString, QStandardItem *> CategoryItemMap; typedef QMap<QString, QStandardItem *> CategoryItemMap;
m_ui->setupUi(this); m_ui->setupUi(this);
@@ -166,7 +167,7 @@ NewDialog::NewDialog(QWidget *parent) :
m_ui->templateCategoryView->setEditTriggers(QAbstractItemView::NoEditTriggers); m_ui->templateCategoryView->setEditTriggers(QAbstractItemView::NoEditTriggers);
m_ui->templateCategoryView->setItemDelegate(new FancyTopLevelDelegate); m_ui->templateCategoryView->setItemDelegate(new FancyTopLevelDelegate);
m_ui->templatesView->setIconSize(QSize(22, 22)); m_ui->templatesView->setIconSize(QSize(ICON_SIZE, ICON_SIZE));
connect(m_ui->templateCategoryView, SIGNAL(clicked(const QModelIndex&)), connect(m_ui->templateCategoryView, SIGNAL(clicked(const QModelIndex&)),
this, SLOT(currentCategoryChanged(const QModelIndex&))); this, SLOT(currentCategoryChanged(const QModelIndex&)));
@@ -192,11 +193,6 @@ bool wizardLessThan(const IWizard *w1, const IWizard *w2)
return w1->id().compare(w2->id()) < 0; return w1->id().compare(w2->id()) < 0;
} }
void NewDialog::setPreferredWizardKinds(IWizard::WizardKinds kinds)
{
m_preferredWizardKinds = kinds;
}
void NewDialog::setWizards(QList<IWizard*> wizards) void NewDialog::setWizards(QList<IWizard*> wizards)
{ {
typedef QMap<QString, QStandardItem *> CategoryItemMap; typedef QMap<QString, QStandardItem *> CategoryItemMap;
@@ -218,7 +214,7 @@ void NewDialog::setWizards(QList<IWizard*> wizards)
parentItem->appendRow(filesClassesKindItem); parentItem->appendRow(filesClassesKindItem);
if (m_dummyIcon.isNull()) { if (m_dummyIcon.isNull()) {
m_dummyIcon = QPixmap(22, 22); m_dummyIcon = QPixmap(ICON_SIZE, ICON_SIZE);
m_dummyIcon.fill(Qt::transparent); m_dummyIcon.fill(Qt::transparent);
} }
@@ -241,9 +237,10 @@ void NewDialog::setWizards(QList<IWizard*> wizards)
break; break;
} }
kindItem->appendRow(categoryItem); kindItem->appendRow(categoryItem);
m_categoryItems.append(categoryItem);
categoryItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); categoryItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
categoryItem->setText(wizard->displayCategory()); categoryItem->setText(wizard->displayCategory());
categoryItem->setData(QVariant::fromValue(0), Qt::UserRole); categoryItem->setData(wizard->category(), Qt::UserRole);
cit = categories.insert(categoryName, categoryItem); cit = categories.insert(categoryName, categoryItem);
} }
// add item // add item
@@ -251,10 +248,11 @@ void NewDialog::setWizards(QList<IWizard*> wizards)
QIcon wizardIcon; QIcon wizardIcon;
// spacing hack. Add proper icons instead // spacing hack. Add proper icons instead
if (wizard->icon().isNull()) if (wizard->icon().isNull()) {
wizardIcon = m_dummyIcon; wizardIcon = m_dummyIcon;
else } else {
wizardIcon = wizard->icon(); wizardIcon = wizard->icon();
}
wizardItem->setIcon(wizardIcon); wizardItem->setIcon(wizardIcon);
wizardItem->setData(QVariant::fromValue(wizard), Qt::UserRole); wizardItem->setData(QVariant::fromValue(wizard), Qt::UserRole);
wizardItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable); wizardItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
@@ -274,8 +272,20 @@ void NewDialog::setWizards(QList<IWizard*> wizards)
Core::IWizard *NewDialog::showDialog() Core::IWizard *NewDialog::showDialog()
{ {
// Select first category, first item by default static QString lastCategory;
m_ui->templateCategoryView->setCurrentIndex(m_proxyModel->index(0,0, m_proxyModel->index(0,0))); QModelIndex idx;
if (!lastCategory.isEmpty())
foreach(QStandardItem* item, m_categoryItems) {
if (item->data(Qt::UserRole) == lastCategory) {
idx = m_proxyModel->mapToSource(m_model->indexFromItem(item));
}
}
if (!idx.isValid())
idx = m_proxyModel->index(0,0, m_proxyModel->index(0,0));
m_ui->templateCategoryView->setCurrentIndex(idx);
// We need to set ensure that the category has default focus // We need to set ensure that the category has default focus
m_ui->templateCategoryView->setFocus(Qt::NoFocusReason); m_ui->templateCategoryView->setFocus(Qt::NoFocusReason);
@@ -286,8 +296,15 @@ Core::IWizard *NewDialog::showDialog()
currentItemChanged(m_ui->templatesView->rootIndex().child(0,0)); currentItemChanged(m_ui->templatesView->rootIndex().child(0,0));
updateOkButton(); updateOkButton();
if (exec() != Accepted)
const int retVal = exec();
idx = m_ui->templateCategoryView->currentIndex();
lastCategory = m_model->itemFromIndex(m_proxyModel->mapToSource(idx))->data(Qt::UserRole).toString();
if (retVal != Accepted)
return 0; return 0;
return currentWizard(); return currentWizard();
} }

View File

@@ -34,6 +34,7 @@
#include <QtGui/QDialog> #include <QtGui/QDialog>
#include <QtCore/QList> #include <QtCore/QList>
#include <QtCore/QModelIndex>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAbstractProxyModel; class QAbstractProxyModel;
@@ -41,7 +42,6 @@ class QPushButton;
class QStandardItem; class QStandardItem;
class QStandardItemModel; class QStandardItemModel;
class QStringList; class QStringList;
class QModelIndex;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core {
@@ -61,7 +61,6 @@ public:
virtual ~NewDialog(); virtual ~NewDialog();
void setWizards(QList<IWizard*> wizards); void setWizards(QList<IWizard*> wizards);
void setPreferredWizardKinds(IWizard::WizardKinds kinds);
Core::IWizard *showDialog(); Core::IWizard *showDialog();
@@ -77,8 +76,8 @@ private:
QStandardItemModel *m_model; QStandardItemModel *m_model;
QAbstractProxyModel *m_proxyModel; QAbstractProxyModel *m_proxyModel;
QPushButton *m_okButton; QPushButton *m_okButton;
IWizard::WizardKinds m_preferredWizardKinds;
QPixmap m_dummyIcon; QPixmap m_dummyIcon;
QList<QStandardItem*> m_categoryItems;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -38,9 +38,15 @@
</item> </item>
<item row="1" column="0" rowspan="3"> <item row="1" column="0" rowspan="3">
<widget class="QTreeView" name="templateCategoryView"> <widget class="QTreeView" name="templateCategoryView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>200</width> <width>225</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
@@ -77,6 +83,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>180</height>
</size>
</property>
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::StrongFocus</enum> <enum>Qt::StrongFocus</enum>
</property> </property>
@@ -91,17 +103,11 @@
<item row="3" column="1"> <item row="3" column="1">
<widget class="QTextBrowser" name="templateDescription"> <widget class="QTextBrowser" name="templateDescription">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>140</height>
</size>
</property>
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::NoFocus</enum> <enum>Qt::NoFocus</enum>
</property> </property>

View File

@@ -54,6 +54,7 @@
#include <QtGui/QListView> #include <QtGui/QListView>
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QtGui/QGroupBox> #include <QtGui/QGroupBox>
#include <QtGui/QStyledItemDelegate>
static const char categoryKeyC[] = "General/LastPreferenceCategory"; static const char categoryKeyC[] = "General/LastPreferenceCategory";
static const char pageKeyC[] = "General/LastPreferencePage"; static const char pageKeyC[] = "General/LastPreferencePage";
@@ -200,6 +201,19 @@ bool CategoryFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sou
// ----------- Category list view // ----------- Category list view
class CategoryListViewDelegate : public QStyledItemDelegate
{
public:
CategoryListViewDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QSize size = QStyledItemDelegate::sizeHint(option, index);
size.setHeight(qMax(size.height(), 32));
return size;
}
};
/** /**
* Special version of a QListView that has the width of the first column as * Special version of a QListView that has the width of the first column as
* minimum size. * minimum size.
@@ -210,6 +224,7 @@ public:
CategoryListView(QWidget *parent = 0) : QListView(parent) CategoryListView(QWidget *parent = 0) : QListView(parent)
{ {
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
setItemDelegate(new CategoryListViewDelegate(this));
} }
virtual QSize sizeHint() const virtual QSize sizeHint() const

View File

@@ -67,17 +67,6 @@
\sa Core::FileManager \sa Core::FileManager
*/ */
/*!
\fn void setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds)
\internal
When set to true, the general "New File or Project" dialog will
collapse the project categories.
This is set by the project explorer: When projects are open, the preferred
thing is to create files/classes, if no projects are open, the preferred thing
to create are projects.
*/
/*! /*!
\fn bool ICore::showOptionsDialog(const QString &group = QString(), \fn bool ICore::showOptionsDialog(const QString &group = QString(),
const QString &page = QString()) const QString &page = QString())

View File

@@ -74,7 +74,6 @@ public:
virtual QStringList showNewItemDialog(const QString &title, virtual QStringList showNewItemDialog(const QString &title,
const QList<IWizard *> &wizards, const QList<IWizard *> &wizards,
const QString &defaultLocation = QString()) = 0; const QString &defaultLocation = QString()) = 0;
virtual void setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds) = 0;
virtual bool showOptionsDialog(const QString &group = QString(), virtual bool showOptionsDialog(const QString &group = QString(),
const QString &page = QString(), const QString &page = QString(),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 930 B

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 852 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 615 B

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1014 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 908 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -775,8 +775,7 @@ void MainWindow::registerDefaultActions()
void MainWindow::newFile() void MainWindow::newFile()
{ {
showNewItemDialog(tr("New", "Title of dialog"), IWizard::allWizards(), showNewItemDialog(tr("New", "Title of dialog"), IWizard::allWizards(), QString());
QString(), m_coreImpl->newItemDialogPreferredWizardKinds());
} }
void MainWindow::openFile() void MainWindow::openFile()
@@ -863,8 +862,7 @@ void MainWindow::setFocusToEditor()
QStringList MainWindow::showNewItemDialog(const QString &title, QStringList MainWindow::showNewItemDialog(const QString &title,
const QList<IWizard *> &wizards, const QList<IWizard *> &wizards,
const QString &defaultLocation, const QString &defaultLocation)
IWizard::WizardKinds preferredWizardKinds)
{ {
// Scan for wizards matching the filter and pick one. Don't show // Scan for wizards matching the filter and pick one. Don't show
// dialog if there is only one. // dialog if there is only one.
@@ -879,7 +877,6 @@ QStringList MainWindow::showNewItemDialog(const QString &title,
NewDialog dlg(this); NewDialog dlg(this);
dlg.setWizards(wizards); dlg.setWizards(wizards);
dlg.setWindowTitle(title); dlg.setWindowTitle(title);
dlg.setPreferredWizardKinds(preferredWizardKinds);
wizard = dlg.showDialog(); wizard = dlg.showDialog();
} }
break; break;

View File

@@ -134,8 +134,7 @@ public slots:
QStringList showNewItemDialog(const QString &title, QStringList showNewItemDialog(const QString &title,
const QList<IWizard *> &wizards, const QList<IWizard *> &wizards,
const QString &defaultLocation = QString(), const QString &defaultLocation = QString());
IWizard::WizardKinds preferredWizardKinds = 0);
bool showOptionsDialog(const QString &category = QString(), bool showOptionsDialog(const QString &category = QString(),
const QString &page = QString(), const QString &page = QString(),

View File

@@ -186,7 +186,7 @@ void OutputPaneManager::updateStatusButtons(bool visible)
int idx = m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt(); int idx = m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt();
if (m_buttons.value(idx)) if (m_buttons.value(idx))
m_buttons.value(idx)->setChecked(visible); m_buttons.value(idx)->setChecked(visible);
m_minMaxButton->setVisible(OutputPanePlaceHolder::m_current m_minMaxAction->setVisible(OutputPanePlaceHolder::m_current
&& OutputPanePlaceHolder::m_current->canMaximizeOrMinimize()); && OutputPanePlaceHolder::m_current->canMaximizeOrMinimize());
} }
@@ -224,9 +224,8 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) :
connect(m_prevAction, SIGNAL(triggered()), this, SLOT(slotPrev())); connect(m_prevAction, SIGNAL(triggered()), this, SLOT(slotPrev()));
m_minMaxAction = new QAction(this); m_minMaxAction = new QAction(this);
m_minMaxButton->setIcon(m_maximizeIcon); m_minMaxAction->setIcon(m_maximizeIcon);
m_minMaxButton->setToolTip(tr("Maximize Output Pane")); m_minMaxAction->setText(tr("Maximize Output Pane"));
m_minMaxAction->setText(m_minMaxButton->toolTip());
m_closeButton->setIcon(QIcon(":/core/images/closebutton.png")); m_closeButton->setIcon(QIcon(":/core/images/closebutton.png"));
connect(m_closeButton, SIGNAL(clicked()), this, SLOT(slotHide())); connect(m_closeButton, SIGNAL(clicked()), this, SLOT(slotHide()));
@@ -312,9 +311,10 @@ void OutputPaneManager::init()
cmd->setDefaultKeySequence(QKeySequence("Alt+9")); cmd->setDefaultKeySequence(QKeySequence("Alt+9"));
#endif #endif
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateIcon);
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
connect(m_minMaxAction, SIGNAL(triggered()), this, SLOT(slotMinMax())); connect(m_minMaxAction, SIGNAL(triggered()), this, SLOT(slotMinMax()));
connect(m_minMaxButton, SIGNAL(clicked()), this, SLOT(slotMinMax())); m_minMaxButton->setDefaultAction(cmd->action());
QAction *sep = new QAction(this); QAction *sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
@@ -418,10 +418,9 @@ void OutputPaneManager::slotMinMax()
return; return;
m_maximised = !m_maximised; m_maximised = !m_maximised;
OutputPanePlaceHolder::m_current->maximizeOrMinimize(m_maximised); OutputPanePlaceHolder::m_current->maximizeOrMinimize(m_maximised);
m_minMaxButton->setIcon(m_maximised ? m_minimizeIcon : m_maximizeIcon); m_minMaxAction->setIcon(m_maximised ? m_minimizeIcon : m_maximizeIcon);
m_minMaxButton->setToolTip(m_maximised ? tr("Minimize Output Pane") m_minMaxAction->setText(m_maximised ? tr("Minimize Output Pane")
: tr("Maximize Output Pane")); : tr("Maximize Output Pane"));
m_minMaxAction->setText(m_minMaxButton->toolTip());
} }
void OutputPaneManager::buttonTriggered() void OutputPaneManager::buttonTriggered()

View File

@@ -79,7 +79,7 @@ QString CodePasterSettingsPage::displayCategory() const
QIcon CodePasterSettingsPage::categoryIcon() const QIcon CodePasterSettingsPage::categoryIcon() const
{ {
return QIcon(); // TODO: Add icon for code paster category return QIcon();
} }
QWidget *CodePasterSettingsPage::createPage(QWidget *parent) QWidget *CodePasterSettingsPage::createPage(QWidget *parent)

View File

@@ -36,6 +36,7 @@ namespace CodePaster {
namespace Constants { namespace Constants {
const char * const CPASTER_SETTINGS_CATEGORY = "X.CPaster"; const char * const CPASTER_SETTINGS_CATEGORY = "X.CPaster";
const char * const CPASTER_SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("CodePaster", "Code Pasting"); const char * const CPASTER_SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("CodePaster", "Code Pasting");
const char * const SETTINGS_CATEGORY_CPASTER_ICON = ":/core/images/category_cpaster.png";
} }
} }

View File

@@ -106,7 +106,7 @@ QString SettingsPage::displayCategory() const
QIcon SettingsPage::categoryIcon() const QIcon SettingsPage::categoryIcon() const
{ {
return QIcon(); // TODO: Icon for CodePaster return QIcon(QLatin1String(Constants::SETTINGS_CATEGORY_CPASTER_ICON));
} }
QWidget *SettingsPage::createPage(QWidget *parent) QWidget *SettingsPage::createPage(QWidget *parent)

View File

@@ -321,7 +321,7 @@ QString CppFileSettingsPage::displayCategory() const
QIcon CppFileSettingsPage::categoryIcon() const QIcon CppFileSettingsPage::categoryIcon() const
{ {
return QIcon(); // TODO: Icon for C++ or move into category return QIcon(QLatin1String(Constants::SETTINGS_CATEGORY_CPP_ICON));
} }
QWidget *CppFileSettingsPage::createPage(QWidget *parent) QWidget *CppFileSettingsPage::createPage(QWidget *parent)

View File

@@ -54,6 +54,7 @@ const char * const CPP_SETTINGS_ID = "File Naming";
const char * const CPP_SETTINGS_NAME = QT_TRANSLATE_NOOP("CppTools", "File Naming"); const char * const CPP_SETTINGS_NAME = QT_TRANSLATE_NOOP("CppTools", "File Naming");
const char * const CPP_SETTINGS_CATEGORY = "I.C++"; const char * const CPP_SETTINGS_CATEGORY = "I.C++";
const char * const CPP_SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("CppTools", "C++"); const char * const CPP_SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("CppTools", "C++");
const char * const SETTINGS_CATEGORY_CPP_ICON = ":/core/images/category_cpp.png";
} // namespace Constants } // namespace Constants
} // namespace CppTools } // namespace CppTools

View File

@@ -48,7 +48,7 @@ CheckoutWizard::CheckoutWizard(QObject *parent) :
QIcon CheckoutWizard::icon() const QIcon CheckoutWizard::icon() const
{ {
return QIcon(); return QIcon(QLatin1String(":/cvs/images/cvs.png"));
} }
QString CheckoutWizard::description() const QString CheckoutWizard::description() const

View File

@@ -2,4 +2,7 @@
<qresource prefix="/trolltech.cvs"> <qresource prefix="/trolltech.cvs">
<file>CVS.mimetypes.xml</file> <file>CVS.mimetypes.xml</file>
</qresource> </qresource>
<qresource prefix="/cvs">
<file>images/cvs.png</file>
</qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -101,6 +101,7 @@ const char * const INSTALL_HANDLER = "TextEditor.FakeVimHandler";
const char * const MINI_BUFFER = "TextEditor.FakeVimMiniBuffer"; const char * const MINI_BUFFER = "TextEditor.FakeVimMiniBuffer";
const char * const INSTALL_KEY = "Alt+V,Alt+V"; const char * const INSTALL_KEY = "Alt+V,Alt+V";
const char * const SETTINGS_CATEGORY = "D.FakeVim"; const char * const SETTINGS_CATEGORY = "D.FakeVim";
const char * const SETTINGS_CATEGORY_FAKEVIM_ICON = ":/core/images/category_fakevim.png";
const char * const SETTINGS_ID = "A.General"; const char * const SETTINGS_ID = "A.General";
const char * const SETTINGS_EX_CMDS_ID = "B.ExCommands"; const char * const SETTINGS_EX_CMDS_ID = "B.ExCommands";
const char * const CMD_FILE_NEXT = "FakeVim.SwitchFileNext"; const char * const CMD_FILE_NEXT = "FakeVim.SwitchFileNext";
@@ -133,7 +134,7 @@ public:
QString displayName() const { return tr("General"); } QString displayName() const { return tr("General"); }
QString category() const { return QLatin1String(Constants::SETTINGS_CATEGORY); } QString category() const { return QLatin1String(Constants::SETTINGS_CATEGORY); }
QString displayCategory() const { return tr("FakeVim"); } QString displayCategory() const { return tr("FakeVim"); }
QIcon categoryIcon() const { return QIcon(); } // TODO: Add an icon or move into another category QIcon categoryIcon() const { return QIcon(QLatin1String(Constants::SETTINGS_CATEGORY_FAKEVIM_ICON)); }
QWidget *createPage(QWidget *parent); QWidget *createPage(QWidget *parent);
void apply() { m_group.apply(ICore::instance()->settings()); } void apply() { m_group.apply(ICore::instance()->settings()); }

View File

@@ -38,6 +38,11 @@
#include <QtGui/QIcon> #include <QtGui/QIcon>
#include <QtGui/QApplication>
#include <QtGui/QStyle>
#include <QtGui/QPainter>
#include <QtGui/QPixmap>
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtCore/QtDebug> #include <QtCore/QtDebug>
@@ -93,7 +98,14 @@ GenericProjectWizard::~GenericProjectWizard()
Core::BaseFileWizardParameters GenericProjectWizard::parameters() Core::BaseFileWizardParameters GenericProjectWizard::parameters()
{ {
Core::BaseFileWizardParameters parameters(ProjectWizard); Core::BaseFileWizardParameters parameters(ProjectWizard);
parameters.setIcon(QIcon(QLatin1String(":/wizards/images/console.png"))); // TODO do something about the ugliness of standard icons in sizes different than 16, 32, 64, 128
{
QPixmap icon(22, 22);
icon.fill(Qt::transparent);
QPainter p(&icon);
p.drawPixmap(3, 3, 16, 16, qApp->style()->standardIcon(QStyle::SP_DirIcon).pixmap(16));
parameters.setIcon(icon);
}
parameters.setDisplayName(tr("Import Existing Project")); parameters.setDisplayName(tr("Import Existing Project"));
parameters.setId(QLatin1String("Z.Makefile")); parameters.setId(QLatin1String("Z.Makefile"));
parameters.setDescription(tr("Imports existing projects that do not use qmake or CMake. " parameters.setDescription(tr("Imports existing projects that do not use qmake or CMake. "

View File

@@ -47,7 +47,7 @@ CloneWizard::CloneWizard(QObject *parent) :
QIcon CloneWizard::icon() const QIcon CloneWizard::icon() const
{ {
return QIcon(); return QIcon(QLatin1String(":/git/images/git.png"));
} }
QString CloneWizard::description() const QString CloneWizard::description() const

View File

@@ -50,3 +50,6 @@ FORMS += changeselectiondialog.ui \
stashdialog.ui stashdialog.ui
OTHER_FILES += ScmGit.pluginspec OTHER_FILES += ScmGit.pluginspec
include(gitorious/gitorious.pri) include(gitorious/gitorious.pri)
RESOURCES += \
git.qrc

6
src/plugins/git/git.qrc Normal file
View File

@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/git">
<file>images/git.png</file>
<file>images/gitorious.png</file>
</qresource>
</RCC>

View File

@@ -75,7 +75,7 @@ GitoriousCloneWizard::GitoriousCloneWizard(QObject *parent) :
QIcon GitoriousCloneWizard::icon() const QIcon GitoriousCloneWizard::icon() const
{ {
return QIcon(); return QIcon(QLatin1String(":/git/images/gitorious.png"));
} }
QString GitoriousCloneWizard::description() const QString GitoriousCloneWizard::description() const

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -38,6 +38,7 @@ namespace Constants {
const char * const FILTER_OPTIONS_PAGE = QT_TRANSLATE_NOOP("Locator", "Filters"); const char * const FILTER_OPTIONS_PAGE = QT_TRANSLATE_NOOP("Locator", "Filters");
const char * const LOCATOR_CATEGORY = "G.Locator"; const char * const LOCATOR_CATEGORY = "G.Locator";
const char * const LOCATOR_TR_CATEGORY = QT_TRANSLATE_NOOP("Locator", "Locator"); const char * const LOCATOR_TR_CATEGORY = QT_TRANSLATE_NOOP("Locator", "Locator");
const char * const SETTINGS_CATEGORY_LOCATOR_ICON = ":/core/images/category_locator.png";
const char * const TASK_INDEX = "Locator.Task.Index"; const char * const TASK_INDEX = "Locator.Task.Index";
} // namespace Constants } // namespace Constants

View File

@@ -71,7 +71,7 @@ QString SettingsPage::displayCategory() const
QIcon SettingsPage::categoryIcon() const QIcon SettingsPage::categoryIcon() const
{ {
return QIcon(); // TODO: Icon for Locator return QIcon(QLatin1String(Locator::Constants::SETTINGS_CATEGORY_LOCATOR_ICON));
} }
QWidget *SettingsPage::createPage(QWidget *parent) QWidget *SettingsPage::createPage(QWidget *parent)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -256,10 +256,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
this, SIGNAL(fileListChanged())); this, SIGNAL(fileListChanged()));
connect(d->m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project *)), connect(d->m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project *)),
this, SLOT(startupProjectChanged())); this, SLOT(startupProjectChanged()));
connect(d->m_session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
this, SLOT(updatePreferredWizardKinds()));
connect(d->m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)),
this, SLOT(updatePreferredWizardKinds()));
connect(d->m_session, SIGNAL(dependencyChanged(ProjectExplorer::Project*,ProjectExplorer::Project*)), connect(d->m_session, SIGNAL(dependencyChanged(ProjectExplorer::Project*,ProjectExplorer::Project*)),
this, SLOT(updateActions())); this, SLOT(updateActions()));
@@ -1884,17 +1880,6 @@ void ProjectExplorerPlugin::openRecentProject()
openProject(fileName); openProject(fileName);
} }
void ProjectExplorerPlugin::updatePreferredWizardKinds()
{
if (d->m_session->projects().count()) {
Core::ICore::instance()->setNewItemDialogPreferredWizardKinds(
Core::IWizard::FileWizard | Core::IWizard::ClassWizard);
} else {
Core::ICore::instance()->setNewItemDialogPreferredWizardKinds(
Core::IWizard::ProjectWizard);
}
}
void ProjectExplorerPlugin::invalidateProject(Project *project) void ProjectExplorerPlugin::invalidateProject(Project *project)
{ {
if (debug) if (debug)

View File

@@ -173,7 +173,6 @@ private slots:
void updateRecentProjectMenu(); void updateRecentProjectMenu();
void openRecentProject(); void openRecentProject();
void openTerminalHere(); void openTerminalHere();
void updatePreferredWizardKinds();
void invalidateProject(ProjectExplorer::Project *project); void invalidateProject(ProjectExplorer::Project *project);

View File

@@ -135,8 +135,6 @@ void DragTool::beginWithPoint(const QPointF &beginPoint)
void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlItemNode parentNode, QPointF scenePos) void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlItemNode parentNode, QPointF scenePos)
{ {
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide();
MetaInfo metaInfo = MetaInfo::global(); MetaInfo metaInfo = MetaInfo::global();
FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode); FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode);
@@ -151,6 +149,8 @@ void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlIt
nodeList.append(m_dragNode); nodeList.append(m_dragNode);
view()->setSelectedQmlItemNodes(nodeList); view()->setSelectedQmlItemNodes(nodeList);
m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList)); m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList));
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide();
} }
void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode parentNode, QPointF scenePos) void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode parentNode, QPointF scenePos)
@@ -158,8 +158,6 @@ void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode
if (!parentNode.isValid()) if (!parentNode.isValid())
return; return;
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide();
MetaInfo metaInfo = MetaInfo::global(); MetaInfo metaInfo = MetaInfo::global();
FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode); FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode);
@@ -171,6 +169,8 @@ void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode
nodeList.append(m_dragNode); nodeList.append(m_dragNode);
view()->setSelectedQmlItemNodes(nodeList); view()->setSelectedQmlItemNodes(nodeList);
m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList)); m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList));
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide();
} }
FormEditorItem* DragTool::calculateContainer(const QPointF &point, FormEditorItem * currentItem) FormEditorItem* DragTool::calculateContainer(const QPointF &point, FormEditorItem * currentItem)
@@ -256,11 +256,11 @@ void DragTool::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
QPointF scenePos = event->scenePos(); QPointF scenePos = event->scenePos();
if (m_dragNode.isValid()) { if (m_dragNode.isValid()) {
FormEditorItem *parentItem = calculateContainer(event->scenePos() - QPoint(2, 2)); FormEditorItem *parentItem = calculateContainer(event->scenePos() + QPoint(2, 2));
if (!parentItem) { //if there is no parent any more - the use left the scene if (!parentItem) { //if there is no parent any more - the use left the scene
end(event->scenePos()); end(event->scenePos());
m_dragNode.destroy(); //delete the node then
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::show(); QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::show();
m_dragNode.destroy(); //delete the node then
return; return;
} }
//move //move

View File

@@ -413,7 +413,7 @@ void FormEditorView::nodeSlidedToIndex(const NodeListProperty &listProperty, int
void FormEditorView::auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data) void FormEditorView::auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data)
{ {
QmlModelView::auxiliaryDataChanged(node, name, data); QmlModelView::auxiliaryDataChanged(node, name, data);
if (name == "invisible") { if (name == "invisible" && m_scene->hasItemForQmlItemNode(QmlItemNode(node))) {
FormEditorItem *item(m_scene->itemForQmlItemNode(QmlItemNode(node))); FormEditorItem *item(m_scene->itemForQmlItemNode(QmlItemNode(node)));
bool isInvisible = data.toBool(); bool isInvisible = data.toBool();
item->setVisible(!isInvisible); item->setVisible(!isInvisible);

View File

@@ -461,6 +461,7 @@ void DesignDocumentController::copySelected()
{ {
QScopedPointer<Model> model(Model::create("import Qt 4.7; Qt/Rectangle")); QScopedPointer<Model> model(Model::create("import Qt 4.7; Qt/Rectangle"));
model->setMetaInfo(m_d->model->metaInfo()); model->setMetaInfo(m_d->model->metaInfo());
model->setFileUrl(m_d->model->fileUrl());
Q_ASSERT(model); Q_ASSERT(model);
@@ -573,6 +574,8 @@ void DesignDocumentController::paste()
if (rootNode.id() == "designer__Selection") { if (rootNode.id() == "designer__Selection") {
QList<ModelNode> selectedNodes = rootNode.allDirectSubModelNodes(); QList<ModelNode> selectedNodes = rootNode.allDirectSubModelNodes();
qDebug() << rootNode;
qDebug() << selectedNodes;
model->detachView(&view); model->detachView(&view);
m_d->model->attachView(&view); m_d->model->attachView(&view);
@@ -635,7 +638,9 @@ void DesignDocumentController::paste()
QString defaultProperty(targetNode.metaInfo().defaultProperty()); QString defaultProperty(targetNode.metaInfo().defaultProperty());
scatterItem(pastedNode, targetNode); scatterItem(pastedNode, targetNode);
if (targetNode.nodeListProperty(defaultProperty).isValid()) {
targetNode.nodeListProperty(defaultProperty).reparentHere(pastedNode); targetNode.nodeListProperty(defaultProperty).reparentHere(pastedNode);
}
view.setSelectedModelNodes(QList<ModelNode>() << pastedNode); view.setSelectedModelNodes(QList<ModelNode>() << pastedNode);
} }

View File

@@ -85,7 +85,11 @@ public:
static void hide() static void hide()
{ instance()->m_isVisible = false; } { instance()->m_isVisible = false; }
static void show() static void show()
{ instance()->m_isVisible = true; } {
instance()->m_isVisible = true;
instance()->m_widget->show();
instance()->m_widget->update();
}
static bool isVisible() static bool isVisible()
{ return instance()->m_isVisible; } { return instance()->m_isVisible; }

View File

@@ -0,0 +1,143 @@
#include "declarativewidgetview.h"
#include <qdeclarative.h>
#include <QDeclarativeItem>
#include <QDeclarativeEngine>
#include <QDeclarativeContext>
#include <QPointer>
namespace QmlDesigner {
class DeclarativeWidgetViewPrivate
{
public:
DeclarativeWidgetViewPrivate(DeclarativeWidgetView *view)
: q(view), root(0), component(0) {}
~DeclarativeWidgetViewPrivate() { delete root; }
void execute();
DeclarativeWidgetView *q;
QPointer<QWidget> root;
QUrl source;
QDeclarativeEngine engine;
QDeclarativeComponent *component;
};
void DeclarativeWidgetViewPrivate::execute()
{
if (root) {
delete root;
root = 0;
}
if (component) {
delete component;
component = 0;
}
if (!source.isEmpty()) {
component = new QDeclarativeComponent(&engine, source, q);
if (!component->isLoading()) {
q->continueExecute();
} else {
QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), q, SLOT(continueExecute()));
}
}
}
DeclarativeWidgetView::DeclarativeWidgetView(QWidget *parent) :
QWidget(parent), d(new DeclarativeWidgetViewPrivate(this))
{
}
DeclarativeWidgetView::~DeclarativeWidgetView()
{
delete d;
}
QUrl DeclarativeWidgetView::source() const
{
return d->source;
}
void DeclarativeWidgetView::setSource(const QUrl& url)
{
d->source = url;
d->execute();
}
QDeclarativeEngine* DeclarativeWidgetView::engine()
{
return &d->engine;
}
QWidget *DeclarativeWidgetView::rootWidget() const
{
return d->root;
}
QDeclarativeContext* DeclarativeWidgetView::rootContext()
{
return d->engine.rootContext();
}
DeclarativeWidgetView::Status DeclarativeWidgetView::status() const
{
if (!d->component)
return DeclarativeWidgetView::Null;
return DeclarativeWidgetView::Status(d->component->status());
}
void DeclarativeWidgetView::continueExecute()
{
disconnect(d->component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(continueExecute()));
if (d->component->isError()) {
QList<QDeclarativeError> errorList = d->component->errors();
foreach (const QDeclarativeError &error, errorList) {
qWarning() << error;
}
emit statusChanged(status());
return;
}
QObject *obj = d->component->create();
if(d->component->isError()) {
QList<QDeclarativeError> errorList = d->component->errors();
foreach (const QDeclarativeError &error, errorList) {
qWarning() << error;
}
emit statusChanged(status());
return;
}
setRootWidget(qobject_cast<QWidget *>(obj));
emit statusChanged(status());
}
void DeclarativeWidgetView::setRootWidget(QWidget *widget)
{
if (d->root == widget)
return;
window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
window()->setAttribute(Qt::WA_NoSystemBackground, false);
widget->setParent(this);
if (isVisible()) {
widget->setVisible(true);
}
resize(widget->size());
d->root = widget;
if (d->root) {
QSize initialSize = d->root->size();
if (initialSize != size()) {
resize(initialSize);
}
}
}
} //QmlDesigner

View File

@@ -0,0 +1,55 @@
#ifndef DECLARATIVEWIDGETVIEW_H
#define DECLARATIVEWIDGETVIEW_H
#include <QWidget>
#include <QUrl>
QT_BEGIN_NAMESPACE
class QDeclarativeEngine;
class QDeclarativeContext;
class QDeclarativeError;
QT_END_NAMESPACE
namespace QmlDesigner {
class DeclarativeWidgetViewPrivate;
class DeclarativeWidgetView : public QWidget
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource DESIGNABLE true)
public:
explicit DeclarativeWidgetView(QWidget *parent = 0);
virtual ~DeclarativeWidgetView();
QUrl source() const;
void setSource(const QUrl&);
QDeclarativeEngine* engine();
QDeclarativeContext* rootContext();
QWidget *rootWidget() const;
enum Status { Null, Ready, Loading, Error };
Status status() const;
signals:
void statusChanged(DeclarativeWidgetView::Status);
protected:
virtual void setRootWidget(QWidget *);
private Q_SLOTS:
void continueExecute();
private:
friend class DeclarativeWidgetViewPrivate;
DeclarativeWidgetViewPrivate *d;
};
} //QmlDesigner
#endif // DECLARATIVEWIDGETVIEW_H

View File

@@ -81,13 +81,13 @@ const int collapseButtonOffset = 114;
namespace QmlDesigner { namespace QmlDesigner {
PropertyEditor::NodeType::NodeType(PropertyEditor *propertyEditor) : PropertyEditor::NodeType::NodeType(PropertyEditor *propertyEditor) :
m_view(new QDeclarativeView), m_propertyEditorTransaction(new PropertyEditorTransaction(propertyEditor)), m_dummyPropertyEditorValue(new PropertyEditorValue()), m_view(new DeclarativeWidgetView), m_propertyEditorTransaction(new PropertyEditorTransaction(propertyEditor)), m_dummyPropertyEditorValue(new PropertyEditorValue()),
m_contextObject(new PropertyEditorContextObject()) m_contextObject(new PropertyEditorContextObject())
{ {
Q_ASSERT(QFileInfo(":/images/button_normal.png").exists()); Q_ASSERT(QFileInfo(":/images/button_normal.png").exists());
m_view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
QDeclarativeContext *ctxt = m_view->rootContext(); QDeclarativeContext *ctxt = m_view->rootContext();
m_view->engine()->setOutputWarningsToStandardError(debug);
m_dummyPropertyEditorValue->setValue("#000000"); m_dummyPropertyEditorValue->setValue("#000000");
ctxt->setContextProperty("dummyBackendValue", m_dummyPropertyEditorValue.data()); ctxt->setContextProperty("dummyBackendValue", m_dummyPropertyEditorValue.data());
m_contextObject->setBackendValues(&m_backendValuesPropertyMap); m_contextObject->setBackendValues(&m_backendValuesPropertyMap);

View File

@@ -31,7 +31,7 @@
#define QmlPropertyView_h #define QmlPropertyView_h
#include <qmlmodelview.h> #include <qmlmodelview.h>
#include <QDeclarativeView> #include <declarativewidgetview.h>
#include <QHash> #include <QHash>
#include <QDeclarativePropertyMap> #include <QDeclarativePropertyMap>
#include <QStackedWidget> #include <QStackedWidget>
@@ -67,7 +67,7 @@ class PropertyEditor: public QmlModelView
void initialSetup(const QString &typeName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor); void initialSetup(const QString &typeName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor);
void setValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value); void setValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value);
QDeclarativeView *m_view; DeclarativeWidgetView *m_view;
Internal::QmlAnchorBindingProxy m_backendAnchorBinding; Internal::QmlAnchorBindingProxy m_backendAnchorBinding;
DesignerPropertyMap<PropertyEditorValue> m_backendValuesPropertyMap; DesignerPropertyMap<PropertyEditorValue> m_backendValuesPropertyMap;
QScopedPointer<PropertyEditorTransaction> m_propertyEditorTransaction; QScopedPointer<PropertyEditorTransaction> m_propertyEditorTransaction;

View File

@@ -18,7 +18,8 @@ SOURCES += propertyeditor.cpp \
originwidget.cpp \ originwidget.cpp \
siblingcombobox.cpp \ siblingcombobox.cpp \
propertyeditortransaction.cpp \ propertyeditortransaction.cpp \
propertyeditorcontextobject.cpp propertyeditorcontextobject.cpp \
declarativewidgetview.cpp
HEADERS += propertyeditor.h \ HEADERS += propertyeditor.h \
qmlanchorbindingproxy.h \ qmlanchorbindingproxy.h \
@@ -38,7 +39,8 @@ HEADERS += propertyeditor.h \
siblingcombobox.h \ siblingcombobox.h \
propertyeditortransaction.h \ propertyeditortransaction.h \
designerpropertymap.h \ designerpropertymap.h \
propertyeditorcontextobject.h propertyeditorcontextobject.h \
declarativewidgetview.h
QT += declarative QT += declarative
RESOURCES += propertyeditor.qrc RESOURCES += propertyeditor.qrc
FORMS += behaviordialog.ui FORMS += behaviordialog.ui

View File

@@ -3,7 +3,7 @@
namespace QmlDesigner { namespace QmlDesigner {
PropertyEditorContextObject::PropertyEditorContextObject(QObject *parent) : PropertyEditorContextObject::PropertyEditorContextObject(QObject *parent) :
QObject(parent), m_backendValues(0), m_isBaseState(false), m_selectionChanged(false) QObject(parent), m_isBaseState(false), m_selectionChanged(false), m_backendValues(0)
{ {
} }

View File

@@ -1,4 +1,5 @@
#include "propertyeditortransaction.h" #include "propertyeditortransaction.h"
#include <QTimerEvent>
#include <QDebug> #include <QDebug>

View File

@@ -31,6 +31,8 @@
#include "invalidnodeinstanceexception.h" #include "invalidnodeinstanceexception.h"
#include <QGraphicsObject> #include <QGraphicsObject>
#include "private/qgraphicsitem_p.h"
#include <QStyleOptionGraphicsItem>
#include "nodemetainfo.h" #include "nodemetainfo.h"
namespace QmlDesigner { namespace QmlDesigner {
@@ -153,13 +155,21 @@ bool GraphicsObjectNodeInstance::equalGraphicsItem(QGraphicsItem *item) const
return item == graphicsObject(); return item == graphicsObject();
} }
void initOption(QGraphicsItem *item, QStyleOptionGraphicsItem *option, const QTransform &transform)
{
QGraphicsItemPrivate *privateItem = QGraphicsItemPrivate::get(item);
privateItem->initStyleOption(option, transform, QRegion());
}
void GraphicsObjectNodeInstance::paintRecursively(QGraphicsItem *graphicsItem, QPainter *painter) const void GraphicsObjectNodeInstance::paintRecursively(QGraphicsItem *graphicsItem, QPainter *painter) const
{ {
if (graphicsItem->isVisible()) { if (graphicsItem->isVisible()) {
painter->save(); painter->save();
painter->setTransform(graphicsItem->itemTransform(graphicsItem->parentItem()), true); painter->setTransform(graphicsItem->itemTransform(graphicsItem->parentItem()), true);
painter->setOpacity(graphicsItem->opacity() * painter->opacity()); painter->setOpacity(graphicsItem->opacity() * painter->opacity());
graphicsItem->paint(painter, 0); QStyleOptionGraphicsItem option;
initOption(graphicsItem, &option, painter->transform());
graphicsItem->paint(painter, &option);
foreach(QGraphicsItem *childItem, graphicsItem->childItems()) { foreach(QGraphicsItem *childItem, graphicsItem->childItems()) {
paintRecursively(childItem, painter); paintRecursively(childItem, painter);
} }
@@ -171,12 +181,16 @@ void GraphicsObjectNodeInstance::paint(QPainter *painter) const
{ {
painter->save(); painter->save();
Q_ASSERT(graphicsObject()); Q_ASSERT(graphicsObject());
if (hasContent()) if (hasContent()) {
graphicsObject()->paint(painter, 0); QStyleOptionGraphicsItem option;
initOption(graphicsObject(), &option, painter->transform());
graphicsObject()->paint(painter, &option);
}
foreach(QGraphicsItem *graphicsItem, graphicsObject()->childItems()) { foreach(QGraphicsItem *graphicsItem, graphicsObject()->childItems()) {
QGraphicsObject *graphicsObject = qgraphicsitem_cast<QGraphicsObject*>(graphicsItem); QGraphicsObject *graphicsObject = qgraphicsitem_cast<QGraphicsObject*>(graphicsItem);
if (graphicsObject && !nodeInstanceView()->hasInstanceForObject(graphicsObject)) if (graphicsObject
&& !nodeInstanceView()->hasInstanceForObject(graphicsObject))
paintRecursively(graphicsItem, painter); paintRecursively(graphicsItem, painter);
} }

View File

@@ -184,7 +184,15 @@ QObject *NodeMetaInfo::createInstance(QDeclarativeContext *context) const
newContext->setParent(object); newContext->setParent(object);
} else { } else {
// primitive // primitive
object = QDeclarativeMetaType::qmlType(typeName().toAscii(), majorVersion(), minorVersion())->create(); QDeclarativeType *type = QDeclarativeMetaType::qmlType(typeName().toAscii(), majorVersion(), minorVersion());
if (type) {
object = type->create();
} else {
qWarning() << "QuickDesigner: Cannot create an object of type"
<< QString("%1 %2,%3").arg(typeName(), majorVersion(), minorVersion())
<< "- type isn't known to declarative meta type system";
}
if (object && context) if (object && context)
QDeclarativeEngine::setContextForObject(object, context); QDeclarativeEngine::setContextForObject(object, context);
} }

View File

@@ -127,8 +127,8 @@ QmlItemNode QmlModelView::createQmlItemNodeFromImage(const QString &imageName, c
newNode.setId(id); newNode.setId(id);
if (!currentState().isBaseState()) { if (!currentState().isBaseState()) {
newNode.modelNode().variantProperty("visible") = false; newNode.modelNode().variantProperty("opacity") = 0;
newNode.setVariantProperty("visible", true); newNode.setVariantProperty("opacity", 1);
} }
Q_ASSERT(newNode.isValid()); Q_ASSERT(newNode.isValid());
@@ -180,8 +180,8 @@ QmlItemNode QmlModelView::createQmlItemNode(const ItemLibraryEntry &itemLibraryE
} }
if (!currentState().isBaseState()) { if (!currentState().isBaseState()) {
newNode.modelNode().variantProperty("visible") = false; newNode.modelNode().variantProperty("opacity") = 0;
newNode.setVariantProperty("visible", true); newNode.setVariantProperty("opacity", 1);
} }
Q_ASSERT(newNode.isValid()); Q_ASSERT(newNode.isValid());

View File

@@ -384,8 +384,6 @@ public:
v.convert(QVariant::Double); v.convert(QVariant::Double);
} else if (property->asStringValue()) { } else if (property->asStringValue()) {
// nothing to do // nothing to do
} else if (property->asEasingCurveNameValue()) {
// nothing to do
} }
return v; return v;
} }

View File

@@ -111,7 +111,7 @@
</itemlibraryentry> </itemlibraryentry>
</node> </node>
<node name="Qt/WebView" icon=":/fxplugin/images/webview-icon16.png"> <node name="org.webkit/WebView" icon=":/fxplugin/images/webview-icon16.png">
<propertyDefaultValue name="width" type="int" defaultValue="300"/> <propertyDefaultValue name="width" type="int" defaultValue="300"/>
<propertyDefaultValue name="height" type="int" defaultValue="300"/> <propertyDefaultValue name="height" type="int" defaultValue="300"/>
<itemlibraryentry name="Web View" category="Qt - Widgets" icon=":/fxplugin/images/webview-icon.png"> <itemlibraryentry name="Web View" category="Qt - Widgets" icon=":/fxplugin/images/webview-icon.png">

View File

@@ -63,6 +63,8 @@ const char * const QML_ITEMSPACING_KEY = "ItemSpacing";
const char * const QML_SNAPMARGIN_KEY = "SnapMargin"; const char * const QML_SNAPMARGIN_KEY = "SnapMargin";
enum { QML_OPENDESIGNMODE_DEFAULT = 0 }; // 0 for text mode, 1 for design mode enum { QML_OPENDESIGNMODE_DEFAULT = 0 }; // 0 for text mode, 1 for design mode
const char * const SETTINGS_CATEGORY_QML_ICON = ":/core/images/category_qml.png";
namespace Internal { namespace Internal {
enum { debug = 0 }; enum { debug = 0 };
} }

View File

@@ -95,7 +95,7 @@ QString SettingsPage::displayCategory() const
QIcon SettingsPage::categoryIcon() const QIcon SettingsPage::categoryIcon() const
{ {
return QIcon(); // TODO: Icon for QML or move into other category (Designer?) return QIcon(QLatin1String(Constants::SETTINGS_CATEGORY_QML_ICON));
} }
QWidget *SettingsPage::createPage(QWidget *parent) QWidget *SettingsPage::createPage(QWidget *parent)

View File

@@ -38,6 +38,8 @@
#include <qmljs/qmljsscanner.h> #include <qmljs/qmljsscanner.h>
#include <qmljs/qmljsevaluate.h> #include <qmljs/qmljsevaluate.h>
#include <qmljs/qmljscompletioncontextfinder.h> #include <qmljs/qmljscompletioncontextfinder.h>
#include <qmljs/qmljslink.h>
#include <qmljs/qmljsscopebuilder.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
@@ -595,6 +597,31 @@ static bool isLiteral(AST::Node *ast)
return false; return false;
} }
void CodeCompletion::addCompletions(const QHash<QString, const Interpreter::Value *> &newCompletions,
const QIcon &icon)
{
QHashIterator<QString, const Interpreter::Value *> it(newCompletions);
while (it.hasNext()) {
it.next();
TextEditor::CompletionItem item(this);
item.text = it.key();
item.icon = icon;
m_completions.append(item);
}
}
void CodeCompletion::addCompletions(const QStringList &newCompletions,
const QIcon &icon)
{
foreach (const QString &text, newCompletions) {
TextEditor::CompletionItem item(this);
item.text = text;
item.icon = icon;
m_completions.append(item);
}
}
int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor) int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
{ {
m_editor = editor; m_editor = editor;
@@ -627,10 +654,11 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
Interpreter::Engine interp; Interpreter::Engine interp;
Interpreter::Context context(&interp); Interpreter::Context context(&interp);
Link link(&context, document, snapshot, m_modelManager->importPaths());
// Set up the current scope chain. // Set up the current scope chain.
QList<AST::Node *> astPath = semanticInfo.astPath(editor->position()); ScopeBuilder scopeBuilder(document, &context);
context.build(astPath, document, snapshot, m_modelManager->importPaths()); scopeBuilder.push(semanticInfo.astPath(editor->position()));
// Search for the operator that triggered the completion. // Search for the operator that triggered the completion.
QChar completionOperator; QChar completionOperator;
@@ -660,24 +688,12 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
enumerateProperties.setGlobalCompletion(true); enumerateProperties.setGlobalCompletion(true);
enumerateProperties.setEnumerateGeneratedSlots(true); enumerateProperties.setEnumerateGeneratedSlots(true);
QHashIterator<QString, const Interpreter::Value *> it(enumerateProperties(qmlScopeType)); addCompletions(enumerateProperties(qmlScopeType), symbolIcon);
while (it.hasNext()) { addCompletions(enumerateProperties(context.scopeChain().qmlTypes), symbolIcon);
it.next();
TextEditor::CompletionItem item(this); if (ScopeBuilder::isPropertyChangesObject(&context, qmlScopeType)
item.text = it.key(); && context.scopeChain().qmlScopeObjects.size() == 2) {
item.icon = symbolIcon; addCompletions(enumerateProperties(context.scopeChain().qmlScopeObjects.first()), symbolIcon);
m_completions.append(item);
}
it = enumerateProperties(context.scopeChain().qmlTypes);
while (it.hasNext()) {
it.next();
TextEditor::CompletionItem item(this);
item.text = it.key();
item.icon = symbolIcon;
m_completions.append(item);
} }
} }
@@ -713,60 +729,33 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
// It's a global completion. // It's a global completion.
EnumerateProperties enumerateProperties(&context); EnumerateProperties enumerateProperties(&context);
enumerateProperties.setGlobalCompletion(true); enumerateProperties.setGlobalCompletion(true);
QHashIterator<QString, const Interpreter::Value *> it(enumerateProperties()); addCompletions(enumerateProperties(), symbolIcon);
while (it.hasNext()) {
it.next();
TextEditor::CompletionItem item(this);
item.text = it.key();
item.icon = symbolIcon;
m_completions.append(item);
}
} }
if (doJsKeywordCompletion) { if (doJsKeywordCompletion) {
// add js keywords // add js keywords
foreach (const QString &word, Scanner::keywords()) { addCompletions(Scanner::keywords(), keywordIcon);
TextEditor::CompletionItem item(this);
item.text = word;
item.icon = keywordIcon;
m_completions.append(item);
}
} }
// add qml extra words // add qml extra words
if (doQmlKeywordCompletion && isQmlFile) { if (doQmlKeywordCompletion && isQmlFile) {
static QStringList qmlWords; static QStringList qmlWords;
static QStringList qmlWordsAlsoInJs;
if (qmlWords.isEmpty()) { if (qmlWords.isEmpty()) {
qmlWords << QLatin1String("property") qmlWords << QLatin1String("property")
<< QLatin1String("readonly") //<< QLatin1String("readonly")
<< QLatin1String("signal") << QLatin1String("signal")
<< QLatin1String("import"); << QLatin1String("import");
} }
if (qmlWordsAlsoInJs.isEmpty()) {
foreach (const QString &word, qmlWords) { qmlWordsAlsoInJs << QLatin1String("default")
TextEditor::CompletionItem item(this); << QLatin1String("function");
item.text = word;
item.icon = keywordIcon;
m_completions.append(item);
} }
if (!doJsKeywordCompletion) { addCompletions(qmlWords, keywordIcon);
{ if (!doJsKeywordCompletion)
TextEditor::CompletionItem item(this); addCompletions(qmlWordsAlsoInJs, keywordIcon);
item.text = QLatin1String("default");
item.icon = keywordIcon;
m_completions.append(item);
}
{
TextEditor::CompletionItem item(this);
item.text = QLatin1String("function");
item.icon = keywordIcon;
m_completions.append(item);
}
}
} }
} }
@@ -787,15 +776,7 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
if (value && completionOperator == QLatin1Char('.')) { // member completion if (value && completionOperator == QLatin1Char('.')) { // member completion
EnumerateProperties enumerateProperties(&context); EnumerateProperties enumerateProperties(&context);
QHashIterator<QString, const Interpreter::Value *> it(enumerateProperties(value)); addCompletions(enumerateProperties(value), symbolIcon);
while (it.hasNext()) {
it.next();
TextEditor::CompletionItem item(this);
item.text = it.key();
item.icon = symbolIcon;
m_completions.append(item);
}
} else if (value && completionOperator == QLatin1Char('(') && m_startPosition == editor->position()) { } else if (value && completionOperator == QLatin1Char('(') && m_startPosition == editor->position()) {
// function completion // function completion
if (const Interpreter::FunctionValue *f = value->asFunctionValue()) { if (const Interpreter::FunctionValue *f = value->asFunctionValue()) {

View File

@@ -39,6 +39,12 @@ namespace TextEditor {
class ITextEditable; class ITextEditable;
} }
namespace QmlJS {
namespace Interpreter {
class Value;
}
}
namespace QmlJSEditor { namespace QmlJSEditor {
class ModelManagerInterface; class ModelManagerInterface;
@@ -74,6 +80,11 @@ private:
bool maybeTriggersCompletion(TextEditor::ITextEditable *editor); bool maybeTriggersCompletion(TextEditor::ITextEditable *editor);
bool isDelimiter(const QChar &ch) const; bool isDelimiter(const QChar &ch) const;
void addCompletions(const QHash<QString, const QmlJS::Interpreter::Value *> &newCompletions,
const QIcon &icon);
void addCompletions(const QStringList &newCompletions,
const QIcon &icon);
ModelManagerInterface *m_modelManager; ModelManagerInterface *m_modelManager;
TextEditor::ITextEditable *m_editor; TextEditor::ITextEditable *m_editor;
int m_startPosition; int m_startPosition;

View File

@@ -39,6 +39,8 @@
#include <qmljs/qmljscheck.h> #include <qmljs/qmljscheck.h>
#include <qmljs/qmljsevaluate.h> #include <qmljs/qmljsevaluate.h>
#include <qmljs/qmljsdocument.h> #include <qmljs/qmljsdocument.h>
#include <qmljs/qmljslink.h>
#include <qmljs/qmljsscopebuilder.h>
#include <qmljs/parser/qmljsastvisitor_p.h> #include <qmljs/parser/qmljsastvisitor_p.h>
#include <qmljs/parser/qmljsast_p.h> #include <qmljs/parser/qmljsast_p.h>
#include <qmljs/parser/qmljsengine_p.h> #include <qmljs/parser/qmljsengine_p.h>
@@ -1007,8 +1009,9 @@ TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor &
Interpreter::Engine interp; Interpreter::Engine interp;
Interpreter::Context context(&interp); Interpreter::Context context(&interp);
context.build(semanticInfo.astPath(cursorPosition), semanticInfo.document, QmlJS::Link linkedSnapshot(&context, semanticInfo.document, semanticInfo.snapshot, m_modelManager->importPaths());
semanticInfo.snapshot, m_modelManager->importPaths()); ScopeBuilder scopeBuilder(semanticInfo.document, &context);
scopeBuilder.push(semanticInfo.astPath(cursorPosition));
Evaluate check(&context); Evaluate check(&context);
const Interpreter::Value *value = check.reference(node); const Interpreter::Value *value = check.reference(node);
@@ -1018,7 +1021,7 @@ TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor &
if (! (value && value->getSourceLocation(&fileName, &line, &column))) if (! (value && value->getSourceLocation(&fileName, &line, &column)))
return Link(); return Link();
Link link; BaseTextEditor::Link link;
link.fileName = fileName; link.fileName = fileName;
link.line = line; link.line = line;
link.column = column - 1; // adjust the column link.column = column - 1; // adjust the column

View File

@@ -39,6 +39,8 @@
#include <qmljs/qmljsbind.h> #include <qmljs/qmljsbind.h>
#include <qmljs/qmljsevaluate.h> #include <qmljs/qmljsevaluate.h>
#include <qmljs/qmljsinterpreter.h> #include <qmljs/qmljsinterpreter.h>
#include <qmljs/qmljslink.h>
#include <qmljs/qmljsscopebuilder.h>
#include <qmljs/parser/qmljsast_p.h> #include <qmljs/parser/qmljsast_p.h>
#include <texteditor/itexteditor.h> #include <texteditor/itexteditor.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
@@ -172,7 +174,9 @@ void HoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int p
Interpreter::Engine interp; Interpreter::Engine interp;
Interpreter::Context context(&interp); Interpreter::Context context(&interp);
context.build(astPath, qmlDocument, snapshot, m_modelManager->importPaths()); Link link(&context, qmlDocument, snapshot, m_modelManager->importPaths());
ScopeBuilder scopeBuilder(qmlDocument, &context);
scopeBuilder.push(astPath);
Evaluate check(&context); Evaluate check(&context);
const Interpreter::Value *value = check(node); const Interpreter::Value *value = check(node);

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

View File

@@ -3,5 +3,6 @@
<file>QmlProject.mimetypes.xml</file> <file>QmlProject.mimetypes.xml</file>
<file>images/qmlfolder.png</file> <file>images/qmlfolder.png</file>
<file>images/qmlproject.png</file> <file>images/qmlproject.png</file>
<file>images/qml_wizard.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -35,6 +35,9 @@
#include <QtGui/QIcon> #include <QtGui/QIcon>
#include <QtGui/QPainter>
#include <QtGui/QPixmap>
#include <QtCore/QTextStream> #include <QtCore/QTextStream>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
@@ -58,7 +61,14 @@ QmlProjectApplicationWizard::~QmlProjectApplicationWizard()
Core::BaseFileWizardParameters QmlProjectApplicationWizard::parameters() Core::BaseFileWizardParameters QmlProjectApplicationWizard::parameters()
{ {
Core::BaseFileWizardParameters parameters(ProjectWizard); Core::BaseFileWizardParameters parameters(ProjectWizard);
parameters.setIcon(QIcon(QLatin1String(":/wizards/images/console.png"))); // TODO: provide icons in correct size
{
QPixmap icon(22, 22);
icon.fill(Qt::transparent);
QPainter p(&icon);
p.drawPixmap(3, 3, 16, 16, QPixmap(QLatin1String(Constants::QML_WIZARD_ICON)));
parameters.setIcon(icon);
}
parameters.setDisplayName(tr("Qt QML Application")); parameters.setDisplayName(tr("Qt QML Application"));
parameters.setId(QLatin1String("QA.QML Application")); parameters.setId(QLatin1String("QA.QML Application"));
parameters.setDescription(tr("Creates a Qt QML application project with a single QML file containing the main view.\n\n" parameters.setDescription(tr("Creates a Qt QML application project with a single QML file containing the main view.\n\n"

View File

@@ -53,6 +53,7 @@ const char *const TASK_CATEGORY_QML = "Task.Category.Qml";
const char * const QML_WIZARD_CATEGORY = "F.Projects"; // (after Qt) const char * const QML_WIZARD_CATEGORY = "F.Projects"; // (after Qt)
const char * const QML_WIZARD_TR_SCOPE = "QmlProjectManager"; const char * const QML_WIZARD_TR_SCOPE = "QmlProjectManager";
const char * const QML_WIZARD_TR_CATEGORY = QT_TRANSLATE_NOOP("QmlProjectManager", "Qt Quick Project"); const char * const QML_WIZARD_TR_CATEGORY = QT_TRANSLATE_NOOP("QmlProjectManager", "Qt Quick Project");
const char * const QML_WIZARD_ICON = ":/qmlproject/images/qml_wizard.png";
// Env variables for inspector // Env variables for inspector
const char * const E_QML_DEBUG_SERVER_PORT = "QML_DEBUG_SERVER_PORT"; const char * const E_QML_DEBUG_SERVER_PORT = "QML_DEBUG_SERVER_PORT";

View File

@@ -40,6 +40,11 @@
#include <QtGui/QIcon> #include <QtGui/QIcon>
#include <QtGui/QApplication>
#include <QtGui/QStyle>
#include <QtGui/QPainter>
#include <QtGui/QPixmap>
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QtDebug> #include <QtCore/QtDebug>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
@@ -100,7 +105,14 @@ QmlProjectImportWizard::~QmlProjectImportWizard()
Core::BaseFileWizardParameters QmlProjectImportWizard::parameters() Core::BaseFileWizardParameters QmlProjectImportWizard::parameters()
{ {
Core::BaseFileWizardParameters parameters(ProjectWizard); Core::BaseFileWizardParameters parameters(ProjectWizard);
parameters.setIcon(QIcon(QLatin1String(":/wizards/images/console.png"))); // TODO do something about the ugliness of standard icons in sizes different than 16, 32, 64, 128
{
QPixmap icon(22, 22);
icon.fill(Qt::transparent);
QPainter p(&icon);
p.drawPixmap(3, 3, 16, 16, qApp->style()->standardIcon(QStyle::SP_DirIcon).pixmap(16));
parameters.setIcon(icon);
}
parameters.setDisplayName(tr("Import Existing Qt QML Directory")); parameters.setDisplayName(tr("Import Existing Qt QML Directory"));
parameters.setId(QLatin1String("QI.QML Import")); parameters.setId(QLatin1String("QI.QML Import"));
parameters.setDescription(tr("Creates a QML project from an existing directory of QML files.")); parameters.setDescription(tr("Creates a QML project from an existing directory of QML files."));

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