analyzer: remove output pane

It's all dockwidgets now.

Change-Id: Ia47ca9331fdfbe12ca11f77c26afc35e73a2fae3
Reviewed-on: http://codereview.qt.nokia.com/776
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2011-06-27 16:13:46 +02:00
committed by hjk
parent 0753c7bd2e
commit a9f53ec9c5
15 changed files with 52 additions and 812 deletions

View File

@@ -12,7 +12,6 @@ QT += network
SOURCES += \ SOURCES += \
ianalyzerengine.cpp \ ianalyzerengine.cpp \
ianalyzeroutputpaneadapter.cpp \
ianalyzertool.cpp \ ianalyzertool.cpp \
analyzerplugin.cpp \ analyzerplugin.cpp \
analyzerruncontrol.cpp \ analyzerruncontrol.cpp \
@@ -21,13 +20,11 @@ SOURCES += \
analyzersettings.cpp \ analyzersettings.cpp \
analyzeroptionspage.cpp \ analyzeroptionspage.cpp \
analyzerrunconfigwidget.cpp \ analyzerrunconfigwidget.cpp \
analyzeroutputpane.cpp \
analyzerutils.cpp \ analyzerutils.cpp \
startremotedialog.cpp startremotedialog.cpp
HEADERS += \ HEADERS += \
ianalyzerengine.h \ ianalyzerengine.h \
ianalyzeroutputpaneadapter.h \
ianalyzertool.h \ ianalyzertool.h \
analyzerbase_global.h \ analyzerbase_global.h \
analyzerconstants.h \ analyzerconstants.h \
@@ -39,7 +36,6 @@ HEADERS += \
analyzerstartparameters.h \ analyzerstartparameters.h \
analyzeroptionspage.h \ analyzeroptionspage.h \
analyzerrunconfigwidget.h \ analyzerrunconfigwidget.h \
analyzeroutputpane.h \
analyzerutils.h \ analyzerutils.h \
startremotedialog.h startremotedialog.h

View File

@@ -39,26 +39,25 @@
#include "analyzerruncontrol.h" #include "analyzerruncontrol.h"
#include "analyzerruncontrolfactory.h" #include "analyzerruncontrolfactory.h"
#include "analyzeroptionspage.h" #include "analyzeroptionspage.h"
#include "analyzeroutputpane.h"
#include "analyzerstartparameters.h" #include "analyzerstartparameters.h"
#include "analyzerutils.h" #include "analyzerutils.h"
#include "ianalyzertool.h" #include "ianalyzertool.h"
#include "startremotedialog.h" #include "startremotedialog.h"
#include <coreplugin/actionmanager/command.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/findplaceholder.h> #include <coreplugin/findplaceholder.h>
#include <coreplugin/icore.h>
#include <coreplugin/imode.h>
#include <coreplugin/minisplitter.h> #include <coreplugin/minisplitter.h>
#include <coreplugin/modemanager.h> #include <coreplugin/modemanager.h>
#include <coreplugin/navigationwidget.h> #include <coreplugin/navigationwidget.h>
#include <coreplugin/outputpane.h> #include <coreplugin/outputpane.h>
#include <coreplugin/rightpane.h> #include <coreplugin/rightpane.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/imode.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
@@ -200,7 +199,6 @@ public:
AnalyzerManager *q; AnalyzerManager *q;
AnalyzerMode *m_mode; AnalyzerMode *m_mode;
AnalyzerOutputPane *m_outputpane;
AnalyzerRunControlFactory *m_runControlFactory; AnalyzerRunControlFactory *m_runControlFactory;
ProjectExplorer::RunControl *m_currentRunControl; ProjectExplorer::RunControl *m_currentRunControl;
Utils::FancyMainWindow *m_mainWindow; Utils::FancyMainWindow *m_mainWindow;
@@ -232,7 +230,6 @@ public:
AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq): AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq):
q(qq), q(qq),
m_mode(0), m_mode(0),
m_outputpane(0),
m_runControlFactory(0), m_runControlFactory(0),
m_currentRunControl(0), m_currentRunControl(0),
m_mainWindow(0), m_mainWindow(0),
@@ -503,8 +500,6 @@ void AnalyzerManager::AnalyzerManagerPrivate::startTool()
// make sure mode is shown // make sure mode is shown
q->showMode(); q->showMode();
if (q->currentTool()->needsOutputPane())
q->popupOutputPane();
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance(); ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
@@ -583,16 +578,16 @@ void AnalyzerManager::AnalyzerManagerPrivate::startTool()
// AnalyzerManager //////////////////////////////////////////////////// // AnalyzerManager ////////////////////////////////////////////////////
AnalyzerManager *AnalyzerManager::m_instance = 0; AnalyzerManager *AnalyzerManager::m_instance = 0;
AnalyzerManager::AnalyzerManager(AnalyzerOutputPane *op, QObject *parent) : AnalyzerManager::AnalyzerManager(QObject *parent)
QObject(parent), : QObject(parent),
d(new AnalyzerManagerPrivate(this)) d(new AnalyzerManagerPrivate(this))
{ {
m_instance = this; m_instance = this;
d->m_outputpane = op;
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(modeChanged(Core::IMode*))); this, SLOT(modeChanged(Core::IMode*)));
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance(); ProjectExplorer::ProjectExplorerPlugin *pe =
ProjectExplorer::ProjectExplorerPlugin::instance();
connect(pe, SIGNAL(updateRunActions()), connect(pe, SIGNAL(updateRunActions()),
this, SLOT(updateRunActions())); this, SLOT(updateRunActions()));
} }
@@ -652,9 +647,11 @@ void AnalyzerManager::toolSelected(int idx)
foreach (QDockWidget *widget, d->m_toolWidgets.value(oldTool)) { foreach (QDockWidget *widget, d->m_toolWidgets.value(oldTool)) {
QAction *toggleViewAction = widget->toggleViewAction(); QAction *toggleViewAction = widget->toggleViewAction();
am->unregisterAction(toggleViewAction, QString("Analyzer." + widget->objectName())); am->unregisterAction(toggleViewAction,
QString("Analyzer." + widget->objectName()));
d->m_mainWindow->removeDockWidget(widget); d->m_mainWindow->removeDockWidget(widget);
///NOTE: QMainWindow (and FancyMainWindow) just look at @c findChildren<QDockWidget*>() ///NOTE: QMainWindow (and FancyMainWindow) just look at
/// @c findChildren<QDockWidget*>()
///if we don't do this, all kind of havoc might happen, including: ///if we don't do this, all kind of havoc might happen, including:
///- improper saveState/restoreState ///- improper saveState/restoreState
///- improper list of qdockwidgets in popup menu ///- improper list of qdockwidgets in popup menu
@@ -679,8 +676,6 @@ void AnalyzerManager::toolSelected(int idx)
} }
loadToolSettings(newTool); loadToolSettings(newTool);
d->m_outputpane->setTool(newTool);
updateRunActions(); updateRunActions();
selectingTool = false; selectingTool = false;
@@ -704,8 +699,10 @@ void AnalyzerManager::addTool(IAnalyzerTool *tool)
ActionManager *am = Core::ICore::instance()->actionManager(); ActionManager *am = Core::ICore::instance()->actionManager();
QString actionId = QString(Constants::ANALYZER_TOOLS) + QString::number(d->m_toolGroup->actions().count()); QString actionId = QString(Constants::ANALYZER_TOOLS)
Core::Command *command = am->registerAction(action, actionId, Core::Context(Core::Constants::C_GLOBAL)); + QString::number(d->m_toolGroup->actions().count());
Core::Command *command = am->registerAction(action, actionId,
Core::Context(Core::Constants::C_GLOBAL));
d->m_menu->addAction(command, Constants::G_ANALYZER_TOOLS); d->m_menu->addAction(command, Constants::G_ANALYZER_TOOLS);
d->m_toolGroup->setVisible(d->m_toolGroup->actions().count() > 1); d->m_toolGroup->setVisible(d->m_toolGroup->actions().count() > 1);
@@ -715,11 +712,10 @@ void AnalyzerManager::addTool(IAnalyzerTool *tool)
d->m_toolBox->addItem(tool->displayName()); d->m_toolBox->addItem(tool->displayName());
d->m_toolBox->blockSignals(blocked); d->m_toolBox->blockSignals(blocked);
// Populate output pane // Populate controls widget.
d->m_outputpane->setTool(tool);
// populate controls widget
QWidget *controlWidget = tool->createControlWidget(); // might be 0 QWidget *controlWidget = tool->createControlWidget(); // might be 0
d->m_controlsWidget->addWidget(controlWidget ? controlWidget : AnalyzerUtils::createDummyWidget()); d->m_controlsWidget->addWidget(controlWidget
? controlWidget : AnalyzerUtils::createDummyWidget());
d->m_toolBox->setEnabled(d->m_toolBox->count() > 1); d->m_toolBox->setEnabled(d->m_toolBox->count() > 1);
@@ -841,10 +837,14 @@ void AnalyzerManager::saveToolSettings(IAnalyzerTool *tool)
void AnalyzerManager::updateRunActions() void AnalyzerManager::updateRunActions()
{ {
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance(); ProjectExplorer::ProjectExplorerPlugin *pe =
ProjectExplorer::ProjectExplorerPlugin::instance();
ProjectExplorer::Project *project = pe->startupProject(); ProjectExplorer::Project *project = pe->startupProject();
bool startEnabled = !d->m_currentRunControl && pe->canRun(project, Constants::MODE_ANALYZE)
&& currentTool(); bool startEnabled = !d->m_currentRunControl
&& pe->canRun(project, Constants::MODE_ANALYZE)
&& currentTool();
QString disabledReason; QString disabledReason;
if (d->m_currentRunControl) if (d->m_currentRunControl)
disabledReason = tr("An analysis is still in progress."); disabledReason = tr("An analysis is still in progress.");
@@ -900,9 +900,4 @@ void AnalyzerManager::showMode()
ModeManager::instance()->activateMode(d->m_mode->id()); ModeManager::instance()->activateMode(d->m_mode->id());
} }
void AnalyzerManager::popupOutputPane()
{
d->m_outputpane->popup();
}
#include "analyzermanager.moc" #include "analyzermanager.moc"

View File

@@ -62,16 +62,12 @@ class IAnalyzerTool;
class AnalyzerRunControl; class AnalyzerRunControl;
class AnalyzerStartParameters; class AnalyzerStartParameters;
namespace Internal {
class AnalyzerOutputPane;
} // namespace Internal
class ANALYZER_EXPORT AnalyzerManager : public QObject class ANALYZER_EXPORT AnalyzerManager : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AnalyzerManager(Internal::AnalyzerOutputPane *op, QObject *parent = 0); explicit AnalyzerManager(QObject *parent = 0);
~AnalyzerManager(); ~AnalyzerManager();
static AnalyzerManager *instance(); static AnalyzerManager *instance();
@@ -87,9 +83,9 @@ public:
IAnalyzerTool *currentTool() const; IAnalyzerTool *currentTool() const;
QList<IAnalyzerTool *> tools() const; QList<IAnalyzerTool *> tools() const;
// dockwidgets are registered to the main window // Dockwidgets are registered to the main window.
QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title, QWidget *widget, QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title,
Qt::DockWidgetArea area = Qt::TopDockWidgetArea); QWidget *widget, Qt::DockWidgetArea area = Qt::TopDockWidgetArea);
Utils::FancyMainWindow *mainWindow() const; Utils::FancyMainWindow *mainWindow() const;
@@ -102,7 +98,6 @@ public:
AnalyzerRunControl *createAnalyzer(const AnalyzerStartParameters &sp, AnalyzerRunControl *createAnalyzer(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *rc = 0); ProjectExplorer::RunConfiguration *rc = 0);
void showMode(); void showMode();
void popupOutputPane();
public slots: public slots:
void startTool(); void startTool();

View File

@@ -1,320 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "analyzeroutputpane.h"
#include "analyzerconstants.h"
#include "analyzermanager.h"
#include "analyzerutils.h"
#include "ianalyzertool.h"
#include "ianalyzeroutputpaneadapter.h"
#include <utils/qtcassert.h>
#include <utils/styledbar.h>
#include <QtCore/QVariant>
#include <QtCore/QDebug>
#include <QtGui/QWidget>
#include <QtGui/QStackedLayout>
#include <QtGui/QLabel>
#include <QtGui/QStackedWidget>
enum { debug = 0 };
namespace Analyzer {
namespace Internal {
static const int dummyWidgetIndex = 0;
/*!
\class AnalyzerPane::Internal::AnalyzerOutputPane
\brief Common analysis output pane managing several tools.
Output pane for all tools derived from IAnalyzerTool.
The IAnalyzerOutputPaneAdapter (unless 0) provides
\list
\i Pane widget
\i Optional toolbar widget
\endlist
Both are inserted into a pane stacked layout and a stacked toolbar widget respectively.
The indexes of the stacked widgets/layouts and the adapter list go in sync
(dummy widgets on the toolbar are used to achieve this).
Dummy widgets that are shown in case there is no tool with an output pane
are added at index 0 to the stacks (usage of index 0 is to avoid using
QStackedWidget::insert() when adding adapters, which causes flicker).
Besides the tool-specific toolbar widget, the start/stop buttons and the combo
box of the AnalyzerManager are shown in the toolbar.
The initialization is a bit tricky here, as the sequence of calls to
setTool(), outputWindow()/toolBarWidgets() is basically undefined. The pane widget
should be created on the correct parent when outputWindow()
is called, tools will typically be added before.
\sa AnalyzerPane::Internal::IAnalyzerOutputPaneAdapter
*/
AnalyzerOutputPane::AnalyzerOutputPane(QObject *parent) :
Core::IOutputPane(parent),
m_paneWidget(0),
m_paneStackedLayout(0),
m_toolbarStackedWidget(0),
m_toolBarSeparator(0),
m_delayedCurrentIndex(-1)
{
setObjectName(QLatin1String("AnalyzerOutputPane"));
}
void AnalyzerOutputPane::clearTool()
{
// No tool. Show dummy label, which is the last widget.
if (m_paneWidget) {
m_paneStackedLayout->setCurrentIndex(dummyWidgetIndex);
m_toolbarStackedWidget->setCurrentIndex(dummyWidgetIndex);
emit navigateStateChanged();
}
hide();
}
int AnalyzerOutputPane::currentIndex() const
{
return isInitialized() ? m_paneStackedLayout->currentIndex() : m_delayedCurrentIndex;
}
IAnalyzerOutputPaneAdapter *AnalyzerOutputPane::currentAdapter() const
{
const int index = currentIndex(); // Rule out leading dummy widget
if (index != dummyWidgetIndex && index < m_adapters.size())
return m_adapters.at(index);
return 0;
}
void AnalyzerOutputPane::setCurrentIndex(int i)
{
if (!isInitialized()) {
m_delayedCurrentIndex = i;
} else if (i != currentIndex()) {
// Show up pane widget and optional toolbar widget. Hide
// the toolbar if the toolbar widget is a dummy.
m_paneStackedLayout->setCurrentIndex(i);
m_toolbarStackedWidget->setCurrentIndex(i);
const bool hasToolBarWidget = !m_toolbarStackedWidget->currentWidget()->property(Constants::ANALYZER_DUMMYWIDGET_ID).toBool();
m_toolbarStackedWidget->setVisible(hasToolBarWidget);
m_toolBarSeparator->setVisible(hasToolBarWidget);
navigateStateChanged();
}
}
void AnalyzerOutputPane::addAdapter(IAnalyzerOutputPaneAdapter *adapter)
{
if (m_adapters.isEmpty())
m_adapters.push_back(0); // Index for leading dummy widgets.
m_adapters.push_back(adapter);
connect(adapter, SIGNAL(navigationStatusChanged()), this, SLOT(slotNavigationStatusChanged()));
connect(adapter, SIGNAL(popup(bool)), this, SLOT(slotPopup(bool)));
if (isInitialized())
addToWidgets(adapter);
}
void AnalyzerOutputPane::addToWidgets(IAnalyzerOutputPaneAdapter *adapter)
{
QTC_ASSERT(m_paneWidget, return; )
QWidget *toolPaneWidget = adapter->paneWidget();
QTC_ASSERT(toolPaneWidget, return; )
m_paneStackedLayout->addWidget(toolPaneWidget);
QWidget *toolBarWidget = adapter->toolBarWidget(); // Might be 0
m_toolbarStackedWidget->addWidget(toolBarWidget ? toolBarWidget : AnalyzerUtils::createDummyWidget());
}
void AnalyzerOutputPane::setTool(IAnalyzerTool *tool)
{
if (debug)
qDebug() << "AnalyzerOutputPane::setTool" << tool;
// No tool. show dummy label.
IAnalyzerOutputPaneAdapter *adapter = 0;
if (tool)
adapter = tool->outputPaneAdapter();
// Re-show or add.
if (adapter) {
int index = m_adapters.indexOf(adapter);
if (index == -1) {
addAdapter(adapter);
index = m_adapters.size();
}
setCurrentIndex(index);
if (isInitialized())
popup(false);
} else {
clearTool();
}
}
QWidget *AnalyzerOutputPane::outputWidget(QWidget *parent)
{
if (debug)
qDebug() << "AnalyzerOutputPane::outputWidget";
// Delayed creation of main pane widget. Add a trailing dummy widget
// and add all adapters.
if (!isInitialized())
createWidgets(parent);
return m_paneWidget;
}
void AnalyzerOutputPane::createWidgets(QWidget *paneParent)
{
// Create pane and toolbar stack with leading dummy widget.
m_paneWidget = new QWidget(paneParent);
m_paneStackedLayout = new QStackedLayout(m_paneWidget);
m_paneWidget->setObjectName(objectName() + QLatin1String("Widget"));
m_paneStackedLayout->addWidget(new QLabel(tr("No current analysis tool"))); // placeholder
// Temporarily assign to (wrong) parent to suppress flicker in conjunction with QStackedWidget.
m_toolbarStackedWidget = new QStackedWidget(paneParent);
m_toolbarStackedWidget->setObjectName(objectName() + QLatin1String("ToolBarStackedWidget"));
m_toolbarStackedWidget->addWidget(AnalyzerUtils::createDummyWidget()); // placeholder
m_toolBarSeparator = new Utils::StyledSeparator(paneParent);
m_toolBarSeparator->setObjectName(objectName() + QLatin1String("ToolBarSeparator"));
// Add adapters added before.
const int adapterCount = m_adapters.size();
const int firstAdapter = dummyWidgetIndex + 1;
for (int i = firstAdapter; i < adapterCount; i++)
addToWidgets(m_adapters.at(i));
if (m_delayedCurrentIndex != -1) // setTool was called before initialization
setCurrentIndex(m_delayedCurrentIndex);
else if (adapterCount > firstAdapter) // default: Make last one current
setCurrentIndex(adapterCount - 1);
}
QWidgetList AnalyzerOutputPane::toolBarWidgets() const
{
if (debug)
qDebug() << "AnalyzerOutputPane::toolBarWidget";
QTC_ASSERT(isInitialized(), return QWidgetList(); )
QWidgetList list;
list << m_toolBarSeparator << m_toolbarStackedWidget;
return list;
}
QString AnalyzerOutputPane::displayName() const
{
return tr("Analysis");
}
int AnalyzerOutputPane::priorityInStatusBar() const
{
return -1; // Not visible in status bar.
}
void AnalyzerOutputPane::clearContents()
{
if (IAnalyzerOutputPaneAdapter *adapter = currentAdapter())
adapter->clearContents();
}
void AnalyzerOutputPane::visibilityChanged(bool v)
{
Q_UNUSED(v)
}
void AnalyzerOutputPane::setFocus()
{
if (IAnalyzerOutputPaneAdapter *adapter = currentAdapter())
adapter->setFocus();
}
bool AnalyzerOutputPane::hasFocus()
{
const IAnalyzerOutputPaneAdapter *adapter = currentAdapter();
return adapter ? adapter->hasFocus() : false;
}
bool AnalyzerOutputPane::canFocus()
{
const IAnalyzerOutputPaneAdapter *adapter = currentAdapter();
return adapter ? adapter->canFocus() : false;
}
bool AnalyzerOutputPane::canNavigate()
{
const IAnalyzerOutputPaneAdapter *adapter = currentAdapter();
return adapter ? adapter->canNavigate() : false;
}
bool AnalyzerOutputPane::canNext()
{
const IAnalyzerOutputPaneAdapter *adapter = currentAdapter();
return adapter ? adapter->canNext() : false;
}
bool AnalyzerOutputPane::canPrevious()
{
const IAnalyzerOutputPaneAdapter *adapter = currentAdapter();
return adapter ? adapter->canPrevious() : false;
}
void AnalyzerOutputPane::goToNext()
{
if (IAnalyzerOutputPaneAdapter *adapter = currentAdapter())
adapter->goToNext();
}
void AnalyzerOutputPane::goToPrev()
{
if (IAnalyzerOutputPaneAdapter *adapter = currentAdapter())
adapter->goToPrev();
}
void AnalyzerOutputPane::slotPopup(bool withFocus)
{
popup(withFocus);
}
void AnalyzerOutputPane::slotNavigationStatusChanged()
{
IAnalyzerOutputPaneAdapter *adapter = qobject_cast<IAnalyzerOutputPaneAdapter *>(sender());
const int index = m_adapters.indexOf(adapter);
QTC_ASSERT(adapter != 0 && index != -1, return; )
// Forward navigation status if it is the current pane.
if (index == currentIndex())
navigateStateChanged();
}
} // namespace Internal
} // namespace Analyzer

View File

@@ -1,103 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef ANALYZEROUTPUTPANE_H
#define ANALYZEROUTPUTPANE_H
#include <coreplugin/ioutputpane.h>
QT_FORWARD_DECLARE_CLASS(QStackedLayout)
QT_FORWARD_DECLARE_CLASS(QStackedWidget)
namespace Utils {
class StyledSeparator;
}
namespace Analyzer {
class IAnalyzerTool;
class IAnalyzerOutputPaneAdapter;
namespace Internal {
class AnalyzerOutputPane : public Core::IOutputPane
{
Q_OBJECT
public:
explicit AnalyzerOutputPane(QObject *parent = 0);
void setTool(IAnalyzerTool *tool);
// IOutputPane
virtual QWidget *outputWidget(QWidget *parent);
virtual QList<QWidget *> toolBarWidgets() const;
virtual QString displayName() const;
virtual int priorityInStatusBar() const;
virtual void clearContents();
virtual void visibilityChanged(bool visible);
virtual void setFocus();
virtual bool hasFocus();
virtual bool canFocus();
virtual bool canNavigate();
virtual bool canNext();
virtual bool canPrevious();
virtual void goToNext();
virtual void goToPrev();
private slots:
void slotPopup(bool withFocus);
void slotNavigationStatusChanged();
private:
void clearTool();
int currentIndex() const;
IAnalyzerOutputPaneAdapter *currentAdapter() const;
void setCurrentIndex(int );
void addAdapter(IAnalyzerOutputPaneAdapter *adapter);
void addToWidgets(IAnalyzerOutputPaneAdapter *adapter);
void createWidgets(QWidget *paneParent);
bool isInitialized() const { return m_paneWidget != 0; }
QWidget *m_paneWidget;
QStackedLayout *m_paneStackedLayout;
QList<IAnalyzerOutputPaneAdapter *> m_adapters;
QStackedWidget *m_toolbarStackedWidget;
Utils::StyledSeparator *m_toolBarSeparator;
// tracks selected index during !isInitialized() state
int m_delayedCurrentIndex;
};
} // namespace Internal
} // namespace Analyzer
#endif // ANALYZEROUTPUTPANE_H

View File

@@ -35,7 +35,6 @@
#include "analyzerplugin.h" #include "analyzerplugin.h"
#include "analyzerconstants.h" #include "analyzerconstants.h"
#include "analyzermanager.h" #include "analyzermanager.h"
#include "analyzeroutputpane.h"
#include "ianalyzertool.h" #include "ianalyzertool.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -60,7 +59,12 @@ static const char lastActiveToolC[] = "Analyzer.Plugin.LastActiveTool";
AnalyzerPlugin *AnalyzerPlugin::m_instance = 0; AnalyzerPlugin *AnalyzerPlugin::m_instance = 0;
// AnalyzerPluginPrivate //////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
//
// AnalyzerPluginPrivate
//
////////////////////////////////////////////////////////////////////////
class AnalyzerPlugin::AnalyzerPluginPrivate class AnalyzerPlugin::AnalyzerPluginPrivate
{ {
public: public:
@@ -69,23 +73,16 @@ public:
m_manager(0) m_manager(0)
{} {}
void initialize(const QStringList &arguments, QString *errorString);
AnalyzerPlugin *q; AnalyzerPlugin *q;
AnalyzerManager *m_manager; AnalyzerManager *m_manager;
}; };
void AnalyzerPlugin::AnalyzerPluginPrivate::initialize(const QStringList &arguments, QString *errorString) ////////////////////////////////////////////////////////////////////////
{ //
Q_UNUSED(arguments) // AnalyzerPlugin
Q_UNUSED(errorString) //
AnalyzerOutputPane *outputPane = new AnalyzerOutputPane; ////////////////////////////////////////////////////////////////////////
q->addAutoReleasedObject(outputPane);
m_manager = new AnalyzerManager(outputPane, q);
}
// AnalyzerPlugin ////////////////////////////////////////////////////
AnalyzerPlugin::AnalyzerPlugin() AnalyzerPlugin::AnalyzerPlugin()
: d(new AnalyzerPluginPrivate(this)) : d(new AnalyzerPluginPrivate(this))
{ {
@@ -94,26 +91,18 @@ AnalyzerPlugin::AnalyzerPlugin()
AnalyzerPlugin::~AnalyzerPlugin() AnalyzerPlugin::~AnalyzerPlugin()
{ {
// Unregister objects from the plugin manager's object pool
// Delete members
delete d; delete d;
m_instance = 0; m_instance = 0;
} }
bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorString) bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorString)
{ {
// Register objects in the plugin manager's object pool
// Load settings
// connect to other plugins' signals
// "In the initialize method, a plugin can be sure that the plugins it
// depends on have initialized their members."
Q_UNUSED(arguments) Q_UNUSED(arguments)
Q_UNUSED(errorString) Q_UNUSED(errorString)
d->initialize(arguments, errorString); d->m_manager = new AnalyzerManager(this);
// Task integration // Task integration.
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
ProjectExplorer::TaskHub *hub = pm->getObject<ProjectExplorer::TaskHub>(); ProjectExplorer::TaskHub *hub = pm->getObject<ProjectExplorer::TaskHub>();
//: Category under which Analyzer tasks are listed in build issues view //: Category under which Analyzer tasks are listed in build issues view
@@ -124,17 +113,13 @@ bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorStri
void AnalyzerPlugin::extensionsInitialized() void AnalyzerPlugin::extensionsInitialized()
{ {
// Retrieve objects from the plugin manager's object pool
// "In the extensionsInitialized method, a plugin can be sure that all
// plugins that depend on it are completely initialized."
// notify tools about the extensions initialized state
const QList<IAnalyzerTool *> tools = d->m_manager->tools(); const QList<IAnalyzerTool *> tools = d->m_manager->tools();
if (tools.isEmpty()) if (tools.isEmpty())
return; return;
const QSettings *settings = Core::ICore::instance()->settings(); const QSettings *settings = Core::ICore::instance()->settings();
const QString lastActiveToolId = settings->value(QLatin1String(lastActiveToolC), QString()).toString(); const QString lastActiveToolId =
settings->value(QLatin1String(lastActiveToolC), QString()).toString();
IAnalyzerTool *lastActiveTool = 0; IAnalyzerTool *lastActiveTool = 0;
foreach (IAnalyzerTool *tool, tools) { foreach (IAnalyzerTool *tool, tools) {
@@ -151,10 +136,6 @@ void AnalyzerPlugin::extensionsInitialized()
ExtensionSystem::IPlugin::ShutdownFlag AnalyzerPlugin::aboutToShutdown() ExtensionSystem::IPlugin::ShutdownFlag AnalyzerPlugin::aboutToShutdown()
{ {
// Save settings
// Disconnect from signals that are not needed during shutdown
// Hide UI (if you add UI that is not in the main window directly)
if (const IAnalyzerTool *tool = d->m_manager->currentTool()) { if (const IAnalyzerTool *tool = d->m_manager->currentTool()) {
QSettings *settings = Core::ICore::instance()->settings(); QSettings *settings = Core::ICore::instance()->settings();
settings->setValue(QLatin1String(lastActiveToolC), tool->id()); settings->setValue(QLatin1String(lastActiveToolC), tool->id());

View File

@@ -49,7 +49,6 @@
#include <QtCore/QDebug> #include <QtCore/QDebug>
using namespace Analyzer; using namespace Analyzer;
using namespace Analyzer::Internal;
// AnalyzerRunControl::Private /////////////////////////////////////////// // AnalyzerRunControl::Private ///////////////////////////////////////////

View File

@@ -1,186 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "ianalyzeroutputpaneadapter.h"
#include "analyzeroutputpane.h"
#include "ianalyzertool.h"
#include <utils/qtcassert.h>
#include <QtGui/QAbstractItemView>
#include <QtGui/QItemSelectionModel>
#include <QtCore/QAbstractItemModel>
#include <QtCore/QModelIndex>
namespace Analyzer {
IAnalyzerTool::IAnalyzerTool(QObject *parent) :
QObject(parent)
{
}
/*!
\class Analyzer::IAnalyzerOutputPaneAdapter
\brief Adapter for handling multiple tools in the common 'Analysis' output pane.
Provides the tool-specific output pane widget and optionally, a widget to be
inserted into into the toolbar. Ownership of them is taken by the output pane.
Forwards navigation calls issued by the output pane.
*/
IAnalyzerOutputPaneAdapter::IAnalyzerOutputPaneAdapter(QObject *parent) :
QObject(parent)
{
}
/*!
\class Analyzer::ListItemViewOutputPaneAdapter
\brief Utility class implementing wrap-around navigation for flat lists.
Provides an optional mechanism to pop up automatically in case errors show up.
*/
ListItemViewOutputPaneAdapter::ListItemViewOutputPaneAdapter(QObject *parent) :
IAnalyzerOutputPaneAdapter(parent), m_listView(0), m_showOnRowsInserted(true)
{
}
void ListItemViewOutputPaneAdapter::connectNavigationSignals(QAbstractItemModel *model)
{
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SIGNAL(navigationStatusChanged()));
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(slotRowsInserted()));
connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SIGNAL(navigationStatusChanged()));
connect(model, SIGNAL(modelReset()),
this, SIGNAL(navigationStatusChanged()));
}
void ListItemViewOutputPaneAdapter::slotRowsInserted()
{
if (m_showOnRowsInserted && !m_listView->isVisible())
emit popup(true);
}
QWidget *ListItemViewOutputPaneAdapter::paneWidget()
{
if (!m_listView) {
m_listView = createItemView();
if (QAbstractItemModel *model = m_listView->model())
connectNavigationSignals(model);
}
return m_listView;
}
void ListItemViewOutputPaneAdapter::setFocus()
{
if (m_listView)
m_listView->setFocus();
}
bool ListItemViewOutputPaneAdapter::hasFocus() const
{
return m_listView ? m_listView->hasFocus() : false;
}
bool ListItemViewOutputPaneAdapter::canFocus() const
{
return true;
}
bool ListItemViewOutputPaneAdapter::canNavigate() const
{
return true;
}
bool ListItemViewOutputPaneAdapter::canNext() const
{
return rowCount() > 0;
}
bool ListItemViewOutputPaneAdapter::canPrevious() const
{
return rowCount() > 0;
}
void ListItemViewOutputPaneAdapter::goToNext()
{
setCurrentRow((currentRow() + 1) % rowCount());
}
void ListItemViewOutputPaneAdapter::goToPrev()
{
const int prevRow = currentRow() - 1;
setCurrentRow(prevRow >= 0 ? prevRow : rowCount() - 1);
}
bool ListItemViewOutputPaneAdapter::showOnRowsInserted() const
{
return m_showOnRowsInserted;
}
void ListItemViewOutputPaneAdapter::setShowOnRowsInserted(bool v)
{
m_showOnRowsInserted = v;
}
int ListItemViewOutputPaneAdapter::currentRow() const
{
if (m_listView) {
const QModelIndex index = m_listView->selectionModel()->currentIndex();
if (index.isValid())
return index.row();
}
return -1;
}
void ListItemViewOutputPaneAdapter::setCurrentRow(int r)
{
QTC_ASSERT(m_listView, return)
const QModelIndex index = m_listView->model()->index(r, 0);
m_listView->selectionModel()->setCurrentIndex(index,
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
m_listView->scrollTo(index);
}
int ListItemViewOutputPaneAdapter::rowCount() const
{
return m_listView ? m_listView->model()->rowCount() : 0;
}
} // namespace Analyzer

View File

@@ -1,109 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (info@qt.nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#ifndef IANALYZEROUTPUTPANEADAPTER_H
#define IANALYZEROUTPUTPANEADAPTER_H
#include "analyzerbase_global.h"
#include <QtCore/QObject>
QT_BEGIN_NAMESPACE
class QAbstractItemView;
class QAbstractItemModel;
class QWidget;
QT_END_NAMESPACE
namespace Analyzer {
class ANALYZER_EXPORT IAnalyzerOutputPaneAdapter : public QObject
{
Q_OBJECT
public:
explicit IAnalyzerOutputPaneAdapter(QObject *parent = 0);
virtual QWidget *toolBarWidget() = 0;
virtual QWidget *paneWidget() = 0;
virtual void clearContents() = 0;
virtual void setFocus() = 0;
virtual bool hasFocus() const = 0;
virtual bool canFocus() const = 0;
virtual bool canNavigate() const = 0;
virtual bool canNext() const = 0;
virtual bool canPrevious() const = 0;
virtual void goToNext() = 0;
virtual void goToPrev() = 0;
signals:
void popup(bool withFocus);
void navigationStatusChanged();
};
class ANALYZER_EXPORT ListItemViewOutputPaneAdapter : public IAnalyzerOutputPaneAdapter
{
Q_OBJECT
public:
explicit ListItemViewOutputPaneAdapter(QObject *parent = 0);
virtual QWidget *paneWidget();
virtual void setFocus();
virtual bool hasFocus() const;
virtual bool canFocus() const;
virtual bool canNavigate() const;
virtual bool canNext() const;
virtual bool canPrevious() const;
virtual void goToNext();
virtual void goToPrev();
bool showOnRowsInserted() const;
void setShowOnRowsInserted(bool v);
protected:
int currentRow() const;
void setCurrentRow(int);
int rowCount() const;
void connectNavigationSignals(QAbstractItemModel *);
virtual QAbstractItemView *createItemView() = 0;
private slots:
void slotRowsInserted();
private:
QAbstractItemView *m_listView;
bool m_showOnRowsInserted;
};
} // namespace Analyzer
#endif // IANALYZEROUTPUTPANEADAPTER_H

View File

@@ -36,6 +36,10 @@
namespace Analyzer { namespace Analyzer {
IAnalyzerTool::IAnalyzerTool(QObject *parent)
: QObject(parent)
{}
QString IAnalyzerTool::modeString(ToolMode mode) QString IAnalyzerTool::modeString(ToolMode mode)
{ {
switch (mode) { switch (mode) {
@@ -49,11 +53,6 @@ QString IAnalyzerTool::modeString(ToolMode mode)
return QString(); return QString();
} }
IAnalyzerOutputPaneAdapter *IAnalyzerTool::outputPaneAdapter()
{
return 0;
}
void IAnalyzerTool::initializeDockWidgets() void IAnalyzerTool::initializeDockWidgets()
{ {
} }

View File

@@ -99,7 +99,6 @@ public:
*/ */
virtual void initializeDockWidgets(); virtual void initializeDockWidgets();
virtual IAnalyzerOutputPaneAdapter *outputPaneAdapter();
/// subclass to return a control widget which will be shown /// subclass to return a control widget which will be shown
/// in the output pane when this tool is selected /// in the output pane when this tool is selected
virtual QWidget *createControlWidget(); virtual QWidget *createControlWidget();
@@ -110,9 +109,6 @@ public:
/// @return true when this tool can be run remotely, e.g. on a meego or maemo device /// @return true when this tool can be run remotely, e.g. on a meego or maemo device
virtual bool canRunRemotely() const = 0; virtual bool canRunRemotely() const = 0;
/// @return true when this tool needs the output pane to be show on startup
virtual bool needsOutputPane() const = 0;
}; };
} // namespace Analyzer } // namespace Analyzer

View File

@@ -442,7 +442,7 @@ void QmlProfilerTool::attach()
connectClient(); connectClient();
AnalyzerManager::instance()->showMode(); AnalyzerManager::instance()->showMode();
AnalyzerManager::instance()->popupOutputPane(); //AnalyzerManager::instance()->popupOutputPane();
} else { } else {
stopRecording(); stopRecording();
} }

View File

@@ -62,7 +62,6 @@ public:
QWidget *createControlWidget(); QWidget *createControlWidget();
bool canRunRemotely() const; bool canRunRemotely() const;
bool needsOutputPane() const { return false; }
public slots: public slots:
void connectClient(); void connectClient();

View File

@@ -61,7 +61,6 @@ public:
QWidget *createControlWidget(); QWidget *createControlWidget();
bool canRunRemotely() const { return true; } bool canRunRemotely() const { return true; }
bool needsOutputPane() const { return false; }
private: private:
CallgrindToolPrivate *d; CallgrindToolPrivate *d;

View File

@@ -112,7 +112,6 @@ private slots:
private: private:
void ensureWidgets(); void ensureWidgets();
bool canRunRemotely() const; bool canRunRemotely() const;
bool needsOutputPane() const { return true; }
void initializeDockWidgets(); void initializeDockWidgets();
void initialize() {} void initialize() {}
void extensionsInitialized(); void extensionsInitialized();