Commit Graph

1390 Commits

Author SHA1 Message Date
Eike Ziller
1ae483fc83 Merge remote-tracking branch 'origin/4.0'
Conflicts:
	src/libs/utils/tcpportsgatherer.h

Change-Id: I495f3e05789f09efb8b1e84827893423a5b5b60c
2016-04-05 14:11:47 +02:00
Tim Jenssen
3c9a893adc QmlJS: do file name checks with platform independent functions
this fix the polluted output while QtQuickDesigner is opened

Change-Id: Icba0d76ff25ae720b5e3b3ce8cc5cecc45181241
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
2016-04-05 11:29:27 +00:00
Oswald Buddenhagen
e426d08e54 Merge remote-tracking branch 'origin/4.0'
Conflicts:
	qtcreator.pri
	qtcreator.qbs
	src/plugins/debugger/debuggerruncontrol.cpp

Change-Id: I81b43480a1369e3d7be60ae26e812dda6b962b0b
2016-04-01 17:31:39 +02:00
hjk
39a38d5679 Wholesale conversion to #pragma once
Kudos to cgmb and https://github.com/cgmb/guardonce

Change-Id: Ifa8970734b8d43fd08c9260c645bdb0228633791
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-03-30 15:20:19 +00:00
Ulf Hermann
35bafd3952 QmlJS: Fix resolution of "alias" directives in qrc files
Previously qrc paths of QML/JS documents were not considered for
implicit imports. Only the path of the document in the file system
was considered. The QML engine, however, doesn't know the original
path at all and only uses the qrc paths for import resolution. This
created a mismatch between what the QML engine could recognize and
what the code model suggested.

Without alias directives, any files imported from a qrc file would
have to reside in the same directory as the one implicitly importing
them, so this arrangement happened to work, most of the time.

In order to support aliases we have to search the files in the same
qrc path to figure out the imports. To do that, we keep a reverse
map of qrc paths to files in the QrcParser and iterate that when
resolving imports.

Change-Id: I84baae6cbfbe96ddd5322c81494c1e4a3f473f3f
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-03-29 11:20:57 +00:00
Eike Ziller
72af6b7834 runAsync: Remove ResultType template parameter.
It is now deduced from either the type of the
QFutureInterface<ResultType> function argument, or the return type.

Change-Id: Iddab3cc329206c649a6e55a44b2de2d406701dee
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-10 10:58:55 +00:00
Friedemann Kleint
97af238656 Preferably use QStringRef::toInt().
Avoid allocations for converting to int.

Change-Id: Id8c79334f4809ec075ffe7e6b7635be4873eafd8
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-02-04 07:56:58 +00:00
Eike Ziller
9074a8c310 QmlJS: Change yet another call of QtConcurrent::run
Change-Id: I417c4dbdf8216e8372578775efe97a0510756520
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-02-01 08:21:22 +00:00
Orgad Shaneh
a6e6c88ed8 Revert "QmlJS: Exchange unsafe meta calls with QTimer::singleShot"
QTimer::singleShot with a member function pointer or a lambda does
not schedule the invocation directly on the receivers event loop,
even if the timeout is 0. It actually creates a timer in the thread
where QTimer::singleShot is called, which requires an event dispatcher
to be available. Only the timer's timeout() signal then schedules the
invocation on the receivers thread.

We do not want to actually run an event loop here until a timer fires.
Even if a timer with timeout 0 might directly schedule the timeout
event on the event dispatcher without involving actual timers, and
even if that event dispatcher makes sure all events are handled before
deleting itself, it would feel like relying on an implementation
detail.

This reverts commit a2e19ba1be.

Task-number: QTCREATORBUG-15681
Change-Id: I19846ce089d72c971d3cc5927c2ddf563e06de14
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-28 11:50:18 +00:00
Eike Ziller
acdfb09687 QmlJS: Use Utils::runAsync and add some more progress information
runAsync avoids the globally shared thread pool.
updateCppQmlTypes missed some kind of progress information.

Change-Id: I8739761326c2f2a5364c0c1552b3c43b00f1ff28
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-27 12:27:59 +00:00
Eike Ziller
a2e19ba1be QmlJS: Exchange unsafe meta calls with QTimer::singleShot
Change-Id: I5596c3f506f1fb873536c03ed5b8f5df88f5ea06
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-27 08:24:14 +00:00
Eike Ziller
265fa13bdb QmlJSModelManager: Use Utils::runAsync instead of QtConcurrent::run
To get rid of the shared thread pool (and to use the API with the less
ugly implementation).

Change-Id: Ia93977b8b394aff8e410d6d81446c23e32b7aed5
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-22 13:34:57 +00:00
Eike Ziller
a30c1adc96 QmlJSModelManager: Cleanup uses of QFuture
- Use simple list instead of QFutureSynchronizer (no feature of that was
  used)
- Avoid duplicate code cleaning up the current list of running futures
- Clean list of running futures after waiting for them all to finish

Change-Id: Ia13ee25ab7835fc4f4970d23d20b16cfe6bf6dfb
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-22 13:28:55 +00:00
Tim Jenssen
ebd7bcd643 qmljs: move running qmldump process to a method
Change-Id: Iaa129d2888d5b0d01e83014a2f520580d238149d
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2016-01-21 10:28:54 +00:00
Tobias Hunger
f72370f20a Update License according to agreement with Free Qt Foundation
* Update remaining files in src

Change-Id: I1896f17fcf34f71c3310c87899fb5171b8e4afb1
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:59:41 +00:00
Oswald Buddenhagen
5a7d3e78db Merge remote-tracking branch 'origin/3.6'
Conflicts:
	qtcreator.pri
	qtcreator.qbs

Change-Id: Ifbe181e86c161e082cc9a69a4bc7bd399f34ff47
2016-01-04 14:11:07 +01:00
Marco Benelli
64d2aab04a Removed qmltypes tooling-related warnings.
QtCreator is not currently handling dependencies written in qmltypes
files, that imports 'QtQuick.tooling 1.2', so it write several warnings
in 'General Messages' for each qmltypes file it reads.
Since dependencies are resolved anyway in the shipped qmltypes, these
warnings are useless and annoying.

Change-Id: Ie209ca4164381990feda12fb4c7a9e332e4a632d
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-12-18 14:01:46 +00:00
Takumi ASAKI
44bb3cb4c3 QmlDesigner: Adding qsTrId() support
Task-number: QTBUG-48850
Change-Id: I16a0612ec29b552a3d46f2563fdc2a043b9dec7e
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
2015-12-15 00:34:57 +00:00
Ulf Hermann
2aff7963b4 Don't use qSNaN()
signalling NaNs are generally undesirable as they with trigger a signal
on any further arithmetics operation done to them.

Change-Id: Icebae3d4eb22c8294b11da234a2ba5c7e31b9733
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-12-10 14:12:20 +00:00
hjk
33651877d8 Move QmlConsole to Debugger
Now it is closer to its only user and possibly reusable for no-QML uses
there.  We also drop the QML/JS syntax checker. The application being
debugged can already tell us about syntax errors. There is no need to
duplicate that functionality.

Change-Id: I2ba151f9f4c854c6119ba5462c21be40bddcebf9
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-12-09 12:06:26 +00:00
Nikolai Kosjar
0498fb68ff C++: Revert lookup to 3.4.2
...which was least buggy.

The bugs fixed by the changes we revert here (highlighting/completion
for code involving templates) were minor compared to ones we currently
have. Those bugs will be addressed by the clang code model anyway.

Relevant commits were collected via:

  $ cd ${QTC}/src/libs/cplusplus
  $ git log \
   --no-merges \
   --format=oneline \
   v3.4.2..HEAD \
   -- LookupContext.* ResolveExpression.* TypeResolver.* TypeOfExpression.* \
      ../../plugins/cpptools/cppcompletion_test.cpp

From this list the following were skipped due to irrelevance:

  88c5b47e53 # CppTools: Minor cleanup in completion tests
  e5255a1f5c # CppTools: Add a test for ObjC not replacing dot with arrow
  5b12c8d63a # CppTools: Support ObjC in member access operator tests
  9fef4fb9ca # CPlusPlus: Fix warnings about overriding visit(...) methods

There were only minor conflicts while reverting those.

This changes touches so many files because there were quite some
cleanups and renames after the 3.4.2 release.

Task-number: QTCREATORBUG-14889
Task-number: QTCREATORBUG-15211
Task-number: QTCREATORBUG-15213
Task-number: QTCREATORBUG-15257
Task-number: QTCREATORBUG-15264
Task-number: QTCREATORBUG-15291
Task-number: QTCREATORBUG-15329
Change-Id: I01f759f8f35ecb4228928a4f22086e279c1a5435
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-19 14:48:38 +00:00
BogDan Vatra
9db8adec7d Export explicitly instantiate templates.
LLVM & MSVC needs to explicitly export the instantiate templates.

Change-Id: I51562750415400bfa561fd6e759211f2b4b10650
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-11-17 11:35:44 +00:00
Marco Benelli
a8d1df2c0c QmlJs: fixed a regression in reformatter.
The commit b26920c3a3 introduced a bug
in reformatting properties lacking an object initializer.

Change-Id: I30f9c9c8a005660e7af4a6c97d0b1ff1be461548
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-11-02 14:26:40 +00:00
Marco Benelli
b26920c3a3 Fixed bug in reformatting QML code (duplicated property name).
Change-Id: I1af68aa979fbbc38edd0255c346b9df371c8fd26
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-10-30 10:03:36 +00:00
Leena Miettinen
330ef13d76 QML JS: fix UI text
Change-Id: I5d1235fc7c86b12127b4b7c6392a24a4f4de84c2
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-10-26 08:37:54 +00:00
Aleix Pol
b899684a89 Don't put QString in static attributes
It crashed in some places on our code-base due to the so-called "static
initialization order fiasco".
As a solution, it turns the variable into a function. This shouldn't have
a penalty due to QStringLiteral.

Change-Id: I9f8a955afdff878dc2f0db16fec861d81250c243
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2015-10-09 17:09:45 +00:00
Eike Ziller
0ba4781bfc Merge remote-tracking branch 'origin/3.5'
Change-Id: I889b93611d1762121548fb71d1d3493e4adba313
2015-09-25 10:35:42 +02:00
Marco Benelli
e69bb933e3 qmljs: set cpp object to the latest version exported
m_objectsByQualifiedName did not prefer the latest meta object
revision, as consequence at type exported both anonymously and with a
name, would pick up one version randomly.

Change-Id: I91baf2729d0a0bda61205a62d9a38d04b4da058e
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-09-17 10:59:59 +00:00
Ulf Hermann
7dd898a1b1 QmlJSTools: Fix glitches in QML console
Half of the widget height is a particularly bad estimate for the
default height of a console item. Focusing editable items should be
done by explicitly transferring focus. Also, this only "worked" if
an editable or formerly editable row was the very first line in the
view, which rarely happens.

By default, if no settings are present, all log categories are enabled
now. Otherwise we might miss the error messages resulting from failed
evaluations.

Repeatedly setting the filter regexp to the same thing doesn't signal
a filter change, which is what we actually want when changing the
filter.

Change-Id: Ibe33b0438d92e777bdceaf9af032fc5117ba4041
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-08-25 14:59:17 +00:00
Ulf Hermann
b5717a5315 QmlJS: Lazy-load console items to allow for recursion
Using Utils:TreeView automatically gives us the capability for loading
item as they are expanded. This way we can show recursive structure in
the console as well as load data from the debug server on demand.

Also, properly print error messages received from unsuccessful
command evaluations.

Task-number: QTCREATORBUG-14931
Change-Id: I66d440eedd9723b04670169b27db1ee18f3f2891
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-08-25 14:42:22 +00:00
Christian Kandeler
f89eab60e1 QmlJs: Add missing override modifier.
Change-Id: Ia6ac2afd84342a72e50eaaf833960a618c88bda6
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-08-21 12:01:49 +00:00
Thiago Macieira
5113713128 Remove unused function
Found by ICC
qmljsreformatter.cpp(410): warning #177: function "<unnamed>::Rewriter::firstOnLine" was declared but never referenced

Change-Id: I7de033f80b0e4431b7f1ffff13fa77233116f0cb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-08-17 16:25:58 +00:00
Christian Kandeler
7b970a3a04 QbsProjectManager: Support an equivalent of QML_IMPORT_PATH.
Task-number: QTCREATORBUG-14849
Change-Id: I26f69b5c6c421b5eb965c96d75df15d16e960237
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-08-04 14:43:15 +00:00
Tobias Hunger
76a071757d QmlJs: More override changes
Change-Id: Ia2ea4d8ced3a23b38911517d1015b20d3412554e
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-06-04 13:32:46 +00:00
Tobias Hunger
9da6ac9022 libs/qmljs: s/Q_DECL_OVERRIDE/override/g
Change-Id: I86a5b56ee8587240a03551c0d23edcbd5230494b
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2015-06-04 08:32:08 +00:00
Daniel Teske
26059dbb1e Make every operator bool() explicit
operator bool() is a trap, but with explicit it's far safer,
and we can use that now.

Change-Id: I4e58631c94e87c00256c3ab3cff4fd2c5f632713
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-06-02 16:06:22 +00:00
Christian Kandeler
1ca649994c Fix qbs build.
Change-Id: I3d335648bed71faf92079b08b19f11119a664a02
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-05-28 10:31:38 +00:00
BogDan Vatra
28d2b16165 Allow plugins to insert custom imports.
This patch allows a plugin to insert custom imports. These imports are
used by QtC for syntax highlighting and code completion. This way a
plugin can register types and objects that are available only at
runtime.

This is an example of an imports function implementation:

QList<Import> MyPlugin::imports(ValueOwner *valueOwner, const Document
*context) const
{
  // context is needed to know from which project is the opened document
  // in this example we don't care about multiple projects

  Import import;
  import.object = new QmlJS::ObjectValue(valueOwner, "<defaults>");
  import.valid = true;
  const ComponentVersion version(1, 0);
  import.info = ImportInfo::moduleImport("MyPlugin", version,
QString());
  auto myType = valueOwner->newObject(nullptr)
  myType->setMember("myProperty", valueOwner->valueOwner->intValue());
  // add more properties & methods/signals to myType

  import.object->setMember("MyType", myType);

  // in this example we return only one, but you care return more than
one
  return QList<Import>(import);
}

Change-Id: I395c273c7b15a9e4ed5a89a81d70ff92db2b7c0c
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
2015-05-28 06:17:58 +00:00
Eike Ziller
3858c33d74 Merge remote-tracking branch 'origin/3.4'
Change-Id: I35ba4cc7f7052699c3006545514c866be3cb5fdd
2015-05-26 15:12:42 +02:00
Denis Kormalev
2105115fdf QmlJS: allProjectsInfosForPath method
Method that returns list of all project infos where this file belongs (similar to methods in cpp module).

Change-Id: I94eb86ffa5bdbee8d794377a03160418b7340662
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
2015-05-19 08:00:50 +00:00
Orgad Shaneh
6c2bcb588b QmlJS: Mark some overridden functions
Change-Id: I5c85dda01a442e4b227c846d6fa5057e1fe82939
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-05-18 17:26:04 +00:00
Kai Koehne
40dc289360 Remove QmLJSDelta class
The class was only used for the Apply on Save functionality in the
QML Debugger, which got nuked in 3bf81efbe7.

Change-Id: I1842cc07d61fe84f8da23210ebac04dd4d567fce
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-04-24 13:26:37 +00:00
Orgad Shaneh
cb350bfeb2 C++: Rename ClassOrNamespace -> LookupScope
Change-Id: Ide74482b133dd1fec40a725d9aa81bd749385f37
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-04-20 14:51:56 +00:00
Nikita Baryshnikov
12dffc6590 Qml&Js: properties/methods/enums inspection
.. of builtIn qml and cpp code over "Inspect API For Element Under
Cursor" action.

Change-Id: I70d5bec2933b682295c5242248a2b0f95dba4e76
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
2015-04-15 08:02:50 +00:00
Alessandro Portale
8983ccc284 Remove a few unneeded "QT += script"s
Change-Id: I078300c7b7a9667109754522048736c886b815ae
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
2015-04-01 08:55:16 +00:00
Alessandro Portale
1e7fa33a13 Remove a few unneeded "QT += xml"s
Must at some point in time have been changed to use QXmlStream*

Change-Id: I8ed535f51246a0917454352d459a0f24c34f4a62
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
2015-03-31 17:58:26 +00:00
Friedemann Kleint
1b9be30371 Clean headers in lib qmljs and plugins qmljstools, qmljseditor.
Change-Id: I3256db8f4d42b6326d986d754b45e6c6c2030839
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-03-05 08:17:10 +00:00
hjk
e36b40161e QmlJS: Fix crash in PathsAndLanguages::compact()
Task-number: QTCREATORBUG-13786
Change-Id: If8c84714382c751f51315d62e1d4b0764e4431ff
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
2015-03-04 09:33:19 +00:00
Orgad Shaneh
b6de2d1bd8 QmlDesigner: Remove unneeded qualifications
Mostly done using the following ruby script:
Dir.glob('**/*.cpp').each { |file|
  next if file =~ %r{src/shared/qbs|/qmljs/}
  s = File.read(file)
  s.scan(/^using namespace (.*);$/) {
    ns = $1
    t = s.gsub(/^(.*)\b#{ns}::((?!Const)[A-Z])/) { |m|
      before = $1
      char = $2
      if before =~ /"|\/\/|\\|using|SIGNAL|SLOT|Q_/
        m
      else
        before + char
      end
    }
    if t != s
      puts file
      File.open(file, 'w').write(t)
    end
  }
}

Change-Id: I492792bb9e5655c55795e938031efc557c9a462f
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
2015-02-18 09:53:25 +00:00
Fawzi Mohamed
6a120df7f7 qmljs: do not look up types in the prototypes
looking up types in prototypes leads to a recursive blowup when resolving
the prototype of a type returns (for incorrect code) the type itself.

Change-Id: Iebcbdda7554e5fe01f0ef323ccc2079888c7ef4e
Task-number: QTCREATORBUG-13906
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
2015-02-16 15:15:33 +00:00