Commit 556b3da1 authored by Pierre Rossi's avatar Pierre Rossi
Browse files

Merge branch '2.0' of scm.dev.nokia.troll.no:creator/mainline into 2.0

parents 26fbb865 830686f2
......@@ -10,7 +10,8 @@ defines = Q_QDOC \
Q_BYTE_ORDER \
QT_DEPRECATED \
Q_NO_USING_KEYWORD \
__cplusplus
__cplusplus \
qtquick
versionsym = QT_VERSION_STR
......
......@@ -18,10 +18,10 @@
and developers to create applications for multiple desktop and mobile device
platforms.
For application designers, Qt Creator provides an integrated
visual editor, \QD,
For application designers, Qt Creator provides integrated
visual editors, \QD
\if defined(qtquick)
and \QMLD
and \QMLD,
\endif
that you can use to design and develop
application user interfaces.
......
......@@ -1385,7 +1385,6 @@ QList<const ObjectValue *> ScopeChain::all() const
Context::Context(Engine *engine)
: _engine(engine),
_lookupMode(JSLookup),
_qmlScopeObjectIndex(-1),
_qmlScopeObjectSet(false)
{
......@@ -1410,16 +1409,6 @@ ScopeChain &Context::scopeChain()
return _scopeChain;
}
Context::LookupMode Context::lookupMode() const
{
return _lookupMode;
}
void Context::setLookupMode(LookupMode lookupMode)
{
_lookupMode = lookupMode;
}
const ObjectValue *Context::typeEnvironment(const QmlJS::Document *doc) const
{
return _typeEnvironments.value(doc->fileName(), 0);
......@@ -1437,9 +1426,7 @@ const Value *Context::lookup(const QString &name)
const ObjectValue *scope = scopes.at(index);
if (const Value *member = scope->lookupMember(name, this)) {
if (_lookupMode == JSLookup || ! dynamic_cast<const ASTVariableReference *>(member)) {
return member;
}
return member;
}
}
......
......@@ -270,12 +270,6 @@ private:
class QMLJS_EXPORT Context
{
public:
enum LookupMode {
JSLookup,
QmlLookup
};
public:
Context(Engine *engine);
~Context();
......@@ -284,9 +278,6 @@ public:
const ScopeChain &scopeChain() const;
ScopeChain &scopeChain();
LookupMode lookupMode() const;
void setLookupMode(LookupMode lookupMode);
const ObjectValue *typeEnvironment(const Document *doc) const;
void setTypeEnvironment(const Document *doc, const ObjectValue *typeEnvironment);
......@@ -307,7 +298,6 @@ private:
typedef QHash<QString, const Value *> Properties;
Engine *_engine;
LookupMode _lookupMode;
QHash<const ObjectValue *, Properties> _properties;
QHash<QString, const ObjectValue *> _typeEnvironments;
QSet<QString> _documentsImportingPlugins;
......
......@@ -54,8 +54,6 @@ void Link::initializeScopeChain()
QHash<Document *, ScopeChain::QmlComponentChain *> componentScopes;
if (_doc->qmlProgram()) {
_context->setLookupMode(Context::QmlLookup);
scopeChain.qmlComponentScope.clear();
componentScopes.insert(_doc.data(), &scopeChain.qmlComponentScope);
makeComponentChain(_doc, &scopeChain.qmlComponentScope, &componentScopes);
......
......@@ -422,8 +422,9 @@ void BinEditor::setLazyData(quint64 startAddr, int range, int blockSize)
m_baseAddr = static_cast<quint64>(range/2) > startAddr
? 0 : startAddr - range/2;
m_baseAddr = (m_baseAddr / blockSize) * blockSize;
m_size = m_baseAddr != 0 && static_cast<quint64>(range) >= -m_baseAddr
? -m_baseAddr : range;
const quint64 maxRange = Q_UINT64_C(0xffffffffffffffff) - m_baseAddr + 1;
m_size = m_baseAddr != 0 && static_cast<quint64>(range) >= maxRange
? maxRange : range;
m_addressBytes = (m_baseAddr + m_size < quint64(1) << 32
&& m_baseAddr + m_size >= m_baseAddr) ? 4 : 8;
......
......@@ -397,12 +397,14 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
if (!m_helpId.isEmpty() && !helpLinks.isEmpty()) {
if (showF1) {
m_toolTip = QString(QLatin1String("<table><tr><td valign=middle><nobr>%1</td>"
// we need the original width without escape sequences
const int width = QFontMetrics(QToolTip::font()).width(m_toolTip);
m_toolTip = QString(QLatin1String("<table><tr><td valign=middle width=%2>%1</td>"
"<td><img src=\":/cppeditor/images/f1.png\"></td></tr></table>"))
.arg(Qt::escape(m_toolTip));
.arg(Qt::escape(m_toolTip)).arg(width);
}
editor->setContextHelpId(m_helpId);
} else if (!m_toolTip.isEmpty() && Qt::mightBeRichText(m_toolTip)) {
m_toolTip = QString(QLatin1String("<nobr>%1")).arg(Qt::escape(m_toolTip));
m_toolTip = QString(QLatin1String("<nobr>%1</nobr>")).arg(Qt::escape(m_toolTip));
}
}
......@@ -587,12 +587,12 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
Qt::ItemFlags BreakHandler::flags(const QModelIndex &mi) const
{
switch (mi.column()) {
//switch (mi.column()) {
//case 0:
// return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled;
default:
//default:
return QAbstractTableModel::flags(mi);
}
//}
}
bool BreakHandler::setData(const QModelIndex &mi, const QVariant &value, int role)
......
......@@ -360,6 +360,7 @@ void DesignModeWidget::readSettings()
if (settings->contains("MainSplitter")) {
const QByteArray splitterState = settings->value("MainSplitter").toByteArray();
m_mainSplitter->restoreState(splitterState);
m_mainSplitter->setOpaqueResize(); // force opaque resize since it used to be off
}
settings->endGroup();
}
......@@ -697,7 +698,6 @@ void DesignModeWidget::setup()
m_mainSplitter->addWidget(m_rightSideBar);
// Finishing touches:
m_mainSplitter->setOpaqueResize(false);
m_mainSplitter->setStretchFactor(1, 1);
m_mainSplitter->setSizes(QList<int>() << 150 << 300 << 150);
......
......@@ -208,9 +208,7 @@ public:
private:
void insertProperty(const QString &name, const Interpreter::Value *value)
{
if (_context->lookupMode() == Interpreter::Context::JSLookup ||
! dynamic_cast<const Interpreter::ASTVariableReference *>(value))
_properties.insert(name, value);
_properties.insert(name, value);
}
virtual bool processProperty(const QString &name, const Interpreter::Value *value)
......
......@@ -10,6 +10,7 @@ class QmlProjectItemPrivate : public QObject {
public:
QString sourceDirectory;
QStringList importPaths;
QStringList absoluteImportPaths;
QList<QmlFileFilterItem*> qmlFileFilters() const;
......@@ -77,23 +78,34 @@ void QmlProjectItem::setSourceDirectory(const QString &directoryPath)
}
}
setImportPaths(d->importPaths);
emit sourceDirectoryChanged();
}
QStringList QmlProjectItem::importPaths() const
{
Q_D(const QmlProjectItem);
return d->importPaths;
return d->absoluteImportPaths;
}
void QmlProjectItem::setImportPaths(const QStringList &importPaths)
{
Q_D(QmlProjectItem);
if (d->importPaths == importPaths)
if (d->importPaths != importPaths)
d->importPaths = importPaths;
// convert to absolute paths
QStringList absoluteImportPaths;
const QDir sourceDir(sourceDirectory());
foreach (const QString &importPath, importPaths)
absoluteImportPaths += QDir::cleanPath(sourceDir.absoluteFilePath(importPath));
if (d->absoluteImportPaths == absoluteImportPaths)
return;
d->importPaths = importPaths;
d->absoluteImportPaths = absoluteImportPaths;
emit importPathsChanged();
}
......
......@@ -156,7 +156,7 @@ Core::GeneratedFiles QmlProjectApplicationWizard::generateFiles(const QWizard *w
<< " }" << endl
//: Comment added to generated .qmlproject file
<< " /* " << tr("List of plugin directories passed to QML runtime", "qmlproject Template") << " */" << endl
<< " // importPaths: [ \" ../exampleplugin \" ]" << endl
<< " // importPaths: [ \"../exampleplugin\" ]" << endl
<< "}" << endl;
}
Core::GeneratedFile generatedCreatorFile(creatorFileName);
......
......@@ -172,7 +172,7 @@ Core::GeneratedFiles QmlProjectImportWizard::generateFiles(const QWizard *w,
<< " }" << endl
//: Comment added to generated .qmlproject file
<< " /* " << tr("List of plugin directories passed to QML runtime", "qmlproject Template") << " */" << endl
<< " // importPaths: [ \" ../exampleplugin \" ]" << endl
<< " // importPaths: [ \"../exampleplugin\" ]" << endl
<< "}" << endl;
}
Core::GeneratedFile generatedCreatorFile(creatorFileName);
......
......@@ -1211,9 +1211,22 @@ void ProFileEvaluator::Private::visitProVariable(ProVariable *var)
m_valuemapStack.top()[varName] = varVal;
m_filevaluemap[currentProFile()][varName] = varVal;
}
} else {
// We are greedy for values.
valuesRef(varName) += varVal;
} else if (!varVal.isEmpty()) {
// We are greedy for values. But avoid exponential growth.
QStringList &v = valuesRef(varName);
if (v.isEmpty()) {
v = varVal;
} else {
QStringList old = v;
v = varVal;
QSet<QString> has = v.toSet();
v.reserve(v.size() + old.size());
foreach (const QString &s, old)
if (!has.contains(s))
v << s;
}
// These values will not be used for further processing inside
// the evaluator. Duplicate elimination happens later.
m_filevaluemap[currentProFile()][varName] += varVal;
}
break;
......@@ -3346,7 +3359,7 @@ ProFileEvaluator::TemplateType ProFileEvaluator::templateType()
{
QStringList templ = values(statics.strTEMPLATE);
if (templ.count() >= 1) {
const QString &t = templ.last();
const QString &t = templ.at(0);
if (!t.compare(QLatin1String("app"), Qt::CaseInsensitive))
return TT_Application;
if (!t.compare(QLatin1String("lib"), Qt::CaseInsensitive))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment