diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc index cd1e9f127a0..7455ef7f7c9 100644 --- a/doc/qtcreator.qdoc +++ b/doc/qtcreator.qdoc @@ -54,6 +54,10 @@ \o \l{Finding and Replacing} \o \l{Refactoring} \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 \o \l{Managing Projects} \list @@ -388,6 +392,9 @@ \endlist 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 @@ -620,28 +627,6 @@ checking, code completion, context sensitive help and in-line error 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 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 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 @@ -760,6 +750,10 @@ \gui{Autocomplete common prefix} in the code completion preferences. 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 used for each. @@ -856,8 +850,16 @@ \note In Qt Creator indexing updates the code automatically. Use \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 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 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 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} > \gui{Ex Command Mapping}. - To make changes to the Vim style settings, select \gui{Tools} > - \gui{Options...} > \gui{General}. + To make changes to the Vim-style settings, select \gui{Tools} > + \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 \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 \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 \previouspage creator-editor-using.html @@ -1139,7 +1290,7 @@ /*! \contentspage index.html - \previouspage creator-editor-locator.html + \previouspage creator-editor-external.html \page creator-project-managing.html \nextpage creator-project-creating.html @@ -1702,7 +1853,7 @@ /*! \contentspage index.html - \previouspage creator-developing-symbian.html + \previouspage creator-project-managing-sessions.html \page creator-building-running.html \nextpage creator-building-targets.html @@ -1941,6 +2092,24 @@ 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}. + \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 @@ -2145,7 +2314,7 @@ \contentspage index.html \previouspage creator-editor-settings.html \page creator-build-dependencies.html - \nextpage creator-project-managing-sessions.html + \nextpage creator-visual-editor.html \title Specifying Dependencies @@ -2890,7 +3059,7 @@ \contentspage index.html \previouspage creator-editor-refactoring.html \page creator-editor-locator.html - \nextpage creator-project-managing.html + \nextpage creator-editor-codepasting.html \title Searching With the Locator @@ -3064,9 +3233,9 @@ /*! \contentspage index.html - \previouspage creator-build-dependencies.html + \previouspage creator-developing-symbian.html \page creator-project-managing-sessions.html - \nextpage creator-visual-editor.html + \nextpage creator-building-running.html \title Managing Sessions @@ -4497,7 +4666,7 @@ /*! \contentspage index.html - \previouspage creator-project-managing-sessions.html + \previouspage creator-build-dependencies.html \page creator-visual-editor.html \nextpage creator-usability.html @@ -5527,7 +5696,7 @@ \contentspage index.html \previouspage creator-developing-maemo.html \page creator-developing-symbian.html - \nextpage creator-building-running.html + \nextpage creator-project-managing-sessions.html \title Setting Up Development Environment for Symbian @@ -6052,6 +6221,9 @@ \row \o Cut line \o Shift+Del + \row + \o Join lines + \o Ctrl+J \row \o Decrease font size \o Ctrl+- (Ctrl+Roll mouse wheel down) @@ -6059,7 +6231,7 @@ \o Increase font size \o Ctrl++ (Ctrl+Roll mouse wheel up) \row - \o Toggle vim-style editing + \o Toggle Vim-style editing \o Alt+V, Alt+V \row \o Split diff --git a/share/qtcreator/qml-type-descriptions/qml-builtin-types.xml b/share/qtcreator/qml-type-descriptions/qml-builtin-types.xml index db77280c210..6f2f3eea5d1 100644 --- a/share/qtcreator/qml-type-descriptions/qml-builtin-types.xml +++ b/share/qtcreator/qml-type-descriptions/qml-builtin-types.xml @@ -1370,12 +1370,12 @@ - + - + @@ -1457,10 +1457,6 @@ - - - - @@ -1474,6 +1470,7 @@ + @@ -1555,7 +1552,7 @@ - + @@ -1566,7 +1563,7 @@ - + @@ -1583,8 +1580,13 @@ + + - + + + + @@ -1599,22 +1601,26 @@ + + - - - - + + - + + + + + @@ -1865,18 +1871,30 @@ + + + + + + + + + + + + @@ -2126,14 +2144,8 @@ - - - - - - @@ -2141,7 +2153,7 @@ - + @@ -2157,6 +2169,7 @@ + @@ -2180,6 +2193,7 @@ + @@ -2274,6 +2288,8 @@ + + @@ -2303,7 +2319,7 @@ - + @@ -2319,7 +2335,7 @@ - + @@ -3094,7 +3110,7 @@ - + @@ -3121,6 +3137,8 @@ + + @@ -3139,6 +3157,10 @@ + + + + diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/Transformation.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/Transformation.qml index 80a9073d19e..aa1a724d364 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/Transformation.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/Transformation.qml @@ -70,14 +70,14 @@ GroupBox { property variant pureValue: backendValues.scale.value; onPureValueChanged: { if (value != pureValue * 100) - value = pureValue * 100; + value = pureValue * 10; } minimum: 1; maximum: 100; singleStep: 1; onValueChanged: { if ((value > 5) && (value < 100)) - backendValues.scale.value = value / 100; + backendValues.scale.value = value / 10; } } } diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/Visibility.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/Visibility.qml index 4e1c6303a2c..444012e8ac3 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/Visibility.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/Visibility.qml @@ -20,6 +20,13 @@ GroupBox { backendValue: backendValues.visible; baseStateFlag: isBaseState; checkable: true; + } + } + } + QWidget { + layout: HorizontalLayout { + Label { + text: "" } CheckBox { id: clipCheckBox; diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/propertyEditor.css b/share/qtcreator/qmldesigner/propertyeditor/Qt/propertyEditor.css index 1aa4a9ce404..c63ecdd3957 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/propertyEditor.css +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/propertyEditor.css @@ -24,7 +24,8 @@ QLabel { padding: 0; background: none; color: #dedede; - font: bold + font: bold; + font-size: 11px; } QScrollArea { @@ -38,7 +39,7 @@ QGroupBox background-color: #4f4f4f; border: 1px solid #4F4F4F; color: white; - font: bold + font: bold ; } QLineEdit diff --git a/share/qtcreator/snippets/qml.xml b/share/qtcreator/snippets/qml.xml index 9a116470ef3..cc81a722493 100644 --- a/share/qtcreator/snippets/qml.xml +++ b/share/qtcreator/snippets/qml.xml @@ -1,6 +1,6 @@ -property type name : name +property type name: name Item { id: name diff --git a/share/qtcreator/templates/wizards/qml-runtime/lib.png b/share/qtcreator/templates/wizards/qml-runtime/lib.png new file mode 100644 index 00000000000..a4e818d986d Binary files /dev/null and b/share/qtcreator/templates/wizards/qml-runtime/lib.png differ diff --git a/share/qtcreator/templates/wizards/qml-runtime/wizard.xml b/share/qtcreator/templates/wizards/qml-runtime/wizard.xml index 4f7576f445f..5800b8ef5d6 100644 --- a/share/qtcreator/templates/wizards/qml-runtime/wizard.xml +++ b/share/qtcreator/templates/wizards/qml-runtime/wizard.xml @@ -37,6 +37,7 @@ leave room for the Qt 4 target page. + lib.png Creates a C++ plugin to extend the funtionality of the QML runtime. QML Runtime Plug-in QML Runtime Plug-in diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index 046c1c1a305..2d2f0adf8ee 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -14499,7 +14499,7 @@ Die folgenden Encodings scheinen der Datei zu entsprechen: Color Scheme - Farbschema: + Farbschema diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index ddc77365e5b..f7b41b67746 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -585,6 +585,17 @@ void PluginManager::profilingReport(const char *what, const PluginSpec *spec) d->profilingReport(what, spec); } + +/*! + \fn void PluginManager::loadQueue() + + Returns a list of plugins in load order. +*/ +QList PluginManager::loadQueue() +{ + return d->loadQueue(); +} + //============PluginManagerPrivate=========== /*! @@ -786,13 +797,10 @@ bool PluginManagerPrivate::loadQueue(PluginSpec *spec, QList &queu circularityCheckQueue.append(spec); // check if we have the dependencies if (spec->state() == PluginSpec::Invalid || spec->state() == PluginSpec::Read) { - if (!spec->isDisabledIndirectly() && spec->isEnabled()) { - spec->d->hasError = true; - spec->d->errorString += "\n"; - spec->d->errorString += PluginManager::tr("Cannot load plugin because dependencies are not resolved"); - } + queue.append(spec); return false; } + // add dependencies foreach (PluginSpec *depSpec, spec->dependencySpecs()) { if (!loadQueue(depSpec, queue, circularityCheckQueue)) { @@ -814,7 +822,11 @@ bool PluginManagerPrivate::loadQueue(PluginSpec *spec, QList &queu */ 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; switch (destState) { @@ -927,6 +939,9 @@ void PluginManagerPrivate::resolveDependencies() foreach (PluginSpec *spec, pluginSpecs) { spec->d->resolveDependencies(pluginSpecs); } + foreach (PluginSpec *spec, loadQueue()) { + spec->d->disableIndirectlyIfDependencyDisabled(); + } } // Look in argument descriptions of the specs for the option. diff --git a/src/libs/extensionsystem/pluginmanager.h b/src/libs/extensionsystem/pluginmanager.h index 037308945e5..67b2e894093 100644 --- a/src/libs/extensionsystem/pluginmanager.h +++ b/src/libs/extensionsystem/pluginmanager.h @@ -91,6 +91,7 @@ public: } // Plugin operations + QList loadQueue(); void loadPlugins(); QStringList pluginPaths() const; void setPluginPaths(const QStringList &paths); diff --git a/src/libs/extensionsystem/pluginspec.cpp b/src/libs/extensionsystem/pluginspec.cpp index 7af800d4446..4bc231c4f3f 100644 --- a/src/libs/extensionsystem/pluginspec.cpp +++ b/src/libs/extensionsystem/pluginspec.cpp @@ -500,6 +500,11 @@ void PluginSpec::setEnabled(bool value) d->enabled = value; } +void PluginSpec::setDisabledIndirectly(bool value) +{ + d->disabledIndirectly = value; +} + /*! \fn bool PluginSpecPrivate::reportError(const QString &err) \internal @@ -799,11 +804,7 @@ bool PluginSpecPrivate::resolveDependencies(const QList &specs) foreach (PluginSpec *spec, specs) { if (spec->provides(dependency.name, dependency.version)) { found = spec; - if (!spec->isEnabled() || spec->isDisabledIndirectly()) - disabledIndirectly = true; - spec->d->addProvidesForPlugin(q); - break; } } @@ -822,12 +823,26 @@ bool PluginSpecPrivate::resolveDependencies(const QList &specs) dependencySpecs = resolvedDependencies; - if (enabled && !disabledIndirectly) - state = PluginSpec::Resolved; + state = PluginSpec::Resolved; 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() \internal diff --git a/src/libs/extensionsystem/pluginspec.h b/src/libs/extensionsystem/pluginspec.h index e79d94edaa5..b253d256b69 100644 --- a/src/libs/extensionsystem/pluginspec.h +++ b/src/libs/extensionsystem/pluginspec.h @@ -92,6 +92,7 @@ public: QString filePath() const; void setEnabled(bool value); + void setDisabledIndirectly(bool value); QStringList arguments() const; void setArguments(const QStringList &arguments); diff --git a/src/libs/extensionsystem/pluginspec_p.h b/src/libs/extensionsystem/pluginspec_p.h index f35770ff6a0..e8c8c9443aa 100644 --- a/src/libs/extensionsystem/pluginspec_p.h +++ b/src/libs/extensionsystem/pluginspec_p.h @@ -92,6 +92,8 @@ public: // add/remove from providesSpecs void addProvidesForPlugin(PluginSpec *dependent); void removeProvidesForPlugin(PluginSpec *dependent); + void disableIndirectlyIfDependencyDisabled(); + private: PluginSpec *q; diff --git a/src/libs/extensionsystem/pluginview.cpp b/src/libs/extensionsystem/pluginview.cpp index 553f2a14df2..f60b2c32def 100644 --- a/src/libs/extensionsystem/pluginview.cpp +++ b/src/libs/extensionsystem/pluginview.cpp @@ -177,8 +177,7 @@ void PluginView::updateList() defaultCollectionItem->setToolTip(C_LOAD, tr("Load on Startup")); defaultCollectionItem->setData(0, Qt::UserRole, qVariantFromValue(defaultCollection)); - foreach (PluginSpec *spec, m_specToItem.keys()) - toggleRelatedPlugins(spec, spec->isEnabled() && !spec->isDisabledIndirectly()); + updatePluginDependencies(); m_ui->categoryWidget->clear(); if (!m_items.isEmpty()) { @@ -301,7 +300,7 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column) if (column == C_LOAD) { spec->setEnabled(loadOnStartup); - toggleRelatedPlugins(spec, loadOnStartup); + updatePluginDependencies(); if (item->parent()) { PluginCollection *collection = item->parent()->data(0, Qt::UserRole).value(); @@ -332,33 +331,36 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column) spec->setEnabled(loadOnStartup); Qt::CheckState state = (loadOnStartup ? Qt::Checked : Qt::Unchecked); child->setData(C_LOAD, Qt::CheckStateRole, state); - toggleRelatedPlugins(spec, loadOnStartup); } else { child->setData(C_LOAD, Qt::CheckStateRole, Qt::Checked); child->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); } } + updatePluginDependencies(); emit pluginSettingsChanged(collection->plugins().first()); } m_allowCheckStateUpdate = true; } -void PluginView::toggleRelatedPlugins(PluginSpec *modifiedPlugin, bool isPluginEnabled) +void PluginView::updatePluginDependencies() { - - for(int i = 0; i < modifiedPlugin->providesForSpecs().length(); ++i) { - PluginSpec *spec = modifiedPlugin->providesForSpecs().at(i); - QTreeWidgetItem *childItem = m_specToItem.value(spec); - - if (childItem->isDisabled() != !isPluginEnabled) { - childItem->setDisabled(!isPluginEnabled); - if (childItem->parent() && !childItem->parent()->isExpanded()) - childItem->parent()->setExpanded(true); - - - toggleRelatedPlugins(spec, isPluginEnabled); + foreach (PluginSpec *spec, PluginManager::instance()->loadQueue()) { + bool disableIndirectly = false; + foreach(const PluginSpec *depSpec, spec->dependencySpecs()) { + if (!depSpec->isEnabled() || depSpec->isDisabledIndirectly()) { + disableIndirectly = true; + break; + } } + QTreeWidgetItem *childItem = m_specToItem.value(spec); + childItem->setDisabled(disableIndirectly); + + if (disableIndirectly == spec->isDisabledIndirectly()) + continue; + spec->setDisabledIndirectly(disableIndirectly); + + if (childItem->parent() && !childItem->parent()->isExpanded()) + childItem->parent()->setExpanded(true); } } - diff --git a/src/libs/extensionsystem/pluginview.h b/src/libs/extensionsystem/pluginview.h index d9c8b470502..b1668b2304c 100644 --- a/src/libs/extensionsystem/pluginview.h +++ b/src/libs/extensionsystem/pluginview.h @@ -77,7 +77,7 @@ private slots: private: enum ParsedState { ParsedNone = 1, ParsedPartial = 2, ParsedAll = 4, ParsedWithErrors = 8}; QIcon iconForState(int state); - void toggleRelatedPlugins(PluginSpec *spec, bool isPluginEnabled = true); + void updatePluginDependencies(); int parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &groupState, QList plugins); Internal::Ui::PluginView *m_ui; diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 91a1adedd5a..8d4e00ff8bb 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -34,7 +34,6 @@ #include "parser/qmljsast_p.h" #include -#include #include #include @@ -64,13 +63,27 @@ public: 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 (/*cast(_ast) + if (const QmlEnumValue *enumValue = dynamic_cast(value)) { + if (StringLiteral *stringLiteral = cast(_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(_ast) ||*/ _ast->kind == Node::Kind_TrueLiteral - || _ast->kind == Node::Kind_FalseLiteral) { - _message.message = QCoreApplication::translate("QmlJS::Check", "numerical value expected"); + || _ast->kind == Node::Kind_FalseLiteral) { + _message.message = Check::tr("numerical value expected"); + } } } @@ -81,7 +94,7 @@ public: if (cast(_ast) || cast(_ast) || (unaryMinus && cast(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(unaryMinus->expression)) || _ast->kind == Node::Kind_TrueLiteral || _ast->kind == Node::Kind_FalseLiteral) { - _message.message = QCoreApplication::translate("QmlJS::Check", "string value expected"); - } - } - - virtual void visit(const EasingCurveNameValue *) - { - if (StringLiteral *stringLiteral = cast(_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"); + _message.message = Check::tr("string value expected"); } } @@ -134,7 +131,7 @@ public: ok = QColor::isValidColor(colorString); } if (!ok) - _message.message = QCoreApplication::translate("QmlJS::Check", "not a valid color"); + _message.message = Check::tr("not a valid color"); } else { visit((StringValue *)0); } @@ -143,7 +140,7 @@ public: virtual void visit(const AnchorLineValue *) { if (! (_rhsValue->asAnchorLineValue() || _rhsValue->asUndefinedValue())) - _message.message = QCoreApplication::translate("QmlJS::Check", "expected anchor line"); + _message.message = Check::tr("expected anchor line"); } DiagnosticMessage _message; @@ -211,7 +208,7 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId, if (! _context.lookupType(_doc.data(), typeId)) { if (! _ignoreTypeErrors) error(typeId->identifierToken, - QCoreApplication::translate("QmlJS::Check", "unknown type")); + Check::tr("unknown type")); // suppress subsequent errors about scope object lookup by clearing // the scope object list // ### todo: better way? @@ -236,7 +233,7 @@ bool Check::visit(UiScriptBinding *ast) ExpressionStatement *expStmt = cast(ast->statement); if (!expStmt) { - error(loc, QCoreApplication::translate("QmlJS::Check", "expected id")); + error(loc, Check::tr("expected id")); return false; } @@ -245,14 +242,14 @@ bool Check::visit(UiScriptBinding *ast) id = idExp->name->asString(); } else if (StringLiteral *strExp = cast(expStmt->expression)) { 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 { - error(loc, QCoreApplication::translate("QmlJS::Check", "expected id")); + error(loc, Check::tr("expected id")); return false; } 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; } } @@ -325,7 +322,7 @@ const Value *Check::checkScopeObjectMember(const UiQualifiedId *id) } if (!value) { 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 @@ -338,7 +335,7 @@ const Value *Check::checkScopeObjectMember(const UiQualifiedId *id) const ObjectValue *objectValue = value_cast(value); if (! objectValue) { 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; } @@ -354,7 +351,7 @@ const Value *Check::checkScopeObjectMember(const UiQualifiedId *id) value = objectValue->lookupMember(propertyName, &_context); if (! value) { 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())); return 0; } diff --git a/src/libs/qmljs/qmljscheck.h b/src/libs/qmljs/qmljscheck.h index 8d37b1c7064..d7c7e930a02 100644 --- a/src/libs/qmljs/qmljscheck.h +++ b/src/libs/qmljs/qmljscheck.h @@ -36,10 +36,14 @@ #include #include +#include + namespace QmlJS { class QMLJS_EXPORT Check: protected AST::Visitor { + Q_DECLARE_TR_FUNCTIONS(QmlJS::Check) + public: Check(Document::Ptr doc, const Snapshot &snapshot, const QStringList &importPaths); virtual ~Check(); diff --git a/src/libs/qmljs/qmljscompletioncontextfinder.cpp b/src/libs/qmljs/qmljscompletioncontextfinder.cpp index 645472c2203..c316b7b4a74 100644 --- a/src/libs/qmljs/qmljscompletioncontextfinder.cpp +++ b/src/libs/qmljs/qmljscompletioncontextfinder.cpp @@ -25,14 +25,19 @@ CompletionContextFinder::CompletionContextFinder(const QTextCursor &cursor) initialize(cursor.document()->begin(), lastBlock); m_startTokenIndex = yyLinizerState.tokens.size() - 1; - for (; m_startTokenIndex >= 0; --m_startTokenIndex) { - const Token &token = yyLinizerState.tokens.at(m_startTokenIndex); - if (token.end() <= cursor.positionInBlock()) - break; - } - if (m_startTokenIndex == yyLinizerState.tokens.size() - 1 && yyLinizerState.insertedSemicolon) - --m_startTokenIndex; + // 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) { + const Token &token = yyLinizerState.tokens.at(m_startTokenIndex); + if (token.end() <= cursor.positionInBlock()) + break; + } + + if (m_startTokenIndex == yyLinizerState.tokens.size() - 1 && yyLinizerState.insertedSemicolon) + --m_startTokenIndex; + } getQmlObjectTypeName(m_startTokenIndex); checkBinding(); diff --git a/src/libs/qmljs/qmljscompletioncontextfinder.h b/src/libs/qmljs/qmljscompletioncontextfinder.h index ec2baf7cf27..b23d158f16f 100644 --- a/src/libs/qmljs/qmljscompletioncontextfinder.h +++ b/src/libs/qmljs/qmljscompletioncontextfinder.h @@ -14,9 +14,6 @@ class QMLJS_EXPORT CompletionContextFinder : public LineInfo public: CompletionContextFinder(const QTextCursor &cursor); - //bool inQmlObjectDefinition(); - bool inQmlBindingRhs(); - QStringList qmlObjectTypeName() const; bool isInQmlContext() const; diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index ec4a1d981ac..76a77ac3954 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -326,6 +326,8 @@ public: class QmlXmlReader { + Q_DECLARE_TR_FUNCTIONS(QmlJS::Interpreter::QmlXmlReader) + public: QmlXmlReader(QIODevice *dev) : _xml(dev) @@ -339,7 +341,7 @@ public: if (_xml.name() == "module") readModule(); 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(); @@ -351,7 +353,7 @@ public: private: 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) { @@ -360,11 +362,11 @@ private: } 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) { - _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() @@ -846,15 +848,6 @@ const Value *QmlObjectValue::propertyValue(const FakeMetaProperty &prop) const value = engine()->colorValue(); } else if (typeName == QLatin1String("QDeclarativeAnchorLine")) { 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 @@ -1199,10 +1192,6 @@ void ValueVisitor::visit(const Reference *) { } -void ValueVisitor::visit(const EasingCurveNameValue *) -{ -} - void ValueVisitor::visit(const ColorValue *) { } @@ -1267,11 +1256,6 @@ const Reference *Value::asReference() const return 0; } -const EasingCurveNameValue *Value::asEasingCurveNameValue() const -{ - return 0; -} - const ColorValue *Value::asColorValue() const { return 0; @@ -1411,13 +1395,6 @@ Context::~Context() { } -void Context::build(const QList &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 { return _engine; @@ -1557,67 +1534,6 @@ const Value *Reference::value(Context *) const return _engine->undefinedValue(); } -void EasingCurveNameValue::accept(ValueVisitor *visitor) const -{ - visitor->visit(this); -} - -QSet EasingCurveNameValue::_curveNames; -QSet EasingCurveNameValue::curveNames() -{ - if (_curveNames.isEmpty()) { - _curveNames = QSet() - << "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 { visitor->visit(this); @@ -1999,8 +1915,8 @@ QStringList MetaTypeSystem::load(const QFileInfoList &xmlFiles) } file.close(); } else { - errorMsgs.append(QCoreApplication::translate("QmlJS::Interpreter::QmlXmlReader", "%1: %2").arg(xmlFile.absoluteFilePath(), - file.errorString())); + errorMsgs.append(QmlXmlReader::tr("%1: %2").arg(xmlFile.absoluteFilePath(), + file.errorString())); } } @@ -2337,11 +2253,6 @@ void TypeId::visit(const FunctionValue *object) _result = QLatin1String("Function"); } -void TypeId::visit(const EasingCurveNameValue *) -{ - _result = QLatin1String("string"); -} - void TypeId::visit(const ColorValue *) { _result = QLatin1String("string"); @@ -2412,11 +2323,6 @@ const StringValue *Engine::stringValue() const return &_stringValue; } -const EasingCurveNameValue *Engine::easingCurveNameValue() const -{ - return &_easingCurveNameValue; -} - const ColorValue *Engine::colorValue() const { return &_colorValue; diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 01d65af5099..ba2ee534ab7 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -60,7 +60,6 @@ class StringValue; class ObjectValue; class FunctionValue; class Reference; -class EasingCurveNameValue; class ColorValue; class AnchorLineValue; @@ -88,7 +87,6 @@ public: virtual void visit(const ObjectValue *); virtual void visit(const FunctionValue *); virtual void visit(const Reference *); - virtual void visit(const EasingCurveNameValue *); virtual void visit(const ColorValue *); virtual void visit(const AnchorLineValue *); }; @@ -113,7 +111,6 @@ public: virtual const ObjectValue *asObjectValue() const; virtual const FunctionValue *asFunctionValue() const; virtual const Reference *asReference() const; - virtual const EasingCurveNameValue *asEasingCurveNameValue() const; virtual const ColorValue *asColorValue() const; virtual const AnchorLineValue *asAnchorLineValue() const; @@ -172,12 +169,6 @@ template <> Q_INLINE_TEMPLATE const Reference *value_cast(const Value *v) 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) { if (v) return v->asColorValue(); @@ -289,9 +280,6 @@ public: Context(Engine *engine); ~Context(); - void build(const QList &astPath, const Document::Ptr doc, - const Snapshot &snapshot, const QStringList &importPaths); - Engine *engine() const; const ScopeChain &scopeChain() const; ScopeChain &scopeChain(); @@ -342,18 +330,6 @@ private: Engine *_engine; }; -class QMLJS_EXPORT EasingCurveNameValue: public Value -{ - static QSet _curveNames; - -public: - static QSet curveNames(); - - // Value interface - virtual const EasingCurveNameValue *asEasingCurveNameValue() const; - virtual void accept(ValueVisitor *) const; -}; - class QMLJS_EXPORT ColorValue: public Value { public: @@ -639,7 +615,6 @@ protected: virtual void visit(const StringValue *); virtual void visit(const ObjectValue *object); virtual void visit(const FunctionValue *object); - virtual void visit(const EasingCurveNameValue *); virtual void visit(const ColorValue *); virtual void visit(const AnchorLineValue *); }; @@ -658,7 +633,6 @@ public: const NumberValue *numberValue() const; const BooleanValue *booleanValue() const; const StringValue *stringValue() const; - const EasingCurveNameValue *easingCurveNameValue() const; const ColorValue *colorValue() const; const AnchorLineValue *anchorLineValue() const; @@ -744,7 +718,6 @@ private: NumberValue _numberValue; BooleanValue _booleanValue; StringValue _stringValue; - EasingCurveNameValue _easingCurveNameValue; ColorValue _colorValue; AnchorLineValue _anchorLineValue; QList _registeredValues; diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index fbbe4071e70..ccc446c8e98 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -8,7 +8,6 @@ #include #include #include -#include using namespace QmlJS; using namespace QmlJS::Interpreter; @@ -211,7 +210,7 @@ void Link::importFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc, importNamespace->setProperty(targetName, importedDoc->bind()->rootObjectValue()); } else { 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('.')); if (dotIdx == -1) { error(doc, import->versionToken, - QCoreApplication::translate("QmlJS::Link", "expected two numbers separated by a dot")); + tr("expected two numbers separated by a dot")); return; } else { majorVersion = versionString.left(dotIdx).toInt(); @@ -261,7 +260,7 @@ void Link::importNonFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc, A } } else { 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; } @@ -307,7 +306,7 @@ void Link::importNonFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc, A } error(doc, locationFromRange(import->firstSourceLocation(), import->lastSourceLocation()), - QCoreApplication::translate("QmlJS::Link", "package not found")); + tr("package not found")); } UiQualifiedId *Link::qualifiedTypeNameId(Node *node) diff --git a/src/libs/qmljs/qmljslink.h b/src/libs/qmljs/qmljslink.h index f97f9dfb31a..44074447246 100644 --- a/src/libs/qmljs/qmljslink.h +++ b/src/libs/qmljs/qmljslink.h @@ -8,6 +8,7 @@ #include #include #include +#include namespace QmlJS { @@ -18,6 +19,8 @@ class NameId; */ class QMLJS_EXPORT Link { + Q_DECLARE_TR_FUNCTIONS(QmlJS::Link) + public: // Link all documents in snapshot Link(Interpreter::Context *context, const Document::Ptr &doc, const Snapshot &snapshot, diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp index 7a3bcfd86a5..2cc24a8cd53 100644 --- a/src/libs/qmljs/qmljsscopebuilder.cpp +++ b/src/libs/qmljs/qmljsscopebuilder.cpp @@ -33,7 +33,8 @@ void ScopeBuilder::push(AST::Node *node) // JS scopes if (FunctionDeclaration *fun = cast(node)) { ObjectValue *functionScope = _doc->bind()->findFunctionScope(fun); - _context->scopeChain().jsScopes += functionScope; + if (functionScope) + _context->scopeChain().jsScopes += functionScope; } _context->scopeChain().update(); @@ -106,14 +107,7 @@ void ScopeBuilder::setQmlScopeObject(Node *node) // check if the object has a Qt.PropertyChanges ancestor prototype = scopeObject->prototype(_context); - while (prototype) { - if (const QmlObjectValue *qmlMetaObject = dynamic_cast(prototype)) { - if (qmlMetaObject->className() == QLatin1String("PropertyChanges") - && qmlMetaObject->packageName() == QLatin1String("Qt")) - break; - } - prototype = prototype->prototype(_context); - } + prototype = isPropertyChangesObject(_context, prototype); // find the target script binding if (prototype) { UiObjectInitializer *initializer = 0; @@ -169,3 +163,19 @@ const Value *ScopeBuilder::scopeObjectLookup(AST::UiQualifiedId *id) return result; } + + +const ObjectValue *ScopeBuilder::isPropertyChangesObject(Context *context, + const ObjectValue *object) +{ + const ObjectValue *prototype = object; + while (prototype) { + if (const QmlObjectValue *qmlMetaObject = dynamic_cast(prototype)) { + if (qmlMetaObject->className() == QLatin1String("PropertyChanges") + && qmlMetaObject->packageName() == QLatin1String("Qt")) + return prototype; + } + prototype = prototype->prototype(context); + } + return 0; +} diff --git a/src/libs/qmljs/qmljsscopebuilder.h b/src/libs/qmljs/qmljsscopebuilder.h index 34485039bf2..7141eee25c7 100644 --- a/src/libs/qmljs/qmljsscopebuilder.h +++ b/src/libs/qmljs/qmljsscopebuilder.h @@ -14,6 +14,7 @@ namespace AST { namespace Interpreter { class Context; class Value; + class ObjectValue; } class QMLJS_EXPORT ScopeBuilder @@ -26,6 +27,8 @@ public: void push(const QList &nodes); void pop(); + static const Interpreter::ObjectValue *isPropertyChangesObject(Interpreter::Context *context, const Interpreter::ObjectValue *object); + private: void setQmlScopeObject(AST::Node *node); const Interpreter::Value *scopeObjectLookup(AST::UiQualifiedId *id); diff --git a/src/plugins/coreplugin/core.qrc b/src/plugins/coreplugin/core.qrc index a38f9d148c4..20e9cfb9a85 100644 --- a/src/plugins/coreplugin/core.qrc +++ b/src/plugins/coreplugin/core.qrc @@ -59,5 +59,11 @@ images/darkclose.png images/arrowdown.png images/arrowup.png + images/category_fakevim.png + images/category_locator.png + images/category_cpaster.png + images/category_cpp.png + images/category_vcs.png + images/category_qml.png diff --git a/src/plugins/coreplugin/coreimpl.cpp b/src/plugins/coreplugin/coreimpl.cpp index 2c7be1e9cf5..c6da6362d44 100644 --- a/src/plugins/coreplugin/coreimpl.cpp +++ b/src/plugins/coreplugin/coreimpl.cpp @@ -56,7 +56,6 @@ ICore* ICore::instance() } CoreImpl::CoreImpl(MainWindow *mainwindow) - : m_preferredWizardKinds(IWizard::ProjectWizard) { m_instance = this; m_mainwindow = mainwindow; @@ -69,11 +68,6 @@ QStringList CoreImpl::showNewItemDialog(const QString &title, 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) { return m_mainwindow->showOptionsDialog(group, page, parent); diff --git a/src/plugins/coreplugin/coreimpl.h b/src/plugins/coreplugin/coreimpl.h index 749a7962e6f..d04defd3181 100644 --- a/src/plugins/coreplugin/coreimpl.h +++ b/src/plugins/coreplugin/coreimpl.h @@ -47,8 +47,6 @@ public: QStringList showNewItemDialog(const QString &title, const QList &wizards, const QString &defaultLocation = QString()); - void setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds); - IWizard::WizardKinds newItemDialogPreferredWizardKinds() { return m_preferredWizardKinds; } bool showOptionsDialog(const QString &group = QString(), const QString &page = QString(), QWidget *parent = 0); @@ -93,8 +91,6 @@ public: private: MainWindow *m_mainwindow; friend class MainWindow; - - IWizard::WizardKinds m_preferredWizardKinds; }; } // namespace Internal diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp index 823f306b3ef..b8bd4a5d852 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.cpp +++ b/src/plugins/coreplugin/dialogs/newdialog.cpp @@ -50,6 +50,8 @@ Q_DECLARE_METATYPE(Core::IWizard*) namespace { +const int ICON_SIZE = 22; + class TwoLevelProxyModel : public QAbstractProxyModel { // Q_OBJECT @@ -150,8 +152,7 @@ using namespace Core::Internal; NewDialog::NewDialog(QWidget *parent) : QDialog(parent), m_ui(new Core::Internal::Ui::NewDialog), - m_okButton(0), - m_preferredWizardKinds(0) + m_okButton(0) { typedef QMap CategoryItemMap; m_ui->setupUi(this); @@ -166,7 +167,7 @@ NewDialog::NewDialog(QWidget *parent) : m_ui->templateCategoryView->setEditTriggers(QAbstractItemView::NoEditTriggers); 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&)), this, SLOT(currentCategoryChanged(const QModelIndex&))); @@ -192,11 +193,6 @@ bool wizardLessThan(const IWizard *w1, const IWizard *w2) return w1->id().compare(w2->id()) < 0; } -void NewDialog::setPreferredWizardKinds(IWizard::WizardKinds kinds) -{ - m_preferredWizardKinds = kinds; -} - void NewDialog::setWizards(QList wizards) { typedef QMap CategoryItemMap; @@ -218,7 +214,7 @@ void NewDialog::setWizards(QList wizards) parentItem->appendRow(filesClassesKindItem); if (m_dummyIcon.isNull()) { - m_dummyIcon = QPixmap(22, 22); + m_dummyIcon = QPixmap(ICON_SIZE, ICON_SIZE); m_dummyIcon.fill(Qt::transparent); } @@ -241,9 +237,10 @@ void NewDialog::setWizards(QList wizards) break; } kindItem->appendRow(categoryItem); + m_categoryItems.append(categoryItem); categoryItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); categoryItem->setText(wizard->displayCategory()); - categoryItem->setData(QVariant::fromValue(0), Qt::UserRole); + categoryItem->setData(wizard->category(), Qt::UserRole); cit = categories.insert(categoryName, categoryItem); } // add item @@ -251,10 +248,11 @@ void NewDialog::setWizards(QList wizards) QIcon wizardIcon; // spacing hack. Add proper icons instead - if (wizard->icon().isNull()) + if (wizard->icon().isNull()) { wizardIcon = m_dummyIcon; - else + } else { wizardIcon = wizard->icon(); + } wizardItem->setIcon(wizardIcon); wizardItem->setData(QVariant::fromValue(wizard), Qt::UserRole); wizardItem->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable); @@ -274,8 +272,20 @@ void NewDialog::setWizards(QList wizards) Core::IWizard *NewDialog::showDialog() { - // Select first category, first item by default - m_ui->templateCategoryView->setCurrentIndex(m_proxyModel->index(0,0, m_proxyModel->index(0,0))); + static QString lastCategory; + 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 m_ui->templateCategoryView->setFocus(Qt::NoFocusReason); @@ -286,8 +296,15 @@ Core::IWizard *NewDialog::showDialog() currentItemChanged(m_ui->templatesView->rootIndex().child(0,0)); 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 currentWizard(); } diff --git a/src/plugins/coreplugin/dialogs/newdialog.h b/src/plugins/coreplugin/dialogs/newdialog.h index bcfe5a7d2fd..02d764bee4b 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.h +++ b/src/plugins/coreplugin/dialogs/newdialog.h @@ -34,6 +34,7 @@ #include #include +#include QT_BEGIN_NAMESPACE class QAbstractProxyModel; @@ -41,7 +42,6 @@ class QPushButton; class QStandardItem; class QStandardItemModel; class QStringList; -class QModelIndex; QT_END_NAMESPACE namespace Core { @@ -61,7 +61,6 @@ public: virtual ~NewDialog(); void setWizards(QList wizards); - void setPreferredWizardKinds(IWizard::WizardKinds kinds); Core::IWizard *showDialog(); @@ -77,8 +76,8 @@ private: QStandardItemModel *m_model; QAbstractProxyModel *m_proxyModel; QPushButton *m_okButton; - IWizard::WizardKinds m_preferredWizardKinds; QPixmap m_dummyIcon; + QList m_categoryItems; }; } // namespace Internal diff --git a/src/plugins/coreplugin/dialogs/newdialog.ui b/src/plugins/coreplugin/dialogs/newdialog.ui index 7be599269ac..90f105d906e 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.ui +++ b/src/plugins/coreplugin/dialogs/newdialog.ui @@ -38,9 +38,15 @@ + + + 0 + 0 + + - 200 + 225 16777215 @@ -77,6 +83,12 @@ 0 + + + 0 + 180 + + Qt::StrongFocus @@ -91,17 +103,11 @@ - + 0 0 - - - 16777215 - 140 - - Qt::NoFocus diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp index 0c14e43a319..e354928a7a4 100644 --- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp +++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp @@ -54,6 +54,7 @@ #include #include #include +#include static const char categoryKeyC[] = "General/LastPreferenceCategory"; static const char pageKeyC[] = "General/LastPreferencePage"; @@ -200,6 +201,19 @@ bool CategoryFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sou // ----------- 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 * minimum size. @@ -210,6 +224,7 @@ public: CategoryListView(QWidget *parent = 0) : QListView(parent) { setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); + setItemDelegate(new CategoryListViewDelegate(this)); } virtual QSize sizeHint() const diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index c1f85bc44cd..363d886b2ca 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -67,17 +67,6 @@ \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(), const QString &page = QString()) diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index ccc3b3b707c..cae3da1b4d9 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -74,7 +74,6 @@ public: virtual QStringList showNewItemDialog(const QString &title, const QList &wizards, const QString &defaultLocation = QString()) = 0; - virtual void setNewItemDialogPreferredWizardKinds(IWizard::WizardKinds kinds) = 0; virtual bool showOptionsDialog(const QString &group = QString(), const QString &page = QString(), diff --git a/src/plugins/coreplugin/images/category_core.png b/src/plugins/coreplugin/images/category_core.png index 89745b3bc7e..aaa94645355 100644 Binary files a/src/plugins/coreplugin/images/category_core.png and b/src/plugins/coreplugin/images/category_core.png differ diff --git a/src/plugins/coreplugin/images/category_cpaster.png b/src/plugins/coreplugin/images/category_cpaster.png new file mode 100644 index 00000000000..eef221c830a Binary files /dev/null and b/src/plugins/coreplugin/images/category_cpaster.png differ diff --git a/src/plugins/coreplugin/images/category_cpp.png b/src/plugins/coreplugin/images/category_cpp.png new file mode 100644 index 00000000000..2a3408dae37 Binary files /dev/null and b/src/plugins/coreplugin/images/category_cpp.png differ diff --git a/src/plugins/coreplugin/images/category_debug.png b/src/plugins/coreplugin/images/category_debug.png index f8c040c744c..5e74d867c0a 100644 Binary files a/src/plugins/coreplugin/images/category_debug.png and b/src/plugins/coreplugin/images/category_debug.png differ diff --git a/src/plugins/coreplugin/images/category_design.png b/src/plugins/coreplugin/images/category_design.png index fb9203565ea..5a4111a3457 100644 Binary files a/src/plugins/coreplugin/images/category_design.png and b/src/plugins/coreplugin/images/category_design.png differ diff --git a/src/plugins/coreplugin/images/category_fakevim.png b/src/plugins/coreplugin/images/category_fakevim.png new file mode 100644 index 00000000000..92b03a34596 Binary files /dev/null and b/src/plugins/coreplugin/images/category_fakevim.png differ diff --git a/src/plugins/coreplugin/images/category_help.png b/src/plugins/coreplugin/images/category_help.png index 5cc973c5311..7736b0a32d6 100644 Binary files a/src/plugins/coreplugin/images/category_help.png and b/src/plugins/coreplugin/images/category_help.png differ diff --git a/src/plugins/coreplugin/images/category_locator.png b/src/plugins/coreplugin/images/category_locator.png new file mode 100644 index 00000000000..98aa5049a63 Binary files /dev/null and b/src/plugins/coreplugin/images/category_locator.png differ diff --git a/src/plugins/coreplugin/images/category_project.png b/src/plugins/coreplugin/images/category_project.png index 18d157e971f..a29396b2f8c 100644 Binary files a/src/plugins/coreplugin/images/category_project.png and b/src/plugins/coreplugin/images/category_project.png differ diff --git a/src/plugins/coreplugin/images/category_qml.png b/src/plugins/coreplugin/images/category_qml.png new file mode 100644 index 00000000000..131a4b381e9 Binary files /dev/null and b/src/plugins/coreplugin/images/category_qml.png differ diff --git a/src/plugins/coreplugin/images/category_qt.png b/src/plugins/coreplugin/images/category_qt.png index 3731d351d4d..bbd4dc681e1 100644 Binary files a/src/plugins/coreplugin/images/category_qt.png and b/src/plugins/coreplugin/images/category_qt.png differ diff --git a/src/plugins/coreplugin/images/category_texteditor.png b/src/plugins/coreplugin/images/category_texteditor.png index c4798e04148..bdde584db48 100644 Binary files a/src/plugins/coreplugin/images/category_texteditor.png and b/src/plugins/coreplugin/images/category_texteditor.png differ diff --git a/src/plugins/coreplugin/images/category_vcs.png b/src/plugins/coreplugin/images/category_vcs.png new file mode 100644 index 00000000000..2b04fa747d0 Binary files /dev/null and b/src/plugins/coreplugin/images/category_vcs.png differ diff --git a/src/plugins/coreplugin/images/mode_Design.png b/src/plugins/coreplugin/images/mode_Design.png index 0bda5e5b87c..268376e5fe7 100644 Binary files a/src/plugins/coreplugin/images/mode_Design.png and b/src/plugins/coreplugin/images/mode_Design.png differ diff --git a/src/plugins/coreplugin/images/mode_Reference.png b/src/plugins/coreplugin/images/mode_Reference.png index 0bc7bf23b37..7247e639eb8 100644 Binary files a/src/plugins/coreplugin/images/mode_Reference.png and b/src/plugins/coreplugin/images/mode_Reference.png differ diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index c10f0da694e..201105098f5 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -775,8 +775,7 @@ void MainWindow::registerDefaultActions() void MainWindow::newFile() { - showNewItemDialog(tr("New", "Title of dialog"), IWizard::allWizards(), - QString(), m_coreImpl->newItemDialogPreferredWizardKinds()); + showNewItemDialog(tr("New", "Title of dialog"), IWizard::allWizards(), QString()); } void MainWindow::openFile() @@ -863,8 +862,7 @@ void MainWindow::setFocusToEditor() QStringList MainWindow::showNewItemDialog(const QString &title, const QList &wizards, - const QString &defaultLocation, - IWizard::WizardKinds preferredWizardKinds) + const QString &defaultLocation) { // Scan for wizards matching the filter and pick one. Don't show // dialog if there is only one. @@ -879,7 +877,6 @@ QStringList MainWindow::showNewItemDialog(const QString &title, NewDialog dlg(this); dlg.setWizards(wizards); dlg.setWindowTitle(title); - dlg.setPreferredWizardKinds(preferredWizardKinds); wizard = dlg.showDialog(); } break; diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 2aecdefc32f..60b911ba1d1 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -134,8 +134,7 @@ public slots: QStringList showNewItemDialog(const QString &title, const QList &wizards, - const QString &defaultLocation = QString(), - IWizard::WizardKinds preferredWizardKinds = 0); + const QString &defaultLocation = QString()); bool showOptionsDialog(const QString &category = QString(), const QString &page = QString(), diff --git a/src/plugins/coreplugin/outputpane.cpp b/src/plugins/coreplugin/outputpane.cpp index e3b48e00319..d677ba27cdb 100644 --- a/src/plugins/coreplugin/outputpane.cpp +++ b/src/plugins/coreplugin/outputpane.cpp @@ -186,7 +186,7 @@ void OutputPaneManager::updateStatusButtons(bool visible) int idx = m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt(); if (m_buttons.value(idx)) m_buttons.value(idx)->setChecked(visible); - m_minMaxButton->setVisible(OutputPanePlaceHolder::m_current + m_minMaxAction->setVisible(OutputPanePlaceHolder::m_current && OutputPanePlaceHolder::m_current->canMaximizeOrMinimize()); } @@ -224,9 +224,8 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) : connect(m_prevAction, SIGNAL(triggered()), this, SLOT(slotPrev())); m_minMaxAction = new QAction(this); - m_minMaxButton->setIcon(m_maximizeIcon); - m_minMaxButton->setToolTip(tr("Maximize Output Pane")); - m_minMaxAction->setText(m_minMaxButton->toolTip()); + m_minMaxAction->setIcon(m_maximizeIcon); + m_minMaxAction->setText(tr("Maximize Output Pane")); m_closeButton->setIcon(QIcon(":/core/images/closebutton.png")); connect(m_closeButton, SIGNAL(clicked()), this, SLOT(slotHide())); @@ -312,9 +311,10 @@ void OutputPaneManager::init() cmd->setDefaultKeySequence(QKeySequence("Alt+9")); #endif cmd->setAttribute(Command::CA_UpdateText); + cmd->setAttribute(Command::CA_UpdateIcon); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); 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); sep->setSeparator(true); @@ -418,10 +418,9 @@ void OutputPaneManager::slotMinMax() return; m_maximised = !m_maximised; OutputPanePlaceHolder::m_current->maximizeOrMinimize(m_maximised); - m_minMaxButton->setIcon(m_maximised ? m_minimizeIcon : m_maximizeIcon); - m_minMaxButton->setToolTip(m_maximised ? tr("Minimize Output Pane") + m_minMaxAction->setIcon(m_maximised ? m_minimizeIcon : m_maximizeIcon); + m_minMaxAction->setText(m_maximised ? tr("Minimize Output Pane") : tr("Maximize Output Pane")); - m_minMaxAction->setText(m_minMaxButton->toolTip()); } void OutputPaneManager::buttonTriggered() diff --git a/src/plugins/cpaster/codepastersettings.cpp b/src/plugins/cpaster/codepastersettings.cpp index 7c6b4d62df0..759a33b409e 100644 --- a/src/plugins/cpaster/codepastersettings.cpp +++ b/src/plugins/cpaster/codepastersettings.cpp @@ -79,7 +79,7 @@ QString CodePasterSettingsPage::displayCategory() const QIcon CodePasterSettingsPage::categoryIcon() const { - return QIcon(); // TODO: Add icon for code paster category + return QIcon(); } QWidget *CodePasterSettingsPage::createPage(QWidget *parent) diff --git a/src/plugins/cpaster/cpasterconstants.h b/src/plugins/cpaster/cpasterconstants.h index 31f84f263a2..a76905a1f48 100644 --- a/src/plugins/cpaster/cpasterconstants.h +++ b/src/plugins/cpaster/cpasterconstants.h @@ -36,6 +36,7 @@ namespace CodePaster { namespace Constants { const char * const CPASTER_SETTINGS_CATEGORY = "X.CPaster"; 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"; } } diff --git a/src/plugins/cpaster/settingspage.cpp b/src/plugins/cpaster/settingspage.cpp index 2d16327da61..3d59b7ac075 100644 --- a/src/plugins/cpaster/settingspage.cpp +++ b/src/plugins/cpaster/settingspage.cpp @@ -106,7 +106,7 @@ QString SettingsPage::displayCategory() const QIcon SettingsPage::categoryIcon() const { - return QIcon(); // TODO: Icon for CodePaster + return QIcon(QLatin1String(Constants::SETTINGS_CATEGORY_CPASTER_ICON)); } QWidget *SettingsPage::createPage(QWidget *parent) diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp index 2a10677cb31..b3833e016fe 100644 --- a/src/plugins/cpptools/cppfilesettingspage.cpp +++ b/src/plugins/cpptools/cppfilesettingspage.cpp @@ -321,7 +321,7 @@ QString CppFileSettingsPage::displayCategory() 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) diff --git a/src/plugins/cpptools/cpptoolsconstants.h b/src/plugins/cpptools/cpptoolsconstants.h index 514624c7bea..791915f31cd 100644 --- a/src/plugins/cpptools/cpptoolsconstants.h +++ b/src/plugins/cpptools/cpptoolsconstants.h @@ -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_CATEGORY = "I.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 CppTools diff --git a/src/plugins/cvs/checkoutwizard.cpp b/src/plugins/cvs/checkoutwizard.cpp index b7e81e711c1..2b1f213d83d 100644 --- a/src/plugins/cvs/checkoutwizard.cpp +++ b/src/plugins/cvs/checkoutwizard.cpp @@ -48,7 +48,7 @@ CheckoutWizard::CheckoutWizard(QObject *parent) : QIcon CheckoutWizard::icon() const { - return QIcon(); + return QIcon(QLatin1String(":/cvs/images/cvs.png")); } QString CheckoutWizard::description() const diff --git a/src/plugins/cvs/cvs.qrc b/src/plugins/cvs/cvs.qrc index 63180dfae75..7278fc2db87 100644 --- a/src/plugins/cvs/cvs.qrc +++ b/src/plugins/cvs/cvs.qrc @@ -1,5 +1,8 @@ - + CVS.mimetypes.xml + + images/cvs.png + diff --git a/src/plugins/cvs/images/cvs.png b/src/plugins/cvs/images/cvs.png new file mode 100644 index 00000000000..ea82090aa80 Binary files /dev/null and b/src/plugins/cvs/images/cvs.png differ diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 5d68848652e..eac4a6582b1 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -97,14 +97,15 @@ using namespace ProjectExplorer; namespace FakeVim { namespace Constants { -const char * const INSTALL_HANDLER = "TextEditor.FakeVimHandler"; -const char * const MINI_BUFFER = "TextEditor.FakeVimMiniBuffer"; -const char * const INSTALL_KEY = "Alt+V,Alt+V"; -const char * const SETTINGS_CATEGORY = "D.FakeVim"; -const char * const SETTINGS_ID = "A.General"; -const char * const SETTINGS_EX_CMDS_ID = "B.ExCommands"; -const char * const CMD_FILE_NEXT = "FakeVim.SwitchFileNext"; -const char * const CMD_FILE_PREV = "FakeVim.SwitchFilePrev"; +const char * const INSTALL_HANDLER = "TextEditor.FakeVimHandler"; +const char * const MINI_BUFFER = "TextEditor.FakeVimMiniBuffer"; +const char * const INSTALL_KEY = "Alt+V,Alt+V"; +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_EX_CMDS_ID = "B.ExCommands"; +const char * const CMD_FILE_NEXT = "FakeVim.SwitchFileNext"; +const char * const CMD_FILE_PREV = "FakeVim.SwitchFilePrev"; } // namespace Constants } // namespace FakeVim @@ -133,7 +134,7 @@ public: QString displayName() const { return tr("General"); } QString category() const { return QLatin1String(Constants::SETTINGS_CATEGORY); } 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); void apply() { m_group.apply(ICore::instance()->settings()); } diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.cpp b/src/plugins/genericprojectmanager/genericprojectwizard.cpp index 25eea3fb5a7..b7f184e3e41 100644 --- a/src/plugins/genericprojectmanager/genericprojectwizard.cpp +++ b/src/plugins/genericprojectmanager/genericprojectwizard.cpp @@ -38,6 +38,11 @@ #include +#include +#include +#include +#include + #include #include #include @@ -93,7 +98,14 @@ GenericProjectWizard::~GenericProjectWizard() Core::BaseFileWizardParameters GenericProjectWizard::parameters() { 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.setId(QLatin1String("Z.Makefile")); parameters.setDescription(tr("Imports existing projects that do not use qmake or CMake. " diff --git a/src/plugins/git/clonewizard.cpp b/src/plugins/git/clonewizard.cpp index e633da5cfc3..c59da9847ce 100644 --- a/src/plugins/git/clonewizard.cpp +++ b/src/plugins/git/clonewizard.cpp @@ -47,7 +47,7 @@ CloneWizard::CloneWizard(QObject *parent) : QIcon CloneWizard::icon() const { - return QIcon(); + return QIcon(QLatin1String(":/git/images/git.png")); } QString CloneWizard::description() const diff --git a/src/plugins/git/git.pro b/src/plugins/git/git.pro index 0ef64c74bb3..7ffe7d8999d 100644 --- a/src/plugins/git/git.pro +++ b/src/plugins/git/git.pro @@ -50,3 +50,6 @@ FORMS += changeselectiondialog.ui \ stashdialog.ui OTHER_FILES += ScmGit.pluginspec include(gitorious/gitorious.pri) + +RESOURCES += \ + git.qrc diff --git a/src/plugins/git/git.qrc b/src/plugins/git/git.qrc new file mode 100644 index 00000000000..ae2b2b64707 --- /dev/null +++ b/src/plugins/git/git.qrc @@ -0,0 +1,6 @@ + + + images/git.png + images/gitorious.png + + diff --git a/src/plugins/git/gitorious/gitoriousclonewizard.cpp b/src/plugins/git/gitorious/gitoriousclonewizard.cpp index 8c37d80e532..db55e0fb77b 100644 --- a/src/plugins/git/gitorious/gitoriousclonewizard.cpp +++ b/src/plugins/git/gitorious/gitoriousclonewizard.cpp @@ -75,7 +75,7 @@ GitoriousCloneWizard::GitoriousCloneWizard(QObject *parent) : QIcon GitoriousCloneWizard::icon() const { - return QIcon(); + return QIcon(QLatin1String(":/git/images/gitorious.png")); } QString GitoriousCloneWizard::description() const diff --git a/src/plugins/git/images/git.png b/src/plugins/git/images/git.png new file mode 100644 index 00000000000..8895fe0165d Binary files /dev/null and b/src/plugins/git/images/git.png differ diff --git a/src/plugins/git/images/gitorious.png b/src/plugins/git/images/gitorious.png new file mode 100644 index 00000000000..6f1f20848de Binary files /dev/null and b/src/plugins/git/images/gitorious.png differ diff --git a/src/plugins/locator/locatorconstants.h b/src/plugins/locator/locatorconstants.h index 74d40a146c5..ffc5d1e27f4 100644 --- a/src/plugins/locator/locatorconstants.h +++ b/src/plugins/locator/locatorconstants.h @@ -38,6 +38,7 @@ namespace Constants { const char * const FILTER_OPTIONS_PAGE = QT_TRANSLATE_NOOP("Locator", "Filters"); const char * const LOCATOR_CATEGORY = "G.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"; } // namespace Constants diff --git a/src/plugins/locator/settingspage.cpp b/src/plugins/locator/settingspage.cpp index 1f913c144bc..cc3e4383a0b 100644 --- a/src/plugins/locator/settingspage.cpp +++ b/src/plugins/locator/settingspage.cpp @@ -71,7 +71,7 @@ QString SettingsPage::displayCategory() 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) diff --git a/src/plugins/mercurial/images/hg.png b/src/plugins/mercurial/images/hg.png index 59a238c2226..1daa4b82225 100644 Binary files a/src/plugins/mercurial/images/hg.png and b/src/plugins/mercurial/images/hg.png differ diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index aa214c455f2..25d31abaa50 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -256,10 +256,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er this, SIGNAL(fileListChanged())); connect(d->m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project *)), 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*)), this, SLOT(updateActions())); @@ -1884,17 +1880,6 @@ void ProjectExplorerPlugin::openRecentProject() 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) { if (debug) diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index 8d277ca2845..4960dc90651 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -173,7 +173,6 @@ private slots: void updateRecentProjectMenu(); void openRecentProject(); void openTerminalHere(); - void updatePreferredWizardKinds(); void invalidateProject(ProjectExplorer::Project *project); diff --git a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp index 8b94cfcb333..4e0f19c4b56 100644 --- a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp @@ -135,8 +135,6 @@ void DragTool::beginWithPoint(const QPointF &beginPoint) void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlItemNode parentNode, QPointF scenePos) { - QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide(); - MetaInfo metaInfo = MetaInfo::global(); FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode); @@ -151,6 +149,8 @@ void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlIt nodeList.append(m_dragNode); view()->setSelectedQmlItemNodes(nodeList); m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList)); + + QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide(); } void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode parentNode, QPointF scenePos) @@ -158,8 +158,6 @@ void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode if (!parentNode.isValid()) return; - QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide(); - MetaInfo metaInfo = MetaInfo::global(); FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode); @@ -171,6 +169,8 @@ void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode nodeList.append(m_dragNode); view()->setSelectedQmlItemNodes(nodeList); m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList)); + + QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide(); } FormEditorItem* DragTool::calculateContainer(const QPointF &point, FormEditorItem * currentItem) @@ -256,11 +256,11 @@ void DragTool::dragMoveEvent(QGraphicsSceneDragDropEvent * event) QPointF scenePos = event->scenePos(); 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 end(event->scenePos()); - m_dragNode.destroy(); //delete the node then QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::show(); + m_dragNode.destroy(); //delete the node then return; } //move diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp index cba3a7a3097..1904c0bec20 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp @@ -413,7 +413,7 @@ void FormEditorView::nodeSlidedToIndex(const NodeListProperty &listProperty, int void FormEditorView::auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data) { QmlModelView::auxiliaryDataChanged(node, name, data); - if (name == "invisible") { + if (name == "invisible" && m_scene->hasItemForQmlItemNode(QmlItemNode(node))) { FormEditorItem *item(m_scene->itemForQmlItemNode(QmlItemNode(node))); bool isInvisible = data.toBool(); item->setVisible(!isInvisible); diff --git a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp index 3c693197693..5c38be2dcbd 100644 --- a/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp @@ -461,6 +461,7 @@ void DesignDocumentController::copySelected() { QScopedPointer model(Model::create("import Qt 4.7; Qt/Rectangle")); model->setMetaInfo(m_d->model->metaInfo()); + model->setFileUrl(m_d->model->fileUrl()); Q_ASSERT(model); @@ -573,6 +574,8 @@ void DesignDocumentController::paste() if (rootNode.id() == "designer__Selection") { QList selectedNodes = rootNode.allDirectSubModelNodes(); + qDebug() << rootNode; + qDebug() << selectedNodes; model->detachView(&view); m_d->model->attachView(&view); @@ -635,7 +638,9 @@ void DesignDocumentController::paste() QString defaultProperty(targetNode.metaInfo().defaultProperty()); scatterItem(pastedNode, targetNode); - targetNode.nodeListProperty(defaultProperty).reparentHere(pastedNode); + if (targetNode.nodeListProperty(defaultProperty).isValid()) { + targetNode.nodeListProperty(defaultProperty).reparentHere(pastedNode); + } view.setSelectedModelNodes(QList() << pastedNode); } diff --git a/src/plugins/qmldesigner/components/itemlibrary/customdraganddrop.h b/src/plugins/qmldesigner/components/itemlibrary/customdraganddrop.h index 3ab1b203762..263af4c1859 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/customdraganddrop.h +++ b/src/plugins/qmldesigner/components/itemlibrary/customdraganddrop.h @@ -85,7 +85,11 @@ public: static void hide() { instance()->m_isVisible = false; } static void show() - { instance()->m_isVisible = true; } + { + instance()->m_isVisible = true; + instance()->m_widget->show(); + instance()->m_widget->update(); + } static bool isVisible() { return instance()->m_isVisible; } diff --git a/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp b/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp new file mode 100644 index 00000000000..4a1e0d3fc3a --- /dev/null +++ b/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp @@ -0,0 +1,143 @@ +#include "declarativewidgetview.h" + +#include +#include +#include +#include +#include + +namespace QmlDesigner { + +class DeclarativeWidgetViewPrivate +{ +public: + DeclarativeWidgetViewPrivate(DeclarativeWidgetView *view) + : q(view), root(0), component(0) {} + ~DeclarativeWidgetViewPrivate() { delete root; } + void execute(); + + DeclarativeWidgetView *q; + + QPointer 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 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 errorList = d->component->errors(); + foreach (const QDeclarativeError &error, errorList) { + qWarning() << error; + } + emit statusChanged(status()); + return; + } + + setRootWidget(qobject_cast(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 diff --git a/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.h b/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.h new file mode 100644 index 00000000000..c36fe4a74d8 --- /dev/null +++ b/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.h @@ -0,0 +1,55 @@ +#ifndef DECLARATIVEWIDGETVIEW_H +#define DECLARATIVEWIDGETVIEW_H + +#include +#include + +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 diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp index 0586095a8a9..7c1f0518d5f 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp @@ -81,13 +81,13 @@ const int collapseButtonOffset = 114; namespace QmlDesigner { 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()) { Q_ASSERT(QFileInfo(":/images/button_normal.png").exists()); - m_view->setResizeMode(QDeclarativeView::SizeRootObjectToView); QDeclarativeContext *ctxt = m_view->rootContext(); + m_view->engine()->setOutputWarningsToStandardError(debug); m_dummyPropertyEditorValue->setValue("#000000"); ctxt->setContextProperty("dummyBackendValue", m_dummyPropertyEditorValue.data()); m_contextObject->setBackendValues(&m_backendValuesPropertyMap); diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h index f2487725652..a3e0bb65710 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h @@ -31,7 +31,7 @@ #define QmlPropertyView_h #include -#include +#include #include #include #include @@ -67,7 +67,7 @@ class PropertyEditor: public QmlModelView void initialSetup(const QString &typeName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor); void setValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value); - QDeclarativeView *m_view; + DeclarativeWidgetView *m_view; Internal::QmlAnchorBindingProxy m_backendAnchorBinding; DesignerPropertyMap m_backendValuesPropertyMap; QScopedPointer m_propertyEditorTransaction; diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri index 2419f7b09fb..841ebe481f5 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri @@ -18,7 +18,8 @@ SOURCES += propertyeditor.cpp \ originwidget.cpp \ siblingcombobox.cpp \ propertyeditortransaction.cpp \ - propertyeditorcontextobject.cpp + propertyeditorcontextobject.cpp \ + declarativewidgetview.cpp HEADERS += propertyeditor.h \ qmlanchorbindingproxy.h \ @@ -38,7 +39,8 @@ HEADERS += propertyeditor.h \ siblingcombobox.h \ propertyeditortransaction.h \ designerpropertymap.h \ - propertyeditorcontextobject.h + propertyeditorcontextobject.h \ + declarativewidgetview.h QT += declarative RESOURCES += propertyeditor.qrc FORMS += behaviordialog.ui diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp index 76407163bc8..71db61e47a2 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorcontextobject.cpp @@ -3,7 +3,7 @@ namespace QmlDesigner { 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) { } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp index 5287a7e8dd9..ef6360f8b4e 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp @@ -1,4 +1,5 @@ #include "propertyeditortransaction.h" +#include #include diff --git a/src/plugins/qmldesigner/designercore/instances/graphicsobjectnodeinstance.cpp b/src/plugins/qmldesigner/designercore/instances/graphicsobjectnodeinstance.cpp index 4fe80a1fcde..926d4465dde 100644 --- a/src/plugins/qmldesigner/designercore/instances/graphicsobjectnodeinstance.cpp +++ b/src/plugins/qmldesigner/designercore/instances/graphicsobjectnodeinstance.cpp @@ -31,6 +31,8 @@ #include "invalidnodeinstanceexception.h" #include +#include "private/qgraphicsitem_p.h" +#include #include "nodemetainfo.h" namespace QmlDesigner { @@ -153,13 +155,21 @@ bool GraphicsObjectNodeInstance::equalGraphicsItem(QGraphicsItem *item) const 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 { if (graphicsItem->isVisible()) { painter->save(); painter->setTransform(graphicsItem->itemTransform(graphicsItem->parentItem()), true); 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()) { paintRecursively(childItem, painter); } @@ -171,12 +181,16 @@ void GraphicsObjectNodeInstance::paint(QPainter *painter) const { painter->save(); Q_ASSERT(graphicsObject()); - if (hasContent()) - graphicsObject()->paint(painter, 0); + if (hasContent()) { + QStyleOptionGraphicsItem option; + initOption(graphicsObject(), &option, painter->transform()); + graphicsObject()->paint(painter, &option); + } foreach(QGraphicsItem *graphicsItem, graphicsObject()->childItems()) { QGraphicsObject *graphicsObject = qgraphicsitem_cast(graphicsItem); - if (graphicsObject && !nodeInstanceView()->hasInstanceForObject(graphicsObject)) + if (graphicsObject + && !nodeInstanceView()->hasInstanceForObject(graphicsObject)) paintRecursively(graphicsItem, painter); } diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index a7891745f67..dd46538e839 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -184,7 +184,15 @@ QObject *NodeMetaInfo::createInstance(QDeclarativeContext *context) const newContext->setParent(object); } else { // 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) QDeclarativeEngine::setContextForObject(object, context); } diff --git a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp index ae081e94d41..d11d5f93ab0 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp @@ -127,8 +127,8 @@ QmlItemNode QmlModelView::createQmlItemNodeFromImage(const QString &imageName, c newNode.setId(id); if (!currentState().isBaseState()) { - newNode.modelNode().variantProperty("visible") = false; - newNode.setVariantProperty("visible", true); + newNode.modelNode().variantProperty("opacity") = 0; + newNode.setVariantProperty("opacity", 1); } Q_ASSERT(newNode.isValid()); @@ -180,8 +180,8 @@ QmlItemNode QmlModelView::createQmlItemNode(const ItemLibraryEntry &itemLibraryE } if (!currentState().isBaseState()) { - newNode.modelNode().variantProperty("visible") = false; - newNode.setVariantProperty("visible", true); + newNode.modelNode().variantProperty("opacity") = 0; + newNode.setVariantProperty("opacity", 1); } Q_ASSERT(newNode.isValid()); diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index 947cce394e4..d3590ce0258 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -384,8 +384,6 @@ public: v.convert(QVariant::Double); } else if (property->asStringValue()) { // nothing to do - } else if (property->asEasingCurveNameValue()) { - // nothing to do } return v; } diff --git a/src/plugins/qmldesigner/fxplugin/fx.metainfo b/src/plugins/qmldesigner/fxplugin/fx.metainfo index a72bc012dcf..f994480be04 100644 --- a/src/plugins/qmldesigner/fxplugin/fx.metainfo +++ b/src/plugins/qmldesigner/fxplugin/fx.metainfo @@ -111,7 +111,7 @@ - + diff --git a/src/plugins/qmldesigner/qmldesignerconstants.h b/src/plugins/qmldesigner/qmldesignerconstants.h index d1880493bf2..d2e14a5bc3d 100644 --- a/src/plugins/qmldesigner/qmldesignerconstants.h +++ b/src/plugins/qmldesigner/qmldesignerconstants.h @@ -63,6 +63,8 @@ const char * const QML_ITEMSPACING_KEY = "ItemSpacing"; const char * const QML_SNAPMARGIN_KEY = "SnapMargin"; 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 { enum { debug = 0 }; } diff --git a/src/plugins/qmldesigner/settingspage.cpp b/src/plugins/qmldesigner/settingspage.cpp index adc8d772bef..c0275419dd6 100644 --- a/src/plugins/qmldesigner/settingspage.cpp +++ b/src/plugins/qmldesigner/settingspage.cpp @@ -95,7 +95,7 @@ QString SettingsPage::displayCategory() 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) diff --git a/src/plugins/qmljseditor/qmljscodecompletion.cpp b/src/plugins/qmljseditor/qmljscodecompletion.cpp index b9e7bbbfdc0..556d0a903c6 100644 --- a/src/plugins/qmljseditor/qmljscodecompletion.cpp +++ b/src/plugins/qmljseditor/qmljscodecompletion.cpp @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include @@ -595,6 +597,31 @@ static bool isLiteral(AST::Node *ast) return false; } +void CodeCompletion::addCompletions(const QHash &newCompletions, + const QIcon &icon) +{ + QHashIterator 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) { m_editor = editor; @@ -627,10 +654,11 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor) Interpreter::Engine interp; Interpreter::Context context(&interp); + Link link(&context, document, snapshot, m_modelManager->importPaths()); // Set up the current scope chain. - QList astPath = semanticInfo.astPath(editor->position()); - context.build(astPath, document, snapshot, m_modelManager->importPaths()); + ScopeBuilder scopeBuilder(document, &context); + scopeBuilder.push(semanticInfo.astPath(editor->position())); // Search for the operator that triggered the completion. QChar completionOperator; @@ -660,24 +688,12 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor) enumerateProperties.setGlobalCompletion(true); enumerateProperties.setEnumerateGeneratedSlots(true); - QHashIterator it(enumerateProperties(qmlScopeType)); - while (it.hasNext()) { - it.next(); + addCompletions(enumerateProperties(qmlScopeType), symbolIcon); + addCompletions(enumerateProperties(context.scopeChain().qmlTypes), symbolIcon); - TextEditor::CompletionItem item(this); - item.text = it.key(); - item.icon = 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); + if (ScopeBuilder::isPropertyChangesObject(&context, qmlScopeType) + && context.scopeChain().qmlScopeObjects.size() == 2) { + addCompletions(enumerateProperties(context.scopeChain().qmlScopeObjects.first()), symbolIcon); } } @@ -713,60 +729,33 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor) // It's a global completion. EnumerateProperties enumerateProperties(&context); enumerateProperties.setGlobalCompletion(true); - QHashIterator it(enumerateProperties()); - while (it.hasNext()) { - it.next(); - - TextEditor::CompletionItem item(this); - item.text = it.key(); - item.icon = symbolIcon; - m_completions.append(item); - } + addCompletions(enumerateProperties(), symbolIcon); } if (doJsKeywordCompletion) { // add js keywords - foreach (const QString &word, Scanner::keywords()) { - TextEditor::CompletionItem item(this); - item.text = word; - item.icon = keywordIcon; - m_completions.append(item); - } + addCompletions(Scanner::keywords(), keywordIcon); } // add qml extra words if (doQmlKeywordCompletion && isQmlFile) { static QStringList qmlWords; + static QStringList qmlWordsAlsoInJs; if (qmlWords.isEmpty()) { qmlWords << QLatin1String("property") - << QLatin1String("readonly") + //<< QLatin1String("readonly") << QLatin1String("signal") << QLatin1String("import"); } - - foreach (const QString &word, qmlWords) { - TextEditor::CompletionItem item(this); - item.text = word; - item.icon = keywordIcon; - m_completions.append(item); + if (qmlWordsAlsoInJs.isEmpty()) { + qmlWordsAlsoInJs << QLatin1String("default") + << QLatin1String("function"); } - if (!doJsKeywordCompletion) { - { - TextEditor::CompletionItem item(this); - 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); - } - } + addCompletions(qmlWords, keywordIcon); + if (!doJsKeywordCompletion) + addCompletions(qmlWordsAlsoInJs, keywordIcon); } } @@ -787,15 +776,7 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor) if (value && completionOperator == QLatin1Char('.')) { // member completion EnumerateProperties enumerateProperties(&context); - QHashIterator it(enumerateProperties(value)); - while (it.hasNext()) { - it.next(); - - TextEditor::CompletionItem item(this); - item.text = it.key(); - item.icon = symbolIcon; - m_completions.append(item); - } + addCompletions(enumerateProperties(value), symbolIcon); } else if (value && completionOperator == QLatin1Char('(') && m_startPosition == editor->position()) { // function completion if (const Interpreter::FunctionValue *f = value->asFunctionValue()) { diff --git a/src/plugins/qmljseditor/qmljscodecompletion.h b/src/plugins/qmljseditor/qmljscodecompletion.h index 7129bce9007..6046f6f7d98 100644 --- a/src/plugins/qmljseditor/qmljscodecompletion.h +++ b/src/plugins/qmljseditor/qmljscodecompletion.h @@ -39,6 +39,12 @@ namespace TextEditor { class ITextEditable; } +namespace QmlJS { + namespace Interpreter { + class Value; + } +} + namespace QmlJSEditor { class ModelManagerInterface; @@ -74,6 +80,11 @@ private: bool maybeTriggersCompletion(TextEditor::ITextEditable *editor); bool isDelimiter(const QChar &ch) const; + void addCompletions(const QHash &newCompletions, + const QIcon &icon); + void addCompletions(const QStringList &newCompletions, + const QIcon &icon); + ModelManagerInterface *m_modelManager; TextEditor::ITextEditable *m_editor; int m_startPosition; diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 2114e03dc03..b0c000cbcf1 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include #include #include @@ -1007,8 +1009,9 @@ TextEditor::BaseTextEditor::Link QmlJSTextEditor::findLinkAt(const QTextCursor & Interpreter::Engine interp; Interpreter::Context context(&interp); - context.build(semanticInfo.astPath(cursorPosition), semanticInfo.document, - semanticInfo.snapshot, m_modelManager->importPaths()); + QmlJS::Link linkedSnapshot(&context, semanticInfo.document, semanticInfo.snapshot, m_modelManager->importPaths()); + ScopeBuilder scopeBuilder(semanticInfo.document, &context); + scopeBuilder.push(semanticInfo.astPath(cursorPosition)); Evaluate check(&context); 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))) return Link(); - Link link; + BaseTextEditor::Link link; link.fileName = fileName; link.line = line; link.column = column - 1; // adjust the column diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index 682ec98717e..38cc47cae56 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.cpp +++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include #include #include @@ -172,7 +174,9 @@ void HoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int p Interpreter::Engine 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); const Interpreter::Value *value = check(node); diff --git a/src/plugins/qmlprojectmanager/images/qml_wizard.png b/src/plugins/qmlprojectmanager/images/qml_wizard.png new file mode 100644 index 00000000000..5355c80bf85 Binary files /dev/null and b/src/plugins/qmlprojectmanager/images/qml_wizard.png differ diff --git a/src/plugins/qmlprojectmanager/qmlproject.qrc b/src/plugins/qmlprojectmanager/qmlproject.qrc index 82f0873a092..21338b6a545 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.qrc +++ b/src/plugins/qmlprojectmanager/qmlproject.qrc @@ -3,5 +3,6 @@ QmlProject.mimetypes.xml images/qmlfolder.png images/qmlproject.png + images/qml_wizard.png diff --git a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp index 30215eb12d0..4edc8857c27 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp @@ -35,6 +35,9 @@ #include +#include +#include + #include #include @@ -58,7 +61,14 @@ QmlProjectApplicationWizard::~QmlProjectApplicationWizard() Core::BaseFileWizardParameters QmlProjectApplicationWizard::parameters() { 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.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" diff --git a/src/plugins/qmlprojectmanager/qmlprojectconstants.h b/src/plugins/qmlprojectmanager/qmlprojectconstants.h index a92e15aa04b..1fd04264a0f 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectconstants.h +++ b/src/plugins/qmlprojectmanager/qmlprojectconstants.h @@ -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_TR_SCOPE = "QmlProjectManager"; 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 const char * const E_QML_DEBUG_SERVER_PORT = "QML_DEBUG_SERVER_PORT"; diff --git a/src/plugins/qmlprojectmanager/qmlprojectimportwizard.cpp b/src/plugins/qmlprojectmanager/qmlprojectimportwizard.cpp index b7165143d00..a8d1349ac7b 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectimportwizard.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectimportwizard.cpp @@ -40,6 +40,11 @@ #include +#include +#include +#include +#include + #include #include #include @@ -100,7 +105,14 @@ QmlProjectImportWizard::~QmlProjectImportWizard() Core::BaseFileWizardParameters QmlProjectImportWizard::parameters() { 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.setId(QLatin1String("QI.QML Import")); parameters.setDescription(tr("Creates a QML project from an existing directory of QML files.")); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp index 61ca0edc213..ee133b823cf 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp @@ -226,16 +226,24 @@ bool MaemoPackageCreationStep::runCommand(QProcess &proc, const QString &command perl = maddeRoot() + QLatin1String("/bin/perl.exe "); #endif proc.start(perl + maddeRoot() % QLatin1String("/madbin/") % command); + if (!proc.waitForStarted()) { + raiseError(tr("Packaging failed."), + tr("Packaging error: Could not start command '%1'. Reason: %2") + .arg(command).arg(proc.errorString())); + return false; + } proc.write("\n"); // For dh_make - if (!proc.waitForFinished(100000) && proc.error() == QProcess::Timedout) { + if (!proc.waitForFinished(60000) && proc.error() == QProcess::Timedout) { raiseError(tr("Packaging failed."), tr("Packaging Error: Command '%1' timed out.").arg(command)); return false; } - if (proc.exitCode() != 0) { - const QString mainMessage = tr("Packaging Error: Command '%1' failed.") - .arg(command); - raiseError(mainMessage, mainMessage + QLatin1Char(' ') + if (proc.error() != QProcess::UnknownError || proc.exitCode() != 0) { + QString mainMessage = tr("Packaging Error: Command '%1' failed.") + .arg(command); + if (proc.error() != QProcess::UnknownError) + mainMessage += tr(" Reason: %1").arg(proc.errorString()); + raiseError(mainMessage, mainMessage + QLatin1Char('\n') + tr("Output was: ") + proc.readAllStandardError() + QLatin1Char('\n') + proc.readAllStandardOutput()); return false; diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 507824fc173..5e76e570814 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -588,9 +588,23 @@ bool Qt4PriFileNode::removeSubProjects(const QStringList &proFilePaths) bool Qt4PriFileNode::addFiles(const FileType fileType, const QStringList &filePaths, QStringList *notAdded) { - QStringList failedFiles; + // If a file is already referenced in the .pro file then we don't add them. + // That ignores scopes and which variable was used to reference the file + // So it's obviously a bit limited, but in those cases you need to edit the + // project files manually anyway. - changeFiles(fileType, filePaths, &failedFiles, AddToProFile); + ProjectExplorer::FindAllFilesVisitor visitor; + accept(&visitor); + const QStringList &allFiles = visitor.filePaths(); + + QStringList uniqueFilePaths; + foreach (const QString &file, filePaths) { + if(!allFiles.contains(file)) + uniqueFilePaths.append(file); + } + + QStringList failedFiles; + changeFiles(fileType, uniqueFilePaths, &failedFiles, AddToProFile); if (notAdded) *notAdded = failedFiles; return failedFiles.isEmpty(); @@ -699,6 +713,23 @@ void Qt4PriFileNode::changeFiles(const FileType fileType, if (!saveModifiedEditors()) return; + // Ensure that the file is not read only + QFileInfo fi(m_projectFilePath); + if (!fi.isWritable()) { + // Try via vcs manager + Core::VCSManager *vcsManager = Core::ICore::instance()->vcsManager(); + Core::IVersionControl *versionControl = vcsManager->findVersionControlForDirectory(fi.absolutePath()); + if (!versionControl || versionControl->vcsOpen(m_projectFilePath)) { + bool makeWritable = QFile::setPermissions(m_projectFilePath, fi.permissions() | QFile::WriteUser); + if (!makeWritable) { + QMessageBox::warning(Core::ICore::instance()->mainWindow(), + tr("Failed!"), + tr("Could not write project file %1.").arg(m_projectFilePath)); + return; + } + } + } + QStringList lines; ProFile *includeFile; { @@ -727,7 +758,9 @@ void Qt4PriFileNode::changeFiles(const FileType fileType, QDir priFileDir = QDir(m_qt4ProFileNode->m_projectDir); if (change == AddToProFile) { - ProWriter::addFiles(includeFile, &lines, priFileDir, filePaths, vars); + // Use the first variable for adding. + // Yes, that's broken for adding objective c sources or other stuff. + ProWriter::addFiles(includeFile, &lines, priFileDir, filePaths, vars.first()); notChanged->clear(); } else { // RemoveFromProFile *notChanged = ProWriter::removeFiles(includeFile, &lines, priFileDir, filePaths, vars); @@ -736,11 +769,11 @@ void Qt4PriFileNode::changeFiles(const FileType fileType, // save file save(lines); - // This is a hack - // We are savign twice in a very short timeframe, once the editor and once the ProFile - // So the modification time might not change between those two saves - // We manually tell each editor to reload it's file - // (The .pro files are notified by the file system watcher) + // This is a hack. + // We are saving twice in a very short timeframe, once the editor and once the ProFile. + // So the modification time might not change between those two saves. + // We manually tell each editor to reload it's file. + // (The .pro files are notified by the file system watcher.) foreach (Core::IEditor *editor, Core::ICore::instance()->editorManager()->editorsForFileName(m_projectFilePath)) { if (Core::IFile *editorFile = editor->file()) { editorFile->reload(Core::IFile::FlagReload, Core::IFile::TypeContents); diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp index e4eb88e1dc4..e08651e769c 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp @@ -199,12 +199,11 @@ void Qt4ProjectConfigWidget::init(ProjectExplorer::BuildConfiguration *bc) bool shadowBuild = m_buildConfiguration->shadowBuild(); m_ui->shadowBuildCheckBox->setChecked(shadowBuild); - m_ui->shadowBuildDirEdit->setEnabled(shadowBuild); - m_browseButton->setEnabled(shadowBuild); - m_ui->shadowBuildDirEdit->setPath(m_buildConfiguration->shadowBuildDirectory()); - m_ui->shadowBuildCheckBox->setEnabled(m_buildConfiguration->qtVersion()->supportsShadowBuilds()); - m_ui->shadowBuildDirEdit->setEnabled(m_buildConfiguration->qtVersion()->supportsShadowBuilds()); + + m_ui->shadowBuildDirEdit->setPath(m_buildConfiguration->shadowBuildDirectory()); + m_ui->shadowBuildDirEdit->setEnabled(shadowBuild && m_buildConfiguration->qtVersion()->supportsShadowBuilds()); + m_browseButton->setEnabled(shadowBuild && m_buildConfiguration->qtVersion()->supportsShadowBuilds()); updateImportLabel(); updateToolChainCombo(); diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index 4bb885f5802..62587205d94 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -1377,15 +1377,10 @@ void QtVersion::updateToolChainAndMkspec() const m_toolChains << ToolChainPtr( ProjectExplorer::ToolChain::createMinGWToolChain(qmakeCXX, mingwDirectory())); m_targetIds.insert(QLatin1String(Constants::DESKTOP_TARGET_ID)); - } else if (qmakeCXX.endsWith("g++")) { // All g++ variants are treated as desktop g++ + } else if (qmakeCXX.contains("g++")) { // All g++ variants are treated as desktop g++ // we should try to do a better job, but for now that's good enough ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); //addToEnvironment(env); - if (qmakeCXX.isEmpty()) { - // macx-xcode mkspec resets the value of QMAKE_CXX. - // Unfortunately, we need a valid QMAKE_CXX to configure the parser. - qmakeCXX = QLatin1String("cc"); - } qmakeCXX = env.searchInPath(qmakeCXX); m_toolChains << ToolChainPtr(ProjectExplorer::ToolChain::createGccToolChain(qmakeCXX)); m_targetIds.insert(QLatin1String(Constants::DESKTOP_TARGET_ID)); diff --git a/src/plugins/subversion/checkoutwizard.cpp b/src/plugins/subversion/checkoutwizard.cpp index 1175408a93b..261382f8f48 100644 --- a/src/plugins/subversion/checkoutwizard.cpp +++ b/src/plugins/subversion/checkoutwizard.cpp @@ -48,7 +48,7 @@ CheckoutWizard::CheckoutWizard(QObject *parent) : QIcon CheckoutWizard::icon() const { - return QIcon(); + return QIcon(QLatin1String(":/subversion/images/subversion.png")); } QString CheckoutWizard::description() const diff --git a/src/plugins/subversion/images/subversion.png b/src/plugins/subversion/images/subversion.png new file mode 100644 index 00000000000..17308b5ebb1 Binary files /dev/null and b/src/plugins/subversion/images/subversion.png differ diff --git a/src/plugins/subversion/subversion.qrc b/src/plugins/subversion/subversion.qrc index 51c899c701a..ca81748ffb0 100644 --- a/src/plugins/subversion/subversion.qrc +++ b/src/plugins/subversion/subversion.qrc @@ -1,5 +1,8 @@ - + + images/subversion.png + + Subversion.mimetypes.xml diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 046bafef277..6b049a9a3b7 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -2384,11 +2384,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e) TextEditorOverlay *overlay = new TextEditorOverlay(this); overlay->addOverlaySelection(d->m_findScopeStart.position(), - d->m_findScopeVerticalBlockSelection ? - d->m_findScopeEnd.block().position() - + d->m_findScopeVerticalBlockSelection - + d->m_findScopeStart.positionInBlock() + 1 - : d->m_findScopeEnd.position(), + d->m_findScopeEnd.position(), d->m_searchScopeFormat.background().color().darker(120), d->m_searchScopeFormat.background().color(), TextEditorOverlay::ExpandBegin, @@ -2493,8 +2489,8 @@ void BaseTextEditor::paintEvent(QPaintEvent *e) const QAbstractTextDocumentLayout::Selection &range = context.selections.at(i); const int selStart = range.cursor.selectionStart() - blpos; const int selEnd = range.cursor.selectionEnd() - blpos; - if (selStart < bllen && selEnd > 0 - && selEnd > selStart) { + if (selStart <= bllen && selEnd >= 0 + && selEnd >= selStart) { QTextLayout::FormatRange o; o.start = selStart; o.length = selEnd - selStart; diff --git a/src/plugins/texteditor/completionwidget.cpp b/src/plugins/texteditor/completionwidget.cpp index 5575d9ad45d..031ddbe39c6 100644 --- a/src/plugins/texteditor/completionwidget.cpp +++ b/src/plugins/texteditor/completionwidget.cpp @@ -153,6 +153,7 @@ CompletionWidget::CompletionWidget(CompletionSupport *support, ITextEditable *ed setObjectName(QLatin1String("m_popupFrame")); setAttribute(Qt::WA_DeleteOnClose); setMinimumSize(1, 1); + setFont(editor->widget()->font()); QVBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(0); diff --git a/src/plugins/vcsbase/vcsbaseconstants.h b/src/plugins/vcsbase/vcsbaseconstants.h index c9d27f50ee2..50bf63d6fc1 100644 --- a/src/plugins/vcsbase/vcsbaseconstants.h +++ b/src/plugins/vcsbase/vcsbaseconstants.h @@ -37,6 +37,7 @@ namespace Constants { const char * const VCS_SETTINGS_CATEGORY = "V.Version Control"; const char * const VCS_SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("VCSBase", "Version Control"); +const char * const SETTINGS_CATEGORY_VCS_ICON = ":/core/images/category_vcs.png"; const char * const VCS_COMMON_SETTINGS_ID = "A.Common"; const char * const VCS_COMMON_SETTINGS_NAME = QT_TRANSLATE_NOOP("VCSBase", "Common"); diff --git a/src/plugins/vcsbase/vcsbaseoptionspage.cpp b/src/plugins/vcsbase/vcsbaseoptionspage.cpp index d5a025b7226..2964a34f5a0 100644 --- a/src/plugins/vcsbase/vcsbaseoptionspage.cpp +++ b/src/plugins/vcsbase/vcsbaseoptionspage.cpp @@ -52,7 +52,7 @@ QString VCSBaseOptionsPage::displayCategory() const QIcon VCSBaseOptionsPage::categoryIcon() const { - return QIcon(); // TODO: Icon for Version Control + return QIcon(QLatin1String(Constants::SETTINGS_CATEGORY_VCS_ICON)); } } // namespace VCSBase diff --git a/src/shared/proparser/prowriter.cpp b/src/shared/proparser/prowriter.cpp index 56f249ad7ed..5c480942c1e 100644 --- a/src/shared/proparser/prowriter.cpp +++ b/src/shared/proparser/prowriter.cpp @@ -37,13 +37,13 @@ using namespace Qt4ProjectManager::Internal; void ProWriter::addFiles(ProFile *profile, QStringList *lines, const QDir &proFileDir, const QStringList &filePaths, - const QStringList &vars) + const QString &var) { // Check if variable item exists as child of root item for (ProItem *item = profile->items(); item; item = item->next()) { if (item->kind() == ProItem::VariableKind) { ProVariable *proVar = static_cast(item); - if (vars.contains(proVar->variable()) + if (var == proVar->variable() && proVar->variableOperator() != ProVariable::RemoveOperator && proVar->variableOperator() != ProVariable::ReplaceOperator) { @@ -78,7 +78,7 @@ void ProWriter::addFiles(ProFile *profile, QStringList *lines, } // Create & append new variable item - QString added = QLatin1Char('\n') + vars.first() + QLatin1String(" +="); + QString added = QLatin1Char('\n') + var + QLatin1String(" +="); foreach (const QString &filePath, filePaths) added += QLatin1String(" \\\n ") + proFileDir.relativeFilePath(filePath); *lines << added; diff --git a/src/shared/proparser/prowriter.h b/src/shared/proparser/prowriter.h index 26bf4449e3e..f4822657b76 100644 --- a/src/shared/proparser/prowriter.h +++ b/src/shared/proparser/prowriter.h @@ -47,7 +47,7 @@ class ProWriter public: static void addFiles(ProFile *profile, QStringList *lines, const QDir &proFileDir, const QStringList &filePaths, - const QStringList &vars); + const QString &var); static QStringList removeFiles(ProFile *profile, QStringList *lines, const QDir &proFileDir, const QStringList &filePaths, const QStringList &vars); diff --git a/src/tools/qml/qmldump/main.cpp b/src/tools/qml/qmldump/main.cpp index cabb5503716..6a8f8a43a25 100644 --- a/src/tools/qml/qmldump/main.cpp +++ b/src/tools/qml/qmldump/main.cpp @@ -268,6 +268,8 @@ int main(int argc, char *argv[]) } cppToQml.insert("QString", "string"); + cppToQml.insert("QEasingCurve", "Qt.Easing"); + cppToQml.insert("QDeclarativeEasingValueType::Type", "Type"); QSet metas; diff --git a/tests/auto/qml/qmldesigner/coretests/testcore.cpp b/tests/auto/qml/qmldesigner/coretests/testcore.cpp index 3bf3a68cd10..ed41208ff20 100644 --- a/tests/auto/qml/qmldesigner/coretests/testcore.cpp +++ b/tests/auto/qml/qmldesigner/coretests/testcore.cpp @@ -699,6 +699,88 @@ void TestCore::testRewriterPreserveOrder() } } +void TestCore::testRewriterForGradientMagic() +{ + const QLatin1String qmlString("\n" + "import Qt 4.7\n" + "\n" + "Rectangle {\n" + " id: root\n" + " x: 10;\n" + " y: 10;\n" + " Rectangle {\n" + " id: rectangle1\n" + " x: 10;\n" + " y: 10;\n" + " }\n" + " Rectangle {\n" + " id: rectangle2\n" + " x: 100;\n" + " y: 100;\n" + " anchors.fill: root\n" + " }\n" + " Rectangle {\n" + " id: rectangle3\n" + " x: 140;\n" + " y: 180;\n" + " gradient: Gradient {\n" + " GradientStop {\n" + " position: 0\n" + " color: \"white\"\n" + " }\n" + " GradientStop {\n" + " position: 1\n" + " color: \"black\"\n" + " }\n" + " }\n" + " }\n" + "}"); + + QPlainTextEdit textEdit; + textEdit.setPlainText(qmlString); + NotIndentingTextEditModifier modifier(&textEdit); + + QScopedPointer model(Model::create("Qt/Text")); + + QScopedPointer testRewriterView(new TestRewriterView()); + testRewriterView->setTextModifier(&modifier); + model->attachView(testRewriterView.data()); + + QVERIFY(testRewriterView->errors().isEmpty()); + + ModelNode rootModelNode = testRewriterView->rootModelNode(); + QVERIFY(rootModelNode.isValid()); + + ModelNode myRect = testRewriterView->modelNodeForId(QLatin1String("rectangle3")); + QVERIFY(myRect.isValid()); + myRect.variantProperty("rotation") = QVariant(45); + QVERIFY(myRect.isValid()); + + QScopedPointer model1(Model::create("Qt/Item", 4, 7)); + QVERIFY(model1.data()); + + QScopedPointer view1(new TestView); + model1->attachView(view1.data()); + + QScopedPointer testRewriterView1(new TestRewriterView()); + QPlainTextEdit textEdit1; + textEdit1.setPlainText("import Qt 4.7; Item {}"); + NotIndentingTextEditModifier modifier1(&textEdit1); + + testRewriterView1->setTextModifier(&modifier1); + model1->attachView(testRewriterView1.data()); + + QVERIFY(testRewriterView1->errors().isEmpty()); + + RewriterTransaction transaction(view1->beginRewriterTransaction()); + + ModelMerger merger(view1.data()); + + QVERIFY(myRect.isValid()); + merger.replaceModel(myRect); + transaction.commit(); +} + void TestCore::loadSubItems() { QFile file(QString(QTCREATORDIR) + "/tests/auto/qml/qmldesigner/data/fx/topitem.qml"); diff --git a/tests/auto/qml/qmldesigner/coretests/testcore.h b/tests/auto/qml/qmldesigner/coretests/testcore.h index fbd683f88bd..5ff29f3333e 100644 --- a/tests/auto/qml/qmldesigner/coretests/testcore.h +++ b/tests/auto/qml/qmldesigner/coretests/testcore.h @@ -45,6 +45,20 @@ private slots: void initTestCase(); void cleanupTestCase(); + // + // unit tests MetaInfo, NodeMetaInfo, PropertyMetaInfo + // + void testMetaInfo(); + void testMetaInfoSimpleType(); + void testMetaInfoUncreatableType(); + void testMetaInfoExtendedType(); + void testMetaInfoInterface(); + void testMetaInfoCustomType(); + void testMetaInfoEnums(); + void testMetaInfoProperties(); + void testMetaInfoDotProperties(); + void testMetaInfoListProperties(); + // // unit tests Model, ModelNode, NodeProperty, AbstractView // @@ -67,20 +81,6 @@ private slots: void testModelNodeInHierarchy(); void testModelNodeIsAncestorOf(); - // - // unit tests MetaInfo, NodeMetaInfo, PropertyMetaInfo - // - void testMetaInfo(); - void testMetaInfoSimpleType(); - void testMetaInfoUncreatableType(); - void testMetaInfoExtendedType(); - void testMetaInfoInterface(); - void testMetaInfoCustomType(); - void testMetaInfoEnums(); - void testMetaInfoProperties(); - void testMetaInfoDotProperties(); - void testMetaInfoListProperties(); - // // unit tests Rewriter // @@ -169,6 +169,7 @@ private slots: // void reparentingNodeLikeDragAndDrop(); + void testRewriterForGradientMagic(); // // old tests