forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.6'
Conflicts: src/plugins/qt4projectmanager/qt4buildconfiguration.cpp src/plugins/qtsupport/baseqtversion.cpp Change-Id: I288eeb1137e1b08d6c0d69f394cbb0fe1a937b68
This commit is contained in:
@@ -581,18 +581,12 @@ DebuggerSettings::DebuggerSettings(QSettings *settings)
|
||||
const QString qmlInspectorGroup = QLatin1String("QML.Inspector");
|
||||
item = new SavedAction(this);
|
||||
item->setSettingsKey(qmlInspectorGroup, QLatin1String("QmlInspector.ShowAppOnTop"));
|
||||
item->setText(tr("Show Application On Top"));
|
||||
item->setCheckable(true);
|
||||
item->setDefaultValue(false);
|
||||
item->setIcon(QIcon(QLatin1String(":/debugger/images/qml/app-on-top.png")));
|
||||
insertItem(ShowAppOnTop, item);
|
||||
|
||||
item = new SavedAction(this);
|
||||
item->setSettingsKey(qmlInspectorGroup, QLatin1String("QmlInspector.FromQml"));
|
||||
item->setText(tr("Apply Changes on Save"));
|
||||
item->setCheckable(true);
|
||||
item->setDefaultValue(false);
|
||||
item->setIcon(QIcon(QLatin1String(":/debugger/images/qml/apply-on-save.png")));
|
||||
insertItem(QmlUpdateOnSave, item);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ const char STEPOUT[] = "Debugger.StepOut";
|
||||
const char NEXT[] = "Debugger.NextLine";
|
||||
const char REVERSE[] = "Debugger.ReverseDirection";
|
||||
const char OPERATE_BY_INSTRUCTION[] = "Debugger.OperateByInstruction";
|
||||
const char QML_SHOW_APP_ON_TOP[] = "Debugger.QmlShowAppOnTop";
|
||||
const char QML_UPDATE_ON_SAVE[] = "Debugger.QmlUpdateOnSave";
|
||||
const char QML_SELECTTOOL[] = "Debugger.QmlSelectTool";
|
||||
const char QML_ZOOMTOOL[] = "Debugger.QmlZoomTool";
|
||||
|
||||
|
||||
@@ -2842,18 +2842,6 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
||||
connect(action(OperateByInstruction), SIGNAL(triggered(bool)),
|
||||
SLOT(handleOperateByInstructionTriggered(bool)));
|
||||
|
||||
QAction *qmlSelectDummyAction = new QAction(tr("Select"), this);
|
||||
qmlSelectDummyAction->setCheckable(true);
|
||||
qmlSelectDummyAction->setIcon(QIcon(_(":/debugger/images/qml/select.png")));
|
||||
qmlSelectDummyAction->setEnabled(false);
|
||||
ActionManager::registerAction(qmlSelectDummyAction, Constants::QML_SELECTTOOL, globalcontext);
|
||||
|
||||
QAction *qmlZoomDummyAction = new QAction(tr("Zoom"), this);
|
||||
qmlZoomDummyAction->setCheckable(true);
|
||||
qmlZoomDummyAction->setIcon(QIcon(_(":/debugger/images/qml/zoom.png")));
|
||||
qmlZoomDummyAction->setEnabled(false);
|
||||
ActionManager::registerAction(qmlZoomDummyAction, Constants::QML_ZOOMTOOL, globalcontext);
|
||||
|
||||
ActionContainer *debugMenu =
|
||||
ActionManager::actionContainer(ProjectExplorer::Constants::M_DEBUG);
|
||||
|
||||
@@ -3126,6 +3114,39 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
||||
|
||||
debugMenu->addSeparator(globalcontext);
|
||||
|
||||
QAction *qmlUpdateOnSaveDummyAction = new QAction(tr("Apply Changes on Save"), this);
|
||||
qmlUpdateOnSaveDummyAction->setCheckable(true);
|
||||
qmlUpdateOnSaveDummyAction->setIcon(QIcon(_(":/debugger/images/qml/apply-on-save.png")));
|
||||
qmlUpdateOnSaveDummyAction->setEnabled(false);
|
||||
cmd = ActionManager::registerAction(qmlUpdateOnSaveDummyAction, Constants::QML_UPDATE_ON_SAVE,
|
||||
globalcontext);
|
||||
debugMenu->addAction(cmd);
|
||||
|
||||
QAction *qmlShowAppOnTopDummyAction = new QAction(tr("Show Application On Top"), this);
|
||||
qmlShowAppOnTopDummyAction->setCheckable(true);
|
||||
qmlShowAppOnTopDummyAction->setIcon(QIcon(_(":/debugger/images/qml/app-on-top.png")));
|
||||
qmlShowAppOnTopDummyAction->setEnabled(false);
|
||||
cmd = ActionManager::registerAction(qmlShowAppOnTopDummyAction, Constants::QML_SHOW_APP_ON_TOP,
|
||||
globalcontext);
|
||||
debugMenu->addAction(cmd);
|
||||
|
||||
QAction *qmlSelectDummyAction = new QAction(tr("Select"), this);
|
||||
qmlSelectDummyAction->setCheckable(true);
|
||||
qmlSelectDummyAction->setIcon(QIcon(_(":/debugger/images/qml/select.png")));
|
||||
qmlSelectDummyAction->setEnabled(false);
|
||||
cmd = ActionManager::registerAction(qmlSelectDummyAction, Constants::QML_SELECTTOOL,
|
||||
globalcontext);
|
||||
debugMenu->addAction(cmd);
|
||||
|
||||
QAction *qmlZoomDummyAction = new QAction(tr("Zoom"), this);
|
||||
qmlZoomDummyAction->setCheckable(true);
|
||||
qmlZoomDummyAction->setIcon(QIcon(_(":/debugger/images/qml/zoom.png")));
|
||||
qmlZoomDummyAction->setEnabled(false);
|
||||
cmd = ActionManager::registerAction(qmlZoomDummyAction, Constants::QML_ZOOMTOOL, globalcontext);
|
||||
debugMenu->addAction(cmd);
|
||||
|
||||
debugMenu->addSeparator(globalcontext);
|
||||
|
||||
// Don't add '1' to the string as it shows up in the shortcut dialog.
|
||||
cmd = ActionManager::registerAction(m_watchAction1,
|
||||
"Debugger.AddToWatch", cppeditorcontext);
|
||||
@@ -3249,8 +3270,8 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
||||
hbox = new QHBoxLayout(qmlToolbar);
|
||||
hbox->setMargin(0);
|
||||
hbox->setSpacing(0);
|
||||
hbox->addWidget(toolButton(action(QmlUpdateOnSave)));
|
||||
hbox->addWidget(toolButton(action(ShowAppOnTop)));
|
||||
hbox->addWidget(toolButton(Constants::QML_UPDATE_ON_SAVE));
|
||||
hbox->addWidget(toolButton(Constants::QML_SHOW_APP_ON_TOP));
|
||||
hbox->addWidget(new StyledSeparator);
|
||||
hbox->addWidget(toolButton(Constants::QML_SELECTTOOL));
|
||||
hbox->addWidget(toolButton(Constants::QML_ZOOMTOOL));
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "debuggercore.h"
|
||||
#include "debuggerstringutils.h"
|
||||
#include "qmladapter.h"
|
||||
#include "qmlengine.h"
|
||||
#include "debuggerengine.h"
|
||||
#include "qmlinspectoragent.h"
|
||||
#include "qmllivetextpreview.h"
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Internal {
|
||||
* integration with the text editor.
|
||||
*/
|
||||
QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter,
|
||||
QmlEngine *engine,
|
||||
DebuggerEngine *engine,
|
||||
QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_debugAdapter(debugAdapter)
|
||||
@@ -75,8 +75,14 @@ QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter,
|
||||
, m_inspectorToolsContext("Debugger.QmlInspector")
|
||||
, m_selectAction(new QAction(this))
|
||||
, m_zoomAction(new QAction(this))
|
||||
, m_showAppOnTopAction(debuggerCore()->action(ShowAppOnTop))
|
||||
, m_updateOnSaveAction(debuggerCore()->action(QmlUpdateOnSave))
|
||||
, m_engineClientConnected(false)
|
||||
{
|
||||
if (!m_engine->isMasterEngine())
|
||||
m_engine = m_engine->masterEngine();
|
||||
connect(m_engine, SIGNAL(stateChanged(Debugger::DebuggerState)),
|
||||
SLOT(onEngineStateChanged(Debugger::DebuggerState)));
|
||||
connect(m_agent, SIGNAL(objectFetched(QmlDebug::ObjectReference)),
|
||||
SLOT(onObjectFetched(QmlDebug::ObjectReference)));
|
||||
connect(m_agent, SIGNAL(jumpToObjectDefinition(QmlDebug::FileReference,int)),
|
||||
@@ -131,11 +137,21 @@ QmlInspectorAdapter::QmlInspectorAdapter(QmlAdapter *debugAdapter,
|
||||
m_zoomAction->setObjectName(QLatin1String("QML Zoom Action"));
|
||||
m_selectAction->setCheckable(true);
|
||||
m_zoomAction->setCheckable(true);
|
||||
m_showAppOnTopAction->setCheckable(true);
|
||||
m_updateOnSaveAction->setCheckable(true);
|
||||
m_selectAction->setEnabled(false);
|
||||
m_zoomAction->setEnabled(false);
|
||||
m_showAppOnTopAction->setEnabled(false);
|
||||
m_updateOnSaveAction->setEnabled(false);
|
||||
|
||||
connect(m_selectAction, SIGNAL(triggered(bool)),
|
||||
SLOT(onSelectActionTriggered(bool)));
|
||||
connect(m_zoomAction, SIGNAL(triggered(bool)),
|
||||
SLOT(onZoomActionTriggered(bool)));
|
||||
connect(m_showAppOnTopAction, SIGNAL(triggered(bool)),
|
||||
SLOT(onShowAppOnTopChanged(bool)));
|
||||
connect(m_updateOnSaveAction, SIGNAL(triggered(bool)),
|
||||
SLOT(onUpdateOnSaveChanged(bool)));
|
||||
}
|
||||
|
||||
QmlInspectorAdapter::~QmlInspectorAdapter()
|
||||
@@ -193,56 +209,49 @@ void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status
|
||||
connect(client, SIGNAL(reloaded()), SLOT(onReloaded()));
|
||||
connect(client, SIGNAL(destroyedObject(int)), SLOT(onDestroyedObject(int)));
|
||||
|
||||
// only enable zoom action for Qt 4.x/old client
|
||||
// (zooming is integrated into selection tool in Qt 5).
|
||||
m_zoomAction->setEnabled(
|
||||
qobject_cast<DeclarativeToolsClient*>(client) != 0);
|
||||
|
||||
// register actions here
|
||||
// because there can be multiple QmlEngines
|
||||
// at the same time (but hopefully one one is connected)
|
||||
Core::ActionManager::registerAction(m_selectAction,
|
||||
Core::Id(Constants::QML_SELECTTOOL),
|
||||
m_inspectorToolsContext);
|
||||
Core::Id(Constants::QML_SELECTTOOL),
|
||||
m_inspectorToolsContext);
|
||||
Core::ActionManager::registerAction(m_zoomAction, Core::Id(Constants::QML_ZOOMTOOL),
|
||||
m_inspectorToolsContext);
|
||||
m_inspectorToolsContext);
|
||||
Core::ActionManager::registerAction(m_showAppOnTopAction,
|
||||
Core::Id(Constants::QML_SHOW_APP_ON_TOP),
|
||||
m_inspectorToolsContext);
|
||||
Core::ActionManager::registerAction(m_updateOnSaveAction,
|
||||
Core::Id(Constants::QML_UPDATE_ON_SAVE),
|
||||
m_inspectorToolsContext);
|
||||
|
||||
Core::ICore::updateAdditionalContexts(Core::Context(),
|
||||
m_inspectorToolsContext);
|
||||
|
||||
Utils::SavedAction *action = debuggerCore()->action(QmlUpdateOnSave);
|
||||
connect(action, SIGNAL(valueChanged(QVariant)),
|
||||
SLOT(onUpdateOnSaveChanged(QVariant)));
|
||||
|
||||
action = debuggerCore()->action(ShowAppOnTop);
|
||||
connect(action, SIGNAL(valueChanged(QVariant)),
|
||||
SLOT(onShowAppOnTopChanged(QVariant)));
|
||||
if (action->isChecked())
|
||||
m_toolsClient->showAppOnTop(true);
|
||||
Core::ICore::updateAdditionalContexts(Core::Context(), m_inspectorToolsContext);
|
||||
|
||||
m_toolsClientConnected = true;
|
||||
onEngineStateChanged(m_engine->state());
|
||||
if (m_showAppOnTopAction->isChecked())
|
||||
m_toolsClient->showAppOnTop(true);
|
||||
|
||||
} else if (m_toolsClientConnected && client == m_toolsClient) {
|
||||
disconnect(client, SIGNAL(currentObjectsChanged(QList<int>)),
|
||||
this, SLOT(selectObjectsFromToolsClient(QList<int>)));
|
||||
disconnect(client, SIGNAL(logActivity(QString,QString)),
|
||||
m_debugAdapter, SLOT(logServiceActivity(QString,QString)));
|
||||
|
||||
Core::ActionManager::unregisterAction(m_selectAction,
|
||||
Core::Id(Constants::QML_SELECTTOOL));
|
||||
Core::ActionManager::unregisterAction(m_zoomAction,
|
||||
Core::Id(Constants::QML_ZOOMTOOL));
|
||||
Core::ActionManager::unregisterAction(m_selectAction, Core::Id(Constants::QML_SELECTTOOL));
|
||||
Core::ActionManager::unregisterAction(m_zoomAction, Core::Id(Constants::QML_ZOOMTOOL));
|
||||
Core::ActionManager::unregisterAction(m_showAppOnTopAction,
|
||||
Core::Id(Constants::QML_SHOW_APP_ON_TOP));
|
||||
Core::ActionManager::unregisterAction(m_updateOnSaveAction,
|
||||
Core::Id(Constants::QML_UPDATE_ON_SAVE));
|
||||
|
||||
m_selectAction->setChecked(false);
|
||||
m_zoomAction->setChecked(false);
|
||||
Core::ICore::updateAdditionalContexts(m_inspectorToolsContext,
|
||||
Core::Context());
|
||||
|
||||
Utils::SavedAction *action = debuggerCore()->action(QmlUpdateOnSave);
|
||||
disconnect(action, 0, this, 0);
|
||||
action = debuggerCore()->action(ShowAppOnTop);
|
||||
disconnect(action, 0, this, 0);
|
||||
Core::ICore::updateAdditionalContexts(m_inspectorToolsContext, Core::Context());
|
||||
|
||||
enableTools(false);
|
||||
m_toolsClientConnected = false;
|
||||
m_selectAction->setCheckable(false);
|
||||
m_zoomAction->setCheckable(false);
|
||||
m_showAppOnTopAction->setCheckable(false);
|
||||
m_updateOnSaveAction->setCheckable(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,20 +393,19 @@ void QmlInspectorAdapter::onZoomActionTriggered(bool checked)
|
||||
}
|
||||
}
|
||||
|
||||
void QmlInspectorAdapter::onShowAppOnTopChanged(const QVariant &value)
|
||||
void QmlInspectorAdapter::onShowAppOnTopChanged(bool checked)
|
||||
{
|
||||
bool showAppOnTop = value.toBool();
|
||||
if (m_toolsClient && m_toolsClient->status() == QmlDebug::Enabled)
|
||||
m_toolsClient->showAppOnTop(showAppOnTop);
|
||||
QTC_ASSERT(toolsClient(), return);
|
||||
toolsClient()->showAppOnTop(checked);
|
||||
}
|
||||
|
||||
void QmlInspectorAdapter::onUpdateOnSaveChanged(const QVariant &value)
|
||||
void QmlInspectorAdapter::onUpdateOnSaveChanged(bool checked)
|
||||
{
|
||||
bool updateOnSave = value.toBool();
|
||||
QTC_ASSERT(toolsClient(), return);
|
||||
for (QHash<QString, QmlLiveTextPreview *>::const_iterator it
|
||||
= m_textPreviews.constBegin();
|
||||
it != m_textPreviews.constEnd(); ++it) {
|
||||
it.value()->setApplyChangesToQmlInspector(updateOnSave);
|
||||
it.value()->setApplyChangesToQmlInspector(checked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,6 +507,19 @@ void QmlInspectorAdapter::deletePreviews()
|
||||
delete m_textPreviews.take(key);
|
||||
}
|
||||
|
||||
void QmlInspectorAdapter::enableTools(const bool enable)
|
||||
{
|
||||
if (!m_toolsClientConnected)
|
||||
return;
|
||||
m_selectAction->setEnabled(enable);
|
||||
m_showAppOnTopAction->setEnabled(enable);
|
||||
m_updateOnSaveAction->setEnabled(enable);
|
||||
// only enable zoom action for Qt 4.x/old client
|
||||
// (zooming is integrated into selection tool in Qt 5).
|
||||
if (!qobject_cast<QmlToolsClient*>(m_toolsClient))
|
||||
m_zoomAction->setEnabled(enable);
|
||||
}
|
||||
|
||||
void QmlInspectorAdapter::onReload()
|
||||
{
|
||||
QHash<QString, QByteArray> changesHash;
|
||||
@@ -542,5 +563,10 @@ void QmlInspectorAdapter::onDestroyedObject(int objectDebugId)
|
||||
m_agent->fetchObject(m_agent->parentIdForObject(objectDebugId));
|
||||
}
|
||||
|
||||
void QmlInspectorAdapter::onEngineStateChanged(const DebuggerState state)
|
||||
{
|
||||
enableTools(state == InferiorRunOk);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#ifndef QMLINSPECTORADAPTER_H
|
||||
#define QMLINSPECTORADAPTER_H
|
||||
|
||||
#include "debuggerconstants.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
@@ -49,11 +51,13 @@ class FileReference;
|
||||
}
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
class DebuggerEngine;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class WatchTreeView;
|
||||
class QmlAdapter;
|
||||
class QmlEngine;
|
||||
class QmlInspectorAgent;
|
||||
class QmlLiveTextPreview;
|
||||
|
||||
@@ -62,7 +66,7 @@ class QmlInspectorAdapter : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QmlInspectorAdapter(QmlAdapter *debugAdapter, QmlEngine *engine,
|
||||
QmlInspectorAdapter(QmlAdapter *debugAdapter, DebuggerEngine *engine,
|
||||
QObject *parent = 0);
|
||||
~QmlInspectorAdapter();
|
||||
|
||||
@@ -77,6 +81,8 @@ signals:
|
||||
void expressionResult();
|
||||
|
||||
private slots:
|
||||
void onEngineStateChanged(const Debugger::DebuggerState);
|
||||
|
||||
void clientStatusChanged(QmlDebug::ClientStatus status);
|
||||
void toolsClientStatusChanged(QmlDebug::ClientStatus status);
|
||||
void engineClientStatusChanged(QmlDebug::ClientStatus status);
|
||||
@@ -90,8 +96,8 @@ private slots:
|
||||
|
||||
void onSelectActionTriggered(bool checked);
|
||||
void onZoomActionTriggered(bool checked);
|
||||
void onShowAppOnTopChanged(const QVariant &value);
|
||||
void onUpdateOnSaveChanged(const QVariant &value);
|
||||
void onShowAppOnTopChanged(bool checked);
|
||||
void onUpdateOnSaveChanged(bool checked);
|
||||
void onReload();
|
||||
void onReloaded();
|
||||
void onDestroyedObject(int);
|
||||
@@ -109,9 +115,10 @@ private:
|
||||
SelectionTarget target);
|
||||
void deletePreviews();
|
||||
|
||||
void enableTools(const bool enable);
|
||||
|
||||
QmlAdapter *m_debugAdapter;
|
||||
QmlEngine *m_engine;
|
||||
DebuggerEngine *m_engine; // Master Engine
|
||||
QmlDebug::BaseEngineDebugClient *m_engineClient;
|
||||
QHash<QString, QmlDebug::BaseEngineDebugClient*> m_engineClients;
|
||||
QmlDebug::BaseToolsClient *m_toolsClient;
|
||||
@@ -134,6 +141,8 @@ private:
|
||||
Core::Context m_inspectorToolsContext;
|
||||
QAction *m_selectAction;
|
||||
QAction *m_zoomAction;
|
||||
QAction *m_showAppOnTopAction;
|
||||
QAction *m_updateOnSaveAction;
|
||||
|
||||
bool m_engineClientConnected;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user