Commit Graph

52 Commits

Author SHA1 Message Date
Daniel Teske
8e75e611a5 Move TextEditor::ToolTip to Utils
To enabled reuse from all plugins.

Change-Id: I1de68c8e6ed017d45f1248b2043f9611becc3b54
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-01-11 15:06:00 +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
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
6dfe3207d2 Cpp: No need for accessors for simple structs
Change-Id: Ie09c1fc59dd54d2302a78cfc9769d5cda6012be7
Reviewed-by: hjk <qthjk@ovi.com>
2012-10-11 23:16:51 +02:00
Eike Ziller
6fd252b0a5 Merge remote-tracking branch 'origin/2.6'
Conflicts:
	share/qtcreator/qml/qmlpuppet/commands/endpuppetcommand.cpp
	share/qtcreator/qml/qmlpuppet/commands/endpuppetcommand.h
	src/plugins/debugger/qtmessageloghandler.cpp
	src/plugins/debugger/qtmessageloghandler.h
	src/plugins/debugger/qtmessagelogwindow.cpp
	src/plugins/madde/maemodeployconfigurationwidget.cpp
	src/plugins/madde/maemodeployconfigurationwidget.h
	src/plugins/remotelinux/deployablefilesperprofile.cpp
	src/plugins/remotelinux/deployablefilesperprofile.h
	src/plugins/remotelinux/deploymentinfo.cpp
	src/plugins/remotelinux/deploymentinfo.h
	src/plugins/remotelinux/deploymentsettingsassistant.cpp
	src/plugins/remotelinux/profilesupdatedialog.cpp
	src/plugins/remotelinux/remotelinuxdeploymentdatamodel.h
	tests/auto/icheckbuild/ichecklib.cpp
	tests/auto/icheckbuild/ichecklib_global.h
	tests/auto/icheckbuild/parsemanager.cpp
	tests/auto/icheckbuild/parsemanager.h
	tests/manual/ssh/tunnel/tunnel.h

Change-Id: I04d7761df6bd936ad00e0547974284c967d39580
2012-10-05 21:20:50 +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
Christian Kandeler
3d9e492860 Do not use the fromAscii() and toAscii() functions.
They are deprecated in Qt 5. Use fromLatin1() and toLatin1() instead. In
Qt 5, these always do the same thing as their "Ascii" counterparts. The
same goes for Qt 4, provided QTextCodec::setCodecForCStrings has not
been set, which it hasn't.

Change-Id: I04edeb376762b6671eff8156094f0d5e2cb8e1ea
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2012-09-21 21:03:48 +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
Leandro Melo
23c637c4f6 C++: Introduce unicode char/strings support
Those are the types char16_t and char32_t along with the new
char/string literals u'', U'', u"", u8"", and U"".

This is particularly important for the use of QStringLiteral
since in some platforms it relies on expansion such as above.

Note: The string literals quickfixes still need some tunning.

Task-number: QTCREATORBUG-7449
Change-Id: Iebcfea15677dc8e0ebb6143def89a5477e1be7d4
Reviewed-by: hjk <qthjk@ovi.com>
2012-06-06 14:55:07 +02:00
Eike Ziller
3934347fe9 ActionManager API cleanup.
d-pointer instead of inheritance
static methods

Change-Id: I7b2f0c8b05ad3951e1ff26a7d4e08e195d2dd258
Reviewed-by: hjk <qthjk@ovi.com>
2012-05-25 10:08:24 +02:00
Kai Koehne
e9277df87b QuickFixes: Fix capitalization of descriptions
Always use camel case for actions in context menu.

Change-Id: Iafa0569c4bca4ecb858fe618780208322379b979
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@nokia.com>
2012-05-10 10:15:42 +02:00
Eike Ziller
9092e70884 Merge remote-tracking branch 'origin/2.5'
Conflicts:
	doc/templates/style/style.css
	qtcreator.pri

Change-Id: I5f4f5f191726883dae18cb760733a5e8e6bd4e7d
2012-04-27 17:02:39 +02:00
David Schulz
e855e02530 Editor: Fix null-pointer dereference
Task-number: QTCREATORBUG-7330
Change-Id: I5c76e5ce4e3ab7f0659a7df82301b853a9983da1
Reviewed-by: hjk <qthjk@ovi.com>
2012-04-27 13:14:34 +02:00
Erik Verbruggen
60db573660 [C++] Rewrite of the preprocessor.
This rewrite fixes a couple of issues with the pre-processor. It now
supports:
- macros in macro bodies
- stringification of parameters [cpp.stringize]
- the concatenation operator [cpp.concat]
- #include MACRO_HERE
- defined() inside macro bodies used in pp-conditions.

Change-Id: Ifdb78041fb6afadf44f939a4bd66ce2832b8601f
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-03-29 14:28:17 +02:00
David Schulz
72e3038629 Editor: Fix NULL-Pointer dereference in cppfunctiondecldeflink
Happen when trying to synchronize a return type in an inapropriate AST.

Task-number:QTCREATORBUG-7073
Change-Id: I6621a3d5539f96c0db9e0d20423dba9a7def98fc
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2012-03-16 08:31:37 +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
Erik Verbruggen
dbc3332b8e C++: Moved completion/highlighting into the model manager.
This way the editor does not need to know all the details of
instantiating or maintaining classes for highlighting and/or completion,
it can just ask the model manager. The change also enables different
highlighting- or completion-engines without changes to the cppeditor.

Change-Id: I8000d9d9fe446b292defddb2295493cf77d0f14a
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2012-02-08 14:30:14 +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
hjk
4a21f0c3c8 Use new static ICore interface.
Change-Id: I9b690d9b150c8d162b15370f9f8986267c9128f1
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
2012-01-24 18:48:47 +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
c287d90604 C++: Rename source/setSource to utf8Source/setUtf8Source
Continuinng a previous commit... This is in order to make
the interface clearer.

Change-Id: Ic1b05217f878578bc84a064927507b75981c47d6
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-01-13 11:22:28 +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
Christian Kamm
d92862d0b1 C++ function signature: Preserve trailing non-cv specifiers.
Like __attribute__((...)).

Task-number: QTCREATORBUG-6620
Change-Id: I8cf9f1743cf107a9ef858206de138ca9771bbdf0
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2011-11-28 11:38:27 +01:00
Christian Kamm
c0cebf9735 C++ function signature: Avoid hitting a QTC_ASSERT.
Change-Id: I0390e51a7d1fc4563eed791c9f8c8ed403398663
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2011-11-23 13:52:23 +01:00
Leandro Melo
a1c2580443 Compile fix for use of QVarLengthArray
Change-Id: Ia68a121f61aab3667d1a4c99ba348fbfe2e98d4d
Reviewed-by: Bill King <bill.king@nokia.com>
2011-11-21 17:16:36 +01:00
Christian Kamm
fa6c3cc1ec C++ function signature: Automatically rename argument uses in body.
Task-number: QTCREATORBUG-6132
Change-Id: I7c21e648cfc2e85803a3bf4df0a615a1e276f96a
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2011-11-21 15:04:27 +01:00
Christian Kamm
a072941617 C++ function signature: Improve preserving of default arguments.
Task-number: QTCREATORBUG-5978
Change-Id: Iab0bba3c16b4cd435f0dc6339db49f209f1359d3
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2011-11-21 15:04:19 +01:00
Eike Ziller
85cf2b661e Merge remote-tracking branch 'origin/2.4'
Conflicts:
	src/libs/qmljs/qmljsinterpreter.cpp
	src/libs/qmljs/qmljsinterpreter.h
	src/plugins/debugger/qml/scriptconsole.cpp
	src/plugins/git/gitplugin.cpp
	src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas.cpp
	src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h

Change-Id: Iad59c8d87c72a21c79c047e374c0ab689998af39
2011-11-11 09:46:25 +01:00
Christian Kamm
c2eb453228 QuickFixes: Sort by priority.
* Generally changes the BasicProposalItemListModel's sort to take the
  BasicProposalItem::order member into account.
* Currently only the QML completion and quick fixes set the order.
* This means the 'Apply signature changes' quick fix is now further up
  than the 'add definition' quick fix.

Change-Id: I7b5bc82aa37fca232fddd630ab3273437e1bcc09
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2011-11-04 12:16:41 +01:00
hjk
31600758de all: s/info@qt.nokia.com/qt-info@nokia.com/
Change-Id: If18afb5d4665924e7d9250dccbc60a65e6daa75e
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
2011-11-03 10:33:19 +01:00
Christian Kamm
f746c746ea C++: Improve calculation of function argument count.
Reuse Function::argumentCount instead of reimplementing it.

Change-Id: I05ba2dbee087e5dfd53c7af3ec94d214f6e37a54
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-10-21 13:28:49 +02:00
Christian Kamm
9cc4751857 C++ function signature: Abort on unexpected function name.
Change-Id: Iaaa3907f709ea9ed567f59725399efd9024f3bc0
Reviewed-on: http://codereview.qt-project.org/5319
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-26 12:45:47 +02:00
Christian Kamm
d8c7dc8c52 C++ function signature: Don't try to reuse nonexistant context.
Change-Id: I890cccc25c5ba774691edee860845e22a7b7ec78
Reviewed-on: http://codereview.qt-project.org/4876
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-14 10:44:53 +02:00
Christian Kamm
d298cffeb0 C++ function signature: Add shortcut to marker tooltip.
Change-Id: Ied3268bb624df4201ca42beb76d20b9a638d5918
Reviewed-on: http://codereview.qt-project.org/4746
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-13 14:33:44 +02:00
Christian Kamm
34dc80529d C++: Don't jump to change when applying function signature quickfix.
Change-Id: I93abf773717b3f82fc6fa15e1916f48bc3edec95
Reviewed-on: http://codereview.qt-project.org/4675
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-13 14:33:31 +02:00
Christian Kamm
fc7dae4096 C++ function signature: Allow most specifiers to be replaced.
Except for some SimpleSpecifiers and AttributeSpecifiers. Fixes a bug
where NamedTypeSpecifiers would not be replaced when the return type
was adjusted.

Change-Id: Ie093615ebf1b26d181b888fcbcc341e5bdf85fd1
Reviewed-on: http://codereview.qt-project.org/4749
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-13 11:50:06 +02:00
Christian Kamm
5a0a44bf92 C++ function signature: Don't accidentally eat specifiers.
You could accidentally delete specifiers like 'static' or 'virtual' with
the 'apply function signature changes' quick fix before.

Change-Id: Ia97a33f663a01063fad4d432551715ebf27a18d5
Reviewed-on: http://codereview.qt-project.org/4538
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-12 11:23:52 +02:00
Christian Kamm
f9effd16b3 C++ function signature: Fix problem with multiline declarations.
QTextCursor::selectedText() has null chars where the tokenizer expects
newlines.

Change-Id: I15ae87ef8525c89812a61b80abda91d36bf56576
Reviewed-on: http://codereview.qt-project.org/4450
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-08 14:56:42 +02:00
Christian Kamm
465890ac31 C++: Jump to better location when function signature is updated.
This will allow using 'Follow Symbol' to jump back after the change.

Change-Id: I99fd3ebc63a2af58b12eee9d7055a4c2f249e97d
Reviewed-on: http://codereview.qt.nokia.com/4186
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-05 12:14:36 +02:00
Christian Kamm
e99f915623 C++: Trigger function signature change via quick fix.
This way we don't need to override Return and Escape.

Change-Id: I1548118c06ee7338ba3dd9d84b82b9314ab16782
Reviewed-on: http://codereview.qt.nokia.com/4183
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-05 12:14:27 +02:00
Christian Kamm
688595e7ba C++ function link: Don't add name if name is commented.
Change-Id: Ibc38898585f6e5be625ccfc0e1304ccb44a7f167
Reviewed-on: http://codereview.qt.nokia.com/3955
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-01 09:25:24 +02:00
Christian Kamm
13a2e49dda C++: Set property on CppEditorWidget when in function link.
To allow FakeVim to pick up on the state and pass through Enter/Return.

Change-Id: Ia203a1b3fa8877d90cbaf4b46183bb01a6de1362
Reviewed-on: http://codereview.qt.nokia.com/3856
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: hjk <qthjk@ovi.com>
2011-08-30 10:20:10 +02:00
Christian Kamm
3dcf168165 C++ function link: Disable function links on name change.
Change-Id: Ib5e3a3a381568347a7a465f956f7daad15f10ab0
Reviewed-on: http://codereview.qt.nokia.com/3596
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2011-08-26 08:47:36 +02:00
Christian Kamm
6d5c0c0d78 C++ function link: The symbol can be unavailable on parser error.
Change-Id: I7a95adcaafff5ff845ae0fdef5bea8c3846a6ffe
Reviewed-on: http://codereview.qt.nokia.com/3599
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2011-08-25 15:00:18 +02:00
Christian Kamm
6235ec5120 C++ function links: Use line+column instead of offset for target.
It's more robust if text before the target is changed in a minor way.

Change-Id: I48e27c5d194dd2dcff4b064bf59538b4660015d7
Reviewed-on: http://codereview.qt.nokia.com/3097
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-08-19 11:12:17 +02:00
Christian Kamm
8a6d767a8f Refactoring changes: Cleanup and improvements.
Previously RefactoringFiles were usually passed around by value.
However, since a RefactoringFile may sometimes own a QTextDocument
(when it was read from a file), that's not great and caused the
file to be reread after every copy.

With this change RefactoringFile becomes noncopyable and is always
owned by a shared pointer.

This change also allowed having const RefactoringFiles which is
useful because they can be safely used from other threads. See
CppRefactoringChanges::fileNoEditor.

Change-Id: I9045921d6d0f6349f9558ff2a3d8317ea172193b
Reviewed-on: http://codereview.qt.nokia.com/3084
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-08-19 11:12:09 +02:00