Merge remote branch 'origin/2.0'

This commit is contained in:
con
2010-04-30 16:39:05 +02:00
13 changed files with 67 additions and 8 deletions

View File

@@ -31,6 +31,9 @@ CompletionContextFinder::CompletionContextFinder(const QTextCursor &cursor)
break;
}
if (m_startTokenIndex == yyLinizerState.tokens.size() - 1 && yyLinizerState.insertedSemicolon)
--m_startTokenIndex;
getQmlObjectTypeName(m_startTokenIndex);
checkBinding();
}

View File

@@ -569,6 +569,9 @@ int QmlJSIndenter::indentForStandaloneLine()
*/
int QmlJSIndenter::indentForBottomLine(QTextBlock begin, QTextBlock end, QChar typedIn)
{
if (begin == end)
return 0;
const QTextBlock last = end.previous();
initialize(begin, last);

View File

@@ -208,6 +208,7 @@ QString LineInfo::trimmedCodeLine(const QString &t)
const Token sc(trimmed.size(), 1, Token::Semicolon);
yyLinizerState.tokens.append(sc);
trimmed.append(QLatin1Char(';'));
yyLinizerState.insertedSemicolon = true;
}
}
@@ -276,6 +277,8 @@ bool LineInfo::readLine()
(firstNonWhiteSpace(yyLinizerState.line) == QLatin1Char('{'));
do {
yyLinizerState.insertedSemicolon = false;
if (yyLinizerState.iter == yyProgram.firstBlock()) {
yyLinizerState.line.clear();
return false;
@@ -332,6 +335,7 @@ void LineInfo::startLinizer()
{
yyLinizerState.braceDepth = 0;
yyLinizerState.pendingRightBrace = false;
yyLinizerState.insertedSemicolon = false;
yyLine = &yyLinizerState.line;
yyBraceDepth = &yyLinizerState.braceDepth;
@@ -564,9 +568,6 @@ bool LineInfo::isContinuationLine()
void LineInfo::initialize(QTextBlock begin, QTextBlock end)
{
if (begin == end)
return;
yyProgram = Program(begin, end);
startLinizer();
}

View File

@@ -84,12 +84,14 @@ protected:
LinizerState()
: braceDepth(0),
leftBraceFollows(false),
pendingRightBrace(false)
pendingRightBrace(false),
insertedSemicolon(false)
{ }
int braceDepth;
bool leftBraceFollows;
bool pendingRightBrace;
bool insertedSemicolon;
QString line;
QList<Token> tokens;
QTextBlock iter;

View File

@@ -79,6 +79,8 @@ RegisterPostMortemAction::RegisterPostMortemAction(QObject *parent) : Utils::Sav
void RegisterPostMortemAction::readSettings(const QSettings *)
{
Q_UNUSED(debuggerRegistryValueNameC); // avoid warning from MinGW
bool registered = false;
HKEY handle = 0;
QString errorMessage;

View File

@@ -690,7 +690,6 @@ int CodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
if (contextFinder.isInRhsOfBinding() && qmlScopeType) {
doQmlKeywordCompletion = false;
qDebug() << "property name: " << contextFinder.bindingPropertyName();
if (!contextFinder.bindingPropertyName().isEmpty()) {
const Interpreter::Value *value = qmlScopeType;

View File

@@ -96,6 +96,7 @@ const char * const DESKTOP_TARGET_ID("Qt4ProjectManager.Target.DesktopTarget");
const char * const S60_EMULATOR_TARGET_ID("Qt4ProjectManager.Target.S60EmulatorTarget");
const char * const S60_DEVICE_TARGET_ID("Qt4ProjectManager.Target.S60DeviceTarget");
const char * const MAEMO_DEVICE_TARGET_ID("Qt4ProjectManager.Target.MaemoDeviceTarget");
const char * const QT_SIMULATOR_TARGET_ID("Qt4ProjectManager.Target.QtSimulatorTarget");
} // namespace Constants
} // namespace Qt4ProjectManager

View File

@@ -65,6 +65,8 @@ QString displayNameForId(const QString &id) {
return QApplication::translate("Qt4ProjectManager::Internal::Qt4Target", "Symbian Device", "Qt4 Symbian Device target display name");
if (id == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
return QApplication::translate("Qt4ProjectManager::Internal::Qt4Target", "Maemo", "Qt4 Maemo target display name");
if (id == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
return QApplication::translate("Qt4ProjectManager::Internal::Qt4Target", "Qt Simulator", "Qt4 Simulator target display name");
return QString();
}
@@ -77,6 +79,8 @@ QIcon iconForId(const QString &id) {
return QIcon(":/projectexplorer/images/SymbianDevice.png");
if (id == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
return QIcon(":/projectexplorer/images/MaemoDevice.png");
if (id == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
return QIcon(":/projectexplorer/images/SymbianEmulator.png");
return QIcon();
}
@@ -315,7 +319,8 @@ Qt4BuildConfigurationFactory *Qt4Target::buildConfigurationFactory() const
void Qt4Target::addRunConfigurationForPath(const QString &proFilePath)
{
if (id() == QLatin1String(Constants::DESKTOP_TARGET_ID))
if (id() == QLatin1String(Constants::DESKTOP_TARGET_ID) ||
id() == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
addRunConfiguration(new Qt4RunConfiguration(this, proFilePath));
else if (id() == QLatin1String(Constants::S60_EMULATOR_TARGET_ID))
addRunConfiguration(new S60EmulatorRunConfiguration(this, proFilePath));
@@ -370,6 +375,8 @@ QString Qt4Target::defaultBuildDirectory() const
shortName = QLatin1String("symbian");
else if (id() == QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))
shortName = QLatin1String("maemo");
else if (id() == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
shortName = QLatin1String("simulator");
// currently we can't have the build directory to be deeper then the source directory
// since that is broken in qmake

View File

@@ -528,6 +528,8 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
envs = tr("Symbian", "Qt Version is meant for Symbian");
else if (targets.contains(Constants::MAEMO_DEVICE_TARGET_ID))
envs = tr("Maemo", "Qt Version is meant for Maemo");
else if (targets.contains(Constants::QT_SIMULATOR_TARGET_ID))
envs = tr("Qt Simulator", "Qt Version is meant for Qt Simulator");
else
envs = tr("unkown", "No idea what this Qt Version is meant for!");
m_ui->errorLabel->setText(tr("Found Qt version %1, using mkspec %2 (%3)")

View File

@@ -47,6 +47,7 @@
#include <help/helpmanager.h>
#include <utils/qtcassert.h>
#include <QtCore/QFile>
#include <QtCore/QProcess>
#include <QtCore/QSettings>
#include <QtCore/QTime>
@@ -1196,7 +1197,8 @@ bool QtVersion::supportsMobileTarget() const
{
return supportsTargetId(Constants::S60_DEVICE_TARGET_ID) ||
supportsTargetId(Constants::S60_EMULATOR_TARGET_ID) ||
supportsTargetId(Constants::MAEMO_DEVICE_TARGET_ID);
supportsTargetId(Constants::MAEMO_DEVICE_TARGET_ID) ||
supportsTargetId(Constants::QT_SIMULATOR_TARGET_ID);
}
QList<QSharedPointer<ProjectExplorer::ToolChain> > QtVersion::toolChains() const
@@ -1420,6 +1422,31 @@ void QtVersion::updateToolChainAndMkspec() const
delete reader;
ProFileCacheManager::instance()->decRefCount();
m_toolChainUpToDate = true;
// Check qconfig.h for QT_SIMULATOR define on desktop builds and switch the
// Qt version to Qt simulator target:
if (m_targetIds.contains(Constants::DESKTOP_TARGET_ID)) {
QString path(headerInstallPath());
path.append(QLatin1String("/Qt/qconfig.h"));
QFile qconfig(path);
if (!qconfig.exists())
return;
qconfig.open(QIODevice::ReadOnly);
QTextStream stream(&qconfig);
QString line;
bool isSimulator = false;
while (!(line = stream.readLine()).isNull()) {
if (line.startsWith(QLatin1String("#define QT_SIMULATOR"))) {
isSimulator = true;
break;
}
}
qconfig.close();
if (isSimulator) {
m_targetIds.remove(QLatin1String(Constants::DESKTOP_TARGET_ID));
m_targetIds.insert(QLatin1String(Constants::QT_SIMULATOR_TARGET_ID));
}
}
}
QString QtVersion::mwcDirectory() const
@@ -1590,6 +1617,12 @@ QString QtVersion::demosPath() const
return m_versionInfo["QT_INSTALL_DEMOS"];
}
QString QtVersion::headerInstallPath() const
{
updateVersionInfo();
return m_versionInfo["QT_INSTALL_HEADERS"];
}
bool QtVersion::hasExamples() const
{
updateVersionInfo();

View File

@@ -123,6 +123,8 @@ public:
bool hasDemos() const;
QString demosPath() const;
QString headerInstallPath() const;
// All valid Ids are >= 0
int uniqueId() const;
bool isQt64Bit() const;

View File

@@ -245,8 +245,11 @@ bool TargetSetupPage::setupProject(Qt4ProjectManager::Qt4Project *project)
if (!targetInfos.isEmpty())
target = project->targetFactory()->create(project, targetId, targetInfos);
if (target)
if (target) {
project->addTarget(target);
if (target->id() == QLatin1String(Constants::QT_SIMULATOR_TARGET_ID))
project->setActiveTarget(target);
}
}
// Create the default target if nothing else was set up:

View File

@@ -104,6 +104,7 @@ bool openRegistryKey(HKEY category, // HKEY_LOCAL_MACHINE, etc.
HKEY *keyHandle,
QString *errorMessage)
{
Q_UNUSED(debuggerRegistryKeyC); // avoid warning from MinGW
REGSAM accessRights = KEY_READ;
if (readWrite)