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

Conflicts:
	doc/qtcreator.qdoc
	doc/qtcreator.qdocconf
	share/qtcreator/gdbmacros/dumper.py
	share/qtcreator/gdbmacros/gdbmacros.py
	src/plugins/debugger/debuggermanager.cpp
	src/plugins/debugger/gdb/attachgdbadapter.cpp
	src/plugins/debugger/gdb/gdbengine.cpp
	src/plugins/debugger/watchhandler.cpp
	src/plugins/mercurial/mercurialjobrunner.h
	src/plugins/qmljseditor/qmljseditor.cpp
	src/plugins/qmljseditor/qmljseditor.pro
	src/plugins/qmljseditor/qmljseditorplugin.cpp
	src/plugins/qmljseditor/qmljseditorplugin.h
	src/plugins/qmljseditor/qmljspreviewrunner.cpp
	src/plugins/qmljseditor/qmljspreviewrunner.h
	src/plugins/qmlprojectmanager/QmlProjectManager.pluginspec
	src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
	src/plugins/qt4projectmanager/qt-maemo/qemuruntimemanager.cpp
	src/plugins/qt4projectmanager/qt4projectmanager.pro
	src/plugins/qt4projectmanager/qtversionmanager.h
	src/plugins/qt4projectmanager/wizards/targetsetuppage.cpp
	src/plugins/qt4projectmanager/wizards/targetsetuppage.h
This commit is contained in:
Kai Koehne
2010-08-23 16:00:24 +02:00
49 changed files with 4742 additions and 5519 deletions

View File

@@ -41,6 +41,8 @@
#include <coreplugin/ifile.h>
#include <utils/synchronousprocess.h>
#include <utils/pathchooser.h>
#include <qt4projectmanager/qtversionmanager.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <QFormLayout>
#include <QComboBox>
@@ -94,27 +96,11 @@ void QmlProjectRunConfiguration::ctor()
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(changeCurrentFile(Core::IEditor*)));
Qt4ProjectManager::QtVersionManager *qtVersions = Qt4ProjectManager::QtVersionManager::instance();
connect(qtVersions, SIGNAL(qtVersionsChanged(QList<int>)), this, SLOT(updateEnabled()));
connect(qtVersions, SIGNAL(qtVersionsChanged(QList<int>)), this, SLOT(onViewerChanged()));
setDisplayName(tr("QML Viewer", "QMLRunConfiguration display name."));
#ifdef Q_OS_MAC
const QString qmlObserverName = QLatin1String("QMLObserver.app");
#else
const QString qmlObserverName = QLatin1String("qmlobserver");
#endif
if (m_qmlViewerDefaultPath.isEmpty()) {
QDir qmlviewerExecutable(QCoreApplication::applicationDirPath());
#ifdef Q_OS_WIN
m_qmlViewerDefaultPath = qmlviewerExecutable.absoluteFilePath(qmlObserverName + QLatin1String(".exe"));
#else
m_qmlViewerDefaultPath = qmlviewerExecutable.absoluteFilePath(qmlObserverName);
#endif
QFileInfo qmlviewerFileInfo(m_qmlViewerDefaultPath);
if (!qmlviewerFileInfo.exists()) {
qWarning() << "QmlProjectRunConfiguration::ctor(): QML Viewer executable does not exist at" << m_qmlViewerDefaultPath;
m_qmlViewerDefaultPath.clear();
}
}
}
QmlProjectRunConfiguration::~QmlProjectRunConfiguration()
@@ -135,7 +121,8 @@ QString QmlProjectRunConfiguration::viewerPath() const
{
if (!m_qmlViewerCustomPath.isEmpty())
return m_qmlViewerCustomPath;
return m_qmlViewerDefaultPath;
return viewerDefaultPath();
}
QStringList QmlProjectRunConfiguration::viewerArguments() const
@@ -188,9 +175,13 @@ QWidget *QmlProjectRunConfiguration::createConfigurationWidget()
Utils::PathChooser *qmlViewer = new Utils::PathChooser;
qmlViewer->setExpectedKind(Utils::PathChooser::Command);
qmlViewer->setPath(viewerPath());
qmlViewer->setPath(m_qmlViewerCustomPath);
connect(qmlViewer, SIGNAL(changed(QString)), this, SLOT(onViewerChanged()));
m_qmlViewerExecutable = new QLabel;
m_qmlViewerExecutable.data()->setText(viewerPath() + " " + m_qmlViewerArgs);
QLineEdit *qmlViewerArgs = new QLineEdit;
qmlViewerArgs->setText(m_qmlViewerArgs);
connect(qmlViewerArgs, SIGNAL(textChanged(QString)), this, SLOT(onViewerArgsChanged()));
@@ -207,10 +198,12 @@ QWidget *QmlProjectRunConfiguration::createConfigurationWidget()
form->addRow(tr("Custom QML Viewer:"), qmlViewer);
form->addRow(tr("QML Viewer arguments:"), qmlViewerArgs);
form->addRow(tr("Main QML File:"), m_fileListCombo.data());
form->addRow(QString(), m_qmlViewerExecutable.data());
form->addRow(tr("Debugging Address:"), debugServer);
form->addRow(tr("Debugging Port:"), debugPort);
form->addRow(tr("Main QML File:"), m_fileListCombo.data());
return config;
}
@@ -274,7 +267,7 @@ void QmlProjectRunConfiguration::setMainScript(const QString &scriptFile)
} else {
m_usingCurrentFile = false;
m_mainScriptFilename = qmlTarget()->qmlProject()->projectDir().absoluteFilePath(scriptFile);
setEnabled(true);
updateEnabled();
}
}
@@ -283,12 +276,19 @@ void QmlProjectRunConfiguration::onViewerChanged()
if (Utils::PathChooser *chooser = qobject_cast<Utils::PathChooser *>(sender())) {
m_qmlViewerCustomPath = chooser->path();
}
if (!m_qmlViewerExecutable.isNull()) {
m_qmlViewerExecutable.data()->setText(viewerPath() + " " + m_qmlViewerArgs);
}
}
void QmlProjectRunConfiguration::onViewerArgsChanged()
{
if (QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender()))
m_qmlViewerArgs = lineEdit->text();
if (!m_qmlViewerExecutable.isNull()) {
m_qmlViewerExecutable.data()->setText(viewerPath() + " " + m_qmlViewerArgs);
}
}
void QmlProjectRunConfiguration::onDebugServerPortChanged()
@@ -322,40 +322,98 @@ bool QmlProjectRunConfiguration::fromMap(const QVariantMap &map)
return RunConfiguration::fromMap(map);
}
void QmlProjectRunConfiguration::changeCurrentFile(Core::IEditor *editor)
void QmlProjectRunConfiguration::changeCurrentFile(Core::IEditor * /*editor*/)
{
updateEnabled();
}
void QmlProjectRunConfiguration::updateEnabled()
{
bool qmlFileFound = false;
if (m_usingCurrentFile) {
bool enable = false;
Core::IEditor *editor = Core::EditorManager::instance()->currentEditor();
if (editor) {
m_currentFileFilename = editor->file()->fileName();
if (Core::ICore::instance()->mimeDatabase()->findByFile(mainScript()).type() == QLatin1String("application/x-qml"))
enable = true;
qmlFileFound = true;
}
if (!editor
|| Core::ICore::instance()->mimeDatabase()->findByFile(mainScript()).type() == QLatin1String("application/x-qmlproject")) {
// find a qml file with lowercase filename. This is slow but only done in initialization/other border cases.
foreach(const QString& filename, m_projectTarget->qmlProject()->files()) {
foreach(const QString &filename, m_projectTarget->qmlProject()->files()) {
const QFileInfo fi(filename);
if (!filename.isEmpty() && fi.baseName()[0].isLower()
&& Core::ICore::instance()->mimeDatabase()->findByFile(fi).type() == QLatin1String("application/x-qml"))
{
m_currentFileFilename = filename;
enable = true;
qmlFileFound = true;
break;
}
}
}
} else { // use default one
qmlFileFound = !m_mainScriptFilename.isEmpty();
}
setEnabled(enable);
bool newValue = QFileInfo(viewerPath()).exists() && qmlFileFound;
if (m_isEnabled != newValue) {
m_isEnabled = newValue;
emit isEnabledChanged(m_isEnabled);
}
}
void QmlProjectRunConfiguration::setEnabled(bool value)
QString QmlProjectRunConfiguration::viewerDefaultPath() const
{
m_isEnabled = value;
emit isEnabledChanged(m_isEnabled);
QString path;
// Search for QmlObserver
#ifdef Q_OS_MAC
const QString qmlObserverName = QLatin1String("QMLObserver.app");
#else
const QString qmlObserverName = QLatin1String("qmlobserver");
#endif
QDir appDir(QCoreApplication::applicationDirPath());
QString qmlObserverPath;
#ifdef Q_OS_WIN
qmlObserverPath = appDir.absoluteFilePath(qmlObserverName + QLatin1String(".exe"));
#else
qmlObserverPath = appDir.absoluteFilePath(qmlObserverName);
#endif
if (QFileInfo(qmlObserverPath).exists()) {
return qmlObserverPath;
}
// Search for QmlViewer
// prepend creator/bin dir to search path (only useful for special creator-qml package)
const QString searchPath = QCoreApplication::applicationDirPath()
+ Utils::SynchronousProcess::pathSeparator()
+ QString::fromLocal8Bit(qgetenv("PATH"));
#ifdef Q_OS_MAC
const QString qmlViewerName = QLatin1String("QMLViewer");
#else
const QString qmlViewerName = QLatin1String("qmlviewer");
#endif
path = Utils::SynchronousProcess::locateBinary(searchPath, qmlViewerName);
if (!path.isEmpty())
return path;
// Try to locate default path in Qt Versions
Qt4ProjectManager::QtVersionManager *qtVersions = Qt4ProjectManager::QtVersionManager::instance();
foreach (Qt4ProjectManager::QtVersion *version, qtVersions->validVersions()) {
if (!version->qmlviewerCommand().isEmpty()
&& version->supportsTargetId(Qt4ProjectManager::Constants::DESKTOP_TARGET_ID)) {
return version->qmlviewerCommand();
}
}
return path;
}
} // namespace QmlProjectManager