Commit Graph

69 Commits

Author SHA1 Message Date
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
Leandro Melo
c25f0585d1 C++: Extract function quickfix
Task-number: QTCREATORBUG-5485

Change-Id: Ib6aaeaadad4b421480d22399392768d4bad85bda
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-01-10 15:31:03 +01:00
Friedemann Kleint
30374e2bb1 CppEditor: Improve string literal quick fix.
- Add conversion for single character constants, offering
  to convert them characters or QLatin1Char.
- Offer conversions from character constants to string constants.
- Rewrite the WrapStringLiteral::Operation class such that it
  takes a mask of actions to perform which can be combined
  in arbitrary ways. Provide static convenience functions
  that can be used for the Translation/Objective C conversion
  as well.
- Move code outside class to reduce indentation.
- Use its functionality for the Translation/Objective C
  conversion as well, reducing redundant analysis/operation code.

Change-Id: If32c16a705cfc1cc20a48ab1c93b5053467d1749
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2011-12-18 11:56:35 +01:00
Christian Kamm
dc72cff71a C++: Add basic 'insert #include' quick fix.
Change-Id: I3a2fef56d6d1871ea4bbb139f9bdd2bc44dd0123
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2011-12-02 13:00:28 +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
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 Kandeler
6820f22bbd CppTools: Remove function replicating standard library functionality.
Change-Id: I0778aa3d91d8c62fcce7e07e2ceffa1970281ec6
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-10-25 15:14:52 +02:00
Leandro Melo
87943ca61c C++: Fix hexadecimals in quick fix
Task-number: QTCREATORBUG-6240
Change-Id: Id3dc48d47f88017b3bc9e026c8e5552d2e9f4d48
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-10-12 14:44:27 +02:00
Friedemann Kleint
1b5e10e1b6 CppEditor: Add Quickfix for Qt 5 QStringLiteral.
Make replacement a parameter of the Operation class.

Change-Id: Ie9c013061d7045b3ee8c0e569e9df342dab38096
Reviewed-on: http://codereview.qt-project.org/5845
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-09-30 12:01:33 +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
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
Christian Kamm
077f503958 C++: Use minimal names in 'insert local declaration' quickfix.
Change-Id: Ia8362bc9a4b319ab4bb65f3fb1a36dc769e28ccd
Reviewed-on: http://codereview.qt.nokia.com/2953
Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
2011-08-15 13:16:02 +02:00
Leandro Melo
bec4f02495 New code assist API
This is a re-work of our completion engine. Primary goals are:

- Allow the computation to run in a separate thread so the GUI is not locked.
- Support a model-based approach. QStrings are still needed (filtering, etc), but
internal structures are free to use more efficient representations.
- Unifiy all kinds of *assist* into a more reusable and extensible framework.
- Remove unnecessary dependencies on the text editor so we have more generic
and easily "plugable" components (still things to be resolved).
2011-05-18 10:46:20 +02:00
hjk
769b21b49d cppeditor: fix crash on uninitialized pointer
Reviewed-by: Erik Verbruggen
2011-05-11 14:42:16 +02:00
Tobias Hunger
aa2acec14c Fix/add copyright headers
Change-Id: I8b73d583be1ee7183f4074bce49d5390e38631a2
2011-05-06 15:17:05 +02:00
Oswald Buddenhagen
9beb7afbe8 GUI style fixes: spaces before ellipses and excess ellipses 2011-04-18 14:10:11 +02:00
hjk
8397663964 Update license. 2011-04-13 11:49:28 +02:00
hjk
f576ad9f2c texteditor: merge ITextEditable into ITextEditor
rename BastTextEditor->BaseTextEditorWidget, BaseTextEditorEditable->BaseTextEditor
rename BaseTextEditor{,Widget} subclasses
rename editableInterface->editorInterface
rename createEditableInterface->createEditor
minor cleanups after renamings
2011-02-22 11:23:53 +01:00
Friedemann Kleint
a9a5e3ea17 Exported header cleanup. 2011-01-20 14:03:07 +01:00
con
d1023c7614 It's 2011 now.
Reviewed-by: hjk
2011-01-12 09:46:24 +01:00
Erik Verbruggen
f9548e5d13 Added activates-on to the quick-fixes.
Reviewed-by: Christian Kamm
2011-01-10 10:10:54 +01:00
Christian Kamm
20aeec7305 QuickFix: Add comments to undocumented fixes.
Reviewed-by: Erik Verbruggen
2011-01-07 14:49:34 +01:00
con
b1bcf081d8 Merge branch '2.1'
Conflicts:
	src/plugins/coreplugin/basemode.cpp
	src/plugins/coreplugin/basemode.h
	src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.cpp
	src/plugins/coreplugin/scriptmanager/qworkbench_wrapper.h
	src/plugins/debugger/cdb/cdbsymbolpathlisteditor.cpp
	src/plugins/debugger/debuggeragents.cpp
	src/plugins/debugger/debuggeruiswitcher.cpp
	src/plugins/debugger/debuggeruiswitcher.h
	src/plugins/projectexplorer/buildconfigdialog.cpp
	src/plugins/qmldesigner/components/propertyeditor/colorwidget.cpp
	src/plugins/qmldesigner/components/propertyeditor/colorwidget.h
	src/plugins/qmldesigner/designercore/include/enumeratormetainfo.h
	src/plugins/qmldesigner/designercore/include/modelutilities.h
	src/plugins/qmldesigner/designercore/include/nodeinstance.h
	src/plugins/qmldesigner/designercore/include/propertymetainfo.h
	src/plugins/qmldesigner/designercore/instances/graphicsscenenodeinstance.cpp
	src/plugins/qmldesigner/designercore/instances/graphicsscenenodeinstance.h
	src/plugins/qmldesigner/designercore/instances/graphicsviewnodeinstance.cpp
	src/plugins/qmldesigner/designercore/instances/graphicswidgetnodeinstance.cpp
	src/plugins/qmldesigner/designercore/instances/graphicswidgetnodeinstance.h
	src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp
	src/plugins/qmldesigner/designercore/instances/qmlviewnodeinstance.cpp
	src/plugins/qmldesigner/designercore/instances/widgetnodeinstance.cpp
	src/plugins/qmldesigner/designercore/instances/widgetnodeinstance.h
	src/plugins/qmldesigner/designercore/metainfo/enumeratormetainfo.cpp
	src/plugins/qmldesigner/designercore/metainfo/propertymetainfo.cpp
	src/plugins/qmldesigner/designercore/model/modelutilities.cpp
	src/plugins/snippets/inputwidget.cpp
	src/plugins/snippets/snippetscompletion.cpp
	src/plugins/snippets/snippetscompletion.h
	src/plugins/snippets/snippetspec.cpp
	src/plugins/snippets/snippetsplugin.cpp
	src/plugins/snippets/snippetswindow.cpp
	src/plugins/snippets/snippetswindow.h
	src/plugins/texteditor/snippetsparser.cpp
	src/tools/qml/qmldom/main.cpp
	tests/manual/trk/runner.cpp
	tests/manual/trk/trkolddevice.cpp
	tests/manual/trk/trkolddevice.h
	tests/manual/trk/trkserver.cpp
2010-12-17 17:00:53 +01:00
con
04e32b0049 License headers. 2010-12-17 16:03:42 +01:00