context-based hiding/showing of debug menu entries

the previous implementation relied on poking around with setVisible
of the menu actions. Now, command attribute CA_Hide is used instead for
the necessary entries.

Reviewed-by: hjk
This commit is contained in:
Lasse Holmstedt
2010-03-19 13:58:26 +01:00
parent 8c83a9d088
commit d5bdad2269
7 changed files with 90 additions and 51 deletions

View File

@@ -171,7 +171,13 @@ QmlInspector::QmlInspector(QObject *parent)
{
m_watchTableModel = new WatchTableModel(0, this);
initWidgets();
m_objectTreeWidget = new ObjectTree;
m_propertiesWidget = new ObjectPropertiesView;
m_watchTableView = new WatchTableView(m_watchTableModel);
m_frameRateWidget = new CanvasFrameRate;
m_expressionWidget = new ExpressionQueryWidget(ExpressionQueryWidget::SeparateEntryMode);
m_context = new Internal::InspectorContext(m_expressionWidget);
m_expressionWidget->createCommands(m_context);
}
bool QmlInspector::connectToViewer()
@@ -291,16 +297,8 @@ void QmlInspector::connectionError()
.arg(m_conn->error()).arg(m_conn->errorString()));
}
void QmlInspector::initWidgets()
void QmlInspector::createDockWidgets()
{
m_objectTreeWidget = new ObjectTree;
m_propertiesWidget = new ObjectPropertiesView;
m_watchTableView = new WatchTableView(m_watchTableModel);
m_frameRateWidget = new CanvasFrameRate;
m_expressionWidget = new ExpressionQueryWidget(ExpressionQueryWidget::SeparateEntryMode);
m_context = new Internal::InspectorContext(m_expressionWidget);
m_expressionWidget->createCommands(m_context);
m_engineSpinBox = new EngineSpinBox;
m_engineSpinBox->setEnabled(false);
@@ -368,6 +366,7 @@ void QmlInspector::initWidgets()
propSplitter->setWindowTitle(tr("Properties and Watchers"));
InspectorOutputWidget *inspectorOutput = new InspectorOutputWidget();
connect(this, SIGNAL(statusMessage(QString)),
inspectorOutput, SLOT(addInspectorStatus(QString)));
@@ -387,6 +386,7 @@ void QmlInspector::initWidgets()
m_inspectorOutputDock->setToolTip(tr("Output of the QML inspector, such as information on connecting to the server."));
m_dockWidgets << m_objectTreeDock << m_frameRateDock << m_propertyWatcherDock << m_inspectorOutputDock;
}
void QmlInspector::setSimpleDockWidgetArrangement()

View File

@@ -75,6 +75,7 @@ class QMLINSPECTOR_EXPORT QmlInspector : public QObject
public:
QmlInspector(QObject *parent = 0);
void createDockWidgets();
bool connectToViewer(); // using host, port from widgets
Core::IContext *context() const;
@@ -96,7 +97,6 @@ private slots:
private:
void resetViews();
void initWidgets();
QDeclarativeDebugConnection *m_conn;
QDeclarativeEngineDebug *m_client;

View File

@@ -103,11 +103,13 @@ bool QmlInspectorPlugin::initialize(const QStringList &arguments, QString *error
ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();
Debugger::DebuggerUISwitcher *uiSwitcher = pluginManager->getObject<Debugger::DebuggerUISwitcher>();
uiSwitcher->addLanguage(Qml::Constants::LANG_QML);
m_inspector = new QmlInspector;
addObject(m_inspector);
Core::ICore::instance()->addContextObject(m_inspector->context());
uiSwitcher->addLanguage(Qml::Constants::LANG_QML, m_inspector->context()->context());
m_inspector->createDockWidgets();
connect(m_connectionTimer, SIGNAL(timeout()), SLOT(pollInspector()));