Commit Graph

92 Commits

Author SHA1 Message Date
Lorenz Haas
276e2bccaa CppEditor: Hide "Assign to Local Variable" if signatures don't match
Task-number: QTCREATORBUG-9321

Change-Id: I31ac75a480b30ef26f343557088c4bbe5e95c4c6
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-05-24 10:22:21 +02:00
Robert Loehning
1f62d7c90d Normalized connect()s
Change-Id: I82e891a73724cdfa0db8c84e9daeb72e00e87029
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-05-16 13:55:14 +02:00
Lorenz Haas
d25c5f35ca CppEditor: InsertDefFromDecl: Hide when definition already exists
"Add Definition Inside/Outside Class" was wrongly shown when there was
already an definition outside the class.

Change-Id: I6409080c6a1a3abdd4511f7db14ecb4f63458411
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-05-15 13:39:32 +02:00
Oswald Buddenhagen
6fb94a7b10 Merge branch '2.7'
Conflicts:
	doc/src/qtquick/qtquick-components.qdoc
	doc/src/qtquick/qtquick-designer.qdoc
	qtcreator.pri
	qtcreator.qbs
	src/plugins/cppeditor/cppinsertdecldef.cpp
	src/plugins/qnx/qnxruncontrolfactory.cpp

Change-Id: I0a37a07c42719bc0d9ef5b3ac4641d01a63c0d88
2013-05-15 10:21:47 +02:00
Leena Miettinen
c32fe654fa UI text: fix capitalization of refactoring action
Words longer than 5 characters are always capitalized when
book-style caps are used.

Change-Id: I61d34aab74eb2fa3028681ef36b553347a0c34b1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-05-14 13:02:27 +02:00
Lorenz Haas
d288e3999b CppEditor: Quick fix "Insert (Pure) Virtual Methods"
This quick fix inserts (pure) virtual functions of base classes to the
current class. For selecting the functions which should be inserted and
for choosing the insertion mode (only declarations or with definitions
inside, outside or in the implementation file) a dialog is shown.

Task-number: QTCREATORBUG-2210
Task-number: QTCREATORBUG-2692
Task-number: QTCREATORBUG-3908
Task-number: QTCREATORBUG-5868
Task-number: QTCREATORBUG-7982
Change-Id: I8e94905afcae4778986f4c3925a494e0c6b3b8ee
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-05-14 09:14:25 +02:00
Lorenz Haas
7ef611047f CppEditor: Improve insert position for AddIncludeForUndefinedIdentifier
Includes of moc files are not considered while determining the new
include's position. Further the new include is inserted at its
"alphabeticaly sorted" position.

Task-number: QTCREATORBUG-8871
Change-Id: I67b40a6f538112753298b960da488e24f4643808
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-05-14 08:51:30 +02:00
Lorenz Haas
15f90404aa CppEditor: InsertDefFromDecl: choose insert position
Now one can decide where the new definition should go: Inside the class,
outside the class or to the implementation file. Further the text cursor
is positioned inside the new created definition body.

Task-number: QTCREATORBUG-6973
Change-Id: I593955dd1e44e35240fa1e9b9a5c1a67eb119456
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-05-10 11:33:05 +02:00
Erik Verbruggen
8e18adc70f C++: Fix crash in code completion.
Caused by a dangling pointer of a template instantiation which had been
cloned into the wrong control. The fix is to remove that control and
refer to the control of the bindings (which is the correct one).

Change-Id: I951a60f2e613aae1e4ac901ce99c820212018709
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-05-03 10:56:26 +02:00
Sergey Shambir
7047cf0140 CppEditor: simplified Objective-C status check
Change-Id: Id318fc34b19295dacef63a7192a0ff11fef3e274
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-05-02 15:21:16 +02:00
Lorenz Haas
7ae31f2ea9 CppEditor: Add quick fix for "Assign to Local Variable"
Adds a local variable which stores the return value of a function call
or new expression.

Task-number: QTCREATORBUG-9052
Change-Id: I1fccbdd5b9f28c8409a4b0fa24610e406de61b24
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-29 08:49:31 +02:00
Friedemann Kleint
2e2f334349 Fix tr-context in quickfix.
Change-Id: Idf741c0eb77dad6f2893f4dff45a8455d3ce9289
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-24 11:49:40 +02:00
Lorenz Haas
39d000430e CppEditor: Quick fix "move definition" keeps ctor-initialization list
Task-number: QTCREATORBUG-9157

Change-Id: Ic46086ba07a86292bbf48de62b69e3f33628fd86
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-18 15:54:13 +02:00
Andrey M. Tokarev
72e0ded3c4 CppEditor: add more sections (protected, ...) for declaration (refactoring)
You can write definition of function, type Alt+Enter, as usual,
and select not only public but also other possible sections
like private, public slots and so on.

Change-Id: I2faefc3833c6f05c9e2e5a2a41328bcdbe17ba14
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-18 15:08:19 +02:00
Nikolai Kosjar
96278750f7 CppEditor: Concatenate strings with + instead of %
operator+ is the official way for concatenating strings whereas operator%
is an optimization that needs certain defines.

The code which was using operator % is not performance critical.

Change-Id: I4c7f4310cc5708aa5f9009672d932f913a2eb59f
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2013-04-17 10:10:37 +02:00
Lorenz Haas
6f3b41214b CppEditor: Add refactoring operation to move definition of a function
With this new operation it is possible to move a function definition
from a cpp file to the header file or vice versa. One can also move a
function definition outside the class body.

Task-number: QTCREATORBUG-516
Task-number: QTCREATORBUG-5364
Change-Id: Id3daefe79284bd9086282369c9d251e003951c11
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-15 17:03:49 +02:00
Nikolai Kosjar
7cc8314425 CppEditor: Fix compilation for Mac OS X.
Change-Id: Iae7ddf066de86f12b9e01af48374c1589afe1388
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-04-15 14:23:05 +02:00
Lorenz Haas
61ddf16689 CppEditor: Rearrange quick fix files
Moved content of cppinsertdecldef.(cpp|h) cppcompleteswitch.(cpp|h)
cppinsertqtpropertymembers.(cpp|h) and ApplyDeclDefLinkChanges to
cppquickfixes.(cpp|h).

Made msgQtStringLiteralDescription private member function of
WrapStringLiteral, added anonymous namespace, "extracted" useful
functions to the top of cppquickfixes.cpp.

Change-Id: I4f82a005a62be3c29d4b96902667bd3a2b9397cc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-15 13:32:42 +02:00
Lorenz Haas
2e8d471c3b CppEditor: Fix insert position of AddIncludeForUndefinedIdentifier
If there are no includes, add new include at the top of file but skip
possible comments at the beginning.

Task-number: QTCREATORBUG-8799
Change-Id: Ie2be644f6ad0a948cf3d8700efa00087753d9863
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-10 16:42:29 +02:00
Friedemann Kleint
d61bc4fcec Clean headers in CppEditor.
Ran script to remove inludes on a trial-and-error basis and
manually corrected it.

Change-Id: I61a5c2fff02616f6883ddf3923e4361fca6bf92b
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-04-10 11:04:22 +02:00
Oswald Buddenhagen
7923032022 fix include style relating to cplusplus libraries
... and adjust INCLUDEPATH accordingly.

while i'm at messing with include statements, also re-order the include
blocks according to policy and sort them within bigger blocks.

Change-Id: I7762abfd7c4ecf59432b99db2f424e4fa25733a5
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2013-04-03 13:40:39 +02:00
Sergey Shambir
63fe568b9b CppTools: improved languages support in ProjectPart
Please, read blueprint here:
http://qt-project.org/wiki/Blueprint-for-language-specs-system

Removed feature from QbsProjectManager: it not longer splits project on
separate C and C++ parts, because Qt version used only by clang parser
(not native) and can be ignored for pure C and Objective-C without C++.

Change-Id: I1c561f7f9f915cc6cb8579d19db74e8352f54c1e
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
2013-03-21 17:22:18 +01:00
Nikolai Kosjar
acfeed29c5 Compile fix (for windows)
Change-Id: Id3aff27a92734b51e894b8a4d55cd9531d810b9e
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
2013-02-15 08:42:35 +01:00
Nikolai Kosjar
30da7ad3e2 C++: Pass only reasonable ASTs to pointer declaration formatter
Change-Id: Ide829a8084d3fef79f252dc7724bd90ce8ebba04
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-02-14 12:25:32 +01:00
Nikolai Kosjar
c6a7fb8ccf C++: Refactor quick fixes
- Put declarations into quickfixes.h to simplify testing
 - Give the factories more meaningful names

Change-Id: If74c29a8c17819d5369ffa3df94d146b14e53af9
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-02-14 12:25:20 +01:00
Nikolai Kosjar
32e83ef89d C++: Use camel case style in quick fix name.
Change-Id: I6f5f1f276cd0ede39be4022fc417ecf40fa30004
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-06 12:26:59 +01:00
Oswald Buddenhagen
1fda2111d4 Merge remote-tracking branch 'origin/2.6'
Conflicts:
	src/plugins/autotoolsprojectmanager/AutotoolsProjectManager.pluginspec.in
	src/plugins/debugger/qtmessageloghandler.cpp
	src/plugins/debugger/qtmessagelogwindow.cpp
	src/plugins/madde/maemodeployconfigurationwidget.cpp
	src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
	src/plugins/qmldesigner/designercore/include/widgetqueryview.h
	src/plugins/qmldesigner/designercore/metainfo/metainfoparser.cpp
	src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp
	src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h
	src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
	src/plugins/qnx/bardescriptormagicmatcher.h
	src/plugins/qt4projectmanager/profilekeywords.cpp
	src/plugins/remotelinux/deployablefilesperprofile.cpp
	src/plugins/remotelinux/deployablefilesperprofile.h
	src/plugins/remotelinux/deploymentinfo.cpp
	src/plugins/remotelinux/deploymentsettingsassistant.cpp
	src/plugins/remotelinux/profilesupdatedialog.cpp
	tests/auto/icheckbuild/ichecklib.cpp
	tests/auto/icheckbuild/parsemanager.cpp
	tests/auto/icheckbuild/parsemanager.h

Change-Id: Ie465a578446a089e1c502d1cb1096e84ca058104
2013-01-31 16:25:33 +01:00
Robert Loehning
298531e370 Incremented year in copyright info
Change-Id: Ic6a9ff0359625021ebc061d22db6811814534205
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2013-01-29 16:27:03 +01:00
Erik Verbruggen
72db7a8f52 CppEditor: quick fix to generate getters and setters
This does not take namespaces on the implementation side
into account and does not properly position/indent things.

Task-number: QTCREATORBUG-1890
Change-Id: I779d12fefc79521bce38361729d4f66dada71147
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-01-24 16:18:16 +01:00
Nikolai Kosjar
632eaf06a9 C++: Add Quickfix for fixing pointer types/declarations
Task-number: QTCREATORBUG-6169

Change-Id: I718dc071b1904d5cbf575c8f379e5ed08522d51f
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-01-24 12:00:45 +01:00
Nikolai Kosjar
8fe25d0a4a C++: Add settings dialog for pointer declaration formatting
The dialog is at Tools > Options > C++ > Code Style > Edit... > Pointers
and References.

Currently the settings are referenced when applying the following
QuickFixes:
 - Adapting function signature in declaration/definition
   (FunctionDeclDefLink)
 - Inserting declaration from definition (InsertDeclOperation)
 - Inserting definition from declaration (InsertDefOperation)
 - Extracting a function (ExtractFunctionOperation)
 - Add Local Declaration (AddLocalDeclarationOp::Operation)

In these cases the code style of the current project is used. If there
is no current project open, the current global code style is used.

Task-number: QTCREATORBUG-6169

Change-Id: I3e4e502b3103f7f754ac9b39594ad461d89d9304
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-01-24 11:59:40 +01:00
Orgad Shaneh
29a93998df Remove braces for single lines of conditions
#!/usr/bin/env ruby

Dir.glob('**/*.cpp') { |file|
  # skip ast (excluding paste, astpath, and canv'ast'imer)
  next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
  s = File.read(file)
  next if s.include?('qlalr')
  orig = s.dup
  s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
    res = $&
    if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
      res
    else
      res.gsub!('} else', 'else')
      res.gsub!(/\n +} *\n/m, "\n")
      res.gsub(/ *{$/, '')
    end
  }
  s.gsub!(/ *$/, '')
  File.open(file, 'wb').write(s) if s != orig
}

Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 10:48:18 +01:00
Orgad Shaneh
a44aa55502 Add whitespace after control keywords
find -name \*.cpp -o -name \*.h | \
  xargs sed -Ei 's/ (for|foreach|if|switch|while)\(/ \1 (/g'

Change-Id: I9efdff4bf0c8c01a52baaaeb75198483c77b0390
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-28 20:20:46 +01:00
Erik Verbruggen
964c01a460 C++: ProjectParts now contain everything that gets linked together.
Change-Id: Ib862e51897156a03a4a45e2a1690b00caeb03518
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
2012-11-28 09:09:14 +01:00
hjk
3fba291b7b cppquickfixes: compile fix for msvc2008
Change-Id: I287c76372d2c50c408b9ef74e292a36d8e278449
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-08 08:43:42 +01:00
hjk
438e4af735 CppEditor: simplify CppQuickFixOperation interface
Change-Id: Ib3ed82c7f07f80027b18471ffb7b3055fa74eb52
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-11-07 14:29:11 +01:00
hjk
6fb3328dbe CppEditor: remove operator() overloads from OverView
Feels less obfuscated.

Change-Id: Ide0ec1f38762038ddbb1eddb4f70f7d6acdf1ff7
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-10-17 11:20:10 +02:00
hjk
386ca7c8dd Adjust license headers
Change-Id: Ice592c6de9951ee3b2c4cb52ed0bb3b6770e0825
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2012-10-05 17:12:56 +02:00
Eike Ziller
e0e8cf3ada Contact -> qt-project.org
Change-Id: I7134d7de30bcf9f9dcfad42520dd45ee083a852d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-07-19 13:23:21 +02:00
Eike Ziller
e3c354d8f2 Make PluginManager mostly static.
Change-Id: Ib938aa4999c7c418a82304c5cca2e8748ef9d228
Reviewed-by: hjk <qthjk@ovi.com>
2012-06-19 16:11:40 +02:00
Erik Verbruggen
f1b2100e34 Move the ModelManagerInterface out of the CPlusPlus library.
Change-Id: Iffaa18f848a22f6961b49dff048672b194570df6
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-03-14 11:46:24 +01:00
Erik Verbruggen
3aab8beaf4 Supply c++11 flags and per-project info to c++ code model.
A manual squash/merge of the changes below, plus a couple of subsequent
code fixes.

59085aa5fbb99e2d786cd2c1a06c24a111ccb49f:
    Modify CppModel::ProjectInfo

    Adding per project node information, to pass on the correct
    defines/includes for each file, instead of aggregating them incorrectly.

    Also split up SOURCES and OBJECTIVE_SOURCES.

    Also ask the toolchain to convert the compilerflags to flags the
    codemodel understands, for now only gcc and only c++11.

    Also make the toolchain aware of the flags used to compile, so that it
    can emit the correct defines.

    Note: No header files are passed on.

74028802314cd4e75b41b46407433e07090a304d:
    GCC: Evaluate cxxflags when checking for predefined macros

ebaaa4957e4c02cc9637a998eddae1d0acd74f83:
    MSVC: Take cxxflags into account when checking for predefined macros

9bfce7e889bcf7bcc47bf880e3ea25945ca7d0d7:
    Compile fixes

Change-Id: I9de94ad038dfc5dc1987732e84b13fb4419c96f5
Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
2012-02-16 15:17:17 +01:00
Erik Verbruggen
3fa55b7ab9 Removed module names from #include directives.
Getting the #include directives ready for Qt5. This includes the
new-project wizards.

Change-Id: Ia9261f1e8faec06b9285b694d2b7e9a095978d2b
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
2012-02-15 16:24:46 +01:00
Element9
d602c418d5 C++: Rearrange parameter declaration list quickfix
This quickfix switches places of the parameter declaration under cursor
with the next or the previous one in the parameter declaration
list.

Change-Id: Ic379967ac51297a317a55d0e0faf6c5b1cb9d585
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2012-02-10 12:45:24 +01:00
hjk
2931a499e6 Long live the king!
Change-Id: I2b72b34c0cfeafc8bdbaf49b83ff723544f2b6e2
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
2012-01-26 19:55:36 +01:00
Leandro Melo
efe9bca20c C++: Replace non-absolute-critical asserts for soft ones
Change-Id: I021074a78d90929b4e83b8aff9db1ae7995e8c6a
Reviewed-by: hjk <qthjk@ovi.com>
2012-01-24 09:58:59 +01:00
Leandro Melo
b97b45a341 C++: Fix "reference" file in symbol finder
Througout the initial review the singleton was transformed into an
ordinary class, but a error was introduced: The "reference" file was
incorrectly assumed to be the editors file, which is wrong, since
it should be the declaration file.

Change-Id: Iad3e25a690fa8bd07a18184b24b10f8dea965332
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-01-23 17:17:00 +01:00
Leandro Melo
466ea4842c C++: Improve file accuracy when finding symbols
This patch introduces a priority-based mechanism when searching for certains
symbols in the snapshot. The priority corresponds to how similar the file path
from the "reference" symbol is to the file path from the "candidate" symbol.
This solves a variety of issues when matching "equivalent" symbols but that
are in another file/project, such as when following a function declaration,
a forward class declaration, or adding a definition through a quickfix.

There's now a symbol finder which will compute the "best" search order and cache
the most recent results. A consequence is that following symbols in some cases
is slower, but not apparently significatly.

Note: The "find" functions were moved from the Snapshot to the new SymbolFinder
class.

Task-number: QTCREATORBUG-6697
Task-number: QTCREATORBUG-6792

Change-Id: Ia518f014275fec1f4d0cb3224bd4e06a9df6d557
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-01-23 11:34:44 +01:00
Leandro Melo
fd179ed951 C++: Accept UTF-8 byte arrays in type of expression
The model uses UTF-8 internally and it makes more sense to only
convert when necessary.

A following commit will rename the source/setSource methods in
document for more clarity too.

Change-Id: I960ea0754efabd1436ad4b4299a57faeb65a8bee
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-01-13 10:17:03 +01:00
Friedemann Kleint
9128fc2ab0 CppEditor: Compile with QT_NO_CAST_FROM_ASCII.
- Avoid unnecessary conversions
- Add missing tr().

Change-Id: I3c0dd627a3621929c9c6fc71db6924fa513e34a7
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2012-01-12 13:50:30 +01:00