Merge remote branch 'origin/2.1'

Conflicts:
	share/qtcreator/templates/mobileapp/app.pro
	share/qtcreator/templates/qmlapp/app.pro
	src/plugins/cpptools/cpptools.pro
This commit is contained in:
dt
2010-10-04 16:07:46 +02:00
386 changed files with 12674 additions and 4573 deletions

View File

@@ -53,10 +53,10 @@ ClientProxy::ClientProxy(Debugger::QmlAdapter *adapter, QObject *parent)
, m_designClient(0)
, m_engineQuery(0)
, m_contextQuery(0)
, m_isConnected(false)
{
m_requestObjectsTimer.setSingleShot(true);
m_requestObjectsTimer.setInterval(3000);
connect(m_adapter, SIGNAL(aboutToDisconnect()), SLOT(disconnectFromServer()));
connect(m_client, SIGNAL(newObjects()), this, SLOT(newObjects()));
connect(&m_requestObjectsTimer, SIGNAL(timeout()), this, SLOT(refreshObjectTree()));
connectToServer();
@@ -65,8 +65,12 @@ ClientProxy::ClientProxy(Debugger::QmlAdapter *adapter, QObject *parent)
void ClientProxy::connectToServer()
{
m_designClient = new QmlJSObserverClient(m_adapter->connection(), this);
emit connected();
m_adapter->logServiceStatusChange(m_designClient->name(), m_designClient->status());
connect(m_designClient, SIGNAL(connectedStatusChanged(QDeclarativeDebugClient::Status)),
this, SLOT(clientStatusChanged(QDeclarativeDebugClient::Status)));
connect(m_designClient, SIGNAL(currentObjectsChanged(QList<int>)),
SLOT(onCurrentObjectsChanged(QList<int>)));
connect(m_designClient, SIGNAL(colorPickerActivated()),
@@ -87,12 +91,27 @@ void ClientProxy::connectToServer()
SIGNAL(selectedColorChanged(QColor)));
connect(m_designClient, SIGNAL(contextPathUpdated(QStringList)),
SIGNAL(contextPathUpdated(QStringList)));
reloadEngines();
updateConnected();
}
void ClientProxy::clientStatusChanged(QDeclarativeDebugClient::Status status)
{
QString serviceName;
if (QDeclarativeDebugClient *client = qobject_cast<QDeclarativeDebugClient*>(sender())) {
serviceName = client->name();
}
m_adapter->logServiceStatusChange(serviceName, status);
updateConnected();
}
void ClientProxy::disconnectFromServer()
{
if (m_designClient) {
disconnect(m_designClient, SIGNAL(connectedStatusChanged(QDeclarativeDebugClient::Status)),
this, SLOT(clientStatusChanged(QDeclarativeDebugClient::Status)));
disconnect(m_designClient, SIGNAL(currentObjectsChanged(QList<int>)),
this, SLOT(onCurrentObjectsChanged(QList<int>)));
disconnect(m_designClient, SIGNAL(colorPickerActivated()),
@@ -111,8 +130,6 @@ void ClientProxy::disconnectFromServer()
this, SIGNAL(selectedColorChanged(QColor)));
disconnect(m_designClient, SIGNAL(contextPathUpdated(QStringList)),
this, SIGNAL(contextPathUpdated(QStringList)));
disconnect(m_designClient, SIGNAL(treeRefreshRequested()),
this, SLOT(refreshObjectTree()));
delete m_designClient;
m_designClient = 0;
@@ -128,6 +145,8 @@ void ClientProxy::disconnectFromServer()
qDeleteAll(m_objectTreeQuery);
m_objectTreeQuery.clear();
updateConnected();
}
void ClientProxy::refreshObjectTree()
@@ -164,7 +183,7 @@ void ClientProxy::onCurrentObjectsChanged(const QList< int >& debugIds, bool req
void ClientProxy::setSelectedItemsByObjectId(const QList<QDeclarativeDebugObjectReference> &objectRefs)
{
if (isConnected() && m_designClient)
if (isConnected())
m_designClient->setSelectedItemsByObjectId(objectRefs);
}
@@ -285,7 +304,7 @@ QDeclarativeDebugExpressionQuery *ClientProxy::queryExpressionResult(int objectD
void ClientProxy::clearComponentCache()
{
if (isDesignClientConnected())
if (isConnected())
m_designClient->clearComponentCache();
}
@@ -365,7 +384,7 @@ void ClientProxy::objectTreeFetched(QDeclarativeDebugQuery::State state)
buildDebugIdHashRecursive(it);
emit objectTreeUpdated();
if (isDesignClientConnected()) {
if (isConnected()) {
if (!m_designClient->selectedItemIds().isEmpty())
onCurrentObjectsChanged(m_designClient->selectedItemIds(), false);
@@ -410,74 +429,84 @@ void ClientProxy::buildDebugIdHashRecursive(const QDeclarativeDebugObjectReferen
void ClientProxy::reloadQmlViewer()
{
if (isDesignClientConnected())
if (isConnected())
m_designClient->reloadViewer();
}
void ClientProxy::setDesignModeBehavior(bool inDesignMode)
{
if (isDesignClientConnected())
if (isConnected())
m_designClient->setDesignModeBehavior(inDesignMode);
}
void ClientProxy::setAnimationSpeed(qreal slowdownFactor)
{
if (isDesignClientConnected())
if (isConnected())
m_designClient->setAnimationSpeed(slowdownFactor);
}
void ClientProxy::changeToColorPickerTool()
{
if (isDesignClientConnected())
if (isConnected())
m_designClient->changeToColorPickerTool();
}
void ClientProxy::changeToZoomTool()
{
if (isDesignClientConnected())
if (isConnected())
m_designClient->changeToZoomTool();
}
void ClientProxy::changeToSelectTool()
{
if (isDesignClientConnected())
if (isConnected())
m_designClient->changeToSelectTool();
}
void ClientProxy::changeToSelectMarqueeTool()
{
if (isDesignClientConnected())
if (isConnected())
m_designClient->changeToSelectMarqueeTool();
}
void ClientProxy::createQmlObject(const QString &qmlText, int parentDebugId,
const QStringList &imports, const QString &filename)
{
if (isDesignClientConnected())
if (isConnected())
m_designClient->createQmlObject(qmlText, parentDebugId, imports, filename);
}
void ClientProxy::destroyQmlObject(int debugId)
{
if (isDesignClientConnected())
if (isConnected())
m_designClient->destroyQmlObject(debugId);
}
void ClientProxy::reparentQmlObject(int debugId, int newParent)
{
if (isDesignClientConnected())
if (isConnected())
m_designClient->reparentQmlObject(debugId, newParent);
}
void ClientProxy::setContextPathIndex(int contextIndex)
{
if (isDesignClientConnected())
if (isConnected())
m_designClient->setContextPathIndex(contextIndex);
}
bool ClientProxy::isDesignClientConnected() const
void ClientProxy::updateConnected()
{
return (m_designClient && m_adapter->isConnected());
bool isConnected = m_designClient && m_designClient->status() == QDeclarativeDebugClient::Enabled
&& m_client && m_client->status() == QDeclarativeEngineDebug::Enabled;
if (isConnected != m_isConnected) {
m_isConnected = isConnected;
if (isConnected) {
emit connected();
reloadEngines();
} else {
emit disconnected();
}
}
}
void ClientProxy::reloadEngines()
@@ -518,7 +547,7 @@ Debugger::QmlAdapter *ClientProxy::qmlAdapter() const
bool ClientProxy::isConnected() const
{
return m_adapter->isConnected();
return m_isConnected;
}
void ClientProxy::newObjects()

View File

@@ -92,7 +92,6 @@ signals:
void selectedItemsChanged(const QList<QDeclarativeDebugObjectReference> &selectedItems);
void connected();
void aboutToDisconnect();
void disconnected();
void colorPickerActivated();
@@ -125,6 +124,7 @@ public slots:
private slots:
void disconnectFromServer();
void connectToServer();
void clientStatusChanged(QDeclarativeDebugClient::Status status);
void contextChanged();
@@ -135,7 +135,7 @@ private slots:
void newObjects();
private:
bool isDesignClientConnected() const;
void updateConnected();
void reloadEngines();
QList<QDeclarativeDebugObjectReference> objectReferences(const QDeclarativeDebugObjectReference &objectRef) const;
@@ -157,6 +157,8 @@ private:
QList<QDeclarativeDebugEngineReference> m_engines;
QTimer m_requestObjectsTimer;
DebugIdHash m_debugIdHash;
bool m_isConnected;
};
} // namespace Internal

View File

@@ -501,6 +501,20 @@ void InspectorUi::setSelectedItemsByObjectReference(QList<QDeclarativeDebugObjec
gotoObjectReferenceDefinition(objectReferences.first());
}
void InspectorUi::enable()
{
m_toolbar->enable();
m_crumblePath->setEnabled(true);
m_objectTreeWidget->setEnabled(true);
}
void InspectorUi::disable()
{
m_toolbar->disable();
m_crumblePath->setEnabled(false);
m_objectTreeWidget->setEnabled(false);
}
void InspectorUi::gotoObjectReferenceDefinition(const QDeclarativeDebugObjectReference &obj)
{
Q_UNUSED(obj);
@@ -686,8 +700,8 @@ void InspectorUi::disableLivePreview()
void InspectorUi::setupToolbar(bool doConnect)
{
if (doConnect) {
connect(m_clientProxy, SIGNAL(connected()), m_toolbar, SLOT(enable()));
connect(m_clientProxy, SIGNAL(disconnected()), m_toolbar, SLOT(disable()));
connect(m_clientProxy, SIGNAL(connected()), this, SLOT(enable()));
connect(m_clientProxy, SIGNAL(disconnected()), this, SLOT(disable()));
connect(m_toolbar, SIGNAL(designModeSelected(bool)), m_clientProxy, SLOT(setDesignModeBehavior(bool)));
connect(m_toolbar, SIGNAL(reloadSelected()), m_clientProxy, SLOT(reloadQmlViewer()));
@@ -705,10 +719,9 @@ void InspectorUi::setupToolbar(bool doConnect)
connect(m_clientProxy, SIGNAL(selectedColorChanged(QColor)), m_toolbar, SLOT(setSelectedColor(QColor)));
connect(m_clientProxy, SIGNAL(animationSpeedChanged(qreal)), m_toolbar, SLOT(setAnimationSpeed(qreal)));
m_toolbar->enable();
} else {
disconnect(m_clientProxy, SIGNAL(connected()), m_toolbar, SLOT(enable()));
disconnect(m_clientProxy, SIGNAL(disconnected()), m_toolbar, SLOT(disable()));
disconnect(m_clientProxy, SIGNAL(connected()), this, SLOT(enable()));
disconnect(m_clientProxy, SIGNAL(disconnected()), this, SLOT(disable()));
disconnect(m_toolbar, SIGNAL(designModeSelected(bool)), m_clientProxy, SLOT(setDesignModeBehavior(bool)));
disconnect(m_toolbar, SIGNAL(reloadSelected()), m_clientProxy, SLOT(reloadQmlViewer()));
@@ -726,6 +739,11 @@ void InspectorUi::setupToolbar(bool doConnect)
disconnect(m_clientProxy, SIGNAL(selectedColorChanged(QColor)), m_toolbar, SLOT(setSelectedColor(QColor)));
disconnect(m_clientProxy, SIGNAL(animationSpeedChanged(qreal)), m_toolbar, SLOT(setAnimationSpeed(qreal)));
m_toolbar->disable();
}
if (m_clientProxy && m_clientProxy->isConnected()) {
enable();
} else {
disable();
}
}

View File

@@ -119,6 +119,8 @@ public slots:
void setApplyChangesToQmlObserver(bool applyChanges);
private slots:
void enable();
void disable();
void gotoObjectReferenceDefinition(const QDeclarativeDebugObjectReference &obj);
void setSelectedItemsByObjectReference(QList<QDeclarativeDebugObjectReference> objectReferences);

View File

@@ -118,14 +118,16 @@ void InspectorPlugin::extensionsInitialized()
m_inspectorUi->setupUi();
}
// The adapter object is only added to the pool with a succesful connection,
// so we can immediately init our stuff.
void InspectorPlugin::objectAdded(QObject *object)
{
Debugger::QmlAdapter *adapter = qobject_cast<Debugger::QmlAdapter *>(object);
if (adapter) {
m_clientProxy = new ClientProxy(adapter);
m_inspectorUi->connected(m_clientProxy);
if (m_clientProxy->isConnected()) {
clientProxyConnected();
} else {
connect(m_clientProxy, SIGNAL(connected()), this, SLOT(clientProxyConnected()));
}
return;
}
@@ -148,4 +150,9 @@ void InspectorPlugin::aboutToRemoveObject(QObject *obj)
}
}
void InspectorPlugin::clientProxyConnected()
{
m_inspectorUi->connected(m_clientProxy);
}
Q_EXPORT_PLUGIN(InspectorPlugin)

View File

@@ -74,6 +74,7 @@ public:
private slots:
void objectAdded(QObject *object);
void aboutToRemoveObject(QObject *obj);
void clientProxyConnected();
private:
void createActions();

View File

@@ -53,7 +53,11 @@ QmlJSObserverClient::QmlJSObserverClient(QDeclarativeDebugConnection *client,
: QDeclarativeDebugClient(QLatin1String("QDeclarativeObserverMode"), client) ,
m_connection(client)
{
setEnabled(true);
}
void QmlJSObserverClient::statusChanged(Status status)
{
emit connectedStatusChanged(status);
}
void QmlJSObserverClient::messageReceived(const QByteArray &message)

View File

@@ -80,6 +80,8 @@ public:
void clearComponentCache();
signals:
void connectedStatusChanged(QDeclarativeDebugClient::Status status);
void currentObjectsChanged(const QList<int> &debugIds);
void selectedColorChanged(const QColor &color);
void colorPickerActivated();
@@ -92,6 +94,7 @@ signals:
void contextPathUpdated(const QStringList &path);
protected:
virtual void statusChanged(Status);
virtual void messageReceived(const QByteArray &);
private: